public class FixedSizeListVector extends BaseValueVector implements BaseListVector, PromotableVector
allocator, fieldReader, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY
Constructor and Description |
---|
FixedSizeListVector(String name,
BufferAllocator allocator,
FieldType fieldType,
CallBack unusedSchemaChangeCallback)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
<OUT,IN> OUT |
accept(VectorVisitor<OUT,IN> visitor,
IN value)
Accept a generic
VectorVisitor and return the result. |
<T extends ValueVector> |
addOrGetVector(FieldType type) |
void |
allocateNew()
Allocate new buffers.
|
boolean |
allocateNewSafe()
Allocates new buffers.
|
void |
clear()
Release any owned ArrowBuf and reset the ValueVector to the initial state.
|
void |
copyFrom(int fromIndex,
int thisIndex,
ValueVector from)
Copy a cell value from a particular index in source vector to a particular
position in this vector.
|
void |
copyFromSafe(int inIndex,
int outIndex,
ValueVector from)
Same as
ValueVector.copyFrom(int, int, ValueVector) except that
it handles the case when the capacity of the vector needs to be expanded
before copy. |
static FixedSizeListVector |
empty(String name,
int size,
BufferAllocator allocator) |
ArrowBuf[] |
getBuffers(boolean clear)
Return the underlying buffers associated with this vector.
|
int |
getBufferSize()
Get the number of bytes used by this vector.
|
int |
getBufferSizeFor(int valueCount)
Returns the number of bytes that is used by this vector if it holds the given number
of values.
|
List<FieldVector> |
getChildrenFromFields()
The returned list is the same size as the list passed to initializeChildrenFromFields.
|
ArrowBuf |
getDataBuffer()
Gets the underlying buffer associated with data vector.
|
long |
getDataBufferAddress()
Gets the starting address of the underlying buffer associated with data vector.
|
FieldVector |
getDataVector() |
int |
getElementEndIndex(int index)
Get data vector end index with the given list index.
|
int |
getElementStartIndex(int index)
Get data vector start index with the given list index.
|
Field |
getField()
Get information about how this field is materialized.
|
List<ArrowBuf> |
getFieldBuffers()
Get the buffers of the fields, (same size as getFieldVectors() since it is their content).
|
List<BufferBacked> |
getFieldInnerVectors()
Deprecated.
This API will be removed as the current implementations no longer support inner vectors.
|
int |
getListSize()
Get the fixed size for each list.
|
Types.MinorType |
getMinorType() |
String |
getName()
Gets the name of the vector.
|
int |
getNullCount()
Returns number of null elements in the vector.
|
List<?> |
getObject(int index)
Get friendly type object from the vector.
|
ArrowBuf |
getOffsetBuffer()
Gets the underlying buffer associated with offset vector.
|
long |
getOffsetBufferAddress()
Gets the starting address of the underlying buffer associated with offset vector.
|
UnionFixedSizeListReader |
getReader()
Default implementation to create a reader for the vector.
|
protected FieldReader |
getReaderImpl()
Each vector has a different reader that implements the FieldReader interface.
|
TransferPair |
getTransferPair(String ref,
BufferAllocator allocator) |
TransferPair |
getTransferPair(String ref,
BufferAllocator allocator,
CallBack callBack) |
ArrowBuf |
getValidityBuffer()
Gets the underlying buffer associated with validity vector.
|
long |
getValidityBufferAddress()
Gets the starting address of the underlying buffer associated with validity vector.
|
int |
getValueCapacity()
Returns the maximum number of values that can be stored in this vector instance.
|
int |
getValueCount()
Gets the number of values.
|
UnionFixedSizeListWriter |
getWriter() |
int |
hashCode(int index)
Returns hashCode of element in index with the default hasher.
|
int |
hashCode(int index,
ArrowBufHasher hasher)
Returns hashCode of element in index with the given hasher.
|
void |
initializeChildrenFromFields(List<Field> children)
Initializes the child vectors
to be later loaded with loadBuffers.
|
boolean |
isNull(int index)
Returns whether the value at index null.
|
int |
isSet(int index)
Returns non-zero when the value at index is non-null.
|
Iterator<ValueVector> |
iterator() |
void |
loadFieldBuffers(ArrowFieldNode fieldNode,
List<ArrowBuf> ownBuffers)
Loads data in the vectors.
|
TransferPair |
makeTransferPair(ValueVector target)
Makes a new transfer pair used to transfer underlying buffers.
|
UnionVector |
promoteToUnion() |
void |
reAlloc()
Allocate new buffer with double capacity, and copy data into the new buffer.
|
void |
reset()
Reset the ValueVector to the initial state without releasing any owned ArrowBuf.
|
void |
setInitialCapacity(int numRecords)
Set the initial record capacity.
|
void |
setNotNull(int index)
Sets the value at index to not-null.
|
void |
setNull(int index)
Sets the value at index to null.
|
void |
setValueCount(int valueCount)
Set number of values in the vector.
|
int |
size()
Get value indicating if inner vector is set.
|
int |
startNewValue(int index)
Start a new value in the list vector.
|
checkBufRefs, close, getAllocator, getTransferPair, getValidityBufferSizeFromCount, releaseBuffer, toString, transferBuffer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, getAllocator, getTransferPair, validate, validateFull
forEach, spliterator
public FixedSizeListVector(String name, BufferAllocator allocator, FieldType fieldType, CallBack unusedSchemaChangeCallback)
name
- The name for the vector.allocator
- The allocator to use for creating/reallocating buffers for the vector.fieldType
- The underlying data type of the vector.unusedSchemaChangeCallback
- Currently unused.public static FixedSizeListVector empty(String name, int size, BufferAllocator allocator)
public Field getField()
ValueVector
getField
in interface ValueVector
public Types.MinorType getMinorType()
getMinorType
in interface ValueVector
public String getName()
ValueVector
getName
in interface ValueVector
getName
in class BaseValueVector
public int getListSize()
public void initializeChildrenFromFields(List<Field> children)
FieldVector
initializeChildrenFromFields
in interface FieldVector
children
- the schemapublic List<FieldVector> getChildrenFromFields()
FieldVector
getChildrenFromFields
in interface FieldVector
public void loadFieldBuffers(ArrowFieldNode fieldNode, List<ArrowBuf> ownBuffers)
FieldVector
loadFieldBuffers
in interface FieldVector
fieldNode
- the fieldNodeownBuffers
- the buffers for this Field (own buffers only, children not included)public List<ArrowBuf> getFieldBuffers()
FieldVector
getFieldBuffers
in interface FieldVector
@Deprecated public List<BufferBacked> getFieldInnerVectors()
getFieldInnerVectors
in interface FieldVector
protected FieldReader getReaderImpl()
BaseValueVector
getReaderImpl
in class BaseValueVector
public UnionFixedSizeListReader getReader()
BaseValueVector
BaseValueVector.getReaderImpl()
to initialize the reader appropriately.getReader
in interface ValueVector
getReader
in class BaseValueVector
public void allocateNew() throws OutOfMemoryException
ValueVector
allocateNew
in interface ValueVector
OutOfMemoryException
- Thrown if no memory can be allocated.public boolean allocateNewSafe()
ValueVector
allocateNewSafe
in interface ValueVector
public void reAlloc()
ValueVector
reAlloc
in interface ValueVector
public FieldVector getDataVector()
public int startNewValue(int index)
index
- index of the value to startpublic UnionFixedSizeListWriter getWriter()
public void setInitialCapacity(int numRecords)
ValueVector
setInitialCapacity
in interface ValueVector
numRecords
- the initial record capacity.public int getValueCapacity()
ValueVector
getValueCapacity
in interface ValueVector
public int getBufferSize()
ValueVector
getBufferSize
in interface ValueVector
public int getBufferSizeFor(int valueCount)
ValueVector
getBufferSizeFor
in interface ValueVector
valueCount
- the number of values to assume this vector containspublic Iterator<ValueVector> iterator()
iterator
in interface Iterable<ValueVector>
iterator
in class BaseValueVector
public void clear()
ValueVector
clear
in interface ValueVector
clear
in class BaseValueVector
public void reset()
ValueVector
reset
in interface ValueVector
public ArrowBuf[] getBuffers(boolean clear)
ValueVector
getBuffers
in interface ValueVector
clear
- Whether to clear vector before returning; the buffers will still be refcounted;
but the returned array will be the only reference to thembuffers
that is used by this vector instance.public int size()
public <T extends ValueVector> AddOrGetResult<T> addOrGetVector(FieldType type)
addOrGetVector
in interface PromotableVector
public void copyFromSafe(int inIndex, int outIndex, ValueVector from)
ValueVector
ValueVector.copyFrom(int, int, ValueVector)
except that
it handles the case when the capacity of the vector needs to be expanded
before copy.copyFromSafe
in interface ValueVector
copyFromSafe
in class BaseValueVector
inIndex
- position to copy from in source vectoroutIndex
- position to copy to in this vectorfrom
- source vectorpublic void copyFrom(int fromIndex, int thisIndex, ValueVector from)
ValueVector
copyFrom
in interface ValueVector
copyFrom
in class BaseValueVector
fromIndex
- position to copy from in source vectorthisIndex
- position to copy to in this vectorfrom
- source vectorpublic UnionVector promoteToUnion()
promoteToUnion
in interface PromotableVector
public long getValidityBufferAddress()
FieldVector
getValidityBufferAddress
in interface FieldVector
public long getDataBufferAddress()
FieldVector
getDataBufferAddress
in interface FieldVector
public long getOffsetBufferAddress()
FieldVector
getOffsetBufferAddress
in interface FieldVector
public ArrowBuf getValidityBuffer()
ValueVector
getValidityBuffer
in interface ValueVector
public ArrowBuf getDataBuffer()
ValueVector
getDataBuffer
in interface ValueVector
public ArrowBuf getOffsetBuffer()
ValueVector
getOffsetBuffer
in interface ValueVector
public List<?> getObject(int index)
ValueVector
getObject
in interface ValueVector
index
- index of object to getpublic boolean isNull(int index)
isNull
in interface ValueVector
index
- index to check for nullpublic int isSet(int index)
public int getNullCount()
ValueVector
getNullCount
in interface ValueVector
public int getValueCount()
ValueVector
getValueCount
in interface ValueVector
public void setNull(int index)
setNull
in interface FieldVector
index
- the value to changepublic void setNotNull(int index)
public void setValueCount(int valueCount)
ValueVector
setValueCount
in interface ValueVector
public TransferPair getTransferPair(String ref, BufferAllocator allocator)
getTransferPair
in interface ValueVector
public TransferPair getTransferPair(String ref, BufferAllocator allocator, CallBack callBack)
getTransferPair
in interface ValueVector
public TransferPair makeTransferPair(ValueVector target)
ValueVector
makeTransferPair
in interface ValueVector
target
- the target for the transfertransfer pair
that is used to transfer underlying
buffers into the target vector.public int hashCode(int index)
ValueVector
hashCode
in interface ValueVector
public int hashCode(int index, ArrowBufHasher hasher)
ValueVector
hashCode
in interface ValueVector
public <OUT,IN> OUT accept(VectorVisitor<OUT,IN> visitor, IN value)
ValueVector
VectorVisitor
and return the result.accept
in interface ValueVector
OUT
- the output result type.IN
- the input data together with visitor.public int getElementStartIndex(int index)
BaseListVector
getElementStartIndex
in interface BaseListVector
public int getElementEndIndex(int index)
BaseListVector
getElementEndIndex
in interface BaseListVector
Copyright © 2023 The Apache Software Foundation. All rights reserved.