DType#

public final class DType#

The data type of a column or scalar, with a scale for decimal types.

Non-decimal types are available as constants such as INT32; use create(DTypeEnum, int) to create decimal types.

Field Summary

Method Summary

create(DTypeEnum dt)

Factory method for non-decimal DType instances.

create(DTypeEnum dt, int scale)

Factory method specialized for decimal DType instances.

equals(Object o)

fromJavaBigDecimal(BigDecimal dec)

Create decimal-like DType using precision and scale of Java BigDecimal.

fromNative(int nativeId, int scale)

Factory method for DType instances.

getDecimalMaxPrecision()

Returns max precision for Decimal Type.

getPrecisionForInt()

Get the number of decimal places needed to hold the Integral Type.

getScale()

Returns scale for Decimal Type.

getSizeInBytes()

This only works for fixed width types.

getTypeId()

Return enum for this DType.

hashCode()

hasOffsets()

Returns true if the type uses a vector of offsets.

hasTimeResolution()

Returns true for timestamps with time level resolution, as opposed to day level resolution.

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.

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()

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()

Returns true if this type is backed by short type Namely this method will return true for the following types DType.INT16, DType.UINT16.

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()

Returns true for duration types.

isIntegral()

Returns true for strictly Integer types not a type backed by ints.

isNestedType()

Returns true for nested types.

isTimestamp()

Deprecated.

isTimestampType()

toString()

Static Fields

public static final int DECIMAL32_MAX_PRECISION = 9#
public static final int DECIMAL64_MAX_PRECISION = 18#
public static final int DECIMAL128_MAX_PRECISION = 38#
public static final DType EMPTY#
public static final DType INT8#
public static final DType INT16#
public static final DType INT32#
public static final DType INT64#
public static final DType UINT8#
public static final DType UINT16#
public static final DType UINT32#
public static final DType UINT64#
public static final DType FLOAT32#
public static final DType FLOAT64#
public static final DType BOOL8#
public static final DType TIMESTAMP_DAYS#
public static final DType TIMESTAMP_SECONDS#
public static final DType TIMESTAMP_MILLISECONDS#
public static final DType TIMESTAMP_MICROSECONDS#
public static final DType TIMESTAMP_NANOSECONDS#
public static final DType DURATION_DAYS#
public static final DType DURATION_SECONDS#
public static final DType DURATION_MILLISECONDS#
public static final DType DURATION_MICROSECONDS#
public static final DType DURATION_NANOSECONDS#
public static final DType STRING#
public static final DType LIST#
public static final DType STRUCT#

Methods

public int getDecimalMaxPrecision()#

Returns max precision for Decimal Type.

Returns:

max precision this Decimal Type can hold

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

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.

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

public DTypeEnum getTypeId()#

Return enum for this DType.

Returns:

DTypeEnum

public boolean equals(Object o)#
public int hashCode()#
public String toString()#
public boolean hasTimeResolution()#

Returns true for timestamps with time level resolution, as opposed to day level resolution.

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.

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.

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.

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.

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.

public boolean isDurationType()#

Returns true for duration types.

public boolean isIntegral()#

Returns true for strictly Integer types not a type backed by ints.

public boolean isNestedType()#

Returns true for nested types.

public boolean isTimestamp() Deprecated#
public boolean isTimestampType()#
public boolean hasOffsets()#

Returns true if the type uses a vector of offsets.

Static Methods

public static DType create(DTypeEnum dt)#

Factory method for non-decimal DType instances.

Parameters:

dt – enum corresponding to datatype.

Returns:

DType

public static DType create(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

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

public static DType fromJavaBigDecimal(BigDecimal dec)#

Create decimal-like DType using precision and scale of Java BigDecimal.

Parameters:

dec – BigDecimal

Returns:

DType

public enum DTypeEnum#

Enum Constant Summary

Method Summary

Enum Constants

EMPTY#
INT8#
INT16#
INT32#
INT64#
UINT8#
UINT16#
UINT32#
UINT64#
FLOAT32#
FLOAT64#
BOOL8#

Byte wise true non-0/false 0.

In general true will be 1.

TIMESTAMP_DAYS#

Days since the UNIX epoch.

TIMESTAMP_SECONDS#

s since the UNIX epoch

TIMESTAMP_MILLISECONDS#

ms since the UNIX epoch

TIMESTAMP_MICROSECONDS#

microseconds since the UNIX epoch

TIMESTAMP_NANOSECONDS#

ns since the UNIX epoch

DURATION_DAYS#
DURATION_SECONDS#
DURATION_MILLISECONDS#
DURATION_MICROSECONDS#
DURATION_NANOSECONDS#
STRING#
LIST#
DECIMAL32#
DECIMAL64#
DECIMAL128#
STRUCT#

Methods

public int getNativeId()#
public boolean isDecimalType()#