Module arrow2::compute::arithmetics::decimal
source · Available on crate feature
compute_arithmetics
only.Expand description
Defines the arithmetic kernels for Decimal PrimitiveArrays
. The
Decimal
type specifies the
precision and scale parameters. These affect the arithmetic operations and
need to be considered while doing operations with Decimal numbers.
Functions
Adaptive addition of two decimal primitive arrays with different precision
and scale. If the precision and scale is different, then the smallest scale
and precision is adjusted to the largest precision and scale. If during the
addition one of the results is larger than the max possible value, the
result precision is changed to the precision of the max value
Adaptive division of two decimal primitive arrays with different precision
and scale. If the precision and scale is different, then the smallest scale
and precision is adjusted to the largest precision and scale. If during the
division one of the results is larger than the max possible value, the
result precision is changed to the precision of the max value. The function
panics when divided by zero.
Adaptive multiplication of two decimal primitive arrays with different
precision and scale. If the precision and scale is different, then the
smallest scale and precision is adjusted to the largest precision and
scale. If during the multiplication one of the results is larger than the
max possible value, the result precision is changed to the precision of the
max value
Adaptive subtract of two decimal primitive arrays with different precision
and scale. If the precision and scale is different, then the smallest scale
and precision is adjusted to the largest precision and scale. If during the
addition one of the results is smaller than the min possible value, the
result precision is changed to the precision of the min value
Adds two decimal
PrimitiveArray
with the same precision and scale.Checked addition of two decimal primitive arrays with the same precision
and scale. If the precision and scale is different, then an
InvalidArgumentError is returned. If the result from the sum is larger than
the possible number with the selected precision (overflowing), then the
validity for that index is changed to None
Checked division of two decimal primitive arrays with the same precision
and scale. If the precision and scale is different, then an
InvalidArgumentError is returned. If the divisor is zero, then the
validity for that index is changed to None
Checked multiplication of two decimal primitive arrays with the same
precision and scale. If the precision and scale is different, then an
InvalidArgumentError is returned. If the result from the mul is larger than
the possible number with the selected precision (overflowing), then the
validity for that index is changed to None
Checked subtract of two decimal primitive arrays with the same precision
and scale. If the precision and scale is different, then an
InvalidArgumentError is returned. If the result from the sub is larger than
the possible number with the selected precision (overflowing), then the
validity for that index is changed to None
Divide two decimal primitive arrays with the same precision and scale. If
the precision and scale is different, then an InvalidArgumentError is
returned. This function panics if the dividend is divided by 0 or None.
This function also panics if the division produces a number larger
than the possible number for the array precision.
Multiply a decimal
PrimitiveArray
with a PrimitiveScalar
with the same precision and scale. If
the precision and scale is different, then an InvalidArgumentError is
returned. This function panics if the multiplied numbers result in a number
larger than the possible number for the selected precision.Multiply two decimal primitive arrays with the same precision and scale. If
the precision and scale is different, then an InvalidArgumentError is
returned. This function panics if the multiplied numbers result in a number
larger than the possible number for the selected precision.
Multiply a decimal
PrimitiveArray
with a PrimitiveScalar
with the same precision and scale. If
the precision and scale is different, then an InvalidArgumentError is
returned. This function panics if the multiplied numbers result in a number
larger than the possible number for the selected precision.Saturated addition of two decimal primitive arrays with the same precision
and scale. If the precision and scale is different, then an
InvalidArgumentError is returned. If the result from the sum is larger than
the possible number with the selected precision then the resulted number in
the arrow array is the maximum number for the selected precision.
Saturated division of two decimal primitive arrays with the same
precision and scale. If the precision and scale is different, then an
InvalidArgumentError is returned. If the result from the division is
larger than the possible number with the selected precision then the
resulted number in the arrow array is the maximum number for the selected
precision. The function panics if divided by zero.
Saturated multiplication of two decimal primitive arrays with the same
precision and scale. If the precision and scale is different, then an
InvalidArgumentError is returned. If the result from the multiplication is
larger than the possible number with the selected precision then the
resulted number in the arrow array is the maximum number for the selected
precision.
Saturated subtraction of two decimal primitive arrays with the same
precision and scale. If the precision and scale is different, then an
InvalidArgumentError is returned. If the result from the sum is smaller
than the possible number with the selected precision then the resulted
number in the arrow array is the minimum number for the selected precision.
Subtract two decimal primitive arrays with the same precision and scale. If
the precision and scale is different, then an InvalidArgumentError is
returned. This function panics if the subtracted numbers result in a number
smaller than the possible number for the selected precision.