public class UnionVector extends Object implements ValueVector
Modifier and Type | Class and Description |
---|---|
class |
UnionVector.Accessor |
class |
UnionVector.Mutator |
Modifier and Type | Field and Description |
---|---|
static String |
INTERNAL_MAP_NAME |
static int |
NULL_MARKER |
static int |
TYPE_COUNT |
static String |
TYPE_VECTOR_NAME |
static TypeProtos.MajorType[] |
TYPES |
BITS_VECTOR_NAME, MAX_BUFFER_SIZE, MAX_ROW_COUNT, MIN_ROW_COUNT, OFFSETS_VECTOR_NAME, VALUES_VECTOR_NAME
Constructor and Description |
---|
UnionVector(MaterializedField field,
BufferAllocator allocator,
CallBack callBack) |
Modifier and Type | Method and Description |
---|---|
void |
addSubType(TypeProtos.MinorType type) |
void |
addType(ValueVector vector)
Add an externally-created subtype vector.
|
ValueVector |
addVector(ValueVector v)
Add a vector that matches the argument.
|
void |
allocateNew()
Allocate new buffers.
|
void |
allocateNew(int rowCount) |
boolean |
allocateNewSafe()
Allocates new buffers.
|
void |
clear()
Release the underlying DrillBuf and reset the ValueVector to empty.
|
void |
close()
Alternative to clear().
|
void |
collectLedgers(Set<AllocationManager.BufferLedger> ledgers)
Add the ledgers underlying the buffers underlying the components of the
vector to the set provided.
|
void |
copyEntry(int toIndex,
ValueVector from,
int fromIndex) |
void |
copyFrom(int inIndex,
int outIndex,
UnionVector from) |
void |
copyFromSafe(int inIndex,
int outIndex,
UnionVector from) |
void |
exchange(ValueVector other)
Exchange state with another value vector of the same type.
|
UnionVector.Accessor |
getAccessor()
Returns an
accessor that is used to read from this vector
instance. |
int |
getAllocatedSize()
Returns the total size of buffers allocated by this vector.
|
BufferAllocator |
getAllocator() |
NullableBigIntVector |
getBigIntVector() |
NullableBitVector |
getBitVector() |
DrillBuf[] |
getBuffers(boolean clear)
Return the underlying buffers associated with this vector.
|
int |
getBufferSize()
Returns the number of bytes that is used by this vector instance.
|
int |
getBufferSizeFor(int valueCount)
Returns the number of bytes that is used by this vector if it holds the given number
of values.
|
NullableDateVector |
getDateVector() |
DictVector |
getDict() |
MaterializedField |
getField()
Get information about how this field is materialized.
|
NullableFloat4Vector |
getFloat4Vector() |
NullableFloat8Vector |
getFloat8Vector() |
NullableIntervalDayVector |
getIntervalDayVector() |
NullableIntervalVector |
getIntervalVector() |
NullableIntervalYearVector |
getIntervalYearVector() |
NullableIntVector |
getIntVector() |
ListVector |
getList() |
MapVector |
getMap() |
ValueVector |
getMember(TypeProtos.MinorType type)
Add or get a type member given the type.
|
UserBitShared.SerializedField |
getMetadata()
Get the metadata for this field.
|
UnionVector.Mutator |
getMutator()
Returns an
mutator that is used to write to this vector
instance. |
int |
getPayloadByteCount(int valueCount)
Return the number of value bytes consumed by actual data.
|
FieldReader |
getReader()
Returns a
field reader that supports reading values
from this vector. |
NullableSmallIntVector |
getSmallIntVector() |
List<TypeProtos.MinorType> |
getSubTypes() |
NullableTimeStampVector |
getTimeStampVector() |
NullableTimeVector |
getTimeVector() |
NullableTinyIntVector |
getTinyIntVector() |
TransferPair |
getTransferPair(BufferAllocator allocator)
Returns a
transfer pair , creating a new target vector of
the same type. |
TransferPair |
getTransferPair(String ref,
BufferAllocator allocator) |
MapVector |
getTypeMap() |
int |
getTypeValue(int index) |
UInt1Vector |
getTypeVector() |
NullableUInt1Vector |
getUInt1Vector() |
NullableUInt2Vector |
getUInt2Vector() |
NullableUInt4Vector |
getUInt4Vector() |
NullableUInt8Vector |
getUInt8Vector() |
int |
getValueCapacity()
Returns the maximum number of values that can be stored in this vector instance.
|
NullableVar16CharVector |
getVar16CharVector() |
NullableVarBinaryVector |
getVarBinaryVector() |
NullableVarCharVector |
getVarCharVector() |
NullableVarDecimalVector |
getVarDecimalVector() |
FieldWriter |
getWriter() |
Iterator<ValueVector> |
iterator() |
void |
load(UserBitShared.SerializedField metadata,
DrillBuf buffer)
Load the data provided in the buffer.
|
TransferPair |
makeTransferPair(ValueVector target)
Returns a new
transfer pair that is used to transfer underlying
buffers into the target vector. |
<T extends ValueVector> |
member(TypeProtos.MinorType type) |
ValueVector |
setFirstType(ValueVector v,
int newValueCount) |
void |
setInitialCapacity(int numRecords)
Set the initial record capacity
|
<T extends ValueVector> |
subtype(TypeProtos.MinorType type) |
void |
toNullable(ValueVector nullableVector)
Convert a non-nullable vector to nullable by shuffling the data from
one to the other.
|
void |
transferTo(UnionVector target) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public static final int NULL_MARKER
public static final String TYPE_VECTOR_NAME
public static final String INTERNAL_MAP_NAME
public static final int TYPE_COUNT
public static final TypeProtos.MajorType[] TYPES
public UnionVector(MaterializedField field, BufferAllocator allocator, CallBack callBack)
public BufferAllocator getAllocator()
getAllocator
in interface ValueVector
public List<TypeProtos.MinorType> getSubTypes()
public <T extends ValueVector> T subtype(TypeProtos.MinorType type)
public void addType(ValueVector vector)
vector
- subtype vector to addpublic void addSubType(TypeProtos.MinorType type)
public MapVector getMap()
public DictVector getDict()
public ListVector getList()
public NullableTinyIntVector getTinyIntVector()
public NullableUInt1Vector getUInt1Vector()
public NullableUInt2Vector getUInt2Vector()
public NullableSmallIntVector getSmallIntVector()
public NullableIntVector getIntVector()
public NullableUInt4Vector getUInt4Vector()
public NullableFloat4Vector getFloat4Vector()
public NullableTimeVector getTimeVector()
public NullableIntervalYearVector getIntervalYearVector()
public NullableBigIntVector getBigIntVector()
public NullableUInt8Vector getUInt8Vector()
public NullableFloat8Vector getFloat8Vector()
public NullableDateVector getDateVector()
public NullableTimeStampVector getTimeStampVector()
public NullableIntervalDayVector getIntervalDayVector()
public NullableIntervalVector getIntervalVector()
public NullableVarBinaryVector getVarBinaryVector()
public NullableVarCharVector getVarCharVector()
public NullableVar16CharVector getVar16CharVector()
public NullableVarDecimalVector getVarDecimalVector()
public NullableBitVector getBitVector()
public ValueVector getMember(TypeProtos.MinorType type)
type
- the type of the vector to retrievepublic <T extends ValueVector> T member(TypeProtos.MinorType type)
public int getTypeValue(int index)
public UInt1Vector getTypeVector()
public MapVector getTypeMap()
public void allocateNew() throws OutOfMemoryException
ValueVector
allocateNew
in interface ValueVector
OutOfMemoryException
- Thrown if no memory can be allocated.public void allocateNew(int rowCount) throws OutOfMemoryException
OutOfMemoryException
public boolean allocateNewSafe()
ValueVector
allocateNewSafe
in interface ValueVector
public void setInitialCapacity(int numRecords)
ValueVector
setInitialCapacity
in interface ValueVector
public int getValueCapacity()
ValueVector
getValueCapacity
in interface ValueVector
public void close()
ValueVector
close
in interface Closeable
close
in interface AutoCloseable
close
in interface ValueVector
public void clear()
ValueVector
clear
in interface ValueVector
public MaterializedField getField()
ValueVector
getField
in interface ValueVector
public void collectLedgers(Set<AllocationManager.BufferLedger> ledgers)
ValueVector
collectLedgers
in interface ValueVector
ledgers
- set of ledgers to which to add ledgers for this vectorpublic int getPayloadByteCount(int valueCount)
ValueVector
getPayloadByteCount
in interface ValueVector
public TransferPair getTransferPair(BufferAllocator allocator)
ValueVector
transfer pair
, creating a new target vector of
the same type.getTransferPair
in interface ValueVector
public TransferPair getTransferPair(String ref, BufferAllocator allocator)
getTransferPair
in interface ValueVector
public TransferPair makeTransferPair(ValueVector target)
ValueVector
transfer pair
that is used to transfer underlying
buffers into the target vector.makeTransferPair
in interface ValueVector
public void transferTo(UnionVector target)
public void copyFrom(int inIndex, int outIndex, UnionVector from)
public void copyFromSafe(int inIndex, int outIndex, UnionVector from)
public void copyEntry(int toIndex, ValueVector from, int fromIndex)
copyEntry
in interface ValueVector
public ValueVector addVector(ValueVector v)
v
- the vector to clone and addpublic ValueVector setFirstType(ValueVector v, int newValueCount)
public void toNullable(ValueVector nullableVector)
ValueVector
toNullable
in interface ValueVector
nullableVector
- nullable vector of the same minor type as
this vectorpublic UnionVector.Accessor getAccessor()
ValueVector
accessor
that is used to read from this vector
instance.getAccessor
in interface ValueVector
public UnionVector.Mutator getMutator()
ValueVector
mutator
that is used to write to this vector
instance.getMutator
in interface ValueVector
public FieldReader getReader()
ValueVector
field reader
that supports reading values
from this vector.getReader
in interface ValueVector
public FieldWriter getWriter()
public UserBitShared.SerializedField getMetadata()
ValueVector
getMetadata
in interface ValueVector
public int getBufferSize()
ValueVector
getBufferSize
in interface ValueVector
public int getAllocatedSize()
ValueVector
getAllocatedSize
in interface ValueVector
public int getBufferSizeFor(int valueCount)
ValueVector
getBufferSizeFor
in interface ValueVector
valueCount
- the number of values to assume this vector containspublic DrillBuf[] 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 void load(UserBitShared.SerializedField metadata, DrillBuf buffer)
ValueVector
load
in interface ValueVector
metadata
- Metadata used to decode the incoming buffer.buffer
- The buffer that contains the ValueVector.public Iterator<ValueVector> iterator()
iterator
in interface Iterable<ValueVector>
public void exchange(ValueVector other)
ValueVector
exchange
in interface ValueVector
Copyright © 1970 The Apache Software Foundation. All rights reserved.