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


##########
python/pyspark/pandas/data_type_ops/num_ops.py:
##########
@@ -369,6 +376,9 @@ def floordiv(self, left: IndexOpsLike, right: Any) -> 
SeriesOrIndex:
         _sanitize_list_like(right)
         if not is_valid_operand_for_numeric_arithmetic(right):
             raise TypeError("Floor division can not be applied to given 
types.")
+        spark_session = left._internal.spark_frame.sparkSession
+        use_try_divide = is_ansi_mode_enabled(spark_session)
+        safe_div = F.try_divide if use_try_divide else lambda x, y: 
x.__div__(y)  # type: ignore

Review Comment:
   Sounds good, btw the code is adjusted to avoid E731



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