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
@@ -1,97 +1,22 @@
|
|
1
1
|
#include "duckdb/execution/index/art/swizzleable_pointer.hpp"
|
2
2
|
|
3
|
-
#include "duckdb/
|
3
|
+
#include "duckdb/storage/meta_block_reader.hpp"
|
4
4
|
|
5
5
|
namespace duckdb {
|
6
|
-
SwizzleablePointer::~SwizzleablePointer() {
|
7
|
-
if (pointer) {
|
8
|
-
if (!IsSwizzled()) {
|
9
|
-
Node::Delete((Node *)pointer);
|
10
|
-
}
|
11
|
-
}
|
12
|
-
}
|
13
6
|
|
14
|
-
SwizzleablePointer::SwizzleablePointer(
|
15
|
-
idx_t block_id = reader.Read<block_id_t>();
|
16
|
-
uint32_t offset = reader.Read<uint32_t>();
|
17
|
-
if (block_id == DConstants::INVALID_INDEX || offset == (uint32_t)DConstants::INVALID_INDEX) {
|
18
|
-
pointer = 0;
|
19
|
-
return;
|
20
|
-
}
|
21
|
-
idx_t pointer_size = sizeof(pointer) * 8;
|
22
|
-
pointer = block_id;
|
23
|
-
// This assumes high 32 bits of pointer are zero.
|
24
|
-
pointer = pointer << (pointer_size / 2);
|
25
|
-
D_ASSERT((pointer >> (pointer_size / 2)) == block_id);
|
26
|
-
pointer += offset;
|
27
|
-
// Set the left most bit to indicate this is a swizzled pointer and send it back to the mother-ship
|
28
|
-
uint64_t mask = 1;
|
29
|
-
mask = mask << (pointer_size - 1);
|
30
|
-
// This assumes the 33rd most significant bit of the block_id is zero.
|
31
|
-
pointer |= mask;
|
32
|
-
}
|
33
|
-
|
34
|
-
SwizzleablePointer &SwizzleablePointer::operator=(const Node *ptr) {
|
35
|
-
// If the object already has a non-swizzled pointer, this will leak memory.
|
36
|
-
//
|
37
|
-
// TODO: If enabled, this assert will fire, indicating a possible leak. If an exception
|
38
|
-
// is thrown here, it will cause a double-free. There is some work to do to make all this safer.
|
39
|
-
// D_ASSERT(empty() || IsSwizzled());
|
40
|
-
if (sizeof(ptr) == 4) {
|
41
|
-
pointer = (uint32_t)(size_t)ptr;
|
42
|
-
} else {
|
43
|
-
pointer = (uint64_t)ptr;
|
44
|
-
}
|
45
|
-
return *this;
|
46
|
-
}
|
47
|
-
|
48
|
-
bool operator!=(const SwizzleablePointer &s_ptr, const uint64_t &ptr) {
|
49
|
-
return (s_ptr.pointer != ptr);
|
50
|
-
}
|
7
|
+
SwizzleablePointer::SwizzleablePointer(MetaBlockReader &reader) {
|
51
8
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
// This is destructive. Pointer will be invalid after this operation.
|
56
|
-
// That's okay because this is only ever called from Unswizzle.
|
57
|
-
pointer = pointer & ~(1ULL << (pointer_size - 1));
|
58
|
-
uint32_t block_id = pointer >> (pointer_size / 2);
|
59
|
-
uint32_t offset = pointer & 0xffffffff;
|
60
|
-
return {block_id, offset};
|
61
|
-
}
|
62
|
-
|
63
|
-
bool SwizzleablePointer::IsSwizzled() {
|
64
|
-
idx_t pointer_size = sizeof(pointer) * 8;
|
65
|
-
return (pointer >> (pointer_size - 1)) & 1;
|
66
|
-
}
|
67
|
-
|
68
|
-
void SwizzleablePointer::Reset() {
|
69
|
-
if (pointer) {
|
70
|
-
if (!IsSwizzled()) {
|
71
|
-
Node::Delete((Node *)pointer);
|
72
|
-
}
|
73
|
-
}
|
74
|
-
*this = nullptr;
|
75
|
-
}
|
9
|
+
idx_t block_id = reader.Read<block_id_t>();
|
10
|
+
offset = reader.Read<uint32_t>();
|
11
|
+
type = 0;
|
76
12
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
// first we unset the bae
|
81
|
-
auto block_info = GetSwizzledBlockInfo();
|
82
|
-
*this = Node::Deserialize(art, block_info.block_id, block_info.offset);
|
83
|
-
art.Verify();
|
13
|
+
if (block_id == DConstants::INVALID_INDEX) {
|
14
|
+
swizzle_flag = 0;
|
15
|
+
return;
|
84
16
|
}
|
85
|
-
return (Node *)pointer;
|
86
|
-
}
|
87
17
|
|
88
|
-
|
89
|
-
|
90
|
-
Unswizzle(art);
|
91
|
-
return ((Node *)pointer)->Serialize(art, writer);
|
92
|
-
} else {
|
93
|
-
return {(block_id_t)DConstants::INVALID_INDEX, (uint32_t)DConstants::INVALID_INDEX};
|
94
|
-
}
|
18
|
+
buffer_id = (uint32_t)block_id;
|
19
|
+
swizzle_flag = 1;
|
95
20
|
}
|
96
21
|
|
97
22
|
} // namespace duckdb
|
@@ -13,6 +13,7 @@
|
|
13
13
|
#include "duckdb/transaction/duck_transaction.hpp"
|
14
14
|
#include "duckdb/catalog/catalog_entry/duck_table_entry.hpp"
|
15
15
|
#include "duckdb/storage/table/scan_state.hpp"
|
16
|
+
#include "duckdb/execution/index/art/art_key.hpp"
|
16
17
|
|
17
18
|
namespace duckdb {
|
18
19
|
|
@@ -48,7 +49,7 @@ public:
|
|
48
49
|
ExpressionExecutor probe_executor;
|
49
50
|
|
50
51
|
ArenaAllocator arena_allocator;
|
51
|
-
vector<
|
52
|
+
vector<ARTKey> keys;
|
52
53
|
unique_ptr<ColumnFetchState> fetch_state;
|
53
54
|
|
54
55
|
public:
|
@@ -110,10 +111,10 @@ void PhysicalIndexJoin::Output(ExecutionContext &context, DataChunk &input, Data
|
|
110
111
|
OperatorState &state_p) const {
|
111
112
|
auto &phy_tbl_scan = (PhysicalTableScan &)*children[1];
|
112
113
|
auto &bind_tbl = phy_tbl_scan.bind_data->Cast<TableScanBindData>();
|
113
|
-
auto &transaction = DuckTransaction::Get(context.client,
|
114
|
+
auto &transaction = DuckTransaction::Get(context.client, bind_tbl.table.catalog);
|
114
115
|
auto &state = state_p.Cast<IndexJoinOperatorState>();
|
115
116
|
|
116
|
-
auto &tbl = bind_tbl.table
|
117
|
+
auto &tbl = bind_tbl.table.GetStorage();
|
117
118
|
idx_t output_sel_idx = 0;
|
118
119
|
vector<row_t> fetch_rows;
|
119
120
|
|
@@ -268,8 +268,8 @@ void BaseCSVReader::AddValue(string_t str_val, idx_t &column, vector<idx_t> &esc
|
|
268
268
|
idx_t row_entry = parse_chunk.size();
|
269
269
|
|
270
270
|
// test against null string, but only if the value was not quoted
|
271
|
-
if ((!has_quotes || return_types[column].id() != LogicalTypeId::VARCHAR) &&
|
272
|
-
Equals::Operation(str_val, string_t(options.null_str))) {
|
271
|
+
if ((!(has_quotes && !options.allow_quoted_nulls) || return_types[column].id() != LogicalTypeId::VARCHAR) &&
|
272
|
+
!options.force_not_null[column] && Equals::Operation(str_val, string_t(options.null_str))) {
|
273
273
|
FlatVector::SetNull(parse_chunk.data[column], row_entry, true);
|
274
274
|
} else {
|
275
275
|
auto &v = parse_chunk.data[column];
|
@@ -175,6 +175,8 @@ void BufferedCSVReaderOptions::SetReadOption(const string &loption, const Value
|
|
175
175
|
}
|
176
176
|
} else if (loption == "null_padding") {
|
177
177
|
null_padding = ParseBoolean(value, loption);
|
178
|
+
} else if (loption == "allow_quoted_nulls") {
|
179
|
+
allow_quoted_nulls = ParseBoolean(value, loption);
|
178
180
|
} else {
|
179
181
|
throw BinderException("Unrecognized option for CSV reader \"%s\"", loption);
|
180
182
|
}
|
@@ -269,9 +269,10 @@ unique_ptr<GlobalSinkState> PhysicalBatchInsert::GetGlobalSinkState(ClientContex
|
|
269
269
|
if (info) {
|
270
270
|
// CREATE TABLE AS
|
271
271
|
D_ASSERT(!insert_table);
|
272
|
-
auto &catalog =
|
273
|
-
table = (TableCatalogEntry *)catalog
|
274
|
-
|
272
|
+
auto &catalog = schema->catalog;
|
273
|
+
table = (TableCatalogEntry *)catalog
|
274
|
+
.CreateTable(catalog.GetCatalogTransaction(context), *schema.get_mutable(), *info)
|
275
|
+
.get();
|
275
276
|
} else {
|
276
277
|
D_ASSERT(insert_table);
|
277
278
|
D_ASSERT(insert_table->IsDuckTable());
|
@@ -117,31 +117,32 @@ void PhysicalExport::GetData(ExecutionContext &context, DataChunk &chunk, Global
|
|
117
117
|
vector<reference<CatalogEntry>> macros;
|
118
118
|
|
119
119
|
auto schema_list = Catalog::GetSchemas(ccontext, info->catalog);
|
120
|
-
for (auto &
|
121
|
-
|
122
|
-
|
120
|
+
for (auto &schema_p : schema_list) {
|
121
|
+
auto &schema = schema_p.get();
|
122
|
+
if (!schema.internal) {
|
123
|
+
schemas.push_back(schema);
|
123
124
|
}
|
124
|
-
schema
|
125
|
-
if (entry
|
125
|
+
schema.Scan(context.client, CatalogType::TABLE_ENTRY, [&](CatalogEntry &entry) {
|
126
|
+
if (entry.internal) {
|
126
127
|
return;
|
127
128
|
}
|
128
|
-
if (entry
|
129
|
-
views.push_back(
|
129
|
+
if (entry.type != CatalogType::TABLE_ENTRY) {
|
130
|
+
views.push_back(entry);
|
130
131
|
}
|
131
132
|
});
|
132
|
-
schema
|
133
|
-
|
134
|
-
schema
|
135
|
-
|
136
|
-
schema
|
137
|
-
schema
|
138
|
-
if (!entry
|
139
|
-
macros.push_back(
|
133
|
+
schema.Scan(context.client, CatalogType::SEQUENCE_ENTRY,
|
134
|
+
[&](CatalogEntry &entry) { sequences.push_back(entry); });
|
135
|
+
schema.Scan(context.client, CatalogType::TYPE_ENTRY,
|
136
|
+
[&](CatalogEntry &entry) { custom_types.push_back(entry); });
|
137
|
+
schema.Scan(context.client, CatalogType::INDEX_ENTRY, [&](CatalogEntry &entry) { indexes.push_back(entry); });
|
138
|
+
schema.Scan(context.client, CatalogType::MACRO_ENTRY, [&](CatalogEntry &entry) {
|
139
|
+
if (!entry.internal && entry.type == CatalogType::MACRO_ENTRY) {
|
140
|
+
macros.push_back(entry);
|
140
141
|
}
|
141
142
|
});
|
142
|
-
schema
|
143
|
-
if (!entry
|
144
|
-
macros.push_back(
|
143
|
+
schema.Scan(context.client, CatalogType::TABLE_MACRO_ENTRY, [&](CatalogEntry &entry) {
|
144
|
+
if (!entry.internal && entry.type == CatalogType::TABLE_MACRO_ENTRY) {
|
145
|
+
macros.push_back(entry);
|
145
146
|
}
|
146
147
|
});
|
147
148
|
}
|
@@ -109,9 +109,9 @@ unique_ptr<GlobalSinkState> PhysicalInsert::GetGlobalSinkState(ClientContext &co
|
|
109
109
|
if (info) {
|
110
110
|
// CREATE TABLE AS
|
111
111
|
D_ASSERT(!insert_table);
|
112
|
-
auto &catalog =
|
113
|
-
table =
|
114
|
-
|
112
|
+
auto &catalog = schema->catalog;
|
113
|
+
table = &catalog.CreateTable(catalog.GetCatalogTransaction(context), *schema.get_mutable(), *info)
|
114
|
+
->Cast<TableCatalogEntry>();
|
115
115
|
} else {
|
116
116
|
D_ASSERT(insert_table);
|
117
117
|
D_ASSERT(insert_table->IsDuckTable());
|
@@ -313,7 +313,7 @@ void PhysicalInsert::OnConflictHandling(TableCatalogEntry &table, ExecutionConte
|
|
313
313
|
// then we scan the existing table for the conflicting tuples, using the rowids
|
314
314
|
scan_chunk.Initialize(context.client, types_to_fetch);
|
315
315
|
auto fetch_state = make_uniq<ColumnFetchState>();
|
316
|
-
auto &transaction = DuckTransaction::Get(context.client,
|
316
|
+
auto &transaction = DuckTransaction::Get(context.client, table.catalog);
|
317
317
|
data_table.Fetch(transaction, scan_chunk, columns_to_fetch, row_ids, conflicts.Count(), *fetch_state);
|
318
318
|
}
|
319
319
|
|
@@ -424,7 +424,7 @@ void PhysicalInsert::Combine(ExecutionContext &context, GlobalSinkState &gstate_
|
|
424
424
|
auto &table = gstate.table;
|
425
425
|
auto &storage = table.GetStorage();
|
426
426
|
storage.InitializeLocalAppend(gstate.append_state, context.client);
|
427
|
-
auto &transaction = DuckTransaction::Get(context.client,
|
427
|
+
auto &transaction = DuckTransaction::Get(context.client, table.catalog);
|
428
428
|
lstate.local_collection->Scan(transaction, [&](DataChunk &insert_chunk) {
|
429
429
|
storage.LocalAppend(gstate.append_state, table, context.client, insert_chunk);
|
430
430
|
return true;
|
@@ -26,7 +26,7 @@ void PhysicalAlter::GetData(ExecutionContext &context, DataChunk &chunk, GlobalS
|
|
26
26
|
return;
|
27
27
|
}
|
28
28
|
auto &catalog = Catalog::GetCatalog(context.client, info->catalog);
|
29
|
-
catalog.Alter(context.client, info
|
29
|
+
catalog.Alter(context.client, *info);
|
30
30
|
state.finished = true;
|
31
31
|
}
|
32
32
|
|
@@ -27,7 +27,7 @@ void PhysicalCreateFunction::GetData(ExecutionContext &context, DataChunk &chunk
|
|
27
27
|
return;
|
28
28
|
}
|
29
29
|
auto &catalog = Catalog::GetCatalog(context.client, info->catalog);
|
30
|
-
catalog.CreateFunction(context.client, info
|
30
|
+
catalog.CreateFunction(context.client, *info);
|
31
31
|
state.finished = true;
|
32
32
|
}
|
33
33
|
|
@@ -6,6 +6,7 @@
|
|
6
6
|
#include "duckdb/main/client_context.hpp"
|
7
7
|
#include "duckdb/storage/storage_manager.hpp"
|
8
8
|
#include "duckdb/main/database_manager.hpp"
|
9
|
+
#include "duckdb/execution/index/art/art_key.hpp"
|
9
10
|
|
10
11
|
namespace duckdb {
|
11
12
|
|
@@ -39,7 +40,7 @@ public:
|
|
39
40
|
|
40
41
|
unique_ptr<Index> local_index;
|
41
42
|
ArenaAllocator arena_allocator;
|
42
|
-
vector<
|
43
|
+
vector<ARTKey> keys;
|
43
44
|
DataChunk key_chunk;
|
44
45
|
vector<column_t> key_column_ids;
|
45
46
|
};
|
@@ -52,7 +53,7 @@ unique_ptr<GlobalSinkState> PhysicalCreateIndex::GetGlobalSinkState(ClientContex
|
|
52
53
|
case IndexType::ART: {
|
53
54
|
auto &storage = table.GetStorage();
|
54
55
|
state->global_index = make_uniq<ART>(storage_ids, TableIOManager::Get(storage), unbound_expressions,
|
55
|
-
info->constraint_type, storage.db
|
56
|
+
info->constraint_type, storage.db);
|
56
57
|
break;
|
57
58
|
}
|
58
59
|
default:
|
@@ -69,13 +70,13 @@ unique_ptr<LocalSinkState> PhysicalCreateIndex::GetLocalSinkState(ExecutionConte
|
|
69
70
|
case IndexType::ART: {
|
70
71
|
auto &storage = table.GetStorage();
|
71
72
|
state->local_index = make_uniq<ART>(storage_ids, TableIOManager::Get(storage), unbound_expressions,
|
72
|
-
info->constraint_type, storage.db
|
73
|
+
info->constraint_type, storage.db);
|
73
74
|
break;
|
74
75
|
}
|
75
76
|
default:
|
76
77
|
throw InternalException("Unimplemented index type");
|
77
78
|
}
|
78
|
-
state->keys = vector<
|
79
|
+
state->keys = vector<ARTKey>(STANDARD_VECTOR_SIZE);
|
79
80
|
state->key_chunk.Initialize(Allocator::Get(context.client), state->local_index->logical_types);
|
80
81
|
|
81
82
|
for (idx_t i = 0; i < state->key_chunk.ColumnCount(); i++) {
|
@@ -97,9 +98,8 @@ SinkResultType PhysicalCreateIndex::Sink(ExecutionContext &context, GlobalSinkSt
|
|
97
98
|
ART::GenerateKeys(lstate.arena_allocator, lstate.key_chunk, lstate.keys);
|
98
99
|
|
99
100
|
auto &storage = table.GetStorage();
|
100
|
-
auto art =
|
101
|
-
|
102
|
-
lstate.local_index->unbound_expressions, lstate.local_index->constraint_type, storage.db, false);
|
101
|
+
auto art = make_uniq<ART>(lstate.local_index->column_ids, lstate.local_index->table_io_manager,
|
102
|
+
lstate.local_index->unbound_expressions, lstate.local_index->constraint_type, storage.db);
|
103
103
|
if (!art->ConstructFromSorted(lstate.key_chunk.size(), lstate.keys, row_identifiers)) {
|
104
104
|
throw ConstraintException("Data contains duplicates on indexed column(s)");
|
105
105
|
}
|
@@ -134,24 +134,24 @@ SinkFinalizeType PhysicalCreateIndex::Finalize(Pipeline &pipeline, Event &event,
|
|
134
134
|
throw TransactionException("Transaction conflict: cannot add an index to a table that has been altered!");
|
135
135
|
}
|
136
136
|
|
137
|
-
|
138
|
-
|
139
|
-
state.global_index->buffer_manager.IncreaseUsedMemory(state.global_index->memory_size);
|
140
|
-
}
|
141
|
-
|
142
|
-
auto &schema = *table.schema;
|
143
|
-
auto index_entry = (DuckIndexEntry *)schema.CreateIndex(context, info.get(), &table);
|
137
|
+
auto &schema = table.schema;
|
138
|
+
auto index_entry = schema.CreateIndex(context, *info, table).get();
|
144
139
|
if (!index_entry) {
|
145
140
|
// index already exists, but error ignored because of IF NOT EXISTS
|
146
141
|
return SinkFinalizeType::READY;
|
147
142
|
}
|
143
|
+
auto &index = index_entry->Cast<DuckIndexEntry>();
|
148
144
|
|
149
|
-
|
150
|
-
|
145
|
+
index.index = state.global_index.get();
|
146
|
+
index.info = storage.info;
|
151
147
|
for (auto &parsed_expr : info->parsed_expressions) {
|
152
|
-
|
148
|
+
index.parsed_expressions.push_back(parsed_expr->Copy());
|
153
149
|
}
|
154
150
|
|
151
|
+
// vacuum excess memory
|
152
|
+
state.global_index->Vacuum();
|
153
|
+
|
154
|
+
// add index to storage
|
155
155
|
storage.info->indexes.AddIndex(std::move(state.global_index));
|
156
156
|
return SinkFinalizeType::READY;
|
157
157
|
}
|
@@ -28,7 +28,7 @@ void PhysicalCreateSchema::GetData(ExecutionContext &context, DataChunk &chunk,
|
|
28
28
|
if (catalog.IsSystemCatalog()) {
|
29
29
|
throw BinderException("Cannot create schema in system catalog");
|
30
30
|
}
|
31
|
-
catalog.CreateSchema(context.client, info
|
31
|
+
catalog.CreateSchema(context.client, *info);
|
32
32
|
state.finished = true;
|
33
33
|
}
|
34
34
|
|
@@ -25,7 +25,7 @@ void PhysicalCreateSequence::GetData(ExecutionContext &context, DataChunk &chunk
|
|
25
25
|
return;
|
26
26
|
}
|
27
27
|
auto &catalog = Catalog::GetCatalog(context.client, info->catalog);
|
28
|
-
catalog.CreateSequence(context.client, info
|
28
|
+
catalog.CreateSequence(context.client, *info);
|
29
29
|
state.finished = true;
|
30
30
|
}
|
31
31
|
|
@@ -34,8 +34,8 @@ void PhysicalCreateTable::GetData(ExecutionContext &context, DataChunk &chunk, G
|
|
34
34
|
if (state.finished) {
|
35
35
|
return;
|
36
36
|
}
|
37
|
-
auto &catalog =
|
38
|
-
catalog.CreateTable(catalog.GetCatalogTransaction(context.client), schema, info
|
37
|
+
auto &catalog = schema.catalog;
|
38
|
+
catalog.CreateTable(catalog.GetCatalogTransaction(context.client), schema, *info);
|
39
39
|
state.finished = true;
|
40
40
|
}
|
41
41
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
#include "duckdb/catalog/catalog.hpp"
|
4
4
|
#include "duckdb/common/types/column/column_data_collection.hpp"
|
5
|
+
#include "duckdb/catalog/catalog_entry/type_catalog_entry.hpp"
|
5
6
|
|
6
7
|
namespace duckdb {
|
7
8
|
|
@@ -86,10 +87,10 @@ void PhysicalCreateType::GetData(ExecutionContext &context, DataChunk &chunk, Gl
|
|
86
87
|
}
|
87
88
|
|
88
89
|
auto &catalog = Catalog::GetCatalog(context.client, info->catalog);
|
89
|
-
auto catalog_entry = catalog.CreateType(context.client, info
|
90
|
+
auto catalog_entry = catalog.CreateType(context.client, *info);
|
90
91
|
D_ASSERT(catalog_entry->type == CatalogType::TYPE_ENTRY);
|
91
|
-
auto catalog_type = (
|
92
|
-
|
92
|
+
auto &catalog_type = catalog_entry->Cast<TypeCatalogEntry>();
|
93
|
+
EnumType::SetCatalog(info->type, &catalog_type);
|
93
94
|
state.finished = true;
|
94
95
|
}
|
95
96
|
|
@@ -25,7 +25,7 @@ void PhysicalCreateView::GetData(ExecutionContext &context, DataChunk &chunk, Gl
|
|
25
25
|
return;
|
26
26
|
}
|
27
27
|
auto &catalog = Catalog::GetCatalog(context.client, info->catalog);
|
28
|
-
catalog.CreateView(context.client, info
|
28
|
+
catalog.CreateView(context.client, *info);
|
29
29
|
state.finished = true;
|
30
30
|
}
|
31
31
|
|
@@ -30,7 +30,7 @@ void PhysicalDetach::GetData(ExecutionContext &context, DataChunk &chunk, Global
|
|
30
30
|
return;
|
31
31
|
}
|
32
32
|
auto &db_manager = DatabaseManager::Get(context.client);
|
33
|
-
db_manager.DetachDatabase(context.client, info->name, info->
|
33
|
+
db_manager.DetachDatabase(context.client, info->name, info->if_not_found);
|
34
34
|
state.finished = true;
|
35
35
|
}
|
36
36
|
|
@@ -40,7 +40,7 @@ void PhysicalDrop::GetData(ExecutionContext &context, DataChunk &chunk, GlobalSo
|
|
40
40
|
}
|
41
41
|
case CatalogType::SCHEMA_ENTRY: {
|
42
42
|
auto &catalog = Catalog::GetCatalog(context.client, info->catalog);
|
43
|
-
catalog.DropEntry(context.client, info
|
43
|
+
catalog.DropEntry(context.client, *info);
|
44
44
|
auto qualified_name = QualifiedName::Parse(info->name);
|
45
45
|
|
46
46
|
// Check if the dropped schema was set as the current schema
|
@@ -58,7 +58,7 @@ void PhysicalDrop::GetData(ExecutionContext &context, DataChunk &chunk, GlobalSo
|
|
58
58
|
}
|
59
59
|
default: {
|
60
60
|
auto &catalog = Catalog::GetCatalog(context.client, info->catalog);
|
61
|
-
catalog.DropEntry(context.client, info
|
61
|
+
catalog.DropEntry(context.client, *info);
|
62
62
|
break;
|
63
63
|
}
|
64
64
|
}
|
@@ -124,7 +124,7 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalAggregate
|
|
124
124
|
|
125
125
|
plan = ExtractAggregateExpressions(std::move(plan), op.expressions, op.groups);
|
126
126
|
|
127
|
-
if (op.groups.empty()) {
|
127
|
+
if (op.groups.empty() && op.grouping_sets.size() <= 1) {
|
128
128
|
// no groups, check if we can use a simple aggregation
|
129
129
|
// special case: aggregate entire columns together
|
130
130
|
bool use_simple_aggregation = true;
|
@@ -20,10 +20,10 @@
|
|
20
20
|
namespace duckdb {
|
21
21
|
|
22
22
|
static bool CanPlanIndexJoin(ClientContext &context, TableScanBindData &bind_data, PhysicalTableScan &scan) {
|
23
|
-
auto table = bind_data.table;
|
24
|
-
auto &transaction = DuckTransaction::Get(context,
|
23
|
+
auto &table = bind_data.table;
|
24
|
+
auto &transaction = DuckTransaction::Get(context, table.catalog);
|
25
25
|
auto &local_storage = LocalStorage::Get(transaction);
|
26
|
-
if (local_storage.Find(table
|
26
|
+
if (local_storage.Find(table.GetStorage())) {
|
27
27
|
// transaction local appends: skip index join
|
28
28
|
return false;
|
29
29
|
}
|
@@ -137,7 +137,7 @@ void CheckForPerfectJoinOpt(LogicalComparisonJoin &op, PerfectHashJoinStats &joi
|
|
137
137
|
|
138
138
|
static optional_ptr<Index> CanUseIndexJoin(TableScanBindData &tbl, Expression &expr) {
|
139
139
|
optional_ptr<Index> result;
|
140
|
-
tbl.table
|
140
|
+
tbl.table.GetStorage().info->indexes.Scan([&](Index &index) {
|
141
141
|
if (index.unbound_expressions.size() != 1) {
|
142
142
|
return false;
|
143
143
|
}
|
@@ -35,12 +35,13 @@ unique_ptr<PhysicalOperator> DuckCatalog::PlanCreateTableAs(ClientContext &conte
|
|
35
35
|
|
36
36
|
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalCreateTable &op) {
|
37
37
|
const auto &create_info = (CreateTableInfo &)*op.info->base;
|
38
|
-
auto &catalog =
|
39
|
-
auto existing_entry = catalog.GetEntry<TableCatalogEntry>(context, create_info.schema, create_info.table,
|
38
|
+
auto &catalog = op.info->schema.catalog;
|
39
|
+
auto existing_entry = catalog.GetEntry<TableCatalogEntry>(context, create_info.schema, create_info.table,
|
40
|
+
OnEntryNotFound::RETURN_NULL);
|
40
41
|
bool replace = op.info->Base().on_conflict == OnCreateConflict::REPLACE_ON_CONFLICT;
|
41
42
|
if ((!existing_entry || replace) && !op.children.empty()) {
|
42
43
|
auto plan = CreatePlan(*op.children[0]);
|
43
|
-
return op.schema.catalog
|
44
|
+
return op.schema.catalog.PlanCreateTableAs(context, op, std::move(plan));
|
44
45
|
} else {
|
45
46
|
return make_uniq<PhysicalCreateTable>(op, op.schema, std::move(op.info), op.estimated_cardinality);
|
46
47
|
}
|
@@ -26,7 +26,7 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalDelete &op
|
|
26
26
|
auto plan = CreatePlan(*op.children[0]);
|
27
27
|
|
28
28
|
dependencies.AddDependency(op.table);
|
29
|
-
return op.table.catalog
|
29
|
+
return op.table.catalog.PlanDelete(context, op, std::move(plan));
|
30
30
|
}
|
31
31
|
|
32
32
|
} // namespace duckdb
|
@@ -107,7 +107,7 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalInsert &op
|
|
107
107
|
plan = CreatePlan(*op.children[0]);
|
108
108
|
}
|
109
109
|
dependencies.AddDependency(op.table);
|
110
|
-
return op.table.catalog
|
110
|
+
return op.table.catalog.PlanInsert(context, op, std::move(plan));
|
111
111
|
}
|
112
112
|
|
113
113
|
} // namespace duckdb
|
@@ -23,7 +23,7 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalUpdate &op
|
|
23
23
|
auto plan = CreatePlan(*op.children[0]);
|
24
24
|
|
25
25
|
dependencies.AddDependency(op.table);
|
26
|
-
return op.table.catalog
|
26
|
+
return op.table.catalog.PlanUpdate(context, op, std::move(plan));
|
27
27
|
}
|
28
28
|
|
29
29
|
} // namespace duckdb
|
@@ -21,37 +21,37 @@ void BuiltinFunctions::AddCollation(string name, ScalarFunction function, bool c
|
|
21
21
|
bool not_required_for_equality) {
|
22
22
|
CreateCollationInfo info(std::move(name), std::move(function), combinable, not_required_for_equality);
|
23
23
|
info.internal = true;
|
24
|
-
catalog.CreateCollation(transaction,
|
24
|
+
catalog.CreateCollation(transaction, info);
|
25
25
|
}
|
26
26
|
|
27
27
|
void BuiltinFunctions::AddFunction(AggregateFunctionSet set) {
|
28
28
|
CreateAggregateFunctionInfo info(std::move(set));
|
29
29
|
info.internal = true;
|
30
|
-
catalog.CreateFunction(transaction,
|
30
|
+
catalog.CreateFunction(transaction, info);
|
31
31
|
}
|
32
32
|
|
33
33
|
void BuiltinFunctions::AddFunction(AggregateFunction function) {
|
34
34
|
CreateAggregateFunctionInfo info(std::move(function));
|
35
35
|
info.internal = true;
|
36
|
-
catalog.CreateFunction(transaction,
|
36
|
+
catalog.CreateFunction(transaction, info);
|
37
37
|
}
|
38
38
|
|
39
39
|
void BuiltinFunctions::AddFunction(PragmaFunction function) {
|
40
40
|
CreatePragmaFunctionInfo info(std::move(function));
|
41
41
|
info.internal = true;
|
42
|
-
catalog.CreatePragmaFunction(transaction,
|
42
|
+
catalog.CreatePragmaFunction(transaction, info);
|
43
43
|
}
|
44
44
|
|
45
45
|
void BuiltinFunctions::AddFunction(const string &name, PragmaFunctionSet functions) {
|
46
46
|
CreatePragmaFunctionInfo info(name, std::move(functions));
|
47
47
|
info.internal = true;
|
48
|
-
catalog.CreatePragmaFunction(transaction,
|
48
|
+
catalog.CreatePragmaFunction(transaction, info);
|
49
49
|
}
|
50
50
|
|
51
51
|
void BuiltinFunctions::AddFunction(ScalarFunction function) {
|
52
52
|
CreateScalarFunctionInfo info(std::move(function));
|
53
53
|
info.internal = true;
|
54
|
-
catalog.CreateFunction(transaction,
|
54
|
+
catalog.CreateFunction(transaction, info);
|
55
55
|
}
|
56
56
|
|
57
57
|
void BuiltinFunctions::AddFunction(const vector<string> &names, ScalarFunction function) { // NOLINT: false positive
|
@@ -64,25 +64,25 @@ void BuiltinFunctions::AddFunction(const vector<string> &names, ScalarFunction f
|
|
64
64
|
void BuiltinFunctions::AddFunction(ScalarFunctionSet set) {
|
65
65
|
CreateScalarFunctionInfo info(std::move(set));
|
66
66
|
info.internal = true;
|
67
|
-
catalog.CreateFunction(transaction,
|
67
|
+
catalog.CreateFunction(transaction, info);
|
68
68
|
}
|
69
69
|
|
70
70
|
void BuiltinFunctions::AddFunction(TableFunction function) {
|
71
71
|
CreateTableFunctionInfo info(std::move(function));
|
72
72
|
info.internal = true;
|
73
|
-
catalog.CreateTableFunction(transaction,
|
73
|
+
catalog.CreateTableFunction(transaction, info);
|
74
74
|
}
|
75
75
|
|
76
76
|
void BuiltinFunctions::AddFunction(TableFunctionSet set) {
|
77
77
|
CreateTableFunctionInfo info(std::move(set));
|
78
78
|
info.internal = true;
|
79
|
-
catalog.CreateTableFunction(transaction,
|
79
|
+
catalog.CreateTableFunction(transaction, info);
|
80
80
|
}
|
81
81
|
|
82
82
|
void BuiltinFunctions::AddFunction(CopyFunction function) {
|
83
83
|
CreateCopyFunctionInfo info(std::move(function));
|
84
84
|
info.internal = true;
|
85
|
-
catalog.CreateCopyFunction(transaction,
|
85
|
+
catalog.CreateCopyFunction(transaction, info);
|
86
86
|
}
|
87
87
|
|
88
88
|
} // namespace duckdb
|
@@ -247,10 +247,10 @@ unique_ptr<Expression> FunctionBinder::BindScalarFunction(const string &schema,
|
|
247
247
|
vector<unique_ptr<Expression>> children, string &error,
|
248
248
|
bool is_operator, Binder *binder) {
|
249
249
|
// bind the function
|
250
|
-
auto function =
|
250
|
+
auto &function =
|
251
251
|
Catalog::GetSystemCatalog(context).GetEntry(context, CatalogType::SCALAR_FUNCTION_ENTRY, schema, name);
|
252
|
-
D_ASSERT(function
|
253
|
-
return BindScalarFunction(function
|
252
|
+
D_ASSERT(function.type == CatalogType::SCALAR_FUNCTION_ENTRY);
|
253
|
+
return BindScalarFunction(function.Cast<ScalarFunctionCatalogEntry>(), std::move(children), error, is_operator,
|
254
254
|
binder);
|
255
255
|
}
|
256
256
|
|