Skip to content

Commit

Permalink
Display projection
Browse files Browse the repository at this point in the history
  • Loading branch information
Dandandan committed Nov 4, 2023
1 parent 53b0cea commit 2dcc875
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ impl LogicalPlan {
projected_schema, ..
}) => projected_schema,
LogicalPlan::Projection(Projection { schema, .. }) => schema,
LogicalPlan::Filter(Filter { input, .. }) => input.schema(),
LogicalPlan::Filter(Filter {
projected_schema, ..
}) => projected_schema,
LogicalPlan::Distinct(Distinct { input }) => input.schema(),
LogicalPlan::Window(Window { schema, .. }) => schema,
LogicalPlan::Aggregate(Aggregate { schema, .. }) => schema,
Expand Down Expand Up @@ -1547,8 +1549,21 @@ impl LogicalPlan {
}
LogicalPlan::Filter(Filter {
predicate: ref expr,
projection,
projected_schema,
..
}) => write!(f, "Filter: {expr}"),
}) => {
if let Some(indices) = projection {
let names: Vec<&str> = indices
.iter()
.map(|i| projected_schema.field(*i).name().as_str())
.collect();

write!(f, "Filter: {expr}, projection=[{}]", names.join(", "))
} else {
write!(f, "Filter: {expr}")
}
}
LogicalPlan::Window(Window {
ref window_expr, ..
}) => {
Expand Down

0 comments on commit 2dcc875

Please sign in to comment.