Function is_constant

Source
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:

  1. It has one elements.
  2. Its encoded as a ConstantArray or NullArray
  3. Has an exact statistic attached to it, saying its constant.
  4. Is all invalid.
  5. 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.