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; usecreate(DTypeEnum, int)to create decimal types.Field Summary
Method Summary
Factory method for non-decimal DType instances.
Factory method specialized for decimal DType instances.
Create decimal-like DType using precision and scale of Java BigDecimal.
Factory method for DType instances.
Returns max precision for Decimal Type.
Get the number of decimal places needed to hold the Integral Type.
Returns scale for Decimal Type.
This only works for fixed width types.
Return enum for this DType.
Returns true if the type uses a vector of offsets.
Returns true for timestamps with time level resolution, as opposed to day level resolution.
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.
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.
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.
Returns true if this type is backed by short type Namely this method will return true for the following types DType.INT16, DType.UINT16.
Returns true if this type is of decimal type Namely this method will return true for the following types DType.DECIMAL32, DType.DECIMAL64.
Returns true for duration types.
Returns true for strictly Integer types not a type backed by ints.
Returns true for nested types.
Deprecated.
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#
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 int hashCode()#
- 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:
- 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:
- 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:
- public static DType fromJavaBigDecimal(BigDecimal dec)#
Create decimal-like DType using precision and scale of Java BigDecimal.
- Parameters:
dec – BigDecimal
- Returns:
- public enum DTypeEnum#
Enum Constant Summary
Byte wise true non-0/false 0.
Days since the UNIX epoch.
microseconds since the UNIX epoch
ms since the UNIX epoch
ns since the UNIX epoch
s since the UNIX epoch
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#