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

A column of a table. More...

#include <duckdb.hpp>

Collaboration diagram for duckdb::ColumnDefinition:

Public Member Functions

DUCKDB_API ColumnDefinition (string name, LogicalType type)
DUCKDB_API ColumnDefinition (string name, LogicalType type, unique_ptr< ParsedExpression > expression, TableColumnType category)
const ParsedExpression & DefaultValue () const
 default_value
bool HasDefaultValue () const
void SetDefaultValue (unique_ptr< ParsedExpression > default_value)
DUCKDB_API const LogicalType & Type () const
 type
LogicalType & TypeMutable ()
void SetType (const LogicalType &type)
DUCKDB_API const string & Name () const
 name
void SetName (const string &name)
DUCKDB_API const Value & Comment () const
 comment
void SetComment (const Value &comment)
const duckdb::CompressionType & CompressionType () const
 compression_type
void SetCompressionType (duckdb::CompressionType compression_type)
const storage_t & StorageOid () const
 storage_oid
void SetStorageOid (storage_t storage_oid)
LogicalIndex Logical () const
PhysicalIndex Physical () const
const column_t & Oid () const
 oid
void SetOid (column_t oid)
const TableColumnType & Category () const
 category
bool Generated () const
 Whether this column is a Generated Column.
DUCKDB_API ColumnDefinition Copy () const
DUCKDB_API void Serialize (Serializer &serializer) const
ParsedExpression & GeneratedExpressionMutable ()
const ParsedExpression & GeneratedExpression () const
void SetGeneratedExpression (unique_ptr< ParsedExpression > expression)
void ChangeGeneratedExpressionType (const LogicalType &type)
void GetListOfDependencies (vector< string > &dependencies) const
string GetName () const
LogicalType GetType () const

Static Public Member Functions

static DUCKDB_API ColumnDefinition Deserialize (Deserializer &deserializer)

Private Attributes

string name
 The name of the entry.
LogicalType type
 The type of the column.
duckdb::CompressionType compression_type = duckdb::CompressionType::COMPRESSION_AUTO
 Compression Type used for this column.
storage_t storage_oid = DConstants::INVALID_INDEX
 The index of the column in the storage of the table.
idx_t oid = DConstants::INVALID_INDEX
 The index of the column in the table.
TableColumnType category = TableColumnType::STANDARD
 The category of the column.
unique_ptr< ParsedExpression > expression
Value comment
 Comment on this column.
unordered_map< string, string > tags
 Tags on this column.

Detailed Description

A column of a table.

Constructor & Destructor Documentation

◆ ColumnDefinition() [1/2]

duckdb::ColumnDefinition::ColumnDefinition ( string name,
LogicalType type )
335580 : name(std::move(name_p)), type(std::move(type_p)) {
335581}
string name
The name of the entry.
Definition duckdb.hpp:13770
LogicalType type
The type of the column.
Definition duckdb.hpp:13772

◆ ColumnDefinition() [2/2]

duckdb::ColumnDefinition::ColumnDefinition ( string name,
LogicalType type,
unique_ptr< ParsedExpression > expression,
TableColumnType category )
335585 : name(std::move(name_p)), type(std::move(type_p)), category(category), expression(std::move(expression)) {
335586}
TableColumnType category
The category of the column.
Definition duckdb.hpp:13780
unique_ptr< ParsedExpression > expression
Definition duckdb.hpp:13783

Member Function Documentation

◆ DefaultValue()

const ParsedExpression & duckdb::ColumnDefinition::DefaultValue ( ) const

default_value

335600 {
335601 if (!HasDefaultValue()) {
335602 if (Generated()) {
335603 throw InternalException("Calling DefaultValue() on a generated column");
335604 }
335605 throw InternalException("DefaultValue() called on a column without a default value");
335606 }
335607 return *expression;
335608}
bool Generated() const
Whether this column is a Generated Column.
Definition duckdb.cpp:335687
Here is the call graph for this function:

◆ HasDefaultValue()

bool duckdb::ColumnDefinition::HasDefaultValue ( ) const
335610 {
335611 if (Generated()) {
335612 return false;
335613 }
335614 return expression != nullptr;
335615}

◆ SetDefaultValue()

