Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::ListVector Struct Reference

Static Public Member Functions

static const list_entry_t * GetData (const Vector &v)
static list_entry_t * GetData (Vector &v)
static DUCKDB_API const Vector & GetEntry (const Vector &vector)
 Gets a reference to the underlying child-vector of a list.
static DUCKDB_API Vector & GetEntry (Vector &vector)
 Gets a reference to the underlying child-vector of a list.
static DUCKDB_API idx_t GetListSize (const Vector &vector)
 Gets the total size of the underlying child-vector of a list.
static DUCKDB_API void SetListSize (Vector &vec, idx_t size)
 Sets the total size of the underlying child-vector of a list.
static DUCKDB_API idx_t GetListCapacity (const Vector &vector)
 Gets the total capacity of the underlying child-vector of a list.
static DUCKDB_API void Reserve (Vector &vec, idx_t required_capacity)
 Sets the total capacity of the underlying child-vector of a list.
static DUCKDB_API void Append (Vector &target, const Vector &source, idx_t source_size, idx_t source_offset=0)
static DUCKDB_API void Append (Vector &target, const Vector &source, const SelectionVector &sel, idx_t source_size, idx_t source_offset=0)
static DUCKDB_API void PushBack (Vector &target, const Value &insert)
static DUCKDB_API idx_t GetConsecutiveChildList (Vector &list, Vector &result, idx_t offset, idx_t count)
 Returns the child_vector of list starting at offset until offset + count, and its length.
static DUCKDB_API ConsecutiveChildListInfo GetConsecutiveChildListInfo (Vector &list, idx_t offset, idx_t count)
 Returns information to only copy a section of a list child vector.
static DUCKDB_API void GetConsecutiveChildSelVector (Vector &list, SelectionVector &sel, idx_t offset, idx_t count)
 Slice and flatten a child vector to only contain a consecutive subsection of the child entries.
static DUCKDB_API void ReferenceEntry (Vector &vector, Vector &other)
 Share the entry of the other list vector.

Static Private Member Functions

template<class T>
static T & GetEntryInternal (T &vector)

Member Function Documentation

◆ GetData() [1/2]

const list_entry_t * duckdb::ListVector::GetData ( const Vector & v)
inlinestatic
10966 {
10967 if (v.GetVectorType() == VectorType::DICTIONARY_VECTOR) {
10968 auto &child = DictionaryVector::Child(v);
10969 return GetData(child);
10970 }
10971 return FlatVector::GetData<const list_entry_t>(v);
10972 }
uint32_t v

◆ GetData() [2/2]

list_entry_t * duckdb::ListVector::GetData ( Vector & v)
inlinestatic
10973 {
10974 if (v.GetVectorType() == VectorType::DICTIONARY_VECTOR) {
10975 auto &child = DictionaryVector::Child(v);
10976 return GetData(child);
10977 }
10978 return FlatVector::GetData<list_entry_t>(v);
10979 }

◆ GetEntry() [1/2]

const Vector & duckdb::ListVector::GetEntry ( const Vector & vector)
static

Gets a reference to the underlying child-vector of a list.

138203 {
138204 return GetEntryInternal<const Vector>(vector);
138205}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEntry() [2/2]

Vector & duckdb::ListVector::GetEntry ( Vector & vector)
static

Gets a reference to the underlying child-vector of a list.

138207 {
138208 return GetEntryInternal<Vector>(vector);
138209}
Here is the call graph for this function:

◆ GetListSize()

idx_t duckdb::ListVector::GetListSize ( const Vector & vector)
static

Gets the total size of the underlying child-vector of a list.

138221 {
138222 if (vec.GetVectorType() == VectorType::DICTIONARY_VECTOR) {
138223 auto &child = DictionaryVector::Child(vec);
138224 return ListVector::GetListSize(child);
138225 }
138226 D_ASSERT(vec.auxiliary);
138227 return vec.auxiliary->Cast<VectorListBuffer>().GetSize();
138228}
static DUCKDB_API idx_t GetListSize(const Vector &vector)
Gets the total size of the underlying child-vector of a list.
Definition duckdb.cpp:138221
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetListSize()

void duckdb::ListVector::SetListSize ( Vector & vec,
idx_t size )
static

Sets the total size of the underlying child-vector of a list.

138248 {
138249 if (vec.GetVectorType() == VectorType::DICTIONARY_VECTOR) {
138250 auto &child = DictionaryVector::Child(vec);
138251 ListVector::SetListSize(child, size);
138252 return;
138253 }
138254 vec.auxiliary->Cast<VectorListBuffer>().SetSize(size);
138255}
static DUCKDB_API void SetListSize(Vector &vec, idx_t size)
Sets the total size of the underlying child-vector of a list.
Definition duckdb.cpp:138248
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetListCapacity()

