Class UnnestImpl
java.lang.Object
org.apache.drill.exec.physical.impl.unnest.UnnestImpl
- All Implemented Interfaces:
Unnest
Contains the actual unnest operation. Unnest is a simple transfer operation in this implementation.
Additionally, unnest produces an implicit rowId column that allows unnest to output batches with many
rows of incoming data being unnested in a single call to innerNext(). Downstream blocking operators need
to be aware of this rowId column and include the rowId as the sort or group by key.
This class follows the pattern of other operators that generate code at runtime. Normally this class
would be abstract and have placeholders for doSetup and doEval. Unnest however, doesn't require code
generation so we can simply implement the code in a simple class that looks similar to the code gen
templates used by other operators but does not implement the doSetup and doEval methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidReset the index at which the incoming vector is being processed.voidsetOutputCount(int outputCount) Set the maximum number of values allowed in the output.voidSet the vector for the rowId implicit columnvoidsetUnnestField(RepeatedValueVector unnestField) Set the field to be unnestedfinal voidsetup(FragmentContext context, RecordBatch incoming, RecordBatch outgoing, List<TransferPair> transfers) toString()final intunnestRecords(int recordCount) Performs the actual unnest operation.
-
Constructor Details
-
UnnestImpl
public UnnestImpl()
-
-
Method Details
-
setUnnestField
Description copied from interface:UnnestSet the field to be unnested- Specified by:
setUnnestFieldin interfaceUnnest- Parameters:
unnestField-
-
getUnnestField
- Specified by:
getUnnestFieldin interfaceUnnest
-
setOutputCount
public void setOutputCount(int outputCount) Description copied from interface:UnnestSet the maximum number of values allowed in the output.- Specified by:
setOutputCountin interfaceUnnest- Parameters:
outputCount-
-
setRowIdVector
Description copied from interface:UnnestSet the vector for the rowId implicit column- Specified by:
setRowIdVectorin interfaceUnnest
-
unnestRecords
public final int unnestRecords(int recordCount) Description copied from interface:UnnestPerforms the actual unnest operation.- Specified by:
unnestRecordsin interfaceUnnest- Parameters:
recordCount-- Returns:
- number of values in output
-
setup
public final void setup(FragmentContext context, RecordBatch incoming, RecordBatch outgoing, List<TransferPair> transfers) throws SchemaChangeException - Specified by:
setupin interfaceUnnest- Throws:
SchemaChangeException
-
resetGroupIndex
public void resetGroupIndex()Description copied from interface:UnnestReset the index at which the incoming vector is being processed. Called every time a new batch comes in.- Specified by:
resetGroupIndexin interfaceUnnest
-
close
public void close() -
toString
-