xinrong-meng commented on code in PR #52182:
URL: https://github.com/apache/spark/pull/52182#discussion_r2316793513


##########
python/pyspark/pandas/data_type_ops/boolean_ops.py:
##########
@@ -237,6 +237,12 @@ def rmod(self, left: IndexOpsLike, right: Any) -> 
SeriesOrIndex:
 
     def __and__(self, left: IndexOpsLike, right: Any) -> SeriesOrIndex:
         _sanitize_list_like(right)
+        if (
+            is_ansi_mode_enabled(left._internal.spark_frame.sparkSession)
+            and self.dtype == bool

Review Comment:
   We need to check `self.dtype == bool` because
   
   ```py
   >>> pd.Series([True, False, np.nan]) | None
   0    False
   1    False
   2    False
   
   >>> ps.Series([True, False, np.nan]).dtype
   dtype('O')
   >>> ps.Series([True, False, np.nan]).spark.data_type
   BooleanType()
   ```
   `BooleanType()` will direct the code path here, but we want to support 
(instead of TypeError) this case, so we check `dtype` explicitly



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