idx_t duckdb::ListVector::GetListCapacity ( const Vector & vector)
static

Gets the total capacity of the underlying child-vector of a list.

138230 {
138231 if (vec.GetVectorType() == VectorType::DICTIONARY_VECTOR) {
138232 auto &child = DictionaryVector::Child(vec);
138233 return ListVector::GetListSize(child);
138234 }
138235 D_ASSERT(vec.auxiliary);
138236 return vec.auxiliary->Cast<VectorListBuffer>().GetCapacity();
138237}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Reserve()

void duckdb::ListVector::Reserve ( Vector & vec,
idx_t required_capacity )
static

Sets the total capacity of the underlying child-vector of a list.

138211 {
138212 D_ASSERT(vector.GetType().id() == LogicalTypeId::LIST || vector.GetType().id() == LogicalTypeId::MAP);
138213 D_ASSERT(vector.GetVectorType() == VectorType::FLAT_VECTOR ||
138214 vector.GetVectorType() == VectorType::CONSTANT_VECTOR);
138215 D_ASSERT(vector.auxiliary);
138216 D_ASSERT(vector.auxiliary->GetBufferType() == VectorBufferType::LIST_BUFFER);
138217 auto &child_buffer = vector.auxiliary->Cast<VectorListBuffer>();
138218 child_buffer.Reserve(required_capacity);
138219}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Append() [1/2]

void duckdb::ListVector::Append ( Vector & target,
const Vector & source,
idx_t source_size,
idx_t source_offset = 0 )
static

Nothing to add

138257 {
138258 if (source_size - source_offset == 0) {
138260 return;
138261 }
138262 auto &target_buffer = target.auxiliary->Cast<VectorListBuffer>();
138263 target_buffer.Append(source, source_size, source_offset);
138264}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Append() [2/2]

void duckdb::ListVector::Append ( Vector & target,
const Vector & source,
const SelectionVector & sel,
idx_t source_size,
idx_t source_offset = 0 )
static

Nothing to add

138267 {
138268 if (source_size - source_offset == 0) {
138270 return;
138271 }
138272 auto &target_buffer = target.auxiliary->Cast<VectorListBuffer>();
138273 target_buffer.Append(source, sel, source_size, source_offset);
138274}
Here is the call graph for this function:

◆ PushBack()

void duckdb::ListVector::PushBack ( Vector & target,
const Value & insert )
static
138276 {
138277 auto &target_buffer = target.auxiliary.get()->Cast<VectorListBuffer>();
138278 target_buffer.PushBack(insert);
138279}

◆ GetConsecutiveChildList()

idx_t duckdb::ListVector::GetConsecutiveChildList ( Vector & list,
Vector & result,
idx_t offset,
idx_t count )
static

Returns the child_vector of list starting at offset until offset + count, and its length.

138281 {
138282 auto info = ListVector::GetConsecutiveChildListInfo(list, offset, count);
138283 if (info.needs_slicing) {
138284 SelectionVector sel(info.child_list_info.length);
138285 ListVector::GetConsecutiveChildSelVector(list, sel, offset, count);
138286
138287 result.Slice(sel, info.child_list_info.length);
138288 result.Flatten(info.child_list_info.length);
138289 }
138290 return info.child_list_info.length;
138291}
static DUCKDB_API void GetConsecutiveChildSelVector(Vector &list, SelectionVector &sel, idx_t offset, idx_t count)
Slice and flatten a child vector to only contain a consecutive subsection of the child entries.
Definition duckdb.cpp:138346
static DUCKDB_API ConsecutiveChildListInfo GetConsecutiveChildListInfo(Vector &list, idx_t offset, idx_t count)
Returns information to only copy a section of a list child vector.
Definition duckdb.cpp:138293
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetConsecutiveChildListInfo()

ConsecutiveChildListInfo duckdb::ListVector::GetConsecutiveChildListInfo ( Vector & list,
idx_t offset,
idx_t count )
static

Returns information to only copy a section of a list child vector.

