Skip to content

Commit c519c77

Browse files
author
Shiv Bhatia
committed
Simplify unchanged case
1 parent 3c09d58 commit c519c77

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

datafusion/optimizer/src/push_down_filter.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -836,11 +836,8 @@ impl OptimizerRule for PushDownFilter {
836836
// it would change semantics: the limit should apply before
837837
// the filter, not after.
838838
if sort.fetch.is_some() {
839-
let plan = LogicalPlan::Filter(Filter::try_new(
840-
filter.predicate,
841-
Arc::new(LogicalPlan::Sort(sort)),
842-
)?);
843-
return Ok(Transformed::no(plan));
839+
filter.input = Arc::new(LogicalPlan::Sort(sort));
840+
return Ok(Transformed::no(LogicalPlan::Filter(filter)));
844841
}
845842
let new_filter =
846843
Filter::try_new(filter.predicate, Arc::clone(&sort.input))
@@ -1144,11 +1141,8 @@ impl OptimizerRule for PushDownFilter {
11441141
// would change semantics: the limit should apply before the
11451142
// filter, not after.
11461143
if scan.fetch.is_some() {
1147-
let plan = LogicalPlan::Filter(Filter::try_new(
1148-
filter.predicate,
1149-
Arc::new(LogicalPlan::TableScan(scan)),
1150-
)?);
1151-
return Ok(Transformed::no(plan));
1144+
filter.input = Arc::new(LogicalPlan::TableScan(scan));
1145+
return Ok(Transformed::no(LogicalPlan::Filter(filter)));
11521146
}
11531147
let filter_predicates = split_conjunction(&filter.predicate);
11541148

0 commit comments

Comments
 (0)