Class AbstractRecordBatch<T extends PhysicalOperator>
- All Implemented Interfaces:
AutoCloseable
,Iterable<VectorWrapper<?>>
,CloseableRecordBatch
,RecordBatch
,VectorAccessible
- Direct Known Subclasses:
AbstractBinaryRecordBatch
,AbstractUnaryRecordBatch
,ExternalSortBatch
,HashAggBatch
,MergingRecordBatch
,OrderedPartitionRecordBatch
,ProducerConsumerBatch
,RowKeyJoinBatch
,SortBatch
,StatisticsWriterRecordBatch
,StreamingAggBatch
,TopNBatch
,WindowFrameRecordBatch
,WriterRecordBatch
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.drill.exec.record.RecordBatch
RecordBatch.IterOutcome
-
Field Summary
Modifier and TypeFieldDescriptionprotected final RecordBatchStats.RecordBatchStatsContext
protected final VectorContainer
protected final FragmentContext
protected final OperatorContext
protected final T
protected AbstractRecordBatch.BatchState
protected final OperatorStats
protected final boolean
Fields inherited from interface org.apache.drill.exec.record.RecordBatch
MAX_BATCH_ROW_COUNT
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractRecordBatch
(T popConfig, FragmentContext context) protected
AbstractRecordBatch
(T popConfig, FragmentContext context, boolean buildSchema) protected
AbstractRecordBatch
(T popConfig, FragmentContext context, boolean buildSchema, OperatorContext oContext) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
cancel()
Informs child operators that no more data is needed.protected abstract void
void
Checks if the query should continue.void
close()
Return the internal vector containerGets the FragmentContext of the current query fragment.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.abstract RecordBatch.IterOutcome
boolean
iterator()
final RecordBatch.IterOutcome
next()
Updates the data in each Field reading interface for the next range of records.final RecordBatch.IterOutcome
next
(int inputIndex, RecordBatch b) final RecordBatch.IterOutcome
next
(RecordBatch b) static UserException
schemaChangeException
(SchemaChangeException e, String operator, org.slf4j.Logger logger) protected UserException
schemaChangeException
(SchemaChangeException e, org.slf4j.Logger logger) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.apache.drill.exec.record.RecordBatch
dump
Methods inherited from interface org.apache.drill.exec.record.VectorAccessible
getRecordCount
-
Field Details
-
container
-
popConfig
-
context
-
oContext
-
batchStatsContext
-
stats
-
unionTypeEnabled
protected final boolean unionTypeEnabled -
state
-
-
Constructor Details
-
AbstractRecordBatch
- Throws:
OutOfMemoryException
-
AbstractRecordBatch
protected AbstractRecordBatch(T popConfig, FragmentContext context, boolean buildSchema) throws OutOfMemoryException - Throws:
OutOfMemoryException
-
AbstractRecordBatch
protected AbstractRecordBatch(T popConfig, FragmentContext context, boolean buildSchema, OperatorContext oContext)
-
-
Method Details
-
iterator
- Specified by:
iterator
in interfaceIterable<T extends PhysicalOperator>
-
getContext
Description copied from interface:RecordBatch
Gets the FragmentContext of the current query fragment. Useful for reporting failure information or other query-level information.- Specified by:
getContext
in interfaceRecordBatch
-
getPopConfig
-
next
-
next
-
next
Description copied from interface:RecordBatch
Updates the data in each Field reading interface for the next range of records.Once a RecordBatch's
next()
has returnedRecordBatch.IterOutcome.NONE
orIterOutcome#STOP
, the consumer should no longer callnext()
. Behavior at this point is undefined and likely to throw an exception.See
RecordBatch.IterOutcome
for the protocol (possible sequences of return values).- Specified by:
next
in interfaceRecordBatch
- Returns:
- An IterOutcome describing the result of the iteration.
-
innerNext
-
getSchema
Description copied from interface:RecordBatch
Gets 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_SCHEMA
orRecordBatch.IterOutcome.OK
.The schema changes when and only when
RecordBatch.next()
returnsRecordBatch.IterOutcome.OK_NEW_SCHEMA
.- Specified by:
getSchema
in interfaceRecordBatch
- Specified by:
getSchema
in interfaceVectorAccessible
- Returns:
- schema of the current batch
-
buildSchema
protected void buildSchema() -
cancel
public void cancel()Description copied from interface:RecordBatch
Informs 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
NONE
status downstream, or throw an exception. It is not legal to callnext()
on an operator after calling itscancel()
method.- Specified by:
cancel
in interfaceRecordBatch
-
cancelIncoming
protected abstract void cancelIncoming() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
getSelectionVector2
- Specified by:
getSelectionVector2
in interfaceVectorAccessible
-
getSelectionVector4
- Specified by:
getSelectionVector4
in interfaceVectorAccessible
-
getValueVectorId
Description copied from interface:RecordBatch
Gets 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:
getValueVectorId
in interfaceRecordBatch
- Specified by:
getValueVectorId
in 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:
getValueAccessorById
in interfaceRecordBatch
- Specified by:
getValueAccessorById
in interfaceVectorAccessible
-
getWritableBatch
Description copied from interface:RecordBatch
Gets a writable version of this batch. Takes over ownership of existing buffers.- Specified by:
getWritableBatch
in interfaceRecordBatch
-
getOutgoingContainer
- Specified by:
getOutgoingContainer
in interfaceRecordBatch
-
getContainer
Description copied from interface:RecordBatch
Return the internal vector container- Specified by:
getContainer
in interfaceRecordBatch
- Returns:
- The internal vector container
-
getRecordBatchStatsContext
-
isRecordBatchStatsLoggingEnabled
public boolean isRecordBatchStatsLoggingEnabled() -
checkContinue
public void checkContinue()Checks if the query should continue. Throws a UserException if not. Operators should call this periodically to detect cancellation requests. The operator need not catch the exception: it will bubble up the operator tree and be handled like any other fatal error. -
schemaChangeException
-
schemaChangeException
public static UserException schemaChangeException(SchemaChangeException e, String operator, org.slf4j.Logger logger)
-