duckdb 0.7.2-dev2507.0 → 0.7.2-dev2675.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/binding.gyp +7 -7
- package/package.json +2 -2
- 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/extension/parquet/parquet_statistics.cpp +3 -0
- 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/radix_partitioning.cpp +1 -1
- package/src/duckdb/src/common/types.cpp +15 -27
- package/src/duckdb/src/execution/index/art/art.cpp +286 -269
- package/src/duckdb/src/execution/index/art/art_key.cpp +22 -32
- package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +224 -0
- package/src/duckdb/src/execution/index/art/iterator.cpp +142 -123
- package/src/duckdb/src/execution/index/art/leaf.cpp +319 -170
- package/src/duckdb/src/execution/index/art/leaf_segment.cpp +42 -0
- package/src/duckdb/src/execution/index/art/node.cpp +444 -379
- package/src/duckdb/src/execution/index/art/node16.cpp +178 -114
- package/src/duckdb/src/execution/index/art/node256.cpp +117 -79
- package/src/duckdb/src/execution/index/art/node4.cpp +169 -114
- package/src/duckdb/src/execution/index/art/node48.cpp +175 -105
- package/src/duckdb/src/execution/index/art/prefix.cpp +405 -127
- package/src/duckdb/src/execution/index/art/prefix_segment.cpp +42 -0
- package/src/duckdb/src/execution/index/art/swizzleable_pointer.cpp +10 -85
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +4 -3
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +2 -0
- 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 +17 -17
- 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 +5 -5
- package/src/duckdb/src/function/table/read_csv.cpp +5 -1
- 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/queue.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types.hpp +3 -4
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +53 -45
- package/src/duckdb/src/include/duckdb/execution/index/art/art_key.hpp +29 -24
- package/src/duckdb/src/include/duckdb/execution/index/art/fixed_size_allocator.hpp +114 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/iterator.hpp +26 -20
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +63 -39
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf_segment.hpp +36 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +98 -116
- package/src/duckdb/src/include/duckdb/execution/index/art/node16.hpp +48 -36
- package/src/duckdb/src/include/duckdb/execution/index/art/node256.hpp +52 -35
- package/src/duckdb/src/include/duckdb/execution/index/art/node4.hpp +46 -36
- package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +57 -35
- package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +57 -50
- package/src/duckdb/src/include/duckdb/execution/index/art/prefix_segment.hpp +40 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/swizzleable_pointer.hpp +38 -31
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_file_handle.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +2 -0
- 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/statement/insert_statement.hpp +4 -1
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +5 -2
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +4 -1
- 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/storage/buffer_manager.hpp +0 -5
- package/src/duckdb/src/include/duckdb/storage/index.hpp +13 -28
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +0 -2
- package/src/duckdb/src/include/duckdb/transaction/cleanup_state.hpp +5 -0
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +12 -0
- package/src/duckdb/src/include/duckdb.h +26 -0
- package/src/duckdb/src/main/attached_database.cpp +12 -6
- package/src/duckdb/src/main/capi/helper-c.cpp +7 -0
- 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/statement/insert_statement.cpp +15 -6
- package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +18 -5
- 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_insert.cpp +5 -7
- 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 +56 -42
- 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 +16 -11
- 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 +57 -55
- package/src/duckdb/src/storage/data_table.cpp +9 -9
- package/src/duckdb/src/storage/index.cpp +18 -6
- package/src/duckdb/src/storage/local_storage.cpp +8 -2
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +0 -9
- package/src/duckdb/src/storage/table/update_segment.cpp +1 -1
- package/src/duckdb/src/storage/wal_replay.cpp +29 -31
- package/src/duckdb/src/storage/write_ahead_log.cpp +8 -8
- package/src/duckdb/src/transaction/cleanup_state.cpp +7 -1
- package/src/duckdb/src/transaction/commit_state.cpp +3 -4
- package/src/duckdb/src/transaction/transaction_context.cpp +1 -1
- package/src/duckdb/src/transaction/undo_buffer.cpp +8 -0
- package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +4 -4
- package/src/duckdb/ub_src_execution_index_art.cpp +7 -1
@@ -17,7 +17,7 @@ struct DuckDBTablesData : public GlobalTableFunctionState {
|
|
17
17
|
DuckDBTablesData() : offset(0) {
|
18
18
|
}
|
19
19
|
|
20
|
-
vector<CatalogEntry
|
20
|
+
vector<reference<CatalogEntry>> entries;
|
21
21
|
idx_t offset;
|
22
22
|
};
|
23
23
|
|
@@ -74,7 +74,8 @@ unique_ptr<GlobalTableFunctionState> DuckDBTablesInit(ClientContext &context, Ta
|
|
74
74
|
// scan all the schemas for tables and collect themand collect them
|
75
75
|
auto schemas = Catalog::GetAllSchemas(context);
|
76
76
|
for (auto &schema : schemas) {
|
77
|
-
schema
|
77
|
+
schema.get().Scan(context, CatalogType::TABLE_ENTRY,
|
78
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry); });
|
78
79
|
};
|
79
80
|
return std::move(result);
|
80
81
|
}
|
@@ -111,23 +112,23 @@ void DuckDBTablesFunction(ClientContext &context, TableFunctionInput &data_p, Da
|
|
111
112
|
// either fill up the chunk or return all the remaining columns
|
112
113
|
idx_t count = 0;
|
113
114
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
114
|
-
auto &entry = data.entries[data.offset++];
|
115
|
+
auto &entry = data.entries[data.offset++].get();
|
115
116
|
|
116
|
-
if (entry
|
117
|
+
if (entry.type != CatalogType::TABLE_ENTRY) {
|
117
118
|
continue;
|
118
119
|
}
|
119
|
-
auto &table = entry
|
120
|
+
auto &table = entry.Cast<TableCatalogEntry>();
|
120
121
|
auto storage_info = table.GetStorageInfo(context);
|
121
122
|
// return values:
|
122
123
|
idx_t col = 0;
|
123
124
|
// database_name, VARCHAR
|
124
|
-
output.SetValue(col++, count,
|
125
|
+
output.SetValue(col++, count, table.catalog.GetName());
|
125
126
|
// database_oid, BIGINT
|
126
|
-
output.SetValue(col++, count, Value::BIGINT(
|
127
|
+
output.SetValue(col++, count, Value::BIGINT(table.catalog.GetOid()));
|
127
128
|
// schema_name, LogicalType::VARCHAR
|
128
|
-
output.SetValue(col++, count, Value(table.schema
|
129
|
+
output.SetValue(col++, count, Value(table.schema.name));
|
129
130
|
// schema_oid, LogicalType::BIGINT
|
130
|
-
output.SetValue(col++, count, Value::BIGINT(table.schema
|
131
|
+
output.SetValue(col++, count, Value::BIGINT(table.schema.oid));
|
131
132
|
// table_name, LogicalType::VARCHAR
|
132
133
|
output.SetValue(col++, count, Value(table.name));
|
133
134
|
// table_oid, LogicalType::BIGINT
|
@@ -13,7 +13,7 @@ struct DuckDBTypesData : public GlobalTableFunctionState {
|
|
13
13
|
DuckDBTypesData() : offset(0) {
|
14
14
|
}
|
15
15
|
|
16
|
-
vector<TypeCatalogEntry
|
16
|
+
vector<reference<TypeCatalogEntry>> entries;
|
17
17
|
idx_t offset;
|
18
18
|
unordered_set<int64_t> oids;
|
19
19
|
};
|
@@ -61,8 +61,8 @@ unique_ptr<GlobalTableFunctionState> DuckDBTypesInit(ClientContext &context, Tab
|
|
61
61
|
auto result = make_uniq<DuckDBTypesData>();
|
62
62
|
auto schemas = Catalog::GetAllSchemas(context);
|
63
63
|
for (auto &schema : schemas) {
|
64
|
-
schema
|
65
|
-
|
64
|
+
schema.get().Scan(context, CatalogType::TYPE_ENTRY,
|
65
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry.Cast<TypeCatalogEntry>()); });
|
66
66
|
};
|
67
67
|
return std::move(result);
|
68
68
|
}
|
@@ -77,25 +77,25 @@ void DuckDBTypesFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
77
77
|
// either fill up the chunk or return all the remaining columns
|
78
78
|
idx_t count = 0;
|
79
79
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
80
|
-
auto &type_entry = data.entries[data.offset++];
|
81
|
-
auto &type = type_entry
|
80
|
+
auto &type_entry = data.entries[data.offset++].get();
|
81
|
+
auto &type = type_entry.user_type;
|
82
82
|
|
83
83
|
// return values:
|
84
84
|
idx_t col = 0;
|
85
85
|
// database_name, VARCHAR
|
86
|
-
output.SetValue(col++, count, type_entry
|
86
|
+
output.SetValue(col++, count, type_entry.catalog.GetName());
|
87
87
|
// database_oid, BIGINT
|
88
|
-
output.SetValue(col++, count, Value::BIGINT(type_entry
|
88
|
+
output.SetValue(col++, count, Value::BIGINT(type_entry.catalog.GetOid()));
|
89
89
|
// schema_name, LogicalType::VARCHAR
|
90
|
-
output.SetValue(col++, count, Value(type_entry
|
90
|
+
output.SetValue(col++, count, Value(type_entry.schema.name));
|
91
91
|
// schema_oid, LogicalType::BIGINT
|
92
|
-
output.SetValue(col++, count, Value::BIGINT(type_entry
|
92
|
+
output.SetValue(col++, count, Value::BIGINT(type_entry.schema.oid));
|
93
93
|
// type_oid, BIGINT
|
94
94
|
int64_t oid;
|
95
|
-
if (type_entry
|
95
|
+
if (type_entry.internal) {
|
96
96
|
oid = int64_t(type.id());
|
97
97
|
} else {
|
98
|
-
oid = type_entry
|
98
|
+
oid = type_entry.oid;
|
99
99
|
}
|
100
100
|
Value oid_val;
|
101
101
|
if (data.oids.find(oid) == data.oids.end()) {
|
@@ -106,7 +106,7 @@ void DuckDBTypesFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
106
106
|
}
|
107
107
|
output.SetValue(col++, count, oid_val);
|
108
108
|
// type_name, VARCHAR
|
109
|
-
output.SetValue(col++, count, Value(type_entry
|
109
|
+
output.SetValue(col++, count, Value(type_entry.name));
|
110
110
|
// type_size, BIGINT
|
111
111
|
auto internal_type = type.InternalType();
|
112
112
|
output.SetValue(col++, count,
|
@@ -159,7 +159,7 @@ void DuckDBTypesFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
159
159
|
}
|
160
160
|
output.SetValue(col++, count, category.empty() ? Value() : Value(category));
|
161
161
|
// internal, BOOLEAN
|
162
|
-
output.SetValue(col++, count, Value::BOOLEAN(type_entry
|
162
|
+
output.SetValue(col++, count, Value::BOOLEAN(type_entry.internal));
|
163
163
|
// labels, VARCHAR[]
|
164
164
|
if (type.id() == LogicalTypeId::ENUM && type.AuxInfo()) {
|
165
165
|
auto data = FlatVector::GetData<string_t>(EnumType::GetValuesInsertOrder(type));
|
@@ -13,7 +13,7 @@ struct DuckDBViewsData : public GlobalTableFunctionState {
|
|
13
13
|
DuckDBViewsData() : offset(0) {
|
14
14
|
}
|
15
15
|
|
16
|
-
vector<CatalogEntry
|
16
|
+
vector<reference<CatalogEntry>> entries;
|
17
17
|
idx_t offset;
|
18
18
|
};
|
19
19
|
|
@@ -58,13 +58,14 @@ unique_ptr<GlobalTableFunctionState> DuckDBViewsInit(ClientContext &context, Tab
|
|
58
58
|
// scan all the schemas for tables and collect them and collect them
|
59
59
|
auto schemas = Catalog::GetAllSchemas(context);
|
60
60
|
for (auto &schema : schemas) {
|
61
|
-
schema
|
61
|
+
schema.get().Scan(context, CatalogType::VIEW_ENTRY,
|
62
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry); });
|
62
63
|
};
|
63
64
|
return std::move(result);
|
64
65
|
}
|
65
66
|
|
66
67
|
void DuckDBViewsFunction(ClientContext &context, TableFunctionInput &data_p, DataChunk &output) {
|
67
|
-
auto &data =
|
68
|
+
auto &data = data_p.global_state->Cast<DuckDBViewsData>();
|
68
69
|
if (data.offset >= data.entries.size()) {
|
69
70
|
// finished returning values
|
70
71
|
return;
|
@@ -73,23 +74,23 @@ void DuckDBViewsFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
73
74
|
// either fill up the chunk or return all the remaining columns
|
74
75
|
idx_t count = 0;
|
75
76
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
76
|
-
auto &entry = data.entries[data.offset++];
|
77
|
+
auto &entry = data.entries[data.offset++].get();
|
77
78
|
|
78
|
-
if (entry
|
79
|
+
if (entry.type != CatalogType::VIEW_ENTRY) {
|
79
80
|
continue;
|
80
81
|
}
|
81
|
-
auto &view = entry
|
82
|
+
auto &view = entry.Cast<ViewCatalogEntry>();
|
82
83
|
|
83
84
|
// return values:
|
84
85
|
idx_t col = 0;
|
85
86
|
// database_name, VARCHAR
|
86
|
-
output.SetValue(col++, count,
|
87
|
+
output.SetValue(col++, count, view.catalog.GetName());
|
87
88
|
// database_oid, BIGINT
|
88
|
-
output.SetValue(col++, count, Value::BIGINT(
|
89
|
+
output.SetValue(col++, count, Value::BIGINT(view.catalog.GetOid()));
|
89
90
|
// schema_name, LogicalType::VARCHAR
|
90
|
-
output.SetValue(col++, count, Value(view.schema
|
91
|
+
output.SetValue(col++, count, Value(view.schema.name));
|
91
92
|
// schema_oid, LogicalType::BIGINT
|
92
|
-
output.SetValue(col++, count, Value::BIGINT(view.schema
|
93
|
+
output.SetValue(col++, count, Value::BIGINT(view.schema.oid));
|
93
94
|
// view_name, LogicalType::VARCHAR
|
94
95
|
output.SetValue(col++, count, Value(view.name));
|
95
96
|
// view_oid, LogicalType::BIGINT
|
@@ -28,8 +28,8 @@ unique_ptr<GlobalTableFunctionState> PragmaCollateInit(ClientContext &context, T
|
|
28
28
|
|
29
29
|
auto schemas = Catalog::GetAllSchemas(context);
|
30
30
|
for (auto schema : schemas) {
|
31
|
-
schema
|
32
|
-
|
31
|
+
schema.get().Scan(context, CatalogType::COLLATION_ENTRY,
|
32
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry.name); });
|
33
33
|
}
|
34
34
|
return std::move(result);
|
35
35
|
}
|
@@ -15,7 +15,7 @@ struct PragmaDatabaseSizeData : public GlobalTableFunctionState {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
idx_t index;
|
18
|
-
vector<
|
18
|
+
vector<reference<AttachedDatabase>> databases;
|
19
19
|
Value memory_usage;
|
20
20
|
Value memory_limit;
|
21
21
|
};
|
@@ -68,13 +68,13 @@ void PragmaDatabaseSizeFunction(ClientContext &context, TableFunctionInput &data
|
|
68
68
|
auto &data = data_p.global_state->Cast<PragmaDatabaseSizeData>();
|
69
69
|
idx_t row = 0;
|
70
70
|
for (; data.index < data.databases.size() && row < STANDARD_VECTOR_SIZE; data.index++) {
|
71
|
-
auto db = data.databases[data.index];
|
72
|
-
if (db
|
71
|
+
auto &db = data.databases[data.index].get();
|
72
|
+
if (db.IsSystem() || db.IsTemporary()) {
|
73
73
|
continue;
|
74
74
|
}
|
75
|
-
auto ds = db
|
75
|
+
auto ds = db.GetCatalog().GetDatabaseSize(context);
|
76
76
|
idx_t col = 0;
|
77
|
-
output.data[col++].SetValue(row, Value(db
|
77
|
+
output.data[col++].SetValue(row, Value(db.GetName()));
|
78
78
|
output.data[col++].SetValue(row, Value(StringUtil::BytesToHumanReadableString(ds.bytes)));
|
79
79
|
output.data[col++].SetValue(row, Value::BIGINT(ds.block_size));
|
80
80
|
output.data[col++].SetValue(row, Value::BIGINT(ds.total_blocks));
|
@@ -80,9 +80,9 @@ static unique_ptr<FunctionData> PragmaStorageInfoBind(ClientContext &context, Ta
|
|
80
80
|
|
81
81
|
// look up the table name in the catalog
|
82
82
|
Binder::BindSchemaOrCatalog(context, qname.catalog, qname.schema);
|
83
|
-
auto table_entry = Catalog::GetEntry<TableCatalogEntry>(context, qname.catalog, qname.schema, qname.name);
|
84
|
-
auto result = make_uniq<PragmaStorageFunctionData>(
|
85
|
-
result->storage_info = table_entry
|
83
|
+
auto &table_entry = Catalog::GetEntry<TableCatalogEntry>(context, qname.catalog, qname.schema, qname.name);
|
84
|
+
auto result = make_uniq<PragmaStorageFunctionData>(table_entry);
|
85
|
+
result->storage_info = table_entry.GetStorageInfo(context);
|
86
86
|
return std::move(result);
|
87
87
|
}
|
88
88
|
|
@@ -54,8 +54,8 @@ static unique_ptr<FunctionData> PragmaTableInfoBind(ClientContext &context, Tabl
|
|
54
54
|
|
55
55
|
// look up the table name in the catalog
|
56
56
|
Binder::BindSchemaOrCatalog(context, qname.catalog, qname.schema);
|
57
|
-
auto entry = Catalog::GetEntry(context, CatalogType::TABLE_ENTRY, qname.catalog, qname.schema, qname.name);
|
58
|
-
return make_uniq<PragmaTableFunctionData>(
|
57
|
+
auto &entry = Catalog::GetEntry(context, CatalogType::TABLE_ENTRY, qname.catalog, qname.schema, qname.name);
|
58
|
+
return make_uniq<PragmaTableFunctionData>(entry);
|
59
59
|
}
|
60
60
|
|
61
61
|
unique_ptr<GlobalTableFunctionState> PragmaTableInfoInit(ClientContext &context, TableFunctionInitInput &input) {
|
@@ -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-dev2675"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "688b2f1f8c"
|
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
|