xinrong-databricks commented on a change in pull request #33735:
URL: https://github.com/apache/spark/pull/33735#discussion_r688775535



##########
File path: python/pyspark/pandas/data_type_ops/datetime_ops.py
##########
@@ -135,9 +136,7 @@ def astype(self, index_ops: IndexOpsLike, dtype: Union[str, 
type, Dtype]) -> Ind
         elif isinstance(spark_type, StringType):
             if isinstance(dtype, extension_dtypes):
                 # seems like a pandas' bug?
-                scol = F.when(index_ops.spark.column.isNull(), 
str(pd.NaT)).otherwise(
-                    index_ops.spark.column.cast(spark_type)
-                )
+                return _as_string_type(index_ops, dtype)

Review comment:
       It would be nice to say that `null_str` is for non-extension dtypes only 
in the docstring of `_as_string_type`. I may also file a follow-up PR if needed.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to