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
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.
-
Field Summary
Fields inherited from class org.apache.drill.exec.physical.impl.xsort.BatchGroup
currentContainer, mergeIndex, schema
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close resources owned by this batch group.void
long
int
getPath()
void
setBatchSize
(long batchSize) void
spillBatch
(VectorContainer newContainer) Methods inherited from class org.apache.drill.exec.physical.impl.xsort.BatchGroup
closeAll, getContainer, getRecordCount, getSchema, getSelectionVector2, getSelectionVector4, getUnfilteredRecordCount, getValueAccessorById, getValueVectorId, iterator, setSchema
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
-
Constructor Details
-
SpilledRun
- Throws:
IOException
-
-
Method Details
-
spillBatch
- Throws:
IOException
-
setBatchSize
public void setBatchSize(long batchSize) -
getBatchSize
public long getBatchSize() -
getPath
-
getNextIndex
public int getNextIndex()- Overrides:
getNextIndex
in classBatchGroup
-
close
Close resources owned by this batch group. Each can fail; report only the first error. This is cluttered because this class tries to do multiple tasks. TODO: Split into multiple classes.- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classBatchGroup
- Throws:
IOException
-
closeWriter
- Throws:
IOException
-