NobiGo commented on code in PR #4402:
URL: https://github.com/apache/calcite/pull/4402#discussion_r2134234209


##########
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 consider 0 as unsafe, while other numbers are safe. `MIN_INT / -1`I also 
have doubts about this, but I will consider it safe here because it actually 
depends on the return type of the operator. 



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

Reply via email to