Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion datafusion/expr/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,6 @@ pub fn union_with_alias(
Ok(LogicalPlan::Union(Union {
inputs,
schema: union_schema,
alias,
}))
}

Expand Down
2 changes: 0 additions & 2 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1285,8 +1285,6 @@ pub struct Union {
pub inputs: Vec<Arc<LogicalPlan>>,
/// Union schema. Should be the same for all inputs.
pub schema: DFSchemaRef,
/// Union output relation alias
pub alias: Option<String>,
}

/// Creates an in memory table.
Expand Down
11 changes: 4 additions & 7 deletions datafusion/expr/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,10 @@ pub fn from_plan(
LogicalPlan::Extension(e) => Ok(LogicalPlan::Extension(Extension {
node: e.node.from_template(expr, inputs),
})),
LogicalPlan::Union(Union { schema, alias, .. }) => {
Ok(LogicalPlan::Union(Union {
inputs: inputs.iter().cloned().map(Arc::new).collect(),
schema: schema.clone(),
alias: alias.clone(),
}))
}
LogicalPlan::Union(Union { schema, .. }) => Ok(LogicalPlan::Union(Union {
inputs: inputs.iter().cloned().map(Arc::new).collect(),
schema: schema.clone(),
})),
LogicalPlan::Distinct(Distinct { .. }) => Ok(LogicalPlan::Distinct(Distinct {
input: Arc::new(inputs[0].clone()),
})),
Expand Down
6 changes: 1 addition & 5 deletions datafusion/optimizer/src/filter_push_down.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,7 @@ fn optimize(plan: &LogicalPlan, mut state: State) -> Result<LogicalPlan> {
// sort is filter-commutable
push_down(&state, plan)
}
LogicalPlan::Union(Union {
inputs: _,
schema,
alias: _,
}) => {
LogicalPlan::Union(Union { inputs: _, schema }) => {
// union changing all qualifiers while building logical plan so we need
// to rewrite filters to push unqualified columns to inputs
let projection = schema
Expand Down
7 changes: 1 addition & 6 deletions datafusion/optimizer/src/limit_push_down.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,7 @@ fn limit_push_down(
)?))
}
(
LogicalPlan::Union(Union {
inputs,
alias,
schema,
}),
LogicalPlan::Union(Union { inputs, schema }),
Ancestor::FromLimit {
skip: ancestor_skip,
fetch: Some(ancestor_fetch),
Expand Down Expand Up @@ -205,7 +201,6 @@ fn limit_push_down(
.collect::<Result<_>>()?;
Ok(LogicalPlan::Union(Union {
inputs: new_inputs,
alias: alias.clone(),
schema: schema.clone(),
}))
}
Expand Down
7 changes: 1 addition & 6 deletions datafusion/optimizer/src/projection_push_down.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,7 @@ fn optimize_plan(
schema: a.schema.clone(),
}))
}
LogicalPlan::Union(Union {
inputs,
schema,
alias,
}) => {
LogicalPlan::Union(Union { inputs, schema }) => {
// UNION inputs will reference the same column with different identifiers, so we need
// to populate new_required_columns by unqualified column name based on required fields
// from the resulting UNION output
Expand Down Expand Up @@ -438,7 +434,6 @@ fn optimize_plan(
Ok(LogicalPlan::Union(Union {
inputs: new_inputs.iter().cloned().map(Arc::new).collect(),
schema: Arc::new(new_schema),
alias: alias.clone(),
}))
}
LogicalPlan::SubqueryAlias(SubqueryAlias { input, alias, .. }) => {
Expand Down