Module arrow2::compute::arithmetics [−][src]
compute
only.Expand description
Defines basic arithmetic kernels for PrimitiveArray
s.
Description
The Arithmetics module is composed by basic arithmetics operations that can be performed on PrimitiveArray Arrays. These operations can be the building for any implementation using Arrow.
Whenever possible, each of the operations in these modules has variations of the basic operation that offers different guarantees. These options are:
-
plain: The plain type (add, sub, mul, and div) don’t offer any protection when performing the operations. This means that if overflow is found, then the operations will panic.
-
checked: A checked operation will change the validity Bitmap for the offending operation. For example, if one of the operations overflows, the validity will be changed to None, indicating a Null value.
-
saturating: If overflowing is presented in one operation, the resulting value for that index will be saturated to the MAX or MIN value possible for that type. For
Decimal
arrays, the saturated value is calculated considering the precision and scale of the array. -
overflowing: When an operation overflows, the resulting will be the overflowed value for the operation. The result from the array operation includes a Binary bitmap indicating which values overflowed.
-
adaptive: For
Decimal
arrays, the adaptive variation adjusts the precision and scale to avoid saturation or overflowing.
New kernels
When adding a new operation to this module, it is strongly suggested to
follow the design description presented in the README.md file located in
the compute
module and the function descriptions
presented in this document.
Modules
Contains arithemtic functions for PrimitiveArray
s.
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.
Defines the arithmetic kernels for adding a Duration to a Timestamp, Time32, Time64, Date32 and Date64.
Enums
Traits
Defines basic addition operation for primitive arrays
Defines checked addition operation for primitive arrays
Defines checked division operation for primitive arrays
Defines checked multiplication operation for primitive arrays
Defines checked reminder operation for primitive arrays
Defines checked subtraction operation for primitive arrays
Defines basic division operation for primitive arrays
Defines basic multiplication operation for primitive arrays
Defines Overflowing addition operation for primitive arrays
Defines Overflowing multiplication operation for primitive arrays
Defines Overflowing subtraction operation for primitive arrays
Defines basic reminder operation for primitive arrays
Defines saturating addition operation for primitive arrays
Defines saturating multiplication operation for primitive arrays
Defines saturating subtraction operation for primitive arrays
Defines basic subtraction operation for primitive arrays
Functions
Execute an arithmetic operation with two arrays. It uses the enum Operator to select the type of operation that is going to be performed with the two arrays
Perform arithmetic operations on two primitive arrays based on the Operator enum
Performs primitive operation on an array and and scalar
Checks if an array of type datatype
can perform basic arithmetic
operations. These operations include add, subtract, multiply, divide.
Negates values from array.