public class VectorSchemaRoot extends Object implements AutoCloseable
Constructor and Description |
---|
VectorSchemaRoot(FieldVector parent)
Constructs a new instance containing the children of parent but not the parent itself.
|
VectorSchemaRoot(Iterable<FieldVector> vectors)
Constructs new instance containing each of the vectors.
|
VectorSchemaRoot(List<Field> fields,
List<FieldVector> fieldVectors)
Constructs a new instance.
|
VectorSchemaRoot(List<Field> fields,
List<FieldVector> fieldVectors,
int rowCount)
Constructs a new instance.
|
VectorSchemaRoot(Schema schema,
List<FieldVector> fieldVectors,
int rowCount)
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
VectorSchemaRoot |
addVector(int index,
FieldVector vector)
Add vector to the record batch, producing a new VectorSchemaRoot.
|
void |
allocateNew()
Do an adaptive allocation of each vector for memory purposes.
|
boolean |
approxEquals(VectorSchemaRoot other)
Determine if two VectorSchemaRoots are approximately equal using default functions to
calculate difference between float/double values.
|
boolean |
approxEquals(VectorSchemaRoot other,
VectorValueEqualizer<Float4Vector> floatDiffFunction,
VectorValueEqualizer<Float8Vector> doubleDiffFunction)
Determine if two VectorSchemaRoots are approximately equal using the given functions to
calculate difference between float/double values.
|
void |
clear()
Release all the memory for each vector held in this root.
|
void |
close() |
String |
contentToTSVString()
Returns a tab separated value of vectors (based on their java object representation).
|
static VectorSchemaRoot |
create(Schema schema,
BufferAllocator allocator)
Creates a new set of empty vectors corresponding to the given schema.
|
boolean |
equals(VectorSchemaRoot other)
Determine if two VectorSchemaRoots are exactly equal.
|
List<FieldVector> |
getFieldVectors() |
int |
getRowCount() |
Schema |
getSchema() |
FieldVector |
getVector(Field field) |
FieldVector |
getVector(int index) |
FieldVector |
getVector(String name)
gets a vector by name.
|
static VectorSchemaRoot |
of(FieldVector... vectors)
Constructs a new instance from vectors.
|
VectorSchemaRoot |
removeVector(int index)
Remove vector from the record batch, producing a new VectorSchemaRoot.
|
void |
setRowCount(int rowCount)
Set the row count of all the vectors in this container.
|
VectorSchemaRoot |
slice(int index)
Slice this root from desired index.
|
VectorSchemaRoot |
slice(int index,
int length)
Slice this root at desired index and length.
|
boolean |
syncSchema()
Synchronizes the schema from the current vectors.
|
public VectorSchemaRoot(Iterable<FieldVector> vectors)
public VectorSchemaRoot(FieldVector parent)
public VectorSchemaRoot(List<Field> fields, List<FieldVector> fieldVectors)
fields
- The types of each vector.fieldVectors
- The data vectors (must be equal in size to fields
.public VectorSchemaRoot(List<Field> fields, List<FieldVector> fieldVectors, int rowCount)
fields
- The types of each vector.fieldVectors
- The data vectors (must be equal in size to fields
.rowCount
- The number of rows contained.public VectorSchemaRoot(Schema schema, List<FieldVector> fieldVectors, int rowCount)
schema
- The schema for the vectors.fieldVectors
- The data vectors.rowCount
- The number of rowspublic static VectorSchemaRoot create(Schema schema, BufferAllocator allocator)
public static VectorSchemaRoot of(FieldVector... vectors)
public void allocateNew()
public void clear()
public List<FieldVector> getFieldVectors()
public FieldVector getVector(String name)
public FieldVector getVector(Field field)
public FieldVector getVector(int index)
public VectorSchemaRoot addVector(int index, FieldVector vector)
index
- field indexvector
- vector to be added.public VectorSchemaRoot removeVector(int index)
index
- field indexpublic Schema getSchema()
public int getRowCount()
public void setRowCount(int rowCount)
rowCount
- Number of records.public void close()
close
in interface AutoCloseable
public String contentToTSVString()
public boolean syncSchema()
PromotableWriter
).
For example, when writing different types of data to a ListVector
may lead to such a case.
When this happens, this method should be called to bring the schema and vector structure in a synchronized state.public VectorSchemaRoot slice(int index)
index
- start position of the slicepublic VectorSchemaRoot slice(int index, int length)
index
- start position of the slicelength
- length of the slicepublic boolean equals(VectorSchemaRoot other)
public boolean approxEquals(VectorSchemaRoot other, VectorValueEqualizer<Float4Vector> floatDiffFunction, VectorValueEqualizer<Float8Vector> doubleDiffFunction)
floatDiffFunction
- function to calculate difference between float values.doubleDiffFunction
- function to calculate difference between double values.public boolean approxEquals(VectorSchemaRoot other)
Copyright © 2024 The Apache Software Foundation. All rights reserved.