Class IncrementalNaturalJoinStateManagerTypedBase
java.lang.Object
io.deephaven.engine.table.impl.StaticNaturalJoinStateManager
io.deephaven.engine.table.impl.naturaljoin.IncrementalNaturalJoinStateManagerTypedBase
- All Implemented Interfaces:
BothIncrementalNaturalJoinStateManager
,IncrementalNaturalJoinStateManager
public abstract class IncrementalNaturalJoinStateManagerTypedBase
extends StaticNaturalJoinStateManager
implements IncrementalNaturalJoinStateManager, BothIncrementalNaturalJoinStateManager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.BothIncrementalNaturalJoinStateManager
BothIncrementalNaturalJoinStateManager.InitialBuildContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected long
How many entries are in the alternate table (includes tombstones)?protected int
protected final WritableColumnSource[]
protected ImmutableObjectArraySource<WritableRowSet>
protected ImmutableLongArraySource
protected ImmutableLongArraySource
protected int
protected final ChunkType[]
static final long
static final long
protected gnu.trove.list.array.TLongArrayList
protected long
How many values do we have that are live (in both main and alternate)?protected int
protected final WritableColumnSource[]
protected ImmutableObjectArraySource<WritableRowSet>
protected ImmutableLongArraySource
protected ImmutableLongArraySource
We use a RowSet.NULL_ROW_KEY for a state that exists, but has no right hand side; the column sources are initialized with NULL_LONG for something that does not exist.protected long
protected long
How many entries are taking up slots in the main hash table (includes tombstones)?protected int
protected ObjectArraySource<WritableRowSet>
protected int
static final long
Fields inherited from class io.deephaven.engine.table.impl.StaticNaturalJoinStateManager
addOnly, DUPLICATE_RIGHT_VALUE, joinType, keySourcesForErrorMessages, NO_RIGHT_ENTRY_VALUE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
IncrementalNaturalJoinStateManagerTypedBase
(ColumnSource<?>[] tableKeySources, ColumnSource<?>[] keySourcesForErrorMessages, int tableSize, double maximumLoadFactor, NaturalJoinType joinType, boolean addOnly) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
addLeftSide
(RowSequence rowSequence, Chunk[] sourceKeyChunks, LongArraySource leftRedirections, long redirectionOffset) void
addLeftSide
(Context bc, RowSequence leftRowSet, ColumnSource<?>[] leftSources, LongArraySource leftRedirections, @NotNull NaturalJoinModifiedSlotTracker modifiedSlotTracker) protected abstract void
addRightSide
(RowSequence rowSequence, Chunk[] sourceKeyChunks, NaturalJoinModifiedSlotTracker modifiedSlotTracker) void
addRightSide
(Context bc, RowSequence rightRowSet, ColumnSource<?>[] rightSources, @NotNull NaturalJoinModifiedSlotTracker modifiedSlotTracker) protected abstract void
After creating the new alternate key states, advise the derived classes, so they can cast them to the typed versions of the column source and adjust the derived class pointers.protected long
protected abstract void
applyLeftShift
(RowSequence rowSequence, Chunk[] sourceKeyChunks, long shiftDelta, IncrementalNaturalJoinStateManagerTypedBase.ProbeContext pc) void
applyLeftShift
(Context pc, ColumnSource<?>[] leftSources, RowSet shiftedRowSet, long shiftDelta) protected abstract void
applyRightShift
(RowSequence rowSequence, Chunk[] sourceKeyChunks, long shiftDelta, NaturalJoinModifiedSlotTracker modifiedSlotTracker, IncrementalNaturalJoinStateManagerTypedBase.ProbeContext pc) void
applyRightShift
(Context pc, ColumnSource<?>[] rightSources, RowSet shiftedRowSet, long shiftDelta, @NotNull NaturalJoinModifiedSlotTracker modifiedSlotTracker) protected abstract void
buildFromLeftSide
(RowSequence rowSequence, Chunk[] sourceKeyChunks) protected abstract void
buildFromRightSide
(RowSequence rowSequence, Chunk[] sourceKeyChunks) void
buildFromRightSide
(Table rightTable, ColumnSource<?>[] rightSources) buildIndexedRowRedirection
(QueryTable leftTable, BothIncrementalNaturalJoinStateManager.InitialBuildContext ibc, ColumnSource<RowSet> indexRowSets, JoinControl.RedirectionType redirectionType) buildRowRedirectionFromRedirections
(QueryTable leftTable, BothIncrementalNaturalJoinStateManager.InitialBuildContext ibc, JoinControl.RedirectionType redirectionType) protected void
buildTable
(boolean initialBuild, IncrementalNaturalJoinStateManagerTypedBase.BuildContext bc, RowSequence buildRows, ColumnSource<?>[] buildSources, TypedHasherUtil.BuildHandler buildHandler, NaturalJoinModifiedSlotTracker modifiedSlotTracker) protected void
void
int
computeTableSize
(int nextChunkSize) void
decorateLeftSide
(RowSet leftRows, ColumnSource<?>[] leftSources, BothIncrementalNaturalJoinStateManager.InitialBuildContext ibc) void
decorateLeftSide
(RowSet leftRowSet, ColumnSource<?>[] leftSources, LongArraySource leftRedirections) boolean
doRehash
(boolean fullRehash, MutableInt rehashCredits, int nextChunkSize, NaturalJoinModifiedSlotTracker modifiedSlotTracker) protected long
duplicateLocationFromRowKey
(long rowKey) protected void
freeDuplicateLocation
(long duplicateLocation) getLeftRowSet
(int slot) long
getRightRowKey
(int slot) getRightRowSet
(int slot) protected int
hashToTableLocation
(int hash) protected int
hashToTableLocationAlternate
(int hash) keyString
(int slot) makeBuildContext
(ColumnSource<?>[] buildSources, long maxSize) makeProbeContext
(ColumnSource<?>[] buildSources, long maxSize) protected abstract void
migrateFront
(NaturalJoinModifiedSlotTracker modifiedSlotTracker) protected abstract void
modifyByRight
(RowSequence rowSequence, Chunk[] sourceKeyChunks, NaturalJoinModifiedSlotTracker modifiedSlotTracker) void
modifyByRight
(Context pc, RowSet modified, ColumnSource<?>[] rightSources, @NotNull NaturalJoinModifiedSlotTracker modifiedSlotTracker) protected void
probeTable
(IncrementalNaturalJoinStateManagerTypedBase.ProbeContext pc, RowSequence probeRows, boolean usePrev, ColumnSource<?>[] probeSources, TypedHasherUtil.ProbeHandler handler) protected abstract void
rehashInternalFull
(int oldSize) protected abstract int
rehashInternalPartial
(int numEntriesToRehash, NaturalJoinModifiedSlotTracker modifiedSlotTracker) boolean
rehashRequired
(int nextChunkSize) protected abstract void
removeLeft
(RowSequence rowSequence, Chunk[] sourceKeyChunks) void
removeLeft
(Context pc, RowSequence leftIndex, ColumnSource<?>[] leftSources) protected abstract void
removeRight
(RowSequence rowSequence, Chunk[] sourceKeyChunks, NaturalJoinModifiedSlotTracker modifiedSlotTracker) void
removeRight
(Context pc, RowSequence rightRowSet, ColumnSource<?>[] rightSources, @NotNull NaturalJoinModifiedSlotTracker modifiedSlotTracker) protected long
rowKeyFromDuplicateLocation
(long duplicateLocation) Methods inherited from class io.deephaven.engine.table.impl.StaticNaturalJoinStateManager
buildRowRedirection, checkExactMatch, extractKeyStringFromSourceTable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.deephaven.engine.table.impl.IncrementalNaturalJoinStateManager
addRightRowKeyToDuplicates, checkExactMatch, getRightRowKeyFromDuplicates, removeRightRowKeyFromDuplicates, shiftOneKey
-
Field Details
-
EMPTY_RIGHT_STATE
public static final long EMPTY_RIGHT_STATE- See Also:
-
TOMBSTONE_RIGHT_STATE
public static final long TOMBSTONE_RIGHT_STATE- See Also:
-
FIRST_DUPLICATE
public static final long FIRST_DUPLICATE- See Also:
-
tableSize
protected int tableSize -
alternateTableSize
protected int alternateTableSize -
rehashPointer
protected int rehashPointer -
numEntries
protected long numEntriesHow many entries are taking up slots in the main hash table (includes tombstones)? -
liveEntries
protected long liveEntriesHow many values do we have that are live (in both main and alternate)? -
alternateEntries
protected long alternateEntriesHow many entries are in the alternate table (includes tombstones)? -
chunkTypes
-
mainKeySources
-
alternateKeySources
-
mainRightRowKey
We use a RowSet.NULL_ROW_KEY for a state that exists, but has no right hand side; the column sources are initialized with NULL_LONG for something that does not exist. When there are multiple right rows, we store a value less than TOMBSTONE_RIGHT_STATE, which is a position in the rightSideDuplicateRowSets (-3 maps to 0, -4 to 1, etc.). We must maintain the right side duplicates so that we do not need a rescan; but in the common (as opposed to impending error) case of a single value we do not want to allocate any objects The TOMBSTONE_RIGHT_STATE indicates that the row was deleted.
-
alternateRightRowKey
-
mainLeftRowSet
-
mainModifiedTrackerCookieSource
-
alternateLeftRowSet
-
alternateModifiedTrackerCookieSource
-
rightSideDuplicateRowSets
-
nextDuplicateRightSide
protected long nextDuplicateRightSide -
freeDuplicateValues
protected gnu.trove.list.array.TLongArrayList freeDuplicateValues -
mainInsertMask
protected int mainInsertMask -
alternateInsertMask
protected int alternateInsertMask
-
-
Constructor Details
-
IncrementalNaturalJoinStateManagerTypedBase
protected IncrementalNaturalJoinStateManagerTypedBase(ColumnSource<?>[] tableKeySources, ColumnSource<?>[] keySourcesForErrorMessages, int tableSize, double maximumLoadFactor, NaturalJoinType joinType, boolean addOnly)
-
-
Method Details
-
makeBuildContext
public IncrementalNaturalJoinStateManagerTypedBase.BuildContext makeBuildContext(ColumnSource<?>[] buildSources, long maxSize) - Specified by:
makeBuildContext
in interfaceBothIncrementalNaturalJoinStateManager
-
makeProbeContext
public IncrementalNaturalJoinStateManagerTypedBase.ProbeContext makeProbeContext(ColumnSource<?>[] buildSources, long maxSize) - Specified by:
makeProbeContext
in interfaceBothIncrementalNaturalJoinStateManager
-
buildTable
protected void buildTable(boolean initialBuild, IncrementalNaturalJoinStateManagerTypedBase.BuildContext bc, RowSequence buildRows, ColumnSource<?>[] buildSources, TypedHasherUtil.BuildHandler buildHandler, NaturalJoinModifiedSlotTracker modifiedSlotTracker) -
probeTable
protected void probeTable(IncrementalNaturalJoinStateManagerTypedBase.ProbeContext pc, RowSequence probeRows, boolean usePrev, ColumnSource<?>[] probeSources, TypedHasherUtil.ProbeHandler handler) -
doRehash
public boolean doRehash(boolean fullRehash, MutableInt rehashCredits, int nextChunkSize, NaturalJoinModifiedSlotTracker modifiedSlotTracker) - 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
-
adviseNewAlternate
protected abstract void adviseNewAlternate()After creating the new alternate key states, advise the derived classes, so they can cast them to the typed versions of the column source and adjust the derived class pointers. -
clearAlternate
protected void clearAlternate() -
rehashRequired
public boolean rehashRequired(int nextChunkSize) -
computeTableSize
public int computeTableSize(int nextChunkSize) -
rehashInternalFull
protected abstract void rehashInternalFull(int oldSize) -
migrateFront
-
rehashInternalPartial
protected abstract int rehashInternalPartial(int numEntriesToRehash, NaturalJoinModifiedSlotTracker modifiedSlotTracker) - Parameters:
numEntriesToRehash
- number of entries to rehash into main table- Returns:
- actual number of entries rehashed
-
hashToTableLocation
protected int hashToTableLocation(int hash) -
hashToTableLocationAlternate
protected int hashToTableLocationAlternate(int hash) -
duplicateLocationFromRowKey
protected long duplicateLocationFromRowKey(long rowKey) -
rowKeyFromDuplicateLocation
protected long rowKeyFromDuplicateLocation(long duplicateLocation) -
allocateDuplicateLocation
protected long allocateDuplicateLocation() -
freeDuplicateLocation
protected void freeDuplicateLocation(long duplicateLocation) -
getRightRowKey
public long getRightRowKey(int slot) - Specified by:
getRightRowKey
in interfaceIncrementalNaturalJoinStateManager
-
getLeftRowSet
- Specified by:
getLeftRowSet
in interfaceIncrementalNaturalJoinStateManager
-
getRightRowSet
- Specified by:
getRightRowSet
in interfaceIncrementalNaturalJoinStateManager
-
keyString
- Specified by:
keyString
in interfaceIncrementalNaturalJoinStateManager
-
buildIndexedRowRedirection
public WritableRowRedirection buildIndexedRowRedirection(QueryTable leftTable, BothIncrementalNaturalJoinStateManager.InitialBuildContext ibc, ColumnSource<RowSet> indexRowSets, JoinControl.RedirectionType redirectionType) - Specified by:
buildIndexedRowRedirection
in interfaceBothIncrementalNaturalJoinStateManager
-
buildRowRedirectionFromRedirections
public WritableRowRedirection buildRowRedirectionFromRedirections(QueryTable leftTable, BothIncrementalNaturalJoinStateManager.InitialBuildContext ibc, JoinControl.RedirectionType redirectionType) - Specified by:
buildRowRedirectionFromRedirections
in interfaceBothIncrementalNaturalJoinStateManager
-
buildFromRightSide
-
applyRightShift
protected abstract void applyRightShift(RowSequence rowSequence, Chunk[] sourceKeyChunks, long shiftDelta, NaturalJoinModifiedSlotTracker modifiedSlotTracker, IncrementalNaturalJoinStateManagerTypedBase.ProbeContext pc) -
modifyByRight
public void modifyByRight(Context pc, RowSet modified, ColumnSource<?>[] rightSources, @NotNull @NotNull NaturalJoinModifiedSlotTracker modifiedSlotTracker) - Specified by:
modifyByRight
in interfaceBothIncrementalNaturalJoinStateManager
-
modifyByRight
protected abstract void modifyByRight(RowSequence rowSequence, Chunk[] sourceKeyChunks, NaturalJoinModifiedSlotTracker modifiedSlotTracker) -
removeRight
public void removeRight(Context pc, RowSequence rightRowSet, ColumnSource<?>[] rightSources, @NotNull @NotNull NaturalJoinModifiedSlotTracker modifiedSlotTracker) - Specified by:
removeRight
in interfaceBothIncrementalNaturalJoinStateManager
-
removeRight
protected abstract void removeRight(RowSequence rowSequence, Chunk[] sourceKeyChunks, NaturalJoinModifiedSlotTracker modifiedSlotTracker) -
buildFromRightSide
- Specified by:
buildFromRightSide
in interfaceBothIncrementalNaturalJoinStateManager
-
decorateLeftSide
public void decorateLeftSide(RowSet leftRows, ColumnSource<?>[] leftSources, BothIncrementalNaturalJoinStateManager.InitialBuildContext ibc) - Specified by:
decorateLeftSide
in interfaceBothIncrementalNaturalJoinStateManager
-
buildFromLeftSide
-
addRightSide
public void addRightSide(Context bc, RowSequence rightRowSet, ColumnSource<?>[] rightSources, @NotNull @NotNull NaturalJoinModifiedSlotTracker modifiedSlotTracker) - Specified by:
addRightSide
in interfaceBothIncrementalNaturalJoinStateManager
-
addRightSide
protected abstract void addRightSide(RowSequence rowSequence, Chunk[] sourceKeyChunks, NaturalJoinModifiedSlotTracker modifiedSlotTracker) -
addLeftSide
public void addLeftSide(Context bc, RowSequence leftRowSet, ColumnSource<?>[] leftSources, LongArraySource leftRedirections, @NotNull @NotNull NaturalJoinModifiedSlotTracker modifiedSlotTracker) - Specified by:
addLeftSide
in interfaceBothIncrementalNaturalJoinStateManager
-
addLeftSide
protected abstract void addLeftSide(RowSequence rowSequence, Chunk[] sourceKeyChunks, LongArraySource leftRedirections, long redirectionOffset) -
removeLeft
- Specified by:
removeLeft
in interfaceBothIncrementalNaturalJoinStateManager
-
removeLeft
-
applyLeftShift
public void applyLeftShift(Context pc, ColumnSource<?>[] leftSources, RowSet shiftedRowSet, long shiftDelta) - Specified by:
applyLeftShift
in interfaceBothIncrementalNaturalJoinStateManager
-
applyRightShift
public void applyRightShift(Context pc, ColumnSource<?>[] rightSources, RowSet shiftedRowSet, long shiftDelta, @NotNull @NotNull NaturalJoinModifiedSlotTracker modifiedSlotTracker) - Specified by:
applyRightShift
in interfaceBothIncrementalNaturalJoinStateManager
-
applyLeftShift
protected abstract void applyLeftShift(RowSequence rowSequence, Chunk[] sourceKeyChunks, long shiftDelta, IncrementalNaturalJoinStateManagerTypedBase.ProbeContext pc) -
makeInitialBuildContext
- Specified by:
makeInitialBuildContext
in interfaceBothIncrementalNaturalJoinStateManager
-
decorateLeftSide
public void decorateLeftSide(RowSet leftRowSet, ColumnSource<?>[] leftSources, LongArraySource leftRedirections) - Specified by:
decorateLeftSide
in classStaticNaturalJoinStateManager
-
compactAll
public void compactAll()- Specified by:
compactAll
in interfaceBothIncrementalNaturalJoinStateManager
-