Turns "vector" into a constant vector by referencing a value within the source vector.
137793 {
137794 auto &source_type = source.GetType();
137795 switch (source_type.InternalType()) {
137797
137798 UnifiedVectorFormat vdata;
137799 source.ToUnifiedFormat(count, vdata);
137800
137801 auto list_index = vdata.sel->get_index(position);
137802 if (!vdata.validity.RowIsValid(list_index)) {
137803
137804 Value null_value(source_type);
137805 vector.Reference(null_value);
137806 break;
137807 }
137808
137809 auto list_data = UnifiedVectorFormat::GetData<list_entry_t>(vdata);
137810 auto list_entry = list_data[list_index];
137811
137812
137813
137814 auto target_data = FlatVector::GetData<list_entry_t>(vector);
137815 target_data[0] = list_entry;
137816
137817
137820
137822 vector.SetVectorType(VectorType::CONSTANT_VECTOR);
137823 break;
137824 }
137825 case PhysicalType::ARRAY: {
137826 UnifiedVectorFormat vdata;
137827 source.ToUnifiedFormat(count, vdata);
137828 auto source_idx = vdata.sel->get_index(position);
137829 if (!vdata.validity.RowIsValid(source_idx)) {
137830
137831 Value null_value(source_type);
137832 vector.Reference(null_value);
137833 break;
137834 }
137835
137836
137839 target_child.Reference(source_child);
137840
137841
137842 auto array_size = ArrayType::GetSize(source_type);
137843 SelectionVector sel(array_size);
137844 for (
idx_t i = 0; i < array_size; i++) {
137845 sel.set_index(i, array_size * source_idx + i);
137846 }
137847 target_child.Slice(sel, array_size);
137848 target_child.Flatten(array_size);
137849
137850 vector.SetVectorType(VectorType::CONSTANT_VECTOR);
137851 vector.validity.Set(0, true);
137852 break;
137853 }
137855 UnifiedVectorFormat vdata;
137856 source.ToUnifiedFormat(count, vdata);
137857
137858 auto struct_index = vdata.sel->get_index(position);
137859 if (!vdata.validity.RowIsValid(struct_index)) {
137860
137861 Value null_value(source_type);
137862 vector.Reference(null_value);
137863 break;
137864 }
137865
137866
137867 auto &source_entries = StructVector::GetEntries(source);
137868 auto &target_entries = StructVector::GetEntries(vector);
137869 for (
idx_t i = 0; i < source_entries.size(); i++) {
137871 }
137872 vector.SetVectorType(VectorType::CONSTANT_VECTOR);
137873 vector.validity.Set(0, true);
137874 break;
137875 }
137876 default:
137877
137878
137879 auto value = source.GetValue(position);
137880 vector.Reference(value);
137881 D_ASSERT(vector.GetVectorType() == VectorType::CONSTANT_VECTOR);
137882 break;
137883 }
137884}
@ LIST
A list of some logical data type.
Definition duckdb.hpp:2813
static DUCKDB_API void Reference(Vector &vector, Vector &source, idx_t position, idx_t count)
Turns "vector" into a constant vector by referencing a value within the source vector.
Definition duckdb.cpp:137793
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 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 idx_t GetListSize(const Vector &vector)
Gets the total size of the underlying child-vector of a list.
Definition duckdb.cpp:138221