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::VariantUtils Struct Reference

Static Public Member Functions

static DUCKDB_API bool IsNestedType (const UnifiedVariantVectorData &variant, idx_t row, uint32_t value_index)
static DUCKDB_API VariantDecimalData DecodeDecimalData (const UnifiedVariantVectorData &variant, idx_t row, uint32_t value_index)
static DUCKDB_API VariantNestedData DecodeNestedData (const UnifiedVariantVectorData &variant, idx_t row, uint32_t value_index)
static DUCKDB_API string_t DecodeStringData (const UnifiedVariantVectorData &variant, idx_t row, uint32_t value_index)
static DUCKDB_API vector< string > GetObjectKeys (const UnifiedVariantVectorData &variant, idx_t row, const VariantNestedData &nested_data)
static DUCKDB_API void FindChildValues (const UnifiedVariantVectorData &variant, const VariantPathComponent &component, optional_ptr< const SelectionVector > sel, SelectionVector &res, ValidityMask &res_validity, const VariantNestedData *nested_data, const ValidityMask &validity, idx_t count)
static DUCKDB_API VariantNestedDataCollectionResult CollectNestedData (const UnifiedVariantVectorData &variant, VariantLogicalType expected_type, const SelectionVector &value_index_sel, idx_t count, optional_idx row, idx_t offset, VariantNestedData *child_data, ValidityMask &validity)
static DUCKDB_API vector< uint32_t > ValueIsNull (const UnifiedVariantVectorData &variant, const SelectionVector &sel, idx_t count, optional_idx row)
static DUCKDB_API Value ConvertVariantToValue (const UnifiedVariantVectorData &variant, idx_t row, uint32_t values_idx)
static DUCKDB_API bool Verify (Vector &variant, const SelectionVector &sel_p, idx_t count)
static DUCKDB_API void FinalizeVariantKeys (Vector &variant, OrderedOwningStringMap< uint32_t > &dictionary, SelectionVector &sel, idx_t sel_size)
static DUCKDB_API void VariantExtract (Vector &input, const vector< VariantPathComponent > &components, Vector &result, idx_t count)

Member Function Documentation

◆ IsNestedType()

bool duckdb::VariantUtils::IsNestedType ( const UnifiedVariantVectorData & variant,
idx_t row,
uint32_t value_index )
static
238466 {
238467 auto type_id = variant.GetTypeId(row, value_index);
238468 return type_id == VariantLogicalType::ARRAY || type_id == VariantLogicalType::OBJECT;
238469}

◆ DecodeDecimalData()

VariantDecimalData duckdb::VariantUtils::DecodeDecimalData ( const UnifiedVariantVectorData & variant,
idx_t row,
uint32_t value_index )
static
238472 {
238473 D_ASSERT(variant.GetTypeId(row, value_index) == VariantLogicalType::DECIMAL);
238474 auto byte_offset = variant.GetByteOffset(row, value_index);
238475 auto data = const_data_ptr_cast(variant.GetData(row).GetData());
238476 auto ptr = data + byte_offset;
238477
238478 auto width = VarintDecode<uint32_t>(ptr);
238479 auto scale = VarintDecode<uint32_t>(ptr);
238480 auto value_ptr = ptr;
238481 return VariantDecimalData(width, scale, value_ptr);
238482}
void scale(cv::Mat &mat, const cv::Mat &range, const T min, const T max)

◆ DecodeNestedData()

VariantNestedData duckdb::VariantUtils::DecodeNestedData ( const UnifiedVariantVectorData & variant,
idx_t row,
uint32_t value_index )
static
238494 {
238495 D_ASSERT(IsNestedType(variant, row, value_index));
238496 auto byte_offset = variant.GetByteOffset(row, value_index);
238497 auto data = const_data_ptr_cast(variant.GetData(row).GetData());
238498 auto ptr = data + byte_offset;
238499
238500 VariantNestedData result;
238501 result.child_count = VarintDecode<uint32_t>(ptr);
238502 if (result.child_count) {
238503 result.children_idx = VarintDecode<uint32_t>(ptr);
238504 } else {
238505 result.children_idx = 0;
238506 }
238507 return result;
238508}

