[ 
https://issues.apache.org/jira/browse/SPARK-60117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lisa Cao updated SPARK-60117:
-----------------------------
    Description: 
Since 4.2.0, regular Python UDFs are Arrow-optimized by default (SPARK-54555), 
but the PySpark K8s image only installs python3 and python3-pip, so a plain 
{{@udf}} fails on it:

{noformat}
ModuleNotFoundError: No module named 'pyarrow'
{noformat}

Installing {{pyarrow>=18.0.0}} fixes it for about 160 MB. I left pandas out 
since only pandas UDFs need it. Tested by building master's Dockerfiles over 
the 4.3.0-rc1 distribution and running UDFs through Spark Connect.

PR: https://github.com/apache/spark/pull/59280 (first raised in 
apache/spark-docker#137)

  was:
Since Spark 4.2.0, regular Python UDFs are Arrow-optimized by default 
(SPARK-54555), but the PySpark K8s Docker image 
(resource-managers/kubernetes/docker/src/main/dockerfiles/spark/bindings/python/Dockerfile)
 only installs python3 and python3-pip. A plain {{@udf}} with no options fails 
on it:

{noformat}
ModuleNotFoundError: No module named 'pyarrow'
{noformat}

Tested by building the base and PySpark images from master's Dockerfiles over 
the 4.3.0-rc1 distribution and running UDFs through Spark Connect:

||UDF||current image||with pyarrow||
|{{@udf}} (default)|ModuleNotFoundError: No module named 'pyarrow'|OK|
|{{@udf(useArrow=False)}}|OK|OK|
|{{@pandas_udf}}|ModuleNotFoundError: No module named 'pandas'|unchanged|

The proposal is to install only {{pyarrow>=18.0.0}} (PySpark's minimum), which 
adds about 160 MB; pandas is left out because only pandas UDFs need it. PR: 
https://github.com/apache/spark/pull/59280

Originally raised against apache/spark-docker (#137, #138), whose images mirror 
this Dockerfile.


> Install PyArrow in PySpark K8s Dockerfile
> -----------------------------------------
>
>                 Key: SPARK-60117
>                 URL: https://issues.apache.org/jira/browse/SPARK-60117
>             Project: Spark
>          Issue Type: Bug
>          Components: Kubernetes
>    Affects Versions: 4.2.0
>            Reporter: Lisa Cao
>            Priority: Major
>
> Since 4.2.0, regular Python UDFs are Arrow-optimized by default 
> (SPARK-54555), but the PySpark K8s image only installs python3 and 
> python3-pip, so a plain {{@udf}} fails on it:
> {noformat}
> ModuleNotFoundError: No module named 'pyarrow'
> {noformat}
> Installing {{pyarrow>=18.0.0}} fixes it for about 160 MB. I left pandas out 
> since only pandas UDFs need it. Tested by building master's Dockerfiles over 
> the 4.3.0-rc1 distribution and running UDFs through Spark Connect.
> PR: https://github.com/apache/spark/pull/59280 (first raised in 
> apache/spark-docker#137)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to