mihaibudiu commented on code in PR #4402:
URL: https://github.com/apache/calcite/pull/4402#discussion_r2133954842
##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -1385,12 +1393,66 @@ enum SafeRexVisitor implements RexVisitor<Boolean> {
}
@Override public Boolean visitCall(RexCall call) {
- if (!safeOps.contains(call.getKind())) {
+ SqlKind sqlKind = call.getKind();
+ switch (sqlKind) {
+ case DIVIDE:
+ case MOD:
+ List<RexNode> operands = call.getOperands();
+ // For example:
+ // a/b ==>
+ // if a is not safe then a/b is not safe
Review Comment:
I am not sure I understand what's going on here.
But dividing by -1 is not safe, since MIN_INT / -1 causes an overflow
--
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]