Class DecimalUtils

java.lang.Object
ai.rapids.cudf.DecimalUtils

public class DecimalUtils extends Object
  • Constructor Details

    • DecimalUtils

      public DecimalUtils()
  • Method Details

    • createDecimalType

      public static DType createDecimalType(int precision, int scale)
      Creates a cuDF decimal type with precision and scale
    • bounds

      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
    • outOfBounds

      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
    • lessThan

      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.
    • lessThan

      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.
    • greaterThan

      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.