◆ DecodeStringData()

string_t duckdb::VariantUtils::DecodeStringData ( const UnifiedVariantVectorData & variant,
idx_t row,
uint32_t value_index )
static
238484 {
238485 auto byte_offset = variant.GetByteOffset(row, value_index);
238486 auto data = const_data_ptr_cast(variant.GetData(row).GetData());
238487 auto ptr = data + byte_offset;
238488
238489 auto length = VarintDecode<uint32_t>(ptr);
238490 return string_t(reinterpret_cast<const char *>(ptr), length);
238491}

◆ GetObjectKeys()

vector< string > duckdb::VariantUtils::GetObjectKeys ( const UnifiedVariantVectorData & variant,
idx_t row,
const VariantNestedData & nested_data )
static
238511 {
238512 vector<string> object_keys;
238513 for (idx_t child_idx = 0; child_idx < nested_data.child_count; child_idx++) {
238514 auto child_key_id = variant.GetKeysIndex(row, nested_data.children_idx + child_idx);
238515 object_keys.push_back(variant.GetKey(row, child_key_id).GetString());
238516 }
238517 return object_keys;
238518}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ FindChildValues()

void duckdb::VariantUtils::FindChildValues ( const UnifiedVariantVectorData & variant,
const VariantPathComponent & component,
optional_ptr< const SelectionVector > sel,
SelectionVector & res,
ValidityMask & res_validity,
const VariantNestedData * nested_data,
const ValidityMask & validity,
idx_t count )
static

The list is too small to contain this index

Found the key we're looking for

238523 {
238524 for (idx_t i = 0; i < count; i++) {
238525 auto row_index = sel ? sel->get_index(i) : i;
238526
238527 if (!validity.RowIsValid(i)) {
238528 continue;
238529 }
238530 auto &nested_data_entry = nested_data[i];
238531 if (component.lookup_mode == VariantChildLookupMode::BY_INDEX) {
238532 auto child_idx = component.index;
238533 if (child_idx >= nested_data_entry.child_count) {
238535 res_validity.SetInvalid(i);
238536 continue;
238537 }
238538 auto value_id = variant.GetValuesIndex(row_index, nested_data_entry.children_idx + child_idx);
238539 res[i] = static_cast<uint8_t>(value_id);
238540 continue;
238541 }
238542 bool found_child = false;
238543 for (idx_t child_idx = 0; child_idx < nested_data_entry.child_count; child_idx++) {
238544 auto value_id = variant.GetValuesIndex(row_index, nested_data_entry.children_idx + child_idx);
238545 auto key_id = variant.GetKeysIndex(row_index, nested_data_entry.children_idx + child_idx);
238546
238547 auto &child_key = variant.GetKey(row_index, key_id);
238548 if (child_key == component.key) {
238550 res[i] = value_id;
238551 found_child = true;
238552 break;
238553 }
238554 }
238555 if (!found_child) {
238556 res_validity.SetInvalid(i);
238557 }
238558 }
238559}
::uint8_t uint8_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CollectNestedData()

VariantNestedDataCollectionResult duckdb::VariantUtils::CollectNestedData ( const UnifiedVariantVectorData & variant,
VariantLogicalType expected_type,
const SelectionVector & value_index_sel,
idx_t count,
optional_idx row,
idx_t offset,
VariantNestedData * child_data,
ValidityMask & validity )
static

NOTE: the validity is assumed to be from a FlatVector Is the input row NULL ?

Is the variant value NULL ?

Is the type of the VARIANT correct?

Record the type of the first row that doesn't have the expected type

