Description
Currently, if a Python UDTF outputs a type that is incompatible with the specified output schema, Spark will throw the following confusing error message:
File "pyarrow/array.pxi", line 1044, in pyarrow.lib.Array.from_pandas File "pyarrow/array.pxi", line 316, in pyarrow.lib.array File "pyarrow/array.pxi", line 83, in pyarrow.lib._ndarray_to_array File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Could not convert [1, 2] with type list: tried to convert to int32
We should improve this.