Skip to content

Commit

Permalink
revert: from_plan keep same schema Agg/Window in #6820
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener committed Jul 3, 2023
1 parent a08ea21 commit 3224f44
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions datafusion/expr/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,19 +821,23 @@ pub fn from_plan(
input: Arc::new(inputs[0].clone()),
})),
},
LogicalPlan::Window(Window { window_expr, .. }) => {
Ok(LogicalPlan::Window(Window::try_new(
expr[0..window_expr.len()].to_vec(),
Arc::new(inputs[0].clone()),
)?))
}
LogicalPlan::Aggregate(Aggregate { group_expr, .. }) => {
Ok(LogicalPlan::Aggregate(Aggregate::try_new(
Arc::new(inputs[0].clone()),
expr[0..group_expr.len()].to_vec(),
expr[group_expr.len()..].to_vec(),
)?))
}
LogicalPlan::Window(Window {
window_expr,
schema,
..
}) => Ok(LogicalPlan::Window(Window {
input: Arc::new(inputs[0].clone()),
window_expr: expr[0..window_expr.len()].to_vec(),
schema: schema.clone(),
})),
LogicalPlan::Aggregate(Aggregate {
group_expr, schema, ..
}) => Ok(LogicalPlan::Aggregate(Aggregate::try_new_with_schema(
Arc::new(inputs[0].clone()),
expr[0..group_expr.len()].to_vec(),
expr[group_expr.len()..].to_vec(),
schema.clone(),
)?)),
LogicalPlan::Sort(SortPlan { fetch, .. }) => Ok(LogicalPlan::Sort(SortPlan {
expr: expr.to_vec(),
input: Arc::new(inputs[0].clone()),
Expand Down

0 comments on commit 3224f44

Please sign in to comment.