Skip to content

Hive: Support DISTRIBUTE BY and SORT BY in window specs#2340

Open
wugeer wants to merge 4 commits into
apache:mainfrom
wugeer:fix_over_distibute_by_and_sort_by
Open

Hive: Support DISTRIBUTE BY and SORT BY in window specs#2340
wugeer wants to merge 4 commits into
apache:mainfrom
wugeer:fix_over_distibute_by_and_sort_by

Conversation

@wugeer

@wugeer wugeer commented May 9, 2026

Copy link
Copy Markdown
Contributor

Add Hive-gated parsing for window specs that use DISTRIBUTE BY and SORT BY, and preserve the original clause kinds in WindowSpec display output.

fix: #2339

Comment thread src/ast/mod.rs
/// `OVER (PARTITION BY ...)`
pub partition_by: Vec<Expr>,
/// The kind of partitioning clause used in the window specification.
pub partition_by_kind: WindowPartitionByKind,

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.

for partition and order by kind, can we instead wrap the field with the enum instead of introducing a new field? i.e.

partition_by: WindowPartitionByKind

// where 
enum WindowPartitionByKind {
     PartitionBy(Vec<Expr>)
     DistributeBy(Vec<Expr>)
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a good idea, but the change is very disruptive. Wouldn't it be better to open a separate PR for it?

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.

not sure it would make sense as a separate PR given this one, since such a PR would be undoing the changes made by this one

Comment thread src/ast/mod.rs Outdated
Comment thread src/dialect/mod.rs Outdated
@wugeer wugeer force-pushed the fix_over_distibute_by_and_sort_by branch from 5047be1 to c7fb3f6 Compare June 18, 2026 10:27
@wugeer wugeer requested a review from iffyio June 18, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hive dialect does not support distribute by or sort by in window specs

2 participants