Interface PagingChunkSource<ATTR extends Attributes.Any>

All Superinterfaces:
ChunkSource<ATTR>, FillContextMaker, GetContextMaker
All Known Subinterfaces:
BufferedColumnRegion<ATTR>, BufferedPage<ATTR>, ChunkPage<ATTR>, ColumnRegion<ATTR>, ColumnRegionByte<ATTR>, ColumnRegionChar<ATTR>, ColumnRegionDouble<ATTR>, ColumnRegionFloat<ATTR>, ColumnRegionInt<ATTR>, ColumnRegionLong<ATTR>, ColumnRegionObject<T,​ATTR>, ColumnRegionReferencing<ATTR,​REFERENCED_COLUMN_REGION>, ColumnRegionShort<ATTR>, Page<ATTR>, Page.WithDefaults<ATTR>, Page.WithDefaultsForRepeatingValues<ATTR>, PageStore<ATTR,​INNER_ATTR,​PAGE>, RegionedPageStore<ATTR,​INNER_ATTR,​REGION_TYPE>
All Known Implementing Classes:
BooleanChunkPage, BufferedColumnRegionBase, BufferedColumnRegionByte, BufferedColumnRegionChar, BufferedColumnRegionDouble, BufferedColumnRegionFloat, BufferedColumnRegionInt, BufferedColumnRegionLong, BufferedColumnRegionShort, BufferedPageByte, BufferedPageChar, BufferedPageDouble, BufferedPageFloat, BufferedPageInt, BufferedPageLong, BufferedPageShort, ByteChunkPage, CharChunkPage, ColumnChunkPageStore, ColumnRegion.Null, ColumnRegionByte.Null, ColumnRegionByte.StaticPageStore, ColumnRegionChar.Null, ColumnRegionChar.StaticPageStore, ColumnRegionChunkDictionary, ColumnRegionDouble.Null, ColumnRegionDouble.StaticPageStore, ColumnRegionFloat.Null, ColumnRegionFloat.StaticPageStore, ColumnRegionInt.Null, ColumnRegionInt.StaticPageStore, ColumnRegionLong.Null, ColumnRegionLong.StaticPageStore, ColumnRegionObject.DictionaryKeysWrapper, ColumnRegionObject.IntDictionaryKeysWrapper, ColumnRegionObject.Null, ColumnRegionObject.StaticPageStore, ColumnRegionObjectCached, ColumnRegionObjectCodecFixed, ColumnRegionObjectCodecVariable, ColumnRegionObjectWithDictionary, ColumnRegionReferencing.Null, ColumnRegionReferencingImpl, ColumnRegionShort.Null, ColumnRegionShort.StaticPageStore, ColumnRegionStringSet, DeferredColumnRegionBase, DeferredColumnRegionChar, DeferredColumnRegionDouble, DeferredColumnRegionFloat, DeferredColumnRegionInt, DeferredColumnRegionLong, DeferredColumnRegionObject, DeferredColumnRegionReferencing, DeferredColumnRegionShort, DoubleChunkPage, FloatChunkPage, IntChunkPage, LongChunkPage, ObjectChunkPage, ParquetColumnRegionBase, ParquetColumnRegionByte, ParquetColumnRegionChar, ParquetColumnRegionDouble, ParquetColumnRegionFloat, ParquetColumnRegionInt, ParquetColumnRegionLong, ParquetColumnRegionObject, ParquetColumnRegionShort, ParquetColumnRegionSymbolTable, RegionedColumnSourceObject, RegionedColumnSourceObject.AsValues, RegionedColumnSourceObjectWithDictionary, RegionedPageStore.Static, ShortChunkPage

public interface PagingChunkSource<ATTR extends Attributes.Any>
extends ChunkSource<ATTR>
In order to be able to cache and reuse ChunkSources across multiple Tables (or other references), PagingChunkSource adds a mask to the ChunkSource, and supports some additional fillChunk methods. The mask is a bitmask of the lower order bits of the keys in an OrderKeys, which specifies the bits from the OrderedKeys which will be used to uniquely specify the offsets into the ChunkSource elements on calls to ChunkSource.fillChunk(FillContext, WritableChunk, OrderedKeys), ChunkSource.getChunk(GetContext, OrderedKeys), ChunkSource.getChunk(GetContext, long, long). Also, a new method fillChunkAppend(FillContext, WritableChunk, OrderedKeys.Iterator) is added, which supports doing a fillChunk incrementally across a series of pages.
  • Method Details

    • mask

      long mask()
      This mask is applied to OrderedKeys which are passed into ChunkSource.getChunk(ChunkSource.GetContext, OrderedKeys) and ChunkSource.fillChunk(ChunkSource.FillContext, WritableChunk, OrderedKeys). This allows the PagingChunkSources to be cached, and reused even if they are properly relocated in key space.
      Returns:
      the mask for this page, which must be a bitmask representing the some number of lower order bits of a long.
    • maxRow

      default long maxRow​(long row)

      The maxRow is the greatest possible row which may reference this ChunkSource. This method is used by fillChunkAppend(FillContext, WritableChunk, OrderedKeys.Iterator) to determine which of its OrderedKeys are referencing this PagingChunkSource.

      The default implementation assumes that only one PagingChunkSource exits for each page reference. That is, there is only one PagingChunkSource for OrderedKeys with the same bits outside of mask().

      It is also possible to pack multiple, non-overlapping PagingChunkSources into the same page reference. In this case, one typically will want to override maxRow. An example such implementation is ChunkPage.

      Parameters:
      row - Any row contained on this page.
      Returns:
      the maximum last row of this page, located in the same way as row.
    • fillChunkAppend

      void fillChunkAppend​(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super ATTR> destination, @NotNull OrderedKeys.Iterator orderedKeysIterator)

      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 mask() are identical.

      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.