Skip to content

[VL] Option to insert partial-merge aggregations for eager aggregation - #13086

Draft
zhztheplayer wants to merge 1 commit into
apache:mainfrom
zhztheplayer:wip-eager-intermediate
Draft

zhztheplayer wants to merge 1 commit into
apache:mainfrom
zhztheplayer:wip-eager-intermediate

Conversation

@zhztheplayer

Copy link
Copy Markdown
Member

The patch adds a new option to enable more intermediate aggregations when eager aggregation (experimental) is enabled.

Copilot AI lite review requested due to automatic review settings September 22, 2026 04:38
@github-actions github-actions Bot added CORE works for Gluten Core VELOX DOCS labels Sep 22, 2026
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

It changes logical/physical aggregation semantics across joins (including new wrapper phases), so a final human review is recommended to validate correctness/performance across broader query patterns.

Review effort: Lite
Findings: None

What changed in this PR

This PR adds an optional “PartialMerge-after-each-push” mode to the join-aggregate pushdown optimization, allowing additional intermediate aggregation/merge steps when pushing wrapper aggregates across multi-join shapes (experimental eager aggregation path).

Changes:

  • Added spark.gluten.sql.pushAggregateThroughJoin.partialMerge.enabled to optionally insert a PartialMerge wrapper aggregate above each pushed join edge.
  • Extended join-aggregate wrapper semantics with a new PartialMergePhase and updated the physical planning strategy to lower it correctly.
  • Expanded/updated join-aggregate pushdown test coverage to validate plan shapes (aggregate node counts) with PartialMerge enabled vs disabled.
File Description
gluten-substrait/​src/​test/​scala/​org/​apache/​gluten/​execution/​PushAggregateThroughJoinSuite.scala Extends test matrix to assert additional wrapper aggregates appear when partial-merge is enabled.
gluten-substrait/​src/​main/​scala/​org/​apache/​gluten/​extension/​joinagg/​PushAggregateThroughJoin.scala Adds config-gated insertion of a PartialMerge wrapper layer while continuing to push the lower Partial wrapper through joins.
gluten-substrait/​src/​main/​scala/​org/​apache/​gluten/​extension/​joinagg/​JoinAggregateFunctionWrapper.scala Introduces PartialMergePhase and updates semantic-mode mapping and wrapper semantics accordingly.
gluten-substrait/​src/​main/​scala/​org/​apache/​gluten/​extension/​joinagg/​ImplementJoinAggregate.scala Adds physical lowering support for PartialMergePhase and refactors planning into a shared phase implementation.
gluten-substrait/​src/​main/​scala/​org/​apache/​gluten/​config/​GlutenConfig.scala Registers the new dynamic SQLConf option and exposes it via GlutenConfig.
docs/​Configuration.md Documents the new configuration key and default.
backends-velox/​src/​test/​scala/​org/​apache/​gluten/​execution/​StarSchemaJoinAggregateSuite.scala Adds a dedicated suite variant with partial-merge enabled and sets an explicit default in the base suite.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The patch adds a new option to enable more intermediate aggregations when eager aggregation (experimental) is enabled.
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core DOCS VELOX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants