Skip to content

Commit

Permalink
fixup! fixup! fixup! WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Aug 26, 2024
1 parent e67b44b commit f2a254f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
19 changes: 10 additions & 9 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ use datafusion_common::{
// backwards compatibility
use crate::display::PgJsonVisitor;
use crate::logical_plan::tree_node::unwrap_arc;
use crate::tree_node::replace_sort_expressions;
pub use datafusion_common::display::{PlanType, StringifiedPlan, ToStringifiedPlan};
pub use datafusion_common::{JoinConstraint, JoinType};

Expand Down Expand Up @@ -887,15 +888,15 @@ impl LogicalPlan {
Aggregate::try_new(Arc::new(inputs.swap_remove(0)), expr, agg_expr)
.map(LogicalPlan::Aggregate)
}
LogicalPlan::Sort(Sort { /*fetch,*/ .. }) => {
// TODO FIXME
// LogicalPlan::Sort(Sort { fetch, .. }) => Ok(LogicalPlan::Sort(Sort {
// expr,
// input: Arc::new(inputs.swap_remove(0)),
// fetch: *fetch,
// })),
internal_err!("with_ew_exprs not implemented for Sort")
},
LogicalPlan::Sort(Sort {
expr: sort_expr,
fetch,
..
}) => Ok(LogicalPlan::Sort(Sort {
expr: replace_sort_expressions(sort_expr.clone(), expr),
input: Arc::new(inputs.swap_remove(0)),
fetch: *fetch,
})),
LogicalPlan::Join(Join {
join_type,
join_constraint,
Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr/src/logical_plan/tree_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ impl LogicalPlan {
.visit_sibling(|| filter.iter().apply_until_stop(f))
}
LogicalPlan::Sort(Sort { expr, .. }) => {
expr.iter().apply_until_stop(|sort| f(&*sort.expr))
expr.iter().apply_until_stop(|sort| f(&sort.expr))
}
LogicalPlan::Extension(extension) => {
// would be nice to avoid this copy -- maybe can
Expand Down
4 changes: 2 additions & 2 deletions datafusion/expr/src/tree_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl TreeNode for Expr {
expr_vec.push(f.as_ref());
}
if let Some(order_by) = order_by {
expr_vec.extend(order_by.into_iter().map(|sort| sort.expr.as_ref()));
expr_vec.extend(order_by.iter().map(|sort| sort.expr.as_ref()));
}
expr_vec
}
Expand All @@ -109,7 +109,7 @@ impl TreeNode for Expr {
}) => {
let mut expr_vec = args.iter().collect::<Vec<_>>();
expr_vec.extend(partition_by);
expr_vec.extend(order_by.into_iter().map(|sort| sort.expr.as_ref()));
expr_vec.extend(order_by.iter().map(|sort| sort.expr.as_ref()));
expr_vec
}
Expr::InList(InList { expr, list, .. }) => {
Expand Down
1 change: 0 additions & 1 deletion datafusion/optimizer/src/common_subexpr_eliminate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,6 @@ enum ExprMask {
/// - [`Columns`](Expr::Column)
/// - [`ScalarVariable`](Expr::ScalarVariable)
/// - [`Alias`](Expr::Alias)
/// - [`Sort`](Expr::Sort)
/// - [`Wildcard`](Expr::Wildcard)
/// - [`AggregateFunction`](Expr::AggregateFunction)
Normal,
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sql/src/unparser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl Unparser<'_> {
};
let order_by: Vec<ast::OrderByExpr> = order_by
.iter()
.map(|expr| sort_to_sql(expr))
.map(sort_to_sql)
.collect::<Result<Vec<_>>>()?;

let start_bound = self.convert_bound(&window_frame.start_bound)?;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sql/src/unparser/rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub(super) fn normalize_union_schema(plan: &LogicalPlan) -> Result<LogicalPlan>
}

/// Rewrite sort expressions that have a UNION plan as their input to remove the table reference.
fn rewrite_sort_expr_for_union(exprs: Vec<SortExpr>) -> Result<Vec<SortExpr>> {
fn rewrite_sort_expr_for_union(_exprs: Vec<SortExpr>) -> Result<Vec<SortExpr>> {
// TODO FIXME
// this impl does't compile
/*
Expand Down

0 comments on commit f2a254f

Please sign in to comment.