Skip to content

Commit

Permalink
Require sort expressions to be of type Sort (#12171)
Browse files Browse the repository at this point in the history
* Require sort expressions to be of type Sort in compare_sort_expr

* fixup! Require sort expressions to be of type Sort in compare_sort_expr

* fixup! Require sort expressions to be of type Sort in compare_sort_expr
  • Loading branch information
findepi authored Aug 27, 2024
1 parent 58ed702 commit 4a94356
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion datafusion/expr/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ pub fn compare_sort_expr(
}
Ordering::Equal
}
_ => Ordering::Equal,
_ => panic!("Sort expressions must be of type Sort"),
}
}

Expand Down
4 changes: 3 additions & 1 deletion datafusion/sql/src/expr/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,10 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
Some(false)
};
}
Some(false)
} else {
panic!("order_by expression must be of type Sort");
}
Some(false)
});

let window_frame = window
Expand Down
2 changes: 2 additions & 0 deletions datafusion/sql/src/unparser/rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ pub(super) fn rewrite_plan_for_sort_on_non_projected_fields(
for expr in &sort.expr {
if let Expr::Sort(s) = expr {
collects.push(s.expr.as_ref().clone());
} else {
panic!("sort expression must be of type Sort");
}
}

Expand Down

0 comments on commit 4a94356

Please sign in to comment.