leonardBang commented on a change in pull request #1491: [CALCITE-3368] Some 
problems simplifying ‘expression IS NULL’ 
URL: https://github.com/apache/calcite/pull/1491#discussion_r333917737
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rex/RexCall.java
 ##########
 @@ -204,7 +204,7 @@ public RelDataType getType() {
     // This reduction allows us to convert it to a semi-join.
     switch (getKind()) {
     case IS_NOT_NULL:
-      return !operands.get(0).getType().isNullable();
+      return RexSimplify.isSafeExpression(this) && 
!operands.get(0).getType().isNullable();
 
 Review comment:
   > we seem to be covered for this already by that the operators result is 
nullable even if all the inputs are non-nullable
   > 
   > ```java
   >   @Test public void testUnsafeSimplify1() {
   >     assertFalse(vIntNotNull(0).getType().isNullable());
   >     assertTrue(plus(vIntNotNull(0), 
vIntNotNull(1)).getType().isNullable());
   >     RexCall c= (RexCall)isNotNull(plus(vIntNotNull(0), vIntNotNull(1)));
   >     assertFalse(c.isAlwaysFalse());
   >     assertFalse(c.isAlwaysTrue());
   >   }
   > ```
   the ' assertTrue(plus(vIntNotNull(0), 
vIntNotNull(1)).getType().isNullable());' case will fail,
   that I miss something ?
   
   
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to