Class RightIncrementalAsOfJoinStateManagerTypedBase
java.lang.Object
io.deephaven.engine.table.impl.RightIncrementalAsOfJoinStateManager
io.deephaven.engine.table.impl.asofjoin.RightIncrementalHashedAsOfJoinStateManager
io.deephaven.engine.table.impl.asofjoin.RightIncrementalAsOfJoinStateManagerTypedBase
public abstract class RightIncrementalAsOfJoinStateManagerTypedBase
extends RightIncrementalHashedAsOfJoinStateManager
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
-
Field Summary
Modifier and TypeFieldDescriptionprotected ImmutableLongArraySource
protected int
protected WritableColumnSource[]
protected ImmutableObjectArraySource<Object>
protected ImmutableObjectArraySource<Object>
protected ImmutableByteArraySource
protected int
protected final ChunkType[]
protected long
static final byte
protected IntegerArraySource
This stores the current set of slots and makes it accessible to the rehashing methodsprotected ImmutableObjectArraySource<Object>
We use our side source to originally build the RowSet using builders.protected ImmutableLongArraySource
Each slot in the hash table has a 'cookie', which we reset by incrementing the cookie generation.protected int
protected WritableColumnSource[]
protected int
protected long
protected int
protected ImmutableObjectArraySource<Object>
protected ImmutableByteArraySource
protected int
Fields inherited from class io.deephaven.engine.table.impl.asofjoin.RightIncrementalHashedAsOfJoinStateManager
ENTRY_LEFT_IS_BUILDER, ENTRY_LEFT_IS_EMPTY, ENTRY_LEFT_IS_ROWSET, ENTRY_LEFT_IS_SSA, ENTRY_LEFT_MASK, ENTRY_RIGHT_IS_BUILDER, ENTRY_RIGHT_IS_EMPTY, ENTRY_RIGHT_IS_ROWSET, ENTRY_RIGHT_IS_SSA, ENTRY_RIGHT_MASK
Fields inherited from class io.deephaven.engine.table.impl.RightIncrementalAsOfJoinStateManager
keySourcesForErrorMessages
-
Constructor Summary
ModifierConstructorDescriptionprotected
RightIncrementalAsOfJoinStateManagerTypedBase
(ColumnSource<?>[] tableKeySources, ColumnSource<?>[] keySourcesForErrorMessages, int tableSize, double maximumLoadFactor) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAlternateLeftKey
(long tableLocation, long keyToAdd, byte currentState) protected void
addAlternateRightKey
(long tableLocation, long keyToAdd, byte currentState) protected void
addLeftKey
(long tableLocation, long keyToAdd, byte currentState) protected void
addRightKey
(long tableLocation, long keyToAdd, byte currentState) protected static void
addToBuilder
(ImmutableObjectArraySource<RowSetBuilderSequential> source, long location, long keyToAdd) int
buildAdditions
(boolean isLeftSide, RowSet additions, ColumnSource<?>[] sources, IntegerArraySource slots, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) protected abstract void
buildFromLeftSide
(RowSequence rowSequence, Chunk[] sourceKeyChunks, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) int
buildFromLeftSide
(RowSequence leftRowSet, ColumnSource<?>[] leftSources, @NotNull IntegerArraySource addedSlots) protected abstract void
buildFromRightSide
(RowSequence rowSequence, Chunk[] sourceKeyChunks, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) int
buildFromRightSide
(RowSequence rightRowSet, ColumnSource<?>[] rightSources, @NotNull IntegerArraySource addedSlots, int usedSlots) protected void
buildTable
(boolean initialBuild, RightIncrementalAsOfJoinStateManagerTypedBase.BuildContext bc, RowSequence buildRows, ColumnSource<?>[] buildSources, IntegerArraySource hashSlots, TypedHasherUtil.BuildHandler buildHandler) protected void
protected static void
createBuilder
(ImmutableObjectArraySource<RowSetBuilderSequential> source, long location, long keyToAdd) boolean
doRehash
(boolean fullRehash, org.apache.commons.lang3.mutable.MutableInt rehashCredits, int nextChunkSize) int
gatherModifications
(RowSet restampAdditions, ColumnSource<?>[] sources, IntegerArraySource slots, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) int
gatherShiftRowSet
(RowSet restampAdditions, ColumnSource<?>[] sources, IntegerArraySource slots, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) getAndClearLeftRowSet
(int slot) protected long
getCookie
(ImmutableLongArraySource cookieSource, int slot) protected long
getCookieAlternate
(int slot) protected long
getCookieMain
(int slot) getLeftRowSet
(int slot) getLeftSsa
(int slot) getLeftSsa
(int slot, Function<RowSet, SegmentedSortedArray> ssaFactory) getLeftSsaOrRowSet
(int slot, org.apache.commons.lang3.mutable.MutableObject<WritableRowSet> indexOutput) getRightRowSet
(int slot) getRightSsa
(int slot) getRightSsa
(int slot, Function<RowSet, SegmentedSortedArray> ssaFactory) getRightSsaOrRowSet
(int slot, org.apache.commons.lang3.mutable.MutableObject<WritableRowSet> indexOutput) byte
getState
(int slot) int
protected int
hashToTableLocation
(int hash) protected int
hashToTableLocationAlternate
(int hash) protected long
makeCookie
(ImmutableLongArraySource cookieSource, int slot) protected long
makeCookieMain
(int slot) int
markForRemoval
(RowSet restampRemovals, ColumnSource<?>[] sources, IntegerArraySource slots, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) protected void
migrateCookie
(long cookie, int destinationLocation) protected abstract void
protected void
void
populateLeftRowSetsFromIndexTable
(IntegerArraySource slots, int slotCount, ColumnSource<RowSet> rowSetSource) void
populateRightRowSetsFromIndexTable
(@NotNull IntegerArraySource slots, int slotCount, @NotNull ColumnSource<RowSet> rowSetSource) int
probeAdditions
(RowSet restampAdditions, ColumnSource<?>[] sources, IntegerArraySource slots, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) void
probeRightInitial
(RowSequence rowsToProbe, ColumnSource<?>[] rightSources) protected abstract void
probeRightSide
(RowSequence rowSequence, Chunk[] sourceKeyChunks, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) protected void
probeTable
(TypedHasherUtil.BuildOrProbeContext.ProbeContext pc, RowSequence probeRows, boolean usePrev, ColumnSource<?>[] probeSources, TypedHasherUtil.ProbeHandler handler) protected abstract void
rehashInternalFull
(int oldSize) protected abstract int
rehashInternalPartial
(int entriesToRehash) boolean
rehashRequired
(int nextChunkSize) protected void
void
setLeftRowSet
(int slot, RowSet rowSet) void
setRightRowSet
(int slot, RowSet rowSet) Methods inherited from class io.deephaven.engine.table.impl.asofjoin.RightIncrementalHashedAsOfJoinStateManager
addToSequentialBuilder, getRightEntryType, leftEntryAsRightType
Methods inherited from class io.deephaven.engine.table.impl.RightIncrementalAsOfJoinStateManager
extractKeyStringFromSourceTable
-
Field Details
-
ENTRY_EMPTY_STATE
public static final byte ENTRY_EMPTY_STATE- See Also:
-
tableSize
protected int tableSize -
alternateTableSize
protected int alternateTableSize -
rehashPointer
protected int rehashPointer -
numEntries
protected long numEntries -
chunkTypes
-
mainKeySources
-
alternateKeySources
-
leftRowSetSource
We use our side source to originally build the RowSet using builders. When a state is activated (meaning we have a corresponding entry for it on the other side); we'll turn it into an SSA. If we have updates for an inactive state, then we turn it into a WritableRowSet. The entry state tells us what we have on each side, using a nibble for the left and a nibble for the right. -
alternateLeftRowSetSource
-
rightRowSetSource
-
alternateRightRowSetSource
-
stateSource
-
alternateStateSource
-
mainInsertMask
protected int mainInsertMask -
alternateInsertMask
protected int alternateInsertMask -
mainCookieSource
Each slot in the hash table has a 'cookie', which we reset by incrementing the cookie generation. The cookie allows us to index into an array source that is passed in for each operation; serving as an intrusive set of modified states (we'll add relevant indices in the probe/build to a RowSet builder). -
alternateCookieSource
-
cookieGeneration
protected long cookieGeneration -
nextCookie
protected int nextCookie -
hashSlots
This stores the current set of slots and makes it accessible to the rehashing methods
-
-
Constructor Details
-
RightIncrementalAsOfJoinStateManagerTypedBase
protected RightIncrementalAsOfJoinStateManagerTypedBase(ColumnSource<?>[] tableKeySources, ColumnSource<?>[] keySourcesForErrorMessages, int tableSize, double maximumLoadFactor)
-
-
Method Details
-
resetCookie
protected void resetCookie() -
getCookieMain
protected long getCookieMain(int slot) -
getCookieAlternate
protected long getCookieAlternate(int slot) -
getCookie
-
makeCookieMain
protected long makeCookieMain(int slot) -
makeCookie
-
migrateCookie
protected void migrateCookie(long cookie, int destinationLocation) -
createBuilder
protected static void createBuilder(ImmutableObjectArraySource<RowSetBuilderSequential> source, long location, long keyToAdd) -
addToBuilder
protected static void addToBuilder(ImmutableObjectArraySource<RowSetBuilderSequential> source, long location, long keyToAdd) -
addLeftKey
protected void addLeftKey(long tableLocation, long keyToAdd, byte currentState) -
addRightKey
protected void addRightKey(long tableLocation, long keyToAdd, byte currentState) -
addAlternateLeftKey
protected void addAlternateLeftKey(long tableLocation, long keyToAdd, byte currentState) -
addAlternateRightKey
protected void addAlternateRightKey(long tableLocation, long keyToAdd, byte currentState) -
buildTable
protected void buildTable(boolean initialBuild, RightIncrementalAsOfJoinStateManagerTypedBase.BuildContext bc, RowSequence buildRows, ColumnSource<?>[] buildSources, IntegerArraySource hashSlots, TypedHasherUtil.BuildHandler buildHandler) -
buildFromLeftSide
public int buildFromLeftSide(RowSequence leftRowSet, ColumnSource<?>[] leftSources, @NotNull @NotNull IntegerArraySource addedSlots) - Specified by:
buildFromLeftSide
in classRightIncrementalHashedAsOfJoinStateManager
-
buildFromRightSide
public int buildFromRightSide(RowSequence rightRowSet, ColumnSource<?>[] rightSources, @NotNull @NotNull IntegerArraySource addedSlots, int usedSlots) - Specified by:
buildFromRightSide
in classRightIncrementalHashedAsOfJoinStateManager
-
markForRemoval
public int markForRemoval(RowSet restampRemovals, ColumnSource<?>[] sources, IntegerArraySource slots, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) - Specified by:
markForRemoval
in classRightIncrementalHashedAsOfJoinStateManager
-
probeAdditions
public int probeAdditions(RowSet restampAdditions, ColumnSource<?>[] sources, IntegerArraySource slots, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) - Specified by:
probeAdditions
in classRightIncrementalHashedAsOfJoinStateManager
-
gatherShiftRowSet
public int gatherShiftRowSet(RowSet restampAdditions, ColumnSource<?>[] sources, IntegerArraySource slots, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) - Specified by:
gatherShiftRowSet
in classRightIncrementalHashedAsOfJoinStateManager
-
gatherModifications
public int gatherModifications(RowSet restampAdditions, ColumnSource<?>[] sources, IntegerArraySource slots, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) - Specified by:
gatherModifications
in classRightIncrementalHashedAsOfJoinStateManager
-
probeTable
protected void probeTable(TypedHasherUtil.BuildOrProbeContext.ProbeContext pc, RowSequence probeRows, boolean usePrev, ColumnSource<?>[] probeSources, TypedHasherUtil.ProbeHandler handler) -
probeRightInitial
- Specified by:
probeRightInitial
in classRightIncrementalHashedAsOfJoinStateManager
-
buildAdditions
public int buildAdditions(boolean isLeftSide, RowSet additions, ColumnSource<?>[] sources, IntegerArraySource slots, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) - Specified by:
buildAdditions
in classRightIncrementalHashedAsOfJoinStateManager
-
getTableSize
public int getTableSize()- Specified by:
getTableSize
in classRightIncrementalHashedAsOfJoinStateManager
-
getAndClearLeftRowSet
- Specified by:
getAndClearLeftRowSet
in classRightIncrementalHashedAsOfJoinStateManager
-
getState
public byte getState(int slot) - Specified by:
getState
in classRightIncrementalHashedAsOfJoinStateManager
-
getRightSsa
- Specified by:
getRightSsa
in classRightIncrementalHashedAsOfJoinStateManager
-
getRightSsa
- Specified by:
getRightSsa
in classRightIncrementalHashedAsOfJoinStateManager
-
getRightRowSet
- Specified by:
getRightRowSet
in classRightIncrementalHashedAsOfJoinStateManager
-
getLeftRowSet
- Specified by:
getLeftRowSet
in classRightIncrementalHashedAsOfJoinStateManager
-
setLeftRowSet
- Specified by:
setLeftRowSet
in classRightIncrementalHashedAsOfJoinStateManager
-
setRightRowSet
- Specified by:
setRightRowSet
in classRightIncrementalHashedAsOfJoinStateManager
-
populateRightRowSetsFromIndexTable
public void populateRightRowSetsFromIndexTable(@NotNull @NotNull IntegerArraySource slots, int slotCount, @NotNull @NotNull ColumnSource<RowSet> rowSetSource) - Specified by:
populateRightRowSetsFromIndexTable
in classRightIncrementalHashedAsOfJoinStateManager
-
populateLeftRowSetsFromIndexTable
public void populateLeftRowSetsFromIndexTable(IntegerArraySource slots, int slotCount, ColumnSource<RowSet> rowSetSource) - Specified by:
populateLeftRowSetsFromIndexTable
in classRightIncrementalHashedAsOfJoinStateManager
-
getLeftSsa
- Specified by:
getLeftSsa
in classRightIncrementalHashedAsOfJoinStateManager
-
getLeftSsa
- Specified by:
getLeftSsa
in classRightIncrementalHashedAsOfJoinStateManager
-
getLeftSsaOrRowSet
public SegmentedSortedArray getLeftSsaOrRowSet(int slot, org.apache.commons.lang3.mutable.MutableObject<WritableRowSet> indexOutput) - Specified by:
getLeftSsaOrRowSet
in classRightIncrementalHashedAsOfJoinStateManager
-
getRightSsaOrRowSet
public SegmentedSortedArray getRightSsaOrRowSet(int slot, org.apache.commons.lang3.mutable.MutableObject<WritableRowSet> indexOutput) - Specified by:
getRightSsaOrRowSet
in classRightIncrementalHashedAsOfJoinStateManager
-
newAlternate
protected void newAlternate() -
clearAlternate
protected void clearAlternate() -
doRehash
public boolean doRehash(boolean fullRehash, org.apache.commons.lang3.mutable.MutableInt rehashCredits, int nextChunkSize) - Parameters:
fullRehash
- should we rehash the entire table (if false, we rehash incrementally)rehashCredits
- the number of entries this operation has rehashed (input/output)nextChunkSize
- the size of the chunk we are processing- Returns:
- true if a front migration is required
-
rehashRequired
public boolean rehashRequired(int nextChunkSize) -
hashToTableLocation
protected int hashToTableLocation(int hash) -
hashToTableLocationAlternate
protected int hashToTableLocationAlternate(int hash) -
buildFromLeftSide
protected abstract void buildFromLeftSide(RowSequence rowSequence, Chunk[] sourceKeyChunks, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) -
buildFromRightSide
protected abstract void buildFromRightSide(RowSequence rowSequence, Chunk[] sourceKeyChunks, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) -
probeRightSide
protected abstract void probeRightSide(RowSequence rowSequence, Chunk[] sourceKeyChunks, ObjectArraySource<RowSetBuilderSequential> sequentialBuilders) -
rehashInternalPartial
protected abstract int rehashInternalPartial(int entriesToRehash) -
migrateFront
protected abstract void migrateFront() -
rehashInternalFull
protected abstract void rehashInternalFull(int oldSize)
-