Class AbstractColumnSource<T>

java.lang.Object
com.illumon.iris.db.v2.sources.AbstractColumnSource<T>
All Implemented Interfaces:
ChunkSource<Attributes.Values>, ChunkSource.WithPrev<Attributes.Values>, DefaultChunkSource<Attributes.Values>, DefaultChunkSource.WithPrev<Attributes.Values>, FillContextMaker, GetContextMaker, ColumnSource<T>, ElementSource<T>, Releasable, TupleExporter<T>, TupleSource<T>, Serializable
Direct Known Subclasses:
AbstractColumnSource.DefaultedImmutable, AbstractColumnSource.DefaultedMutable, AbstractDeferredGroupingColumnSource, BitMaskingColumnSource, BitShiftingColumnSource, BooleanAsByteColumnSource, BoxedColumnSource, BoxedLongAsTimeSource, ByteAggregateColumnSource, ByteSsmBackedSource, CharAggregateColumnSource, CharSsmBackedSource, CrossJoinRightColumnSource, DbDateTimeSsmSourceWrapper, DeltaAwareColumnSource, DoubleAggregateColumnSource, DoubleNullToZeroColumnSource, DoubleSsmBackedSource, EmptyToNullStringRegionedColumnSource, FloatAggregateColumnSource, FloatSsmBackedSource, HashTableColumnSource, ImmutableBooleanArraySource, ImmutableByteArraySource, ImmutableCharArraySource, ImmutableDateTimeArraySource, ImmutableDoubleArraySource, ImmutableFloatArraySource, ImmutableInstantArraySource, ImmutableIntArraySource, ImmutableLongArraySource, ImmutableObjectArraySource, ImmutableShortArraySource, IntAggregateColumnSource, IntSsmBackedSource, ListAggregateColumnSource, LocalDateWrapperSource, LocalTimeWrapperSource, LongAggregateColumnSource, LongSsmBackedSource, MergeSortedHelper.SortedMergeColumnSource, NullValueColumnSource, ObjectAggregateColumnSource, ObjectSsmBackedSource, PrevColumnSource, ReversedColumnSource, RowIdSource, ShortAggregateColumnSource, ShortSsmBackedSource, SingleValueColumnSource, SingleValueObjectColumnSource, SmartKeySource, SwitchColumnSource, SymbolTableToUniqueIdSource, TableLogger.NoPrevColumnSource, UnboxedLongBackedColumnSource, UnboxedTimeBackedColumnSource, UngroupedColumnSource, UnionColumnSource, ViewColumnSource, ViewportColumnSource

