pub fn in_list_of(
needle: Expression,
element_dtype: DType,
elements: Vec<Scalar>,
) -> VortexResult<Expression>Expand description
Creates needle IN (elements) with SQL null semantics for a list of constant elements of
element_dtype, ignoring nullability. An element can also be an untyped null.
The nullability of element_dtype is not used: the list elements are nullable only when a
null element is present.
Non-null integers that hold every value between their smallest and largest become a range check, which is cheaper to evaluate and prunes with tighter bounds than a set lookup, as for the keys of a small dimension table that a join pushes down.
ยงErrors
Returns an error if an element is not a null and not of element_dtype.
let dtype = DType::Primitive(PType::I32, Nullability::NonNullable);
let expr = in_list_of(root(), dtype, vec![3i32.into(), 1i32.into(), 2i32.into()])?;
assert_eq!(expr.to_string(), "(1i32 <= $ <= 3i32)");