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_r323085897
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/sql/SqlBinaryOperator.java
 ##########
 @@ -186,6 +186,10 @@ public RelDataType deriveType(
       final SqlMonotonicity mono0 = call.getOperandMonotonicity(0);
       final SqlMonotonicity mono1 = call.getOperandMonotonicity(1);
       if (mono1 == SqlMonotonicity.CONSTANT) {
+        // e.g., mono / null --> constant (null)
+        if (call.isOperandNull(1, true)) {
+          return SqlMonotonicity.CONSTANT;
+        }
 
 Review comment:
   The monotonicity inference is in the "logic" layer, we should not rely on 
the runtime execution to ensure the semantics, enumerate the operators would be 
more clear to me.

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