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::UnionByName Class Reference

Static Public Member Functions

static void CombineUnionTypes (const vector< string > &new_names, const vector< LogicalType > &new_types, vector< LogicalType > &union_col_types, vector< string > &union_col_names, case_insensitive_map_t< idx_t > &union_names_map)
static vector< shared_ptr< BaseUnionData > > UnionCols (ClientContext &context, const vector< OpenFileInfo > &files, vector< LogicalType > &union_col_types, vector< string > &union_col_names, BaseFileReaderOptions &options, MultiFileOptions &file_options, MultiFileReader &multi_file_reader, MultiFileReaderInterface &interface)
 Union all files(readers) by their col names.

Member Function Documentation

◆ CombineUnionTypes()

void duckdb::UnionByName::CombineUnionTypes ( const vector< string > & new_names,
const vector< LogicalType > & new_types,
vector< LogicalType > & union_col_types,
vector< string > & union_col_names,
case_insensitive_map_t< idx_t > & union_names_map )
static
84886 {
84887 D_ASSERT(col_names.size() == sql_types.size());
84888
84889 for (idx_t col = 0; col < col_names.size(); ++col) {
84890 auto union_find = union_names_map.find(col_names[col]);
84891
84892 if (union_find != union_names_map.end()) {
84893 // given same name , union_col's type must compatible with col's type
84894 auto &current_type = union_col_types[union_find->second];
84895 auto compatible_type = LogicalType::ForceMaxLogicalType(current_type, sql_types[col]);
84896 union_col_types[union_find->second] = compatible_type;
84897 } else {
84898 union_names_map[col_names[col]] = union_col_names.size();
84899 union_col_names.emplace_back(col_names[col]);
84900 union_col_types.emplace_back(sql_types[col]);
84901 }
84902 }
84903}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
static DUCKDB_API LogicalType ForceMaxLogicalType(const LogicalType &left, const LogicalType &right)
Forcibly returns a maximum logical type - similar to MaxLogicalType but never throws....
Definition duckdb.cpp:140319

◆ UnionCols()

vector< shared_ptr< BaseUnionData > > duckdb::UnionByName::UnionCols ( ClientContext & context,
const vector< OpenFileInfo > & files,
vector< LogicalType > & union_col_types,
vector< string > & union_col_names,
BaseFileReaderOptions & options,
MultiFileOptions & file_options,
MultiFileReader & multi_file_reader,
MultiFileReaderInterface & interface )
static

Union all files(readers) by their col names.

85063 {
85064 vector<shared_ptr<BaseUnionData>> union_readers;
85065 union_readers.resize(files.size());
85066
85067 TaskExecutor executor(context);
85068 // schedule tasks for all files
85069 for (idx_t file_idx = 0; file_idx < files.size(); ++file_idx) {
85070 auto task = make_uniq<UnionByReaderTask>(executor, context, files[file_idx], file_idx, union_readers, options,
85071 file_options, multi_file_reader, interface);
85072 executor.ScheduleTask(std::move(task));
85073 }
85074 // complete all tasks
85075 executor.WorkOnTasks();
85076
85077 // now combine the result schemas
85078 case_insensitive_map_t<idx_t> union_names_map;
85079 for (auto &reader : union_readers) {
85080 auto &col_names = reader->names;
85081 auto &sql_types = reader->types;
85082 CombineUnionTypes(col_names, sql_types, union_col_types, union_col_names, union_names_map);
85083 }
85084 return union_readers;
85085}
Here is the call graph for this function:

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