public class BitVector extends BaseFixedWidthVector
field, lastValueCapacity, validityBuffer, valueBuffer, valueCount
allocator, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY, name
Constructor and Description |
---|
BitVector(String name,
BufferAllocator allocator)
Instantiate a BitVector.
|
BitVector(String name,
FieldType fieldType,
BufferAllocator allocator)
Instantiate a BitVector.
|
Modifier and Type | Method and Description |
---|---|
void |
copyFrom(int fromIndex,
int thisIndex,
BitVector from)
Copy a cell value from a particular index in source vector to a particular
position in this vector.
|
void |
copyFromSafe(int fromIndex,
int thisIndex,
BitVector from)
Same as
copyFrom(int, int, BitVector) except that
it handles the case when the capacity of the vector needs to be expanded
before copy. |
int |
get(int index)
Get the element at the given index from the vector.
|
void |
get(int index,
NullableBitHolder holder)
Get the element at the given index from the vector and
sets the state in holder.
|
int |
getBufferSize()
Get the size (number of bytes) of underlying buffers used by this
vector
|
int |
getBufferSizeFor(int count)
Get the potential buffer size for a particular number of records.
|
Types.MinorType |
getMinorType()
Get minor type for this vector.
|
Boolean |
getObject(int index)
Same as
get(int) . |
FieldReader |
getReader()
Get a reader that supports reading values from this vector.
|
TransferPair |
getTransferPair(String ref,
BufferAllocator allocator)
Construct a TransferPair comprising of this and and a target vector of
the same type.
|
int |
getValueCapacity()
Get the current value capacity for the vector
|
TransferPair |
makeTransferPair(ValueVector to)
Construct a TransferPair with a desired target vector of the same type.
|
void |
set(int index,
BitHolder holder)
Set the element at the given index to the value set in data holder.
|
void |
set(int index,
int value)
Set the element at the given index to the given value.
|
void |
set(int index,
int isSet,
int value)
Store the given value at a particular position in the vector.
|
void |
set(int index,
NullableBitHolder holder)
Set the element at the given index to the value set in data holder.
|
void |
setInitialCapacity(int valueCount)
Sets the desired value capacity for the vector.
|
void |
setNull(int index)
Set the element at the given index to null.
|
void |
setRangeToOne(int firstBitIndex,
int count)
Set count bits to 1 in data starting at firstBitIndex.
|
void |
setSafe(int index,
BitHolder holder)
Same as
set(int, BitHolder) except that it handles the
case when index is greater than or equal to existing
value capacity getValueCapacity() . |
void |
setSafe(int index,
int value)
Same as
set(int, int) except that it handles the
case when index is greater than or equal to existing
value capacity getValueCapacity() . |
void |
setSafe(int index,
int isSet,
int value)
Same as
set(int, int, int) except that it handles the case
when index is greater than or equal to current value capacity of the
vector. |
void |
setSafe(int index,
NullableBitHolder holder)
Same as
set(int, NullableBitHolder) except that it handles the
case when index is greater than or equal to existing
value capacity getValueCapacity() . |
void |
setSafeToOne(int index)
Same as
setToOne(int) except that it handles the case when
index is greater than or equal to current value capacity of the vector. |
void |
setToOne(int index)
Set the element at the given index to one.
|
void |
splitAndTransferTo(int startIndex,
int length,
BaseFixedWidthVector target)
Slice this vector at desired index and length and transfer the
corresponding data to the target vector.
|
allocateNew, allocateNew, allocateNewSafe, clear, close, decrementAllocationMonitor, getBuffers, getChildrenFromFields, getDataBuffer, getDataBufferAddress, getField, getFieldBuffers, getFieldInnerVectors, getNullCount, getOffsetBuffer, getOffsetBufferAddress, getTransferPair, getTransferPair, getValidityBuffer, getValidityBufferAddress, getValueCount, handleSafe, incrementAllocationMonitor, initializeChildrenFromFields, isNull, isSafe, isSet, loadFieldBuffers, reAlloc, reset, set, set, setIndexDefined, setSafe, setSafe, setValueCount, transferTo, zeroVector
checkBufRefs, getAllocator, getValidityBufferSizeFromCount, iterator, releaseBuffer, toString, transferBuffer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAllocator
forEach, iterator, spliterator
public BitVector(String name, BufferAllocator allocator)
name
- name of the vectorallocator
- allocator for memory management.public BitVector(String name, FieldType fieldType, BufferAllocator allocator)
name
- name of the vectorfieldType
- type of Field materialized by this vectorallocator
- allocator for memory management.public FieldReader getReader()
public Types.MinorType getMinorType()
Types.MinorType
public void setInitialCapacity(int valueCount)
setInitialCapacity
in interface ValueVector
setInitialCapacity
in class BaseFixedWidthVector
valueCount
- desired number of elements in the vectorpublic int getValueCapacity()
getValueCapacity
in interface ValueVector
getValueCapacity
in class BaseFixedWidthVector
public int getBufferSizeFor(int count)
getBufferSizeFor
in interface ValueVector
getBufferSizeFor
in class BaseFixedWidthVector
count
- desired number of elements in the vectorpublic int getBufferSize()
getBufferSize
in interface ValueVector
getBufferSize
in class BaseFixedWidthVector
public void splitAndTransferTo(int startIndex, int length, BaseFixedWidthVector target)
splitAndTransferTo
in class BaseFixedWidthVector
startIndex
- start position of the split in source vector.length
- length of the split.target
- destination vectorpublic int get(int index) throws IllegalStateException
index
- position of elementIllegalStateException
public void get(int index, NullableBitHolder holder)
index
- position of elementpublic Boolean getObject(int index)
get(int)
.index
- position of elementpublic void copyFrom(int fromIndex, int thisIndex, BitVector from)
fromIndex
- position to copy from in source vectorthisIndex
- position to copy to in this vectorfrom
- source vectorpublic void copyFromSafe(int fromIndex, int thisIndex, BitVector from)
copyFrom(int, int, BitVector)
except that
it handles the case when the capacity of the vector needs to be expanded
before copy.fromIndex
- position to copy from in source vectorthisIndex
- position to copy to in this vectorfrom
- source vectorpublic void set(int index, int value)
index
- position of elementvalue
- value of elementpublic void set(int index, NullableBitHolder holder) throws IllegalArgumentException
index
- position of elementholder
- nullable data holder for value of elementIllegalArgumentException
public void set(int index, BitHolder holder)
index
- position of elementholder
- data holder for value of elementpublic void setSafe(int index, int value)
set(int, int)
except that it handles the
case when index is greater than or equal to existing
value capacity getValueCapacity()
.index
- position of elementvalue
- value of elementpublic void setSafe(int index, NullableBitHolder holder) throws IllegalArgumentException
set(int, NullableBitHolder)
except that it handles the
case when index is greater than or equal to existing
value capacity getValueCapacity()
.index
- position of elementholder
- nullable data holder for value of elementIllegalArgumentException
public void setSafe(int index, BitHolder holder)
set(int, BitHolder)
except that it handles the
case when index is greater than or equal to existing
value capacity getValueCapacity()
.index
- position of elementholder
- data holder for value of elementpublic void setNull(int index)
index
- position of elementpublic void set(int index, int isSet, int value)
index
- position of the new valueisSet
- 0 for NULL value, 1 otherwisevalue
- element valuepublic void setSafe(int index, int isSet, int value)
set(int, int, int)
except that it handles the case
when index is greater than or equal to current value capacity of the
vector.index
- position of the new valueisSet
- 0 for NULL value, 1 otherwisevalue
- element valuepublic void setToOne(int index)
index
- position of elementpublic void setSafeToOne(int index)
setToOne(int)
except that it handles the case when
index is greater than or equal to current value capacity of the vector.index
- position of the elementpublic void setRangeToOne(int firstBitIndex, int count)
firstBitIndex
- the index of the first bit to setcount
- the number of bits to setpublic 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 makeTransferPair(ValueVector to)
to
- target vectorTransferPair
Copyright © 2019 The Apache Software Foundation. All rights reserved.