public abstract class SingleVectorState extends Object implements VectorState
| Modifier and Type | Class and Description |
|---|---|
static class |
SingleVectorState.FixedWidthVectorState
State for a scalar value vector.
|
static class |
SingleVectorState.IsSetVectorState |
static class |
SingleVectorState.OffsetVectorState
Special case for an offset vector.
|
static class |
SingleVectorState.SimpleVectorState |
static class |
SingleVectorState.VariableWidthVectorState
State for a scalar value vector.
|
| Modifier and Type | Field and Description |
|---|---|
protected ValueVector |
backupVector |
protected ValueVector |
mainVector |
protected WriterEvents |
writer |
| Constructor and Description |
|---|
SingleVectorState(WriterEvents writer,
ValueVector mainVector) |
| Modifier and Type | Method and Description |
|---|---|
int |
allocate(int cardinality)
Allocate a new vector with the number of elements given.
|
protected abstract int |
allocateVector(ValueVector vector,
int cardinality) |
void |
close()
Clear the vector(s) associated with this state.
|
protected abstract void |
copyOverflow(int sourceStartIndex,
int sourceEndIndex) |
void |
dump(HierarchicalFormatter format) |
void |
harvestWithLookAhead()
Exchange the data from the backup vector and the main vector, putting
the completed buffers back into the main vectors, and stashing the
overflow buffers away in the backup vector.
|
boolean |
isProjected()
Report whether this column is projected (has materialized vectors),
or is unprojected (has no materialized backing.)
|
protected static TypeProtos.MajorType |
parseVectorType(ValueVector vector)
The vector mechanism here relies on the vector metadata.
|
void |
rollover(int cardinality)
A column within the row batch overflowed.
|
void |
startBatchWithLookAhead()
The previous full batch has been sent downstream and the client is
now ready to start writing to the next batch.
|
<T extends ValueVector> |
vector()
Underlying vector: the one presented to the consumer of the
result set loader.
|
static SingleVectorState.SimpleVectorState |
vectorState(ColumnMetadata schema,
WriterEvents writer,
ValueVector mainVector) |
protected final WriterEvents writer
protected final ValueVector mainVector
protected ValueVector backupVector
public SingleVectorState(WriterEvents writer, ValueVector mainVector)
public <T extends ValueVector> T vector()
VectorStatevector in interface VectorStatepublic int allocate(int cardinality)
VectorStateallocate in interface VectorStatecardinality - number of elements desired in the allocated
vectorprotected abstract int allocateVector(ValueVector vector, int cardinality)
public void rollover(int cardinality)
rollover in interface VectorStatesourceStartIndex - the index of the row that caused the overflow, the
values of which should be copied to a new "look-ahead" vector. If the
vector is an array, then the overflowIndex is the position of the first
element to be moved, and multiple elements may need to moveprotected static TypeProtos.MajorType parseVectorType(ValueVector vector)
values vector which
is required. But the values vector will carry metadata that
declares it to be nullable. While this is clearly a bug, it is a bug that has
become a "feature" and cannot be changed. This code works around this feature
by parsing out the actual type of the vector.vector - the vector to clone, the type of which may not match the
metadata declared within that vectorprotected abstract void copyOverflow(int sourceStartIndex,
int sourceEndIndex)
public void harvestWithLookAhead()
harvestWithLookAhead in interface VectorStatepublic void startBatchWithLookAhead()
startBatchWithLookAhead in interface VectorStatepublic void close()
VectorStateclose in interface VectorStatepublic boolean isProjected()
VectorStateisProjected in interface VectorStatepublic static SingleVectorState.SimpleVectorState vectorState(ColumnMetadata schema, WriterEvents writer, ValueVector mainVector)
public void dump(HierarchicalFormatter format)
dump in interface VectorStateCopyright © 2021 The Apache Software Foundation. All rights reserved.