fn make_upscaler<I: DecimalType, O: DecimalType>(
input_precision: u8,
input_scale: i8,
output_precision: u8,
output_scale: i8,
) -> Option<(impl Fn(I::Native) -> Option<O::Native>, Option<impl Fn(I::Native) -> O::Native>)>where
I::Native: DecimalCast + ArrowNativeTypeOp,
O::Native: DecimalCast + ArrowNativeTypeOp,Expand description
Construct closures to upscale decimals from (input_precision, input_scale) to
(output_precision, output_scale).
Returns (f_fallible, f_infallible) where:
f_fallibleyieldsNonewhen the requested cast would overflowf_infallibleis present only when every input is guaranteed to succeed; otherwise it isNoneand callers must fall back tof_fallible
Returns None if the required scale increase delta_scale = output_scale - input_scale
exceeds the supported precomputed precision table O::MAX_FOR_EACH_PRECISION.
In that case, the caller should treat this as an overflow for the output scale
and handle it accordingly (e.g., return a cast error).