Transformation Binaryops#
- group transformation_binaryops
Typedefs
-
template<typename L, typename R>
using binary_op_common_type_t = typename binary_op_common_type<L, R>::type# Binary operation common type helper.
Enums
-
enum class binary_operator : int32_t#
Types of binary operations that can be performed on data.
Values:
-
enumerator ADD#
operator +
-
enumerator SUB#
operator -
-
enumerator MUL#
operator *
-
enumerator DIV#
operator / using common type of lhs and rhs
-
enumerator TRUE_DIV#
operator / after promoting type to floating point
-
enumerator FLOOR_DIV#
operator // integer division rounding towards negative infinity if both arguments are integral; floor division for floating types (using C++ type promotion for mixed integral/floating arguments) If different promotion semantics are required, it is the responsibility of the caller to promote manually before calling in to this function.
-
enumerator MOD#
operator %
-
enumerator PMOD#
positive modulo operator If remainder is negative, this returns (remainder + divisor) % divisor else, it returns (dividend % divisor)
-
enumerator PYMOD#
operator % but following Python’s sign rules for negatives
-
enumerator POW#
lhs ^ rhs
-
enumerator INT_POW#
int ^ int, used to avoid floating point precision loss. Returns 0 for negative exponents.
-
enumerator LOG_BASE#
logarithm to the base
-
enumerator ATAN2#
2-argument arctangent
-
enumerator SHIFT_LEFT#
operator <<
-
enumerator SHIFT_RIGHT#
operator >>
-
enumerator SHIFT_RIGHT_UNSIGNED#
operator >>> (from Java) Logical right shift. Casts to an unsigned value before shifting.
-
enumerator BITWISE_AND#
operator &
-
enumerator BITWISE_OR#
operator |
-
enumerator BITWISE_XOR#
operator ^
-
enumerator LOGICAL_AND#
operator &&
-
enumerator LOGICAL_OR#
operator ||
-
enumerator EQUAL#
operator ==
-
enumerator NOT_EQUAL#
operator !=
-
enumerator LESS#
operator <
-
enumerator GREATER#
operator >
-
enumerator LESS_EQUAL#
operator <=
-
enumerator GREATER_EQUAL#
operator >=
-
enumerator NULL_EQUALS#
Returns true when both operands are null; false when one is null; the result of equality when both are non-null
-
enumerator NULL_NOT_EQUALS#
Returns false when both operands are null; true when one is null; the result of inequality when both are non-null
-
enumerator NULL_MAX#
Returns max of operands when both are non-null; returns the non-null operand when one is null; or invalid when both are null
-
enumerator NULL_MIN#
Returns min of operands when both are non-null; returns the non-null operand when one is null; or invalid when both are null
-
enumerator GENERIC_BINARY#
generic binary operator to be generated with input ptx code
-
enumerator NULL_LOGICAL_AND#
operator && with Spark rules: (null, null) is null, (null, true) is null, (null, false) is false, and (valid, valid) == LOGICAL_AND(valid, valid)
-
enumerator NULL_LOGICAL_OR#
operator || with Spark rules: (null, null) is null, (null, true) is true, (null, false) is null, and (valid, valid) == LOGICAL_OR(valid, valid)
-
enumerator INVALID_BINARY#
invalid operation
-
enumerator ADD#
Functions
-
std::unique_ptr<column> binary_operation(scalar const &lhs, column_view const &rhs, binary_operator op, data_type output_type, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
Performs a binary operation between a scalar and a column.
The output contains the result of
op(lhs, rhs[i])
for all0 <= i < rhs.size()
The scalar is the left operand and the column elements are the right operand. This distinction is significant in case of non-commutative binary operationsRegardless of the operator, the validity of the output value is the logical AND of the validity of the two operands except NullMin and NullMax (logical OR).
- Parameters:
lhs – The left operand scalar
rhs – The right operand column
op – The binary operator
output_type – The desired data type of the output column
stream – CUDA stream used for device memory operations and kernel launches
mr – Device memory resource used to allocate the returned column’s device memory
- Throws:
cudf::logic_error – if
output_type
dtype isn’t fixed-widthcudf::logic_error – if
output_type
dtype isn’t boolean for comparison and logical operations.cudf::data_type_error – if the operation is not supported for the types of
lhs
andrhs
- Returns:
Output column of
output_type
type containing the result of the binary operation
-
std::unique_ptr<column> binary_operation(column_view const &lhs, scalar const &rhs, binary_operator op, data_type output_type, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
Performs a binary operation between a column and a scalar.
The output contains the result of
op(lhs[i], rhs)
for all0 <= i < lhs.size()
The column elements are the left operand and the scalar is the right operand. This distinction is significant in case of non-commutative binary operationsRegardless of the operator, the validity of the output value is the logical AND of the validity of the two operands except NullMin and NullMax (logical OR).
- Parameters:
lhs – The left operand column
rhs – The right operand scalar
op – The binary operator
output_type – The desired data type of the output column
stream – CUDA stream used for device memory operations and kernel launches
mr – Device memory resource used to allocate the returned column’s device memory
- Throws:
cudf::logic_error – if
output_type
dtype isn’t fixed-widthcudf::logic_error – if
output_type
dtype isn’t boolean for comparison and logical operations.cudf::data_type_error – if the operation is not supported for the types of
lhs
andrhs
- Returns:
Output column of
output_type
type containing the result of the binary operation
-
std::unique_ptr<column> binary_operation(column_view const &lhs, column_view const &rhs, binary_operator op, data_type output_type, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
Performs a binary operation between two columns.
The output contains the result of
op(lhs[i], rhs[i])
for all0 <= i < lhs.size()
Regardless of the operator, the validity of the output value is the logical AND of the validity of the two operands except NullMin and NullMax (logical OR).
- Parameters:
lhs – The left operand column
rhs – The right operand column
op – The binary operator
output_type – The desired data type of the output column
stream – CUDA stream used for device memory operations and kernel launches
mr – Device memory resource used to allocate the returned column’s device memory
- Throws:
cudf::logic_error – if
lhs
andrhs
are different sizescudf::logic_error – if
output_type
dtype isn’t boolean for comparison and logical operations.cudf::logic_error – if
output_type
dtype isn’t fixed-widthcudf::data_type_error – if the operation is not supported for the types of
lhs
andrhs
- Returns:
Output column of
output_type
type containing the result of the binary operation
-
std::unique_ptr<column> binary_operation(column_view const &lhs, column_view const &rhs, std::string const &ptx, data_type output_type, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
Performs a binary operation between two columns using a user-defined PTX function.
The output contains the result of
op(lhs[i], rhs[i])
for all0 <= i < lhs.size()
Regardless of the operator, the validity of the output value is the logical AND of the validity of the two operands
- Parameters:
lhs – The left operand column
rhs – The right operand column
ptx – String containing the PTX of a binary function
output_type – The desired data type of the output column. It is assumed that output_type is compatible with the output data type of the function in the PTX code
stream – CUDA stream used for device memory operations and kernel launches
mr – Device memory resource used to allocate the returned column’s device memory
- Throws:
cudf::logic_error – if
lhs
andrhs
are different sizescudf::logic_error – if
lhs
andrhs
dtypes aren’t numericcudf::logic_error – if
output_type
dtype isn’t numeric
- Returns:
Output column of
output_type
type containing the result of the binary operation
-
int32_t binary_operation_fixed_point_scale(binary_operator op, int32_t left_scale, int32_t right_scale)#
Computes the
scale
for afixed_point
number based on given binary operatorop
- Parameters:
op – The binary_operator used for two
fixed_point
numbersleft_scale – Scale of left
fixed_point
numberright_scale – Scale of right
fixed_point
number
- Returns:
The resulting
scale
of the computedfixed_point
number
-
cudf::data_type binary_operation_fixed_point_output_type(binary_operator op, cudf::data_type const &lhs, cudf::data_type const &rhs)#
Computes the
data_type
for afixed_point
number based on given binary operatorop
- Parameters:
op – The binary_operator used for two
fixed_point
numberslhs –
cudf::data_type
of leftfixed_point
numberrhs –
cudf::data_type
of rightfixed_point
number
- Returns:
The resulting
cudf::data_type
of the computedfixed_point
number
Variables
-
template<typename L, typename R, typename = void>
struct binary_op_common_type# - #include <binaryop.hpp>
Binary operation common type default.
-
template<typename L, typename R>
struct binary_op_common_type<L, R, std::enable_if_t<has_common_type_v<L, R>>># - #include <binaryop.hpp>
Binary operation common type specialization.
-
template<typename L, typename R>