suibianwanwank commented on code in PR #4033:
URL: https://github.com/apache/calcite/pull/4033#discussion_r1830322530


##########
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##########
@@ -3148,7 +3148,7 @@ private void 
checkPushJoinThroughUnionOnRightDoesNotMatchSemiOrAntiJoin(JoinRelT
     sql(sql)
         .withRule(CoreRules.UNION_TO_VALUES)
         .withInSubQueryThreshold(0)
-        .check();
+        .checkUnchanged();

Review Comment:
   I would optimize this part, for setting  simplifyValues to false we can do 
this optimization, and also for that reason I keep this rule



##########
core/src/test/java/org/apache/calcite/tools/PlannerTest.java:
##########
@@ -452,11 +452,6 @@ private void emptyUnions32(UnionMergeRule... extraRules)
         + "  EnumerableValues(tuples=[[{ 1 }]])\n"
         + "  EnumerableValues(tuples=[[{ 2 }]])\n";
 
-    checkUnionPruning("values(1)"

Review Comment:
   Originally this test would return:
   `EnumerableValues(tuples=[[{ 1 }, { 2 }]])`
   This is a little different from the plan above, it has to do with the order 
in which the Values are created, Values with Filters can't be merged, they are 
converted to unions. 
   I'm not sure I need to add back this test.



##########
core/src/test/resources/sql/sub-query.iq:
##########
@@ -3452,9 +3452,8 @@ EnumerableCalc(expr#0..12=[{inputs}], expr#13=[0:BIGINT], 
expr#14=[=($t8, $t13)]
           EnumerableAggregate(group=[{}], agg#0=[COUNT()], agg#1=[COUNT($0)])
             EnumerableValues(tuples=[[{ null }, { 7782 }]])
     EnumerableSort(sort0=[$0], dir0=[ASC])
-      EnumerableAggregate(group=[{0}], agg#0=[MIN($1)])
-        EnumerableCalc(expr#0=[{inputs}], expr#1=[true], proj#0..1=[{exprs}])
-          EnumerableValues(tuples=[[{ null }, { 7782 }]])
+      EnumerableCalc(expr#0=[{inputs}], expr#1=[true], proj#0..1=[{exprs}])

Review Comment:
   AggregateRemoveRule is applied, The difference is in the metadata of the 
extracted UNION
   ```
   if (!SqlFunctions.isTrue(mq.areColumnsUnique(input, 
aggregate.getGroupSet()))) {
         return;
   }
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to