HyukjinKwon commented on a change in pull request #33850:
URL: https://github.com/apache/spark/pull/33850#discussion_r701542412



##########
File path: python/pyspark/pandas/data_type_ops/binary_ops.py
##########
@@ -100,7 +99,9 @@ def astype(self, index_ops: IndexOpsLike, dtype: Union[str, 
type, Dtype]) -> Ind
         if isinstance(dtype, CategoricalDtype):
             return _as_categorical_type(index_ops, dtype, spark_type)
         elif isinstance(spark_type, BooleanType):
-            return _as_bool_type(index_ops, dtype)
+            # Cannot cast binary to boolean in Spark.
+            # We should cast binary to str first, and cast it to boolean
+            return index_ops.astype(str).astype(bool)

Review comment:
       can you describe in more details with the input/output before/after this 
change.




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