chenkovsky commented on code in PR #15639: URL: https://github.com/apache/datafusion/pull/15639#discussion_r2035659837
########## datafusion/sql/src/select.rs: ########## @@ -914,20 +906,35 @@ fn match_window_definitions( }) } } - } - // All named windows must be defined with a WindowSpec. - if let Some(WindowType::NamedWindow(ident)) = &f.over { - err = Some(DataFusionError::Plan(format!( - "The window {ident} is not defined!" - ))); - 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!( + "The window {ident} is not defined!" + ))); + return ControlFlow::Break(()); + } } } + ControlFlow::Continue(()) + }); + if let Some(err) = err { + return Err(err); } - ControlFlow::Continue(()) - }); - if let Some(err) = err { - return Err(err); + } + } + Ok(()) + } +} + +// 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() { Review Comment: I haven't modify 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: ########## @@ -914,20 +906,35 @@ fn match_window_definitions( }) } } - } - // All named windows must be defined with a WindowSpec. - if let Some(WindowType::NamedWindow(ident)) = &f.over { - err = Some(DataFusionError::Plan(format!( - "The window {ident} is not defined!" - ))); - 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!( + "The window {ident} is not defined!" + ))); + return ControlFlow::Break(()); + } } } + ControlFlow::Continue(()) + }); + if let Some(err) = err { + return Err(err); } - ControlFlow::Continue(()) - }); - if let Some(err) = err { - return Err(err); + } + } + Ok(()) + } +} + +// 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() { Review Comment: 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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org