Class ReinterpretUtils
java.lang.Object
io.deephaven.engine.table.impl.sources.ReinterpretUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ColumnSource<Byte>booleanToByteSource(@NotNull ColumnSource<Boolean> source) Given aBooleancolumn source turn it into abytecolumn source, either via reinterpretation or wrapping.static @NotNull ColumnSource<Boolean>byteToBooleanSource(@NotNull ColumnSource<Byte> source) Given abytecolumn source turn it into aBooleancolumn source, either via reinterpretation or wrapping.static @NotNull ColumnSource<?>convertToOriginalType(@NotNull ColumnSource<?> originalSource, @NotNull ColumnSource<?> sourceToConvert) Reinterpret or boxsourceToConvertback to its original type.static @NotNull ColumnSource<Long>instantToLongSource(@NotNull ColumnSource<Instant> source) Given anInstantcolumn source turn it into alongcolumn source, either via reinterpretation or wrapping.static @NotNull ColumnSource<Instant>longToInstantSource(@NotNull ColumnSource<Long> source) Given alongcolumn source turn it into anInstantcolumn source, either via reinterpretation or wrapping.static ColumnSource<ZonedDateTime>longToZonedDateTimeSource(@NotNull ColumnSource<Long> source, @NotNull ZoneId wrapperTimeZone) Given alongcolumn source turn it into aZonedDateTimecolumn source, either via reinterpretation or wrapping.static @NotNull ColumnDefinition<?>maybeConvertToPrimitive(@NotNull ColumnDefinition<?> columnDefinition) IfcolumnDefinition.getDataType()orcolumnDefinition.getComponentTypeare something that we prefer to handle as a primitive, do the appropriate conversion.static @NotNull ColumnSource<?>maybeConvertToPrimitive(@NotNull ColumnSource<?> source) If source is something that we prefer to handle as a primitive, do the appropriate conversion.static @NotNull ColumnSource<?>[]maybeConvertToPrimitive(@NotNull ColumnSource<?>[] sources) Convert each source insourcesto a primitive if possible.static @NotNull ChunkTypemaybeConvertToPrimitiveChunkType(@NotNull Class<?> dataType) IfdataTypeis something that we prefer to handle as a primitive, emit the appropriateChunkType, else the normal ChunkType for the data type.static @NotNull Class<?>maybeConvertToPrimitiveDataType(@NotNull Class<?> dataType) IfdataTypeis something that we prefer to handle as a primitive, emit the appropriatedata type to use, else returndataType.static @NotNull WritableColumnSource<?>maybeConvertToWritablePrimitive(@NotNull WritableColumnSource<?> source) Ifsourceis something that we prefer to handle as a primitive, do the appropriate conversion.static @NotNull ChunkTypemaybeConvertToWritablePrimitiveChunkType(@NotNull Class<?> dataType) IfdataTypeis something that we prefer to handle as a primitive, emit the appropriateChunkType, else the normal ChunkType for the data type.static @Nullable WritableColumnSource<Byte>writableBooleanToByteSource(@NotNull WritableColumnSource<Boolean> source) Given a writableBooleancolumn source turn it into a writablebytecolumn source via reinterpretation if possible.static @Nullable WritableColumnSource<Long>writableInstantToLongSource(@NotNull WritableColumnSource<Instant> source) Given a writableInstantcolumn source turn it into a writablelongcolumn source via reinterpretation if possible.static @Nullable WritableColumnSource<Long>writableZonedDateTimeToLongSource(@NotNull WritableColumnSource<ZonedDateTime> source) Given a writableZonedDateTimecolumn source turn it into a writablelongcolumn source via reinterpretation if possible.static @NotNull ColumnSource<Long>zonedDateTimeToLongSource(@NotNull ColumnSource<ZonedDateTime> source) Given aZonedDateTimecolumn source turn it into alongcolumn source, either via reinterpretation or wrapping.
-
Constructor Details
-
ReinterpretUtils
public ReinterpretUtils()
-
-
Method Details
-
byteToBooleanSource
@NotNull public static @NotNull ColumnSource<Boolean> byteToBooleanSource(@NotNull @NotNull ColumnSource<Byte> source) Given abytecolumn source turn it into aBooleancolumn source, either via reinterpretation or wrapping. -
booleanToByteSource
@NotNull public static @NotNull ColumnSource<Byte> booleanToByteSource(@NotNull @NotNull ColumnSource<Boolean> source) Given aBooleancolumn source turn it into abytecolumn source, either via reinterpretation or wrapping.- Parameters:
source- the source to turn into abytesource- Returns:
- the
bytesource
-
writableBooleanToByteSource
@Nullable public static @Nullable WritableColumnSource<Byte> writableBooleanToByteSource(@NotNull @NotNull WritableColumnSource<Boolean> source) Given a writableBooleancolumn source turn it into a writablebytecolumn source via reinterpretation if possible.- Parameters:
source- the source to turn into abytesource- Returns:
- the
bytesource or null if it could not be reinterpreted
-
longToInstantSource
@NotNull public static @NotNull ColumnSource<Instant> longToInstantSource(@NotNull @NotNull ColumnSource<Long> source) Given alongcolumn source turn it into anInstantcolumn source, either via reinterpretation or wrapping.- Parameters:
source- the source to turn into anInstantsource- Returns:
- the
longsource
-
instantToLongSource
@NotNull public static @NotNull ColumnSource<Long> instantToLongSource(@NotNull @NotNull ColumnSource<Instant> source) Given anInstantcolumn source turn it into alongcolumn source, either via reinterpretation or wrapping.- Parameters:
source- the source to turn into alongsource- Returns:
- the
longsource
-
writableInstantToLongSource
@Nullable public static @Nullable WritableColumnSource<Long> writableInstantToLongSource(@NotNull @NotNull WritableColumnSource<Instant> source) Given a writableInstantcolumn source turn it into a writablelongcolumn source via reinterpretation if possible.- Parameters:
source- the source to turn into alongsource- Returns:
- the
longsource or null if it could not be reinterpreted
-
longToZonedDateTimeSource
public static ColumnSource<ZonedDateTime> longToZonedDateTimeSource(@NotNull @NotNull ColumnSource<Long> source, @NotNull @NotNull ZoneId wrapperTimeZone) Given alongcolumn source turn it into aZonedDateTimecolumn source, either via reinterpretation or wrapping.- Parameters:
source- the source to turn into aZonedDateTimesourcewrapperTimeZone- theZoneIdto use if and only if we can't apply a simple reinterpret- Returns:
- the
longsource
-
zonedDateTimeToLongSource
@NotNull public static @NotNull ColumnSource<Long> zonedDateTimeToLongSource(@NotNull @NotNull ColumnSource<ZonedDateTime> source) Given aZonedDateTimecolumn source turn it into alongcolumn source, either via reinterpretation or wrapping.- Parameters:
source- the source to turn into alongsource- Returns:
- the
longsource
-
writableZonedDateTimeToLongSource
@Nullable public static @Nullable WritableColumnSource<Long> writableZonedDateTimeToLongSource(@NotNull @NotNull WritableColumnSource<ZonedDateTime> source) Given a writableZonedDateTimecolumn source turn it into a writablelongcolumn source via reinterpretation if possible.- Parameters:
source- the source to turn into alongsource- Returns:
- the
longsource or null if it could not be reinterpreted
-
maybeConvertToPrimitive
@NotNull public static @NotNull ColumnSource<?> maybeConvertToPrimitive(@NotNull @NotNull ColumnSource<?> source) 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
-
maybeConvertToPrimitive
@NotNull public static @NotNull ColumnSource<?>[] maybeConvertToPrimitive(@NotNull @NotNull ColumnSource<?>[] sources) Convert each source insourcesto a primitive if possible.- Parameters:
sources- An array of the sources to potentially convert- Returns:
- The primitive sources for each source in
sources
-
maybeConvertToPrimitive
@NotNull public static @NotNull ColumnDefinition<?> maybeConvertToPrimitive(@NotNull @NotNull ColumnDefinition<?> columnDefinition) IfcolumnDefinition.getDataType()orcolumnDefinition.getComponentTypeare something that we prefer to handle as a primitive, do the appropriate conversion.- Parameters:
columnDefinition- The column definition to convert- Returns:
- if possible,
columnDefinitionconverted to a primitive, otherewisecolumnDefinition
-
maybeConvertToWritablePrimitive
@NotNull public static @NotNull WritableColumnSource<?> maybeConvertToWritablePrimitive(@NotNull @NotNull WritableColumnSource<?> source) Ifsourceis something that we prefer to handle as a primitive, do the appropriate conversion.- Parameters:
source- the source to convert- Returns:
- if possible,
sourceconverted to a writable primitive, otherwisesource
-
maybeConvertToPrimitiveChunkType
@NotNull public static @NotNull ChunkType maybeConvertToPrimitiveChunkType(@NotNull @NotNull Class<?> dataType) IfdataTypeis something that we prefer to handle as a primitive, emit the appropriateChunkType, else the normal ChunkType for the data type. -
maybeConvertToWritablePrimitiveChunkType
@NotNull public static @NotNull ChunkType maybeConvertToWritablePrimitiveChunkType(@NotNull @NotNull Class<?> dataType) IfdataTypeis something that we prefer to handle as a primitive, emit the appropriateChunkType, else the normal ChunkType for the data type. -
maybeConvertToPrimitiveDataType
@NotNull public static @NotNull Class<?> maybeConvertToPrimitiveDataType(@NotNull @NotNull Class<?> dataType) IfdataTypeis something that we prefer to handle as a primitive, emit the appropriatedata type to use, else returndataType.- Parameters:
dataType- The data type to examine- Returns:
- the appropriate data type to use when extracting primitives from the source
-
convertToOriginalType
@NotNull public static @NotNull ColumnSource<?> convertToOriginalType(@NotNull @NotNull ColumnSource<?> originalSource, @NotNull @NotNull ColumnSource<?> sourceToConvert) Reinterpret or boxsourceToConvertback to its original type.- Parameters:
originalSource- The source that was reinterpreted to producesourceToConvert, or a similarly-typed source for type informationsourceToConvert- The source to convert- Returns:
- reinterpret or box
sourceToConvertback to the original type if possible - Throws:
UnsupportedOperationException- for unsupported conversions
-