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


##########
core/src/main/java/org/apache/calcite/sql/SqlOperator.java:
##########
@@ -1036,6 +1036,19 @@ public <R> void acceptCall(
     return null;
   }
 
+  /**
+   * Returns whether this is a safe operator that doesn't throw any exception.
+   *
+   * <p> If an operator is a safe operator, we will check its parameters to 
determine
+   * if the entire expression is safe.
+   *
+   * <p>For example, {@code 1/0 + null} is not safe. Because even though the
+   * {@code SqlStdOperatorTable.PLUS} is safe operator but its operands is not 
safe.
+   */
+  public Boolean isSafeOperator() {

Review Comment:
   the design of this function deserves some discussion



##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -1385,10 +1391,34 @@ enum SafeRexVisitor implements RexVisitor<Boolean> {
     }
 
     @Override public Boolean visitCall(RexCall call) {
-      if (!safeOps.contains(call.getKind())) {
+      SqlKind sqlKind = call.getKind();
+      SqlOperator sqlOperator = call.getOperator();
+
+      switch (sqlKind) {
+      case DIVIDE:

Review Comment:
   these features are really not related to the issue being solved.
   if you want to improve the precision of the safety computation, I think you 
should file a separate issue and move these changes there.
   we should also discuss the APIs for doing that



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