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


##########
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:
   Ok. I get your point.
   ```
     /**
      * Returns whether this is a safe operator.
      *
      * <p>If an operator is safe, then it never causes a run-time exception.
      *
      * <p>For example, the {@code a/b} is not safe. Because the
      * {@code SqlStdOperatorTable.DIVIDE} may throw the exception when 
dividing by zero.
      *
      * <p>By default, returns {@code false}, which means the operator is not 
safe.
      *
      * <p>If an operator is safe, then some optimizations can be performed in
      * {@code org.apache.calcite.rex.RexSimplify}.
      *
      * <p>For example:
      * {@code NULL + a} can be optimized to {@code NULL}.
      *
      */
   ```



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