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::CommonTableExpressionMap Class Reference
Collaboration diagram for duckdb::CommonTableExpressionMap:

Public Member Functions

string ToString () const
CommonTableExpressionMap Copy () const
void Serialize (Serializer &serializer) const

Static Public Member Functions

static CommonTableExpressionMap Deserialize (Deserializer &deserializer)

Public Attributes

InsertionOrderPreservingMap< unique_ptr< CommonTableExpressionInfo > > map

Constructor & Destructor Documentation

◆ CommonTableExpressionMap()

duckdb::CommonTableExpressionMap::CommonTableExpressionMap ( )
348446 {
348447}

Member Function Documentation

◆ ToString()

string duckdb::CommonTableExpressionMap::ToString ( ) const
348467 {
348468 if (map.empty()) {
348469 return string();
348470 }
348471 // check if there are any recursive CTEs
348472 bool has_recursive = false;
348473 for (auto &kv : map) {
348474 if (kv.second->query->node->type == QueryNodeType::RECURSIVE_CTE_NODE) {
348475 has_recursive = true;
348476 break;
348477 }
348478 }
348479 string result = "WITH ";
348480 if (has_recursive) {
348481 result += "RECURSIVE ";
348482 }
348483 bool first_cte = true;
348484
348485 for (auto &kv : map) {
348486 if (!first_cte) {
348487 result += ", ";
348488 }
348489 auto &cte = *kv.second;
348490 result += KeywordHelper::WriteOptionallyQuoted(kv.first);
348491 if (!cte.aliases.empty()) {
348492 result += " (";
348493 for (idx_t k = 0; k < cte.aliases.size(); k++) {
348494 if (k > 0) {
348495 result += ", ";
348496 }
348497 result += KeywordHelper::WriteOptionallyQuoted(cte.aliases[k]);
348498 }
348499 result += ")";
348500 }
348501 if (!cte.key_targets.empty()) {
348502 result += " USING KEY (";
348503 for (idx_t k = 0; k < cte.key_targets.size(); k++) {
348504 if (k > 0) {
348505 result += ", ";
348506 }
348507 result += cte.key_targets[k]->ToString();
348508 }
348509 result += ") ";
348510 }
348511 if (kv.second->materialized == CTEMaterialize::CTE_MATERIALIZE_ALWAYS) {
348512 result += " AS MATERIALIZED (";
348513 } else if (kv.second->materialized == CTEMaterialize::CTE_MATERIALIZE_NEVER) {
348514 result += " AS NOT MATERIALIZED (";
348515 } else {
348516 result += " AS (";
348517 }
348518 result += cte.query->ToString();
348519 result += ")";
348520 first_cte = false;
348521 }
348522 return result;
348523}
static string WriteOptionallyQuoted(const string &text, char quote='"', bool allow_caps = true, KeywordCategory category = KeywordCategory::KEYWORD_NONE)
Writes a string that is optionally quoted + escaped so it can be used as an identifier.
Definition duckdb.cpp:338034
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ Copy()

CommonTableExpressionMap duckdb::CommonTableExpressionMap::Copy ( ) const
348449 {
348450 CommonTableExpressionMap res;
348451 for (auto &kv : this->map) {
348452 auto kv_info = make_uniq<CommonTableExpressionInfo>();
348453 for (auto &al : kv.second->aliases) {
348454 kv_info->aliases.push_back(al);
348455 }
348456 for (auto &al : kv.second->key_targets) {
348457 kv_info->key_targets.push_back(al->Copy());
348458 }
348459 kv_info->query = unique_ptr_cast<SQLStatement, SelectStatement>(kv.second->query->Copy());
348460 kv_info->materialized = kv.second->materialized;
348461 res.map[kv.first] = std::move(kv_info);
348462 }
348463
348464 return res;
348465}

◆ Serialize()

void duckdb::CommonTableExpressionMap::Serialize ( Serializer & serializer) const
417452 {
417453 serializer.WritePropertyWithDefault<InsertionOrderPreservingMap<unique_ptr<CommonTableExpressionInfo>>>(100, "map", map);
417454}

◆ Deserialize()

CommonTableExpressionMap duckdb::CommonTableExpressionMap::Deserialize ( Deserializer & deserializer)
static
417456 {
417457 CommonTableExpressionMap result;
417458 deserializer.ReadPropertyWithDefault<InsertionOrderPreservingMap<unique_ptr<CommonTableExpressionInfo>>>(100, "map", result.map);
417459 return result;
417460}

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