void duckdb::ColumnDefinition::SetDefaultValue ( unique_ptr< ParsedExpression > default_value)
335617 {
335618 if (Generated()) {
335619 throw InternalException("Calling SetDefaultValue() on a generated column");
335620 }
335621 this->expression = std::move(default_value);
335622}

◆ Type()

const LogicalType & duckdb::ColumnDefinition::Type ( ) const

type

335624 {
335625 return type;
335626}

◆ TypeMutable()

LogicalType & duckdb::ColumnDefinition::TypeMutable ( )
335628 {
335629 return type;
335630}

◆ SetType()

void duckdb::ColumnDefinition::SetType ( const LogicalType & type)
335632 {
335633 this->type = type;
335634}

◆ Name()

const string & duckdb::ColumnDefinition::Name ( ) const

name

335636 {
335637 return name;
335638}

◆ SetName()

void duckdb::ColumnDefinition::SetName ( const string & name)
335639 {
335640 this->name = name;
335641}

◆ Comment()

const Value & duckdb::ColumnDefinition::Comment ( ) const

comment

335643 {
335644 return comment;
335645}
Value comment
Comment on this column.
Definition duckdb.hpp:13785

◆ SetComment()

void duckdb::ColumnDefinition::SetComment ( const Value & comment)
335647 {
335648 this->comment = comment;
335649}

◆ CompressionType()

const duckdb::CompressionType & duckdb::ColumnDefinition::CompressionType ( ) const

compression_type

335651 {
335652 return compression_type;
335653}
duckdb::CompressionType compression_type
Compression Type used for this column.
Definition duckdb.hpp:13774

◆ SetCompressionType()

void duckdb::ColumnDefinition::SetCompressionType ( duckdb::CompressionType compression_type)
335655 {
335657}

◆ StorageOid()

const storage_t & duckdb::ColumnDefinition::StorageOid ( ) const

storage_oid

335659 {
335660 return storage_oid;
335661}
storage_t storage_oid
The index of the column in the storage of the table.
Definition duckdb.hpp:13776

◆ SetStorageOid()

void duckdb::ColumnDefinition::SetStorageOid ( storage_t storage_oid)
335671 {
335672 this->storage_oid = storage_oid;
335673}

◆ Logical()

LogicalIndex duckdb::ColumnDefinition::Logical ( ) const
335663 {
335664 return LogicalIndex(oid);
335665}
idx_t oid
The index of the column in the table.
Definition duckdb.hpp:13778

◆ Physical()

PhysicalIndex duckdb::ColumnDefinition::Physical ( ) const
335667 {
335668 return PhysicalIndex(storage_oid);
335669}

◆ Oid()

const column_t & duckdb::ColumnDefinition::Oid ( ) const

oid

335675 {
335676 return oid;
335677}

◆ SetOid()

void duckdb::ColumnDefinition::SetOid ( column_t oid)
335679 {
335680 this->oid = oid;
335681}

◆ Category()

const TableColumnType & duckdb::ColumnDefinition::Category ( ) const

category

335683 {
335684 return category;
335685}

◆ Generated()

bool duckdb::ColumnDefinition::Generated ( ) const

Whether this column is a Generated Column.

335687 {
335688 return category == TableColumnType::GENERATED;
335689}
Here is the caller graph for this function:

◆ Copy()

ColumnDefinition duckdb::ColumnDefinition::Copy ( ) const
335588 {
335589 ColumnDefinition copy(name, type);
335590 copy.oid = oid;
335591 copy.storage_oid = storage_oid;
335592 copy.expression = expression ? expression->Copy() : nullptr;
335593 copy.compression_type = compression_type;
335594 copy.category = category;
335595 copy.comment = comment;
335596 copy.tags = tags;
335597 return copy;
335598}
unordered_map< string, string > tags
Tags on this column.
Definition duckdb.hpp:13787

◆ Serialize()

void duckdb::ColumnDefinition::Serialize ( Serializer & serializer) const
417372 {
417373 serializer.WritePropertyWithDefault<string>(100, "name", name);
417374 serializer.WriteProperty<LogicalType>(101, "type", type);
417375 serializer.WritePropertyWithDefault<unique_ptr<ParsedExpression>>(102, "expression", expression);
417376 serializer.WriteProperty<TableColumnType>(103, "category", category);
417377 serializer.WriteProperty<duckdb::CompressionType>(104, "compression_type", compression_type);
417378 serializer.WritePropertyWithDefault<Value>(105, "comment", comment, Value());
417379 serializer.WritePropertyWithDefault<unordered_map<string, string>>(106, "tags", tags, unordered_map<string, string>());
417380}

