Skip to content

Commit

Permalink
prune BatchFilter if predicate always true
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel committed Nov 8, 2024
1 parent 115e2ef commit e60b4e4
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ impl Rule for BatchIcebergPredicatePushDownRule {
assert_eq!(scan.predicate, IcebergPredicate::AlwaysTrue);

let predicate = filter.predicate().clone();
let (iceberg_predicate, new_predicate) =
let (iceberg_predicate, rw_predicate) =
rw_predicate_to_iceberg_predicate(predicate, scan.schema().fields());
let scan = scan.clone_with_predicate(iceberg_predicate);
let filter = filter
.clone_with_input(scan.into())
.clone_with_predicate(new_predicate);
Some(filter.into())
if rw_predicate.always_true() {
Some(scan.into())
} else {
let filter = filter
.clone_with_input(scan.into())
.clone_with_predicate(rw_predicate);
Some(filter.into())
}
}
}

Expand Down

0 comments on commit e60b4e4

Please sign in to comment.