138293 {
138294 ConsecutiveChildListInfo info;
138295 UnifiedVectorFormat unified_list_data;
138296 list.ToUnifiedFormat(offset + count, unified_list_data);
138297 auto list_data = UnifiedVectorFormat::GetData<list_entry_t>(unified_list_data);
138298
138299 // find the first non-NULL entry
138300 idx_t first_length = 0;
138301 for (idx_t i = offset; i < offset + count; i++) {
138302 auto idx = unified_list_data.sel->get_index(i);
138303 if (!unified_list_data.validity.RowIsValid(idx)) {
138304 continue;
138305 }
138306 info.child_list_info.offset = list_data[idx].offset;
138307 first_length = list_data[idx].length;
138308 break;
138309 }
138310
138311 // small performance improvement for constant vectors
138312 // avoids iterating over all their (constant) elements
138313 if (list.GetVectorType() == VectorType::CONSTANT_VECTOR) {
138314 info.child_list_info.length = first_length;
138315 return info;
138316 }
138317
138318 // now get the child count and determine whether the children are stored consecutively
138319 // also determine if a flat vector has pseudo constant values (all offsets + length the same)
138320 // this can happen e.g. for UNNESTs
138321 bool is_consecutive = true;
138322 for (idx_t i = offset; i < offset + count; i++) {
138323 auto idx = unified_list_data.sel->get_index(i);
138324 if (!unified_list_data.validity.RowIsValid(idx)) {
138325 continue;
138326 }
138327 if (list_data[idx].offset != info.child_list_info.offset || list_data[idx].length != first_length) {
138328 info.is_constant = false;
138329 }
138330 if (list_data[idx].offset != info.child_list_info.offset + info.child_list_info.length) {
138331 is_consecutive = false;
138332 }
138333 info.child_list_info.length += list_data[idx].length;
138334 }
138335
138336 if (info.is_constant) {
138337 info.child_list_info.length = first_length;
138338 }
138339 if (!info.is_constant && !is_consecutive) {
138340 info.needs_slicing = true;
138341 }
138342
138343 return info;
138344}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetConsecutiveChildSelVector()

void duckdb::ListVector::GetConsecutiveChildSelVector ( Vector & list,
SelectionVector & sel,
idx_t offset,
idx_t count )
static

Slice and flatten a child vector to only contain a consecutive subsection of the child entries.

138346 {
138347 UnifiedVectorFormat unified_list_data;
138348 list.ToUnifiedFormat(offset + count, unified_list_data);
138349 auto list_data = UnifiedVectorFormat::GetData<list_entry_t>(unified_list_data);
138350
138351 // SelectionVector child_sel(info.second.length);
138352 idx_t entry = 0;
138353 for (idx_t i = offset; i < offset + count; i++) {
138354 auto idx = unified_list_data.sel->get_index(i);
138355 if (!unified_list_data.validity.RowIsValid(idx)) {
138356 continue;
138357 }
138358 for (idx_t k = 0; k < list_data[idx].length; k++) {
138359 // child_sel.set_index(entry++, list_data[idx].offset + k);
138360 sel.set_index(entry++, list_data[idx].offset + k);
138361 }
138362 }
138363 //
138364 // result.Slice(child_sel, info.second.length);
138365 // result.Flatten(info.second.length);
138366 // info.second.offset = 0;
138367}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReferenceEntry()

void duckdb::ListVector::ReferenceEntry ( Vector & vector,
Vector & other )
static

Share the entry of the other list vector.

138239 {
138240 D_ASSERT(vector.GetType().id() == LogicalTypeId::LIST);
138241 D_ASSERT(vector.GetVectorType() == VectorType::FLAT_VECTOR ||
138242 vector.GetVectorType() == VectorType::CONSTANT_VECTOR);
138243 D_ASSERT(other.GetType().id() == LogicalTypeId::LIST);
138244 D_ASSERT(other.GetVectorType() == VectorType::FLAT_VECTOR || other.GetVectorType() == VectorType::CONSTANT_VECTOR);
138245 vector.auxiliary = other.auxiliary;
138246}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEntryInternal()

template<class T>
T & duckdb::ListVector::GetEntryInternal ( T & vector)
staticprivate
138190 {
138191 D_ASSERT(vector.GetType().id() == LogicalTypeId::LIST || vector.GetType().id() == LogicalTypeId::MAP);
138192 if (vector.GetVectorType() == VectorType::DICTIONARY_VECTOR) {
138193 auto &child = DictionaryVector::Child(vector);
138194 return ListVector::GetEntry(child);
138195 }
138196 D_ASSERT(vector.GetVectorType() == VectorType::FLAT_VECTOR ||
138197 vector.GetVectorType() == VectorType::CONSTANT_VECTOR);
138198 D_ASSERT(vector.auxiliary);
138199 D_ASSERT(vector.auxiliary->GetBufferType() == VectorBufferType::LIST_BUFFER);
138200 return vector.auxiliary->template Cast<VectorListBuffer>().GetChild();
138201}
static DUCKDB_API const Vector & GetEntry(const Vector &vector)
Gets a reference to the underlying child-vector of a list.
Definition duckdb.cpp:138203

The documentation for this struct was generated from the following files: