public final class VarDecimalVector.Mutator extends BaseValueVector.BaseMutator implements VariableWidthVector.VariableWidthMutator
MutableVarDecimal implements a vector of variable width values. Elements in the vector are accessed by position from the logical start of the vector. A fixed width offsetVector is used to convert an element's position to it's offset from the start of the (0-based) DrillBuf. Size is inferred by adjacent elements. The width of each element is 4 byte(s) The equivalent Java primitive is 'int' NB: this class is automatically generated from ValueVectorTypes.tdd using FreeMarker.
VariableWidthVector
s do not support random writes. In contrast FixedWidthVector
s do
allow random writes but special care is needed.
setValueCount(int)
.
It is possible to trim the vector by setting the value count to be less than the number of values currently contained in the vector. Note the extra memory consumed in
the data buffer is not freed when this is done.
IndexOutOfBoundsException
.
set(int, byte[])
methods. If you do not
manually allocate sufficient memory an IndexOutOfBoundsException
can be thrown when the data buffer runs out of space.
setSafe(int, byte[])
methods, which will automatically grow your data buffer to
fit your data.
setValueCount(int)
has been called, it should be considered immutable.
Constructor and Description |
---|
Mutator() |
Modifier and Type | Method and Description |
---|---|
void |
fillEmpties(int lastWrite,
int index)
Backfill missing offsets from the given last written position up to, but
not including the given current write position.
|
void |
generateTestData(int size) |
void |
set(int index,
BigDecimal value) |
protected void |
set(int index,
byte[] bytes)
Set the variable length element at the specified index to the supplied byte array.
|
protected void |
set(int index,
byte[] bytes,
int start,
int length)
Set the variable length element at the specified index to the supplied byte array.
|
protected void |
set(int index,
int start,
int length,
DrillBuf buffer) |
protected void |
set(int index,
NullableVarDecimalHolder holder) |
protected void |
set(int index,
VarDecimalHolder holder) |
void |
setSafe(int index,
BigDecimal value) |
void |
setSafe(int index,
byte[] bytes) |
void |
setSafe(int index,
byte[] bytes,
int start,
int length) |
void |
setSafe(int index,
ByteBuffer bytes,
int start,
int length) |
void |
setSafe(int index,
int start,
int end,
DrillBuf buffer) |
void |
setSafe(int index,
NullableVarDecimalHolder holder) |
void |
setSafe(int index,
VarDecimalHolder holder) |
<T extends VarLenBulkEntry> |
setSafe(VarLenBulkInput<T> input)
Copies the bulk input into this value vector and extends its capacity if necessary.
|
<T extends VarLenBulkEntry> |
setSafe(VarLenBulkInput<T> input,
VarLenBulkInput.BulkInputCallback<T> callback)
Copies the bulk input into this value vector and extends its capacity if necessary.
|
void |
setValueCount(int valueCount)
Notes on Usage
|
void |
setValueLengthSafe(int index,
int length) |
exchange, reset
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exchange, reset
protected void set(int index, byte[] bytes)
index
- position of the bit to setbytes
- array of bytes to writepublic void setSafe(int index, byte[] bytes)
public <T extends VarLenBulkEntry> void setSafe(VarLenBulkInput<T> input)
input
- bulk inputpublic <T extends VarLenBulkEntry> void setSafe(VarLenBulkInput<T> input, VarLenBulkInput.BulkInputCallback<T> callback)
input
- bulk inputcallback
- a bulk input callback object (optional)protected void set(int index, byte[] bytes, int start, int length)
index
- position of the bit to setbytes
- array of bytes to writestart
- start index of bytes to writelength
- length of bytes to writepublic void setSafe(int index, ByteBuffer bytes, int start, int length)
public void setSafe(int index, byte[] bytes, int start, int length)
public void setValueLengthSafe(int index, int length)
setValueLengthSafe
in interface VariableWidthVector.VariableWidthMutator
public void setSafe(int index, int start, int end, DrillBuf buffer)
public void setSafe(int index, NullableVarDecimalHolder holder)
public void set(int index, BigDecimal value)
public void setSafe(int index, BigDecimal value)
public void setSafe(int index, VarDecimalHolder holder)
public void fillEmpties(int lastWrite, int index)
lastWrite
- the position of the last valid write: the offset to be copied
forwardindex
- the current write position filling occurs up to, but not
including, this positionprotected void set(int index, int start, int length, DrillBuf buffer)
protected void set(int index, NullableVarDecimalHolder holder)
protected void set(int index, VarDecimalHolder holder)
public void setValueCount(int valueCount)
For VariableWidthVector
s this method can be used in the following
cases:
It is important to note that for
FixedWidthVector
s this method can
also be used to expand the vector. However, VariableWidthVector
do not support this usage and this method will throw an
IndexOutOfBoundsException
if you attempt to use it in this way.
Expansion of valueCounts is not supported mainly because there is no
benefit, since you would still have to rely on the setSafe methods to
appropriately expand the data buffer and populate the vector anyway
(since by definition we do not know the width of elements). See
DRILL-6234 for details.
setValueCount
in interface ValueVector.Mutator
valueCount
- value count to set.public void generateTestData(int size)
generateTestData
in interface ValueVector.Mutator
generateTestData
in class BaseValueVector.BaseMutator
Copyright © 1970 The Apache Software Foundation. All rights reserved.