You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "HTHou (via GitHub)" <gi...@apache.org> on 2023/02/02 01:21:52 UTC

[GitHub] [iotdb] HTHou commented on a diff in pull request #8953: Correct DataPartiton Fetch request parameter contruction

HTHou commented on code in PR #8953:
URL: https://github.com/apache/iotdb/pull/8953#discussion_r1093914940


##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/SourceRewriter.java:
##########
@@ -953,21 +965,43 @@ private void calculateGroupByLevelNodeAttributes(
       // Check every OutputColumn of GroupByLevelNode and set the Expression of corresponding
       // AggregationDescriptor
       List<CrossSeriesAggregationDescriptor> descriptorList = new ArrayList<>();
+      Map<String, Expression> columnNameToExpression = context.getColumnNameToExpression();
+      Set<Expression> childrenExpressionSet = new HashSet<>();
+      for (String childColumn : childrenOutputColumns) {
+        Expression childExpression =
+            columnNameToExpression.get(
+                childColumn.substring(childColumn.indexOf("(") + 1, childColumn.lastIndexOf(")")));
+        childrenExpressionSet.add(childExpression);
+      }
+
       for (CrossSeriesAggregationDescriptor originalDescriptor :
           handle.getGroupByLevelDescriptors()) {
         Set<Expression> descriptorExpressions = new HashSet<>();
-        for (String childColumn : childrenOutputColumns) {
-          // If this condition matched, the childColumn should come from GroupByLevelNode
-          if (isAggColumnMatchExpression(childColumn, originalDescriptor.getOutputExpression())) {
-            descriptorExpressions.add(originalDescriptor.getOutputExpression());
-            continue;
-          }
-          for (Expression exp : originalDescriptor.getInputExpressions()) {
-            if (isAggColumnMatchExpression(childColumn, exp)) {
-              descriptorExpressions.add(exp);
-            }
+
+        if (childrenExpressionSet.contains(originalDescriptor.getOutputExpression())) {
+          descriptorExpressions.add(originalDescriptor.getOutputExpression());
+        }
+
+        for (Expression exp : originalDescriptor.getInputExpressions()) {
+          if (childrenExpressionSet.contains(exp)) {
+            descriptorExpressions.add(exp);
           }
         }
+
+        //        for (String childColumn : childrenOutputColumns) {
+        //          // If this condition matched, the childColumn should come from GroupByLevelNode
+        //          if (isAggColumnMatchExpression(childColumn,
+        // originalDescriptor.getOutputExpression())) {
+        //            descriptorExpressions.add(originalDescriptor.getOutputExpression());
+        //            continue;
+        //          }
+        //          for (Expression exp : originalDescriptor.getInputExpressions()) {
+        //            if (isAggColumnMatchExpression(childColumn, exp)) {
+        //              descriptorExpressions.add(exp);
+        //            }
+        //          }
+        //        }
+

Review Comment:
   Remove this?



-- 
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: reviews-unsubscribe@iotdb.apache.org

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