Package com.illumon.iris.db.v2.sources
Class ReinterpretUtilities
java.lang.Object
com.illumon.iris.db.v2.sources.ReinterpretUtilities
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ColumnSource<Byte>
booleanToByteSource
(ColumnSource<?> source) Given a Boolean column source turn it into a byte column source, either via reinterpretation or wrapping.static ColumnSource<?>
convertToOriginal
(Class<?> originalType, ColumnSource<?> source) Reinterpret or boxColumnSource
back to its original type.static ColumnSource<Long>
dateTimeToLongSource
(ColumnSource<?> source) Given a DateTime column source turn it into a long column source, either via reinterpretation or wrapping.static ColumnSource<Long>
instantToLongSource
(ColumnSource<?> source) Given anInstant
column source turn it into a long column source, either via reinterpretation or wrapping.static ColumnSource<?>
maybeConvertToPrimitive
(ColumnSource<?> source) If source is something that we prefer to handle as a primitive, do the appropriate conversion.static ChunkType
maybeConvertToWritablePrimitiveChunkType
(Class<?> dataType) IfdataType
is something that we prefer to handle as a primitive, emit the appropriateChunkType
, else the normal ChunkType for the data type.static ColumnSource<Long>
zonedDateTimeToLongSource
(ColumnSource<?> source) Given aZonedDateTime
column source turn it into a long column source, either via reinterpretation or wrapping.
-
Constructor Details
-
ReinterpretUtilities
public ReinterpretUtilities()
-
-
Method Details
-
instantToLongSource
Given anInstant
column source turn it into a long column source, either via reinterpretation or wrapping.- Parameters:
source
- the source to turn into a long source- Returns:
- the long source
-
zonedDateTimeToLongSource
@NotNull public static ColumnSource<Long> zonedDateTimeToLongSource(@NotNull ColumnSource<?> source) Given aZonedDateTime
column source turn it into a long column source, either via reinterpretation or wrapping.- Parameters:
source
- the source to turn into a long source- Returns:
- the long source
-
dateTimeToLongSource
Given a DateTime column source turn it into a long column source, either via reinterpretation or wrapping.- Parameters:
source
- the source to turn into a long source- Returns:
- the long source
-
booleanToByteSource
Given a Boolean column source turn it into a byte column source, either via reinterpretation or wrapping.- Parameters:
source
- the source to turn into a byte source- Returns:
- the byte source
-
maybeConvertToPrimitive
If source is something that we prefer to handle as a primitive, do the appropriate conversion.- Parameters:
source
- The source to convert- Returns:
- If possible, the source converted to a primitive, otherwise the source
-
convertToOriginal
public static ColumnSource<?> convertToOriginal(@NotNull Class<?> originalType, @NotNull ColumnSource<?> source) Reinterpret or boxColumnSource
back to its original type.- Parameters:
originalType
- The type to convert tosource
- The source to convert- Returns:
- Reinterpret or box source back to the original type if possible
-
maybeConvertToWritablePrimitiveChunkType
@NotNull public static ChunkType maybeConvertToWritablePrimitiveChunkType(@NotNull Class<?> dataType) IfdataType
is something that we prefer to handle as a primitive, emit the appropriateChunkType
, else the normal ChunkType for the data type.
-