comphead commented on code in PR #15639:
URL: https://github.com/apache/datafusion/pull/15639#discussion_r2035594591


##########
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:
   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);
       }
   }
   ```



-- 
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

Reply via email to