You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by "Zouxxyy (via GitHub)" <gi...@apache.org> on 2025/12/07 08:59:29 UTC

[PR] [VL] Correct the conversion from `AggregateRel.groupings` to `AggregationNode.groupingKeys`. [incubator-gluten]

Zouxxyy opened a new pull request, #11264:
URL: https://github.com/apache/incubator-gluten/pull/11264

   <!--
   Thank you for submitting a pull request! Here are some tips:
   
   1. For first-time contributors, please read our contributing guide:
      https://github.com/apache/incubator-gluten/blob/main/CONTRIBUTING.md
   2. If necessary, create a GitHub issue for discussion beforehand to avoid duplicate work.
   3. If the PR is specific to a single backend, include [VL] or [CH] in the PR title to indicate the
      Velox or ClickHouse backend, respectively.
   4. If the PR is not ready for review, please mark it as a draft.
   -->
   
   Currently, Velox's `AggregationNode` only supports a single grouping keys list,
   
   ```cpp
   AggregationNode(
       const PlanNodeId& id,
       Step step,
       const std::vector<FieldAccessTypedExprPtr>& groupingKeys,
       const std::vector<FieldAccessTypedExprPtr>& preGroupedKeys,
       const std::vector<std::string>& aggregateNames,
       const std::vector<Aggregate>& aggregates,
       bool ignoreNullKeys,
       PlanNodePtr source);
   ```
   
   whereas the groupings field in `AggregateRel` is actually a list of grouping keys list.
   
   ```
   message AggregateRel {
     ...
     repeated Grouping groupings = 3;
     message Grouping {
       repeated Expression grouping_expressions = 1;
     }
    ...
   }
   ```
   
   Therefore, the correct conversion is:
   
   - Map `AggregateRel.groupings[0]` to `AggregationNode`'s `groupingKeys`,
   - And throw an exception if the number of groupings is greater than 1.
   
   ## What changes are proposed in this pull request?
   
   <!--
   Provide a clear and concise description of the changes introduced in this PR.
   Ensure the PR description aligns with the code changes, especially after updates.
   If applicable, include "Fixes #<GitHub_Issue_ID>" to automatically close the corresponding issue
   when the PR is merged.
   -->
   
   ## How was this patch tested?
   
   <!--
   Describe how the changes were tested, if applicable.
   Include new tests to validate the functionality, if necessary.
   For UI-related changes, attach screenshots to demonstrate the updates.
   -->
   


-- 
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-unsubscribe@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Correct the conversion from `AggregateRel.groupings` to `AggregationNode.groupingKeys`. [incubator-gluten]

Posted by "FelixYBW (via GitHub)" <gi...@apache.org>.
FelixYBW commented on PR #11264:
URL: https://github.com/apache/incubator-gluten/pull/11264#issuecomment-3639874396

   So then root cause is that Velox's AggregationNode can't use a single grouping set to simulate multiple groups as below
   
   ```
   [groupings[0].key[0],groupings[0].key[1],groupings[1].key[0],groupings[1].key[1]]
   ```
   
   we have to implement multiple groups support in AggregationNode. 
   
   Right?


-- 
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-unsubscribe@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Correct the conversion from `AggregateRel.groupings` to `AggregationNode.groupingKeys`. [incubator-gluten]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11264:
URL: https://github.com/apache/incubator-gluten/pull/11264#issuecomment-3621835842

   Run Gluten Clickhouse CI on x86


-- 
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-unsubscribe@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Correct the conversion from `AggregateRel.groupings` to `AggregationNode.groupingKeys`. [incubator-gluten]

Posted by "FelixYBW (via GitHub)" <gi...@apache.org>.
FelixYBW commented on PR #11264:
URL: https://github.com/apache/incubator-gluten/pull/11264#issuecomment-3632475892

   Original design is to put all groupings into velox group keys. 
   Is there any cases we may generate more than 1 AggregateRel.groupings? Will it cause issue on original design?
   
   


-- 
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-unsubscribe@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Correct the conversion from `AggregateRel.groupings` to `AggregationNode.groupingKeys`. [incubator-gluten]

Posted by "Zouxxyy (via GitHub)" <gi...@apache.org>.
Zouxxyy commented on PR #11264:
URL: https://github.com/apache/incubator-gluten/pull/11264#issuecomment-3624149535

   CC @rui-mo @PHILO-HE for a look, thanks


-- 
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-unsubscribe@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Correct the conversion from `AggregateRel.groupings` to `AggregationNode.groupingKeys`. [incubator-gluten]

Posted by "Zouxxyy (via GitHub)" <gi...@apache.org>.
Zouxxyy commented on PR #11264:
URL: https://github.com/apache/incubator-gluten/pull/11264#issuecomment-3633197535

   > Original design is to put all groupings into velox group keys. Is there any cases we may generate more than 1 AggregateRel.groupings? Will it cause issue on original design?
   
   Currently, `AggregateRel.groupings` is actually a `List<List<keys>>`, representing multiple grouping sets. However, Velox's AggregationNode only supports a single grouping set.
   
   In the current implementation of AggregateRelNode.toProtobuf, only groupings[0] = groupingKeys is populated.
   
   I discovered this issue because we have developed an AggregationNode that supports multiple grouping sets. 
   
   In this PR, no proto changes are made—only defensive code is added. In fact, you’ll notice that the following two nested loops look quite odd:
   
   ```c++
   for (const auto& grouping : aggRel.groupings()) {
     for (const auto& groupingExpr : grouping.grouping_expressions()) {
       // Velox's groupings are limited to be Field.
       veloxGroupingExprs.emplace_back(exprConverter_->toVeloxExpr(groupingExpr.selection(), inputType));
     }
   }
   ```


-- 
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-unsubscribe@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Correct the conversion from `AggregateRel.groupings` to `AggregationNode.groupingKeys` [incubator-gluten]

Posted by "PHILO-HE (via GitHub)" <gi...@apache.org>.
PHILO-HE merged PR #11264:
URL: https://github.com/apache/incubator-gluten/pull/11264


-- 
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-unsubscribe@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Correct the conversion from `AggregateRel.groupings` to `AggregationNode.groupingKeys`. [incubator-gluten]

Posted by "Zouxxyy (via GitHub)" <gi...@apache.org>.
Zouxxyy commented on PR #11264:
URL: https://github.com/apache/incubator-gluten/pull/11264#issuecomment-3639922082

   > So then root cause is that Velox's AggregationNode can't use a single grouping set to simulate multiple groups as below
   > 
   > ```
   > [groupings[0].key[0],groupings[0].key[1],groupings[1].key[0],groupings[1].key[1]]
   > ```
   > 
   > we have to implement multiple groups support in AggregationNode.
   > 
   > Right?
   
   Yes, it only accept
   
   ```
   [groupings[0].key[0],groupings[0].key[1],groupings[0].key[2],groupings[0].key[3]]
   ```
   
   BTY, in the case of multiple groups, the aggregates functions also need to be a list of list.


-- 
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-unsubscribe@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [VL] Correct the conversion from `AggregateRel.groupings` to `AggregationNode.groupingKeys`. [incubator-gluten]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11264:
URL: https://github.com/apache/incubator-gluten/pull/11264#issuecomment-3621839282

   Run Gluten Clickhouse CI on x86


-- 
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-unsubscribe@gluten.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org