Skip to content

Commit

Permalink
remove unused contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
Tishj committed Oct 20, 2023
1 parent 6454167 commit d58e213
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/catalog/catalog_entry/duck_schema_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ optional_ptr<CatalogEntry> DuckSchemaEntry::AddEntryInternal(CatalogTransaction
}

optional_ptr<CatalogEntry> DuckSchemaEntry::CreateTable(CatalogTransaction transaction, BoundCreateTableInfo &info) {
auto table = make_uniq<DuckTableEntry>(catalog, *this, info, transaction.context);
auto table = make_uniq<DuckTableEntry>(catalog, *this, info);
auto &storage = table->GetStorage();
storage.info->cardinality = storage.GetTotalRows();

Expand Down
26 changes: 13 additions & 13 deletions src/catalog/catalog_entry/duck_table_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void AddDataTableIndex(DataTable &storage, const ColumnList &columns, vector<Log
}

DuckTableEntry::DuckTableEntry(Catalog &catalog, SchemaCatalogEntry &schema, BoundCreateTableInfo &info,
optional_ptr<ClientContext> context, std::shared_ptr<DataTable> inherited_storage)
std::shared_ptr<DataTable> inherited_storage)
: TableCatalogEntry(catalog, schema, info.Base()), storage(std::move(inherited_storage)),
bound_constraints(std::move(info.bound_constraints)),
column_dependency_manager(std::move(info.column_dependency_manager)) {
Expand Down Expand Up @@ -268,7 +268,7 @@ unique_ptr<CatalogEntry> DuckTableEntry::RenameColumn(ClientContext &context, Re
}
auto binder = Binder::CreateBinder(context);
auto bound_create_info = binder->BindCreateTableInfo(std::move(create_info));
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, storage);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, storage);
}

unique_ptr<CatalogEntry> DuckTableEntry::AddColumn(ClientContext &context, AddColumnInfo &info) {
Expand Down Expand Up @@ -299,7 +299,7 @@ unique_ptr<CatalogEntry> DuckTableEntry::AddColumn(ClientContext &context, AddCo
auto bound_create_info = binder->BindCreateTableInfo(std::move(create_info));
auto new_storage =
make_shared<DataTable>(context, *storage, info.new_column, *bound_create_info->bound_defaults.back());
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, new_storage);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, new_storage);
}

void DuckTableEntry::UpdateConstraintsOnColumnDrop(const LogicalIndex &removed_index,
Expand Down Expand Up @@ -430,11 +430,11 @@ unique_ptr<CatalogEntry> DuckTableEntry::RemoveColumn(ClientContext &context, Re
auto binder = Binder::CreateBinder(context);
auto bound_create_info = binder->BindCreateTableInfo(std::move(create_info));
if (columns.GetColumn(LogicalIndex(removed_index)).Generated()) {
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, storage);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, storage);
}
auto new_storage =
make_shared<DataTable>(context, *storage, columns.LogicalToPhysical(LogicalIndex(removed_index)).index);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, new_storage);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, new_storage);
}

unique_ptr<CatalogEntry> DuckTableEntry::SetDefault(ClientContext &context, SetDefaultInfo &info) {
Expand Down Expand Up @@ -464,7 +464,7 @@ unique_ptr<CatalogEntry> DuckTableEntry::SetDefault(ClientContext &context, SetD

auto binder = Binder::CreateBinder(context);
auto bound_create_info = binder->BindCreateTableInfo(std::move(create_info));
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, storage);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, storage);
}

unique_ptr<CatalogEntry> DuckTableEntry::SetNotNull(ClientContext &context, SetNotNullInfo &info) {
Expand Down Expand Up @@ -495,13 +495,13 @@ unique_ptr<CatalogEntry> DuckTableEntry::SetNotNull(ClientContext &context, SetN

// Early return
if (has_not_null) {
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, storage);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, storage);
}

// Return with new storage info. Note that we need the bound column index here.
auto new_storage = make_shared<DataTable>(
context, *storage, make_uniq<BoundNotNullConstraint>(columns.LogicalToPhysical(LogicalIndex(not_null_idx))));
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, new_storage);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, new_storage);
}

unique_ptr<CatalogEntry> DuckTableEntry::DropNotNull(ClientContext &context, DropNotNullInfo &info) {
Expand All @@ -523,7 +523,7 @@ unique_ptr<CatalogEntry> DuckTableEntry::DropNotNull(ClientContext &context, Dro

auto binder = Binder::CreateBinder(context);
auto bound_create_info = binder->BindCreateTableInfo(std::move(create_info));
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, storage);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, storage);
}

unique_ptr<CatalogEntry> DuckTableEntry::ChangeColumnType(ClientContext &context, ChangeColumnTypeInfo &info) {
Expand Down Expand Up @@ -610,7 +610,7 @@ unique_ptr<CatalogEntry> DuckTableEntry::ChangeColumnType(ClientContext &context
auto new_storage =
make_shared<DataTable>(context, *storage, columns.LogicalToPhysical(LogicalIndex(change_idx)).index,
info.target_type, std::move(storage_oids), *bound_expression);
auto result = make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, new_storage);
auto result = make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, new_storage);
return std::move(result);
}

Expand All @@ -635,7 +635,7 @@ unique_ptr<CatalogEntry> DuckTableEntry::AddForeignKeyConstraint(ClientContext &
auto binder = Binder::CreateBinder(context);
auto bound_create_info = binder->BindCreateTableInfo(std::move(create_info));

return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, storage);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, storage);
}

unique_ptr<CatalogEntry> DuckTableEntry::DropForeignKeyConstraint(ClientContext &context, AlterForeignKeyInfo &info) {
Expand All @@ -658,7 +658,7 @@ unique_ptr<CatalogEntry> DuckTableEntry::DropForeignKeyConstraint(ClientContext
auto binder = Binder::CreateBinder(context);
auto bound_create_info = binder->BindCreateTableInfo(std::move(create_info));

return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, storage);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, storage);
}

unique_ptr<CatalogEntry> DuckTableEntry::Copy(ClientContext &context) const {
Expand All @@ -672,7 +672,7 @@ unique_ptr<CatalogEntry> DuckTableEntry::Copy(ClientContext &context) const {

auto binder = Binder::CreateBinder(context);
auto bound_create_info = binder->BindCreateTableInfo(std::move(create_info));
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, &context, storage);
return make_uniq<DuckTableEntry>(catalog, schema, *bound_create_info, storage);
}

void DuckTableEntry::SetAsRoot() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DuckTableEntry : public TableCatalogEntry {
public:
//! Create a TableCatalogEntry and initialize storage for it
DuckTableEntry(Catalog &catalog, SchemaCatalogEntry &schema, BoundCreateTableInfo &info,
optional_ptr<ClientContext> context, std::shared_ptr<DataTable> inherited_storage = nullptr);
std::shared_ptr<DataTable> inherited_storage = nullptr);

public:
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo &info) override;
Expand Down

0 comments on commit d58e213

Please sign in to comment.