Class GroupedWritableRowRedirection
java.lang.Object
io.deephaven.engine.table.impl.util.GroupedWritableRowRedirection
- All Implemented Interfaces:
ChunkSink<RowKeys>,ChunkSource<RowKeys>,ChunkSource.WithPrev<RowKeys>,FillContextMaker,GetContextMaker,DefaultChunkSource<RowKeys>,DefaultChunkSource.WithPrev<RowKeys>,FillUnordered<RowKeys>,RowRedirection,WritableRowRedirection
The GroupedWritableRowRedirection is intended for situations where you have several row sets that represent
contiguous rows of your output table and a flat output RowSet.
When sorting a table by indexed columns, instead of using a large contiguous WritableRowRedirection, we simply store the row sets for each group and the accumulated cardinality. We then binary search in the accumulated cardinality for a given key; and fetch the corresponding offset from that group's row set.
This WritableRowRedirection does not support mutation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.table.ChunkSink
ChunkSink.FillFromContextNested classes/interfaces inherited from interface io.deephaven.engine.table.ChunkSource
ChunkSource.FillContext, ChunkSource.GetContext, ChunkSource.WithPrev<ATTR extends Any>Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.DefaultChunkSource
DefaultChunkSource.SupportsContiguousGet<ATTR extends Any>, DefaultChunkSource.WithPrev<ATTR extends Any>Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.util.WritableRowRedirection
WritableRowRedirection.Factory -
Field Summary
Fields inherited from interface io.deephaven.engine.table.ChunkSource
DEFAULT_FILL_INSTANCE, ZERO_LENGTH_CHUNK_SOURCE_ARRAYFields inherited from interface io.deephaven.engine.table.ChunkSource.WithPrev
ZERO_LENGTH_CHUNK_SOURCE_WITH_PREV_ARRAYFields inherited from interface io.deephaven.engine.table.impl.util.WritableRowRedirection
DEFAULT_FILL_FROM_INSTANCE, FACTORY -
Constructor Summary
ConstructorsConstructorDescriptionGroupedWritableRowRedirection(long size, long[] groupSizes, RowSet[] groups) -
Method Summary
Modifier and TypeMethodDescriptionvoidfillChunk(@NotNull ChunkSource.FillContext fillContext, @NotNull WritableChunk<? super RowKeys> innerRowKeys, @NotNull RowSequence outerRowKeys) Lookup each element in aRowSequenceand write the result to aWritableLongChunk.voidfillPrevChunk(@NotNull ChunkSource.FillContext fillContext, @NotNull WritableChunk<? super RowKeys> innerRowKeys, @NotNull RowSequence outerRowKeys) Lookup each element in aRowSequenceusing previous values and write the result to aWritableLongChunk.longget(long outerRowKey) Simple redirected lookup.longgetPrev(long outerRowKey) Simple redirected lookup, using previous values.longput(long outerRowKey, long innerRowKey) Add or change a mapping fromouterRowKeytoinnerRowKey.longremove(long outerRowKey) Remove a mapping fromouterRowKey.voidInitiate previous value tracking.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.deephaven.engine.table.impl.DefaultChunkSource
getChunk, getChunk, getChunkByFilling, makeFillContext, makeGetContextMethods inherited from interface io.deephaven.engine.table.impl.DefaultChunkSource.WithPrev
getPrevChunk, getPrevChunk, getPrevChunkByFilling, getPrevSourceMethods inherited from interface io.deephaven.engine.table.FillContextMaker
makeFillContextMethods inherited from interface io.deephaven.engine.table.GetContextMaker
makeGetContextMethods inherited from interface io.deephaven.engine.table.impl.util.RowRedirection
ascendingMapping, fillChunkUnordered, fillPrevChunkUnordered, getChunkType, isWritable, providesFillUnordered, writableCastMethods inherited from interface io.deephaven.engine.table.impl.util.WritableRowRedirection
applyShift, fillFromChunk, fillFromChunkUnordered, makeFillFromContext, putVoid, removeAll, removeAllUnordered, removeVoid
-
Constructor Details
-
GroupedWritableRowRedirection
-
-
Method Details
-
get
public long get(long outerRowKey) Description copied from interface:RowRedirectionSimple redirected lookup.- Specified by:
getin interfaceRowRedirection- Parameters:
outerRowKey- The "outer" row key- Returns:
- The corresponding "inner" row key, or
RowSequence.NULL_ROW_KEYif no mapping exists
-
getPrev
public long getPrev(long outerRowKey) Description copied from interface:RowRedirectionSimple redirected lookup, using previous values.- Specified by:
getPrevin interfaceRowRedirection- Parameters:
outerRowKey- The "outer" row key- Returns:
- The corresponding "inner" row key, or
RowSequence.NULL_ROW_KEYif no mapping exists
-
fillChunk
public void fillChunk(@NotNull @NotNull ChunkSource.FillContext fillContext, @NotNull @NotNull WritableChunk<? super RowKeys> innerRowKeys, @NotNull @NotNull RowSequence outerRowKeys) Description copied from interface:RowRedirectionLookup each element in aRowSequenceand write the result to aWritableLongChunk.- Specified by:
fillChunkin interfaceChunkSource<RowKeys>- Specified by:
fillChunkin interfaceRowRedirection- Parameters:
fillContext- Thefill contextinnerRowKeys- The resultWritableLongChunkouterRowKeys- The row keys to lookup in this RowRedirection
-
fillPrevChunk
public void fillPrevChunk(@NotNull @NotNull ChunkSource.FillContext fillContext, @NotNull @NotNull WritableChunk<? super RowKeys> innerRowKeys, @NotNull @NotNull RowSequence outerRowKeys) Description copied from interface:RowRedirectionLookup each element in aRowSequenceusing previous values and write the result to aWritableLongChunk.- Specified by:
fillPrevChunkin interfaceChunkSource.WithPrev<RowKeys>- Specified by:
fillPrevChunkin interfaceRowRedirection- Parameters:
fillContext- Thefill contextinnerRowKeys- The resultWritableLongChunkouterRowKeys- The row keys to lookup in this RowRedirection
-
remove
public long remove(long outerRowKey) Description copied from interface:WritableRowRedirectionRemove a mapping fromouterRowKey.- Specified by:
removein interfaceWritableRowRedirection- Parameters:
outerRowKey- The outer row key to unmap- Returns:
- The inner row key previously mapped from
outerRowKey, orRowSequence.NULL_ROW_KEYif there was no mapping
-
put
public long put(long outerRowKey, long innerRowKey) Description copied from interface:WritableRowRedirectionAdd or change a mapping fromouterRowKeytoinnerRowKey.- Specified by:
putin interfaceWritableRowRedirection- Parameters:
outerRowKey- The outer row key to map frominnerRowKey- The inner row key to map to- Returns:
- The inner row key previously mapped from
outerRowKey, orRowSequence.NULL_ROW_KEYif there was no mapping
-
startTrackingPrevValues
public void startTrackingPrevValues()Description copied from interface:WritableRowRedirectionInitiate previous value tracking.- Specified by:
startTrackingPrevValuesin interfaceWritableRowRedirection
-