26 friend class ArrowColumnVector;
30 std::shared_ptr<DataChunkState> dataChunkState =
nullptr);
33 KU_ASSERT(dataTypeID != LogicalTypeID::LIST);
41 if (hasNoNullsGuarantee()) {
42 state->getSelVector().forEach(func);
44 state->getSelVector().forEach([&](
auto i) {
53 if (hasNoNullsGuarantee()) {
54 return state->getSelVector().getSelSize();
55 }
else if (state->getSelVector().isUnfiltered() &&
57 return nullMask.countNulls();
60 forEachNonNull([&](
auto) { count++; });
65 void setState(
const std::shared_ptr<DataChunkState>& state_);
72 nullMask.setNullFromRange(startPos, len, value);
76 uint8_t
isNull(uint32_t pos)
const {
return nullMask.isNull(pos); }
78 state->getSelVectorUnsafe().setSelSize(1);
79 setNull(state->getSelVector()[0],
true);
82 bool setNullFromBits(
const uint64_t* srcNullEntries, uint64_t srcOffset, uint64_t dstOffset,
83 uint64_t numBitsToCopy,
bool invert =
false);
90 return ((T*)valueBuffer.get())[pos];
94 return ((T*)valueBuffer.get())[pos];
105 const uint8_t* srcVectorData);
111 uint8_t*
getData()
const {
return valueBuffer.get(); }
114 KU_ASSERT(dataType.getLogicalTypeID() == LogicalTypeID::INTERNAL_ID);
115 return getValue<nodeID_t>(pos).offset;
125 static std::unique_ptr<ValueVector>
deSerialize(Deserializer& deSer, storage::MemoryManager* mm,
126 std::shared_ptr<DataChunkState> dataChunkState);
130 void initializeValueBuffer();
134 std::shared_ptr<DataChunkState>
state;
137 std::unique_ptr<uint8_t[]> valueBuffer;
139 uint32_t numBytesPerValue;
140 std::unique_ptr<AuxiliaryBuffer> auxiliaryBuffer;
147 return ku_dynamic_cast<StringAuxiliaryBuffer*>(vector->auxiliaryBuffer.get())
148 ->getOverflowBuffer();
163 const std::string& srcStr);
170 StringVector::addString(vector, pos, data, length);
173 StringVector::addString(vector, pos,
reinterpret_cast<const char*
>(data), length);
191 auto& listBuffer = getAuxBufferUnsafe(*vector);
192 listBuffer.setDataVector(std::move(dataVector));
197 return getAuxBuffer(*vector).getDataVector();
201 return getAuxBuffer(*vector).getSharedDataVector();
205 return getAuxBuffer(*vector).getSize();
209 auto dataVector = getDataVector(vector);
210 return dataVector->getData() + dataVector->getNumBytesPerValue() * listEntry.
offset;
215 return getListValues(vector, listEntry) +
216 elementOffsetInList * getDataVector(vector)->getNumBytesPerValue();
220 return getAuxBufferUnsafe(*vector).addList(listSize);
224 getAuxBufferUnsafe(*vector).resize(numValues);
231 const ValueVector* srcVector,
const uint8_t* srcData);
233 uint64_t numValuesToAppend);
237 static bool validateType(
const ValueVector& vector) {
239 case PhysicalTypeID::LIST:
240 case PhysicalTypeID::ARRAY:
259 ->getFieldVectorShared(idx);
265 ->getFieldVectorPtr(idx);
269 std::shared_ptr<ValueVector> vectorToReference) {
271 ->referenceChildVector(idx, std::move(vectorToReference));
278 const ValueVector* srcVector,
const uint8_t* srcData);
294 std::shared_ptr<ValueVector> vectorToReference) {
296 std::move(vectorToReference));
301 for (
auto i = 0u; i < vector->
state->getSelVector().getSelSize(); i++) {
321 return keyVector->getData() + keyVector->getNumBytesPerValue() * listEntry.
offset;
326 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:32
Definition auxiliary_buffer.h:79
Definition value_vector.h:178
static void setDataVector(const ValueVector *vector, std::shared_ptr< ValueVector > dataVector)
Definition value_vector.h:189
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:218
static const ListAuxiliaryBuffer & getAuxBuffer(const ValueVector &vector)
Definition value_vector.h:180
static void resizeDataVector(ValueVector *vector, uint64_t numValues)
Definition value_vector.h:222
static void copyListEntryAndBufferMetaData(ValueVector &vector, const ValueVector &other)
static ListAuxiliaryBuffer & getAuxBufferUnsafe(const ValueVector &vector)
Definition value_vector.h:183
static uint8_t * getListValues(const ValueVector *vector, const list_entry_t &listEntry)
Definition value_vector.h:207
static void copyFromRowData(ValueVector *vector, uint32_t pos, const uint8_t *rowData)
static uint64_t getDataVectorSize(const ValueVector *vector)
Definition value_vector.h:203
static ValueVector * getDataVector(const ValueVector *vector)
Definition value_vector.h:195
static uint8_t * getListValuesWithOffset(const ValueVector *vector, const list_entry_t &listEntry, offset_t elementOffsetInList)
Definition value_vector.h:212
static std::shared_ptr< ValueVector > getSharedDataVector(const ValueVector *vector)
Definition value_vector.h:199
KUZU_API LogicalTypeID getLogicalTypeID() const
Definition types.h:272
KUZU_API PhysicalTypeID getPhysicalType() const
Definition types.h:276
Definition value_vector.h:307
static ValueVector * getValueVector(const ValueVector *vector)
Definition value_vector.h:314
static uint8_t * getMapKeys(const ValueVector *vector, const list_entry_t &listEntry)
Definition value_vector.h:319
static uint8_t * getMapValues(const ValueVector *vector, const list_entry_t &listEntry)
Definition value_vector.h:324
static ValueVector * getKeyVector(const ValueVector *vector)
Definition value_vector.h:309
Definition null_mask.h:71
Definition value_vector.h:143
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:145
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:248
static const std::vector< std::shared_ptr< ValueVector > > & getFieldVectors(const ValueVector *vector)
Definition value_vector.h:250
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:268
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:262
static std::shared_ptr< ValueVector > getFieldVector(const ValueVector *vector, struct_field_idx_t idx)
Definition value_vector.h:256
Definition value_vector.h:281
static void setTagField(ValueVector *vector, union_field_idx_t tag)
Definition value_vector.h:299
static void referenceVector(ValueVector *vector, union_field_idx_t fieldIdx, std::shared_ptr< ValueVector > vectorToReference)
Definition value_vector.h:293
static ValueVector * getValVector(const ValueVector *vector, union_field_idx_t fieldIdx)
Definition value_vector.h:288
static ValueVector * getTagVector(const ValueVector *vector)
Definition value_vector.h:283
Definition value_vector.h:21
static bool discardNull(ValueVector &vector)
uint8_t * getData() const
Definition value_vector.h:111
ValueVector(LogicalType dataType, storage::MemoryManager *memoryManager=nullptr, std::shared_ptr< DataChunkState > dataChunkState=nullptr)
void copyFromRowData(uint32_t pos, const uint8_t *rowData)
void copyToRowData(uint32_t pos, uint8_t *rowData, InMemOverflowBuffer *rowOverflowBuffer) const
void resetAuxiliaryBuffer()
void forEachNonNull(Func &&func) const
Definition value_vector.h:40
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:68
uint8_t isNull(uint32_t pos) const
Definition value_vector.h:76
void serialize(Serializer &ser) const
ValueVector(LogicalTypeID dataTypeID, storage::MemoryManager *memoryManager=nullptr)
Definition value_vector.h:31
const T & getValue(uint32_t pos) const
Definition value_vector.h:89
LogicalType dataType
Definition value_vector.h:133
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)
uint32_t countNonNull() const
Definition value_vector.h:52
DELETE_COPY_AND_MOVE(ValueVector)
const NullMask & getNullMask() const
Definition value_vector.h:74
bool hasNoNullsGuarantee() const
Definition value_vector.h:70
T & getValue(uint32_t pos)
Definition value_vector.h:93
void setAllNull()
Definition value_vector.h:67
uint32_t getNumBytesPerValue() const
Definition value_vector.h:85
void setAsSingleNullEntry()
Definition value_vector.h:77
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:113
bool setNullFromBits(const uint64_t *srcNullEntries, uint64_t srcOffset, uint64_t dstOffset, uint64_t numBitsToCopy, bool invert=false)
void setNullRange(uint32_t startPos, uint32_t len, bool value)
Definition value_vector.h:71
void setNull(uint32_t pos, bool isNull)
std::shared_ptr< DataChunkState > state
Definition value_vector.h:134
constexpr uint64_t DEFAULT_VECTOR_CAPACITY
Definition constants.h:24
struct_field_idx_t union_field_idx_t
Definition types.h:49
LogicalTypeID
Definition types.h:170
uint64_t offset_t
Definition types.h:77
uint8_t struct_field_idx_t
Definition types.h:48
TO ku_dynamic_cast(FROM *old)
Definition cast.h:11
Definition array_utils.h:7
Definition value_vector.h:168
static void addBlob(ValueVector *vector, uint32_t pos, const uint8_t *data, uint64_t length)
Definition value_vector.h:172
static void addBlob(ValueVector *vector, uint32_t pos, const char *data, uint32_t length)
Definition value_vector.h:169
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:590
Definition ku_string.h:12
offset_t offset
Definition types.h:112