BinaryOperable#

public interface BinaryOperable#

A value that can be an operand of a binary operation, such as a column or a scalar.

Implemented by ColumnView and Scalar; the operations are built on binaryOp(BinaryOp, BinaryOperable, DType).

Subclassed by ai.rapids.cudf.ColumnView, ai.rapids.cudf.Scalar

Method Summary

add(BinaryOperable rhs)

Add + operator.

add(BinaryOperable rhs, DType outType)

Add one vector to another with the given output type.

and(BinaryOperable rhs)

Logical and (&&).

and(BinaryOperable rhs, DType outType)

Logical and (&&) with the given output type.

arctan2(BinaryOperable xCoordinate)

The function arctan2(y,x) or atan2(y,x) is defined as the angle in the Euclidean plane, given in radians, between the positive x axis and the ray to the point (x, y) ≠ (0, 0).

arctan2(BinaryOperable xCoordinate, DType outType)

The function arctan2(y,x) or atan2(y,x) is defined as the angle in the Euclidean plane, given in radians, between the positive x axis and the ray to the point (x, y) ≠ (0, 0).

binaryOp(BinaryOp op, BinaryOperable rhs, DType outType)

Multiple different binary operations.

bitAnd(BinaryOperable rhs)

Bit wise and (&).

bitAnd(BinaryOperable rhs, DType outType)

Bit wise and (&) with the given output type.

bitOr(BinaryOperable rhs)

Bit wise or (|).

bitOr(BinaryOperable rhs, DType outType)

Bit wise or (|) with the given output type.

bitXor(BinaryOperable rhs)

Bit wise xor (^).

bitXor(BinaryOperable rhs, DType outType)

Bit wise xor (^) with the given output type.

div(BinaryOperable rhs)

Divide one vector by another.

div(BinaryOperable rhs, DType outType)

Divide one vector by another with the given output type.

equalTo(BinaryOperable rhs)

this == rhs 1 is true 0 is false.

equalTo(BinaryOperable rhs, DType outType)

this == rhs 1 is true 0 is false with the output cast to the given type.

equalToNullAware(BinaryOperable rhs)

like equalTo but NULL == NULL is TRUE and NULL == not NULL is FALSE

equalToNullAware(BinaryOperable rhs, DType outType)

like equalTo but NULL == NULL is TRUE and NULL == not NULL is FALSE

floorDiv(BinaryOperable rhs)

Divide one vector by another and calculate the floor of the result.

floorDiv(BinaryOperable rhs, DType outType)

Divide one vector by another and calculate the floor of the result with the given output type.

getType()

Get the type of this data.

greaterOrEqualTo(BinaryOperable rhs)

this >= rhs 1 is true 0 is false.

greaterOrEqualTo(BinaryOperable rhs, DType outType)

this >= rhs 1 is true 0 is false with the output cast to the given type.

greaterThan(BinaryOperable rhs)

this > rhs 1 is true 0 is false.

greaterThan(BinaryOperable rhs, DType outType)

this > rhs 1 is true 0 is false with the output cast to the given type.

implicitConversion(BinaryOp op, BinaryOperable lhs, BinaryOperable rhs)

Finds the proper DType for an implicit output.

lessOrEqualTo(BinaryOperable rhs)

this <= rhs 1 is true 0 is false.

lessOrEqualTo(BinaryOperable rhs, DType outType)

this <= rhs 1 is true 0 is false with the output cast to the given type.

lessThan(BinaryOperable rhs)

this < rhs 1 is true 0 is false.

lessThan(BinaryOperable rhs, DType outType)

this < rhs 1 is true 0 is false with the output cast to the given type.

log(BinaryOperable rhs)

Calculate the log with the specified base, output is the same as this.

log(BinaryOperable rhs, DType outType)

Calculate the log with the specified base.

maxNullAware(BinaryOperable rhs)

Returns the max non null value.

maxNullAware(BinaryOperable rhs, DType outType)

Returns the max non null value.

minNullAware(BinaryOperable rhs)

Returns the min non null value.

minNullAware(BinaryOperable rhs, DType outType)

Returns the min non null value.

mod(BinaryOperable rhs)

Compute the modulus.

mod(BinaryOperable rhs, DType outType)

Compute the modulus with the given output type.

mul(BinaryOperable rhs)

Multiply two vectors together.

mul(BinaryOperable rhs, DType outType)

Multiply two vectors together with the given output type.

notEqualTo(BinaryOperable rhs)

this != rhs 1 is true 0 is false.

