retikulum commented on code in PR #3824:
URL: https://github.com/apache/arrow-datafusion/pull/3824#discussion_r995911930
##########
datafusion/optimizer/src/simplify_expressions.rs:
##########
@@ -794,13 +794,20 @@ impl<'a, S: SimplifyInfo> ExprRewriter for Simplifier<'a,
S> {
op: Divide,
right,
} if is_null(&right) => *right,
- // A / A --> 1 (if a is not nullable)
+ // 0 / 0 -> null
Review Comment:
I approached it a little bit complex than I should have. A / 0 is undefined
however 0/0 is indeterminate so I represent undefined as error and
indeterminate as null. Also, expected behavior in the #3615 pointed that `col /
col` should return `null` when `col = 0`. I checked other languages and see
that python implemented both (A/0 and 0/0) to return an error. Moreover, I like
the offered solution. If it is OK for others, I am ready to change necessary
parts. Thanks.
--
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]