T
- The wrapped vector type.public abstract class ExtensionTypeVector<T extends ValueVector & FieldVector> extends BaseValueVector implements FieldVector
allocator, fieldReader, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY
Constructor and Description |
---|
ExtensionTypeVector(Field field,
BufferAllocator allocator,
T underlyingVector)
Instantiate an extension type vector.
|
ExtensionTypeVector(String name,
BufferAllocator allocator,
T underlyingVector)
Instantiate an extension type vector.
|
Modifier and Type | Method and Description |
---|---|
<OUT,IN> OUT |
accept(VectorVisitor<OUT,IN> visitor,
IN value)
Accept a generic
VectorVisitor and return the result. |
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 |
close()
Alternative to clear().
|
BufferAllocator |
getAllocator() |
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.
|
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.
|
Types.MinorType |
getMinorType() |
String |
getName()
Gets the name of the vector.
|
int |
getNullCount()
Returns number of null elements in the vector.
|
abstract Object |
getObject(int index)
Get the extension object at the specified index.
|
ArrowBuf |
getOffsetBuffer()
Gets the underlying buffer associated with offset vector.
|
long |
getOffsetBufferAddress()
Gets the starting address of the underlying buffer associated with offset vector.
|
protected FieldReader |
getReaderImpl()
Each vector has a different reader that implements the FieldReader interface.
|
TransferPair |
getTransferPair(BufferAllocator allocator)
To transfer quota responsibility.
|
TransferPair |
getTransferPair(String ref,
BufferAllocator allocator) |
TransferPair |
getTransferPair(String ref,
BufferAllocator allocator,
CallBack callBack) |
T |
getUnderlyingVector()
Get the underlying vector.
|
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.
|
void |
initializeChildrenFromFields(List<Field> children)
Initializes the child vectors
to be later loaded with loadBuffers.
|
boolean |
isNull(int index)
Check whether an element in the vector is 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.
|
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 |
setNull(int index)
Set the element at the given index to null.
|
void |
setValueCount(int valueCount)
Set number of values in the vector.
|
checkBufRefs, copyFrom, copyFromSafe, getReader, getValidityBufferSizeFromCount, releaseBuffer, toString, transferBuffer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
copyFrom, copyFromSafe, getReader, hashCode, hashCode, validate, validateFull
forEach, spliterator
public ExtensionTypeVector(String name, BufferAllocator allocator, T underlyingVector)
name
- name of the vectorallocator
- allocator for memory managementunderlyingVector
- underlying filed vectorpublic ExtensionTypeVector(Field field, BufferAllocator allocator, T underlyingVector)
field
- field materialized by this vector.allocator
- allocator for memory managementunderlyingVector
- underlying filed vectorpublic String getName()
ValueVector
getName
in interface ValueVector
getName
in class BaseValueVector
public T getUnderlyingVector()
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 void setInitialCapacity(int numRecords)
ValueVector
setInitialCapacity
in interface ValueVector
numRecords
- the initial record capacity.public int getValueCapacity()
ValueVector
getValueCapacity
in interface ValueVector
public void reset()
ValueVector
reset
in interface ValueVector
public Field getField()
ValueVector
getField
in interface ValueVector
public Types.MinorType getMinorType()
getMinorType
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.protected FieldReader getReaderImpl()
BaseValueVector
getReaderImpl
in class BaseValueVector
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 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 ArrowBuf getValidityBuffer()
ValueVector
getValidityBuffer
in interface ValueVector
public ArrowBuf getDataBuffer()
ValueVector
getDataBuffer
in interface ValueVector
public ArrowBuf getOffsetBuffer()
ValueVector
getOffsetBuffer
in interface ValueVector
public int getValueCount()
ValueVector
getValueCount
in interface ValueVector
public void setValueCount(int valueCount)
ValueVector
setValueCount
in interface ValueVector
public abstract Object getObject(int index)
Generally, this should access the underlying vector and construct the corresponding Java object from the raw data.
getObject
in interface ValueVector
index
- index of object to getpublic int getNullCount()
ValueVector
getNullCount
in interface ValueVector
public boolean isNull(int index)
ValueVector
isNull
in interface ValueVector
index
- index to check for nullpublic void setNull(int index)
FieldVector
setNull
in interface FieldVector
index
- the value to changepublic 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
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 void clear()
ValueVector
clear
in interface ValueVector
clear
in class BaseValueVector
public void close()
ValueVector
close
in interface Closeable
close
in interface AutoCloseable
close
in interface ValueVector
close
in class BaseValueVector
public TransferPair getTransferPair(BufferAllocator allocator)
ValueVector
getTransferPair
in interface ValueVector
getTransferPair
in class BaseValueVector
allocator
- the target allocatortransfer pair
, creating a new target vector of
the same type.public Iterator<ValueVector> iterator()
iterator
in interface Iterable<ValueVector>
iterator
in class BaseValueVector
public BufferAllocator getAllocator()
getAllocator
in interface ValueVector
getAllocator
in class BaseValueVector
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.Copyright © 2023 The Apache Software Foundation. All rights reserved.