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



##########
File path: python/pyspark/pandas/data_type_ops/boolean_ops.py
##########
@@ -15,7 +15,27 @@
 # limitations under the License.
 #
 
-from pyspark.pandas.data_type_ops.base import DataTypeOps
+import numbers
+from typing import TYPE_CHECKING, Union
+
+import numpy as np
+from pandas.api.types import CategoricalDtype
+
+from pyspark.pandas.base import column_op, IndexOpsMixin, numpy_column_op
+from pyspark.pandas.data_type_ops.base import DataTypeOps, 
transform_boolean_operand_to_numeric
+from pyspark.pandas.typedef.typehints import as_spark_type
+from pyspark.sql import Column, functions as F
+from pyspark.sql.types import NumericType
+
+if TYPE_CHECKING:
+    from pyspark.pandas.indexes import Index  # noqa: F401 (SPARK-34943)
+    from pyspark.pandas.series import Series  # noqa: F401 (SPARK-34943)
+
+
+def is_numeric_index_ops(index_ops: IndexOpsMixin) -> bool:
+    """Check if the given index_ops is numeric IndexOpsMixin."""
+    return isinstance(index_ops.spark.data_type, NumericType) and (
+        not isinstance(index_ops.dtype, CategoricalDtype))

Review comment:
       `is_valid_operand_for_numeric_arithmetic`  returns True for 
`BooleanType`, whereas `is_numeric_index_ops ` returns False for `BooleanType`.
   
   We may also pass in a boolean flag deciding how to deal with `BooleanType`. 
How do you think about this?




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

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