Interface RegionedColumnSource<DATA_TYPE>
- All Superinterfaces:
ChunkSource<Attributes.Values>,ChunkSource.WithPrev<Attributes.Values>,ColumnSource<DATA_TYPE>,DefaultChunkSource<Attributes.Values>,DefaultChunkSource.WithPrev<Attributes.Values>,ElementSource<DATA_TYPE>,FillContextMaker,GetContextMaker,ImmutableColumnSource<DATA_TYPE>,LongSizedDataStructure,Releasable,SizedColumnSource<DATA_TYPE>,TupleExporter<DATA_TYPE>,TupleSource<DATA_TYPE>
- All Known Implementing Classes:
RegionedColumnSourceObject,RegionedColumnSourceObject.AsValues,RegionedColumnSourceObjectWithDictionary
@VisibleForTesting public interface RegionedColumnSource<DATA_TYPE> extends ImmutableColumnSource<DATA_TYPE>, SizedColumnSource<DATA_TYPE>
Regioned column source interface.
"V2" SourceTables can be thought of a tree of partitions with
TableLocations at the leaf nodes. When building the
Index for such a Table, we statically
partition the available element address space from [0, 9223372036854775807L (2^63-1)].
We constrain the size at these leaf nodes in order to support a partitioning of the element address space into region index and sub-region element index. In order to make the calculations as inexpensive as possible, this is done by assigning X bits of each index key (element address) to the region index, and the remaining Y = 63 - X to the sub-region element index.
This type of address space allocation allows very cheap O(1) element access. Denser alternatives tend to introduce more complication and/or O(log n) lookups.
Currently, X is 23 and Y is 40, allowing tables to consist of more than 8 million locations with more than 1 trillion elements each.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource
ChunkSource.FillContext, ChunkSource.GetContext, ChunkSource.WithPrev<ATTR extends Attributes.Any>Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource
DefaultChunkSource.SupportsContiguousGet<ATTR extends Attributes.Any>, DefaultChunkSource.WithPrev<ATTR extends Attributes.Any> -
Field Summary
Fields Modifier and Type Field Description static longELEMENT_INDEX_TO_SUB_REGION_ELEMENT_INDEX_MASKThe mask for converting from an element index to a region sub-index.static intMAXIMUM_REGION_COUNTThe maximum number of regions that may be addressed.static longREGION_CAPACITY_IN_ELEMENTSThe size used for *all* regions.static intREGION_INDEX_ADDRESS_BITSAddress bits allocated to the region index.static intSUB_REGION_ELEMENT_INDEX_ADDRESS_BITSAddress bits allocated to the sub-region element index.Fields inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource
DEFAULT_FILL_INSTANCE, ZERO_LENGTH_CHUNK_SOURCE_ARRAYFields inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource.WithPrev
ZERO_LENGTH_CHUNK_SOURCE_WITH_PREV_ARRAYFields inherited from interface com.illumon.iris.db.v2.sources.ColumnSource
ZERO_LENGTH_COLUMN_SOURCE_ARRAY -
Method Summary
Modifier and Type Method Description intaddRegion(com.illumon.dataobjects.ColumnDefinition<?> columnDefinition, ColumnLocation<?> columnLocation)Add a region to this regioned column source.Methods inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource
fillChunk, getChunkTypeMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource.WithPrev
fillPrevChunkMethods inherited from interface com.illumon.iris.db.v2.sources.ColumnSource
allowsReinterpret, cast, createPreviousTuple, createTuple, createTupleFromValues, exportElement, exportElement, exportToExternalKey, getColumnSources, getComponentType, getGroupingBuilder, getGroupingProvider, getNativeType, getPrevSource, getType, hasGrouping, match, reinterpret, releaseCachedResources, setGroupingProvider, startTrackingPrevValuesMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource
getChunk, getChunk, getChunkByFilling, makeFillContext, makeGetContextMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource.WithPrev
getPrevChunk, getPrevChunk, getPrevChunkByFillingMethods inherited from interface com.illumon.iris.db.v2.sources.ElementSource
get, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getShortMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.FillContextMaker
makeFillContextMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.GetContextMaker
makeGetContextMethods inherited from interface com.illumon.iris.db.v2.sources.ImmutableColumnSource
getPrev, getPrevBoolean, getPrevByte, getPrevChar, getPrevDouble, getPrevFloat, getPrevInt, getPrevLong, getPrevShort, isImmutableMethods inherited from interface com.illumon.iris.db.util.LongSizedDataStructure
intSize, intSize, sizeMethods inherited from interface com.illumon.iris.db.v2.tuples.TupleExporter
exportElementReinterpretedMethods inherited from interface com.illumon.iris.db.v2.tuples.TupleSource
createTupleFromReinterpretedValues
-
Field Details
-
REGION_INDEX_ADDRESS_BITS
static final int REGION_INDEX_ADDRESS_BITSAddress bits allocated to the region index.- See Also:
- Constant Field Values
-
SUB_REGION_ELEMENT_INDEX_ADDRESS_BITS
static final int SUB_REGION_ELEMENT_INDEX_ADDRESS_BITSAddress bits allocated to the sub-region element index.- See Also:
- Constant Field Values
-
MAXIMUM_REGION_COUNT
static final int MAXIMUM_REGION_COUNTThe maximum number of regions that may be addressed.- See Also:
- Constant Field Values
-
REGION_CAPACITY_IN_ELEMENTS
static final long REGION_CAPACITY_IN_ELEMENTSThe size used for *all* regions.- See Also:
- Constant Field Values
-
ELEMENT_INDEX_TO_SUB_REGION_ELEMENT_INDEX_MASK
static final long ELEMENT_INDEX_TO_SUB_REGION_ELEMENT_INDEX_MASKThe mask for converting from an element index to a region sub-index.- See Also:
- Constant Field Values
-
-
Method Details
-
addRegion
int addRegion(@NotNull com.illumon.dataobjects.ColumnDefinition<?> columnDefinition, @NotNull ColumnLocation<?> columnLocation)Add a region to this regioned column source. Elements in this region are ordered after elements in other regions added previously.- Parameters:
columnDefinition- The column definition for this column source (potentially varies by region)columnLocation- The column location for the region being added- Returns:
- The index assigned to the added region
-