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

LogicalInsert represents an insertion of data into a base table. More...

Inheritance diagram for duckdb::LogicalInsert:
Collaboration diagram for duckdb::LogicalInsert:

Public Member Functions

 LogicalInsert (TableCatalogEntry &table, idx_t table_index)
void Serialize (Serializer &serializer) const override
Public Member Functions inherited from duckdb::LogicalOperator
 LogicalOperator (LogicalOperatorType type)
 LogicalOperator (LogicalOperatorType type, vector< unique_ptr< Expression > > expressions)
virtual idx_t GetRootIndex ()
void PrintColumnBindings ()
void ResolveOperatorTypes ()
 Resolve the types of the logical operator and its children.
virtual InsertionOrderPreservingMap< string > ParamsToString () const
virtual string ToString (ExplainFormat format=ExplainFormat::DEFAULT) const
DUCKDB_API void Print ()
virtual void Verify (ClientContext &context)
 Debug method: verify that the integrity of expressions & child nodes are maintained.
void AddChild (unique_ptr< LogicalOperator > child)
void SetEstimatedCardinality (idx_t _estimated_cardinality)
void SetParamsEstimatedCardinality (InsertionOrderPreservingMap< string > &result) const
virtual unique_ptr< LogicalOperator > Copy (ClientContext &context) const
virtual bool RequireOptimizer () const
virtual bool SupportSerialization () const
 Allows LogicalOperators to opt out of serialization.
virtual bool HasProjectionMap () const
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Static Public Member Functions

static unique_ptr< LogicalOperator > Deserialize (Deserializer &deserializer)
Static Public Member Functions inherited from duckdb::LogicalOperator
static string ColumnBindingsToString (const vector< ColumnBinding > &bindings)
static vector< ColumnBinding > GenerateColumnBindings (idx_t table_idx, idx_t column_count)
static vector< LogicalType > MapTypes (const vector< LogicalType > &types, const vector< idx_t > &projection_map)
static vector< ColumnBinding > MapBindings (const vector< ColumnBinding > &types, const vector< idx_t > &projection_map)
static unique_ptr< LogicalOperator > Deserialize (Deserializer &deserializer)

Public Attributes

vector< vector< unique_ptr< Expression > > > insert_values
physical_index_vector_t< idx_t > column_index_map
 The insertion map ([table_index -> index in result, or DConstants::INVALID_INDEX if not specified]).
vector< LogicalType > expected_types
 The expected types for the INSERT statement (obtained from the column types).
TableCatalogEntry & table
 The base table to insert into.
idx_t table_index
bool return_chunk
 if returning option is used, return actual chunk to projection
vector< unique_ptr< Expression > > bound_defaults
 The default statements used by the table.
vector< unique_ptr< BoundConstraint > > bound_constraints
 The constraints used by the table.
BoundOnConflictInfo on_conflict_info
Public Attributes inherited from duckdb::LogicalOperator
LogicalOperatorType type
 The type of the logical operator.
vector< unique_ptr< LogicalOperator > > children
 The set of children of the operator.
vector< unique_ptr< Expression > > expressions
 The set of expressions contained within the operator, if any.
vector< LogicalType > types
 The types returned by this logical operator. Set by calling LogicalOperator::ResolveTypes.
idx_t estimated_cardinality
 Estimated Cardinality.
bool has_estimated_cardinality

Static Public Attributes

static constexpr const LogicalOperatorType TYPE = LogicalOperatorType::LOGICAL_INSERT

Protected Member Functions

vector< ColumnBinding > GetColumnBindings () override
void ResolveTypes () override
 Resolve types for this specific operator.
idx_t EstimateCardinality (ClientContext &context) override
vector< idx_t > GetTableIndex () const override
 Returns the set of table indexes of this operator.
string GetName () const override

Private Member Functions

 LogicalInsert (ClientContext &context, const unique_ptr< CreateInfo > table_info)

Detailed Description

LogicalInsert represents an insertion of data into a base table.

Constructor & Destructor Documentation

◆ LogicalInsert() [1/2]

duckdb::LogicalInsert::LogicalInsert ( TableCatalogEntry & table,
idx_t table_index )
382587 : LogicalOperator(LogicalOperatorType::LOGICAL_INSERT), table(table), table_index(table_index),
382588 return_chunk(false) {
382589}
bool return_chunk
if returning option is used, return actual chunk to projection
Definition duckdb.cpp:147566
TableCatalogEntry & table
The base table to insert into.
Definition duckdb.cpp:147563

◆ LogicalInsert() [2/2]

