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_r323072738
 
 

 ##########
 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:
   I'm not sure if we can make the assumption "if operand1 is null the the 
monotonicity is always CONSTANT" for every binary operator, and i think this 
change is radical.

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