pub fn is_constant(array: &dyn Array) -> VortexResult<bool>
Expand description
Computes whether an array has constant values. If the array’s encoding doesn’t implement the relevant VTable, it’ll try and canonicalize in order to make a determination. An array is constant IFF at least one of the following conditions apply:
- It has one elements.
- Its encoded as a
ConstantArray
orNullArray
- Has an exact statistic attached to it, saying its constant.
- Is all invalid.
- Is all valid AND has minimum and maximum statistics that are equal.
If the array has some null values but is not all null, it’ll never be constant. Please note: Might return false negatives if a specific encoding couldn’t make a determination.