Class DType

java.lang.Object
ai.rapids.cudf.DType

public final class DType extends Object
  • Field Details

    • DECIMAL32_MAX_PRECISION

      public static final int DECIMAL32_MAX_PRECISION
      See Also:
    • DECIMAL64_MAX_PRECISION

      public static final int DECIMAL64_MAX_PRECISION
      See Also:
    • DECIMAL128_MAX_PRECISION

      public static final int DECIMAL128_MAX_PRECISION
      See Also:
    • EMPTY

      public static final DType EMPTY
    • INT8

      public static final DType INT8
    • INT16

      public static final DType INT16
    • INT32

      public static final DType INT32
    • INT64

      public static final DType INT64
    • UINT8

      public static final DType UINT8
    • UINT16

      public static final DType UINT16
    • UINT32

      public static final DType UINT32
    • UINT64

      public static final DType UINT64
    • FLOAT32

      public static final DType FLOAT32
    • FLOAT64

      public static final DType FLOAT64
    • BOOL8

      public static final DType BOOL8
    • TIMESTAMP_DAYS

      public static final DType TIMESTAMP_DAYS
    • TIMESTAMP_SECONDS

      public static final DType TIMESTAMP_SECONDS
    • TIMESTAMP_MILLISECONDS

      public static final DType TIMESTAMP_MILLISECONDS
    • TIMESTAMP_MICROSECONDS

      public static final DType TIMESTAMP_MICROSECONDS
    • TIMESTAMP_NANOSECONDS

      public static final DType TIMESTAMP_NANOSECONDS
    • DURATION_DAYS

      public static final DType DURATION_DAYS
    • DURATION_SECONDS

      public static final DType DURATION_SECONDS
    • DURATION_MILLISECONDS

      public static final DType DURATION_MILLISECONDS
    • DURATION_MICROSECONDS

      public static final DType DURATION_MICROSECONDS
    • DURATION_NANOSECONDS

      public static final DType DURATION_NANOSECONDS
    • STRING

      public static final DType STRING
    • LIST

      public static final DType LIST
    • STRUCT

      public static final DType STRUCT
  • Method Details

    • getDecimalMaxPrecision

      public int getDecimalMaxPrecision()
      Returns max precision for Decimal Type.
      Returns:
      max precision this Decimal Type can hold
    • getPrecisionForInt

      public int getPrecisionForInt()
      Get the number of decimal places needed to hold the Integral Type. NOTE: this method is NOT for Decimal Type but for Integral Type.
      Returns:
      the minimum decimal precision (places) for Integral Type
    • getSizeInBytes

      public int getSizeInBytes()
      This only works for fixed width types. Variable width types like strings the value is undefined and should be ignored.
      Returns:
      size of type in bytes.
    • getScale

      public int getScale()
      Returns scale for Decimal Type.
      Returns:
      scale base-10 exponent to multiply the unscaled value to produce the decimal value. Example: Consider unscaled value = 123456 if scale = -2, decimal value = 123456 * 10^-2 = 1234.56 if scale = 2, decimal value = 123456 * 10^2 = 12345600
    • getTypeId

      public DType.DTypeEnum getTypeId()
      Return enum for this DType
      Returns:
      DTypeEnum
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • create

      public static DType create(DType.DTypeEnum dt)
      Factory method for non-decimal DType instances.
      Parameters:
      dt - enum corresponding to datatype.
      Returns:
      DType
    • create

      public static DType create(DType.DTypeEnum dt, int scale)
      Factory method specialized for decimal DType instances.
      Parameters:
      dt - enum corresponding to datatype.
      scale - base-10 exponent to multiply the unscaled value to produce the decimal value. Example: Consider unscaled value = 123456 if scale = -2, decimal value = 123456 * 10^-2 = 1234.56 if scale = 2, decimal value = 123456 * 10^2 = 12345600
      Returns:
      DType
    • fromNative

      public static DType fromNative(int nativeId, int scale)
      Factory method for DType instances
      Parameters:
      nativeId - nativeId of DataTypeEnun
      scale - base-10 exponent to multiply the unscaled value to produce the decimal value Example: Consider unscaled value = 123456 if scale = -2, decimal value = 123456 * 10^-2 = 1234.56 if scale = 2, decimal value = 123456 * 10^2 = 12345600
      Returns:
      DType
    • fromJavaBigDecimal

      public static DType fromJavaBigDecimal(BigDecimal dec)
      Create decimal-like DType using precision and scale of Java BigDecimal.
      Parameters:
      dec - BigDecimal
      Returns:
      DType
    • hasTimeResolution

      public boolean hasTimeResolution()
      Returns true for timestamps with time level resolution, as opposed to day level resolution
    • isBackedByInt

      public boolean isBackedByInt()
      Returns true if this type is backed by int type Namely this method will return true for the following types DType.INT32, DType.UINT32, DType.DURATION_DAYS, DType.TIMESTAMP_DAYS, DType.DECIMAL32
    • isBackedByLong

      public boolean isBackedByLong()
      Returns true if this type is backed by long type Namely this method will return true for the following types DType.INT64, DType.UINT64, DType.DURATION_SECONDS, DType.DURATION_MILLISECONDS, DType.DURATION_MICROSECONDS, DType.DURATION_NANOSECONDS, DType.TIMESTAMP_SECONDS, DType.TIMESTAMP_MILLISECONDS, DType.TIMESTAMP_MICROSECONDS, DType.TIMESTAMP_NANOSECONDS, DType.DECIMAL64
    • isBackedByShort

      public boolean isBackedByShort()
      Returns true if this type is backed by short type Namely this method will return true for the following types DType.INT16, DType.UINT16
    • isBackedByByte

      public boolean isBackedByByte()
      Returns true if this type is backed by byte type Namely this method will return true for the following types DType.INT8, DType.UINT8, DType.BOOL8
    • isDecimalType

      public boolean isDecimalType()
      Returns true if this type is of decimal type Namely this method will return true for the following types DType.DECIMAL32, DType.DECIMAL64
    • isDurationType

      public boolean isDurationType()
      Returns true for duration types
    • isIntegral

      public boolean isIntegral()
      Returns true for strictly Integer types not a type backed by ints
    • isNestedType

      public boolean isNestedType()
      Returns true for nested types
    • isTimestamp

      @Deprecated public boolean isTimestamp()
      Deprecated.
    • isTimestampType

      public boolean isTimestampType()
    • hasOffsets

      public boolean hasOffsets()
      Returns true if the type uses a vector of offsets