Skip to content

Commit c29d147

Browse files
committed
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! WIP
1 parent 9b576f3 commit c29d147

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

datafusion/sql/src/unparser/rewrite.rs

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use datafusion_common::{
2424
tree_node::{Transformed, TransformedResult, TreeNode},
2525
Result,
2626
};
27+
use datafusion_expr::tree_node::transform_sort_vec;
2728
use datafusion_expr::{Expr, LogicalPlan, Projection, Sort, SortExpr};
2829
use sqlparser::ast::Ident;
2930

@@ -86,11 +87,8 @@ pub(super) fn normalize_union_schema(plan: &LogicalPlan) -> Result<LogicalPlan>
8687
}
8788

8889
/// 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>> {
90-
// TODO FIXME
91-
// this impl does't compile
92-
/*
93-
let sort_exprs = transform_sort_vec(exprs, |expr| {
90+
fn rewrite_sort_expr_for_union(exprs: Vec<SortExpr>) -> Result<Vec<SortExpr>> {
91+
let sort_exprs = transform_sort_vec(exprs, &mut |expr| {
9492
expr.transform_up(|expr| {
9593
if let Expr::Column(mut col) = expr {
9694
col.relation = None;
@@ -103,31 +101,6 @@ fn rewrite_sort_expr_for_union(_exprs: Vec<SortExpr>) -> Result<Vec<SortExpr>> {
103101
.data()?;
104102

105103
Ok(sort_exprs)
106-
*/
107-
108-
/*
109-
original code:
110-
111-
fn rewrite_sort_expr_for_union(exprs: Vec<Expr>) -> Result<Vec<Expr>> {
112-
let sort_exprs: Vec<Expr> = exprs
113-
.into_iter()
114-
.map_until_stop_and_collect(|expr| {
115-
expr.transform_up(|expr| {
116-
if let Expr::Column(mut col) = expr {
117-
col.relation = None;
118-
Ok(Transformed::yes(Expr::Column(col)))
119-
} else {
120-
Ok(Transformed::no(expr))
121-
}
122-
})
123-
})
124-
.data()?;
125-
126-
Ok(sort_exprs)
127-
}
128-
*/
129-
130-
panic!("rewrite_sort_expr_for_union to be implemented");
131104
}
132105

133106
// Rewrite logic plan for query that order by columns are not in projections

0 commit comments

Comments
 (0)