use of org.apache.drill.exec.planner.common.JoinControl in project drill by apache.
the class HashJoinProbeTemplate method setupHashJoinProbe.
/**
* Setup the Hash Join Probe object
*
* @param probeBatch
* @param outgoing
* @param joinRelType
* @param semiJoin
* @param leftStartState
* @param partitions
* @param cycleNum
* @param container
* @param spilledInners
* @param buildSideIsEmpty
* @param numPartitions
* @param rightHVColPosition
*/
@Override
public void setupHashJoinProbe(RecordBatch probeBatch, HashJoinBatch outgoing, JoinRelType joinRelType, boolean semiJoin, IterOutcome leftStartState, HashPartition[] partitions, int cycleNum, VectorContainer container, HashJoinBatch.HashJoinSpilledPartition[] spilledInners, boolean buildSideIsEmpty, int numPartitions, int rightHVColPosition) {
this.container = container;
this.spilledInners = spilledInners;
this.probeBatch = probeBatch;
this.probeSchema = probeBatch.getSchema();
this.joinType = joinRelType;
this.outgoingJoinBatch = outgoing;
this.partitions = partitions;
this.cycleNum = cycleNum;
this.buildSideIsEmpty = buildSideIsEmpty;
this.numPartitions = numPartitions;
// position (0 based) of added column == #columns
this.numberOfBuildSideColumns = semiJoin ? 0 : rightHVColPosition;
this.semiJoin = semiJoin;
// e.g. 32 --> 0x1F
partitionMask = numPartitions - 1;
// e.g. 0x1F -> 5
bitsInMask = Integer.bitCount(partitionMask);
joinControl = new JoinControl(outgoingJoinBatch.getPopConfig().getJoinControl());
probeState = ProbeState.PROBE_PROJECT;
this.recordsToProcess = 0;
this.recordsProcessed = 0;
// A special case - if the left was an empty file
if (leftStartState == IterOutcome.NONE) {
changeToFinalProbeState();
} else {
this.recordsToProcess = probeBatch.getRecordCount();
}
// initialize those partitions' current batches and hash-value vectors
for (HashPartition partn : this.partitions) {
partn.allocateNewCurrentBatchAndHV();
}
// In case it's a Right/Full outer join
currRightPartition = 0;
// Initialize the HV vector for the first (already read) left batch
if (this.cycleNum > 0) {
if (read_left_HV_vector != null) {
read_left_HV_vector.clear();
}
if (leftStartState != IterOutcome.NONE) {
// Skip when outer spill was empty
read_left_HV_vector = (IntVector) probeBatch.getContainer().getLast();
}
}
}
Aggregations