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

ASF GitHub Bot updated SPARK-60962:
-----------------------------------
    Labels: pull-request-available  (was: )

> Pickle user-defined types as Python objects, and make them of arguments, in 
> the Python client as PySpark does
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-60962
>                 URL: https://issues.apache.org/jira/browse/SPARK-60962
>             Project: Spark
>          Issue Type: Bug
>          Components: Connect
>    Affects Versions: connect-rust-4.3.0
>            Reporter: Hyukjin Kwon
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: connect-rust-4.3.0
>
>
> In PySpark, a user-defined type is a Python object: it pickles as its class 
> and its state, so cloudpickle sends a class that a notebook or script 
> defines, in {{__main__}}, by value, and a UDT of parameters keeps them; and 
> as {{DataType.__new__}} is {{object.__new__}}, a UDT whose {{__init__}} takes 
> arguments is made with them. So a UDT of {{__main__}}, of parameters too, can 
> be the return type of a UDF.
> The Rust-backed Python client pickles a UDT as its JSON, which the worker 
> rebuilds with {{UserDefinedType.fromJson}}: that imports the class by its 
> module, which {{__main__}} on the worker does not define, so {{udf(f, 
> returnType=PointUDT())}} fails on the worker with {{UNSUPPORTED_OPERATION}}, 
> and a UDT whose {{__init__}} takes arguments or keeps state is rebuilt 
> without them. A UDT whose {{__init__}} takes arguments cannot even be made: 
> {{PointUDT(10.0)}} raises {{TypeError: DataType.__new__() takes 0 positional 
> arguments}}. Pickle and make UDTs as PySpark does.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to