Class RecordBatchLoader

java.lang.Object
org.apache.drill.exec.record.RecordBatchLoader
All Implemented Interfaces:
Iterable<VectorWrapper<?>>, VectorAccessible

public class RecordBatchLoader extends Object implements VectorAccessible
Holds record batch loaded from record batch message.
  • Constructor Details

    • RecordBatchLoader

      public RecordBatchLoader(BufferAllocator allocator)
      Constructs a loader using the given allocator for vector buffer allocation.
  • Method Details

    • allocator

      public BufferAllocator allocator()
    • load

      public boolean load(UserBitShared.RecordBatchDef def, DrillBuf buf)
      Load a record batch from a single buffer.
      Parameters:
      def - The definition for the record batch.
      buf - The buffer that holds the data associated with the record batch.
      Returns:
      Whether the schema changed since the previous load.
    • getValueVectorId

      public TypedFieldId getValueVectorId(SchemaPath path)
      Description copied from interface: VectorAccessible
      Get 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 classes implementation of Iterable<ValueVector>.
      Specified by:
      getValueVectorId in interface VectorAccessible
      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
    • getRecordCount

      public int getRecordCount()
      Description copied from interface: VectorAccessible
      Get the number of records.
      Specified by:
      getRecordCount in interface VectorAccessible
      Returns:
      number of records
    • getContainer

      public VectorContainer getContainer()
    • getValueAccessorById

      public VectorWrapper<?> getValueAccessorById(Class<?> clazz, int... ids)
      Specified by:
      getValueAccessorById in interface VectorAccessible
    • getWritableBatch

      public WritableBatch getWritableBatch()
    • iterator

      public Iterator<VectorWrapper<?>> iterator()
      Specified by:
      iterator in interface Iterable<VectorWrapper<?>>
    • getSelectionVector2

      public SelectionVector2 getSelectionVector2()
      Specified by:
      getSelectionVector2 in interface VectorAccessible
    • getSelectionVector4

      public SelectionVector4 getSelectionVector4()
      Specified by:
      getSelectionVector4 in interface VectorAccessible
    • getSchema

      public BatchSchema getSchema()
      Description copied from interface: VectorAccessible
      Get the schema of the current RecordBatch. This changes if and only if a *_NEW_SCHEMA IterOutcome is provided.
      Specified by:
      getSchema in interface VectorAccessible
      Returns:
      schema of the current batch
    • resetRecordCount

      public void resetRecordCount()
    • zero

      public void zero()
      Removes an data from the loader, but maintains the schema and empty vectors.
    • clear

      public void clear()
      Clears this loader, which clears the internal vector container (see VectorContainer.clear()) and resets the record count to zero.
    • toString

      public String toString()
      Overrides:
      toString in class Object