notEqualTo(BinaryOperable rhs, DType outType)

this != rhs 1 is true 0 is false with the output cast to the given type.

notEqualToNullAware(BinaryOperable rhs)

like notEqualTo but NULL != NULL is TRUE and NULL != not NULL is FALSE

notEqualToNullAware(BinaryOperable rhs, DType outType)

like notEqualTo but NULL != NULL is TRUE and NULL != not NULL is FALSE

or(BinaryOperable rhs)

Logical or (||).

or(BinaryOperable rhs, DType outType)

Logical or (||) with the given output type.

pmod(BinaryOperable rhs)

Returns the positive value of lhs mod rhs.

pmod(BinaryOperable rhs, DType outputType)

Returns the positive value of lhs mod rhs.

pow(BinaryOperable rhs)

Compute the power.

pow(BinaryOperable rhs, DType outType)

Compute the power with the given output type.

shiftLeft(BinaryOperable shiftBy)

Bitwise left shift the values of this vector by the shiftBy.

shiftLeft(BinaryOperable shiftBy, DType outType)

Bitwise left shifts the values of this vector by shiftBy.

shiftRight(BinaryOperable shiftBy)

Bitwise right shift this vector by the shiftBy.

shiftRight(BinaryOperable shiftBy, DType outType)

Bitwise right shift this vector by the shiftBy.

shiftRightUnsigned(BinaryOperable shiftBy)

This method bitwise right shifts the values of this vector by the shiftBy.

shiftRightUnsigned(BinaryOperable shiftBy, DType outType)

This method bitwise right shifts the values of this vector by the shiftBy.

sub(BinaryOperable rhs)

Subtract one vector from another.

sub(BinaryOperable rhs, DType outType)

Subtract one vector from another with the given output type.

trueDiv(BinaryOperable rhs)

Divide one vector by another converting to FLOAT64 in between.

trueDiv(BinaryOperable rhs, DType outType)

Divide one vector by another converting to FLOAT64 in between with the given output type.

Methods

public DType getType()#

Get the type of this data.

public ColumnVector binaryOp(
BinaryOp op,
BinaryOperable rhs,
DType outType
)#

Multiple different binary operations.

Parameters:
  • op – the operation to perform

  • rhs – the rhs of the operation

  • outType – the type of output you want.

Returns:

the result

public default ColumnVector add(BinaryOperable rhs, DType outType)#

Add one vector to another with the given output type.

this + rhs Output type is ignored for the operations between decimal types and it is always decimal type.

public default ColumnVector add(BinaryOperable rhs)#

Add + operator.

this + rhs

public default ColumnVector sub(BinaryOperable rhs, DType outType)#

Subtract one vector from another with the given output type.

this - rhs Output type is ignored for the operations between decimal types and it is always decimal type.

public default ColumnVector sub(BinaryOperable rhs)#

Subtract one vector from another.

this - rhs

public default ColumnVector mul(BinaryOperable rhs, DType outType)#

Multiply two vectors together with the given output type.

this * rhs Output type is ignored for the operations between decimal types and it is always decimal type.

public default ColumnVector mul(BinaryOperable rhs)#

Multiply two vectors together.

this * rhs

public default ColumnVector div(BinaryOperable rhs, DType outType)#

Divide one vector by another with the given output type.

this / rhs Output type is ignored for the operations between decimal types and it is always decimal type.

public default ColumnVector div(BinaryOperable rhs)#

Divide one vector by another.

this / rhs

public default ColumnVector trueDiv(BinaryOperable rhs, DType outType)#

Divide one vector by another converting to FLOAT64 in between with the given output type.

(double)this / (double)rhs

public default ColumnVector trueDiv(BinaryOperable rhs)#

Divide one vector by another converting to FLOAT64 in between.

(double)this / (double)rhs

public default ColumnVector floorDiv(
BinaryOperable rhs,
DType outType
)#

Divide one vector by another and calculate the floor of the result with the given output type.

Math.floor(this/rhs)

public default ColumnVector floorDiv(BinaryOperable rhs)#

Divide one vector by another and calculate the floor of the result.

Math.floor(this/rhs)

public default ColumnVector mod(BinaryOperable rhs, DType outType)#

Compute the modulus with the given output type.

this % rhs

public default ColumnVector mod(BinaryOperable rhs)#

Compute the modulus.

this % rhs

public default ColumnVector pow(BinaryOperable rhs, DType outType)#

Compute the power with the given output type.

Math.pow(this, rhs)

public default ColumnVector pow(BinaryOperable rhs)#