◆ Deserialize()

ColumnDefinition duckdb::ColumnDefinition::Deserialize ( Deserializer & deserializer)
static
417382 {
417383 auto name = deserializer.ReadPropertyWithDefault<string>(100, "name");
417384 auto type = deserializer.ReadProperty<LogicalType>(101, "type");
417385 auto expression = deserializer.ReadPropertyWithDefault<unique_ptr<ParsedExpression>>(102, "expression");
417386 auto category = deserializer.ReadProperty<TableColumnType>(103, "category");
417387 ColumnDefinition result(std::move(name), std::move(type), std::move(expression), category);
417388 deserializer.ReadProperty<duckdb::CompressionType>(104, "compression_type", result.compression_type);
417389 deserializer.ReadPropertyWithExplicitDefault<Value>(105, "comment", result.comment, Value());
417390 deserializer.ReadPropertyWithExplicitDefault<unordered_map<string, string>>(106, "tags", result.tags, unordered_map<string, string>());
417391 return result;
417392}

◆ GeneratedExpressionMutable()

ParsedExpression & duckdb::ColumnDefinition::GeneratedExpressionMutable ( )
335765 {
335766 D_ASSERT(Generated());
335767 return *expression;
335768}

◆ GeneratedExpression()

const ParsedExpression & duckdb::ColumnDefinition::GeneratedExpression ( ) const
335760 {
335761 D_ASSERT(Generated());
335762 return *expression;
335763}

◆ SetGeneratedExpression()

void duckdb::ColumnDefinition::SetGeneratedExpression ( unique_ptr< ParsedExpression > expression)
335731 {
335732 category = TableColumnType::GENERATED;
335733
335734 if (new_expr->HasSubquery()) {
335735 throw ParserException("Expression of generated column \"%s\" contains a subquery, which isn't allowed", name);
335736 }
335737
335738 VerifyColumnRefs(*new_expr);
335739 if (type.id() == LogicalTypeId::ANY) {
335740 expression = std::move(new_expr);
335741 return;
335742 }
335743 // Always wrap the expression in a cast, that way we can always update the cast when we change the type
335744 // Except if the type is LogicalType::ANY (no type specified)
335745 expression = make_uniq_base<ParsedExpression, CastExpression>(type, std::move(new_expr));
335746}

◆ ChangeGeneratedExpressionType()

void duckdb::ColumnDefinition::ChangeGeneratedExpressionType ( const LogicalType & type)
335748 {
335749 D_ASSERT(Generated());
335750 // First time the type is set, add a cast around the expression
335751 D_ASSERT(this->type.id() == LogicalTypeId::ANY);
335752 expression = make_uniq_base<ParsedExpression, CastExpression>(type, std::move(expression));
335753 // Every generated expression should be wrapped in a cast on creation
335754 // D_ASSERT(generated_expression->type == ExpressionType::OPERATOR_CAST);
335755 // auto &cast_expr = generated_expression->Cast<CastExpression>();
335756 // auto base_expr = std::move(cast_expr.child);
335757 // generated_expression = make_uniq_base<ParsedExpression, CastExpression>(type, std::move(base_expr));
335758}

◆ GetListOfDependencies()

void duckdb::ColumnDefinition::GetListOfDependencies ( vector< string > & dependencies) const
335718 {
335719 D_ASSERT(Generated());
335720 InnerGetListOfDependencies(*expression, dependencies);
335721}

◆ GetName()

string duckdb::ColumnDefinition::GetName ( ) const
335723 {
335724 return name;
335725}

◆ GetType()

LogicalType duckdb::ColumnDefinition::GetType ( ) const
335727 {
335728 return type;
335729}

Member Data Documentation

◆ expression

unique_ptr<ParsedExpression> duckdb::ColumnDefinition::expression
private

The default value of the column (for non-generated columns) The generated column expression (for generated columns)


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