dhruvarya-db commented on code in PR #3144:
URL: https://github.com/apache/iceberg-rust/pull/3144#discussion_r3938308826
##########
crates/iceberg/src/expr/visitors/inclusive_metrics_evaluator.rs:
##########
@@ -437,14 +437,17 @@ impl BoundPredicateVisitor for
InclusiveMetricsEvaluator<'_> {
return ROWS_MIGHT_MATCH;
}
+ // Narrow the set against each bound, matching Java / PyIceberg.
+ let mut filtered_literals = literals.clone();
+
if let Some(lower_bound) = self.lower_bound(field_id) {
Review Comment:
Looks like RowGroupMetricsEvaluator::in also has the same issue?
##########
crates/iceberg/src/expr/visitors/inclusive_metrics_evaluator.rs:
##########
@@ -437,14 +437,17 @@ impl BoundPredicateVisitor for
InclusiveMetricsEvaluator<'_> {
return ROWS_MIGHT_MATCH;
}
+ // Narrow the set against each bound, matching Java / PyIceberg.
+ let mut filtered_literals = literals.clone();
Review Comment:
I wonder if something like might be more readable. We avoid creating a
mutable filtered_literals as well this way
```
let lower_bound = self.lower_bound(field_id);
let upper_bound = self.upper_bound(field_id);
if lower_bound.is_some_and(Datum::is_nan) ||
upper_bound.is_some_and(Datum::is_nan) {
return ROWS_MIGHT_MATCH;
}
let any_literal_in_bounds = match (lower_bound, upper_bound) {
(Some(lower), Some(upper)) => {
literals.iter().any(|datum| datum.ge(lower) &&
datum.le(upper))
}
(Some(lower), None) => literals.iter().any(|datum|
datum.ge(lower)),
(None, Some(upper)) => literals.iter().any(|datum|
datum.le(upper)),
(None, None) => true,
};
if !any_literal_in_bounds {
return ROWS_CANNOT_MATCH;
}
ROWS_MIGHT_MATCH
```
##########
crates/iceberg/src/expr/visitors/manifest_evaluator.rs:
##########
@@ -409,12 +409,16 @@ impl BoundPredicateVisitor for ManifestFilterVisitor<'_> {
return ROWS_MIGHT_MATCH;
}
+ // Narrow the set against each bound, matching
InclusiveMetricsEvaluator.
+ let mut filtered_literals = literals.clone();
Review Comment:
Same applies here
https://github.com/apache/iceberg-rust/pull/3144/changes#r3938316479
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]