File tree 6 files changed +15
-15
lines changed
6 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ use datafusion_common::{
54
54
// backwards compatibility
55
55
use crate :: display:: PgJsonVisitor ;
56
56
use crate :: logical_plan:: tree_node:: unwrap_arc;
57
+ use crate :: tree_node:: replace_sort_expressions;
57
58
pub use datafusion_common:: display:: { PlanType , StringifiedPlan , ToStringifiedPlan } ;
58
59
pub use datafusion_common:: { JoinConstraint , JoinType } ;
59
60
@@ -887,15 +888,15 @@ impl LogicalPlan {
887
888
Aggregate :: try_new ( Arc :: new ( inputs. swap_remove ( 0 ) ) , expr, agg_expr)
888
889
. map ( LogicalPlan :: Aggregate )
889
890
}
890
- LogicalPlan :: Sort ( Sort { /*fetch,*/ .. } ) => {
891
- // TODO FIXME
892
- // LogicalPlan::Sort(Sort { fetch, .. }) => Ok(LogicalPlan::Sort(Sort {
893
- // expr,
894
- // input: Arc::new(inputs.swap_remove(0)),
895
- // fetch: *fetch ,
896
- // } )),
897
- internal_err ! ( "with_ew_exprs not implemented for Sort" )
898
- } ,
891
+ LogicalPlan :: Sort ( Sort {
892
+ expr : sort_expr ,
893
+ fetch,
894
+ ..
895
+ } ) => Ok ( LogicalPlan :: Sort ( Sort {
896
+ expr : replace_sort_expressions ( sort_expr . clone ( ) , expr ) ,
897
+ input : Arc :: new ( inputs . swap_remove ( 0 ) ) ,
898
+ fetch : * fetch ,
899
+ } ) ) ,
899
900
LogicalPlan :: Join ( Join {
900
901
join_type,
901
902
join_constraint,
Original file line number Diff line number Diff line change @@ -491,7 +491,7 @@ impl LogicalPlan {
491
491
. visit_sibling ( || filter. iter ( ) . apply_until_stop ( f) )
492
492
}
493
493
LogicalPlan :: Sort ( Sort { expr, .. } ) => {
494
- expr. iter ( ) . apply_until_stop ( |sort| f ( & * sort. expr ) )
494
+ expr. iter ( ) . apply_until_stop ( |sort| f ( & sort. expr ) )
495
495
}
496
496
LogicalPlan :: Extension ( extension) => {
497
497
// would be nice to avoid this copy -- maybe can
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ impl TreeNode for Expr {
97
97
expr_vec. push ( f. as_ref ( ) ) ;
98
98
}
99
99
if let Some ( order_by) = order_by {
100
- expr_vec. extend ( order_by. into_iter ( ) . map ( |sort| sort. expr . as_ref ( ) ) ) ;
100
+ expr_vec. extend ( order_by. iter ( ) . map ( |sort| sort. expr . as_ref ( ) ) ) ;
101
101
}
102
102
expr_vec
103
103
}
@@ -109,7 +109,7 @@ impl TreeNode for Expr {
109
109
} ) => {
110
110
let mut expr_vec = args. iter ( ) . collect :: < Vec < _ > > ( ) ;
111
111
expr_vec. extend ( partition_by) ;
112
- expr_vec. extend ( order_by. into_iter ( ) . map ( |sort| sort. expr . as_ref ( ) ) ) ;
112
+ expr_vec. extend ( order_by. iter ( ) . map ( |sort| sort. expr . as_ref ( ) ) ) ;
113
113
expr_vec
114
114
}
115
115
Expr :: InList ( InList { expr, list, .. } ) => {
Original file line number Diff line number Diff line change @@ -886,7 +886,6 @@ enum ExprMask {
886
886
/// - [`Columns`](Expr::Column)
887
887
/// - [`ScalarVariable`](Expr::ScalarVariable)
888
888
/// - [`Alias`](Expr::Alias)
889
- /// - [`Sort`](Expr::Sort)
890
889
/// - [`Wildcard`](Expr::Wildcard)
891
890
/// - [`AggregateFunction`](Expr::AggregateFunction)
892
891
Normal ,
Original file line number Diff line number Diff line change @@ -253,7 +253,7 @@ impl Unparser<'_> {
253
253
} ;
254
254
let order_by: Vec < ast:: OrderByExpr > = order_by
255
255
. iter ( )
256
- . map ( |expr| sort_to_sql ( expr ) )
256
+ . map ( sort_to_sql)
257
257
. collect :: < Result < Vec < _ > > > ( ) ?;
258
258
259
259
let start_bound = self . convert_bound ( & window_frame. start_bound ) ?;
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ pub(super) fn normalize_union_schema(plan: &LogicalPlan) -> Result<LogicalPlan>
86
86
}
87
87
88
88
/// Rewrite sort expressions that have a UNION plan as their input to remove the table reference.
89
- fn rewrite_sort_expr_for_union ( exprs : Vec < SortExpr > ) -> Result < Vec < SortExpr > > {
89
+ fn rewrite_sort_expr_for_union ( _exprs : Vec < SortExpr > ) -> Result < Vec < SortExpr > > {
90
90
// TODO FIXME
91
91
// this impl does't compile
92
92
/*
You can’t perform that action at this time.
0 commit comments