-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: normalize window ident #15639
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
fix: normalize window ident #15639
Conversation
|
||
// If there are any multiple-defined windows, we raise an error. | ||
fn check_conflicting_windows(window_defs: &[NamedWindowDefinition]) -> Result<()> { | ||
for (i, window_def_i) in window_defs.iter().enumerate() { |
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.
is this method for identifying duplicate named windows? if so probably we can simplify this a little bit like
let mut seen = HashSet::new();
for (name, _) in window_defs {
if !seen.insert(name) {
return plan_err!("The window {} is defined multiple times!", name);
}
}
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 haven't modified this method, It was there before I changed this file. I think your suggestion make sense, but maybe we can change it in another PR.
datafusion/sql/src/select.rs
Outdated
return ControlFlow::Break(()); | ||
// All named windows must be defined with a WindowSpec. | ||
if let Some(WindowType::NamedWindow(ident)) = &f.over { | ||
err = Some(DataFusionError::Plan(format!( |
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.
@chenkovsky can you make a favor and change this to plan_err!
?
4 11 | ||
5 16 | ||
|
||
# window definitions with aliases |
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.
is it the same test as above? 🤔
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.
the difference is lower case & upper case.
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.
Thanks @chenkovsky this lgtm
Thanks @chenkovsky and @comphead |
* fix: normalize window name * format
Which issue does this PR close?
Rationale for this change
ident normalizer is not called.
What changes are included in this PR?
normalize ident before comparing window name.
Are these changes tested?
UT
Are there any user-facing changes?
NO