allisonwang-db commented on code in PR #50160:
URL: https://github.com/apache/spark/pull/50160#discussion_r1982284472
##########
python/pyspark/sql/udf.py:
##########
@@ -128,6 +130,18 @@ def _create_py_udf(
else:
is_arrow_enabled = useArrow
+ if is_arrow_enabled:
+ try:
+ require_minimum_pandas_version()
+ require_minimum_pyarrow_version()
+ except ImportError:
+ is_arrow_enabled = False
+ warnings.warn(
+ "Arrow optimization failed to enable because PyArrow/pandas is
not installed. "
Review Comment:
This looks good! But it would be great to make it consistent with above.
##########
python/pyspark/sql/connect/udf.py:
##########
@@ -77,6 +79,17 @@ def _create_py_udf(
eval_type: int = PythonEvalType.SQL_BATCHED_UDF
if is_arrow_enabled:
+ try:
+ require_minimum_pandas_version()
+ require_minimum_pyarrow_version()
+ except ImportError:
+ is_arrow_enabled = False
+ warnings.warn(
+ "Arrow optimization failed to enable because PyArrow is not
installed. "
Review Comment:
nit: Looks like we also need Pandas here
```suggestion
"Arrow optimization failed to enable because PyArrow or
Pandas is not installed. "
```
--
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]