Skip to content

Commit 3a8e7c7

Browse files
authored
Update select.rs
1 parent 6f46e73 commit 3a8e7c7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

datafusion/sql/src/select.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,8 @@ fn match_window_definitions(
860860
if let SelectItem::ExprWithAlias { expr, alias: _ }
861861
| SelectItem::UnnamedExpr(expr) = proj
862862
{
863-
let result = visit_expressions_mut(expr, |expr| {
863+
let mut err = None;
864+
visit_expressions_mut(expr, |expr| {
864865
if let SQLExpr::Function(f) = expr {
865866
if let Some(WindowType::NamedWindow(_)) = &f.over {
866867
for NamedWindowDefinition(window_ident, window_expr) in
@@ -881,18 +882,18 @@ fn match_window_definitions(
881882
}
882883
// All named windows must be defined with a WindowSpec.
883884
if let Some(WindowType::NamedWindow(ident)) = &f.over {
884-
return ControlFlow::Break(DataFusionError::Plan(format!(
885+
err = Some(DataFusionError::Plan(format!(
885886
"The window {ident} is not defined!"
886887
)));
888+
return ControlFlow::Break(());
887889
}
888890
}
889891
}
890892
ControlFlow::Continue(())
891893
});
892-
match result {
893-
ControlFlow::Continue(_) => (),
894-
ControlFlow::Break(err) => return Err(err),
895-
};
894+
if let Some(err) = err {
895+
return Err(err);
896+
}
896897
}
897898
}
898899
Ok(())

0 commit comments

Comments
 (0)