Class HashJoinMemoryCalculatorImpl.BuildSidePartitioningImpl
java.lang.Object
org.apache.drill.exec.physical.impl.join.HashJoinMemoryCalculatorImpl.BuildSidePartitioningImpl
- All Implemented Interfaces:
HashJoinMemoryCalculator.BuildSidePartitioning,HashJoinStateCalculator<HashJoinMemoryCalculator.PostBuildCalculations>
- Enclosing class:
HashJoinMemoryCalculatorImpl
public static class HashJoinMemoryCalculatorImpl.BuildSidePartitioningImpl
extends Object
implements HashJoinMemoryCalculator.BuildSidePartitioning
At this point we need to reserve memory for the following:
- An incoming batch
- An incomplete batch for each partition
Life Cycle
- Step 0: Call
initialize(boolean, boolean, RecordBatch, RecordBatch, Set, boolean, long, int, int, int, int, int, int, double). This will initialize the StateCalculate with the additional information it needs. - Step 1: Call
getNumPartitions()to see the number of partitions that fit in memory. - Step 2: Call
shouldSpill()To determine if spilling needs to occurr. - Step 3: Call
next()and get the next memory calculator associated with your next state.
-
Constructor Summary
ConstructorsConstructorDescriptionBuildSidePartitioningImpl(BatchSizePredictor.Factory batchSizePredictorFactory, HashTableSizeCalculator hashTableSizeCalculator, HashJoinHelperSizeCalculator hashJoinHelperSizeCalculator, double fragmentationFactor, double safetyFactor, boolean semiJoin) -
Method Summary
Modifier and TypeMethodDescriptionlonglongintgetState()The currentHashJoinStatecorresponding to this calculator.protected voidinitialize(boolean firstCycle, boolean reserveHash, CaseInsensitiveMap<Long> keySizes, long memoryAvailable, int initialPartitions, boolean probeEmpty, BatchSizePredictor buildSizePredictor, BatchSizePredictor probeSizePredictor, int recordsPerPartitionBatchBuild, int recordsPerPartitionBatchProbe, int maxBatchNumRecordsBuild, int maxBatchNumRecordsProbe, int outputBatchSize, double loadFactor) voidinitialize(boolean firstCycle, boolean reserveHash, RecordBatch buildBatch, RecordBatch probeBatch, Set<String> joinColumns, boolean probeEmpty, long memoryAvailable, int initialPartitions, int recordsPerPartitionBatchBuild, int recordsPerPartitionBatchProbe, int maxBatchNumRecordsBuild, int maxBatchNumRecordsProbe, int outputBatchSize, double loadFactor) next()Signifies that the current state is complete and returns the nextHashJoinStateCalculator.voidsetPartitionStatSet(HashJoinMemoryCalculator.PartitionStatSet partitionStatSet) boolean
-
Constructor Details
-
BuildSidePartitioningImpl
public BuildSidePartitioningImpl(BatchSizePredictor.Factory batchSizePredictorFactory, HashTableSizeCalculator hashTableSizeCalculator, HashJoinHelperSizeCalculator hashJoinHelperSizeCalculator, double fragmentationFactor, double safetyFactor, boolean semiJoin)
-
-
Method Details
-
initialize
public void initialize(boolean firstCycle, boolean reserveHash, RecordBatch buildBatch, RecordBatch probeBatch, Set<String> joinColumns, boolean probeEmpty, long memoryAvailable, int initialPartitions, int recordsPerPartitionBatchBuild, int recordsPerPartitionBatchProbe, int maxBatchNumRecordsBuild, int maxBatchNumRecordsProbe, int outputBatchSize, double loadFactor) - Specified by:
initializein interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-
initialize
protected void initialize(boolean firstCycle, boolean reserveHash, CaseInsensitiveMap<Long> keySizes, long memoryAvailable, int initialPartitions, boolean probeEmpty, BatchSizePredictor buildSizePredictor, BatchSizePredictor probeSizePredictor, int recordsPerPartitionBatchBuild, int recordsPerPartitionBatchProbe, int maxBatchNumRecordsBuild, int maxBatchNumRecordsProbe, int outputBatchSize, double loadFactor) -
setPartitionStatSet
- Specified by:
setPartitionStatSetin interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-
getNumPartitions
public int getNumPartitions()- Specified by:
getNumPartitionsin interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-
getBuildReservedMemory
public long getBuildReservedMemory()- Specified by:
getBuildReservedMemoryin interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-
getMaxReservedMemory
public long getMaxReservedMemory()- Specified by:
getMaxReservedMemoryin interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-
shouldSpill
public boolean shouldSpill()- Specified by:
shouldSpillin interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-
next
Description copied from interface:HashJoinStateCalculatorSignifies that the current state is complete and returns the nextHashJoinStateCalculator. Returns null in the case where there is no next state.- Specified by:
nextin interfaceHashJoinStateCalculator<HashJoinMemoryCalculator.PostBuildCalculations>- Returns:
- The next
HashJoinStateCalculatoror null if this was the last state.
-
getState
Description copied from interface:HashJoinStateCalculatorThe currentHashJoinStatecorresponding to this calculator.- Specified by:
getStatein interfaceHashJoinStateCalculator<HashJoinMemoryCalculator.PostBuildCalculations>- Returns:
-
makeDebugString
- Specified by:
makeDebugStringin interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-