[
https://issues.apache.org/jira/browse/SPARK-62260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Hyukjin Kwon resolved SPARK-62260.
----------------------------------
Fix Version/s: connect-rust-4.4.0
Resolution: Fixed
Issue resolved by pull request 947
[https://github.com/apache/spark-connect-rust/pull/947]
> Import the modules that the native classes of the Python client name in their
> __module__ when their objects are made, so that cloudpickle pickles them by
> reference, as it does PySpark's
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: SPARK-62260
> URL: https://issues.apache.org/jira/browse/SPARK-62260
> Project: Spark
> Issue Type: Bug
> Components: Connect
> Affects Versions: 5.0.0
> Reporter: Hyukjin Kwon
> Assignee: Hyukjin Kwon
> Priority: Major
> Labels: pull-request-available
> Fix For: connect-rust-4.4.0
>
>
> cloudpickle pickles a class by reference only when the module that its
> __module__ names is in sys.modules. The native GroupedData,
> PandasCogroupedOps and StreamingQuery of the Python client name
> pyspark.sql.connect.group and pyspark.sql.connect.streaming.query, but the
> paths that make their objects (df.groupBy, the start of a stream) do not
> import those modules. So a foreachBatch function that captures one pickles
> the class by value, and the server's Python worker fails with
> "AttributeError: type object 'GroupedData' has no attribute 'agg'". PySpark's
> classes are defined in those modules, which are imported when their objects
> are made.
> test_dropin_e2e.py::test_foreach_batch_captures_the_readers_writers_and_groups_as_pyspark
> fails when run alone and passes in the full run only because earlier tests
> import the modules. Import the modules that the native classes name when
> their objects are made, so that cloudpickle pickles them by reference, as it
> does PySpark's.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]