238585 {
238586 VariantLogicalType wrong_type = VariantLogicalType::VARIANT_NULL;
238587 for (idx_t i = 0; i < count; i++) {
238588 auto row_index = row.IsValid() ? row.GetIndex() : i;
238589
238592 if (!variant.RowIsValid(row_index) || !validity.RowIsValid(i)) {
238593 validity.SetInvalid(i);
238594 continue;
238595 }
238596
238598 auto type_id = variant.GetTypeId(row_index, value_index_sel[i]);
238599 if (type_id == VariantLogicalType::VARIANT_NULL) {
238600 validity.SetInvalid(i);
238601 continue;
238602 }
238603
238605 if (type_id != expected_type) {
238606 if (wrong_type == VariantLogicalType::VARIANT_NULL) {
238608 wrong_type = type_id;
238609 }
238610 validity.SetInvalid(i);
238611 continue;
238612 }
238613
238614 child_data[i] = DecodeNestedData(variant, row_index, value_index_sel[i]);
238615 }
238616
238617 if (wrong_type != VariantLogicalType::VARIANT_NULL) {
238618 return VariantNestedDataCollectionResult(wrong_type);
238619 }
238620 return VariantNestedDataCollectionResult();
238621}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValueIsNull()

vector< uint32_t > duckdb::VariantUtils::ValueIsNull ( const UnifiedVariantVectorData & variant,
const SelectionVector & sel,
idx_t count,
optional_idx row )
static

Get the index into 'values'

238562 {
238563 vector<uint32_t> res;
238564 res.reserve(count);
238565 for (idx_t i = 0; i < count; i++) {
238566 auto row_index = row.IsValid() ? row.GetIndex() : i;
238567
238568 if (!variant.RowIsValid(row_index)) {
238569 res.push_back(static_cast<uint32_t>(i));
238570 continue;
238571 }
238572
238574 auto type_id = variant.GetTypeId(row_index, sel[i]);
238575 if (type_id == VariantLogicalType::VARIANT_NULL) {
238576 res.push_back(static_cast<uint32_t>(i));
238577 }
238578 }
238579 return res;
238580}
::uint32_t uint32_t

◆ ConvertVariantToValue()

Value duckdb::VariantUtils::ConvertVariantToValue ( const UnifiedVariantVectorData & variant,
idx_t row,
uint32_t values_idx )
static
238623 {
238624 return VariantVisitor<ValueConverter>::Visit(variant, row, values_idx);
238625}

◆ Verify()

bool duckdb::VariantUtils::Verify ( Vector & variant,
const SelectionVector & sel_p,
idx_t count )
static

keys

keys_entry

children

children.key_id

children.value_id

values

values.type_id

values.byte_offset

data

verify keys

verify children

verify values

If the root value is NULL, the row itself should be NULL, not use VARIANT_NULL for the value

Verify the validity of array/object key_ids

