Skip to content

Commit

Permalink
recompute schema
Browse files Browse the repository at this point in the history
  • Loading branch information
yyy1000 committed May 14, 2024
1 parent b7b910d commit adb7435
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,16 +628,12 @@ impl LogicalPlan {
node: node.from_template(&expr, &inputs),
}))
}
LogicalPlan::Union(Union { inputs, schema }) => {
let input_schema = inputs[0].schema();
// If inputs are not pruned do not change schema
// TODO this seems wrong (shouldn't we always use the schema of the input?)
let schema = if schema.fields().len() == input_schema.fields().len() {
schema.clone()
} else {
input_schema.clone()
};
Ok(LogicalPlan::Union(Union { inputs, schema }))
LogicalPlan::Union(Union { inputs, schema: _ }) => {
let input_schema = inputs[0].schema().clone();
Ok(LogicalPlan::Union(Union {
inputs,
schema: input_schema,
}))
}
LogicalPlan::Distinct(distinct) => {
let distinct = match distinct {
Expand Down

0 comments on commit adb7435

Please sign in to comment.