You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/12/02 12:05:04 UTC

[GitHub] [calcite] chunweilei commented on a change in pull request #1610: [CALCITE-3525] RexSimplify: eliminate redundant rex calls in OR

chunweilei commented on a change in pull request #1610: [CALCITE-3525] RexSimplify: eliminate redundant rex calls in OR
URL: https://github.com/apache/calcite/pull/1610#discussion_r352559995
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/test/RexProgramTest.java
 ##########
 @@ -1738,6 +1738,20 @@ private void checkExponentialCnf(int n) {
         "OR(null, <>(0, ?0.int0))",
         "<>(0, ?0.int0)",
         "true");
+
+    // (a=1 or a=2 or (arr[1]>4 and arr[1]<3 and a=3)) => a=1 or a=2
+    final RelDataType intArrayType = typeFactory.createArrayType(intType, -1);
+    final RexInputRef ref0 = rexBuilder.makeInputRef(intType, 0);
+    final RexInputRef ref3 = rexBuilder.makeInputRef(intArrayType, 3);
+    final RexCall itm1 = (RexCall) rexBuilder.makeCall(intType, SqlStdOperatorTable.ITEM,
+        ImmutableList.of(ref3, literal1));
+    simplify = this.simplify.withParanoid(false);
+    checkSimplifyFilter(
+        or(eq(ref0, literal1), eq(ref0, literal2),
 
 Review comment:
   That's what I am worried about. This method contains too many tests.

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


With regards,
Apache Git Services