-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Refactor/simplify window frame utils #11648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/simplify window frame utils #11648
Conversation
| .order_by(order_by) | ||
| .window_frame(window_frame) | ||
| .build() | ||
| .unwrap()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a nice improvement too
| || frame.end_bound.is_unbounded()) | ||
| { | ||
| plan_err!("RANGE requires exactly one ORDER BY column")? | ||
| /// Returns whether the window frame can accept multiple ORDER BY expressons. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this is much nicer
alamb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @ozankabak -- this looks like a nice improvement to me
datafusion/expr/src/window_frame.rs
Outdated
| order_by.push(Expr::Sort(Sort::new( | ||
| Box::new(Expr::Literal(ScalarValue::UInt64(Some(1)))), | ||
| true, | ||
| false, | ||
| ))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW you can write this more succinctly with the expr API like this I think
| order_by.push(Expr::Sort(Sort::new( | |
| Box::new(Expr::Literal(ScalarValue::UInt64(Some(1)))), | |
| true, | |
| false, | |
| ))); | |
| order_by.push(lit(1u64).sort(true, false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed much nicer, thank you -- added
mustafasrepo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!.
|
Did a Rust version update just land? CI checks were passing in-branch, but we have clippy and doc failures on CI post merge. |
Which issue does this PR close?
Closes #.
Rationale for this change
Reducing API clutter for checking/verifying/regularizing window frames.
What changes are included in this PR?
Apart from the said API simplification, fixes the window fuzz tests to make it clear when streaming execution is not possible. Also removes some unwrap calls from window related code.
Are these changes tested?
Yes
Are there any user-facing changes?
A very minor change at the API level: The
regularizefunction becomes a method ofWindowFrame