You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2023/09/14 03:48:11 UTC

[GitHub] [spark] zhengruifeng commented on a diff in pull request #42920: [WIP][SPARK-45143][PYTHON][CONNECT] Make PySpark compatible with PyArrow 13.0.0

zhengruifeng commented on code in PR #42920:
URL: https://github.com/apache/spark/pull/42920#discussion_r1325319963


##########
python/pyspark/pandas/typedef/typehints.py:
##########
@@ -293,7 +293,9 @@ def spark_type_to_pandas_dtype(
         ),
     ):
         return np.dtype("object")
-    elif isinstance(spark_type, types.TimestampType):
+    elif isinstance(spark_type, types.DayTimeIntervalType):
+        return np.dtype("timedelta64[ns]")
+    elif isinstance(spark_type, (types.TimestampType, types.TimestampNTZType)):
         return np.dtype("datetime64[ns]")
     else:
         return np.dtype(to_arrow_type(spark_type).to_pandas_dtype())

Review Comment:
   the behavior of `to_arrow_type(spark_type).to_pandas_dtype()` changed, e.g.:
   
    `to_arrow_type(DayTimeIntervalType)` -> `pa.timestamp("us", tz="UTC")` -> `datetime64[us, UTC]` in 13.0.0, but `datetime64[ns, UTC]` in 12.0.1



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org