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

PhysicalSet represents a SET operation (e.g. SET a = 42). More...

Inheritance diagram for duckdb::PhysicalSet:
Collaboration diagram for duckdb::PhysicalSet:

Public Member Functions

 PhysicalSet (PhysicalPlan &physical_plan, const string &name_p, Value value_p, SetScope scope_p, idx_t estimated_cardinality)
SourceResultType GetDataInternal (ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override
bool IsSource () const override
Public Member Functions inherited from duckdb::PhysicalOperator
 PhysicalOperator (PhysicalPlan &physical_plan, PhysicalOperatorType type, vector< LogicalType > types, idx_t estimated_cardinality)
 PhysicalOperator (const PhysicalOperator &other)=delete
 Deleted copy constructors.
PhysicalOperator & operator= (const PhysicalOperator &)=delete
virtual string GetName () const
virtual InsertionOrderPreservingMap< string > ParamsToString () const
virtual string ToString (ExplainFormat format=ExplainFormat::DEFAULT) const
void Print () const
virtual vector< const_reference< PhysicalOperator > > GetChildren () const
const vector< LogicalType > & GetTypes () const
 Return a vector of the types that will be returned by this operator.
virtual bool Equals (const PhysicalOperator &other) const
idx_t EstimatedThreadCount () const
 Functions to help decide how to set up pipeline dependencies.
bool CanSaturateThreads (ClientContext &context) const
virtual void Verify ()
virtual unique_ptr< OperatorState > GetOperatorState (ExecutionContext &context) const
virtual unique_ptr< GlobalOperatorState > GetGlobalOperatorState (ClientContext &context) const
virtual OperatorResultType Execute (ExecutionContext &context, DataChunk &input, DataChunk &chunk, GlobalOperatorState &gstate, OperatorState &state) const
virtual OperatorFinalizeResultType FinalExecute (ExecutionContext &context, DataChunk &chunk, GlobalOperatorState &gstate, OperatorState &state) const
virtual OperatorFinalResultType OperatorFinalize (Pipeline &pipeline, Event &event, ClientContext &context, OperatorFinalizeInput &input) const
virtual bool ParallelOperator () const
virtual bool RequiresFinalExecute () const
virtual bool RequiresOperatorFinalize () const
virtual OrderPreservationType OperatorOrder () const
 The influence the operator has on order (insertion order means no influence).
virtual unique_ptr< LocalSourceState > GetLocalSourceState (ExecutionContext &context, GlobalSourceState &gstate) const
virtual unique_ptr< GlobalSourceState > GetGlobalSourceState (ClientContext &context) const
SourceResultType GetData (ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const
virtual OperatorPartitionData GetPartitionData (ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate, LocalSourceState &lstate, const OperatorPartitionInfo &partition_info) const
virtual bool ParallelSource () const
virtual bool SupportsPartitioning (const OperatorPartitionInfo &partition_info) const
virtual OrderPreservationType SourceOrder () const
 The type of order emitted by the operator (as a source).
virtual ProgressData GetProgress (ClientContext &context, GlobalSourceState &gstate) const
 Returns the current progress percentage, or a negative value if progress bars are not supported.
virtual ProgressData GetSinkProgress (ClientContext &context, GlobalSinkState &gstate, const ProgressData source_progress) const
 Returns the current progress percentage, or a negative value if progress bars are not supported.
virtual InsertionOrderPreservingMap< string > ExtraSourceParams (GlobalSourceState &gstate, LocalSourceState &lstate) const
virtual SinkResultType Sink (ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const
virtual SinkCombineResultType Combine (ExecutionContext &context, OperatorSinkCombineInput &input) const
virtual void PrepareFinalize (ClientContext &context, GlobalSinkState &sink_state) const
virtual SinkFinalizeType Finalize (Pipeline &pipeline, Event &event, ClientContext &context, OperatorSinkFinalizeInput &input) const
virtual SinkNextBatchType NextBatch (ExecutionContext &context, OperatorSinkNextBatchInput &input) const
virtual unique_ptr< LocalSinkState > GetLocalSinkState (ExecutionContext &context) const
virtual unique_ptr< GlobalSinkState > GetGlobalSinkState (ClientContext &context) const
virtual bool IsSink () const
virtual bool ParallelSink () const
virtual OperatorPartitionInfo RequiredPartitionInfo () const
virtual bool SinkOrderDependent () const
virtual vector< const_reference< PhysicalOperator > > GetSources () const
bool AllSourcesSupportBatchIndex () const
virtual void BuildPipelines (Pipeline &current, MetaPipeline &meta_pipeline)
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Static Public Member Functions

static void SetExtensionVariable (ClientContext &context, ExtensionOption &extension_option, const String &name, SetScope scope, const Value &value)
static void SetGenericVariable (ClientContext &context, idx_t setting_index, SetScope scope, Value target_value)
static SetScope GetSettingScope (const ConfigurationOption &option, SetScope variable_scope)
Static Public Member Functions inherited from duckdb::PhysicalOperator
static void SetEstimatedCardinality (InsertionOrderPreservingMap< string > &result, idx_t estimated_cardinality)
static idx_t GetMaxThreadMemory (ClientContext &context)
 The maximum amount of memory the operator should use per thread.
static OperatorCachingMode SelectOperatorCachingMode (ExecutionContext &context)
 Whether operator caching is allowed in the current execution context.

Public Attributes

String name
const Value value
const SetScope scope
Public Attributes inherited from duckdb::PhysicalOperator
ArenaLinkedList< reference< PhysicalOperator > > children
 The child operators.
PhysicalOperatorType type
 The physical operator type.
vector< LogicalType > types
 The return types.
idx_t estimated_cardinality
 The estimated cardinality.
unique_ptr< GlobalSinkState > sink_state
 The global sink state.
unique_ptr< GlobalOperatorState > op_state
 The global operator state.
mutex lock
 Lock for (re)setting any of the operator states.

Static Public Attributes

static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::SET
Static Public Attributes inherited from duckdb::PhysicalOperator
static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::INVALID

Detailed Description

PhysicalSet represents a SET operation (e.g. SET a = 42).

Constructor & Destructor Documentation

◆ PhysicalSet()

duckdb::PhysicalSet::PhysicalSet ( PhysicalPlan & physical_plan,
const string & name_p,
Value value_p,
SetScope scope_p,
idx_t estimated_cardinality )
inline
179402 : PhysicalOperator(physical_plan, PhysicalOperatorType::SET, {LogicalType::BOOLEAN}, estimated_cardinality),
179403 name(physical_plan.ArenaRef().MakeString(name_p)), value(std::move(value_p)), scope(scope_p) {
179404 }
idx_t estimated_cardinality
The estimated cardinality.
Definition duckdb.hpp:22154

Member Function Documentation

◆ GetDataInternal()

SourceResultType duckdb::PhysicalSet::GetDataInternal ( ExecutionContext & context,
DataChunk & chunk,
OperatorSourceInput & input ) const
overridevirtual

Reimplemented from duckdb::PhysicalOperator.

179665 {
179666 auto &config = DBConfig::GetConfig(context.client);
179667 // check if we are allowed to change the configuration option
179668 config.CheckLock(name);
179669 auto option = DBConfig::GetOptionByName(name);
179670 if (!option) {
179671 ExtensionOption extension_option;
179672 // check if this is an extra extension variable
179673 if (!config.TryGetExtensionOption(name, extension_option)) {
179674 auto extension_name = Catalog::AutoloadExtensionByConfigName(context.client, name);
179675 if (!config.TryGetExtensionOption(name, extension_option)) {
179676 throw InvalidInputException("Extension parameter %s was not found after autoloading", name);
179677 }
179678 }
179679 SetExtensionVariable(context.client, extension_option, name, scope, value);
179680 return SourceResultType::FINISHED;
179681 }
179682 SetScope variable_scope = GetSettingScope(*option, scope);
179683
179684 Value input_val = value.CastAs(context.client, DBConfig::ParseLogicalType(option->parameter_type));
179685 if (option->default_value) {
179686 if (option->set_callback) {
179687 SettingCallbackInfo info(context.client, variable_scope);
179688 option->set_callback(info, input_val);
179689 }
179690 auto setting_index = option->setting_idx.GetIndex();
179691 SetGenericVariable(context.client, setting_index, variable_scope, std::move(input_val));
179692 return SourceResultType::FINISHED;
179693 }
179694 switch (variable_scope) {
179695 case SetScope::GLOBAL: {
179696 if (!option->set_global) {
179697 throw CatalogException("option \"%s\" cannot be set globally", name);
179698 }
179699 auto &db = DatabaseInstance::GetDatabase(context.client);
179700 config.SetOption(&db, *option, input_val);
179701 break;
179702 }
179703 case SetScope::SESSION:
179704 if (!option->set_local) {
179705 throw CatalogException("option \"%s\" cannot be set locally", name);
179706 }
179707 option->set_local(context.client, input_val);
179708 break;
179709 default:
179710 throw InternalException("Unsupported SetScope for variable");
179711 }
179712
179713 return SourceResultType::FINISHED;
179714}
static String AutoloadExtensionByConfigName(ClientContext &context, const String &configuration_name)
Autoload the extension required for configuration_name or throw a CatalogException.
Definition duckdb.cpp:7659
db
static DUCKDB_API optional_ptr< const ConfigurationOption > GetOptionByName(const String &name)
Fetch an option by name. Returns a pointer to the option, or nullptr if none exists.
Definition duckdb.cpp:274813

◆ IsSource()

bool duckdb::PhysicalSet::IsSource ( ) const
inlineoverridevirtual

Reimplemented from duckdb::PhysicalOperator.

179411 {
179412 return true;
179413 }

◆ SetExtensionVariable()

void duckdb::PhysicalSet::SetExtensionVariable ( ClientContext & context,
ExtensionOption & extension_option,
const String & name,
SetScope scope,
const Value & value )
static
179620 {
179621 auto &target_type = extension_option.type;
179622 Value target_value = value.CastAs(context, target_type);
179623 if (extension_option.set_function) {
179624 extension_option.set_function(context, scope, target_value);
179625 }
179626 if (scope == SetScope::AUTOMATIC) {
179627 scope = extension_option.default_scope;
179628 }
179629 auto setting_index = extension_option.setting_index.GetIndex();
179630 SetGenericVariable(context, setting_index, scope, std::move(target_value));
179631}

◆ SetGenericVariable()

void duckdb::PhysicalSet::SetGenericVariable ( ClientContext & context,
idx_t setting_index,
SetScope scope,
Value target_value )
static
179609 {
179610 if (scope == SetScope::GLOBAL) {
179611 auto &config = DBConfig::GetConfig(context);
179612 config.SetOption(setting_index, std::move(target_value));
179613 } else {
179614 auto &client_config = ClientConfig::GetConfig(context);
179615 client_config.user_settings.SetUserSetting(setting_index, std::move(target_value));
179616 }
179617}

◆ GetSettingScope()

SetScope duckdb::PhysicalSet::GetSettingScope ( const ConfigurationOption & option,
SetScope variable_scope )
static
179633 {
179634 if (variable_scope == SetScope::AUTOMATIC) {
179635 if (option.set_local) {
179636 return SetScope::SESSION;
179637 }
179638 if (option.set_global) {
179639 return SetScope::GLOBAL;
179640 }
179641 // generic setting
179642 switch (option.scope) {
179645 return SetScope::SESSION;
179648 return SetScope::GLOBAL;
179649 default:
179650 throw InvalidInputException("Setting \"%s\" does not have a valid scope defined", option.name);
179651 }
179652 }
179653 if (variable_scope == SetScope::SESSION && option.scope == SettingScopeTarget::GLOBAL_ONLY) {
179654 throw InvalidInputException("Setting \"%s\" cannot be set as a session variable - it can only be set globally",
179655 option.name);
179656 }
179657 if (variable_scope == SetScope::GLOBAL && option.scope == SettingScopeTarget::LOCAL_ONLY) {
179658 throw InvalidInputException(
179659 "Setting \"%s\" cannot be set as a global variable - it can only be set per session", option.name);
179660 }
179661 return variable_scope;
179662}
@ LOCAL_ONLY
Setting can be set in local scope only.
Definition duckdb.hpp:37024
@ GLOBAL_ONLY
Setting can be set in global scope only.
Definition duckdb.hpp:37022
@ GLOBAL_DEFAULT
Setting can be set in both scopes - but defaults to global.
Definition duckdb.hpp:37026
@ LOCAL_DEFAULT
Setting can be set in both scopes - but defaults to local.
Definition duckdb.hpp:37028

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