Compute the power.

Math.pow(this, rhs)

public default ColumnVector equalTo(BinaryOperable rhs, DType outType)#

this == rhs 1 is true 0 is false with the output cast to the given type.

public default ColumnVector equalTo(BinaryOperable rhs)#

this == rhs 1 is true 0 is false.

The output type is BOOL8.

public default ColumnVector notEqualTo(
BinaryOperable rhs,
DType outType
)#

this != rhs 1 is true 0 is false with the output cast to the given type.

public default ColumnVector notEqualTo(BinaryOperable rhs)#

this != rhs 1 is true 0 is false.

The output type is BOOL8.

public default ColumnVector lessThan(
BinaryOperable rhs,
DType outType
)#

this < rhs 1 is true 0 is false with the output cast to the given type.

public default ColumnVector lessThan(BinaryOperable rhs)#

this < rhs 1 is true 0 is false.

The output type is BOOL8.

public default ColumnVector greaterThan(
BinaryOperable rhs,
DType outType
)#

this > rhs 1 is true 0 is false with the output cast to the given type.

public default ColumnVector greaterThan(BinaryOperable rhs)#

this > rhs 1 is true 0 is false.

The output type is BOOL8.

public default ColumnVector lessOrEqualTo(
BinaryOperable rhs,
DType outType
)#

this <= rhs 1 is true 0 is false with the output cast to the given type.

public default ColumnVector lessOrEqualTo(BinaryOperable rhs)#

this <= rhs 1 is true 0 is false.

The output type is BOOL8.

public default ColumnVector greaterOrEqualTo(
BinaryOperable rhs,
DType outType
)#

this >= rhs 1 is true 0 is false with the output cast to the given type.

public default ColumnVector greaterOrEqualTo(BinaryOperable rhs)#

this >= rhs 1 is true 0 is false.

The output type is BOOL8.

public default ColumnVector bitAnd(BinaryOperable rhs, DType outType)#

Bit wise and (&) with the given output type.

this & rhs

public default ColumnVector bitAnd(BinaryOperable rhs)#

Bit wise and (&).

this & rhs

public default ColumnVector bitOr(BinaryOperable rhs, DType outType)#

Bit wise or (|) with the given output type.

this | rhs

public default ColumnVector bitOr(BinaryOperable rhs)#

Bit wise or (|).

this | rhs

public default ColumnVector bitXor(BinaryOperable rhs, DType outType)#

Bit wise xor (^) with the given output type.

this ^ rhs

public default ColumnVector bitXor(BinaryOperable rhs)#

Bit wise xor (^).

this ^ rhs

public default ColumnVector and(BinaryOperable rhs, DType outType)#

Logical and (&&) with the given output type.

this && rhs

public default ColumnVector and(BinaryOperable rhs)#

Logical and (&&).

this && rhs

public default ColumnVector or(BinaryOperable rhs, DType outType)#

Logical or (||) with the given output type.

this || rhs

public default ColumnVector or(BinaryOperable rhs)#

Logical or (||).

this || rhs

public default ColumnVector shiftLeft(
BinaryOperable shiftBy,
DType outType
)#

Bitwise left shifts the values of this vector by shiftBy.

If “this” and shiftBy are both vectors then, this[i] << shiftBy[i] If “this” is a scalar and shiftBy is a vector then returns a vector of size shiftBy.rows with the scalar << shiftBy[i] If “this” is a vector and shiftBy is a scalar then returns a vector of size this.rows with this[i] << shiftBy

public default ColumnVector shiftLeft(BinaryOperable shiftBy)#

Bitwise left shift the values of this vector by the shiftBy.

If “this” and shiftBy are both vectors then, this[i] << shiftBy[i] If “this” is a scalar and shiftBy is a vector then returns a vector of size shiftBy.rows with the scalar << shiftBy[i] If “this” is a vector and shiftBy is a scalar then returns a vector of size this.rows with this[i] << shiftBy

public default ColumnVector shiftRight(
BinaryOperable shiftBy,
DType outType
)#

Bitwise right shift this vector by the shiftBy.

If “this” and shiftBy are both vectors then, this[i] >> shiftBy[i] If “this” is a scalar and shiftBy is a vector then returns a vector of size shiftBy.rows with the scalar >> shiftBy[i] If “this” is a vector and shiftBy is a scalar then returns a vector of size this.rows with this[i] >> shiftBy

public default ColumnVector shiftRight(BinaryOperable shiftBy)#

Bitwise right shift this vector by the shiftBy.

