Hyukjin Kwon created SPARK-61191:
------------------------------------
Summary: Pickle WindowSpec, so UDFs and foreachBatch functions can
capture windows, in the Python client as PySpark does
Key: SPARK-61191
URL: https://issues.apache.org/jira/browse/SPARK-61191
Project: Spark
Issue Type: Bug
Components: Connect
Affects Versions: connect-rust-4.3.0
Reporter: Hyukjin Kwon
A WindowSpec (Window.partitionBy(...).orderBy(...)) could not be pickled:
pickle, cloudpickle and copy.copy raised TypeError: cannot pickle
'pyspark.sql.window.WindowSpec' object. PySpark's WindowSpec is a plain Python
object that pickles, so a UDF or foreachBatch function that captures a window
failed at serialization on this client.
Repro: cloudpickle.dumps(lambda df:
df.select(F.row_number().over(Window.partitionBy("k").orderBy("x")))) raises
TypeError; official pickles it, and the function runs on the server's worker.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]