in crates/iceberg/src/expr/visitors/inclusive_metrics_evaluator.rs [423:465]
fn r#in(
&mut self,
reference: &BoundReference,
literals: &FnvHashSet<Datum>,
_predicate: &BoundPredicate,
) -> crate::Result<bool> {
let field_id = reference.field().id;
if self.contains_nulls_only(field_id) || self.contains_nans_only(field_id) {
return ROWS_CANNOT_MATCH;
}
if literals.len() > IN_PREDICATE_LIMIT {
// skip evaluating the predicate if the number of values is too big
return ROWS_MIGHT_MATCH;
}
if let Some(lower_bound) = self.lower_bound(field_id) {
if lower_bound.is_nan() {
// NaN indicates unreliable bounds. See the InclusiveMetricsEvaluator docs for more.
return ROWS_MIGHT_MATCH;
}
if !literals.iter().any(|datum| datum.ge(lower_bound)) {
// if all values are less than lower bound, rows cannot match.
return ROWS_CANNOT_MATCH;
}
}
if let Some(upper_bound) = self.upper_bound(field_id) {
if upper_bound.is_nan() {
// NaN indicates unreliable bounds. See the InclusiveMetricsEvaluator docs for more.
return ROWS_MIGHT_MATCH;
}
if !literals.iter().any(|datum| datum.le(upper_bound)) {
// if all values are greater than upper bound, rows cannot match.
return ROWS_CANNOT_MATCH;
}
}
ROWS_MIGHT_MATCH
}