public abstract class AbstractColumnSource<T>
extends Object
implements ColumnSource<T>, Serializable
The basis for all Column Sources. This class contains the default implementations for various grouping operations as well as basic chunking.
See Also:
Serialized Form
  • Field Details

  • Constructor Details

  • Method Details

    • getType

      public Class<T> getType()
      Specified by:
      getType in interface ColumnSource<T>
    • getComponentType

      public Class<?> getComponentType()
      Specified by:
      getComponentType in interface ColumnSource<T>
    • getGroupToRange

      public Map<T,​ReadOnlyIndex> getGroupToRange()
      Description copied from interface: ColumnSource
      Compute grouping information for all keys present in this column source.
      Specified by:
      getGroupToRange in interface ColumnSource<T>
      Returns:
      A map from distinct data values to an index that contains those values
    • getGroupToRange

      public Map<T,​ReadOnlyIndex> getGroupToRange​(ReadOnlyIndex index)
      Description copied from interface: ColumnSource
      Compute grouping information for (at least) all keys present in index.
      Specified by:
      getGroupToRange in interface ColumnSource<T>
      Parameters:
      index - The index to consider
      Returns:
      A map from distinct data values to an index that contains those values
    • setGroupToRange

      public final void setGroupToRange​(@Nullable Map<T,​ReadOnlyIndex> groupToRange)
    • match

      public Index match​(boolean invertMatch, boolean usePrev, boolean caseInsensitive, Index mapper, Object... keys)
      Specified by:
      match in interface ColumnSource<T>
    • getValuesMapping

      public Map<T,​ReadOnlyIndex> getValuesMapping​(ReadOnlyIndex subRange)
      Specified by:
      getValuesMapping in interface ColumnSource<T>
    • isSerializable

      public boolean isSerializable()
      Finds the most derived class that has an IsSerializable annotation, and returns its value. If no annotation is found, then returns false. Note: This is an internal Deephaven function and may be removed or changed at any time.
    • getNativeType

      public Class<T> getNativeType()
      Specified by:
      getNativeType in interface ChunkSource<T>
      Specified by:
      getNativeType in interface ColumnSource<T>
    • fillChunk

      public void fillChunk​(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Attributes.Values> destination, @NotNull OrderedKeys orderedKeys)
      Description copied from interface: ChunkSource
      Populates the given destination chunk with data corresponding to the keys from the given OrderedKeys.
      Specified by:
      fillChunk in interface ChunkSource<T>
      Parameters:
      context - A context containing all mutable/state related data used in retrieving the Chunk.
      destination - The chunk to be populated according to orderedKeys. No assumptions shall be made about the size of the chunk shall be made. The chunk will be populated from position [0,orderedKeys.size()).
      orderedKeys - An OrderedKeys representing the keys to be fetched
    • defaultFillChunk

      @VisibleForTesting public final void defaultFillChunk​(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Attributes.Values> destination, @NotNull OrderedKeys orderedKeys)
    • fillPrevChunk

      public void fillPrevChunk​(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Attributes.Values> destination, @NotNull OrderedKeys orderedKeys)
      Description copied from interface: ChunkSource.WithPrev
      Populates the given destination chunk with data corresponding to the keys from the given OrderedKeys.
      Specified by:
      fillPrevChunk in interface ChunkSource.WithPrev<T>
      Parameters:
      context - A context containing all mutable/state related data used in retrieving the Chunk.
      destination - The chunk to be populated according to orderedKeys. No assumptions shall be made about the size of the chunk shall be made. The chunk will be populated from position [0,orderedKeys.size()).
      orderedKeys - An OrderedKeys representing the keys to be fetched
    • allowsReinterpret

      public <ALTERNATE_DATA_TYPE> boolean allowsReinterpret​(@NotNull Class<ALTERNATE_DATA_TYPE> alternateDataType)
      Description copied from interface: ColumnSource
      Test if a reinterpret call will succeed.
      Specified by:
      allowsReinterpret in interface ColumnSource<T>
      Parameters:
      alternateDataType - The alternative type to consider
      Returns:
      If a reinterpret on this column source with the supplied alternateDataType will succeed.
    • reinterpret

      public final <ALTERNATE_DATA_TYPE> ColumnSource<ALTERNATE_DATA_TYPE> reinterpret​(@NotNull Class<ALTERNATE_DATA_TYPE> alternateDataType) throws IllegalArgumentException
      Description copied from interface: ColumnSource
      Provide an alternative view into the data underlying this column source.
      Specified by:
      reinterpret in interface ColumnSource<T>
      Parameters:
      alternateDataType - The alternative type to expose
      Returns:
      A column source of the alternate data type, backed by the same underlying data.
      Throws:
      IllegalArgumentException - If the alternativeDataType supplied is not supported
    • doReinterpret

      protected <ALTERNATE_DATA_TYPE> ColumnSource<ALTERNATE_DATA_TYPE> doReinterpret​(@NotNull Class<ALTERNATE_DATA_TYPE> alternateDataType)
      Supply allowed reinterpret results. The default implementation handles the most common case to avoid code duplication.
      Parameters:
      alternateDataType - The alternate data type
      Returns:
      The resulting ColumnSource
    • computeFlattenedGroupings

      public static <TYPE> Map<TYPE,​ReadOnlyIndex> computeFlattenedGroupings​(@NotNull Index index, @Nullable ColumnSource<TYPE> columnSource)
      Get a map from unique, boxed values in this column to a flat index of keys where they are present.
      Parameters:
      index - The index that defines the column along with the column source
      columnSource - The column source that defines the column along with the index
      Returns:
      A new value to range map (i.e. grouping metadata)
    • forEachGroup

      public static <TYPE> void forEachGroup​(@NotNull Map<TYPE,​ReadOnlyIndex> groupToIndex, @NotNull BiConsumer<TYPE,​ReadOnlyIndex> groupConsumer)
      Consume all groups in a group-to-index map.
      Parameters:
      groupToIndex - The group-to-index map to consume
      groupConsumer - Consumer for responsive groups
    • groupingToFlatSources

      public static <TYPE> com.fishlib.base.Pair<ArrayBackedColumnSource<TYPE>,​ObjectArraySource<ReadOnlyIndex>> groupingToFlatSources​(@NotNull ColumnSource<TYPE> originalKeyColumnSource, @NotNull Map<TYPE,​ReadOnlyIndex> groupToIndex)
      Convert a group-to-index map to a pair of flat in-memory column sources, one for the keys and one for the indexes.
      Parameters:
      originalKeyColumnSource - The key column source whose contents are reflected by the group-to-index map (used for typing, only)
      groupToIndex - The group-to-index map to convert
      Returns:
      A pair of a flat key column source and a flat index column source
    • groupingToFlatSources

      public static <TYPE> com.fishlib.base.Pair<ArrayBackedColumnSource<TYPE>,​ObjectArraySource<ReadOnlyIndex>> groupingToFlatSources​(@NotNull Class valueType, Class componentType, @NotNull Map<TYPE,​ReadOnlyIndex> groupToIndex)
      Convert a group-to-index map to a pair of flat in-memory column sources, one for the keys and one for the indexes.
      Parameters:
      valueType - The column type of the value column
      componentType - The component type of the column
      groupToIndex - The group-to-index map to convert
      Returns:
      A pair of a flat key column source and a flat index column source
    • forEachResponsiveGroup

      public static <TYPE> void forEachResponsiveGroup​(@NotNull Map<TYPE,​ReadOnlyIndex> groupToIndex, @NotNull ReadOnlyIndex intersect, @NotNull BiConsumer<TYPE,​ReadOnlyIndex> groupConsumer)
      Consume all responsive groups in a group-to-index map.
      Parameters:
      groupToIndex - The group-to-index map to consume
      intersect - Limit indices to values contained within intersect, eliminating empty result groups
      groupConsumer - Consumer for responsive groups
    • groupingToFlatSources

      public static <TYPE> com.fishlib.base.Pair<ArrayBackedColumnSource<TYPE>,​ObjectArraySource<ReadOnlyIndex>> groupingToFlatSources​(@NotNull ColumnSource<TYPE> originalKeyColumnSource, @NotNull Map<TYPE,​ReadOnlyIndex> groupToIndex, @NotNull ReadOnlyIndex intersect, @NotNull org.apache.commons.lang3.mutable.MutableInt responsiveGroups)
      Convert a group-to-index map to a pair of flat in-memory column sources, one for the keys and one for the indexes.
      Parameters:
      originalKeyColumnSource - The key column source whose contents are reflected by the group-to-index map (used for typing, only)
      groupToIndex - The group-to-index map to convert
      intersect - Limit returned indices to values contained within intersect
      responsiveGroups - Set to the number of responsive groups on exit
      Returns:
      A pair of a flat key column source and a flat index column source