Skip to main content

calculate_binary_decimal_math_cast

Function calculate_binary_decimal_math_cast 

Source
pub fn calculate_binary_decimal_math_cast<L, R, O, F>(
    left: &dyn Array,
    right: &ColumnarValue,
    fun: F,
    precision: u8,
    scale: i8,
    cast_target: &DataType,
) -> Result<Arc<PrimitiveArray<O>>>
Expand description

Computes a binary math function for input arrays using a specified function and applies rescaling to given precision and scale.

It casts the right operand to cast_target instead of the default R::DATA_TYPE to preserve the right operand scale.

§Type Parameters

  • L: Left array decimal type
  • R: Right array primitive type
  • O: Output array decimal type
  • F: Functor computing fun(l: L, r: R) -> Result<OutputType>

§Arguments

  • left: Left input array
  • right: Right input array or scalar value
  • fun: Function of type F
  • precision: Precision to apply to output decimal array
  • scale: Scale to apply to output decimal array
  • cast_target: Data type to cast right operand to before applying function