walterddr commented on code in PR #9870:
URL: https://github.com/apache/pinot/pull/9870#discussion_r1035275130


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/ShuffleRewriteVisitor.java:
##########
@@ -150,19 +147,11 @@ public Set<Integer> visitMailboxSend(MailboxSendNode 
node, Void context) {
   @Override
   public Set<Integer> visitProject(ProjectNode node, Void context) {
     Set<Integer> oldPartitionKeys = node.getInputs().get(0).visit(this, 
context);
-
-    // all inputs carry over if they're still in the projection result
-    Set<Integer> partitionKeys = new HashSet<>();
-    for (int i = 0; i < node.getProjects().size(); i++) {
-      RexExpression rex = node.getProjects().get(i);
-      if (rex instanceof RexExpression.InputRef) {
-        if (oldPartitionKeys.contains(((RexExpression.InputRef) 
rex).getIndex())) {
-          partitionKeys.add(i);
-        }
-      }
+    if (rexExpressionListContainsAllPartitionKey(node.getProjects(), 
oldPartitionKeys)) {

Review Comment:
   project can make a partition become unpartitioned. for example
   ```
   - Aggregation [ GroupSet = (0, 1, 2), AggCall = (...) ]
     - Project [ SelectList = [inputRef(0), inputRef(1), func(xx)], 
PartitionKeys = [] ]
       - MailboxReceived [ PartitionKeys = [inputRef(0), inputRef(1), 
inputRef(2)] ]
   ```
   we need to remove the PartitionKeys (no longer inputRef [0, 1, 2]) because 
even the group set is now (0, 1, 2) it is no longer the same 0, 1, 2 it was 
referring to
   



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to