238660 {
238661 RecursiveUnifiedVectorFormat format;
238662 Vector::RecursiveToUnifiedFormat(variant, count, format);
238663
238666 auto keys_data = keys.GetData<list_entry_t>(keys);
238667
238669 auto &keys_entry = UnifiedVariantVector::GetKeysEntry(format);
238670 auto keys_entry_data = keys_entry.GetData<string_t>(keys_entry);
238671 D_ASSERT(keys_entry.validity.AllValid());
238672
238674 auto &children = UnifiedVariantVector::GetChildren(format);
238675 auto children_data = children.GetData<list_entry_t>(children);
238676
238679 auto key_id_data = key_id.GetData<uint32_t>(key_id);
238680
238683 auto value_id_data = value_id.GetData<uint32_t>(value_id);
238684
238686 auto &values = UnifiedVariantVector::GetValues(format);
238687 auto values_data = values.GetData<list_entry_t>(values);
238688
238691 auto type_id_data = type_id.GetData<uint8_t>(type_id);
238692
238695 auto byte_offset_data = byte_offset.GetData<uint32_t>(byte_offset);
238696
238699 auto data_data = data.GetData<string_t>(data);
238700
238701 for (idx_t i = 0; i < count; i++) {
238702 auto mapped_row = sel_p.get_index(i);
238703 auto index = format.unified.sel->get_index(mapped_row);
238704
238705 if (!format.unified.validity.RowIsValid(index)) {
238706 continue;
238707 }
238708
238709 auto keys_index = keys.sel->get_index(mapped_row);
238710 auto children_index = children.sel->get_index(mapped_row);
238711 auto values_index = values.sel->get_index(mapped_row);
238712 auto data_index = data.sel->get_index(mapped_row);
238713
238714 D_ASSERT(keys.validity.RowIsValid(keys_index));
238715 D_ASSERT(children.validity.RowIsValid(children_index));
238716 D_ASSERT(values.validity.RowIsValid(values_index));
238717 D_ASSERT(data.validity.RowIsValid(data_index));
238718
238719 auto keys_list_entry = keys_data[keys_index];
238720 auto children_list_entry = children_data[children_index];
238721 auto values_list_entry = values_data[values_index];
238722 auto &blob = data_data[data_index];
238723
238725 for (idx_t j = 0; j < keys_list_entry.length; j++) {
238726 auto keys_entry_index = keys_entry.sel->get_index(j + keys_list_entry.offset);
238727 D_ASSERT(keys_entry.validity.RowIsValid(keys_entry_index));
238728 keys_entry_data[keys_entry_index].Verify();
238729 }
238731 for (idx_t j = 0; j < children_list_entry.length; j++) {
238732 auto key_id_index = key_id.sel->get_index(j + children_list_entry.offset);
238733 if (key_id.validity.RowIsValid(key_id_index)) {
238734 auto children_key_id = key_id_data[key_id_index];
238735 D_ASSERT(children_key_id < keys_list_entry.length);
238736 (void)children_key_id;
238737 }
238738
238739 auto value_id_index = value_id.sel->get_index(j + children_list_entry.offset);
238740 D_ASSERT(value_id.validity.RowIsValid(value_id_index));
238741 auto children_value_id = value_id_data[value_id_index];
238742 D_ASSERT(children_value_id < values_list_entry.length);
238743 (void)children_value_id;
238744 }
238745
238747 for (idx_t j = 0; j < values_list_entry.length; j++) {
238748 auto type_id_index = type_id.sel->get_index(j + values_list_entry.offset);
238749 D_ASSERT(type_id.validity.RowIsValid(type_id_index));
238750 auto value_type_id = type_id_data[type_id_index];
238751 D_ASSERT(value_type_id < static_cast<uint8_t>(VariantLogicalType::ENUM_SIZE));
238752
238753 auto byte_offset_index = byte_offset.sel->get_index(j + values_list_entry.offset);
238754 D_ASSERT(byte_offset.validity.RowIsValid(byte_offset_index));
238755 auto value_byte_offset = byte_offset_data[byte_offset_index];
238756 D_ASSERT(value_byte_offset <= blob.GetSize());
238757
238758 if (j == 0) {
238760 D_ASSERT(value_type_id != static_cast<uint8_t>(VariantLogicalType::VARIANT_NULL));
238761 }
238762
238763 auto blob_data = const_data_ptr_cast(blob.GetData()) + value_byte_offset;
238764 switch (static_cast<VariantLogicalType>(value_type_id)) {
238765 case VariantLogicalType::OBJECT:
238766 case VariantLogicalType::ARRAY: {
238767 auto length = VarintDecode<uint32_t>(blob_data);
238768 if (!length) {
238769 break;
238770 }
238771 auto children_start_index = VarintDecode<uint32_t>(blob_data);
238772 D_ASSERT(children_start_index + length <= children_list_entry.length);
238773
238775 for (idx_t child_idx = 0; child_idx < length; child_idx++) {
238776 auto child_key_id_index =
238777 key_id.sel->get_index(children_list_entry.offset + children_start_index + child_idx);
238778 if (value_type_id == static_cast<uint8_t>(VariantLogicalType::OBJECT)) {
238779 D_ASSERT(key_id.validity.RowIsValid(child_key_id_index));
238780 } else {
238781 D_ASSERT(!key_id.validity.RowIsValid(child_key_id_index));
238782 }
238783 (void)child_key_id_index;
238784 }
238785 break;
238786 }
238787 default:
238788 break;
238789 }
238790 }
238791 }
238792
238793 return true;
238794}
static void RecursiveToUnifiedFormat(Vector &input, idx_t count, RecursiveUnifiedVectorFormat &data)
Recursively calls UnifiedVectorFormat on a vector and its child vectors (for nested types).
Definition duckdb.cpp:136924
std::basic_string< Char > format(const S &format_str, Args &&... args)
Definition duckdb.cpp:16295
index
static DUCKDB_API const UnifiedVectorFormat & GetKeysEntry(const RecursiveUnifiedVectorFormat &vec)
The 'keys' list entry.
Definition duckdb.cpp:138663
static DUCKDB_API const UnifiedVectorFormat & GetValues(const RecursiveUnifiedVectorFormat &vec)
The 'values' list.
Definition duckdb.cpp:138679
static DUCKDB_API const UnifiedVectorFormat & GetValuesTypeId(const RecursiveUnifiedVectorFormat &vec)
The 'type_id' inside the 'values' list.
Definition duckdb.cpp:138683
static DUCKDB_API const UnifiedVectorFormat & GetKeys(const RecursiveUnifiedVectorFormat &vec)
The 'keys' list (dictionary).
Definition duckdb.cpp:138659
static DUCKDB_API const UnifiedVectorFormat & GetChildren(const RecursiveUnifiedVectorFormat &vec)
The 'children' list.
Definition duckdb.cpp:138667
static DUCKDB_API const UnifiedVectorFormat & GetChildrenValuesIndex(const RecursiveUnifiedVectorFormat &vec)
The 'values_index' inside the 'children' list.
Definition duckdb.cpp:138675
static DUCKDB_API const UnifiedVectorFormat & GetValuesByteOffset(const RecursiveUnifiedVectorFormat &vec)
The 'byte_offset' inside the 'values' list.
Definition duckdb.cpp:138688
static DUCKDB_API const UnifiedVectorFormat & GetData(const RecursiveUnifiedVectorFormat &vec)
The binary blob 'data' encoding the Variant for the row.
Definition duckdb.cpp:138693
static DUCKDB_API const UnifiedVectorFormat & GetChildrenKeysIndex(const RecursiveUnifiedVectorFormat &vec)
The 'keys_index' inside the 'children' list.
Definition duckdb.cpp:138671
Here is the call graph for this function:

