Class DeferredColumnRegionBase<ATTR extends Attributes.Any,REGION_TYPE extends ColumnRegion<ATTR>>

java.lang.Object
com.illumon.iris.db.v2.sources.regioned.DeferredColumnRegionBase<ATTR,REGION_TYPE>
All Implemented Interfaces:
ChunkSource<ATTR>, FillContextMaker, GetContextMaker, Page<ATTR>, PagingChunkSource<ATTR>, ColumnRegion<ATTR>, Releasable
Direct Known Subclasses:
DeferredColumnRegionChar, DeferredColumnRegionDouble, DeferredColumnRegionFloat, DeferredColumnRegionInt, DeferredColumnRegionLong, DeferredColumnRegionObject, DeferredColumnRegionShort

public class DeferredColumnRegionBase<ATTR extends Attributes.Any,REGION_TYPE extends ColumnRegion<ATTR>> extends Object
Base deferred region implementation.
  • Method Details

    • getResultRegion

      public final REGION_TYPE getResultRegion()
    • releaseCachedResources

      @OverridingMethodsMustInvokeSuper public void releaseCachedResources()
      Description copied from interface: Releasable
      Release any resources held for caching purposes. Implementations need not guarantee that they are safe for normal use concurrently with invocations of this method.
      Specified by:
      releaseCachedResources in interface Releasable
    • getNativeType

      public Class<?> getNativeType()
      Specified by:
      getNativeType in interface ChunkSource<ATTR extends Attributes.Any>
    • length

      public long length()
      Specified by:
      length in interface Page<ATTR extends Attributes.Any>
      Returns:
      the length of this page.
    • fillChunk

      public void fillChunk(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super ATTR> 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<ATTR extends Attributes.Any>
      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
    • fillChunkAppend

      public void fillChunkAppend(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super ATTR> destination, @NotNull OrderedKeys.Iterator orderedKeysIterator)
      Description copied from interface: PagingChunkSource

      Similar to ChunkSource.fillChunk(FillContext, WritableChunk, OrderedKeys), except that the values from the ChunkSource are appended to destination, rather than placed at the beginning.

      The values to fill into destination are specified by orderedKeysIterator, whose OrderedKeys.firstKey() must exist, and must be represented by this PagingChunkSource (modulo {#link @mask}), otherwise results are undefined.

      No more than the elements in orderedKeysIterator, which are on the same page as OrderedKeys.firstKey(), have their values appended to destination, and consumed from orderedKeysIterator. Keys are on the same page when the bits outside of PagingChunkSource.mask() are identical.

      Specified by:
      fillChunkAppend in interface PagingChunkSource<ATTR extends Attributes.Any>
      Parameters:
      context - A context containing all mutable/state related data used in retrieving the Chunk. In particular, the Context may be used to provide a Chunk data pool
      destination - The chunk to append the results to.
      orderedKeysIterator - The iterator to the ordered keys, which contain at least the keys to extract from this ChunkSource. The keys to extract will be at the beginning of iteration order.
    • getChunk

      public Chunk<? extends ATTR> getChunk(@NotNull ChunkSource.GetContext context, @NotNull OrderedKeys orderedKeys)
      Description copied from interface: ChunkSource
      Returns a chunk of data corresponding to the keys from the given OrderedKeys.
      Specified by:
      getChunk in interface ChunkSource<ATTR extends Attributes.Any>
      Parameters:
      context - A context containing all mutable/state related data used in retrieving the Chunk. In particular, the Context may be used to provide a Chunk data pool
      orderedKeys - An OrderedKeys representing the keys to be fetched
      Returns:
      A chunk of data corresponding to the keys from the given OrderedKeys
    • getChunk

      public Chunk<? extends ATTR> getChunk(@NotNull ChunkSource.GetContext context, long firstKey, long lastKey)
      Description copied from interface: ChunkSource
      Same as ChunkSource.getChunk(GetContext, OrderedKeys), except that you pass in the begin and last keys representing the begin and last (inclusive) keys of a single range rather than an OrderedKeys. Typically you want to call this only if you don't have an OrderedKeys, such as during an OrderedKeys.forAllLongRanges(LongRangeConsumer) call. In this case, it allows you to avoid creating an intermediary OrderedKeys object.
      Specified by:
      getChunk in interface ChunkSource<ATTR extends Attributes.Any>
      Parameters:
      context - A context containing all mutable/state related data used in retrieving the Chunk. In particular, the Context may be used to provide a Chunk data pool
      firstKey - The beginning key (inclusive) of the range to fetch in the chunk
      lastKey - The last key (inclusive) of the range to fetch in the chunk
      Returns:
      A chunk of data corresponding to the keys from the given range.
    • makeFillContext

      public ChunkSource.FillContext makeFillContext(int chunkCapacity, SharedContext sharedContext)
      Description copied from interface: FillContextMaker
      Allocate a new ChunkSource.FillContext for filling chunks from this FillContextMaker, typically a ChunkSource.
      Specified by:
      makeFillContext in interface FillContextMaker
      Parameters:
      chunkCapacity - The maximum size of any WritableChunk that will be filled with this context
      sharedContext - Shared store of intermediate results.
      Returns:
      A context for use with fill operations
    • makeGetContext

      public ChunkSource.GetContext makeGetContext(int chunkCapacity, SharedContext sharedContext)
      Description copied from interface: GetContextMaker
      Allocate a new ChunkSource.GetContext for retrieving chunks from this GetContextMaker, typically a ChunkSource.
      Specified by:
      makeGetContext in interface GetContextMaker
      Parameters:
      chunkCapacity - The maximum size required for any WritableChunk allocated as part of the result.
      sharedContext - Shared store of intermediate results.
      Returns:
      A context for use with get operations
    • getLocation

      public ColumnLocation getLocation()
      Specified by:
      getLocation in interface ColumnRegion<ATTR extends Attributes.Any>
    • binSearchMatch

      public Index binSearchMatch(long firstKey, long lastKey, @NotNull SortPair sortPair, @NotNull Object[] sortedKeys)
      Description copied from interface: ColumnRegion
      Given that this column is sorted, match the input keys using a binary search.
      Specified by:
      binSearchMatch in interface ColumnRegion<ATTR extends Attributes.Any>
      Parameters:
      firstKey - The first key to search
      lastKey - The last key to search
      sortPair - the sorting definition
      sortedKeys - the keys to search for, in no particular order
    • supportsSpecialMatching

      public boolean supportsSpecialMatching()
      Description copied from interface: ColumnRegion
      Check if this region has special matching features.
      Specified by:
      supportsSpecialMatching in interface ColumnRegion<ATTR extends Attributes.Any>
      Returns:
      true if this has special matching features
    • specialMatch

      public Index specialMatch(@NotNull OrderedKeys keysToFilter, long regionFirstKey, boolean caseInsensitive, boolean invertMatch, @NotNull Object[] sortedKeys)
      Description copied from interface: ColumnRegion
      Specified by:
      specialMatch in interface ColumnRegion<ATTR extends Attributes.Any>
      Parameters:
      keysToFilter - the keys being filtered
      regionFirstKey - the first key within this region
      caseInsensitive - if the match is case insensitive
      invertMatch - if the match should be inverted
      sortedKeys - the keys to search for, in no particular order
      Returns:
      an index of matched rows
    • couldInclude

      public boolean couldInclude(@NotNull Object[] sortedKeys)
      Description copied from interface: ColumnRegion
      Check if the region could possibly include any of the keys we're searching for
      Specified by:
      couldInclude in interface ColumnRegion<ATTR extends Attributes.Any>
      Parameters:
      sortedKeys - the keys to search for
      Returns:
      true if the region possibly contains the values
    • chunkMatch

      public Index chunkMatch(long regionFirstKey, @NotNull OrderedKeys keysToFilter, boolean caseInsensitive, boolean invertMatch, @NotNull Object[] sortedKeys)
      Specified by:
      chunkMatch in interface ColumnRegion<ATTR extends Attributes.Any>