Skip to content

Commit 86526fd

Browse files
committed
refactor: order_by_to_sort_expr
1 parent e0f3189 commit 86526fd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

datafusion/sql/src/expr/order_by.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
4747
literal_to_column: bool,
4848
additional_schema: Option<&DFSchema>,
4949
) -> Result<Vec<SortExpr>> {
50+
if order_by_exprs.is_empty() {
51+
return Ok(vec![]);
52+
}
53+
5054
let mut combined_schema;
5155
let order_by_schema = match additional_schema {
5256
Some(schema) => {
@@ -57,11 +61,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
5761
None => input_schema,
5862
};
5963

60-
if order_by_exprs.is_empty() {
61-
return Ok(vec![]);
62-
}
63-
64-
let mut sort_expr_vec = vec![];
64+
let mut sort_expr_vec = Vec::with_capacity(order_by_exprs.len());
6565

6666
let make_sort_expr =
6767
|expr: Expr, asc: Option<bool>, nulls_first: Option<bool>| {

0 commit comments

Comments
 (0)