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

 ##########
 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:
   How did you measure when it's too many tests in the method? As you may 
notice the practice of making tests as small as possible was already sacrificed 
long time ago. And refactoring of tests is out of scope of this PR. 

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