DecimalUtils#
- public class DecimalUtils#
Utility methods for creating decimal types and comparing decimal columns.
Method Summary
Given decimal precision and scale, returns the lower and upper bound of current decimal type.
Creates a cuDF decimal type with precision and scale.
Because the native greaterThan operator has issues with comparing decimal values that have different precision and scale accurately.
Because the native lessThan operator has issues with comparing decimal values that have different precision and scale accurately.
Because the native lessThan operator has issues with comparing decimal values that have different precision and scale accurately.
With precision and scale, checks each value of input decimal column for out of bound.
Static Methods
- public static DType createDecimalType(int precision, int scale)#
Creates a cuDF decimal type with precision and scale.
- public static Map.Entry<BigDecimal, BigDecimal> bounds(
- int precision,
- int scale
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 type
scale – the scale of decimal type
- Returns:
a Map Entry of BigDecimal, lower bound as the key, upper bound as the value
- public static ColumnVector outOfBounds(
- ColumnView input,
- int precision,
- int scale
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
- public 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.
This method takes some special steps to get rid of these issues.
- public 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.
This method takes some special steps to get rid of these issues.
- public static ColumnVector greaterThan(ColumnView lhs, BigDecimal rhs)#
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.