Skip to content

Commit 4cf91eb

Browse files
xiedeyantucomphead
andcommitted
Update datafusion/optimizer/src/unions_to_filter.rs
Co-authored-by: Oleks V <comphead@users.noreply.github.com>
1 parent 8aac147 commit 4cf91eb

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

datafusion/optimizer/src/unions_to_filter.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,17 @@ struct UnionsToFilterRewriter;
7676
impl TreeNodeRewriter for UnionsToFilterRewriter {
7777
type Node = LogicalPlan;
7878

79-
fn f_up(&mut self, plan: LogicalPlan) -> Result<Transformed<LogicalPlan>> {
80-
match plan {
81-
LogicalPlan::Distinct(Distinct::All(input)) => {
82-
let inner = Arc::unwrap_or_clone(input);
83-
match try_rewrite_distinct_union(inner.clone())? {
84-
Some(rewritten) => Ok(Transformed::yes(rewritten)),
85-
None => Ok(Transformed::no(LogicalPlan::Distinct(Distinct::All(
86-
Arc::new(inner),
87-
)))),
88-
}
89-
}
90-
_ => Ok(Transformed::no(plan)),
91-
}
92-
}
93-
}
79+
fn f_up(&mut self, plan: LogicalPlan) -> Result<Transformed<LogicalPlan>> {
80+
match &plan {
81+
LogicalPlan::Distinct(Distinct::All(input)) => {
82+
match try_rewrite_distinct_union(input.as_ref().clone())? {
83+
Some(rewritten) => Ok(Transformed::yes(rewritten)),
84+
None => Ok(Transformed::no(plan)),
85+
}
86+
}
87+
_ => Ok(Transformed::no(plan)),
88+
}
89+
}
9490

9591
fn try_rewrite_distinct_union(plan: LogicalPlan) -> Result<Option<LogicalPlan>> {
9692
let LogicalPlan::Union(Union { inputs, schema }) = plan else {

0 commit comments

Comments
 (0)