Class IncrementalMultiJoinStateManagerTypedBase
java.lang.Object
io.deephaven.engine.table.impl.multijoin.IncrementalMultiJoinStateManagerTypedBase
- All Implemented Interfaces:
MultiJoinStateManager
public abstract class IncrementalMultiJoinStateManagerTypedBase
extends Object
implements MultiJoinStateManager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final WritableColumnSource<?>[]
protected ImmutableLongArraySource
protected ImmutableIntArraySource
protected int
The number of slots in our alternate table, to start with "1" is a lie, but rehashPointer is zero; so our location value is positive and can be compared against rehashPointer safely.protected final ChunkType[]
The keys for our hash entries.static final long
static final int
protected final ColumnSource<?>[]
protected final WritableColumnSource<?>[]
protected ImmutableLongArraySource
static final long
protected int
The number of entries in our hash table in use.protected final WritableColumnSource[]
The output sources representing the keys of our joined table.protected int
how much of the alternate sources are necessary to rehash?protected ImmutableIntArraySource
Store sentinel information and maps hash slots to output row keys.protected int
The number of slots in our hash table. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
IncrementalMultiJoinStateManagerTypedBase
(ColumnSource<?>[] tableKeySources, ColumnSource<?>[] keySourcesForErrorMessages, int tableSize, double maximumLoadFactor) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.void
build
(Table table, ColumnSource<?>[] keySources, int tableNumber) Add the given table to this multiJoin result.protected abstract void
buildFromTable
(RowSequence rowSequence, Chunk<Values>[] sourceKeyChunks, LongArraySource tableRedirSource, int tableNumber, MultiJoinModifiedSlotTracker modifiedSlotTracker, byte trackerFlag) protected void
boolean
doRehash
(boolean fullRehash, MutableInt rehashCredits, int nextChunkSize) void
ensureTableCapacity
(int tables) Ensure that this state manager can handlenumTables
tables as constituents of the multiJoin.void
getCurrentRedirections
(long slot, long[] redirections) ColumnSource<?>[]
Get the hash table column sources for the result table.long
Get the number of rows in the result tablegetRowRedirectionForTable
(int tableNumber) Get the resultrow redirection
for a given tableint
protected int
hashToTableLocation
(int hash) protected int
hashToTableLocationAlternate
(int hash) protected String
produce a pretty key for error messages.makeBuildContext
(ColumnSource<?>[] buildSources, long maxSize) makeProbeContext
(ColumnSource<?>[] probeSources, long maxSize) protected abstract void
protected abstract void
modify
(RowSequence rowSequence, Chunk<Values>[] sourceKeyChunks, LongArraySource tableRedirSource, int tableNumber, MultiJoinModifiedSlotTracker modifiedSlotTracker, byte trackerFlag) void
processAdded
(RowSet rowSet, ColumnSource<?>[] sources, int tableNumber, @NotNull MultiJoinModifiedSlotTracker slotTracker, byte trackerFlag) void
processModified
(RowSet rowSet, ColumnSource<?>[] sources, int tableNumber, @NotNull MultiJoinModifiedSlotTracker slotTracker, byte trackerFlag) void
processRemoved
(RowSet rowSet, ColumnSource<?>[] sources, int tableNumber, @NotNull MultiJoinModifiedSlotTracker slotTracker, byte trackerFlag) void
processShifts
(RowSet rowSet, RowSetShiftData rowSetShiftData, ColumnSource<?>[] sources, int tableNumber, @NotNull MultiJoinModifiedSlotTracker slotTracker) protected abstract void
rehashInternalFull
(int oldSize) protected abstract int
rehashInternalPartial
(int numEntriesToRehash) boolean
rehashRequired
(int nextChunkSize) protected abstract void
remove
(RowSequence rowSequence, Chunk<Values>[] sourceKeyChunks, LongArraySource tableRedirSource, int tableNumber, MultiJoinModifiedSlotTracker modifiedSlotTracker, byte trackerFlag) void
setMaximumLoadFactor
(double maximumLoadFactor) void
setTargetLoadFactor
(double targetLoadFactor) protected abstract void
shift
(RowSequence rowSequence, Chunk<Values>[] sourceKeyChunks, LongArraySource tableRedirSource, int tableNumber, MultiJoinModifiedSlotTracker modifiedSlotTracker, byte trackerFlag, long shiftDelta) void
startTrackingPrevRedirectionValues
(int tableNumber)
-
Field Details
-
keySourcesForErrorMessages
-
NO_REDIRECTION
public static final long NO_REDIRECTION- See Also:
-
EMPTY_OUTPUT_ROW
public static final int EMPTY_OUTPUT_ROW- See Also:
-
EMPTY_COOKIE_SLOT
public static final long EMPTY_COOKIE_SLOT- See Also:
-
tableSize
protected int tableSizeThe number of slots in our hash table. -
alternateTableSize
protected int alternateTableSizeThe number of slots in our alternate table, to start with "1" is a lie, but rehashPointer is zero; so our location value is positive and can be compared against rehashPointer safely. -
numEntries
protected int numEntriesThe number of entries in our hash table in use. -
chunkTypes
The keys for our hash entries. -
mainKeySources
-
alternateKeySources
-
outputKeySources
The output sources representing the keys of our joined table. -
slotToOutputRow
Store sentinel information and maps hash slots to output row keys. -
alternateSlotToOutputRow
-
mainModifiedTrackerCookieSource
-
alternateModifiedTrackerCookieSource
-
rehashPointer
protected int rehashPointerhow much of the alternate sources are necessary to rehash?
-
-
Constructor Details
-
IncrementalMultiJoinStateManagerTypedBase
protected IncrementalMultiJoinStateManagerTypedBase(ColumnSource<?>[] tableKeySources, ColumnSource<?>[] keySourcesForErrorMessages, int tableSize, double maximumLoadFactor)
-
-
Method Details
-
getTableCount
public int getTableCount() -
makeBuildContext
public IncrementalMultiJoinStateManagerTypedBase.BuildContext makeBuildContext(ColumnSource<?>[] buildSources, long maxSize) -
makeProbeContext
public IncrementalMultiJoinStateManagerTypedBase.ProbeContext makeProbeContext(ColumnSource<?>[] probeSources, long maxSize) -
build
Description copied from interface:MultiJoinStateManager
Add the given table to this multiJoin result.- Specified by:
build
in interfaceMultiJoinStateManager
- Parameters:
table
- the table to addkeySources
- the column sources that contain the keystableNumber
- the table number for which we are adding rows
-
processRemoved
public void processRemoved(RowSet rowSet, ColumnSource<?>[] sources, int tableNumber, @NotNull @NotNull MultiJoinModifiedSlotTracker slotTracker, byte trackerFlag) -
processShifts
public void processShifts(RowSet rowSet, RowSetShiftData rowSetShiftData, ColumnSource<?>[] sources, int tableNumber, @NotNull @NotNull MultiJoinModifiedSlotTracker slotTracker) -
processModified
public void processModified(RowSet rowSet, ColumnSource<?>[] sources, int tableNumber, @NotNull @NotNull MultiJoinModifiedSlotTracker slotTracker, byte trackerFlag) -
processAdded
public void processAdded(RowSet rowSet, ColumnSource<?>[] sources, int tableNumber, @NotNull @NotNull MultiJoinModifiedSlotTracker slotTracker, byte trackerFlag) -
buildFromTable
protected abstract void buildFromTable(RowSequence rowSequence, Chunk<Values>[] sourceKeyChunks, LongArraySource tableRedirSource, int tableNumber, MultiJoinModifiedSlotTracker modifiedSlotTracker, byte trackerFlag) -
remove
protected abstract void remove(RowSequence rowSequence, Chunk<Values>[] sourceKeyChunks, LongArraySource tableRedirSource, int tableNumber, MultiJoinModifiedSlotTracker modifiedSlotTracker, byte trackerFlag) -
shift
protected abstract void shift(RowSequence rowSequence, Chunk<Values>[] sourceKeyChunks, LongArraySource tableRedirSource, int tableNumber, MultiJoinModifiedSlotTracker modifiedSlotTracker, byte trackerFlag, long shiftDelta) -
modify
protected abstract void modify(RowSequence rowSequence, Chunk<Values>[] sourceKeyChunks, LongArraySource tableRedirSource, int tableNumber, MultiJoinModifiedSlotTracker modifiedSlotTracker, byte trackerFlag) -
migrateFront
protected abstract void migrateFront() -
doRehash
- 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) -
rehashInternalFull
protected abstract void rehashInternalFull(int oldSize) -
rehashInternalPartial
protected abstract int rehashInternalPartial(int numEntriesToRehash) - 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) -
keyString
produce a pretty key for error messages. -
getCurrentRedirections
public void getCurrentRedirections(long slot, long[] redirections) -
startTrackingPrevRedirectionValues
public void startTrackingPrevRedirectionValues(int tableNumber) -
getResultSize
public long getResultSize()Description copied from interface:MultiJoinStateManager
Get the number of rows in the result table- Specified by:
getResultSize
in interfaceMultiJoinStateManager
- Returns:
- the number of rows in the result table
-
getKeyHashTableSources
Description copied from interface:MultiJoinStateManager
Get the hash table column sources for the result table. These are used as the key columns of our result.- Specified by:
getKeyHashTableSources
in interfaceMultiJoinStateManager
-
getRowRedirectionForTable
Description copied from interface:MultiJoinStateManager
Get the resultrow redirection
for a given table- Specified by:
getRowRedirectionForTable
in interfaceMultiJoinStateManager
- Parameters:
tableNumber
- the table to fetch- Returns:
- the row redirection for the table
-
ensureTableCapacity
public void ensureTableCapacity(int tables) Description copied from interface:MultiJoinStateManager
Ensure that this state manager can handlenumTables
tables as constituents of the multiJoin.- Specified by:
ensureTableCapacity
in interfaceMultiJoinStateManager
- Parameters:
tables
- the number of tables that participate
-
setTargetLoadFactor
public void setTargetLoadFactor(double targetLoadFactor) - Specified by:
setTargetLoadFactor
in interfaceMultiJoinStateManager
-
setMaximumLoadFactor
public void setMaximumLoadFactor(double maximumLoadFactor) - Specified by:
setMaximumLoadFactor
in interfaceMultiJoinStateManager
-