◆ FinalizeVariantKeys()

void duckdb::VariantUtils::FinalizeVariantKeys ( Vector & variant,
OrderedOwningStringMap< uint32_t > & dictionary,
SelectionVector & sel,
idx_t sel_size )
static

Adjust the selection vector to point to the right dictionary index

238628 {
238629 auto &keys = VariantVector::GetKeys(variant);
238630 auto &keys_entry = ListVector::GetEntry(keys);
238631 auto keys_entry_data = FlatVector::GetData<string_t>(keys_entry);
238632
238633 bool already_sorted = true;
238634
238635 vector<uint32_t> unsorted_to_sorted(dictionary.size());
238636 auto it = dictionary.begin();
238637 for (uint32_t sorted_idx = 0; sorted_idx < dictionary.size(); sorted_idx++) {
238638 auto unsorted_idx = it->second;
238639 if (unsorted_idx != sorted_idx) {
238640 already_sorted = false;
238641 }
238642 unsorted_to_sorted[unsorted_idx] = sorted_idx;
238643 D_ASSERT(sorted_idx < ListVector::GetListSize(keys));
238644 keys_entry_data[sorted_idx] = it->first;
238645 auto size = static_cast<uint32_t>(keys_entry_data[sorted_idx].GetSize());
238646 keys_entry_data[sorted_idx].SetSizeAndFinalize(size, size);
238647 it++;
238648 }
238649
238650 if (!already_sorted) {
238652 for (idx_t i = 0; i < sel_size; i++) {
238653 auto &entry = sel[i];
238654 auto sorted_idx = unsorted_to_sorted[entry];
238655 entry = sorted_idx;
238656 }
238657 }
238658}
GOpaque< Size > size(const GMat &src)
static DUCKDB_API const Vector & GetEntry(const Vector &vector)
Gets a reference to the underlying child-vector of a list.
Definition duckdb.cpp:138203
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
static DUCKDB_API Vector & GetKeys(Vector &vec)
Gets a reference to the 'keys' list (dictionary) of a Variant.
Definition duckdb.cpp:138595
Here is the call graph for this function:
Here is the caller graph for this function:

