Class LateralJoinBatch
java.lang.Object
org.apache.drill.exec.record.AbstractRecordBatch<LateralJoinPOP>
org.apache.drill.exec.record.AbstractBinaryRecordBatch<LateralJoinPOP>
org.apache.drill.exec.physical.impl.join.LateralJoinBatch
- All Implemented Interfaces:
AutoCloseable,Iterable<VectorWrapper<?>>,LateralContract,CloseableRecordBatch,RecordBatch,VectorAccessible
public class LateralJoinBatch
extends AbstractBinaryRecordBatch<LateralJoinPOP>
implements LateralContract
RecordBatch implementation for the lateral join operator. Currently it's
expected LATERAL to co-exists with UNNEST operator. Both LATERAL and UNNEST
will share a contract with each other defined at
LateralContract.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.drill.exec.record.AbstractBinaryRecordBatch
AbstractBinaryRecordBatch.MetricNested classes/interfaces inherited from class org.apache.drill.exec.record.AbstractRecordBatch
AbstractRecordBatch.BatchStateNested classes/interfaces inherited from interface org.apache.drill.exec.record.RecordBatch
RecordBatch.IterOutcome -
Field Summary
Fields inherited from class org.apache.drill.exec.record.AbstractBinaryRecordBatch
batchMemoryManager, left, LEFT_INDEX, leftUpstream, numInputs, right, RIGHT_INDEX, rightUpstreamFields inherited from class org.apache.drill.exec.record.AbstractRecordBatch
batchStatsContext, container, context, oContext, popConfig, state, stats, unionTypeEnabledFields inherited from interface org.apache.drill.exec.record.RecordBatch
MAX_BATCH_ROW_COUNT -
Constructor Summary
ConstructorsConstructorDescriptionLateralJoinBatch(LateralJoinPOP popConfig, FragmentContext context, RecordBatch left, RecordBatch right) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPrefetch a batch from left and right branch to know about the schema of each side.protected voidvoidclose()voiddump()Perform dump of this batch's state to logs.Returns the left side incoming for the Lateral Join.Returns the currentRecordBatch.IterOutcomefor the left incoming batchintGet the number of records.intReturns the current row index which the calling operator should process in current incoming left record batch.Gets the left and right incoming batch and produce the output batch.protected booleanGet the left and right batch during build schema phase forLateralJoinBatch.voidsetMaxOutputRowCount(int outputRowCount) Used only for testing for cases when multiple output batches are produced for same input setvoidsetUseMemoryManager(boolean useMemoryManager) Used only for testing to disable output batch calculation using memory manager and instead use the static max value set bysetMaxOutputRowCount(int)Methods inherited from class org.apache.drill.exec.record.AbstractBinaryRecordBatch
checkForEarlyFinish, getBatchMemoryManager, updateBatchMemoryManagerStats, verifyOutcomeToSetBatchStateMethods inherited from class org.apache.drill.exec.record.AbstractRecordBatch
cancel, checkContinue, getContainer, getContext, getOutgoingContainer, getPopConfig, getRecordBatchStatsContext, getSchema, getSelectionVector2, getSelectionVector4, getValueAccessorById, getValueVectorId, getWritableBatch, isRecordBatchStatsLoggingEnabled, iterator, next, next, next, schemaChangeException, schemaChangeExceptionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
LateralJoinBatch
public LateralJoinBatch(LateralJoinPOP popConfig, FragmentContext context, RecordBatch left, RecordBatch right) throws OutOfMemoryException - Throws:
OutOfMemoryException
-
-
Method Details
-
innerNext
Gets the left and right incoming batch and produce the output batch. If the left incoming batch is empty then next on right branch is not called and empty batch with correct outcome is returned. If non empty left incoming batch is received then it call's next on right branch to get an incoming and finally produces output.- Specified by:
innerNextin classAbstractRecordBatch<LateralJoinPOP>- Returns:
- IterOutcome state of the lateral join batch
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classAbstractRecordBatch<LateralJoinPOP>
-
getRecordCount
public int getRecordCount()Description copied from interface:VectorAccessibleGet the number of records.- Specified by:
getRecordCountin interfaceVectorAccessible- Returns:
- number of records
-
getIncoming
Returns the left side incoming for the Lateral Join. Used by right branch leaf operator of Lateral to process the records atleftJoinIndex.- Specified by:
getIncomingin interfaceLateralContract- Returns:
- - RecordBatch received as left side incoming
-
getRecordIndex
public int getRecordIndex()Returns the current row index which the calling operator should process in current incoming left record batch. LATERAL should never return it as -1 since that indicated current left batch is empty and LATERAL will never call next on right side with empty left batch- Specified by:
getRecordIndexin interfaceLateralContract- Returns:
- - int - index of row to process.
-
getLeftOutcome
Returns the currentRecordBatch.IterOutcomefor the left incoming batch- Specified by:
getLeftOutcomein interfaceLateralContract- Returns:
- The current outcome of left incoming batch.
-
prefetchFirstBatchFromBothSides
protected boolean prefetchFirstBatchFromBothSides()Get the left and right batch during build schema phase forLateralJoinBatch. If left batch sees a failure outcome then we don't even call next on right branch, since there is no left incoming.- Overrides:
prefetchFirstBatchFromBothSidesin classAbstractBinaryRecordBatch<LateralJoinPOP>- Returns:
- true if both the left/right batch was received without failure outcome. false if either of batch is received with failure outcome.
-
buildSchema
protected void buildSchema()Prefetch a batch from left and right branch to know about the schema of each side. Then adds value vector in output container based on those schemas. For this phase LATERAL always expect's an empty batch from right side which UNNEST should abide by.- Overrides:
buildSchemain classAbstractRecordBatch<LateralJoinPOP>- Throws:
SchemaChangeException- if batch schema was changed during execution
-
cancelIncoming
protected void cancelIncoming()- Overrides:
cancelIncomingin classAbstractBinaryRecordBatch<LateralJoinPOP>
-
setMaxOutputRowCount
public void setMaxOutputRowCount(int outputRowCount) Used only for testing for cases when multiple output batches are produced for same input set- Parameters:
outputRowCount- - Max rows that output batch can hold
-
setUseMemoryManager
public void setUseMemoryManager(boolean useMemoryManager) Used only for testing to disable output batch calculation using memory manager and instead use the static max value set bysetMaxOutputRowCount(int)- Parameters:
useMemoryManager- - false - disable memory manager update to take effect, true enable memory manager update
-
dump
public void dump()Description copied from interface:RecordBatchPerform dump of this batch's state to logs.- Specified by:
dumpin interfaceRecordBatch
-