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

Static Public Member Functions

static vector< Value > GenerateValues (TestVectorInfo &info, const LogicalType &type)
static TestGeneratedValues GenerateValues (TestVectorInfo &info)
static void Generate (TestVectorInfo &info)

Static Public Attributes

static constexpr const idx_t TEST_VECTOR_CARDINALITY = 3

Member Function Documentation

◆ GenerateValues() [1/2]

vector< Value > duckdb::TestVectorFlat::GenerateValues ( TestVectorInfo & info,
const LogicalType & type )
inlinestatic
250786 {
250787 vector<Value> result;
250788 switch (type.InternalType()) {
250789 case PhysicalType::STRUCT: {
250790 vector<child_list_t<Value>> struct_children;
250791 auto &child_types = StructType::GetChildTypes(type);
250792
250793 struct_children.resize(TEST_VECTOR_CARDINALITY);
250794 for (auto &child_type : child_types) {
250795 auto child_values = GenerateValues(info, child_type.second);
250796
250797 for (idx_t i = 0; i < child_values.size(); i++) {
250798 struct_children[i].push_back(make_pair(child_type.first, std::move(child_values[i])));
250799 }
250800 }
250801 for (auto &struct_child : struct_children) {
250802 result.push_back(Value::STRUCT(std::move(struct_child)));
250803 }
250804 break;
250805 }
250806 case PhysicalType::LIST: {
250807 if (type.id() == LogicalTypeId::MAP) {
250808 auto &child_type = ListType::GetChildType(type);
250809 auto child_values = GenerateValues(info, child_type);
250810 result.push_back(Value::MAP(child_type, {child_values[0]}));
250811 result.push_back(Value(type));
250812 result.push_back(Value::MAP(child_type, {child_values[1]}));
250813 break;
250814 }
250815 auto &child_type = ListType::GetChildType(type);
250816 auto child_values = GenerateValues(info, child_type);
250817
250818 result.push_back(Value::LIST(child_type, {child_values[0], child_values[1]}));
250819 result.push_back(Value::LIST(child_type, {}));
250820 result.push_back(Value::LIST(child_type, {child_values[2]}));
250821 break;
250822 }
250823 default: {
250824 auto entry = info.test_type_map.find(type.id());
250825 if (entry == info.test_type_map.end()) {
250826 throw NotImplementedException("Unimplemented type for test_vector_types %s", type.ToString());
250827 }
250828 result.push_back(entry->second.min_value);
250829 result.push_back(entry->second.max_value);
250830 result.emplace_back(type);
250831 break;
250832 }
250833 }
250834 return result;
250835 }
static DUCKDB_API Value MAP(const LogicalType &child_type, vector< Value > values)
Create a map value with the given entries.
Definition duckdb.cpp:132466
static DUCKDB_API Value LIST(const LogicalType &child_type, vector< Value > values)
Create a list value with the given entries.
Definition duckdb.cpp:132555
static DUCKDB_API Value STRUCT(child_list_t< Value > values)
Create a struct value with given list of entries.
Definition duckdb.cpp:132434
@ LIST
A list of some logical data type.
Definition duckdb.hpp:2813
@ STRUCT
Struct of logical types.
Definition duckdb.hpp:2816
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ GenerateValues() [2/2]

TestGeneratedValues duckdb::TestVectorFlat::GenerateValues ( TestVectorInfo & info)
inlinestatic
250837 {
250838 // generate the values for each column
250839 TestGeneratedValues generated_values;
250840 for (auto &type : info.types) {
250841 generated_values.AddColumn(GenerateValues(info, type));
250842 }
250843 return generated_values;
250844 }

◆ Generate()

void duckdb::TestVectorFlat::Generate ( TestVectorInfo & info)
inlinestatic
250846 {
250847 auto result_values = GenerateValues(info);
250848 for (idx_t cur_row = 0; cur_row < result_values.Rows(); cur_row += STANDARD_VECTOR_SIZE) {
250849 auto result = make_uniq<DataChunk>();
250850 result->Initialize(Allocator::DefaultAllocator(), info.types);
250851 auto cardinality = MinValue<idx_t>(STANDARD_VECTOR_SIZE, result_values.Rows() - cur_row);
250852 for (idx_t c = 0; c < info.types.size(); c++) {
250853 for (idx_t i = 0; i < cardinality; i++) {
250854 result->data[c].SetValue(i, result_values.GetValue(cur_row + i, c));
250855 }
250856 }
250857 result->SetCardinality(cardinality);
250858 info.entries.push_back(std::move(result));
250859 }
250860 }

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