Hyukjin Kwon created SPARK-61075:
------------------------------------

             Summary: Convert values in toInternal and fromInternal of data 
types in the Python client as PySpark does
                 Key: SPARK-61075
                 URL: https://issues.apache.org/jira/browse/SPARK-61075
             Project: Spark
          Issue Type: Bug
          Components: Connect
    Affects Versions: connect-rust-4.3.0
            Reporter: Hyukjin Kwon


In PySpark Connect, the {{toInternal}} and {{fromInternal}} of a data type 
convert a Python value to the internal value of Spark and back, as for a 
{{DateType}} the days since the epoch, for a {{TimestampType}} or a 
{{TimestampNTZType}} the microseconds since the epoch, for a 
{{DayTimeIntervalType}} the microseconds of a timedelta, and for a 
{{StructType}}, an {{ArrayType}} and a {{MapType}} the values of their fields, 
elements, keys and values. A {{UserDefinedType}} converts the value that it 
serializes with its {{sqlType()}}.

The Rust-backed Python client returns the value itself for every data type: 
{{TimestampType().toInternal(datetime(2020, 1, 1))}} returns the datetime 
rather than 1577836800000000, and {{DateType().fromInternal(18262)}} returns 
18262 rather than the date 2020-01-01. Convert them 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