Skip to content

fix: prevent CSE from extracting window functions - #24750

Open
cdelmonte-zg wants to merge 1 commit into
apache:mainfrom
cdelmonte-zg:fix-15190-window-cse
Open

fix: prevent CSE from extracting window functions#24750
cdelmonte-zg wants to merge 1 commit into
apache:mainfrom
cdelmonte-zg:fix-15190-window-cse

Conversation

@cdelmonte-zg

@cdelmonte-zg cdelmonte-zg commented Aug 28, 2026

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

Common subexpression elimination can extract duplicated window functions into an intermediate Projection. Since window functions cannot be evaluated by a projection, this produces a plan that fails during physical planning.

What changes are included in this PR?

Exclude WindowFunction expressions themselves from CSE extraction and add a regression test.

Are these changes tested?

Yes. A regression test verifies that duplicated window functions remain in the WindowAggr node.

Are there any user-facing changes?

Queries affected by #15190 no longer fail during physical planning. No documentation changes are required.

@github-actions github-actions Bot added the optimizer Optimizer rules label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

optimizer Optimizer rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSE may extract Window functions into a Project node

1 participant