pub fn optimized_take<I: UnsignedPType>(
values: &BoolVector,
indices: &[I],
compute_validity: impl FnOnce() -> Mask,
) -> BoolVectorExpand description
Optimized take for boolean vectors with small value arrays.
Since booleans can only be true or false, we can optimize these specific cases:
- All of the values are
true, so create aBoolVectorwithntrues. - All of the values are
false, so create aBoolVectorwithnfalses. - There is a single
truevalue, so compare indices against that index. - There is a single
falsevalue, so compare indices against that index and negate. - Otherwise, there are multiple
trues andfalses in thevaluesvector and we must do a normaltakeon it.
The compute_validity closure computes the output validity mask, allowing callers to handle
nullable vs non-nullable indices differently.