itholic commented on a change in pull request #33735:
URL: https://github.com/apache/spark/pull/33735#discussion_r689990823



##########
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.
   
   I added !




-- 
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-unsubscr...@spark.apache.org

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



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

Reply via email to