Skip to main content

Module numeric

Module numeric 

Source
Expand description

Numeric scalar helpers (port of Python _promote_for_addition + NumericDispatch).

Output type is computed by promotion at bind; process casts the input column(s) to that type and applies the op via Arrow’s type-preserving add kernel (covers int / uint / float / decimal uniformly).

Functions§

add_two
Add the first two input columns (cast to the bound output type).
array_value_f64
Read any numeric array element widened to f64 (None if null).
array_value_i64
Read any integer/float array element widened to i64 (None if null).
common_type_for_addition
Common addition type for two inputs: the numeric common type of the two, then promoted for overflow headroom (matches Python _promote_for_addition(pc.add(nulls(t1), nulls(t2)).type)).
double_first
Double the first input column (cast to the bound output type, add to self, cast back so Arrow’s decimal widening doesn’t drift the result type).
promote_for_addition
Promote a numeric type for addition/doubling, matching Python _promote_for_addition: integers widen to the next size, floats to float64, decimals gain one digit of precision (capped at 38).