HyukjinKwon opened a new pull request, #50083:
URL: https://github.com/apache/spark/pull/50083
### What changes were proposed in this pull request?
This PR proposes to require pandas as well for Arrow-optimized Python UDF
### Why are the changes needed?
Now it fails as below:
```
Driver stacktrace:)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../spark/python/pyspark/sql/classic/dataframe.py", line 285, in
show
print(self._show_string(n, truncate, vertical))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.../spark/python/pyspark/sql/classic/dataframe.py", line 303, in
_show_string
return self._jdf.showString(n, 20, vertical)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.../spark/python/lib/py4j-0.10.9.9-src.zip/py4j/java_gateway.py",
line 1362, in __call__
File "/.../spark/python/pyspark/errors/exceptions/captured.py", line 258,
in deco
raise converted from None
pyspark.errors.exceptions.captured.PythonException:
An exception was thrown from the Python worker. Please see the stack trace
below.
Traceback (most recent call last):
File "/.../spark/python/lib/pyspark.zip/pyspark/worker.py", line 2012, in
main
func, profiler, deserializer, serializer = read_udfs(pickleSer, infile,
eval_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.../spark/python/lib/pyspark.zip/pyspark/worker.py", line 1922, in
read_udfs
read_single_udf(
File "/.../spark/python/lib/pyspark.zip/pyspark/worker.py", line 897, in
read_single_udf
return wrap_arrow_batch_udf(func, args_offsets, kwargs_offsets,
return_type, runner_conf)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.../spark/python/lib/pyspark.zip/pyspark/worker.py", line 192, in
wrap_arrow_batch_udf
def evaluate(*args: pd.Series) -> pd.Series:
^^^^^^^^^
AttributeError: module 'pandas' has no attribute 'Series'
```
We should require it.
### Does this PR introduce _any_ user-facing change?
Yes, it requires pandas now explicitly.
### How was this patch tested?
Manually tested.
### Was this patch authored or co-authored using generative AI tooling?
No.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]