public class VectorContainer extends Object implements VectorAccessible
Modifier and Type | Field and Description |
---|---|
protected List<VectorWrapper<?>> |
wrappers |
Constructor and Description |
---|
VectorContainer() |
VectorContainer(BufferAllocator allocator) |
VectorContainer(BufferAllocator allocator,
BatchSchema schema)
Create a new vector container given a pre-defined schema.
|
VectorContainer(OperatorContext oContext) |
Modifier and Type | Method and Description |
---|---|
TypedFieldId |
add(ValueVector vv) |
void |
add(ValueVector[] hyperVector) |
void |
add(ValueVector[] hyperVector,
boolean releasable) |
void |
addCollection(Iterable<ValueVector> vectors) |
void |
addHyperList(List<ValueVector> vectors) |
void |
addHyperList(List<ValueVector> vectors,
boolean releasable) |
<T extends ValueVector> |
addOrGet(MaterializedField field) |
<T extends ValueVector> |
addOrGet(MaterializedField field,
SchemaChangeCallBack callBack)
This method should be called with MaterializedField which also has correct children field list specially when
the field type is MAP.
|
<T extends ValueVector> |
addOrGet(String name,
TypeProtos.MajorType type,
Class<T> clazz) |
void |
allocate(int recordCount) |
void |
allocateNew() |
boolean |
allocateNewSafe() |
void |
allocatePrecomputedChildCount(int valueCount,
int bytesPerValue,
int childValCount) |
int |
appendRow(VectorContainer srcContainer,
int srcIndex)
This works with non-hyper
VectorContainer s which have no selection vectors. |
void |
buildFrom(BatchSchema sourceSchema) |
void |
buildSchema(BatchSchema.SelectionVectorMode mode) |
void |
clear() |
void |
copySchemaFrom(VectorAccessible other) |
void |
exchange(VectorContainer other)
Exchange buffers between two identical vector containers.
|
BufferAllocator |
getAllocator() |
ValueVector |
getLast() |
int |
getNumberOfColumns() |
int |
getRecordCount()
Get the number of records.
|
BatchSchema |
getSchema()
Get the schema of the current RecordBatch.
|
SelectionVector2 |
getSelectionVector2() |
SelectionVector4 |
getSelectionVector4() |
static VectorContainer |
getTransferClone(VectorAccessible incoming,
BufferAllocator allocator) |
static VectorContainer |
getTransferClone(VectorAccessible incoming,
OperatorContext oContext)
Get a set of transferred clones of this container.
|
static VectorContainer |
getTransferClone(VectorAccessible incoming,
VectorWrapper<?>[] ignoreWrappers,
OperatorContext oContext) |
VectorWrapper<?> |
getValueAccessorById(Class<?> clazz,
int... fieldIds) |
VectorWrapper<?> |
getValueVector(int index) |
TypedFieldId |
getValueVectorId(SchemaPath path)
Get the value vector type and id for the given schema path.
|
boolean |
hasRecordCount() |
boolean |
hasSchema() |
int |
incRecordCount()
Increment the record count
|
boolean |
isSchemaChanged() |
Iterator<VectorWrapper<?>> |
iterator() |
VectorContainer |
merge(VectorContainer otherContainer)
Merge two batches to create a single, combined, batch.
|
String |
prettyPrintRecord(int index)
This method create a pretty string for a record in the
VectorContainer . |
void |
rawTransferIn(VectorContainer containerIn) |
void |
remove(ValueVector v) |
void |
removeAll() |
void |
schemaChanged()
Indicate the schema changed.
|
void |
setEmpty()
Safely set this container to an empty batch.
|
void |
setRecordCount(int recordCount) |
void |
setValueCount(int valueCount) |
String |
toString() |
void |
transferIn(VectorContainer containerIn)
Transfer vectors from containerIn to this.
|
void |
transferOut(VectorContainer containerOut)
Transfer vectors from this to containerOut
|
void |
zeroVectors()
Clears the contained vectors.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected final List<VectorWrapper<?>> wrappers
public VectorContainer()
public VectorContainer(OperatorContext oContext)
public VectorContainer(BufferAllocator allocator)
public VectorContainer(BufferAllocator allocator, BatchSchema schema)
allocateNew()
or allocateNewSafe()
to allocate
memory.
Note that this method does the equivalent of #buildSchema(SelectionVectorMode)
using the schema provided.
allocator
- allocator to be used to allocate memory laterschema
- the schema that defines the vectors to createpublic BufferAllocator getAllocator()
public boolean isSchemaChanged()
public void schemaChanged()
public void addHyperList(List<ValueVector> vectors)
public void addHyperList(List<ValueVector> vectors, boolean releasable)
public void transferIn(VectorContainer containerIn)
public void rawTransferIn(VectorContainer containerIn)
public void transferOut(VectorContainer containerOut)
public <T extends ValueVector> T addOrGet(MaterializedField field)
public <T extends ValueVector> T addOrGet(MaterializedField field, SchemaChangeCallBack callBack)
T
- field
- callBack
- public <T extends ValueVector> T addOrGet(String name, TypeProtos.MajorType type, Class<T> clazz)
public static VectorContainer getTransferClone(VectorAccessible incoming, OperatorContext oContext)
incoming
- The RecordBatch iterator the contains the batch we should take over.public static VectorContainer getTransferClone(VectorAccessible incoming, BufferAllocator allocator)
public static VectorContainer getTransferClone(VectorAccessible incoming, VectorWrapper<?>[] ignoreWrappers, OperatorContext oContext)
public void addCollection(Iterable<ValueVector> vectors)
public int appendRow(VectorContainer srcContainer, int srcIndex)
VectorContainer
s which have no selection vectors.
Appends a row taken from a source VectorContainer
to this VectorContainer
.srcContainer
- The VectorContainer
to copy a row from.srcIndex
- The index of the row to copy from the source VectorContainer
.public TypedFieldId add(ValueVector vv)
public ValueVector getLast()
public void add(ValueVector[] hyperVector)
public void add(ValueVector[] hyperVector, boolean releasable)
public void remove(ValueVector v)
public TypedFieldId getValueVectorId(SchemaPath path)
VectorAccessible
Iterable<ValueVector>.
getValueVectorId
in interface VectorAccessible
path
- the path where the vector should be located.public VectorWrapper<?> getValueVector(int index)
public VectorWrapper<?> getValueAccessorById(Class<?> clazz, int... fieldIds)
getValueAccessorById
in interface VectorAccessible
public boolean hasSchema()
public BatchSchema getSchema()
VectorAccessible
getSchema
in interface VectorAccessible
public void buildSchema(BatchSchema.SelectionVectorMode mode)
public Iterator<VectorWrapper<?>> iterator()
iterator
in interface Iterable<VectorWrapper<?>>
public void clear()
public void removeAll()
public void setRecordCount(int recordCount)
public int incRecordCount()
public int getRecordCount()
VectorAccessible
getRecordCount
in interface VectorAccessible
public boolean hasRecordCount()
public SelectionVector2 getSelectionVector2()
getSelectionVector2
in interface VectorAccessible
public SelectionVector4 getSelectionVector4()
getSelectionVector4
in interface VectorAccessible
public void zeroVectors()
ValueVector.clear()
).
Note that the name zeroVector() in a value vector is
used for the action to set all vectors to zero. Here it means
to free the vector's memory. Sigh...public int getNumberOfColumns()
public void allocate(int recordCount)
public void allocateNew()
public boolean allocateNewSafe()
public void setValueCount(int valueCount)
public VectorContainer merge(VectorContainer otherContainer)
BatchSchema.merge(BatchSchema)
.
The two batches must have identical row counts. The pattern is that
this container is the main part of the record batch, the other
represents new columns to merge.
Reference counts on the underlying buffers are unchanged. The client code is assumed to abandon the two input containers in favor of the merged container.
otherContainer
- the container to merge with this onepublic void exchange(VectorContainer other)
other
- the target container with buffers to swappublic String prettyPrintRecord(int index)
VectorContainer
.index
- The index of the record of interest.public void setEmpty()
public void copySchemaFrom(VectorAccessible other)
public void buildFrom(BatchSchema sourceSchema)
public void allocatePrecomputedChildCount(int valueCount, int bytesPerValue, int childValCount)
Copyright © 1970 The Apache Software Foundation. All rights reserved.