Skip to content

fix missing window expressions when unparsing plans without outer projections#21801

Open
nathanb9 wants to merge 2 commits intoapache:mainfrom
nathanb9:fix/window-unparser-without-outer-projection
Open

fix missing window expressions when unparsing plans without outer projections#21801
nathanb9 wants to merge 2 commits intoapache:mainfrom
nathanb9:fix/window-unparser-without-outer-projection

Conversation

@nathanb9
Copy link
Copy Markdown
Contributor

@nathanb9 nathanb9 commented Apr 23, 2026

Summary

Addressing: #21746

Fixes a problem withplan_to_sql where window expressions could be dropped when unparsing plans that have a Window node without an outer Projection

PR solution

When unparsing a LogicalPlan::Window, if no projection has already reconstructed the output, the unparser now appends the window expressions itself. This preserves window outputs for plans like:

  • Window(TableScan)
  • Window(Aggregate(TableScan))
  • Basically stacked Window nodes without an outer projection

@github-actions github-actions Bot added the sql SQL Planner label Apr 23, 2026
@nathanb9 nathanb9 changed the title preserve window expressions when unparsing plans without outer projections fix missing window expressions when unparsing plans without outer projections Apr 23, 2026
@nathanb9 nathanb9 marked this pull request as ready for review April 23, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant