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_r352618479
 
 

 ##########
 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:
   Test was added to existing method because it looks like it's common practice 
in the class. Of course it's easy to use new test method and I'll do it. What I 
want to say is that it doesn't change things much, even worse, the class won't 
have any consistency and will continue to confuse new contributors.

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