Interface ColumnSource<T>

All Superinterfaces:
ChunkSource<Attributes.Values>, ChunkSource.WithPrev<Attributes.Values>, DefaultChunkSource<Attributes.Values>, DefaultChunkSource.WithPrev<Attributes.Values>, ElementSource<T>, FillContextMaker, GetContextMaker, Releasable, TupleExporter<T>, TupleSource<T>
All Known Subinterfaces:
AggregateColumnSource<DB_ARRAY_TYPE,​COMPONENT_TYPE>, ColumnSourceGetDefaults.ForBoolean, ColumnSourceGetDefaults.ForByte, ColumnSourceGetDefaults.ForChar, ColumnSourceGetDefaults.ForDouble, ColumnSourceGetDefaults.ForFloat, ColumnSourceGetDefaults.ForInt, ColumnSourceGetDefaults.ForLong, ColumnSourceGetDefaults.ForLongAsDateTime, ColumnSourceGetDefaults.ForLongAsInstant, ColumnSourceGetDefaults.ForObject<DATA_TYPE>, ColumnSourceGetDefaults.ForShort, ColumnSourceGetDefaults.LongBacked<DATA_TYPE>, ContextualizedObjectColumnSource<DATA_TYPE>, DeferredGroupingColumnSource<DATA_TYPE>, ImmutableColumnSource<DATA_TYPE>, ImmutableColumnSourceGetDefaults.ForBoolean, ImmutableColumnSourceGetDefaults.ForByte, ImmutableColumnSourceGetDefaults.ForChar, ImmutableColumnSourceGetDefaults.ForDouble, ImmutableColumnSourceGetDefaults.ForFloat, ImmutableColumnSourceGetDefaults.ForInt, ImmutableColumnSourceGetDefaults.ForLong, ImmutableColumnSourceGetDefaults.ForLongAsDateTime, ImmutableColumnSourceGetDefaults.ForObject<DATA_TYPE>, ImmutableColumnSourceGetDefaults.ForShort, ImmutableColumnSourceGetDefaults.LongBacked<DATA_TYPE>, MutableColumnSource<DATA_TYPE>, MutableColumnSourceGetDefaults.ForBoolean, MutableColumnSourceGetDefaults.ForByte, MutableColumnSourceGetDefaults.ForChar, MutableColumnSourceGetDefaults.ForDouble, MutableColumnSourceGetDefaults.ForFloat, MutableColumnSourceGetDefaults.ForInt, MutableColumnSourceGetDefaults.ForLong, MutableColumnSourceGetDefaults.ForLongAsDateTime, MutableColumnSourceGetDefaults.ForLongAsInstant, MutableColumnSourceGetDefaults.ForObject<DATA_TYPE>, MutableColumnSourceGetDefaults.ForShort, MutableColumnSourceGetDefaults.LongBacked<DATA_TYPE>, RegionedColumnSource<DATA_TYPE>, ReverseLookupColumnSource<DATA_TYPE,​EXTRA_VALUE_TYPE>, SizedColumnSource<DATA_TYPE>, SizedContextualizedObjectColumnSource<DATA_TYPE>, SsmBackedColumnSource<K,​T>, SymbolTableSource<SYMBOL_TYPE>, WritableSource<T>
All Known Implementing Classes:
AbstractColumnSource, AbstractColumnSource.DefaultedImmutable, AbstractColumnSource.DefaultedMutable, AbstractDeferredGroupingColumnSource, ArrayBackedColumnSource, BitMaskingColumnSource, BitShiftingColumnSource, BooleanArraySource, BooleanAsByteColumnSource, BooleanSparseArraySource, BoxedColumnSource, BoxedColumnSource.OfDateTime, BoxedLongAsTimeSource, ByteAggregateColumnSource, ByteArraySource, ByteSingleValueSource, ByteSparseArraySource, ByteSsmBackedSource, CharacterArraySource, CharacterSingleValueSource, CharacterSparseArraySource, CharAggregateColumnSource, CharSsmBackedSource, CrossJoinRightColumnSource, DateTimeArraySource, DatetimeAsLongColumnSource, DateTimeSparseArraySource, DbDateTimeSsmSourceWrapper, DeltaAwareColumnSource, DoubleAggregateColumnSource, DoubleArraySource, DoubleNullToZeroColumnSource, DoubleSingleValueSource, DoubleSparseArraySource, DoubleSsmBackedSource, EmptyToNullStringRegionedColumnSource, FloatAggregateColumnSource, FloatArraySource, FloatSingleValueSource, FloatSparseArraySource, FloatSsmBackedSource, HashTableColumnSource, ImmutableBooleanArraySource, ImmutableByteArraySource, ImmutableCharArraySource, ImmutableDateTimeArraySource, ImmutableDoubleArraySource, ImmutableFloatArraySource, ImmutableInstantArraySource, ImmutableIntArraySource, ImmutableLongArraySource, ImmutableObjectArraySource, ImmutableShortArraySource, InstantArraySource, InstantAsLongColumnSource, InstantSparseArraySource, IntAggregateColumnSource, IntegerArraySource, IntegerSingleValueSource, IntegerSparseArraySource, IntSsmBackedSource, ListAggregateColumnSource, LocalDateWrapperSource, LocalTimeWrapperSource, LongAggregateColumnSource, LongArraySource, LongAsDateTimeColumnSource, LongAsInstantColumnSource, LongAsLocalDateColumnSource, LongAsLocalTimeColumnSource, LongAsZonedDateTimeColumnSource, LongSingleValueSource, LongSparseArraySource, LongSsmBackedSource, MergeSortedHelper.SortedMergeColumnSource, NanosBasedTimeArraySource, NanosBasedTimeSparseArraySource, NullValueColumnSource, ObjectAggregateColumnSource, ObjectArraySource, ObjectSingleValueSource, ObjectSparseArraySource, ObjectSsmBackedSource, PrevColumnSource, ReadOnlyRedirectedColumnSource, RedirectedColumnSource, RegionedColumnSourceObject, RegionedColumnSourceObject.AsValues, RegionedColumnSourceObjectWithDictionary, ReversedColumnSource, RowIdSource, ShiftedColumnSource, ShortAggregateColumnSource, ShortArraySource, ShortSingleValueSource, ShortSparseArraySource, ShortSsmBackedSource, SingleValueColumnSource, SingleValueObjectColumnSource, SmartKeySource, SparseArrayColumnSource, SwitchColumnSource, SymbolTableToUniqueIdSource, TableLogger.NoPrevColumnSource, UnboxedLongBackedColumnSource, UnboxedLongBackedWritableSource, UnboxedTimeBackedColumnSource, UngroupedArrayColumnSource, UngroupedBooleanArrayColumnSource, UngroupedBoxedBooleanArrayColumnSource, UngroupedBoxedByteArrayColumnSource, UngroupedBoxedByteDbArrayColumnSource, UngroupedBoxedCharArrayColumnSource, UngroupedBoxedCharDbArrayColumnSource, UngroupedBoxedDoubleArrayColumnSource, UngroupedBoxedDoubleDbArrayColumnSource, UngroupedBoxedFloatArrayColumnSource, UngroupedBoxedFloatDbArrayColumnSource, UngroupedBoxedIntArrayColumnSource, UngroupedBoxedIntDbArrayColumnSource, UngroupedBoxedLongArrayColumnSource, UngroupedBoxedLongDbArrayColumnSource, UngroupedBoxedShortArrayColumnSource, UngroupedBoxedShortDbArrayColumnSource, UngroupedByteArrayColumnSource, UngroupedByteDbArrayColumnSource, UngroupedCharArrayColumnSource, UngroupedCharDbArrayColumnSource, UngroupedColumnSource, UngroupedDbArrayColumnSource, UngroupedDoubleArrayColumnSource, UngroupedDoubleDbArrayColumnSource, UngroupedFloatArrayColumnSource, UngroupedFloatDbArrayColumnSource, UngroupedIntArrayColumnSource, UngroupedIntDbArrayColumnSource, UngroupedLongArrayColumnSource, UngroupedLongDbArrayColumnSource, UngroupedShortArrayColumnSource, UngroupedShortDbArrayColumnSource, UnionColumnSource, ViewColumnSource, ViewportColumnSource, ZonedDateTimeArraySource, ZonedDateTimeAsLongSource, ZonedDateTimeSparseArraySource

