vlsi commented on a change in pull request #1044: [CALCITE-2838] 
Simplification: Remove redundant IS TRUE/IS NOT FALSE …
URL: https://github.com/apache/calcite/pull/1044#discussion_r256890036
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rex/RexSimplify.java
 ##########
 @@ -494,10 +494,16 @@ private RexNode simplifyNot(RexCall call, RexUnknownAs 
unknownAs) {
     return call;
   }
 
-  private RexNode simplifyIs(RexCall call) {
+  private RexNode simplifyIs(RexCall call, RexUnknownAs unknownAs) {
     final SqlKind kind = call.getKind();
-    final RexNode a = call.getOperands().get(0);
-
+    final RexNode argument = call.getOperands().get(0);
+    if (kind == SqlKind.IS_TRUE && unknownAs == RexUnknownAs.FALSE) {
+      return simplify(argument, unknownAs);
+    }
+    if (kind == SqlKind.IS_NOT_FALSE && unknownAs == RexUnknownAs.TRUE) {
+      return simplify(argument, unknownAs);
+    }
+    final RexNode a = simplify(call.getOperands().get(0), 
RexUnknownAs.UNKNOWN);
 
 Review comment:
   @kgyrtkirk , I agree: https://issues.apache.org/jira/browse/CALCITE-2449 :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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