duckdb 0.7.2-dev2430.0 → 0.7.2-dev2552.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/connection.cpp +1 -1
- package/src/duckdb/extension/icu/icu-dateadd.cpp +3 -3
- package/src/duckdb/extension/icu/icu-datepart.cpp +3 -3
- package/src/duckdb/extension/icu/icu-datesub.cpp +2 -2
- package/src/duckdb/extension/icu/icu-datetrunc.cpp +1 -1
- package/src/duckdb/extension/icu/icu-extension.cpp +3 -3
- package/src/duckdb/extension/icu/icu-list-range.cpp +2 -2
- package/src/duckdb/extension/icu/icu-makedate.cpp +1 -1
- package/src/duckdb/extension/icu/icu-strptime.cpp +4 -4
- package/src/duckdb/extension/icu/icu-table-range.cpp +2 -2
- package/src/duckdb/extension/icu/icu-timebucket.cpp +1 -1
- package/src/duckdb/extension/icu/icu-timezone.cpp +4 -4
- package/src/duckdb/extension/json/json-extension.cpp +6 -6
- package/src/duckdb/extension/parquet/parquet-extension.cpp +9 -8
- package/src/duckdb/src/catalog/catalog.cpp +166 -127
- package/src/duckdb/src/catalog/catalog_entry/copy_function_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +90 -82
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +65 -67
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/pragma_function_catalog_entry.cpp +4 -4
- package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +8 -8
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +10 -10
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +4 -4
- package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +9 -9
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +5 -5
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +23 -23
- package/src/duckdb/src/catalog/catalog_entry.cpp +27 -6
- package/src/duckdb/src/catalog/catalog_search_path.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_set.cpp +84 -87
- package/src/duckdb/src/catalog/catalog_transaction.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_functions.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_schemas.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_types.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_views.cpp +1 -1
- package/src/duckdb/src/catalog/dependency_list.cpp +2 -2
- package/src/duckdb/src/catalog/dependency_manager.cpp +9 -10
- package/src/duckdb/src/catalog/duck_catalog.cpp +30 -26
- package/src/duckdb/src/catalog/similar_catalog_entry.cpp +1 -1
- package/src/duckdb/src/common/types.cpp +15 -27
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +4 -3
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +19 -18
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +5 -5
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +6 -5
- package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +4 -3
- package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +4 -3
- package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_update.cpp +1 -1
- package/src/duckdb/src/function/built_in_functions.cpp +10 -10
- package/src/duckdb/src/function/function_binder.cpp +3 -3
- package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +5 -6
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +2 -2
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +9 -8
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +6 -6
- package/src/duckdb/src/function/table/arrow.cpp +32 -31
- package/src/duckdb/src/function/table/arrow_conversion.cpp +75 -59
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +8 -7
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +14 -14
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +26 -25
- package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +13 -12
- package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +7 -7
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +8 -9
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +10 -9
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +13 -13
- package/src/duckdb/src/function/table/system/duckdb_views.cpp +11 -10
- package/src/duckdb/src/function/table/system/pragma_collations.cpp +2 -2
- package/src/duckdb/src/function/table/system/pragma_database_size.cpp +5 -5
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +3 -3
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +2 -2
- package/src/duckdb/src/function/table/table_scan.cpp +39 -37
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/udf_function.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +122 -81
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp +2 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/collate_catalog_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/copy_function_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +24 -20
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +22 -17
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +28 -7
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +20 -19
- package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +9 -9
- package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +2 -1
- package/src/duckdb/src/include/duckdb/catalog/standard_entry.hpp +10 -4
- package/src/duckdb/src/include/duckdb/common/enums/on_entry_not_found.hpp +17 -0
- package/src/duckdb/src/include/duckdb/common/types.hpp +3 -4
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +3 -2
- package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +5 -4
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +28 -15
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/keyword_helper.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +7 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +5 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +13 -0
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +5 -2
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +1 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +4 -7
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +12 -0
- package/src/duckdb/src/main/attached_database.cpp +12 -6
- package/src/duckdb/src/main/capi/table_function-c.cpp +17 -16
- package/src/duckdb/src/main/client_context.cpp +12 -11
- package/src/duckdb/src/main/database_manager.cpp +13 -12
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +1 -2
- package/src/duckdb/src/parser/parsed_data/alter_info.cpp +3 -3
- package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +9 -9
- package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +3 -2
- package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +5 -1
- package/src/duckdb/src/parser/transform/statement/transform_detach.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +26 -27
- package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +17 -17
- package/src/duckdb/src/planner/binder/expression/bind_case_expression.cpp +9 -9
- package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +2 -2
- package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +21 -21
- package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +2 -3
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +33 -36
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +5 -5
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +23 -23
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +4 -4
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +7 -7
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +23 -23
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +14 -13
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +36 -35
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +3 -3
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +10 -10
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +5 -4
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +3 -3
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +10 -12
- package/src/duckdb/src/planner/binder.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_expression.cpp +11 -2
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +2 -5
- package/src/duckdb/src/planner/operator/logical_create.cpp +2 -1
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_delete.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_get.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_insert.cpp +2 -7
- package/src/duckdb/src/planner/operator/logical_update.cpp +2 -6
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +2 -2
- package/src/duckdb/src/planner/pragma_handler.cpp +3 -4
- package/src/duckdb/src/storage/checkpoint_manager.cpp +46 -46
- package/src/duckdb/src/storage/data_table.cpp +3 -6
- package/src/duckdb/src/storage/table/update_segment.cpp +1 -1
- package/src/duckdb/src/storage/wal_replay.cpp +28 -30
- package/src/duckdb/src/storage/write_ahead_log.cpp +8 -8
- package/src/duckdb/src/transaction/cleanup_state.cpp +1 -1
- package/src/duckdb/src/transaction/commit_state.cpp +3 -4
- package/src/duckdb/src/transaction/transaction_context.cpp +1 -1
@@ -43,7 +43,7 @@ struct TableScanGlobalState : public GlobalTableFunctionState {
|
|
43
43
|
TableScanGlobalState(ClientContext &context, const FunctionData *bind_data_p) {
|
44
44
|
D_ASSERT(bind_data_p);
|
45
45
|
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
|
46
|
-
max_threads = bind_data.table
|
46
|
+
max_threads = bind_data.table.GetStorage().MaxThreads(context);
|
47
47
|
}
|
48
48
|
|
49
49
|
ParallelTableScanState state;
|
@@ -67,11 +67,11 @@ static unique_ptr<LocalTableFunctionState> TableScanInitLocal(ExecutionContext &
|
|
67
67
|
auto &bind_data = input.bind_data->Cast<TableScanBindData>();
|
68
68
|
vector<column_t> column_ids = input.column_ids;
|
69
69
|
for (auto &col : column_ids) {
|
70
|
-
auto storage_idx = GetStorageIndex(
|
70
|
+
auto storage_idx = GetStorageIndex(bind_data.table, col);
|
71
71
|
col = storage_idx;
|
72
72
|
}
|
73
|
-
result->scan_state.Initialize(std::move(column_ids), input.filters);
|
74
|
-
TableScanParallelStateNext(context.client, input.bind_data, result.get(), gstate);
|
73
|
+
result->scan_state.Initialize(std::move(column_ids), input.filters.get());
|
74
|
+
TableScanParallelStateNext(context.client, input.bind_data.get(), result.get(), gstate);
|
75
75
|
if (input.CanRemoveFilterColumns()) {
|
76
76
|
auto &tsgs = gstate->Cast<TableScanGlobalState>();
|
77
77
|
result->all_columns.Initialize(context.client, tsgs.scanned_types);
|
@@ -83,11 +83,11 @@ unique_ptr<GlobalTableFunctionState> TableScanInitGlobal(ClientContext &context,
|
|
83
83
|
|
84
84
|
D_ASSERT(input.bind_data);
|
85
85
|
auto &bind_data = input.bind_data->Cast<TableScanBindData>();
|
86
|
-
auto result = make_uniq<TableScanGlobalState>(context, input.bind_data);
|
87
|
-
bind_data.table
|
86
|
+
auto result = make_uniq<TableScanGlobalState>(context, input.bind_data.get());
|
87
|
+
bind_data.table.GetStorage().InitializeParallelScan(context, result->state);
|
88
88
|
if (input.CanRemoveFilterColumns()) {
|
89
89
|
result->projection_ids = input.projection_ids;
|
90
|
-
const auto &columns = bind_data.table
|
90
|
+
const auto &columns = bind_data.table.GetColumns();
|
91
91
|
for (const auto &col_idx : input.column_ids) {
|
92
92
|
if (col_idx == COLUMN_IDENTIFIER_ROW_ID) {
|
93
93
|
result->scanned_types.emplace_back(LogicalType::ROW_TYPE);
|
@@ -102,20 +102,20 @@ unique_ptr<GlobalTableFunctionState> TableScanInitGlobal(ClientContext &context,
|
|
102
102
|
static unique_ptr<BaseStatistics> TableScanStatistics(ClientContext &context, const FunctionData *bind_data_p,
|
103
103
|
column_t column_id) {
|
104
104
|
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
|
105
|
-
auto &local_storage = LocalStorage::Get(context,
|
106
|
-
if (local_storage.Find(bind_data.table
|
105
|
+
auto &local_storage = LocalStorage::Get(context, bind_data.table.catalog);
|
106
|
+
if (local_storage.Find(bind_data.table.GetStorage())) {
|
107
107
|
// we don't emit any statistics for tables that have outstanding transaction-local data
|
108
108
|
return nullptr;
|
109
109
|
}
|
110
|
-
return bind_data.table
|
110
|
+
return bind_data.table.GetStatistics(context, column_id);
|
111
111
|
}
|
112
112
|
|
113
113
|
static void TableScanFunc(ClientContext &context, TableFunctionInput &data_p, DataChunk &output) {
|
114
114
|
auto &bind_data = data_p.bind_data->Cast<TableScanBindData>();
|
115
115
|
auto &gstate = data_p.global_state->Cast<TableScanGlobalState>();
|
116
116
|
auto &state = data_p.local_state->Cast<TableScanLocalState>();
|
117
|
-
auto &transaction = DuckTransaction::Get(context,
|
118
|
-
auto &storage = bind_data.table
|
117
|
+
auto &transaction = DuckTransaction::Get(context, bind_data.table.catalog);
|
118
|
+
auto &storage = bind_data.table.GetStorage();
|
119
119
|
do {
|
120
120
|
if (bind_data.is_create_index) {
|
121
121
|
storage.CreateIndexScan(state.scan_state, output,
|
@@ -130,7 +130,8 @@ static void TableScanFunc(ClientContext &context, TableFunctionInput &data_p, Da
|
|
130
130
|
if (output.size() > 0) {
|
131
131
|
return;
|
132
132
|
}
|
133
|
-
if (!TableScanParallelStateNext(context, data_p.bind_data, data_p.local_state
|
133
|
+
if (!TableScanParallelStateNext(context, data_p.bind_data.get(), data_p.local_state.get(),
|
134
|
+
data_p.global_state.get())) {
|
134
135
|
return;
|
135
136
|
}
|
136
137
|
} while (true);
|
@@ -141,7 +142,7 @@ bool TableScanParallelStateNext(ClientContext &context, const FunctionData *bind
|
|
141
142
|
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
|
142
143
|
auto ¶llel_state = global_state->Cast<TableScanGlobalState>();
|
143
144
|
auto &state = local_state->Cast<TableScanLocalState>();
|
144
|
-
auto &storage = bind_data.table
|
145
|
+
auto &storage = bind_data.table.GetStorage();
|
145
146
|
|
146
147
|
return storage.NextParallelScan(context, parallel_state.state, state.scan_state);
|
147
148
|
}
|
@@ -150,7 +151,7 @@ double TableScanProgress(ClientContext &context, const FunctionData *bind_data_p
|
|
150
151
|
const GlobalTableFunctionState *gstate_p) {
|
151
152
|
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
|
152
153
|
auto &gstate = gstate_p->Cast<TableScanGlobalState>();
|
153
|
-
auto &storage = bind_data.table
|
154
|
+
auto &storage = bind_data.table.GetStorage();
|
154
155
|
idx_t total_rows = storage.GetTotalRows();
|
155
156
|
if (total_rows == 0) {
|
156
157
|
//! Table is either empty or smaller than a vector size, so it is finished
|
@@ -185,14 +186,14 @@ BindInfo TableScanGetBindInfo(const FunctionData *bind_data) {
|
|
185
186
|
|
186
187
|
void TableScanDependency(DependencyList &entries, const FunctionData *bind_data_p) {
|
187
188
|
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
|
188
|
-
entries.AddDependency(
|
189
|
+
entries.AddDependency(bind_data.table);
|
189
190
|
}
|
190
191
|
|
191
192
|
unique_ptr<NodeStatistics> TableScanCardinality(ClientContext &context, const FunctionData *bind_data_p) {
|
192
193
|
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
|
193
|
-
auto &local_storage = LocalStorage::Get(context,
|
194
|
-
auto &storage = bind_data.table
|
195
|
-
idx_t estimated_cardinality = storage.info->cardinality + local_storage.AddedRows(bind_data.table
|
194
|
+
auto &local_storage = LocalStorage::Get(context, bind_data.table.catalog);
|
195
|
+
auto &storage = bind_data.table.GetStorage();
|
196
|
+
idx_t estimated_cardinality = storage.info->cardinality + local_storage.AddedRows(bind_data.table.GetStorage());
|
196
197
|
return make_uniq<NodeStatistics>(storage.info->cardinality, estimated_cardinality);
|
197
198
|
}
|
198
199
|
|
@@ -217,10 +218,10 @@ static unique_ptr<GlobalTableFunctionState> IndexScanInitGlobal(ClientContext &c
|
|
217
218
|
row_id_data = (data_ptr_t)&bind_data.result_ids[0];
|
218
219
|
}
|
219
220
|
auto result = make_uniq<IndexScanGlobalState>(row_id_data);
|
220
|
-
auto &local_storage = LocalStorage::Get(context,
|
221
|
+
auto &local_storage = LocalStorage::Get(context, bind_data.table.catalog);
|
221
222
|
result->column_ids = input.column_ids;
|
222
|
-
result->local_storage_state.Initialize(input.column_ids, input.filters);
|
223
|
-
local_storage.InitializeScan(bind_data.table
|
223
|
+
result->local_storage_state.Initialize(input.column_ids, input.filters.get());
|
224
|
+
local_storage.InitializeScan(bind_data.table.GetStorage(), result->local_storage_state.local_state, input.filters);
|
224
225
|
|
225
226
|
result->finished = false;
|
226
227
|
return std::move(result);
|
@@ -229,12 +230,12 @@ static unique_ptr<GlobalTableFunctionState> IndexScanInitGlobal(ClientContext &c
|
|
229
230
|
static void IndexScanFunction(ClientContext &context, TableFunctionInput &data_p, DataChunk &output) {
|
230
231
|
auto &bind_data = data_p.bind_data->Cast<TableScanBindData>();
|
231
232
|
auto &state = data_p.global_state->Cast<IndexScanGlobalState>();
|
232
|
-
auto &transaction = DuckTransaction::Get(context,
|
233
|
+
auto &transaction = DuckTransaction::Get(context, bind_data.table.catalog);
|
233
234
|
auto &local_storage = LocalStorage::Get(transaction);
|
234
235
|
|
235
236
|
if (!state.finished) {
|
236
|
-
bind_data.table
|
237
|
-
|
237
|
+
bind_data.table.GetStorage().Fetch(transaction, output, state.column_ids, state.row_ids,
|
238
|
+
bind_data.result_ids.size(), state.fetch_state);
|
238
239
|
state.finished = true;
|
239
240
|
}
|
240
241
|
if (output.size() == 0) {
|
@@ -265,8 +266,8 @@ static void RewriteIndexExpression(Index &index, LogicalGet &get, Expression &ex
|
|
265
266
|
void TableScanPushdownComplexFilter(ClientContext &context, LogicalGet &get, FunctionData *bind_data_p,
|
266
267
|
vector<unique_ptr<Expression>> &filters) {
|
267
268
|
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
|
268
|
-
auto table = bind_data.table;
|
269
|
-
auto &storage = table
|
269
|
+
auto &table = bind_data.table;
|
270
|
+
auto &storage = table.GetStorage();
|
270
271
|
|
271
272
|
auto &config = ClientConfig::GetConfig(context);
|
272
273
|
if (!config.enable_optimizer) {
|
@@ -365,7 +366,7 @@ void TableScanPushdownComplexFilter(ClientContext &context, LogicalGet &get, Fun
|
|
365
366
|
}
|
366
367
|
if (!equal_value.IsNull() || !low_value.IsNull() || !high_value.IsNull()) {
|
367
368
|
// we can scan this index using this predicate: try a scan
|
368
|
-
auto &transaction = Transaction::Get(context,
|
369
|
+
auto &transaction = Transaction::Get(context, bind_data.table.catalog);
|
369
370
|
unique_ptr<IndexScanState> index_state;
|
370
371
|
if (!equal_value.IsNull()) {
|
371
372
|
// equality predicate
|
@@ -397,19 +398,19 @@ void TableScanPushdownComplexFilter(ClientContext &context, LogicalGet &get, Fun
|
|
397
398
|
|
398
399
|
string TableScanToString(const FunctionData *bind_data_p) {
|
399
400
|
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
|
400
|
-
string result = bind_data.table
|
401
|
+
string result = bind_data.table.name;
|
401
402
|
return result;
|
402
403
|
}
|
403
404
|
|
404
405
|
static void TableScanSerialize(FieldWriter &writer, const FunctionData *bind_data_p, const TableFunction &function) {
|
405
406
|
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
|
406
407
|
|
407
|
-
writer.WriteString(bind_data.table
|
408
|
-
writer.WriteString(bind_data.table
|
408
|
+
writer.WriteString(bind_data.table.schema.name);
|
409
|
+
writer.WriteString(bind_data.table.name);
|
409
410
|
writer.WriteField<bool>(bind_data.is_index_scan);
|
410
411
|
writer.WriteField<bool>(bind_data.is_create_index);
|
411
412
|
writer.WriteList<row_t>(bind_data.result_ids);
|
412
|
-
writer.WriteString(bind_data.table
|
413
|
+
writer.WriteString(bind_data.table.schema.catalog.GetName());
|
413
414
|
}
|
414
415
|
|
415
416
|
static unique_ptr<FunctionData> TableScanDeserialize(ClientContext &context, FieldReader &reader,
|
@@ -421,12 +422,12 @@ static unique_ptr<FunctionData> TableScanDeserialize(ClientContext &context, Fie
|
|
421
422
|
auto result_ids = reader.ReadRequiredList<row_t>();
|
422
423
|
auto catalog_name = reader.ReadField<string>(INVALID_CATALOG);
|
423
424
|
|
424
|
-
auto catalog_entry = Catalog::GetEntry<TableCatalogEntry>(context, catalog_name, schema_name, table_name);
|
425
|
-
if (
|
425
|
+
auto &catalog_entry = Catalog::GetEntry<TableCatalogEntry>(context, catalog_name, schema_name, table_name);
|
426
|
+
if (catalog_entry.type != CatalogType::TABLE_ENTRY) {
|
426
427
|
throw SerializationException("Cant find table for %s.%s", schema_name, table_name);
|
427
428
|
}
|
428
429
|
|
429
|
-
auto result = make_uniq<TableScanBindData>((
|
430
|
+
auto result = make_uniq<TableScanBindData>(catalog_entry.Cast<DuckTableEntry>());
|
430
431
|
result->is_index_scan = is_index_scan;
|
431
432
|
result->is_create_index = is_create_index;
|
432
433
|
result->result_ids = std::move(result_ids);
|
@@ -471,12 +472,13 @@ TableFunction TableScanFunction::GetFunction() {
|
|
471
472
|
return scan_function;
|
472
473
|
}
|
473
474
|
|
474
|
-
TableCatalogEntry
|
475
|
+
optional_ptr<TableCatalogEntry> TableScanFunction::GetTableEntry(const TableFunction &function,
|
476
|
+
const optional_ptr<FunctionData> bind_data_p) {
|
475
477
|
if (function.function != TableScanFunc || !bind_data_p) {
|
476
478
|
return nullptr;
|
477
479
|
}
|
478
480
|
auto &bind_data = bind_data_p->Cast<TableScanBindData>();
|
479
|
-
return bind_data.table;
|
481
|
+
return &bind_data.table;
|
480
482
|
}
|
481
483
|
|
482
484
|
void TableScanFunction::RegisterFunction(BuiltinFunctions &set) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "0.7.2-
|
2
|
+
#define DUCKDB_VERSION "0.7.2-dev2552"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "98590facb8"
|
6
6
|
#endif
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
8
8
|
#include "duckdb/main/database.hpp"
|
@@ -15,13 +15,13 @@ void UDFWrapper::RegisterFunction(string name, vector<LogicalType> args, Logical
|
|
15
15
|
scalar_function.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
16
16
|
CreateScalarFunctionInfo info(scalar_function);
|
17
17
|
info.schema = DEFAULT_SCHEMA;
|
18
|
-
context.RegisterFunction(
|
18
|
+
context.RegisterFunction(info);
|
19
19
|
}
|
20
20
|
|
21
21
|
void UDFWrapper::RegisterAggrFunction(AggregateFunction aggr_function, ClientContext &context, LogicalType varargs) {
|
22
22
|
aggr_function.varargs = std::move(varargs);
|
23
23
|
CreateAggregateFunctionInfo info(std::move(aggr_function));
|
24
|
-
context.RegisterFunction(
|
24
|
+
context.RegisterFunction(info);
|
25
25
|
}
|
26
26
|
|
27
27
|
} // namespace duckdb
|
@@ -15,7 +15,7 @@
|
|
15
15
|
#include "duckdb/common/reference_map.hpp"
|
16
16
|
#include "duckdb/common/atomic.hpp"
|
17
17
|
#include "duckdb/common/optional_ptr.hpp"
|
18
|
-
|
18
|
+
#include "duckdb/common/enums/on_entry_not_found.hpp"
|
19
19
|
#include <functional>
|
20
20
|
|
21
21
|
namespace duckdb {
|
@@ -110,100 +110,121 @@ public:
|
|
110
110
|
DUCKDB_API CatalogTransaction GetCatalogTransaction(ClientContext &context);
|
111
111
|
|
112
112
|
//! Creates a schema in the catalog.
|
113
|
-
DUCKDB_API virtual CatalogEntry
|
114
|
-
|
113
|
+
DUCKDB_API virtual optional_ptr<CatalogEntry> CreateSchema(CatalogTransaction transaction,
|
114
|
+
CreateSchemaInfo &info) = 0;
|
115
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateSchema(ClientContext &context, CreateSchemaInfo &info);
|
115
116
|
//! Creates a table in the catalog.
|
116
|
-
DUCKDB_API CatalogEntry
|
117
|
-
DUCKDB_API CatalogEntry
|
117
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateTable(CatalogTransaction transaction, BoundCreateTableInfo &info);
|
118
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateTable(ClientContext &context, BoundCreateTableInfo &info);
|
118
119
|
//! Creates a table in the catalog.
|
119
|
-
DUCKDB_API CatalogEntry
|
120
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateTable(ClientContext &context, unique_ptr<CreateTableInfo> info);
|
120
121
|
//! Create a table function in the catalog
|
121
|
-
DUCKDB_API CatalogEntry
|
122
|
-
|
122
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateTableFunction(CatalogTransaction transaction,
|
123
|
+
CreateTableFunctionInfo &info);
|
124
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateTableFunction(ClientContext &context, CreateTableFunctionInfo &info);
|
125
|
+
// Kept for backwards compatibility
|
126
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateTableFunction(ClientContext &context,
|
127
|
+
optional_ptr<CreateTableFunctionInfo> info);
|
123
128
|
//! Create a copy function in the catalog
|
124
|
-
DUCKDB_API CatalogEntry
|
125
|
-
|
129
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateCopyFunction(CatalogTransaction transaction,
|
130
|
+
CreateCopyFunctionInfo &info);
|
131
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateCopyFunction(ClientContext &context, CreateCopyFunctionInfo &info);
|
126
132
|
//! Create a pragma function in the catalog
|
127
|
-
DUCKDB_API CatalogEntry
|
128
|
-
|
133
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreatePragmaFunction(CatalogTransaction transaction,
|
134
|
+
CreatePragmaFunctionInfo &info);
|
135
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreatePragmaFunction(ClientContext &context, CreatePragmaFunctionInfo &info);
|
129
136
|
//! Create a scalar or aggregate function in the catalog
|
130
|
-
DUCKDB_API CatalogEntry
|
131
|
-
DUCKDB_API CatalogEntry
|
137
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateFunction(CatalogTransaction transaction, CreateFunctionInfo &info);
|
138
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateFunction(ClientContext &context, CreateFunctionInfo &info);
|
132
139
|
//! Creates a table in the catalog.
|
133
|
-
DUCKDB_API CatalogEntry
|
134
|
-
DUCKDB_API CatalogEntry
|
140
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateView(CatalogTransaction transaction, CreateViewInfo &info);
|
141
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateView(ClientContext &context, CreateViewInfo &info);
|
135
142
|
//! Creates a sequence in the catalog.
|
136
|
-
DUCKDB_API CatalogEntry
|
137
|
-
DUCKDB_API CatalogEntry
|
143
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateSequence(CatalogTransaction transaction, CreateSequenceInfo &info);
|
144
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateSequence(ClientContext &context, CreateSequenceInfo &info);
|
138
145
|
//! Creates a Enum in the catalog.
|
139
|
-
DUCKDB_API CatalogEntry
|
140
|
-
DUCKDB_API CatalogEntry
|
146
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateType(CatalogTransaction transaction, CreateTypeInfo &info);
|
147
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateType(ClientContext &context, CreateTypeInfo &info);
|
141
148
|
//! Creates a collation in the catalog
|
142
|
-
DUCKDB_API CatalogEntry
|
143
|
-
DUCKDB_API CatalogEntry
|
149
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateCollation(CatalogTransaction transaction, CreateCollationInfo &info);
|
150
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateCollation(ClientContext &context, CreateCollationInfo &info);
|
144
151
|
//! Creates an index in the catalog
|
145
|
-
DUCKDB_API CatalogEntry
|
146
|
-
DUCKDB_API CatalogEntry
|
152
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateIndex(CatalogTransaction transaction, CreateIndexInfo &info);
|
153
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateIndex(ClientContext &context, CreateIndexInfo &info);
|
147
154
|
|
148
155
|
//! Creates a table in the catalog.
|
149
|
-
DUCKDB_API CatalogEntry
|
150
|
-
|
156
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateTable(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
157
|
+
BoundCreateTableInfo &info);
|
151
158
|
//! Create a table function in the catalog
|
152
|
-
DUCKDB_API CatalogEntry
|
153
|
-
|
159
|
+
DUCKDB_API optional_ptr<CatalogEntry>
|
160
|
+
CreateTableFunction(CatalogTransaction transaction, SchemaCatalogEntry &schema, CreateTableFunctionInfo &info);
|
154
161
|
//! Create a copy function in the catalog
|
155
|
-
DUCKDB_API CatalogEntry
|
156
|
-
|
162
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateCopyFunction(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
163
|
+
CreateCopyFunctionInfo &info);
|
157
164
|
//! Create a pragma function in the catalog
|
158
|
-
DUCKDB_API CatalogEntry
|
159
|
-
|
165
|
+
DUCKDB_API optional_ptr<CatalogEntry>
|
166
|
+
CreatePragmaFunction(CatalogTransaction transaction, SchemaCatalogEntry &schema, CreatePragmaFunctionInfo &info);
|
160
167
|
//! Create a scalar or aggregate function in the catalog
|
161
|
-
DUCKDB_API CatalogEntry
|
162
|
-
|
168
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateFunction(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
169
|
+
CreateFunctionInfo &info);
|
163
170
|
//! Creates a view in the catalog
|
164
|
-
DUCKDB_API CatalogEntry
|
165
|
-
|
171
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateView(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
172
|
+
CreateViewInfo &info);
|
166
173
|
//! Creates a table in the catalog.
|
167
|
-
DUCKDB_API CatalogEntry
|
168
|
-
|
174
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateSequence(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
175
|
+
CreateSequenceInfo &info);
|
169
176
|
//! Creates a enum in the catalog.
|
170
|
-
DUCKDB_API CatalogEntry
|
171
|
-
|
177
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateType(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
178
|
+
CreateTypeInfo &info);
|
172
179
|
//! Creates a collation in the catalog
|
173
|
-
DUCKDB_API CatalogEntry
|
174
|
-
|
180
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateCollation(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
181
|
+
CreateCollationInfo &info);
|
175
182
|
|
176
183
|
//! Drops an entry from the catalog
|
177
|
-
DUCKDB_API void DropEntry(ClientContext &context, DropInfo
|
184
|
+
DUCKDB_API void DropEntry(ClientContext &context, DropInfo &info);
|
178
185
|
|
179
186
|
//! Returns the schema object with the specified name, or throws an exception if it does not exist
|
180
|
-
DUCKDB_API SchemaCatalogEntry
|
181
|
-
|
187
|
+
DUCKDB_API SchemaCatalogEntry &GetSchema(ClientContext &context, const string &name,
|
188
|
+
QueryErrorContext error_context = QueryErrorContext());
|
189
|
+
DUCKDB_API optional_ptr<SchemaCatalogEntry> GetSchema(ClientContext &context, const string &name,
|
190
|
+
OnEntryNotFound if_not_found,
|
191
|
+
QueryErrorContext error_context = QueryErrorContext());
|
192
|
+
DUCKDB_API SchemaCatalogEntry &GetSchema(CatalogTransaction transaction, const string &name,
|
182
193
|
QueryErrorContext error_context = QueryErrorContext());
|
183
|
-
DUCKDB_API virtual SchemaCatalogEntry
|
184
|
-
|
185
|
-
|
186
|
-
DUCKDB_API static SchemaCatalogEntry
|
187
|
-
const string &schema_name,
|
194
|
+
DUCKDB_API virtual optional_ptr<SchemaCatalogEntry>
|
195
|
+
GetSchema(CatalogTransaction transaction, const string &schema_name, OnEntryNotFound if_not_found,
|
196
|
+
QueryErrorContext error_context = QueryErrorContext()) = 0;
|
197
|
+
DUCKDB_API static SchemaCatalogEntry &GetSchema(ClientContext &context, const string &catalog_name,
|
198
|
+
const string &schema_name,
|
188
199
|
QueryErrorContext error_context = QueryErrorContext());
|
200
|
+
DUCKDB_API static optional_ptr<SchemaCatalogEntry> GetSchema(ClientContext &context, const string &catalog_name,
|
201
|
+
const string &schema_name,
|
202
|
+
OnEntryNotFound if_not_found,
|
203
|
+
QueryErrorContext error_context = QueryErrorContext());
|
189
204
|
//! Scans all the schemas in the system one-by-one, invoking the callback for each entry
|
190
|
-
DUCKDB_API virtual void ScanSchemas(ClientContext &context, std::function<void(
|
191
|
-
//! Gets the "schema.name" entry of the specified type, if
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
//!
|
198
|
-
|
199
|
-
|
205
|
+
DUCKDB_API virtual void ScanSchemas(ClientContext &context, std::function<void(SchemaCatalogEntry &)> callback) = 0;
|
206
|
+
//! Gets the "schema.name" entry of the specified type, if entry does not exist behavior depends on OnEntryNotFound
|
207
|
+
DUCKDB_API optional_ptr<CatalogEntry> GetEntry(ClientContext &context, CatalogType type, const string &schema,
|
208
|
+
const string &name, OnEntryNotFound if_not_found,
|
209
|
+
QueryErrorContext error_context = QueryErrorContext());
|
210
|
+
DUCKDB_API CatalogEntry &GetEntry(ClientContext &context, CatalogType type, const string &schema,
|
211
|
+
const string &name, QueryErrorContext error_context = QueryErrorContext());
|
212
|
+
//! Gets the "catalog.schema.name" entry of the specified type, if entry does not exist behavior depends on
|
213
|
+
//! OnEntryNotFound
|
214
|
+
DUCKDB_API static optional_ptr<CatalogEntry> GetEntry(ClientContext &context, CatalogType type,
|
215
|
+
const string &catalog, const string &schema,
|
216
|
+
const string &name, OnEntryNotFound if_not_found,
|
217
|
+
QueryErrorContext error_context = QueryErrorContext());
|
218
|
+
DUCKDB_API static CatalogEntry &GetEntry(ClientContext &context, CatalogType type, const string &catalog,
|
219
|
+
const string &schema, const string &name,
|
200
220
|
QueryErrorContext error_context = QueryErrorContext());
|
201
221
|
|
202
222
|
//! Gets the "schema.name" entry without a specified type, if entry does not exist an exception is thrown
|
203
|
-
DUCKDB_API CatalogEntry
|
223
|
+
DUCKDB_API CatalogEntry &GetEntry(ClientContext &context, const string &schema, const string &name);
|
204
224
|
|
205
225
|
//! Fetches a logical type from the catalog
|
206
|
-
DUCKDB_API LogicalType GetType(ClientContext &context, const string &schema, const string &names,
|
226
|
+
DUCKDB_API LogicalType GetType(ClientContext &context, const string &schema, const string &names,
|
227
|
+
OnEntryNotFound if_not_found);
|
207
228
|
|
208
229
|
DUCKDB_API static LogicalType GetType(ClientContext &context, const string &catalog_name, const string &schema,
|
209
230
|
const string &name);
|
@@ -212,20 +233,29 @@ public:
|
|
212
233
|
const string &name);
|
213
234
|
|
214
235
|
template <class T>
|
215
|
-
T
|
216
|
-
|
217
|
-
auto entry = GetEntry(context, T::Type, schema_name, name,
|
218
|
-
if (entry
|
236
|
+
optional_ptr<T> GetEntry(ClientContext &context, const string &schema_name, const string &name,
|
237
|
+
OnEntryNotFound if_not_found, QueryErrorContext error_context = QueryErrorContext()) {
|
238
|
+
auto entry = GetEntry(context, T::Type, schema_name, name, if_not_found, error_context);
|
239
|
+
if (!entry) {
|
240
|
+
return nullptr;
|
241
|
+
}
|
242
|
+
if (entry->type != T::Type) {
|
219
243
|
throw CatalogException(error_context.FormatError("%s is not an %s", name, T::Name));
|
220
244
|
}
|
221
|
-
return (
|
245
|
+
return &entry->template Cast<T>();
|
246
|
+
}
|
247
|
+
template <class T>
|
248
|
+
T &GetEntry(ClientContext &context, const string &schema_name, const string &name,
|
249
|
+
QueryErrorContext error_context = QueryErrorContext()) {
|
250
|
+
auto entry = GetEntry<T>(context, schema_name, name, OnEntryNotFound::THROW_EXCEPTION, error_context);
|
251
|
+
return *entry;
|
222
252
|
}
|
223
253
|
|
224
254
|
//! Append a scalar or aggregate function to the catalog
|
225
|
-
DUCKDB_API CatalogEntry
|
255
|
+
DUCKDB_API optional_ptr<CatalogEntry> AddFunction(ClientContext &context, CreateFunctionInfo &info);
|
226
256
|
|
227
257
|
//! Alter an existing entry in the catalog.
|
228
|
-
DUCKDB_API void Alter(ClientContext &context, AlterInfo
|
258
|
+
DUCKDB_API void Alter(ClientContext &context, AlterInfo &info);
|
229
259
|
|
230
260
|
virtual unique_ptr<PhysicalOperator> PlanCreateTableAs(ClientContext &context, LogicalCreateTable &op,
|
231
261
|
unique_ptr<PhysicalOperator> plan) = 0;
|
@@ -245,19 +275,30 @@ public:
|
|
245
275
|
|
246
276
|
public:
|
247
277
|
template <class T>
|
248
|
-
static T
|
249
|
-
|
250
|
-
|
251
|
-
auto entry = GetEntry(context, T::Type, catalog_name, schema_name, name,
|
252
|
-
if (entry
|
278
|
+
static optional_ptr<T> GetEntry(ClientContext &context, const string &catalog_name, const string &schema_name,
|
279
|
+
const string &name, OnEntryNotFound if_not_found,
|
280
|
+
QueryErrorContext error_context = QueryErrorContext()) {
|
281
|
+
auto entry = GetEntry(context, T::Type, catalog_name, schema_name, name, if_not_found, error_context);
|
282
|
+
if (!entry) {
|
283
|
+
return nullptr;
|
284
|
+
}
|
285
|
+
if (entry->type != T::Type) {
|
253
286
|
throw CatalogException(error_context.FormatError("%s is not an %s", name, T::Name));
|
254
287
|
}
|
255
|
-
return (
|
288
|
+
return &entry->template Cast<T>();
|
289
|
+
}
|
290
|
+
template <class T>
|
291
|
+
static T &GetEntry(ClientContext &context, const string &catalog_name, const string &schema_name,
|
292
|
+
const string &name, QueryErrorContext error_context = QueryErrorContext()) {
|
293
|
+
auto entry =
|
294
|
+
GetEntry<T>(context, catalog_name, schema_name, name, OnEntryNotFound::THROW_EXCEPTION, error_context);
|
295
|
+
return *entry;
|
256
296
|
}
|
257
297
|
|
258
|
-
DUCKDB_API vector<SchemaCatalogEntry
|
259
|
-
DUCKDB_API static vector<SchemaCatalogEntry
|
260
|
-
|
298
|
+
DUCKDB_API vector<reference<SchemaCatalogEntry>> GetSchemas(ClientContext &context);
|
299
|
+
DUCKDB_API static vector<reference<SchemaCatalogEntry>> GetSchemas(ClientContext &context,
|
300
|
+
const string &catalog_name);
|
301
|
+
DUCKDB_API static vector<reference<SchemaCatalogEntry>> GetAllSchemas(ClientContext &context);
|
261
302
|
|
262
303
|
virtual void Verify();
|
263
304
|
|
@@ -271,9 +312,9 @@ private:
|
|
271
312
|
CatalogEntryLookup LookupEntryInternal(CatalogTransaction transaction, CatalogType type, const string &schema,
|
272
313
|
const string &name);
|
273
314
|
CatalogEntryLookup LookupEntry(ClientContext &context, CatalogType type, const string &schema, const string &name,
|
274
|
-
|
315
|
+
OnEntryNotFound if_not_found, QueryErrorContext error_context = QueryErrorContext());
|
275
316
|
static CatalogEntryLookup LookupEntry(ClientContext &context, vector<CatalogLookup> &lookups, CatalogType type,
|
276
|
-
const string &name,
|
317
|
+
const string &name, OnEntryNotFound if_not_found,
|
277
318
|
QueryErrorContext error_context = QueryErrorContext());
|
278
319
|
|
279
320
|
//! Return an exception with did-you-mean suggestion.
|
@@ -286,7 +327,7 @@ private:
|
|
286
327
|
static SimilarCatalogEntry SimilarEntryInSchemas(ClientContext &context, const string &entry_name, CatalogType type,
|
287
328
|
const reference_set_t<SchemaCatalogEntry> &schemas);
|
288
329
|
|
289
|
-
virtual void DropSchema(ClientContext &context, DropInfo
|
330
|
+
virtual void DropSchema(ClientContext &context, DropInfo &info) = 0;
|
290
331
|
|
291
332
|
public:
|
292
333
|
template <class TARGET>
|
package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp
CHANGED
@@ -22,9 +22,8 @@ public:
|
|
22
22
|
static constexpr const char *Name = "aggregate function";
|
23
23
|
|
24
24
|
public:
|
25
|
-
AggregateFunctionCatalogEntry(Catalog
|
26
|
-
: StandardEntry(CatalogType::AGGREGATE_FUNCTION_ENTRY, schema, catalog, info
|
27
|
-
functions(info->functions) {
|
25
|
+
AggregateFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateAggregateFunctionInfo &info)
|
26
|
+
: StandardEntry(CatalogType::AGGREGATE_FUNCTION_ENTRY, schema, catalog, info.name), functions(info.functions) {
|
28
27
|
}
|
29
28
|
|
30
29
|
//! The aggregate functions
|
@@ -21,9 +21,9 @@ public:
|
|
21
21
|
static constexpr const char *Name = "collation";
|
22
22
|
|
23
23
|
public:
|
24
|
-
CollateCatalogEntry(Catalog
|
25
|
-
: StandardEntry(CatalogType::COLLATION_ENTRY, schema, catalog, info
|
26
|
-
combinable(info
|
24
|
+
CollateCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateCollationInfo &info)
|
25
|
+
: StandardEntry(CatalogType::COLLATION_ENTRY, schema, catalog, info.name), function(info.function),
|
26
|
+
combinable(info.combinable), not_required_for_equality(info.not_required_for_equality) {
|
27
27
|
}
|
28
28
|
|
29
29
|
//! The collation function to push in case collation is required
|
@@ -24,7 +24,7 @@ public:
|
|
24
24
|
static constexpr const char *Name = "copy function";
|
25
25
|
|
26
26
|
public:
|
27
|
-
CopyFunctionCatalogEntry(Catalog
|
27
|
+
CopyFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateCopyFunctionInfo &info);
|
28
28
|
|
29
29
|
//! The copy function
|
30
30
|
CopyFunction function;
|
@@ -16,7 +16,7 @@ namespace duckdb {
|
|
16
16
|
class DuckIndexEntry : public IndexCatalogEntry {
|
17
17
|
public:
|
18
18
|
//! Create an IndexCatalogEntry and initialize storage for it
|
19
|
-
DuckIndexEntry(Catalog
|
19
|
+
DuckIndexEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateIndexInfo &info);
|
20
20
|
~DuckIndexEntry();
|
21
21
|
|
22
22
|
shared_ptr<DataTableInfo> info;
|