Expand description
Operations that run on the values of a Widen instead of on a widened copy.
An operation runs on the values only where it gives the canonical result. Decoding a value is a strictly increasing, one-to-one map that keeps validity, so comparisons, sortedness, constancy and extrema carry over from the values, and every value in a result widens exactly to the logical dtype.
Most of these operations decide from dtypes and constants alone. The arithmetic kernel also needs the min and max of each operand, which come from cached statistics or from one scan of the operand. That scan is the one hidden cost in this module.
AggregateFnSession::default registers the aggregate kernel, not the Widen encoding’s
initialize, because the kernel session runs initialize on a temporary session and drops its
aggregate registry.
Functions§
- cast_
keeping_ nullability - Casts the integer array
arraytoptype, keeping its nullability. - constant_
fits_ values - Returns whether the dtype range of
valuesholdsconstant. - constant_
in_ values_ dtype - Returns
constant, which must fit the type ofvalues, as a constant array of that type with the nullability ofconstant. - ptype_
holding_ both_ values - Returns the wider of the value types of two
Widenarrays, orNonewhen a value type is not primitive. - ptype_
holding_ values_ and_ scalar - Returns the type that the values of
arraywiden to so that they also holdscalar: the type of the values, or the smallest wider type of the logical signedness that holdsscalar. - wrap_
values - Returns
valueswhen it hasdtype, and aWidenofdtypeovervaluesotherwise.