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

Public Member Functions

 DefaultFunctionGenerator (Catalog &catalog, SchemaCatalogEntry &schema)
 
unique_ptr< CatalogEntryCreateDefaultEntry (ClientContext &context, const string &entry_name) override
 Creates a default entry with the specified name, or returns nullptr if no such entry can be generated.
 
vector< string > GetDefaultEntries () override
 Get a list of all default entries in the generator.
 
- Public Member Functions inherited from duckdb::DefaultGenerator
 DefaultGenerator (Catalog &catalog)
 
virtual unique_ptr< CatalogEntryCreateDefaultEntry (CatalogTransaction transaction, const string &entry_name)
 
virtual bool LockDuringCreate () const
 

Static Public Member Functions

static DUCKDB_API unique_ptr< CreateMacroInfoCreateInternalMacroInfo (const DefaultMacro &default_macro)
 
static DUCKDB_API unique_ptr< CreateMacroInfoCreateInternalMacroInfo (array_ptr< const DefaultMacro > macro)
 

Public Attributes

SchemaCatalogEntryschema
 
- Public Attributes inherited from duckdb::DefaultGenerator
Catalogcatalog
 
atomic< bool > created_all_entries
 

Constructor & Destructor Documentation

◆ DefaultFunctionGenerator()

duckdb::DefaultFunctionGenerator::DefaultFunctionGenerator ( Catalog catalog,
SchemaCatalogEntry schema 
)
24242 : DefaultGenerator(catalog), schema(schema) {
24243}

Member Function Documentation

◆ CreateInternalMacroInfo() [1/2]

unique_ptr< CreateMacroInfo > duckdb::DefaultFunctionGenerator::CreateInternalMacroInfo ( const DefaultMacro default_macro)
static
24182 {
24183 return CreateInternalMacroInfo(array_ptr<const DefaultMacro>(default_macro));
24184}

◆ CreateInternalMacroInfo() [2/2]

unique_ptr< CreateMacroInfo > duckdb::DefaultFunctionGenerator::CreateInternalMacroInfo ( array_ptr< const DefaultMacro macro)
static
24187 {
24188 auto type = CatalogType::MACRO_ENTRY;
24189 auto bind_info = make_uniq<CreateMacroInfo>(type);
24190 for(auto &default_macro : macros) {
24191 // parse the expression
24192 auto expressions = Parser::ParseExpressionList(default_macro.macro);
24193 D_ASSERT(expressions.size() == 1);
24194
24195 auto function = make_uniq<ScalarMacroFunction>(std::move(expressions[0]));
24196 for (idx_t param_idx = 0; default_macro.parameters[param_idx] != nullptr; param_idx++) {
24197 function->parameters.push_back(
24198 make_uniq<ColumnRefExpression>(default_macro.parameters[param_idx]));
24199 }
24200 for (idx_t named_idx = 0; default_macro.named_parameters[named_idx].name != nullptr; named_idx++) {
24201 const auto &named_param = default_macro.named_parameters[named_idx];
24202 auto expr_list = Parser::ParseExpressionList(named_param.default_value);
24203 if (expr_list.size() != 1) {
24204 throw InternalException("Expected a single expression");
24205 }
24206 function->parameters.push_back(make_uniq<ColumnRefExpression>(named_param.name));
24207 function->default_parameters.insert(make_pair(named_param.name, std::move(expr_list[0])));
24208 }
24209 D_ASSERT(function->type == MacroType::SCALAR_MACRO);
24210 bind_info->macros.push_back(std::move(function));
24211 }
24212 bind_info->schema = macros[0].schema;
24213 bind_info->name = macros[0].name;
24214 bind_info->temporary = true;
24215 bind_info->internal = true;
24216 return bind_info;
24217}
static DUCKDB_API vector< unique_ptr< ParsedExpression > > ParseExpressionList(const string &select_list, ParserOptions options=ParserOptions())
Parses a list of expressions (i.e. the list found in a SELECT clause)

◆ CreateDefaultEntry()

unique_ptr< CatalogEntry > duckdb::DefaultFunctionGenerator::CreateDefaultEntry ( ClientContext context,
const string &  entry_name 
)
overridevirtual

Creates a default entry with the specified name, or returns nullptr if no such entry can be generated.

Reimplemented from duckdb::DefaultGenerator.

24246 {
24247 auto info = GetDefaultFunction(schema.name, entry_name);
24248 if (info) {
24249 return make_uniq_base<CatalogEntry, ScalarMacroCatalogEntry>(catalog, schema, info->Cast<CreateMacroInfo>());
24250 }
24251 return nullptr;
24252}
string name
The name of the entry.
Definition duckdb.hpp:6311

◆ GetDefaultEntries()

vector< string > duckdb::DefaultFunctionGenerator::GetDefaultEntries ( )
overridevirtual

Get a list of all default entries in the generator.

Implements duckdb::DefaultGenerator.

24254 {
24255 vector<string> result;
24256 for (idx_t index = 0; internal_macros[index].name != nullptr; index++) {
24257 if (StringUtil::Lower(internal_macros[index].name) != internal_macros[index].name) {
24258 throw InternalException("Default macro name %s should be lowercase", internal_macros[index].name);
24259 }
24260 if (internal_macros[index].schema == schema.name) {
24261 result.emplace_back(internal_macros[index].name);
24262 }
24263 }
24264 return result;
24265}
static DUCKDB_API string Lower(const string &str)
Convert a string to lowercase.
index
Here is the call graph for this function:

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