duckdb::LogicalInsert::LogicalInsert ( ClientContext & context,
const unique_ptr< CreateInfo > table_info )
private
382592 : LogicalOperator(LogicalOperatorType::LOGICAL_INSERT),
382593 table(Catalog::GetEntry<TableCatalogEntry>(context, table_info->catalog, table_info->schema,
382594 table_info->Cast<CreateTableInfo>().table)) {
382595 auto binder = Binder::CreateBinder(context);
382596 bound_constraints = binder->BindConstraints(table);
382597}
DUCKDB_API optional_ptr< CatalogEntry > GetEntry(ClientContext &context, const string &schema, const EntryLookupInfo &lookup_info, OnEntryNotFound if_not_found)
Gets the "schema.name" entry of the specified type, if entry does not exist behavior depends on OnEnt...
Definition duckdb.cpp:8156
vector< unique_ptr< BoundConstraint > > bound_constraints
The constraints used by the table.
Definition duckdb.cpp:147570

Member Function Documentation

◆ Serialize()

void duckdb::LogicalInsert::Serialize ( Serializer & serializer) const
overridevirtual

Reimplemented from duckdb::LogicalOperator.

416808 {
416809 LogicalOperator::Serialize(serializer);
416810 serializer.WritePropertyWithDefault<unique_ptr<CreateInfo>>(200, "table_info", table.GetInfo());
416811 serializer.WritePropertyWithDefault<vector<vector<unique_ptr<Expression>>>>(201, "insert_values", insert_values);
416812 serializer.WriteProperty<IndexVector<idx_t, PhysicalIndex>>(202, "column_index_map", column_index_map);
416813 serializer.WritePropertyWithDefault<vector<LogicalType>>(203, "expected_types", expected_types);
416814 serializer.WritePropertyWithDefault<idx_t>(204, "table_index", table_index);
416815 serializer.WritePropertyWithDefault<bool>(205, "return_chunk", return_chunk);
416816 serializer.WritePropertyWithDefault<vector<unique_ptr<Expression>>>(206, "bound_defaults", bound_defaults);
416817 serializer.WriteProperty<OnConflictAction>(207, "action_type", on_conflict_info.action_type);
416818 serializer.WritePropertyWithDefault<vector<LogicalType>>(208, "expected_set_types", on_conflict_info.expected_set_types);
416819 serializer.WritePropertyWithDefault<unordered_set<idx_t>>(209, "on_conflict_filter", on_conflict_info.on_conflict_filter);
416820 serializer.WritePropertyWithDefault<unique_ptr<Expression>>(210, "on_conflict_condition", on_conflict_info.on_conflict_condition);
416821 serializer.WritePropertyWithDefault<unique_ptr<Expression>>(211, "do_update_condition", on_conflict_info.do_update_condition);
416822 serializer.WritePropertyWithDefault<vector<PhysicalIndex>>(212, "set_columns", on_conflict_info.set_columns);
416823 serializer.WritePropertyWithDefault<vector<LogicalType>>(213, "set_types", on_conflict_info.set_types);
416824 serializer.WritePropertyWithDefault<idx_t>(214, "excluded_table_index", on_conflict_info.excluded_table_index);
416825 serializer.WritePropertyWithDefault<vector<column_t>>(215, "columns_to_fetch", on_conflict_info.columns_to_fetch);
416826 serializer.WritePropertyWithDefault<vector<column_t>>(216, "source_columns", on_conflict_info.source_columns);
416827 serializer.WritePropertyWithDefault<vector<unique_ptr<Expression>>>(217, "expressions", expressions);
416828 serializer.WritePropertyWithDefault<bool>(218, "update_is_del_and_insert", on_conflict_info.update_is_del_and_insert, false);
416829}
physical_index_vector_t< idx_t > column_index_map
The insertion map ([table_index -> index in result, or DConstants::INVALID_INDEX if not specified]).
Definition duckdb.cpp:147559
vector< LogicalType > expected_types
The expected types for the INSERT statement (obtained from the column types).
Definition duckdb.cpp:147561
vector< unique_ptr< Expression > > bound_defaults
The default statements used by the table.
Definition duckdb.cpp:147568
vector< unique_ptr< Expression > > expressions
The set of expressions contained within the operator, if any.
Definition duckdb.hpp:21264
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ Deserialize()

