public abstract class BatchGroup extends Object implements VectorAccessible, AutoCloseable
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:
| Modifier and Type | Class and Description |
|---|---|
static class |
BatchGroup.InputBatch
The input batch group gathers batches buffered in memory before
spilling.
|
static class |
BatchGroup.SpilledRun
Holds a set of spilled batches, represented by a file on disk.
|
| Modifier and Type | Field and Description |
|---|---|
protected BufferAllocator |
allocator |
protected VectorContainer |
currentContainer |
protected int |
pointer |
protected BatchSchema |
schema |
| Constructor and Description |
|---|
BatchGroup(VectorContainer container,
BufferAllocator allocator) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static void |
closeAll(Collection<? extends BatchGroup> groups) |
VectorContainer |
getContainer() |
int |
getNextIndex() |
int |
getRecordCount()
Get the number of records.
|
BatchSchema |
getSchema()
Get the schema of the current RecordBatch.
|
SelectionVector2 |
getSelectionVector2() |
SelectionVector4 |
getSelectionVector4() |
int |
getUnfilteredRecordCount() |
VectorWrapper<?> |
getValueAccessorById(Class<?> clazz,
int... ids) |
TypedFieldId |
getValueVectorId(SchemaPath path)
Get the value vector type and id for the given schema path.
|
Iterator<VectorWrapper<?>> |
iterator() |
void |
setSchema(BatchSchema schema)
Updates the schema for this batch group.
|
protected VectorContainer currentContainer
protected int pointer
protected final BufferAllocator allocator
protected BatchSchema schema
public BatchGroup(VectorContainer container, BufferAllocator allocator)
public void setSchema(BatchSchema schema)
schema - public int getNextIndex()
public VectorContainer getContainer()
public void close()
throws IOException
close in interface AutoCloseableIOExceptionpublic VectorWrapper<?> getValueAccessorById(Class<?> clazz, int... ids)
getValueAccessorById in interface VectorAccessiblepublic TypedFieldId getValueVectorId(SchemaPath path)
VectorAccessiblegetValueVectorId in interface VectorAccessiblepath - the path where the vector should be located.public BatchSchema getSchema()
VectorAccessiblegetSchema in interface VectorAccessiblepublic int getRecordCount()
VectorAccessiblegetRecordCount in interface VectorAccessiblepublic int getUnfilteredRecordCount()
public Iterator<VectorWrapper<?>> iterator()
iterator in interface Iterable<VectorWrapper<?>>public SelectionVector2 getSelectionVector2()
getSelectionVector2 in interface VectorAccessiblepublic SelectionVector4 getSelectionVector4()
getSelectionVector4 in interface VectorAccessiblepublic static void closeAll(Collection<? extends BatchGroup> groups)
Copyright © 2017 The Apache Software Foundation. All rights reserved.