Class IncrementalMultiJoinStateManagerTypedBase

All Implemented Interfaces:

public abstract class IncrementalMultiJoinStateManagerTypedBase extends Object implements MultiJoinStateManager
  • Field Details

    • keySourcesForErrorMessages

      protected final ColumnSource<?>[] keySourcesForErrorMessages

      public static final long NO_REDIRECTION
      See Also:

      public static final int EMPTY_OUTPUT_ROW
      See Also:
    • tableSize

      protected int tableSize
      The number of slots in our hash table.
    • alternateTableSize

      protected int alternateTableSize
      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.
    • numEntries

      protected int numEntries
      The number of entries in our hash table in use.
    • chunkTypes

      protected final ChunkType[] chunkTypes
      The keys for our hash entries.
    • mainKeySources

      protected final WritableColumnSource<?>[] mainKeySources
    • alternateKeySources

      protected final WritableColumnSource<?>[] alternateKeySources
    • outputKeySources

      protected final WritableColumnSource[] outputKeySources
      The output sources representing the keys of our joined table.
    • slotToOutputRow

      protected ImmutableIntArraySource slotToOutputRow
      Store sentinel information and maps hash slots to output row keys.
    • alternateSlotToOutputRow

      protected ImmutableIntArraySource alternateSlotToOutputRow
    • mainModifiedTrackerCookieSource

      protected ImmutableLongArraySource mainModifiedTrackerCookieSource
    • alternateModifiedTrackerCookieSource

      protected ImmutableLongArraySource alternateModifiedTrackerCookieSource
    • rehashPointer

      protected int rehashPointer
      how 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

      public void build(Table table, ColumnSource<?>[] keySources, int tableNumber)
      Description copied from interface: MultiJoinStateManager
      Add the given table to this multiJoin result.
      Specified by:
      build in interface MultiJoinStateManager
      table - the table to add
      keySources - the column sources that contain the keys
      tableNumber - 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

      public boolean doRehash(boolean fullRehash, org.apache.commons.lang3.mutable.MutableInt rehashCredits, int nextChunkSize)
      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
      true if a front migration is required
    • newAlternate

      protected void newAlternate()
    • clearAlternate

      protected void clearAlternate()
    • rehashRequired

      public boolean rehashRequired(int nextChunkSize)
    • rehashInternalFull

      protected abstract void rehashInternalFull(int oldSize)
    • rehashInternalPartial

      protected abstract int rehashInternalPartial(int numEntriesToRehash)
      numEntriesToRehash - number of entries to rehash into main table
      actual number of entries rehashed
    • hashToTableLocation

      protected int hashToTableLocation(int hash)
    • hashToTableLocationAlternate

      protected int hashToTableLocationAlternate(int hash)
    • keyString

      protected String keyString(Chunk<Values>[] sourceKeyChunks, int chunkPosition)
      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 interface MultiJoinStateManager
      the number of rows in the result table
    • getKeyHashTableSources

      public ColumnSource<?>[] 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 interface MultiJoinStateManager
    • getRowRedirectionForTable

      public RowRedirection getRowRedirectionForTable(int tableNumber)
      Description copied from interface: MultiJoinStateManager
      Get the result row redirection for a given table
      Specified by:
      getRowRedirectionForTable in interface MultiJoinStateManager
      tableNumber - the table to fetch
      the row redirection for the table
    • ensureTableCapacity

      public void ensureTableCapacity(int tables)
      Description copied from interface: MultiJoinStateManager
      Ensure that this state manager can handle numTables tables as constituents of the multiJoin.
      Specified by:
      ensureTableCapacity in interface MultiJoinStateManager
      tables - the number of tables that participate
    • setTargetLoadFactor

      public void setTargetLoadFactor(double targetLoadFactor)
      Specified by:
      setTargetLoadFactor in interface MultiJoinStateManager
    • setMaximumLoadFactor

      public void setMaximumLoadFactor(double maximumLoadFactor)
      Specified by:
      setMaximumLoadFactor in interface MultiJoinStateManager