public final class DecimalVector extends BaseFixedWidthVector
Modifier and Type | Field and Description |
---|---|
static int |
MAX_PRECISION |
static byte |
TYPE_WIDTH |
actualValueCapacity, field, lastValueCapacity, validityBuffer, valueBuffer, valueCount
allocator, fieldReader, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY
Constructor and Description |
---|
DecimalVector(Field field,
BufferAllocator allocator)
Instantiate a DecimalVector.
|
DecimalVector(String name,
BufferAllocator allocator,
int precision,
int scale)
Instantiate a DecimalVector.
|
DecimalVector(String name,
FieldType fieldType,
BufferAllocator allocator)
Instantiate a DecimalVector.
|
Modifier and Type | Method and Description |
---|---|
ArrowBuf |
get(int index)
Get the element at the given index from the vector.
|
void |
get(int index,
NullableDecimalHolder holder)
Get the element at the given index from the vector and
sets the state in holder.
|
Types.MinorType |
getMinorType()
Get minor type for this vector.
|
BigDecimal |
getObject(int index)
Same as
get(int) . |
int |
getPrecision()
Return precision for the decimal value.
|
protected FieldReader |
getReaderImpl()
Each vector has a different reader that implements the FieldReader interface.
|
int |
getScale()
Return scale for the decimal value.
|
TransferPair |
getTransferPair(Field field,
BufferAllocator allocator)
Construct a TransferPair comprising this and a target vector of
the same type.
|
TransferPair |
getTransferPair(String ref,
BufferAllocator allocator)
Construct a TransferPair comprising this and a target vector of
the same type.
|
TransferPair |
makeTransferPair(ValueVector to)
Construct a TransferPair with a desired target vector of the same type.
|
void |
set(int index,
ArrowBuf buffer)
Set the element at the given index to the given value.
|
void |
set(int index,
BigDecimal value)
Set the element at the given index to the given value.
|
void |
set(int index,
DecimalHolder holder)
Set the element at the given index to the value set in data holder.
|
void |
set(int index,
int isSet,
long start,
ArrowBuf buffer)
Store the given value at a particular position in the vector.
|
void |
set(int index,
long value)
Set the element at the given index to the given value.
|
void |
set(int index,
long start,
ArrowBuf buffer)
Set the element at the given index to the given value.
|
void |
set(int index,
NullableDecimalHolder holder)
Set the element at the given index to the value set in data holder.
|
void |
setBigEndian(int index,
byte[] value)
Set the decimal element at given index to the provided array of bytes.
|
void |
setBigEndianSafe(int index,
byte[] value)
Same as
setBigEndian(int, byte[]) except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity() . |
void |
setBigEndianSafe(int index,
long start,
ArrowBuf buffer,
int length)
Sets the element at given index using the buffer whose size maybe <= 16 bytes.
|
void |
setSafe(int index,
ArrowBuf buffer)
Same as
set(int, ArrowBuf) except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity() . |
void |
setSafe(int index,
BigDecimal value)
Same as
set(int, BigDecimal) except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity() . |
void |
setSafe(int index,
DecimalHolder holder)
Same as
set(int, DecimalHolder) except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity() . |
void |
setSafe(int index,
int isSet,
long start,
ArrowBuf buffer)
Same as
set(int, int, long, ArrowBuf) except that it handles
the case when the position of new value is beyond the current value
capacity of the vector. |
void |
setSafe(int index,
long value)
Same as
set(int, long) except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity() . |
void |
setSafe(int index,
long start,
ArrowBuf buffer)
Same as
set(int, long, ArrowBuf) except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity() . |
void |
setSafe(int index,
long start,
ArrowBuf buffer,
int length)
Sets the element at given index using the buffer whose size maybe <= 16 bytes.
|
void |
setSafe(int index,
NullableDecimalHolder holder)
Same as
set(int, NullableDecimalHolder) except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity() . |
accept, allocateNew, allocateNew, allocateNewSafe, clear, close, copyFrom, copyFromSafe, decrementAllocationMonitor, getBuffers, getBufferSize, getBufferSizeFor, getChildrenFromFields, getDataBuffer, getDataBufferAddress, getDataPointer, getDataPointer, getField, getFieldBuffers, getFieldInnerVectors, getName, getNullCount, getOffsetBuffer, getOffsetBufferAddress, getTransferPair, getTransferPair, getTypeWidth, getValidityBuffer, getValidityBufferAddress, getValidityBufferValueCapacity, getValueBufferValueCapacity, getValueCapacity, getValueCount, handleSafe, hashCode, hashCode, incrementAllocationMonitor, initializeChildrenFromFields, isNull, isSafe, isSet, loadFieldBuffers, reAlloc, refreshValueCapacity, reset, set, set, setIndexDefined, setInitialCapacity, setNull, setSafe, setSafe, setValueCount, splitAndTransferTo, transferTo, zeroVector
checkBufRefs, getAllocator, getReader, getValidityBufferSizeFromCount, iterator, releaseBuffer, toString, transferBuffer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAllocator, getReader
forEach, iterator, spliterator
public static final int MAX_PRECISION
public static final byte TYPE_WIDTH
public DecimalVector(String name, BufferAllocator allocator, int precision, int scale)
name
- name of the vectorallocator
- allocator for memory management.public DecimalVector(String name, FieldType fieldType, BufferAllocator allocator)
name
- name of the vectorfieldType
- type of Field materialized by this vectorallocator
- allocator for memory management.public DecimalVector(Field field, BufferAllocator allocator)
field
- field materialized by this vectorallocator
- allocator for memory management.protected FieldReader getReaderImpl()
BaseValueVector
getReaderImpl
in class BaseValueVector
public Types.MinorType getMinorType()
Types.MinorType
public ArrowBuf get(int index) throws IllegalStateException
index
- position of elementIllegalStateException
public void get(int index, NullableDecimalHolder holder)
index
- position of elementpublic BigDecimal getObject(int index)
get(int)
.index
- position of elementpublic int getPrecision()
public int getScale()
public void set(int index, ArrowBuf buffer)
index
- position of elementbuffer
- ArrowBuf containing decimal value.public void setBigEndian(int index, byte[] value)
Consumers of Arrow code can use this API instead of first swapping the source bytes (doing a write and read) and then finally writing to ArrowBuf of decimal vector.
This method takes care of adding the necessary padding if the length of byte array is less then 16 (length of decimal type).
index
- position of elementvalue
- array of bytes containing decimal in big endian byte order.public void set(int index, long start, ArrowBuf buffer)
index
- position of elementstart
- start index of data in the bufferbuffer
- ArrowBuf containing decimal value.public void setSafe(int index, long start, ArrowBuf buffer, int length)
index
- index to write the decimal tostart
- start of value in the bufferbuffer
- contains the decimal in native endian byteslength
- length of the value in the bufferpublic void setBigEndianSafe(int index, long start, ArrowBuf buffer, int length)
index
- index to write the decimal tostart
- start of value in the bufferbuffer
- contains the decimal in big endian byteslength
- length of the value in the bufferpublic void set(int index, BigDecimal value)
index
- position of elementvalue
- BigDecimal containing decimal value.public void set(int index, long value)
index
- position of elementvalue
- long value.public void set(int index, NullableDecimalHolder holder) throws IllegalArgumentException
index
- position of elementholder
- nullable data holder for value of elementIllegalArgumentException
public void set(int index, DecimalHolder holder)
index
- position of elementholder
- data holder for value of elementpublic void setSafe(int index, ArrowBuf buffer)
set(int, ArrowBuf)
except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity()
.index
- position of elementbuffer
- ArrowBuf containing decimal value.public void setBigEndianSafe(int index, byte[] value)
setBigEndian(int, byte[])
except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity()
.public void setSafe(int index, long start, ArrowBuf buffer)
set(int, long, ArrowBuf)
except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity()
.index
- position of elementstart
- start index of data in the bufferbuffer
- ArrowBuf containing decimal value.public void setSafe(int index, BigDecimal value)
set(int, BigDecimal)
except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity()
.index
- position of elementvalue
- BigDecimal containing decimal value.public void setSafe(int index, long value)
set(int, long)
except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity()
.index
- position of elementvalue
- long value.public void setSafe(int index, NullableDecimalHolder holder) throws IllegalArgumentException
set(int, NullableDecimalHolder)
except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity()
.index
- position of elementholder
- nullable data holder for value of elementIllegalArgumentException
public void setSafe(int index, DecimalHolder holder)
set(int, DecimalHolder)
except that it handles the
case when index is greater than or equal to existing
value capacity BaseFixedWidthVector.getValueCapacity()
.index
- position of elementholder
- data holder for value of elementpublic void set(int index, int isSet, long start, ArrowBuf buffer)
index
- position of the new valueisSet
- 0 for NULL value, 1 otherwisestart
- start position of the value in the bufferbuffer
- buffer containing the value to be stored in the vectorpublic void setSafe(int index, int isSet, long start, ArrowBuf buffer)
set(int, int, long, ArrowBuf)
except that it handles
the case when the position of new value is beyond the current value
capacity of the vector.index
- position of the new valueisSet
- 0 for NULL value, 1 otherwisestart
- start position of the value in the bufferbuffer
- buffer containing the value to be stored in the vectorpublic TransferPair getTransferPair(String ref, BufferAllocator allocator)
getTransferPair
in interface ValueVector
getTransferPair
in class BaseFixedWidthVector
ref
- name of the target vectorallocator
- allocator for the target vectorTransferPair
public TransferPair getTransferPair(Field field, BufferAllocator allocator)
getTransferPair
in class BaseFixedWidthVector
field
- Field object used by the target vectorallocator
- allocator for the target vectorTransferPair
public TransferPair makeTransferPair(ValueVector to)
to
- target vectorTransferPair
Copyright © 2023 The Apache Software Foundation. All rights reserved.