25 friend class ArrowColumnVector;
31 KU_ASSERT(dataTypeID != LogicalTypeID::LIST);
37 void setState(
const std::shared_ptr<DataChunkState>& state_);
44 nullMask.setNullFromRange(startPos, len, value);
48 uint8_t
isNull(uint32_t pos)
const {
return nullMask.isNull(pos); }
50 state->getSelVectorUnsafe().setSelSize(1);
51 setNull(state->getSelVector()[0],
true);
54 bool setNullFromBits(
const uint64_t* srcNullEntries, uint64_t srcOffset, uint64_t dstOffset,
55 uint64_t numBitsToCopy,
bool invert =
false);
62 return ((T*)valueBuffer.get())[pos];
66 return ((T*)valueBuffer.get())[pos];
77 const uint8_t* srcVectorData);
83 uint8_t*
getData()
const {
return valueBuffer.get(); }
86 KU_ASSERT(dataType.getLogicalTypeID() == LogicalTypeID::INTERNAL_ID);
87 return getValue<nodeID_t>(pos).offset;
97 static std::unique_ptr<ValueVector>
deSerialize(Deserializer& deSer, storage::MemoryManager* mm,
98 std::shared_ptr<DataChunkState> dataChunkState);
102 void initializeValueBuffer();
106 std::shared_ptr<DataChunkState>
state;
109 std::unique_ptr<uint8_t[]> valueBuffer;
111 uint32_t numBytesPerValue;
112 std::unique_ptr<AuxiliaryBuffer> auxiliaryBuffer;
119 return ku_dynamic_cast<StringAuxiliaryBuffer*>(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:
231 ->getFieldVectorShared(idx);
237 ->getFieldVectorPtr(idx);
241 std::shared_ptr<ValueVector> vectorToReference) {
243 ->referenceChildVector(idx, std::move(vectorToReference));
250 const ValueVector* srcVector,
const uint8_t* srcData);
266 std::shared_ptr<ValueVector> vectorToReference) {
268 std::move(vectorToReference));
273 for (
auto i = 0u; i < vector->
state->getSelVector().getSelSize(); i++) {
293 return keyVector->getData() + keyVector->getNumBytesPerValue() * listEntry.
offset;
298 return valueVector->getData() + valueVector->getNumBytesPerValue() * listEntry.
offset;
#define KUZU_API
Definition api.h:25
#define KU_ASSERT(condition)
Definition assert.h:19
Definition in_mem_overflow_buffer.h:30
Definition auxiliary_buffer.h:79
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:269
KUZU_API PhysicalTypeID getPhysicalType() const
Definition types.h:273
Definition value_vector.h:279
static ValueVector * getValueVector(const ValueVector *vector)
Definition value_vector.h:286
static uint8_t * getMapKeys(const ValueVector *vector, const list_entry_t &listEntry)
Definition value_vector.h:291
static uint8_t * getMapValues(const ValueVector *vector, const list_entry_t &listEntry)
Definition value_vector.h:296
static ValueVector * getKeyVector(const ValueVector *vector)
Definition value_vector.h:281
Definition null_mask.h:70
Definition value_vector.h:115
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:117
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:240
static void copyToRowData(const ValueVector *vector, uint32_t pos, uint8_t *rowData, InMemOverflowBuffer *rowOverflowBuffer)
static ValueVector * getFieldVectorRaw(const ValueVector &vector, const std::string &fieldName)
Definition value_vector.h:234
static std::shared_ptr< ValueVector > getFieldVector(const ValueVector *vector, struct_field_idx_t idx)
Definition value_vector.h:228
Definition value_vector.h:253
static void setTagField(ValueVector *vector, union_field_idx_t tag)
Definition value_vector.h:271
static void referenceVector(ValueVector *vector, union_field_idx_t fieldIdx, std::shared_ptr< ValueVector > vectorToReference)
Definition value_vector.h:265
static ValueVector * getValVector(const ValueVector *vector, union_field_idx_t fieldIdx)
Definition value_vector.h:260
static ValueVector * getTagVector(const ValueVector *vector)
Definition value_vector.h:255
Definition value_vector.h:20
static bool discardNull(ValueVector &vector)
uint8_t * getData() const
Definition value_vector.h:83
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:40
uint8_t isNull(uint32_t pos) const
Definition value_vector.h:48
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:61
LogicalType dataType
Definition value_vector.h:105
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)
DELETE_COPY_AND_MOVE(ValueVector)
const NullMask & getNullMask() const
Definition value_vector.h:46
bool hasNoNullsGuarantee() const
Definition value_vector.h:42
T & getValue(uint32_t pos)
Definition value_vector.h:65
void setAllNull()
Definition value_vector.h:39
uint32_t getNumBytesPerValue() const
Definition value_vector.h:57
void setAsSingleNullEntry()
Definition value_vector.h:49
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:85
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:43
void setNull(uint32_t pos, bool isNull)
std::shared_ptr< DataChunkState > state
Definition value_vector.h:106
struct_field_idx_t union_field_idx_t
Definition types.h:46
LogicalTypeID
Definition types.h:167
uint64_t offset_t
Definition types.h:74
uint8_t struct_field_idx_t
Definition types.h:45
TO ku_dynamic_cast(FROM *old)
Definition cast.h:11
Definition array_utils.h:7
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
static struct_field_idx_t getFieldIdx(const LogicalType &type, const std::string &key)
static union_field_idx_t getInternalFieldIdx(union_field_idx_t idx)
static constexpr union_field_idx_t TAG_FIELD_IDX
Definition types.h:585
Definition ku_string.h:12
offset_t offset
Definition types.h:109