java.lang.Object
org.apache.arrow.vector.BaseValueVector
org.apache.arrow.vector.BaseVariableWidthVector
org.apache.arrow.vector.VarCharVector
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<ValueVector>
,DensityAwareVector
,ElementAddressableVector
,FieldVector
,ValueIterableVector<Text>
,ValueVector
,VariableWidthFieldVector
,VariableWidthVector
,VectorDefinitionSetter
public final class VarCharVector
extends BaseVariableWidthVector
implements ValueIterableVector<Text>
VarCharVector implements a variable width vector of VARCHAR values which could be NULL. A
validity buffer (bit vector) is maintained to track which elements in the vector are null.
-
Field Summary
Fields inherited from class org.apache.arrow.vector.BaseVariableWidthVector
emptyByteArray, field, lastSet, OFFSET_WIDTH, offsetBuffer, validityBuffer, valueBuffer, valueCount
Fields inherited from class org.apache.arrow.vector.BaseValueVector
allocator, fieldReader, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY
-
Constructor Summary
ConstructorDescriptionVarCharVector
(String name, BufferAllocator allocator) Instantiate a VarCharVector.VarCharVector
(String name, FieldType fieldType, BufferAllocator allocator) Instantiate a VarCharVector.VarCharVector
(Field field, BufferAllocator allocator) Instantiate a VarCharVector. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
get
(int index) Get the variable length element at specified index as byte array.void
get
(int index, NullableVarCharHolder holder) Get the variable length element at specified index and sets the state in provided holder.Get minor type for this vector.getObject
(int index) Get the variable length element at specified index as Text.protected FieldReader
Each vector has a different reader that implements the FieldReader interface.getTransferPair
(String ref, BufferAllocator allocator) Construct a TransferPair comprising of this and a target vector of the same type.getTransferPair
(Field field, BufferAllocator allocator) Construct a transfer pair of this vector and another vector of same type.Construct a TransferPair with a desired target vector of the same type.void
read
(int index, ReusableBuffer<?> buffer) Read the value at the given position to the given output buffer.void
set
(int index, NullableVarCharHolder holder) Set the variable length element at the specified index to the data buffer supplied in the holder.void
set
(int index, VarCharHolder holder) Set the variable length element at the specified index to the data buffer supplied in the holder.void
Set the variable length element at the specified index to the content in supplied Text.void
setSafe
(int index, NullableVarCharHolder holder) Same asset(int, NullableVarCharHolder)
except that it handles the case where index and length of new element are beyond the existing capacity of the vector.void
setSafe
(int index, VarCharHolder holder) Same asset(int, VarCharHolder)
except that it handles the case where index and length of new element are beyond the existing capacity of the vector.void
Same asset(int, NullableVarCharHolder)
except that it handles the case where index and length of new element are beyond the existing capacity of the vector.void
Validate the scalar values held by this vector.Methods inherited from class org.apache.arrow.vector.BaseVariableWidthVector
accept, allocateNew, allocateNew, allocateNew, allocateNewSafe, clear, close, copyFrom, copyFromSafe, exportCDataBuffers, fillEmpties, fillHoles, get, getBuffers, getBufferSize, getBufferSizeFor, getByteCapacity, getChildrenFromFields, getDataBuffer, getDataBufferAddress, getDataPointer, getDataPointer, getDensity, getEndOffset, getField, getFieldBuffers, getFieldInnerVectors, getLastSet, getName, getNullCount, getOffsetBuffer, getOffsetBufferAddress, getStartEnd, getStartOffset, getTransferPair, getTransferPair, getTransferPair, getValidityBuffer, getValidityBufferAddress, getValueCapacity, getValueCount, getValueLength, handleSafe, hashCode, hashCode, initializeChildrenFromFields, isNull, isSafe, isSet, loadFieldBuffers, reAlloc, reallocDataBuffer, reallocDataBuffer, reallocValidityAndOffsetBuffers, reset, set, set, set, set, set, set, setBytes, setIndexDefined, setInitialCapacity, setInitialCapacity, setLastSet, setNull, setSafe, setSafe, setSafe, setSafe, setSafe, setValueCount, setValueLengthSafe, sizeOfValueBuffer, splitAndTransferTo, transferTo, zeroVector
Methods inherited from class org.apache.arrow.vector.BaseValueVector
checkBufRefs, getAllocator, getReader, getValidityBufferSizeFromCount, iterator, releaseBuffer, toString, transferBuffer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.arrow.vector.FieldVector
exportBuffer, getExportedCDataBufferCount
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface org.apache.arrow.vector.ValueIterableVector
getValueIterable, getValueIterator
Methods inherited from interface org.apache.arrow.vector.ValueVector
accept, allocateNew, allocateNewSafe, clear, close, copyFrom, copyFromSafe, getAllocator, getBuffers, getBufferSize, getBufferSizeFor, getDataBuffer, getField, getName, getNullCount, getOffsetBuffer, getReader, getTransferPair, getTransferPair, getTransferPair, getValidityBuffer, getValueCapacity, getValueCount, hashCode, hashCode, isNull, reAlloc, reset, setInitialCapacity, setValueCount, validate, validateFull
-
Constructor Details
-
VarCharVector
Instantiate a VarCharVector. This doesn't allocate any memory for the data in vector.- Parameters:
name
- name of the vectorallocator
- allocator for memory management.
-
VarCharVector
Instantiate a VarCharVector. This doesn't allocate any memory for the data in vector.- Parameters:
name
- name of the vectorfieldType
- type of Field materialized by this vectorallocator
- allocator for memory management.
-
VarCharVector
Instantiate a VarCharVector. This doesn't allocate any memory for the data in vector.- Parameters:
field
- field materialized by this vectorallocator
- allocator for memory management.
-
-
Method Details
-
getReaderImpl
Description copied from class:BaseValueVector
Each vector has a different reader that implements the FieldReader interface. Overridden methods must make sure to return the correct concrete reader implementation.- Specified by:
getReaderImpl
in classBaseValueVector
- Returns:
- Returns a lambda that initializes a reader when called.
-
getMinorType
Get minor type for this vector. The vector holds values belonging to a particular type.- Specified by:
getMinorType
in interfaceValueVector
- Returns:
Types.MinorType
-
get
public byte[] get(int index) Get the variable length element at specified index as byte array.- Specified by:
get
in interfaceVariableWidthFieldVector
- Parameters:
index
- position of element to get- Returns:
- array of bytes for non-null element, null otherwise
-
getObject
Get the variable length element at specified index as Text.- Specified by:
getObject
in interfaceValueVector
- Parameters:
index
- position of element to get- Returns:
- Text object for non-null element, null otherwise
-
read
Read the value at the given position to the given output buffer. The caller is responsible for checking for nullity first.- Specified by:
read
in interfaceVariableWidthFieldVector
- Parameters:
index
- position of element.buffer
- the buffer to write into.
-
get
Get the variable length element at specified index and sets the state in provided holder.- Parameters:
index
- position of element to getholder
- data holder to be populated by this function
-
set
Set the variable length element at the specified index to the data buffer supplied in the holder.- Parameters:
index
- position of the element to setholder
- holder that carries data buffer.
-
setSafe
Same asset(int, VarCharHolder)
except that it handles the case where index and length of new element are beyond the existing capacity of the vector.- Parameters:
index
- position of the element to setholder
- holder that carries data buffer.
-
set
Set the variable length element at the specified index to the data buffer supplied in the holder.- Parameters:
index
- position of the element to setholder
- holder that carries data buffer.
-
setSafe
Same asset(int, NullableVarCharHolder)
except that it handles the case where index and length of new element are beyond the existing capacity of the vector.- Parameters:
index
- position of the element to setholder
- holder that carries data buffer.
-
set
Set the variable length element at the specified index to the content in supplied Text.- Parameters:
index
- position of the element to settext
- Text object with data
-
setSafe
Same asset(int, NullableVarCharHolder)
except that it handles the case where index and length of new element are beyond the existing capacity of the vector.- Parameters:
index
- position of the element to set.text
- Text object with data
-
validateScalars
public void validateScalars()Description copied from class:BaseVariableWidthVector
Validate the scalar values held by this vector.- Overrides:
validateScalars
in classBaseVariableWidthVector
-
getTransferPair
Construct a TransferPair comprising of this and a target vector of the same type.- Specified by:
getTransferPair
in interfaceValueVector
- Specified by:
getTransferPair
in classBaseVariableWidthVector
- Parameters:
ref
- name of the target vectorallocator
- allocator for the target vector- Returns:
TransferPair
-
getTransferPair
Description copied from class:BaseVariableWidthVector
Construct a transfer pair of this vector and another vector of same type.- Specified by:
getTransferPair
in interfaceValueVector
- Specified by:
getTransferPair
in classBaseVariableWidthVector
- Parameters:
field
- The field materialized by this vector.allocator
- allocator for the target vector- Returns:
- TransferPair
-
makeTransferPair
Construct a TransferPair with a desired target vector of the same type.- Specified by:
makeTransferPair
in interfaceValueVector
- Parameters:
to
- target vector- Returns:
TransferPair
-