public interface ColumnSource<T>
extends DefaultChunkSource.WithPrev<Attributes.Values>, ElementSource<T>, TupleSource<T>, Releasable
A "source" for column data - allows cell values to be looked up by (long) keys.

Note for implementors: All ColumnSource implementations must map ReadOnlyIndex.NULL_KEY to a null value for all get and getPrev methods.

  • Field Details

  • Method Details

    • getType

      Class<T> getType()
    • getComponentType

      Class<?> getComponentType()
    • getNativeType

      Class<T> getNativeType()
      Specified by:
      getNativeType in interface ChunkSource<T>
    • match

      Index match​(boolean invertMatch, boolean usePrev, boolean caseInsensitive, Index mapper, Object... keys)
    • startTrackingPrevValues

      default void startTrackingPrevValues()
      ColumnSource implementations that track previous values have the option to not actually start tracking previous values until this method is called. This is an option, not an obligation: some simple ColumnSource implementations (like TSingleValueSource for various T) always track previous values; other implementations (like PrevColumnSource) never do; some (like TArrayColumnSource) only start tracking once this method is called. An immutable column source can not have distinct prev values; therefore it is implemented as a no-op.
    • getValuesMapping

      Map<T,​ReadOnlyIndex> getValuesMapping​(ReadOnlyIndex subRange)
    • getGroupToRange

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

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

      boolean isImmutable()
      Determine if this column source is immutable, meaning that the values at a given index key never change.
      Returns:
      true if the values at a given index of the column source never change, false otherwise
    • releaseCachedResources

      @OverridingMethodsMustInvokeSuper default void releaseCachedResources()
      Release any resources held for caching purposes. Implementations need not guarantee that concurrent accesses are correct, as the purpose of this method is to ensure cleanup for column sources that will no longer be used.
      Specified by:
      releaseCachedResources in interface Releasable
    • allowsReinterpret

      <ALTERNATE_DATA_TYPE> boolean allowsReinterpret​(@NotNull Class<ALTERNATE_DATA_TYPE> alternateDataType)
      Test if a reinterpret call will succeed.
      Parameters:
      alternateDataType - The alternative type to consider
      Returns:
      If a reinterpret on this column source with the supplied alternateDataType will succeed.
    • reinterpret

      <ALTERNATE_DATA_TYPE> ColumnSource<ALTERNATE_DATA_TYPE> reinterpret​(@NotNull Class<ALTERNATE_DATA_TYPE> alternateDataType) throws IllegalArgumentException
      Provide an alternative view into the data underlying this column source.
      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
    • getColumnSources

      default List<ColumnSource> getColumnSources()
      Description copied from interface: TupleSource
      Get the ColumnSources backing this tuple source.
      Specified by:
      getColumnSources in interface TupleSource<T>
      Returns:
      The column sources
    • createTuple

      default T createTuple​(long indexKey)
      Description copied from interface: TupleSource
      Create a tuple for key column values at the supplied index key.
      Specified by:
      createTuple in interface TupleSource<T>
      Parameters:
      indexKey - The index key
      Returns:
      The resulting tuple
    • createPreviousTuple

      default T createPreviousTuple​(long indexKey)
      Description copied from interface: TupleSource
      Create a tuple for previous key column values at the supplied index key.
      Specified by:
      createPreviousTuple in interface TupleSource<T>
      Parameters:
      indexKey - The index key
      Returns:
      The resulting tuple
    • createTupleFromValues

      default T createTupleFromValues​(@NotNull Object... values)
      Description copied from interface: TupleSource
      Create a tuple for the supplied (boxed) values.
      Specified by:
      createTupleFromValues in interface TupleSource<T>
      Parameters:
      values - The values
      Returns:
      The resulting tuple
    • exportElement

      default <ELEMENT_TYPE> void exportElement​(T tuple, int elementIndex, @NotNull WritableSource<ELEMENT_TYPE> writableSource, long destinationIndexKey)
      Description copied from interface: TupleExporter
      Export a single element from the tuple, identified by its element index, to the destination index key of the supplied writable source.

      For the empty tuple, this is unsupported.

      For singles, this will copy the sole element, possibly in boxed form.

      For doubles and longer, this will copy the specified element without any unnecessary boxing.

      Specified by:
      exportElement in interface TupleExporter<T>
      Parameters:
      tuple - The tuple to export an element from
      elementIndex - The element index to export
      writableSource - The destination
      destinationIndexKey - The destination index key
    • exportElement

      default Object exportElement​(T tuple, int elementIndex)
      Description copied from interface: TupleExporter
      Export a single element from the tuple, identified by its element index, to an Object

      For the empty tuple, this is unsupported.

      For singles, this will copy the sole element, possibly in boxed form.

      For doubles and longer, this will copy the specified element without any unnecessary boxing.

      Specified by:
      exportElement in interface TupleExporter<T>
      Parameters:
      tuple - The tuple to export an element from
      elementIndex - The element index to export
    • exportToExternalKey

      default Object exportToExternalKey​(T tuple)
      Description copied from interface: TupleExporter

      Export this tuple's element list as a key suitable for the TableMaps resulting from Table.byExternal(boolean, java.lang.String...).

      For the empty tuple this is a unsupported.

      For singles, this is the (boxed) sole element itself.

      For doubles and longer, this is a newly-allocated "SmartKey".

      Specified by:
      exportToExternalKey in interface TupleExporter<T>
      Parameters:
      tuple - The tuple to export all elements from
      Returns:
      The new smart key
    • getPrevSource

      default ChunkSource<Attributes.Values> getPrevSource()
      Specified by:
      getPrevSource in interface ChunkSource.WithPrev<T>
      Specified by:
      getPrevSource in interface DefaultChunkSource.WithPrev<T>
      Returns:
      a chunk source which accesses the previous values.
    • cast

      default <TYPE> ColumnSource<TYPE> cast​(Class<? extends TYPE> clazz)
      Returns this ColumnSource, parameterized by <TYPE>, if the data type of this column (as given by getType()) can be cast to clazz. This is analogous to casting the objects provided by this column source to clazz.

      For example, the following code will throw an exception if the "MyString" column does not actually contain String data:

           ColumnSource<String> colSource = table.getColumnSource("MyString").getParameterized(String.class)
       

      Due to the nature of type erasure, the JVM will still insert an additional cast to TYPE when elements are retrieved from the column source, such as with String myStr = colSource.get(0).

      Type Parameters:
      TYPE - The target type, as a type parameter. Intended to be inferred from clazz.
      Parameters:
      clazz - The target type.
      Returns:
      A ColumnSource parameterized by TYPE.