If “this” and shiftBy are both vectors then, this[i] >> shiftBy[i] If “this” is a scalar and shiftBy is a vector then returns a vector of size shiftBy.rows with the scalar >> shiftBy[i] If “this” is a vector and shiftBy is a scalar then returns a vector of size this.rows with this[i] >> shiftBy

public default ColumnVector shiftRightUnsigned(
BinaryOperable shiftBy,
DType outType
)#

This method bitwise right shifts the values of this vector by the shiftBy.

This method always fills 0 irrespective of the sign of the number.

If “this” and shiftBy are both vectors then, this[i] >>> shiftBy[i] If “this” is a scalar and shiftBy is a vector then returns a vector of size shiftBy.rows with the scalar >>> shiftBy[i] If “this” is a vector and shiftBy is a scalar then returns a vector of size this.rows with this[i] >>> shiftBy

public default ColumnVector shiftRightUnsigned(BinaryOperable shiftBy)#

This method bitwise right shifts the values of this vector by the shiftBy.

This method always fills 0 irrespective of the sign of the number.

If “this” and shiftBy are both vectors then, this[i] >>> shiftBy[i] If “this” is a scalar and shiftBy is a vector then returns a vector of size shiftBy.rows with the scalar >>> shiftBy[i] If “this” is a vector and shiftBy is a scalar then returns a vector of size this.rows with this[i] >>> shiftBy

public default ColumnVector log(BinaryOperable rhs, DType outType)#

Calculate the log with the specified base.

public default ColumnVector log(BinaryOperable rhs)#

Calculate the log with the specified base, output is the same as this.

public default ColumnVector arctan2(
BinaryOperable xCoordinate,
DType outType
)#

The function arctan2(y,x) or atan2(y,x) is defined as the angle in the Euclidean plane, given in radians, between the positive x axis and the ray to the point (x, y) ≠ (0, 0).

public default ColumnVector arctan2(BinaryOperable xCoordinate)#

The function arctan2(y,x) or atan2(y,x) is defined as the angle in the Euclidean plane, given in radians, between the positive x axis and the ray to the point (x, y) ≠ (0, 0).

public default ColumnVector pmod(BinaryOperable rhs, DType outputType)#

Returns the positive value of lhs mod rhs.

r = lhs % rhs if r < 0 then (r + rhs) % rhs else r

public default ColumnVector pmod(BinaryOperable rhs)#

Returns the positive value of lhs mod rhs.

r = lhs % rhs if r < 0 then (r + rhs) % rhs else r

public default ColumnVector equalToNullAware(
BinaryOperable rhs,
DType outType
)#

like equalTo but NULL == NULL is TRUE and NULL == not NULL is FALSE

public default ColumnVector equalToNullAware(BinaryOperable rhs)#

like equalTo but NULL == NULL is TRUE and NULL == not NULL is FALSE

public default ColumnVector notEqualToNullAware(
BinaryOperable rhs,
DType outType
)#

like notEqualTo but NULL != NULL is TRUE and NULL != not NULL is FALSE

public default ColumnVector notEqualToNullAware(BinaryOperable rhs)#

like notEqualTo but NULL != NULL is TRUE and NULL != not NULL is FALSE

public default ColumnVector maxNullAware(
BinaryOperable rhs,
DType outType
)#

Returns the max non null value.

public default ColumnVector maxNullAware(BinaryOperable rhs)#

Returns the max non null value.

public default ColumnVector minNullAware(
BinaryOperable rhs,
DType outType
)#

Returns the min non null value.

public default ColumnVector minNullAware(BinaryOperable rhs)#

Returns the min non null value.

Static Methods

public static DType implicitConversion(
BinaryOp op,
BinaryOperable lhs,
BinaryOperable rhs
)#

Finds the proper DType for an implicit output.

This follows the typical rules of C++, Java, and most SQL implementations. FLOAT64/double > FLOAT32/float > INT64/long > INT32/int > INT16/short > INT8/byte/char

Currently most TIMESTAMPs are treated the same as INT64. TIMESTAMP_DAYS is treated the same as INT32. All time information is stripped from them. This may change in the future.

BOOL8 is treated like an INT8. Math on boolean operations makes little sense. If you want to stay as a BOOL8 you will need to explicitly specify the output type. For decimal types, DECIMAL32 and DECIMAL64 takes in another parameter scale. DType is created with scale=0 as scale is required. Dtype is discarded for binary operations for decimal types in cudf as a new DType is created for output type with the new scale.