unique_ptr< LogicalOperator > duckdb::LogicalInsert::Deserialize ( Deserializer & deserializer)
static
416831 {
416832 auto table_info = deserializer.ReadPropertyWithDefault<unique_ptr<CreateInfo>>(200, "table_info");
416833 auto result = duckdb::unique_ptr<LogicalInsert>(new LogicalInsert(deserializer.Get<ClientContext &>(), std::move(table_info)));
416834 deserializer.ReadPropertyWithDefault<vector<vector<unique_ptr<Expression>>>>(201, "insert_values", result->insert_values);
416835 deserializer.ReadProperty<IndexVector<idx_t, PhysicalIndex>>(202, "column_index_map", result->column_index_map);
416836 deserializer.ReadPropertyWithDefault<vector<LogicalType>>(203, "expected_types", result->expected_types);
416837 deserializer.ReadPropertyWithDefault<idx_t>(204, "table_index", result->table_index);
416838 deserializer.ReadPropertyWithDefault<bool>(205, "return_chunk", result->return_chunk);
416839 deserializer.ReadPropertyWithDefault<vector<unique_ptr<Expression>>>(206, "bound_defaults", result->bound_defaults);
416840 deserializer.ReadProperty<OnConflictAction>(207, "action_type", result->on_conflict_info.action_type);
416841 deserializer.ReadPropertyWithDefault<vector<LogicalType>>(208, "expected_set_types", result->on_conflict_info.expected_set_types);
416842 deserializer.ReadPropertyWithDefault<unordered_set<idx_t>>(209, "on_conflict_filter", result->on_conflict_info.on_conflict_filter);
416843 deserializer.ReadPropertyWithDefault<unique_ptr<Expression>>(210, "on_conflict_condition", result->on_conflict_info.on_conflict_condition);
416844 deserializer.ReadPropertyWithDefault<unique_ptr<Expression>>(211, "do_update_condition", result->on_conflict_info.do_update_condition);
416845 deserializer.ReadPropertyWithDefault<vector<PhysicalIndex>>(212, "set_columns", result->on_conflict_info.set_columns);
416846 deserializer.ReadPropertyWithDefault<vector<LogicalType>>(213, "set_types", result->on_conflict_info.set_types);
416847 deserializer.ReadPropertyWithDefault<idx_t>(214, "excluded_table_index", result->on_conflict_info.excluded_table_index);
416848 deserializer.ReadPropertyWithDefault<vector<column_t>>(215, "columns_to_fetch", result->on_conflict_info.columns_to_fetch);
416849 deserializer.ReadPropertyWithDefault<vector<column_t>>(216, "source_columns", result->on_conflict_info.source_columns);
416850 deserializer.ReadPropertyWithDefault<vector<unique_ptr<Expression>>>(217, "expressions", result->expressions);
416851 deserializer.ReadPropertyWithExplicitDefault<bool>(218, "update_is_del_and_insert", result->on_conflict_info.update_is_del_and_insert, false);
416852 return std::move(result);
416853}

◆ GetColumnBindings()

vector< ColumnBinding > duckdb::LogicalInsert::GetColumnBindings ( )
overrideprotectedvirtual

Reimplemented from duckdb::LogicalOperator.

382607 {
382608 if (return_chunk) {
382609 return GenerateColumnBindings(table_index, table.GetTypes().size());
382610 }
382611 return {ColumnBinding(0, 0)};
382612}

◆ ResolveTypes()

void duckdb::LogicalInsert::ResolveTypes ( )
overrideprotectedvirtual

Resolve types for this specific operator.

Implements duckdb::LogicalOperator.

382614 {
382615 if (return_chunk) {
382616 types = table.GetTypes();
382617 } else {
382618 types.emplace_back(LogicalType::BIGINT);
382619 }
382620}
vector< LogicalType > types
The types returned by this logical operator. Set by calling LogicalOperator::ResolveTypes.
Definition duckdb.hpp:21266

◆ EstimateCardinality()

idx_t duckdb::LogicalInsert::EstimateCardinality ( ClientContext & context)
overrideprotectedvirtual

Reimplemented from duckdb::LogicalOperator.

382599 {
382600 return return_chunk ? LogicalOperator::EstimateCardinality(context) : 1;
382601}

◆ GetTableIndex()

vector< idx_t > duckdb::LogicalInsert::GetTableIndex ( ) const
overrideprotectedvirtual

Returns the set of table indexes of this operator.

Reimplemented from duckdb::LogicalOperator.

382603 {
382604 return vector<idx_t> {table_index};
382605}

◆ GetName()

string duckdb::LogicalInsert::GetName ( ) const
overrideprotectedvirtual

Reimplemented from duckdb::LogicalOperator.

382622 {
382623#ifdef DEBUG
382625 return LogicalOperator::GetName() + StringUtil::Format(" #%llu", table_index);
382626 }
382627#endif
382628 return LogicalOperator::GetName();
382629}
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002
static bool debug_print_bindings
Whether to print bindings when printing the plan (debug mode only).
Definition duckdb.hpp:40040

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