Class OperatorRecordBatch
- All Implemented Interfaces:
AutoCloseable,Iterable<VectorWrapper<?>>,CloseableRecordBatch,RecordBatch,VectorAccessible
Note that downstream operators make an assumption that the same vectors will appear from one batch to the next. That is, not only must the schema be the same, but if column "a" appears in two batches, the same value vector must back "a" in both batches. The TransferPair abstraction fails if different vectors appear across batches.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.drill.exec.record.RecordBatch
RecordBatch.IterOutcome -
Field Summary
Fields inherited from interface org.apache.drill.exec.record.RecordBatch
MAX_BATCH_ROW_COUNT -
Constructor Summary
ConstructorsConstructorDescriptionOperatorRecordBatch(FragmentContext context, PhysicalOperator config, OperatorExec opExec, boolean enableSchemaBatch) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Informs child operators that no more data is needed.voidclose()voiddump()Perform dump of this batch's state to logs.Return the internal vector containerGets the FragmentContext of the current query fragment.intGet the number of records.Gets the current schema of this record batch.getValueAccessorById(Class<?> clazz, int... ids) getValueVectorId(SchemaPath path) Gets the value vector type and ID for the given schema path.Gets a writable version of this batch.iterator()next()Updates the data in each Field reading interface for the next range of records.Methods 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
-
OperatorRecordBatch
public OperatorRecordBatch(FragmentContext context, PhysicalOperator config, OperatorExec opExec, boolean enableSchemaBatch)
-
-
Method Details
-
getContext
Description copied from interface:RecordBatchGets the FragmentContext of the current query fragment. Useful for reporting failure information or other query-level information.- Specified by:
getContextin interfaceRecordBatch
-
fragmentContext
-
getSchema
Description copied from interface:RecordBatchGets the current schema of this record batch.May be called only when the most recent call to
RecordBatch.next(), if any, returnedRecordBatch.IterOutcome.OK_NEW_SCHEMAorRecordBatch.IterOutcome.OK.The schema changes when and only when
RecordBatch.next()returnsRecordBatch.IterOutcome.OK_NEW_SCHEMA.- Specified by:
getSchemain interfaceRecordBatch- Specified by:
getSchemain interfaceVectorAccessible- Returns:
- schema of the current batch
-
getRecordCount
public int getRecordCount()Description copied from interface:VectorAccessibleGet the number of records.- Specified by:
getRecordCountin interfaceVectorAccessible- Returns:
- number of records
-
getOutgoingContainer
- Specified by:
getOutgoingContainerin interfaceRecordBatch
-
getValueVectorId
Description copied from interface:RecordBatchGets the value vector type and ID for the given schema path. The TypedFieldId should store a fieldId which is the same as the ordinal position of the field within the Iterator provided this class's implementation ofIterable<ValueVector>.- Specified by:
getValueVectorIdin interfaceRecordBatch- Specified by:
getValueVectorIdin interfaceVectorAccessible- Parameters:
path- The path where the vector should be located.- Returns:
- The local field id associated with this vector. If no field matches this path, this will return a null TypedFieldId
-
getValueAccessorById
- Specified by:
getValueAccessorByIdin interfaceRecordBatch- Specified by:
getValueAccessorByIdin interfaceVectorAccessible
-
getWritableBatch
Description copied from interface:RecordBatchGets a writable version of this batch. Takes over ownership of existing buffers.- Specified by:
getWritableBatchin interfaceRecordBatch
-
getSelectionVector2
- Specified by:
getSelectionVector2in interfaceVectorAccessible
-
getSelectionVector4
- Specified by:
getSelectionVector4in interfaceVectorAccessible
-
iterator
- Specified by:
iteratorin interfaceIterable<VectorWrapper<?>>
-
cancel
public void cancel()Description copied from interface:RecordBatchInforms child operators that no more data is needed. Only called for "normal" cancellation to avoid unnecessary compute in any worker threads. For the error case, the fragment executor will call close() on each child automatically.The operator which triggers the cancel MUST send a
NONEstatus downstream, or throw an exception. It is not legal to callnext()on an operator after calling itscancel()method.- Specified by:
cancelin interfaceRecordBatch
-
next
Description copied from interface:RecordBatchUpdates the data in each Field reading interface for the next range of records.Once a RecordBatch's
next()has returnedRecordBatch.IterOutcome.NONEor, the consumer should no longer callinvalid reference
IterOutcome#STOPnext(). Behavior at this point is undefined and likely to throw an exception.See
RecordBatch.IterOutcomefor the protocol (possible sequences of return values).- Specified by:
nextin interfaceRecordBatch- Returns:
- An IterOutcome describing the result of the iteration.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getContainer
Description copied from interface:RecordBatchReturn the internal vector container- Specified by:
getContainerin interfaceRecordBatch- Returns:
- The internal vector container
-
dump
public void dump()Description copied from interface:RecordBatchPerform dump of this batch's state to logs.- Specified by:
dumpin interfaceRecordBatch
-