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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
Reset the index at which the incoming vector is being processed.void
setOutputCount
(int outputCount) Set the maximum number of values allowed in the output.void
Set the vector for the rowId implicit columnvoid
setUnnestField
(RepeatedValueVector unnestField) Set the field to be unnestedfinal void
setup
(FragmentContext context, RecordBatch incoming, RecordBatch outgoing, List<TransferPair> transfers) toString()
final int
unnestRecords
(int recordCount) Performs the actual unnest operation.
-
Constructor Details
-
UnnestImpl
public UnnestImpl()
-
-
Method Details
-
setUnnestField
Description copied from interface:Unnest
Set the field to be unnested- Specified by:
setUnnestField
in interfaceUnnest
-
getUnnestField
- Specified by:
getUnnestField
in interfaceUnnest
-
setOutputCount
public void setOutputCount(int outputCount) Description copied from interface:Unnest
Set the maximum number of values allowed in the output.- Specified by:
setOutputCount
in interfaceUnnest
-
setRowIdVector
Description copied from interface:Unnest
Set the vector for the rowId implicit column- Specified by:
setRowIdVector
in interfaceUnnest
-
unnestRecords
public final int unnestRecords(int recordCount) Description copied from interface:Unnest
Performs the actual unnest operation.- Specified by:
unnestRecords
in interfaceUnnest
- Returns:
- number of values in output
-
setup
public final void setup(FragmentContext context, RecordBatch incoming, RecordBatch outgoing, List<TransferPair> transfers) throws SchemaChangeException - Specified by:
setup
in interfaceUnnest
- Throws:
SchemaChangeException
-
resetGroupIndex
public void resetGroupIndex()Description copied from interface:Unnest
Reset the index at which the incoming vector is being processed. Called every time a new batch comes in.- Specified by:
resetGroupIndex
in interfaceUnnest
-
close
public void close() -
toString
-