attilapiros commented on code in PR #53458:
URL: https://github.com/apache/spark/pull/53458#discussion_r2755491000


##########
python/pyspark/pandas/data_type_ops/base.py:
##########
@@ -199,8 +199,17 @@ def _as_string_type(
     else:
         casted = index_ops.spark.column.cast(spark_type)
         scol = F.when(index_ops.spark.column.isNull(), 
null_str).otherwise(casted)
+
+    # Always get nullable from the Spark schema after the cast.
+    # Binary->String can be nullable when UTF-8 validation is enabled.
+    temp_sdf = index_ops._internal.spark_frame.select(scol)

Review Comment:
   Should this logic be in `base.py`? 
   Since the source type isn't guaranteed to be Binary, it might be more 
appropriate to move this into binary_ops.py.



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