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

 ##########
 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:
   Franky, I'm also confused why we need `SqlMonotonicBinaryOperator`. 
According to the doc, it just used to differentiate the cases with 
at-least-one-side `SqlMonotonicity.CONSTANT`. However, its implementation only 
enumerates (+, -, *). Therefore, I handle them separately. 
   I incline to remove `SqlMonotonicBinaryOperator` and move all these logic 
into `SqlBinaryOperator`, but I'm not sure whether I missed something. How 
about your idea?

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