Skip to content

[GLUTEN-10605][VL] Rewrite unbounded window to an equivalent aggregate join#10606

Merged
zml1206 merged 2 commits intoapache:mainfrom
zml1206:10605
Sep 5, 2025
Merged

[GLUTEN-10605][VL] Rewrite unbounded window to an equivalent aggregate join#10606
zml1206 merged 2 commits intoapache:mainfrom
zml1206:10605

Conversation

@zml1206
Copy link
Copy Markdown
Contributor

@zml1206 zml1206 commented Sep 2, 2025

What changes are proposed in this pull request?

For unbounded window, velox needs to load the entire partition's data into memory for calculation, which can easily cause OOM when the partition is too large. This rule rewrites unbounded window to an equivalent aggregate join operation to avoid OOM.
Input query:

SELECT *, SUM(c0) OVER (PARTITION BY c1) AS sum FROM t

Rewritten query:

SELECT t.*, t1.sum FROM t LEFT JOIN (SELECT c1, SUM(c0) AS sum FROM t GROUP BY c1) t1  ON t. c1 <=> t1.c1

How was this patch tested?

UT

@github-actions github-actions bot added the VELOX label Sep 2, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 2, 2025

#10605

@zml1206
Copy link
Copy Markdown
Contributor Author

zml1206 commented Sep 3, 2025

@JkSelf What do you think of this feature? It should make up for some of the current shortcomings of Velox Window.

Copy link
Copy Markdown
Contributor

@JkSelf JkSelf left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for your improving.

@zml1206
Copy link
Copy Markdown
Contributor Author

zml1206 commented Sep 5, 2025

@JkSelf Thanks for review, merge into main.

@zml1206 zml1206 merged commit 84ac418 into apache:main Sep 5, 2025
53 checks passed
wForget pushed a commit to wForget/gluten that referenced this pull request Sep 23, 2025
@wForget wForget mentioned this pull request Sep 23, 2025
wForget added a commit to wForget/gluten that referenced this pull request Sep 23, 2025
wForget pushed a commit to wForget/gluten that referenced this pull request Oct 15, 2025
@zml1206 zml1206 deleted the 10605 branch December 9, 2025 08:11
zml1206 added a commit to zml1206/gluten that referenced this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants