Package ai.rapids.cudf
Class DecimalUtils
java.lang.Object
ai.rapids.cudf.DecimalUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Map.Entry<BigDecimal,
BigDecimal> bounds
(int precision, int scale) Given decimal precision and scale, returns the lower and upper bound of current decimal type.static DType
createDecimalType
(int precision, int scale) Creates a cuDF decimal type with precision and scalestatic ColumnVector
greaterThan
(ColumnView lhs, BigDecimal rhs) Because the native greaterThan operator has issues with comparing decimal values that have different precision and scale accurately.static ColumnVector
lessThan
(BinaryOperable lhs, BigDecimal rhs, int numRows) Because the native lessThan operator has issues with comparing decimal values that have different precision and scale accurately.static ColumnVector
lessThan
(ColumnView lhs, BigDecimal rhs) Because the native lessThan operator has issues with comparing decimal values that have different precision and scale accurately.static ColumnVector
outOfBounds
(ColumnView input, int precision, int scale) With precision and scale, checks each value of input decimal column for out of bound.
-
Constructor Details
-
DecimalUtils
public DecimalUtils()
-
-
Method Details
-
createDecimalType
Creates a cuDF decimal type with precision and scale -
bounds
Given decimal precision and scale, returns the lower and upper bound of current decimal type. Be very careful when comparing these CUDF decimal comparisons really only work when both types are already the same precision and scale, and when you change the scale you end up losing information.- Parameters:
precision
- the max precision of decimal typescale
- the scale of decimal type- Returns:
- a Map Entry of BigDecimal, lower bound as the key, upper bound as the value
-
outOfBounds
With precision and scale, checks each value of input decimal column for out of bound.- Returns:
- the boolean column represents whether specific values are out of bound or not
-
lessThan
Because the native lessThan operator has issues with comparing decimal values that have different precision and scale accurately. This method takes some special steps to get rid of these issues. -
lessThan
Because the native lessThan operator has issues with comparing decimal values that have different precision and scale accurately. This method takes some special steps to get rid of these issues. -
greaterThan
Because the native greaterThan operator has issues with comparing decimal values that have different precision and scale accurately. This method takes some special steps to get rid of these issues.
-