Class SpilledRun

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

public class SpilledRun extends BatchGroup
Holds a set of spilled batches, represented by a file on disk. Handles reads from, and writes to the spill file. The data structure is:
  • A pointer to a file that contains serialized batches.
  • When writing, each batch is appended to the output file.
  • When reading, iterates over each spilled batch, and for each of those, each spilled record.

Starts out with no current batch. Defines the current batch to be the (shell: schema without data) of the last batch spilled to disk.

When reading, has destructive read-once behavior: closing the batch (after reading) deletes the underlying spill file.

This single class does three tasks: load data, hold data and read data. This should be split into three separate classes. But, the original (combined) structure is retained for expedience at present.