Class BatchGroup

java.lang.Object
org.apache.drill.exec.physical.impl.xsort.BatchGroup
All Implemented Interfaces:
AutoCloseable, Iterable<VectorWrapper<?>>, VectorAccessible
Direct Known Subclasses:
InputBatch, SpilledRun

public abstract class BatchGroup extends Object implements VectorAccessible, AutoCloseable
Represents a group of batches spilled to disk.

The batches are defined by a schema which can change over time. When the schema changes, all existing and new batches are coerced into the new schema. Provides a uniform way to iterate over records for one or more batches whether the batches are in memory or on disk.

The BatchGroup operates in two modes as given by the two subclasses:

  • Input mode InputBatch: Used to buffer in-memory batches prior to spilling.
  • Spill mode SpilledRun: Holds a "memento" to a set of batches written to disk. Acts as both a reader and writer for those batches.
  • Field Details

    • allocator

      protected final BufferAllocator allocator
    • currentContainer

      protected VectorContainer currentContainer
    • mergeIndex

      protected int mergeIndex
      This class acts as both "holder" for a vector container and an iterator into that container when the sort enters the merge phase. (This should be revisited.) This field keeps track of the next record to merge during the merge phase.
    • schema

      protected BatchSchema schema
  • Constructor Details

  • Method Details