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

Hyukjin Kwon updated SPARK-62251:
---------------------------------
    Description: 
PySpark 4.3.0's data types keep their parameters in their __dict__ (precision, 
scale, hasPrecisionInfo, collation, elementType, fields, names, _needConversion 
and the others), and a subclass with __slots__ raises PySpark's pickle error. 
The Python client keeps them in its native types. Keep them in the __dict__ of 
the types, from which the core type derives, as PySpark's types do, and raise 
PySpark's pickle error of a __slots__ subclass. The known-differences row of 
subclasses then documents exactly the parts that are inherent: a singleton's 
__init__ runs at each call, and a class with two native bases of different 
layouts conflicts. Related: SPARK-62229 (copy.copy of a StructType shares) and 
SPARK-62231 (the constructor of a StructType subclass).


Also: simpleString(), repr() and treeString() of fields, structs, arrays and 
maps read the native values of the attributes that a subclass overrides with a 
property. PySpark gives struct<a:string> and StructField('a', StringType(), 
True); the Python client gives struct<a:bigint> and StructField('a', 
LongType(), True). The same fix applies: the native methods read the attributes 
as Python reads them.

  was:
PySpark 4.3.0's data types keep their parameters in their __dict__ (precision, 
scale, hasPrecisionInfo, collation, elementType, fields, names, _needConversion 
and the others), and a subclass with __slots__ raises PySpark's pickle error. 
The Python client keeps them in its native types. Keep them in the __dict__ of 
the types, from which the core type derives, as PySpark's types do, and raise 
PySpark's pickle error of a __slots__ subclass. The known-differences row of 
subclasses then documents exactly the parts that are inherent: a singleton's 
__init__ runs at each call, and a class with two native bases of different 
layouts conflicts. Related: SPARK-62229 (copy.copy of a StructType shares) and 
SPARK-62231 (the constructor of a StructType subclass).



> Keep the parameters of the data types in their __dict__, as PySpark's types 
> do, and raise PySpark's pickle error of a __slots__ subclass
> ----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-62251
>                 URL: https://issues.apache.org/jira/browse/SPARK-62251
>             Project: Spark
>          Issue Type: Improvement
>          Components: Connect
>    Affects Versions: 5.0.0
>            Reporter: Hyukjin Kwon
>            Priority: Major
>
> PySpark 4.3.0's data types keep their parameters in their __dict__ 
> (precision, scale, hasPrecisionInfo, collation, elementType, fields, names, 
> _needConversion and the others), and a subclass with __slots__ raises 
> PySpark's pickle error. The Python client keeps them in its native types. 
> Keep them in the __dict__ of the types, from which the core type derives, as 
> PySpark's types do, and raise PySpark's pickle error of a __slots__ subclass. 
> The known-differences row of subclasses then documents exactly the parts that 
> are inherent: a singleton's __init__ runs at each call, and a class with two 
> native bases of different layouts conflicts. Related: SPARK-62229 (copy.copy 
> of a StructType shares) and SPARK-62231 (the constructor of a StructType 
> subclass).
> Also: simpleString(), repr() and treeString() of fields, structs, arrays and 
> maps read the native values of the attributes that a subclass overrides with 
> a property. PySpark gives struct<a:string> and StructField('a', StringType(), 
> True); the Python client gives struct<a:bigint> and StructField('a', 
> LongType(), True). The same fix applies: the native methods read the 
> attributes as Python reads them.



--
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