◆ VariantExtract()

void duckdb::VariantUtils::VariantExtract ( Vector & input,
const vector< VariantPathComponent > & components,
Vector & result,
idx_t count )
static

Extract always starts by looking at value_index 0

Perform the extract

Look up the value_index of the child we're extracting

No child could be extracted, set to NULL

Get the index into 'values'

We reference the input, creating a dictionary over the 'values' list entry to remap what value_index 0 points to. This way we can perform a zero-copy extract on the variant column (when there are no nulls). The following code looks complicated but is necessary to avoid modifying the 'input'

Create a new Variant that references the existing data of the input Variant

Copy the existing 'values' list entry data

Prepare the selection vector to remap index 0 of each row

Create a copy of the vector, because we used Reference before, and we now need to adjust the data Which is a problem if we're still sharing the memory with 'input'

237858 {
237859 auto &allocator = Allocator::DefaultAllocator();
237860
237861 RecursiveUnifiedVectorFormat source_format;
237862 Vector::RecursiveToUnifiedFormat(variant_vec, count, source_format);
237863
237864 UnifiedVariantVectorData variant(source_format);
237865
237867 SelectionVector value_index_sel;
237868 value_index_sel.Initialize(count);
237869
237870 SelectionVector new_value_index_sel;
237871 new_value_index_sel.Initialize(count);
237872
237873 for (idx_t i = 0; i < count; i++) {
237874 value_index_sel[i] = 0;
237875 }
237876
237877 auto owned_nested_data = allocator.Allocate(sizeof(VariantNestedData) * count);
237878 auto nested_data = reinterpret_cast<VariantNestedData *>(owned_nested_data.get());
237879
237881 ValidityMask validity(count);
237882 for (idx_t i = 0; i < components.size(); i++) {
237883 auto &component = components[i];
237884 auto &input_indices = i % 2 == 0 ? value_index_sel : new_value_index_sel;
237885 auto &output_indices = i % 2 == 0 ? new_value_index_sel : value_index_sel;
237886
237887 auto expected_type = component.lookup_mode == VariantChildLookupMode::BY_INDEX ? VariantLogicalType::ARRAY
237888 : VariantLogicalType::OBJECT;
237889
237890 (void)VariantUtils::CollectNestedData(variant, expected_type, input_indices, count, optional_idx(), 0,
237891 nested_data, validity);
237893 ValidityMask lookup_validity(count);
237894 VariantUtils::FindChildValues(variant, component, nullptr, output_indices, lookup_validity, nested_data,
237895 validity, count);
237896
237897 for (idx_t j = 0; j < count; j++) {
237898 if (!validity.RowIsValid(j)) {
237899 continue;
237900 }
237901 if (!lookup_validity.AllValid() && !lookup_validity.RowIsValid(j)) {
237903 validity.SetInvalid(j);
237904 continue;
237905 }
237907 auto type_id = variant.GetTypeId(j, output_indices[j]);
237908 if (type_id == VariantLogicalType::VARIANT_NULL) {
237909 validity.SetInvalid(j);
237910 }
237911 }
237912 }
237913
237917
237918 auto &values = UnifiedVariantVector::GetValues(source_format);
237919 auto values_data = values.GetData<list_entry_t>(values);
237920 auto &raw_values = VariantVector::GetValues(variant_vec);
237921 auto values_list_size = ListVector::GetListSize(raw_values);
237922
237924 result.Initialize(false, count);
237928
237930 auto &result_values = VariantVector::GetValues(result);
237931 result_values.Initialize(false, count);
237932 ListVector::Reserve(result_values, values_list_size);
237933 ListVector::SetListSize(result_values, values_list_size);
237934 auto result_values_data = FlatVector::GetData<list_entry_t>(result_values);
237935 auto &result_values_validity = FlatVector::Validity(result_values);
237936 for (idx_t i = 0; i < count; i++) {
237937 if (!validity.RowIsValid(i)) {
237938 result_values_validity.SetInvalid(i);
237939 continue;
237940 }
237941 result_values_data[i] = values_data[values.sel->get_index(i)];
237942 }
237943
237944 auto &result_indices = components.size() % 2 == 0 ? value_index_sel : new_value_index_sel;
237945
237947 SelectionVector new_sel(0, values_list_size);
237948 for (idx_t i = 0; i < count; i++) {
237949 if (!validity.RowIsValid(i)) {
237950 continue;
237951 }
237952 auto &list_entry = values_data[values.sel->get_index(i)];
237953 new_sel.set_index(list_entry.offset, list_entry.offset + result_indices[i]);
237954 }
237955
237956 auto &result_type_id = VariantVector::GetValuesTypeId(result);
237957 auto &result_byte_offset = VariantVector::GetValuesByteOffset(result);
237958
237959 result_type_id.Dictionary(VariantVector::GetValuesTypeId(variant_vec), values_list_size, new_sel, values_list_size);
237960 result_byte_offset.Dictionary(VariantVector::GetValuesByteOffset(variant_vec), values_list_size, new_sel,
237961 values_list_size);
237962
237963 if (!validity.AllValid()) {
237966 Vector other(result.GetType(), count);
237967 VectorOperations::Copy(result, other, count, 0, 0);
237968 result.Reference(other);
237969
237970 for (idx_t i = 0; i < count; i++) {
237971 if (!validity.RowIsValid(i)) {
237972 FlatVector::SetNull(result, i, true);
237973 }
237974 }
237975 }
237976
237977 if (variant_vec.GetVectorType() == VectorType::CONSTANT_VECTOR) {
237978 result.SetVectorType(VectorType::CONSTANT_VECTOR);
237979 }
237980 result.Verify(count);
237981}
DUCKDB_API void Reference(const Value &value)
Create a vector that references the specified value.
Definition duckdb.cpp:135784
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
static DUCKDB_API void Reserve(Vector &vec, idx_t required_capacity)
Sets the total capacity of the underlying child-vector of a list.
Definition duckdb.cpp:138211
static DUCKDB_API VariantNestedDataCollectionResult CollectNestedData(const UnifiedVariantVectorData &variant, VariantLogicalType expected_type, const SelectionVector &value_index_sel, idx_t count, optional_idx row, idx_t offset, VariantNestedData *child_data, ValidityMask &validity)
Definition duckdb.cpp:238583
static DUCKDB_API void FindChildValues(const UnifiedVariantVectorData &variant, const VariantPathComponent &component, optional_ptr< const SelectionVector > sel, SelectionVector &res, ValidityMask &res_validity, const VariantNestedData *nested_data, const ValidityMask &validity, idx_t count)
Definition duckdb.cpp:238520
static DUCKDB_API Vector & GetValuesTypeId(Vector &vec)
Gets a reference to the 'type_id' inside the 'values' list of a Variant.
Definition duckdb.cpp:138634
static DUCKDB_API Vector & GetValuesByteOffset(Vector &vec)
Gets a reference to the 'byte_offset' inside the 'values' list of a Variant.
Definition duckdb.cpp:138643
static DUCKDB_API Vector & GetData(Vector &vec)
Gets a reference to the binary blob 'value', which encodes the data of the row.
Definition duckdb.cpp:138652
static DUCKDB_API Vector & GetChildren(Vector &vec)
Gets a reference to the 'children' list of a Variant.
Definition duckdb.cpp:138602
static DUCKDB_API Vector & GetValues(Vector &vec)
Gets a reference to the 'values' list of a Variant.
Definition duckdb.cpp:138627
Here is the call graph for this function:
Here is the caller graph for this function:

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