You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3cba937
Browse filesBrowse the repository at this point in the historyBrowse files
fix missing window expressions when unparsing plans without outer projections (apache#21801)
## Summary
Addressing: apache#21746
Fixes a problem with`plan_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
Additionally:
* `DISTINCT`, `LIMIT`, `SORT`, `UNION`, and child `Projection`
boundaries are preserved by deriving the window input before appending
window output.
* Window expressions over derived inputs are rewritten to reference the
derived input alias.
* Aggregate unprojection now stops at `Subquery` / `SubqueryAlias`
boundaries, so outer windows reference derived columns instead of
incorrectly looking through the subquery.
---------
Co-authored-by: Dmitrii Blaginin <[email protected]>
0 commit comments