danny0405 commented on a change in pull request #1448: [CALCITE-3332] Query 
failed with AssertionError: cannot cast null as class java.math.BigDecima
URL: https://github.com/apache/calcite/pull/1448#discussion_r323659868
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/sql/fun/SqlMonotonicBinaryOperator.java
 ##########
 @@ -55,12 +55,22 @@ public SqlMonotonicBinaryOperator(
   //~ Methods ----------------------------------------------------------------
 
   @Override public SqlMonotonicity getMonotonicity(SqlOperatorBinding call) {
+    // specially handle cases with null operands
+    if (hasNullOperand(call)) {
+      switch (this.kind) {
+      case PLUS:
+      case MINUS:
+      case TIMES:
+        return SqlMonotonicity.CONSTANT;
 
 Review comment:
   I'm a little confused why you handle `+`, `-`, `*` in 
`SqlMonotonicBinaryOperator` and `DIVIDE` in `SqlBinaryOperator`, did you try 
`SqlKind.BINARY_ARITHMETIC` ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to