25 friend class ArrowColumnVector;
31 KU_ASSERT(dataTypeID != LogicalTypeID::LIST);
36 void setState(
const std::shared_ptr<DataChunkState>& state_);
43 nullMask.setNullFromRange(startPos, len, value);
47 uint8_t
isNull(uint32_t pos)
const {
return nullMask.isNull(pos); }
49 state->getSelVectorUnsafe().setSelSize(1);
50 setNull(state->getSelVector()[0],
true);
53 bool setNullFromBits(
const uint64_t* srcNullEntries, uint64_t srcOffset, uint64_t dstOffset,
54 uint64_t numBitsToCopy,
bool invert =
false);
61 return ((T*)valueBuffer.get())[pos];
65 return ((T*)valueBuffer.get())[pos];
76 const uint8_t* srcVectorData);
82 uint8_t*
getData()
const {
return valueBuffer.get(); }
85 KU_ASSERT(dataType.getLogicalTypeID() == LogicalTypeID::INTERNAL_ID);
86 return getValue<nodeID_t>(pos).offset;
97 std::shared_ptr<DataChunkState> dataChunkState);
101 void initializeValueBuffer();
105 std::shared_ptr<DataChunkState>
state;
108 std::unique_ptr<uint8_t[]> valueBuffer;
110 uint32_t numBytesPerValue;
111 std::unique_ptr<AuxiliaryBuffer> auxiliaryBuffer;
118 return ku_dynamic_cast<AuxiliaryBuffer*, StringAuxiliaryBuffer*>(
119 vector->auxiliaryBuffer.get())
120 ->getOverflowBuffer();
135 const std::string& srcStr);
142 StringVector::addString(vector, pos, data, length);
145 StringVector::addString(vector, pos,
reinterpret_cast<const char*
>(data), length);
163 auto& listBuffer = getAuxBufferUnsafe(*vector);
164 listBuffer.setDataVector(std::move(dataVector));
169 return getAuxBuffer(*vector).getDataVector();
173 return getAuxBuffer(*vector).getSharedDataVector();
177 return getAuxBuffer(*vector).getSize();
181 auto dataVector = getDataVector(vector);
182 return dataVector->getData() + dataVector->getNumBytesPerValue() * listEntry.
offset;
187 return getListValues(vector, listEntry) +
188 elementOffsetInList * getDataVector(vector)->getNumBytesPerValue();
192 return getAuxBufferUnsafe(*vector).addList(listSize);
196 getAuxBufferUnsafe(*vector).resize(numValues);
203 const ValueVector* srcVector,
const uint8_t* srcData);
205 uint64_t numValuesToAppend);
209 static bool validateType(
const ValueVector& vector) {
211 case PhysicalTypeID::LIST:
212 case PhysicalTypeID::ARRAY:
225 vector->auxiliaryBuffer.get())
232 vector->auxiliaryBuffer.get())
233 ->getFieldVectors()[idx];
237 std::shared_ptr<ValueVector> vectorToReference) {
239 ->referenceChildVector(idx, std::move(vectorToReference));
243 std::iota(
reinterpret_cast<int64_t*
>(vector->
getData()),
244 reinterpret_cast<int64_t*
>(
253 const ValueVector* srcVector,
const uint8_t* srcData);
269 std::shared_ptr<ValueVector> vectorToReference) {
271 std::move(vectorToReference));
276 for (
auto i = 0u; i < vector->
state->getSelVector().getSelSize(); i++) {
296 return keyVector->getData() + keyVector->getNumBytesPerValue() * listEntry.
offset;
301 return valueVector->getData() + valueVector->getNumBytesPerValue() * listEntry.
offset;
#define KUZU_API
Definition api.h:25
#define KU_ASSERT(condition)
Definition assert.h:19
Definition deserializer.h:15
Definition in_mem_overflow_buffer.h:30
Definition auxiliary_buffer.h:75
Definition value_vector.h:150
static void setDataVector(const ValueVector *vector, std::shared_ptr< ValueVector > dataVector)
Definition value_vector.h:161
static void sliceDataVector(ValueVector *vectorToSlice, uint64_t offset, uint64_t numValues)
static void copyFromVectorData(ValueVector *dstVector, uint8_t *dstData, const ValueVector *srcVector, const uint8_t *srcData)
static void appendDataVector(ValueVector *dstVector, ValueVector *srcDataVector, uint64_t numValuesToAppend)
static void copyToRowData(const ValueVector *vector, uint32_t pos, uint8_t *rowData, InMemOverflowBuffer *rowOverflowBuffer)
static list_entry_t addList(ValueVector *vector, uint64_t listSize)
Definition value_vector.h:190
static const ListAuxiliaryBuffer & getAuxBuffer(const ValueVector &vector)
Definition value_vector.h:152
static void resizeDataVector(ValueVector *vector, uint64_t numValues)
Definition value_vector.h:194
static void copyListEntryAndBufferMetaData(ValueVector &vector, const ValueVector &other)
static ListAuxiliaryBuffer & getAuxBufferUnsafe(const ValueVector &vector)
Definition value_vector.h:155
static uint8_t * getListValues(const ValueVector *vector, const list_entry_t &listEntry)
Definition value_vector.h:179
static void copyFromRowData(ValueVector *vector, uint32_t pos, const uint8_t *rowData)
static uint64_t getDataVectorSize(const ValueVector *vector)
Definition value_vector.h:175
static ValueVector * getDataVector(const ValueVector *vector)
Definition value_vector.h:167
static uint8_t * getListValuesWithOffset(const ValueVector *vector, const list_entry_t &listEntry, offset_t elementOffsetInList)
Definition value_vector.h:184
static std::shared_ptr< ValueVector > getSharedDataVector(const ValueVector *vector)
Definition value_vector.h:171
KUZU_API LogicalTypeID getLogicalTypeID() const
Definition types.h:224
KUZU_API PhysicalTypeID getPhysicalType() const
Definition types.h:227
Definition value_vector.h:282
static ValueVector * getValueVector(const ValueVector *vector)
Definition value_vector.h:289
static uint8_t * getMapKeys(const ValueVector *vector, const list_entry_t &listEntry)
Definition value_vector.h:294
static uint8_t * getMapValues(const ValueVector *vector, const list_entry_t &listEntry)
Definition value_vector.h:299
static ValueVector * getKeyVector(const ValueVector *vector)
Definition value_vector.h:284
Definition null_mask.h:70
Definition serializer.h:15
Definition value_vector.h:114
static void reserveString(ValueVector *vector, ku_string_t &dstStr, uint64_t length)
static void addString(ValueVector *vector, ku_string_t &dstStr, const char *srcStr, uint64_t length)
static void addString(ValueVector *vector, ku_string_t &dstStr, ku_string_t &srcStr)
static void addString(ValueVector *vector, uint32_t vectorPos, const char *srcStr, uint64_t length)
static void addString(ValueVector *vector, uint32_t vectorPos, const std::string &srcStr)
static void addString(ValueVector *vector, uint32_t vectorPos, ku_string_t &srcStr)
static ku_string_t & reserveString(ValueVector *vector, uint32_t vectorPos, uint64_t length)
static InMemOverflowBuffer * getInMemOverflowBuffer(ValueVector *vector)
Definition value_vector.h:116
static void copyToRowData(const ValueVector *vector, uint32_t pos, uint8_t *rowData, InMemOverflowBuffer *rowOverflowBuffer)
static void addString(kuzu::common::ValueVector *vector, ku_string_t &dstStr, const std::string &srcStr)
Definition value_vector.h:220
static const std::vector< std::shared_ptr< ValueVector > > & getFieldVectors(const ValueVector *vector)
Definition value_vector.h:222
static void copyFromVectorData(ValueVector *dstVector, const uint8_t *dstData, const ValueVector *srcVector, const uint8_t *srcData)
static void copyFromRowData(ValueVector *vector, uint32_t pos, const uint8_t *rowData)
static void referenceVector(ValueVector *vector, struct_field_idx_t idx, std::shared_ptr< ValueVector > vectorToReference)
Definition value_vector.h:236
static void copyToRowData(const ValueVector *vector, uint32_t pos, uint8_t *rowData, InMemOverflowBuffer *rowOverflowBuffer)
static void initializeEntries(ValueVector *vector)
Definition value_vector.h:242
static std::shared_ptr< ValueVector > getFieldVector(const ValueVector *vector, struct_field_idx_t idx)
Definition value_vector.h:229
Definition value_vector.h:256
static void setTagField(ValueVector *vector, union_field_idx_t tag)
Definition value_vector.h:274
static void referenceVector(ValueVector *vector, union_field_idx_t fieldIdx, std::shared_ptr< ValueVector > vectorToReference)
Definition value_vector.h:268
static ValueVector * getValVector(const ValueVector *vector, union_field_idx_t fieldIdx)
Definition value_vector.h:263
static ValueVector * getTagVector(const ValueVector *vector)
Definition value_vector.h:258
Definition value_vector.h:20
static bool discardNull(ValueVector &vector)
uint8_t * getData() const
Definition value_vector.h:82
void copyFromRowData(uint32_t pos, const uint8_t *rowData)
void copyToRowData(uint32_t pos, uint8_t *rowData, InMemOverflowBuffer *rowOverflowBuffer) const
void resetAuxiliaryBuffer()
void setState(const std::shared_ptr< DataChunkState > &state_)
void copyFromValue(uint64_t pos, const Value &value)
std::unique_ptr< Value > getAsValue(uint64_t pos) const
void setAllNonNull()
Definition value_vector.h:39
uint8_t isNull(uint32_t pos) const
Definition value_vector.h:47
void serialize(Serializer &ser) const
ValueVector(LogicalTypeID dataTypeID, storage::MemoryManager *memoryManager=nullptr)
Definition value_vector.h:29
const T & getValue(uint32_t pos) const
Definition value_vector.h:60
LogicalType dataType
Definition value_vector.h:104
static std::unique_ptr< ValueVector > deSerialize(Deserializer &deSer, storage::MemoryManager *mm, std::shared_ptr< DataChunkState > dataChunkState)
void copyFromVectorData(uint64_t dstPos, const ValueVector *srcVector, uint64_t srcPos)
const NullMask & getNullMask() const
Definition value_vector.h:45
bool hasNoNullsGuarantee() const
Definition value_vector.h:41
T & getValue(uint32_t pos)
Definition value_vector.h:64
void setAllNull()
Definition value_vector.h:38
uint32_t getNumBytesPerValue() const
Definition value_vector.h:56
void setAsSingleNullEntry()
Definition value_vector.h:48
void setValue(uint32_t pos, T val)
void copyFromVectorData(uint8_t *dstData, const ValueVector *srcVector, const uint8_t *srcVectorData)
offset_t readNodeOffset(uint32_t pos) const
Definition value_vector.h:84
bool setNullFromBits(const uint64_t *srcNullEntries, uint64_t srcOffset, uint64_t dstOffset, uint64_t numBitsToCopy, bool invert=false)
ValueVector(LogicalType dataType, storage::MemoryManager *memoryManager=nullptr)
void setNullRange(uint32_t startPos, uint32_t len, bool value)
Definition value_vector.h:42
void setNull(uint32_t pos, bool isNull)
std::shared_ptr< DataChunkState > state
Definition value_vector.h:105
constexpr uint64_t DEFAULT_VECTOR_CAPACITY
Definition constants.h:12
struct_field_idx_t union_field_idx_t
Definition types.h:44
uint64_t sel_t
Definition types.h:24
TO ku_dynamic_cast(FROM old)
Definition cast.h:11
LogicalTypeID
Definition types.h:126
uint64_t offset_t
Definition internal_id_t.h:22
uint8_t struct_field_idx_t
Definition types.h:43
Definition alter_type.h:5
Definition value_vector.h:140
static void addBlob(ValueVector *vector, uint32_t pos, const uint8_t *data, uint64_t length)
Definition value_vector.h:144
static void addBlob(ValueVector *vector, uint32_t pos, const char *data, uint32_t length)
Definition value_vector.h:141
Definition value_vector.h:305
static void add(ValueVector *vector, sel_t pos, T val)
static void addString(ValueVector *vector, sel_t pos, const char *str, uint32_t length)
static void addString(ValueVector *vector, sel_t pos, ku_string_t str)
static union_field_idx_t getInternalFieldIdx(union_field_idx_t idx)
static constexpr union_field_idx_t TAG_FIELD_IDX
Definition types.h:505
Definition ku_string.h:12
offset_t offset
Definition types.h:71