in crates/iceberg/src/expr/visitors/page_index_evaluator.rs [724:773]
fn r#in(
&mut self,
reference: &BoundReference,
literals: &FnvHashSet<Datum>,
_predicate: &BoundPredicate,
) -> Result<RowSelection> {
let field_id = reference.field().id;
if literals.len() > IN_PREDICATE_LIMIT {
// skip evaluating the predicate if the number of values is too big
return self.select_all_rows();
}
self.calc_row_selection(
field_id,
|min, max, nulls| {
if matches!(nulls, PageNullCount::AllNull) {
return Ok(false);
}
match (min, max) {
(Some(min), Some(max)) => {
if literals
.iter()
.all(|datum| datum.lt(&min) || datum.gt(&max))
{
// if all values are outside the bounds, rows cannot match.
return Ok(false);
}
}
(Some(min), _) => {
if !literals.iter().any(|datum| datum.ge(&min)) {
// if none of the values are greater than the min bound, rows cant match
return Ok(false);
}
}
(_, Some(max)) => {
if !literals.iter().any(|datum| datum.le(&max)) {
// if all values are greater than upper bound, rows cannot match.
return Ok(false);
}
}
_ => {}
}
Ok(true)
},
MissingColBehavior::CantMatch,
)
}