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
ConstructorDescriptionBuildSidePartitioningImpl
(BatchSizePredictor.Factory batchSizePredictorFactory, HashTableSizeCalculator hashTableSizeCalculator, HashJoinHelperSizeCalculator hashJoinHelperSizeCalculator, double fragmentationFactor, double safetyFactor, boolean semiJoin) -
Method Summary
Modifier and TypeMethodDescriptionlong
long
int
getState()
The currentHashJoinState
corresponding to this calculator.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) 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) next()
Signifies that the current state is complete and returns the nextHashJoinStateCalculator
.void
setPartitionStatSet
(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:
initialize
in 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:
setPartitionStatSet
in interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-
getNumPartitions
public int getNumPartitions()- Specified by:
getNumPartitions
in interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-
getBuildReservedMemory
public long getBuildReservedMemory()- Specified by:
getBuildReservedMemory
in interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-
getMaxReservedMemory
public long getMaxReservedMemory()- Specified by:
getMaxReservedMemory
in interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-
shouldSpill
public boolean shouldSpill()- Specified by:
shouldSpill
in interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-
next
Description copied from interface:HashJoinStateCalculator
Signifies that the current state is complete and returns the nextHashJoinStateCalculator
. Returns null in the case where there is no next state.- Specified by:
next
in interfaceHashJoinStateCalculator<HashJoinMemoryCalculator.PostBuildCalculations>
- Returns:
- The next
HashJoinStateCalculator
or null if this was the last state.
-
getState
Description copied from interface:HashJoinStateCalculator
The currentHashJoinState
corresponding to this calculator.- Specified by:
getState
in interfaceHashJoinStateCalculator<HashJoinMemoryCalculator.PostBuildCalculations>
- Returns:
-
makeDebugString
- Specified by:
makeDebugString
in interfaceHashJoinMemoryCalculator.BuildSidePartitioning
-