ueshin commented on code in PR #50972:
URL: https://github.com/apache/spark/pull/50972#discussion_r2112725869


##########
python/pyspark/pandas/data_type_ops/num_ops.py:
##########
@@ -247,14 +247,22 @@ def truediv(self, left: IndexOpsLike, right: Any) -> 
SeriesOrIndex:
         _sanitize_list_like(right)
         if not is_valid_operand_for_numeric_arithmetic(right):
             raise TypeError("True division can not be applied to given types.")
+        right = transform_boolean_operand_to_numeric(right, 
spark_type=left.spark.data_type)
 
         def truediv(left: PySparkColumn, right: Any) -> PySparkColumn:
-            return F.when(
-                F.lit(right != 0) | F.lit(right).isNull(),
-                left.__div__(right),
-            ).otherwise(F.lit(np.inf).__div__(left))
+            if not get_option("compute.ansi_mode_support"):

Review Comment:
   Shall we check both `spark.sql.ansi.enabled` and it to avoid any changes for 
non-ANSI?
   Also related, could you extract the config check to some util method to 
reuse it in other places.



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