duckdb 1.0.1-dev21.0 → 1.0.1-dev27.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/.github/workflows/HighPriorityIssues.yml +2 -2
- package/.github/workflows/NodeJS.yml +1 -1
- package/binding.gyp +41 -0
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-dateadd.cpp +4 -2
- package/src/duckdb/extension/icu/icu-datefunc.cpp +6 -2
- package/src/duckdb/extension/icu/icu-datesub.cpp +13 -2
- package/src/duckdb/extension/icu/icu-strptime.cpp +6 -6
- package/src/duckdb/extension/icu/icu-table-range.cpp +92 -73
- package/src/duckdb/extension/icu/icu-timebucket.cpp +12 -2
- package/src/duckdb/extension/icu/icu-timezone.cpp +3 -3
- package/src/duckdb/extension/icu/icu_extension.cpp +61 -9
- package/src/duckdb/extension/json/include/json_executors.hpp +20 -23
- package/src/duckdb/extension/json/include/json_functions.hpp +4 -0
- package/src/duckdb/extension/json/include/json_scan.hpp +6 -2
- package/src/duckdb/extension/json/include/json_structure.hpp +12 -9
- package/src/duckdb/extension/json/json_common.cpp +66 -10
- package/src/duckdb/extension/json/json_extension.cpp +13 -5
- package/src/duckdb/extension/json/json_functions/json_array_length.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_create.cpp +21 -4
- package/src/duckdb/extension/json/json_functions/json_exists.cpp +32 -0
- package/src/duckdb/extension/json/json_functions/json_extract.cpp +2 -2
- package/src/duckdb/extension/json/json_functions/json_keys.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_pretty.cpp +32 -0
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +5 -1
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +305 -94
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_type.cpp +3 -3
- package/src/duckdb/extension/json/json_functions/json_value.cpp +42 -0
- package/src/duckdb/extension/json/json_functions/read_json.cpp +16 -2
- package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +3 -2
- package/src/duckdb/extension/json/json_functions.cpp +5 -1
- package/src/duckdb/extension/json/json_scan.cpp +13 -12
- package/src/duckdb/extension/json/serialize_json.cpp +5 -3
- package/src/duckdb/extension/parquet/column_reader.cpp +206 -43
- package/src/duckdb/extension/parquet/column_writer.cpp +133 -62
- package/src/duckdb/extension/parquet/geo_parquet.cpp +391 -0
- package/src/duckdb/extension/parquet/include/boolean_column_reader.hpp +16 -5
- package/src/duckdb/extension/parquet/include/column_reader.hpp +37 -12
- package/src/duckdb/extension/parquet/include/column_writer.hpp +10 -11
- package/src/duckdb/extension/parquet/include/expression_column_reader.hpp +52 -0
- package/src/duckdb/extension/parquet/include/geo_parquet.hpp +139 -0
- package/src/duckdb/extension/parquet/include/parquet_crypto.hpp +13 -8
- package/src/duckdb/extension/parquet/include/parquet_decimal_utils.hpp +3 -0
- package/src/duckdb/extension/parquet/include/parquet_file_metadata_cache.hpp +7 -3
- package/src/duckdb/extension/parquet/include/parquet_reader.hpp +55 -8
- package/src/duckdb/extension/parquet/include/parquet_rle_bp_decoder.hpp +3 -3
- package/src/duckdb/extension/parquet/include/parquet_rle_bp_encoder.hpp +1 -1
- package/src/duckdb/extension/parquet/include/parquet_timestamp.hpp +8 -0
- package/src/duckdb/extension/parquet/include/parquet_writer.hpp +21 -7
- package/src/duckdb/extension/parquet/include/resizable_buffer.hpp +33 -11
- package/src/duckdb/extension/parquet/include/string_column_reader.hpp +5 -2
- package/src/duckdb/extension/parquet/include/templated_column_reader.hpp +48 -14
- package/src/duckdb/extension/parquet/parquet_crypto.cpp +109 -61
- package/src/duckdb/extension/parquet/parquet_extension.cpp +305 -72
- package/src/duckdb/extension/parquet/parquet_metadata.cpp +4 -4
- package/src/duckdb/extension/parquet/parquet_reader.cpp +151 -40
- package/src/duckdb/extension/parquet/parquet_statistics.cpp +50 -16
- package/src/duckdb/extension/parquet/parquet_timestamp.cpp +42 -1
- package/src/duckdb/extension/parquet/parquet_writer.cpp +67 -75
- package/src/duckdb/extension/parquet/serialize_parquet.cpp +3 -1
- package/src/duckdb/extension/parquet/zstd_file_system.cpp +5 -1
- package/src/duckdb/src/catalog/catalog.cpp +14 -16
- package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +14 -11
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +39 -19
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +92 -78
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +10 -2
- package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +10 -3
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +7 -7
- package/src/duckdb/src/catalog/catalog_entry.cpp +6 -3
- package/src/duckdb/src/catalog/catalog_set.cpp +14 -19
- package/src/duckdb/src/catalog/default/default_functions.cpp +179 -166
- package/src/duckdb/src/catalog/default/default_generator.cpp +24 -0
- package/src/duckdb/src/catalog/default/default_schemas.cpp +4 -3
- package/src/duckdb/src/catalog/default/default_table_functions.cpp +148 -0
- package/src/duckdb/src/catalog/default/default_views.cpp +7 -3
- package/src/duckdb/src/catalog/duck_catalog.cpp +7 -1
- package/src/duckdb/src/common/adbc/adbc.cpp +120 -58
- package/src/duckdb/src/common/allocator.cpp +71 -6
- package/src/duckdb/src/common/arrow/appender/bool_data.cpp +8 -7
- package/src/duckdb/src/common/arrow/appender/fixed_size_list_data.cpp +1 -1
- package/src/duckdb/src/common/arrow/appender/union_data.cpp +4 -5
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +55 -21
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +85 -10
- package/src/duckdb/src/common/arrow/arrow_merge_event.cpp +142 -0
- package/src/duckdb/src/common/arrow/arrow_query_result.cpp +56 -0
- package/src/duckdb/src/common/arrow/physical_arrow_batch_collector.cpp +37 -0
- package/src/duckdb/src/common/arrow/physical_arrow_collector.cpp +128 -0
- package/src/duckdb/src/common/arrow/schema_metadata.cpp +101 -0
- package/src/duckdb/src/common/cgroups.cpp +189 -0
- package/src/duckdb/src/common/compressed_file_system.cpp +6 -3
- package/src/duckdb/src/common/encryption_state.cpp +38 -0
- package/src/duckdb/src/common/enum_util.cpp +682 -14
- package/src/duckdb/src/common/enums/file_compression_type.cpp +24 -0
- package/src/duckdb/src/common/enums/metric_type.cpp +208 -0
- package/src/duckdb/src/common/enums/optimizer_type.cpp +8 -2
- package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -0
- package/src/duckdb/src/common/enums/relation_type.cpp +4 -0
- package/src/duckdb/src/common/enums/statement_type.cpp +15 -0
- package/src/duckdb/src/common/error_data.cpp +22 -20
- package/src/duckdb/src/common/exception/binder_exception.cpp +5 -0
- package/src/duckdb/src/common/exception.cpp +11 -1
- package/src/duckdb/src/common/extra_type_info.cpp +3 -0
- package/src/duckdb/src/common/file_buffer.cpp +1 -1
- package/src/duckdb/src/common/file_system.cpp +25 -3
- package/src/duckdb/src/common/filename_pattern.cpp +1 -0
- package/src/duckdb/src/common/fsst.cpp +15 -14
- package/src/duckdb/src/common/gzip_file_system.cpp +3 -1
- package/src/duckdb/src/common/hive_partitioning.cpp +103 -43
- package/src/duckdb/src/common/http_util.cpp +25 -0
- package/src/duckdb/src/common/local_file_system.cpp +48 -27
- package/src/duckdb/src/common/multi_file_list.cpp +113 -22
- package/src/duckdb/src/common/multi_file_reader.cpp +59 -58
- package/src/duckdb/src/common/operator/cast_operators.cpp +133 -34
- package/src/duckdb/src/common/operator/string_cast.cpp +42 -11
- package/src/duckdb/src/common/progress_bar/progress_bar.cpp +2 -2
- package/src/duckdb/src/common/progress_bar/terminal_progress_bar_display.cpp +1 -1
- package/src/duckdb/src/common/radix_partitioning.cpp +31 -21
- package/src/duckdb/src/common/random_engine.cpp +4 -0
- package/src/duckdb/src/common/re2_regex.cpp +47 -12
- package/src/duckdb/src/common/render_tree.cpp +243 -0
- package/src/duckdb/src/common/row_operations/row_aggregate.cpp +1 -1
- package/src/duckdb/src/common/row_operations/row_gather.cpp +2 -2
- package/src/duckdb/src/common/row_operations/row_matcher.cpp +58 -5
- package/src/duckdb/src/common/row_operations/row_radix_scatter.cpp +79 -43
- package/src/duckdb/src/common/serializer/binary_deserializer.cpp +1 -1
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +6 -4
- package/src/duckdb/src/common/serializer/buffered_file_writer.cpp +18 -9
- package/src/duckdb/src/common/serializer/memory_stream.cpp +1 -0
- package/src/duckdb/src/common/sort/partition_state.cpp +33 -18
- package/src/duckdb/src/common/sort/radix_sort.cpp +22 -15
- package/src/duckdb/src/common/sort/sort_state.cpp +19 -16
- package/src/duckdb/src/common/sort/sorted_block.cpp +11 -10
- package/src/duckdb/src/common/string_util.cpp +167 -10
- package/src/duckdb/src/common/tree_renderer/graphviz_tree_renderer.cpp +108 -0
- package/src/duckdb/src/common/tree_renderer/html_tree_renderer.cpp +267 -0
- package/src/duckdb/src/common/tree_renderer/json_tree_renderer.cpp +116 -0
- package/src/duckdb/src/common/tree_renderer/text_tree_renderer.cpp +482 -0
- package/src/duckdb/src/common/tree_renderer/tree_renderer.cpp +12 -0
- package/src/duckdb/src/common/tree_renderer.cpp +16 -508
- package/src/duckdb/src/common/types/batched_data_collection.cpp +78 -9
- package/src/duckdb/src/common/types/bit.cpp +24 -22
- package/src/duckdb/src/common/types/blob.cpp +15 -11
- package/src/duckdb/src/common/types/column/column_data_allocator.cpp +18 -9
- package/src/duckdb/src/common/types/column/column_data_collection.cpp +4 -4
- package/src/duckdb/src/common/types/column/column_data_collection_segment.cpp +3 -4
- package/src/duckdb/src/common/types/column/column_data_consumer.cpp +2 -2
- package/src/duckdb/src/common/types/column/partitioned_column_data.cpp +70 -21
- package/src/duckdb/src/common/types/data_chunk.cpp +10 -1
- package/src/duckdb/src/common/types/date.cpp +8 -19
- package/src/duckdb/src/common/types/decimal.cpp +3 -2
- package/src/duckdb/src/common/types/hugeint.cpp +11 -3
- package/src/duckdb/src/common/types/hyperloglog.cpp +212 -227
- package/src/duckdb/src/common/types/interval.cpp +1 -1
- package/src/duckdb/src/common/types/list_segment.cpp +83 -49
- package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +22 -83
- package/src/duckdb/src/common/types/row/row_data_collection.cpp +2 -2
- package/src/duckdb/src/common/types/row/row_data_collection_scanner.cpp +20 -4
- package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +28 -7
- package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +29 -14
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +152 -102
- package/src/duckdb/src/common/types/row/tuple_data_segment.cpp +4 -1
- package/src/duckdb/src/common/types/selection_vector.cpp +17 -1
- package/src/duckdb/src/common/types/time.cpp +62 -31
- package/src/duckdb/src/common/types/timestamp.cpp +70 -12
- package/src/duckdb/src/common/types/uuid.cpp +1 -1
- package/src/duckdb/src/common/types/validity_mask.cpp +40 -5
- package/src/duckdb/src/common/types/value.cpp +50 -8
- package/src/duckdb/src/common/types/varint.cpp +295 -0
- package/src/duckdb/src/common/types/vector.cpp +165 -54
- package/src/duckdb/src/common/types/vector_buffer.cpp +5 -4
- package/src/duckdb/src/common/types.cpp +106 -26
- package/src/duckdb/src/common/vector_operations/vector_copy.cpp +13 -25
- package/src/duckdb/src/common/vector_operations/vector_hash.cpp +6 -0
- package/src/duckdb/src/common/virtual_file_system.cpp +3 -3
- package/src/duckdb/src/core_functions/aggregate/distributive/approx_count.cpp +35 -82
- package/src/duckdb/src/core_functions/aggregate/distributive/arg_min_max.cpp +283 -46
- package/src/duckdb/src/core_functions/aggregate/distributive/bitagg.cpp +4 -4
- package/src/duckdb/src/core_functions/aggregate/distributive/entropy.cpp +3 -2
- package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +226 -338
- package/src/duckdb/src/core_functions/aggregate/distributive/sum.cpp +2 -0
- package/src/duckdb/src/core_functions/aggregate/holistic/approx_top_k.cpp +388 -0
- package/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp +63 -21
- package/src/duckdb/src/core_functions/aggregate/holistic/mad.cpp +330 -0
- package/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp +136 -97
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +601 -1485
- package/src/duckdb/src/core_functions/aggregate/nested/binned_histogram.cpp +405 -0
- package/src/duckdb/src/core_functions/aggregate/nested/histogram.cpp +136 -165
- package/src/duckdb/src/core_functions/function_list.cpp +35 -8
- package/src/duckdb/src/core_functions/lambda_functions.cpp +5 -7
- package/src/duckdb/src/core_functions/scalar/array/array_functions.cpp +172 -198
- package/src/duckdb/src/core_functions/scalar/blob/create_sort_key.cpp +341 -54
- package/src/duckdb/src/core_functions/scalar/date/date_diff.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +89 -29
- package/src/duckdb/src/core_functions/scalar/date/date_trunc.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/date/make_date.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/date/strftime.cpp +133 -71
- package/src/duckdb/src/core_functions/scalar/date/to_interval.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/enum/enum_functions.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/generic/can_implicitly_cast.cpp +40 -0
- package/src/duckdb/src/core_functions/scalar/generic/error.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/generic/least.cpp +161 -58
- package/src/duckdb/src/core_functions/scalar/generic/typeof.cpp +13 -0
- package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +59 -75
- package/src/duckdb/src/core_functions/scalar/list/list_distance.cpp +93 -40
- package/src/duckdb/src/core_functions/scalar/list/list_has_any_or_all.cpp +227 -0
- package/src/duckdb/src/core_functions/scalar/list/list_reduce.cpp +20 -19
- package/src/duckdb/src/core_functions/scalar/list/list_sort.cpp +0 -2
- package/src/duckdb/src/core_functions/scalar/list/list_value.cpp +106 -8
- package/src/duckdb/src/core_functions/scalar/map/map_contains.cpp +56 -0
- package/src/duckdb/src/core_functions/scalar/map/map_extract.cpp +73 -118
- package/src/duckdb/src/core_functions/scalar/math/numeric.cpp +98 -2
- package/src/duckdb/src/core_functions/scalar/operators/bitwise.cpp +1 -2
- package/src/duckdb/src/core_functions/scalar/random/setseed.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/string/bar.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/string/hex.cpp +5 -1
- package/src/duckdb/src/core_functions/scalar/string/md5.cpp +10 -37
- package/src/duckdb/src/core_functions/scalar/string/printf.cpp +18 -2
- package/src/duckdb/src/core_functions/scalar/string/repeat.cpp +45 -0
- package/src/duckdb/src/core_functions/scalar/string/reverse.cpp +4 -5
- package/src/duckdb/src/core_functions/scalar/string/sha1.cpp +35 -0
- package/src/duckdb/src/core_functions/scalar/string/sha256.cpp +5 -2
- package/src/duckdb/src/core_functions/scalar/string/url_encode.cpp +49 -0
- package/src/duckdb/src/core_functions/scalar/struct/struct_pack.cpp +1 -2
- package/src/duckdb/src/core_functions/scalar/union/union_extract.cpp +4 -2
- package/src/duckdb/src/execution/adaptive_filter.cpp +30 -11
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +13 -18
- package/src/duckdb/src/execution/expression_executor/execute_conjunction.cpp +4 -9
- package/src/duckdb/src/execution/expression_executor.cpp +1 -1
- package/src/duckdb/src/execution/index/art/art.cpp +683 -670
- package/src/duckdb/src/execution/index/art/art_key.cpp +121 -38
- package/src/duckdb/src/execution/index/art/base_leaf.cpp +168 -0
- package/src/duckdb/src/execution/index/art/base_node.cpp +163 -0
- package/src/duckdb/src/execution/index/art/iterator.cpp +148 -77
- package/src/duckdb/src/execution/index/art/leaf.cpp +159 -263
- package/src/duckdb/src/execution/index/art/node.cpp +493 -247
- package/src/duckdb/src/execution/index/art/node256.cpp +31 -91
- package/src/duckdb/src/execution/index/art/node256_leaf.cpp +71 -0
- package/src/duckdb/src/execution/index/art/node48.cpp +75 -143
- package/src/duckdb/src/execution/index/art/prefix.cpp +424 -244
- package/src/duckdb/src/execution/index/bound_index.cpp +7 -1
- package/src/duckdb/src/execution/index/fixed_size_allocator.cpp +22 -18
- package/src/duckdb/src/execution/index/fixed_size_buffer.cpp +22 -73
- package/src/duckdb/src/execution/join_hashtable.cpp +637 -179
- package/src/duckdb/src/execution/operator/aggregate/aggregate_object.cpp +4 -4
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +15 -10
- package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +13 -8
- package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +525 -132
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +147 -138
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +531 -312
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.cpp +4 -3
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_file_handle.cpp +9 -2
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/base_scanner.cpp +13 -17
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/column_count_scanner.cpp +60 -16
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/csv_schema.cpp +105 -0
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/scanner_boundary.cpp +24 -24
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/skip_scanner.cpp +25 -2
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +275 -112
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +106 -11
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +253 -115
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +93 -52
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +116 -76
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_refinement.cpp +29 -14
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_replacement.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.cpp +70 -26
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_file_scanner.cpp +81 -60
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/global_csv_state.cpp +88 -50
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_error.cpp +161 -51
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +59 -17
- package/src/duckdb/src/execution/operator/filter/physical_filter.cpp +5 -5
- package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +0 -21
- package/src/duckdb/src/execution/operator/helper/physical_buffered_batch_collector.cpp +109 -0
- package/src/duckdb/src/execution/operator/helper/physical_buffered_collector.cpp +5 -13
- package/src/duckdb/src/execution/operator/helper/physical_explain_analyze.cpp +1 -1
- package/src/duckdb/src/execution/operator/helper/physical_load.cpp +12 -4
- package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +0 -16
- package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +4 -2
- package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +5 -0
- package/src/duckdb/src/execution/operator/helper/physical_result_collector.cpp +3 -1
- package/src/duckdb/src/execution/operator/helper/physical_set_variable.cpp +39 -0
- package/src/duckdb/src/execution/operator/helper/physical_streaming_sample.cpp +4 -2
- package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +16 -5
- package/src/duckdb/src/execution/operator/join/outer_join_marker.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +5 -4
- package/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp +59 -21
- package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +7 -4
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +333 -176
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +57 -34
- package/src/duckdb/src/execution/operator/join/physical_join.cpp +16 -8
- package/src/duckdb/src/execution/operator/join/physical_left_delim_join.cpp +10 -4
- package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +2 -5
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +5 -5
- package/src/duckdb/src/execution/operator/join/physical_right_delim_join.cpp +7 -2
- package/src/duckdb/src/execution/operator/order/physical_order.cpp +17 -12
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +12 -9
- package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +35 -17
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +17 -11
- package/src/duckdb/src/execution/operator/persistent/physical_copy_database.cpp +5 -1
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +156 -47
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +10 -2
- package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +1 -3
- package/src/duckdb/src/execution/operator/projection/physical_pivot.cpp +2 -2
- package/src/duckdb/src/execution/operator/projection/physical_projection.cpp +13 -6
- package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +22 -3
- package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +19 -3
- package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +37 -22
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +77 -21
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +27 -55
- package/src/duckdb/src/execution/operator/schema/physical_create_art_index.cpp +41 -44
- package/src/duckdb/src/execution/operator/set/physical_cte.cpp +4 -6
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +4 -6
- package/src/duckdb/src/execution/operator/set/physical_union.cpp +18 -4
- package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +3 -2
- package/src/duckdb/src/execution/physical_operator.cpp +45 -4
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +18 -7
- package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +8 -3
- package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +13 -6
- package/src/duckdb/src/execution/physical_plan/plan_explain.cpp +3 -3
- package/src/duckdb/src/execution/physical_plan/plan_get.cpp +111 -19
- package/src/duckdb/src/execution/physical_plan/plan_limit.cpp +19 -2
- package/src/duckdb/src/execution/physical_plan/plan_set.cpp +9 -0
- package/src/duckdb/src/execution/physical_plan/plan_window.cpp +3 -1
- package/src/duckdb/src/execution/physical_plan_generator.cpp +3 -3
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +49 -49
- package/src/duckdb/src/execution/reservoir_sample.cpp +2 -2
- package/src/duckdb/src/execution/window_executor.cpp +556 -318
- package/src/duckdb/src/execution/window_segment_tree.cpp +1058 -485
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +5 -5
- package/src/duckdb/src/function/aggregate/distributive/first.cpp +92 -95
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +10 -9
- package/src/duckdb/src/function/aggregate_function.cpp +8 -0
- package/src/duckdb/src/function/cast/cast_function_set.cpp +10 -1
- package/src/duckdb/src/function/cast/decimal_cast.cpp +10 -1
- package/src/duckdb/src/function/cast/default_casts.cpp +2 -0
- package/src/duckdb/src/function/cast/numeric_casts.cpp +3 -0
- package/src/duckdb/src/function/cast/string_cast.cpp +8 -5
- package/src/duckdb/src/function/cast/time_casts.cpp +2 -2
- package/src/duckdb/src/function/cast/union_casts.cpp +1 -1
- package/src/duckdb/src/function/cast/varint_casts.cpp +283 -0
- package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +3 -1
- package/src/duckdb/src/function/cast_rules.cpp +104 -15
- package/src/duckdb/src/function/compression_config.cpp +35 -33
- package/src/duckdb/src/function/copy_function.cpp +27 -0
- package/src/duckdb/src/function/function_binder.cpp +39 -11
- package/src/duckdb/src/function/macro_function.cpp +75 -32
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +10 -0
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_string.cpp +1 -0
- package/src/duckdb/src/function/scalar/generic/binning.cpp +507 -0
- package/src/duckdb/src/function/scalar/generic/getvariable.cpp +58 -0
- package/src/duckdb/src/function/scalar/generic_functions.cpp +1 -0
- package/src/duckdb/src/function/scalar/list/contains_or_position.cpp +33 -47
- package/src/duckdb/src/function/scalar/list/list_extract.cpp +70 -143
- package/src/duckdb/src/function/scalar/list/list_resize.cpp +93 -84
- package/src/duckdb/src/function/scalar/list/list_zip.cpp +3 -0
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +24 -11
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +4 -4
- package/src/duckdb/src/function/scalar/strftime_format.cpp +196 -57
- package/src/duckdb/src/function/scalar/string/caseconvert.cpp +9 -7
- package/src/duckdb/src/function/scalar/string/concat.cpp +239 -123
- package/src/duckdb/src/function/scalar/string/concat_ws.cpp +149 -0
- package/src/duckdb/src/function/scalar/string/contains.cpp +18 -7
- package/src/duckdb/src/function/scalar/string/like.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/substring.cpp +6 -11
- package/src/duckdb/src/function/scalar/string_functions.cpp +1 -0
- package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +7 -3
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +5 -5
- package/src/duckdb/src/function/scalar_function.cpp +5 -2
- package/src/duckdb/src/function/scalar_macro_function.cpp +2 -2
- package/src/duckdb/src/function/table/arrow/arrow_duck_schema.cpp +20 -39
- package/src/duckdb/src/function/table/arrow/arrow_type_info.cpp +135 -0
- package/src/duckdb/src/function/table/arrow.cpp +194 -52
- package/src/duckdb/src/function/table/arrow_conversion.cpp +212 -69
- package/src/duckdb/src/function/table/copy_csv.cpp +43 -14
- package/src/duckdb/src/function/table/query_function.cpp +80 -0
- package/src/duckdb/src/function/table/range.cpp +222 -142
- package/src/duckdb/src/function/table/read_csv.cpp +25 -13
- package/src/duckdb/src/function/table/sniff_csv.cpp +55 -35
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +141 -129
- package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +25 -14
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +20 -14
- package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +15 -1
- package/src/duckdb/src/function/table/system/duckdb_variables.cpp +84 -0
- package/src/duckdb/src/function/table/system/test_all_types.cpp +1 -0
- package/src/duckdb/src/function/table/system/test_vector_types.cpp +33 -3
- package/src/duckdb/src/function/table/system_functions.cpp +1 -0
- package/src/duckdb/src/function/table/table_scan.cpp +45 -22
- package/src/duckdb/src/function/table/unnest.cpp +2 -2
- package/src/duckdb/src/function/table/version/pragma_version.cpp +4 -4
- package/src/duckdb/src/function/table_function.cpp +5 -4
- package/src/duckdb/src/function/table_macro_function.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +8 -4
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +5 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +3 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +3 -4
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +5 -5
- package/src/duckdb/src/include/duckdb/catalog/default/builtin_types/types.hpp +2 -1
- package/src/duckdb/src/include/duckdb/catalog/default/default_functions.hpp +4 -5
- package/src/duckdb/src/include/duckdb/catalog/default/default_generator.hpp +4 -5
- package/src/duckdb/src/include/duckdb/catalog/default/default_schemas.hpp +2 -1
- package/src/duckdb/src/include/duckdb/catalog/default/default_table_functions.hpp +47 -0
- package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +2 -0
- package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +9 -1
- package/src/duckdb/src/include/duckdb/common/array_ptr.hpp +120 -0
- package/src/duckdb/src/include/duckdb/common/arrow/appender/append_data.hpp +37 -11
- package/src/duckdb/src/include/duckdb/common/arrow/appender/enum_data.hpp +9 -8
- package/src/duckdb/src/include/duckdb/common/arrow/appender/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/arrow/appender/list_data.hpp +6 -4
- package/src/duckdb/src/include/duckdb/common/arrow/appender/list_view_data.hpp +92 -0
- package/src/duckdb/src/include/duckdb/common/arrow/appender/map_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/arrow/appender/scalar_data.hpp +26 -4
- package/src/duckdb/src/include/duckdb/common/arrow/appender/varchar_data.hpp +90 -11
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_buffer.hpp +8 -1
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_merge_event.hpp +62 -0
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_query_result.hpp +52 -0
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_types_extension.hpp +42 -0
- package/src/duckdb/src/include/duckdb/common/arrow/physical_arrow_batch_collector.hpp +30 -0
- package/src/duckdb/src/include/duckdb/common/arrow/physical_arrow_collector.hpp +65 -0
- package/src/duckdb/src/include/duckdb/common/arrow/schema_metadata.hpp +43 -0
- package/src/duckdb/src/include/duckdb/common/bswap.hpp +18 -16
- package/src/duckdb/src/include/duckdb/common/cgroups.hpp +30 -0
- package/src/duckdb/src/include/duckdb/common/compressed_file_system.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/dl.hpp +8 -1
- package/src/duckdb/src/include/duckdb/common/encryption_state.hpp +48 -0
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +88 -0
- package/src/duckdb/src/include/duckdb/common/enums/checkpoint_type.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/enums/copy_overwrite_mode.hpp +6 -1
- package/src/duckdb/src/include/duckdb/common/enums/destroy_buffer_upon.hpp +21 -0
- package/src/duckdb/src/include/duckdb/common/enums/explain_format.hpp +17 -0
- package/src/duckdb/src/include/duckdb/common/enums/file_compression_type.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/enums/join_type.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/enums/metric_type.hpp +88 -0
- package/src/duckdb/src/include/duckdb/common/enums/optimizer_type.hpp +6 -1
- package/src/duckdb/src/include/duckdb/common/enums/pending_execution_result.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/profiler_format.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/enums/relation_type.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/enums/set_scope.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/enums/statement_type.hpp +23 -2
- package/src/duckdb/src/include/duckdb/common/enums/stream_execution_result.hpp +25 -0
- package/src/duckdb/src/include/duckdb/common/enums/tableref_type.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/enums/wal_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/error_data.hpp +5 -2
- package/src/duckdb/src/include/duckdb/common/exception/binder_exception.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/exception.hpp +20 -2
- package/src/duckdb/src/include/duckdb/common/extra_operator_info.hpp +12 -0
- package/src/duckdb/src/include/duckdb/common/file_buffer.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/file_open_flags.hpp +16 -0
- package/src/duckdb/src/include/duckdb/common/file_opener.hpp +18 -0
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/filename_pattern.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/fixed_size_map.hpp +160 -96
- package/src/duckdb/src/include/duckdb/common/fsst.hpp +9 -2
- package/src/duckdb/src/include/duckdb/common/helper.hpp +22 -8
- package/src/duckdb/src/include/duckdb/common/hive_partitioning.hpp +16 -7
- package/src/duckdb/src/include/duckdb/common/http_util.hpp +19 -0
- package/src/duckdb/src/include/duckdb/common/insertion_order_preserving_map.hpp +19 -6
- package/src/duckdb/src/include/duckdb/common/limits.hpp +9 -2
- package/src/duckdb/src/include/duckdb/common/multi_file_list.hpp +38 -6
- package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +9 -2
- package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +5 -1
- package/src/duckdb/src/include/duckdb/common/numeric_utils.hpp +82 -50
- package/src/duckdb/src/include/duckdb/common/operator/abs.hpp +11 -0
- package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +7 -3
- package/src/duckdb/src/include/duckdb/common/operator/decimal_cast_operators.hpp +23 -1
- package/src/duckdb/src/include/duckdb/common/operator/double_cast_operator.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/operator/integer_cast_operator.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/operator/numeric_cast.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/operator/string_cast.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +10 -5
- package/src/duckdb/src/include/duckdb/common/optionally_owned_ptr.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/owning_string_map.hpp +155 -0
- package/src/duckdb/src/include/duckdb/common/perfect_map_set.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/platform.hpp +58 -0
- package/src/duckdb/src/include/duckdb/common/radix.hpp +172 -27
- package/src/duckdb/src/include/duckdb/common/radix_partitioning.hpp +5 -1
- package/src/duckdb/src/include/duckdb/common/random_engine.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/re2_regex.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/render_tree.hpp +77 -0
- package/src/duckdb/src/include/duckdb/common/row_operations/row_matcher.hpp +12 -0
- package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +6 -2
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_writer.hpp +5 -3
- package/src/duckdb/src/include/duckdb/common/serializer/deserializer.hpp +15 -7
- package/src/duckdb/src/include/duckdb/common/serializer/memory_stream.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_data.hpp +245 -0
- package/src/duckdb/src/include/duckdb/common/serializer/serializer.hpp +10 -0
- package/src/duckdb/src/include/duckdb/common/sort/duckdb_pdqsort.hpp +10 -11
- package/src/duckdb/src/include/duckdb/common/sort/partition_state.hpp +12 -6
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +37 -7
- package/src/duckdb/src/include/duckdb/common/tree_renderer/graphviz_tree_renderer.hpp +44 -0
- package/src/duckdb/src/include/duckdb/common/tree_renderer/html_tree_renderer.hpp +44 -0
- package/src/duckdb/src/include/duckdb/common/tree_renderer/json_tree_renderer.hpp +44 -0
- package/src/duckdb/src/include/duckdb/common/tree_renderer/text_tree_renderer.hpp +119 -0
- package/src/duckdb/src/include/duckdb/common/tree_renderer.hpp +9 -123
- package/src/duckdb/src/include/duckdb/common/type_visitor.hpp +96 -0
- package/src/duckdb/src/include/duckdb/common/typedefs.hpp +11 -1
- package/src/duckdb/src/include/duckdb/common/types/arrow_string_view_type.hpp +84 -0
- package/src/duckdb/src/include/duckdb/common/types/batched_data_collection.hpp +36 -1
- package/src/duckdb/src/include/duckdb/common/types/bit.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/cast_helpers.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_allocator.hpp +4 -2
- package/src/duckdb/src/include/duckdb/common/types/column/partitioned_column_data.hpp +52 -0
- package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/types/date.hpp +0 -3
- package/src/duckdb/src/include/duckdb/common/types/date_lookup_cache.hpp +65 -0
- package/src/duckdb/src/include/duckdb/common/types/datetime.hpp +5 -2
- package/src/duckdb/src/include/duckdb/common/types/hyperloglog.hpp +49 -40
- package/src/duckdb/src/include/duckdb/common/types/interval.hpp +5 -1
- package/src/duckdb/src/include/duckdb/common/types/list_segment.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +41 -9
- package/src/duckdb/src/include/duckdb/common/types/row/row_data_collection.hpp +4 -3
- package/src/duckdb/src/include/duckdb/common/types/row/row_data_collection_scanner.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_allocator.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_states.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +4 -1
- package/src/duckdb/src/include/duckdb/common/types/time.hpp +11 -6
- package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +13 -3
- package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +103 -12
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +12 -3
- package/src/duckdb/src/include/duckdb/common/types/varint.hpp +107 -0
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +5 -1
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +7 -2
- package/src/duckdb/src/include/duckdb/common/types.hpp +6 -39
- package/src/duckdb/src/include/duckdb/common/union_by_name.hpp +42 -10
- package/src/duckdb/src/include/duckdb/common/vector_operations/generic_executor.hpp +29 -0
- package/src/duckdb/src/include/duckdb/common/vector_operations/unary_executor.hpp +0 -7
- package/src/duckdb/src/include/duckdb/common/vector_operations/vector_operations.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/winapi.hpp +8 -0
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic/covar.hpp +8 -4
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/algebraic/stddev.hpp +8 -4
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/distributive_functions.hpp +4 -2
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/histogram_helpers.hpp +99 -0
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/holistic_functions.hpp +16 -7
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/minmax_n_helpers.hpp +396 -0
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/nested_functions.hpp +10 -0
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/quantile_helpers.hpp +65 -0
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/quantile_sort_tree.hpp +349 -0
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/quantile_state.hpp +300 -0
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/regression/regr_slope.hpp +1 -1
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/sort_key_helpers.hpp +55 -0
- package/src/duckdb/src/include/duckdb/core_functions/array_kernels.hpp +107 -0
- package/src/duckdb/src/include/duckdb/core_functions/create_sort_key.hpp +55 -0
- package/src/duckdb/src/include/duckdb/core_functions/lambda_functions.hpp +1 -2
- package/src/duckdb/src/include/duckdb/core_functions/scalar/array_functions.hpp +24 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/date_functions.hpp +9 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/generic_functions.hpp +27 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +80 -8
- package/src/duckdb/src/include/duckdb/core_functions/scalar/map_functions.hpp +9 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/math_functions.hpp +54 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +30 -21
- package/src/duckdb/src/include/duckdb/execution/adaptive_filter.hpp +25 -14
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +2 -48
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +25 -2
- package/src/duckdb/src/include/duckdb/execution/ht_entry.hpp +102 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +94 -101
- package/src/duckdb/src/include/duckdb/execution/index/art/art_key.hpp +43 -25
- package/src/duckdb/src/include/duckdb/execution/index/art/base_leaf.hpp +109 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/base_node.hpp +140 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/iterator.hpp +43 -24
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +41 -52
- package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +133 -74
- package/src/duckdb/src/include/duckdb/execution/index/art/node256.hpp +46 -29
- package/src/duckdb/src/include/duckdb/execution/index/art/node256_leaf.hpp +53 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +52 -35
- package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +96 -57
- package/src/duckdb/src/include/duckdb/execution/index/bound_index.hpp +9 -4
- package/src/duckdb/src/include/duckdb/execution/index/fixed_size_allocator.hpp +48 -10
- package/src/duckdb/src/include/duckdb/execution/index/fixed_size_buffer.hpp +0 -2
- package/src/duckdb/src/include/duckdb/execution/index/index_pointer.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +114 -36
- package/src/duckdb/src/include/duckdb/execution/merge_sort_tree.hpp +158 -67
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/aggregate_object.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_streaming_window.hpp +19 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/ungrouped_aggregate_state.hpp +75 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/base_scanner.hpp +81 -23
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/column_count_scanner.hpp +27 -8
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer_manager.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_error.hpp +31 -22
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_handle.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_scanner.hpp +48 -5
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_option.hpp +7 -3
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +22 -12
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_schema.hpp +35 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_sniffer.hpp +81 -39
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine.hpp +18 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine_cache.hpp +9 -7
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/global_csv_state.hpp +5 -4
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/header_value.hpp +26 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner_boundary.hpp +6 -9
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/skip_scanner.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine_options.hpp +5 -3
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/string_value_scanner.hpp +36 -19
- package/src/duckdb/src/include/duckdb/execution/operator/filter/physical_filter.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +21 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_buffered_batch_collector.hpp +53 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_buffered_collector.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +6 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +18 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_result_collector.hpp +6 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set_variable.hpp +43 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_sample.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/join_filter_pushdown.hpp +59 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_comparison_join.hpp +8 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +5 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_left_delim_join.hpp +3 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_range_join.hpp +4 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_right_delim_join.hpp +3 -1
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/batch_memory_manager.hpp +5 -37
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp +5 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +8 -2
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_projection.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_tableinout_function.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +9 -3
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +8 -6
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_art_index.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_cte.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +21 -6
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/window_executor.hpp +137 -110
- package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +57 -126
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +21 -4
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/compression/compression.hpp +10 -10
- package/src/duckdb/src/include/duckdb/function/compression_function.hpp +37 -7
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +24 -11
- package/src/duckdb/src/include/duckdb/function/function_binder.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +41 -1
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +15 -5
- package/src/duckdb/src/include/duckdb/function/pragma/pragma_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/replacement_scan.hpp +20 -4
- package/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp +6 -0
- package/src/duckdb/src/include/duckdb/function/scalar/list/contains_or_position.hpp +77 -109
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar/regexp.hpp +6 -3
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +25 -12
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +9 -8
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +38 -4
- package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_duck_schema.hpp +11 -57
- package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_type_info.hpp +142 -0
- package/src/duckdb/src/include/duckdb/function/table/arrow/enum/arrow_datetime_type.hpp +18 -0
- package/src/duckdb/src/include/duckdb/function/table/arrow/enum/arrow_type_info_type.hpp +7 -0
- package/src/duckdb/src/include/duckdb/function/table/arrow/enum/arrow_variable_size_type.hpp +10 -0
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +2 -0
- package/src/duckdb/src/include/duckdb/function/table/range.hpp +4 -0
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +4 -1
- package/src/duckdb/src/include/duckdb/function/table/system_functions.hpp +4 -0
- package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +5 -5
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +14 -2
- package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/appender.hpp +14 -4
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +25 -7
- package/src/duckdb/src/include/duckdb/main/buffered_data/batched_buffered_data.hpp +79 -0
- package/src/duckdb/src/include/duckdb/main/buffered_data/buffered_data.hpp +10 -20
- package/src/duckdb/src/include/duckdb/main/buffered_data/simple_buffered_data.hpp +11 -12
- package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +7 -2
- package/src/duckdb/src/include/duckdb/main/capi/cast/generic.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/capi/cast/utils.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/capi/extension_api.hpp +809 -0
- package/src/duckdb/src/include/duckdb/main/chunk_scan_state/batched_data_collection.hpp +35 -0
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +68 -2
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +30 -22
- package/src/duckdb/src/include/duckdb/main/client_context_state.hpp +79 -1
- package/src/duckdb/src/include/duckdb/main/client_properties.hpp +9 -3
- package/src/duckdb/src/include/duckdb/main/config.hpp +55 -7
- package/src/duckdb/src/include/duckdb/main/connection.hpp +5 -1
- package/src/duckdb/src/include/duckdb/main/database.hpp +16 -5
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +9 -8
- package/src/duckdb/src/include/duckdb/main/db_instance_cache.hpp +21 -6
- package/src/duckdb/src/include/duckdb/main/extension.hpp +20 -0
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +25 -0
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +29 -23
- package/src/duckdb/src/include/duckdb/main/extension_install_info.hpp +6 -0
- package/src/duckdb/src/include/duckdb/main/extension_util.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/pending_query_result.hpp +4 -2
- package/src/duckdb/src/include/duckdb/main/prepared_statement.hpp +5 -6
- package/src/duckdb/src/include/duckdb/main/prepared_statement_data.hpp +2 -5
- package/src/duckdb/src/include/duckdb/main/profiling_info.hpp +87 -0
- package/src/duckdb/src/include/duckdb/main/profiling_node.hpp +60 -0
- package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +72 -34
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/relation/create_table_relation.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/relation/delim_get_relation.hpp +30 -0
- package/src/duckdb/src/include/duckdb/main/relation/explain_relation.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/relation/join_relation.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/relation/materialized_relation.hpp +1 -4
- package/src/duckdb/src/include/duckdb/main/relation/query_relation.hpp +4 -1
- package/src/duckdb/src/include/duckdb/main/relation/read_json_relation.hpp +6 -0
- package/src/duckdb/src/include/duckdb/main/relation/table_function_relation.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/relation/view_relation.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/relation.hpp +7 -4
- package/src/duckdb/src/include/duckdb/main/secret/default_secrets.hpp +36 -0
- package/src/duckdb/src/include/duckdb/main/secret/secret.hpp +108 -0
- package/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp +14 -4
- package/src/duckdb/src/include/duckdb/main/settings.hpp +227 -3
- package/src/duckdb/src/include/duckdb/main/stream_query_result.hpp +8 -0
- package/src/duckdb/src/include/duckdb/optimizer/build_probe_side_optimizer.hpp +51 -0
- package/src/duckdb/src/include/duckdb/optimizer/compressed_materialization.hpp +7 -0
- package/src/duckdb/src/include/duckdb/optimizer/cte_filter_pusher.hpp +46 -0
- package/src/duckdb/src/include/duckdb/optimizer/filter_combiner.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/filter_pushdown.hpp +7 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_filter_pushdown_optimizer.hpp +31 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +51 -10
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cost_model.hpp +1 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_order_optimizer.hpp +17 -5
- package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph_manager.hpp +15 -13
- package/src/duckdb/src/include/duckdb/optimizer/join_order/relation_manager.hpp +9 -4
- package/src/duckdb/src/include/duckdb/optimizer/limit_pushdown.hpp +25 -0
- package/src/duckdb/src/include/duckdb/optimizer/optimizer.hpp +1 -0
- package/src/duckdb/src/include/duckdb/optimizer/rule/join_dependent_filter.hpp +37 -0
- package/src/duckdb/src/include/duckdb/parallel/executor_task.hpp +6 -1
- package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +54 -2
- package/src/duckdb/src/include/duckdb/parallel/meta_pipeline.hpp +27 -8
- package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parallel/pipeline_prepare_finish_event.hpp +25 -0
- package/src/duckdb/src/include/duckdb/parallel/task_executor.hpp +63 -0
- package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +10 -1
- package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +4 -1
- package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +11 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +9 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_expression_iterator.hpp +13 -6
- package/src/duckdb/src/include/duckdb/parser/parser_extension.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/sql_statement.hpp +1 -3
- package/src/duckdb/src/include/duckdb/parser/statement/copy_statement.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/statement/explain_statement.hpp +5 -1
- package/src/duckdb/src/include/duckdb/parser/statement/set_statement.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/statement/transaction_statement.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/tableref/basetableref.hpp +0 -2
- package/src/duckdb/src/include/duckdb/parser/tableref/column_data_ref.hpp +9 -7
- package/src/duckdb/src/include/duckdb/parser/tableref/delimgetref.hpp +37 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/joinref.hpp +4 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +0 -2
- package/src/duckdb/src/include/duckdb/parser/tableref/subqueryref.hpp +0 -2
- package/src/duckdb/src/include/duckdb/parser/tableref/table_function_ref.hpp +0 -1
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +3 -1
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +17 -9
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +24 -14
- package/src/duckdb/src/include/duckdb/planner/collation_binding.hpp +44 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_aggregate_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_conjunction_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_constant_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_expanded_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_function_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_operator_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_data.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_reference_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_subquery_expression.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression/bound_unnest_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_window_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/column_alias_binder.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder/group_binder.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder/order_binder.hpp +6 -5
- package/src/duckdb/src/include/duckdb/planner/expression_binder/where_binder.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +19 -11
- package/src/duckdb/src/include/duckdb/planner/filter/conjunction_filter.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/filter/constant_filter.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/filter/null_filter.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/filter/struct_filter.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +7 -2
- package/src/duckdb/src/include/duckdb/planner/logical_operator_visitor.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_any_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +6 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +10 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_execute.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +4 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +15 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_materialized_cte.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/subquery/flatten_dependent_join.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/table_filter.hpp +24 -2
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_delimgetref.hpp +26 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_joinref.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_subqueryref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_table_function.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/list.hpp +2 -0
- package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/block.hpp +4 -2
- package/src/duckdb/src/include/duckdb/storage/block_manager.hpp +48 -3
- package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +21 -7
- package/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +65 -51
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +14 -5
- package/src/duckdb/src/include/duckdb/storage/checkpoint/row_group_writer.hpp +0 -4
- package/src/duckdb/src/include/duckdb/storage/checkpoint/string_checkpoint_state.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/checkpoint/write_overflow_strings_to_disk.hpp +3 -4
- package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +2 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alp/algorithm/alp.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_analyze.hpp +6 -4
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_compress.hpp +19 -17
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_constants.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_scan.hpp +3 -4
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_utils.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/algorithm/alprd.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_analyze.hpp +13 -11
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_compress.hpp +19 -19
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_scan.hpp +3 -4
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +10 -2
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/in_memory_block_manager.hpp +15 -0
- package/src/duckdb/src/include/duckdb/storage/index_storage_info.hpp +14 -10
- package/src/duckdb/src/include/duckdb/storage/metadata/metadata_manager.hpp +6 -8
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +7 -4
- package/src/duckdb/src/include/duckdb/storage/segment/uncompressed.hpp +4 -7
- package/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp +29 -4
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +22 -7
- package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +15 -2
- package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +8 -2
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats.hpp +5 -16
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats_union.hpp +51 -13
- package/src/duckdb/src/include/duckdb/storage/statistics/string_stats.hpp +6 -3
- package/src/duckdb/src/include/duckdb/storage/storage_info.hpp +29 -19
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +23 -7
- package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +27 -18
- package/src/duckdb/src/include/duckdb/storage/table/append_state.hpp +6 -3
- package/src/duckdb/src/include/duckdb/storage/table/array_column_data.hpp +5 -2
- package/src/duckdb/src/include/duckdb/storage/table/chunk_info.hpp +3 -0
- package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +5 -1
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +77 -6
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +23 -11
- package/src/duckdb/src/include/duckdb/storage/table/data_table_info.hpp +3 -0
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +5 -2
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +18 -4
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +7 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_version_manager.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +89 -14
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +4 -2
- package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +4 -2
- package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/validity_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/temporary_memory_manager.hpp +33 -15
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +9 -9
- package/src/duckdb/src/include/duckdb/transaction/cleanup_state.hpp +3 -1
- package/src/duckdb/src/include/duckdb/transaction/commit_state.hpp +4 -16
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +27 -4
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction_manager.hpp +11 -0
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +6 -2
- package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +5 -5
- package/src/duckdb/src/include/duckdb/transaction/transaction_context.hpp +6 -2
- package/src/duckdb/src/include/duckdb/transaction/undo_buffer.hpp +5 -3
- package/src/duckdb/src/include/duckdb/transaction/wal_write_state.hpp +48 -0
- package/src/duckdb/src/include/duckdb.h +1779 -739
- package/src/duckdb/src/include/duckdb_extension.h +921 -0
- package/src/duckdb/src/main/appender.cpp +53 -7
- package/src/duckdb/src/main/attached_database.cpp +87 -17
- package/src/duckdb/src/main/buffered_data/batched_buffered_data.cpp +226 -0
- package/src/duckdb/src/main/buffered_data/buffered_data.cpp +35 -0
- package/src/duckdb/src/main/buffered_data/simple_buffered_data.cpp +48 -23
- package/src/duckdb/src/main/capi/aggregate_function-c.cpp +327 -0
- package/src/duckdb/src/main/capi/appender-c.cpp +18 -0
- package/src/duckdb/src/main/capi/cast/utils-c.cpp +2 -2
- package/src/duckdb/src/main/capi/cast_function-c.cpp +210 -0
- package/src/duckdb/src/main/capi/config-c.cpp +3 -3
- package/src/duckdb/src/main/capi/data_chunk-c.cpp +18 -7
- package/src/duckdb/src/main/capi/duckdb_value-c.cpp +223 -24
- package/src/duckdb/src/main/capi/helper-c.cpp +51 -11
- package/src/duckdb/src/main/capi/logical_types-c.cpp +105 -46
- package/src/duckdb/src/main/capi/pending-c.cpp +7 -6
- package/src/duckdb/src/main/capi/prepared-c.cpp +18 -7
- package/src/duckdb/src/main/capi/profiling_info-c.cpp +84 -0
- package/src/duckdb/src/main/capi/result-c.cpp +139 -37
- package/src/duckdb/src/main/capi/scalar_function-c.cpp +269 -0
- package/src/duckdb/src/main/capi/table_description-c.cpp +82 -0
- package/src/duckdb/src/main/capi/table_function-c.cpp +161 -95
- package/src/duckdb/src/main/capi/value-c.cpp +2 -2
- package/src/duckdb/src/main/chunk_scan_state/batched_data_collection.cpp +57 -0
- package/src/duckdb/src/main/client_config.cpp +17 -0
- package/src/duckdb/src/main/client_context.cpp +67 -52
- package/src/duckdb/src/main/client_data.cpp +3 -3
- package/src/duckdb/src/main/config.cpp +120 -62
- package/src/duckdb/src/main/connection.cpp +14 -2
- package/src/duckdb/src/main/database.cpp +96 -35
- package/src/duckdb/src/main/database_manager.cpp +25 -23
- package/src/duckdb/src/main/database_path_and_type.cpp +2 -2
- package/src/duckdb/src/main/db_instance_cache.cpp +54 -19
- package/src/duckdb/src/main/extension/extension_helper.cpp +47 -42
- package/src/duckdb/src/main/extension/extension_install.cpp +155 -87
- package/src/duckdb/src/main/extension/extension_load.cpp +180 -26
- package/src/duckdb/src/main/extension/extension_util.cpp +8 -0
- package/src/duckdb/src/main/extension.cpp +72 -5
- package/src/duckdb/src/main/pending_query_result.cpp +20 -12
- package/src/duckdb/src/main/prepared_statement.cpp +6 -6
- package/src/duckdb/src/main/prepared_statement_data.cpp +28 -17
- package/src/duckdb/src/main/profiling_info.cpp +196 -0
- package/src/duckdb/src/main/query_profiler.cpp +413 -224
- package/src/duckdb/src/main/query_result.cpp +1 -1
- package/src/duckdb/src/main/relation/create_table_relation.cpp +4 -2
- package/src/duckdb/src/main/relation/create_view_relation.cpp +0 -6
- package/src/duckdb/src/main/relation/delim_get_relation.cpp +44 -0
- package/src/duckdb/src/main/relation/explain_relation.cpp +4 -3
- package/src/duckdb/src/main/relation/join_relation.cpp +5 -0
- package/src/duckdb/src/main/relation/limit_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/materialized_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/query_relation.cpp +42 -15
- package/src/duckdb/src/main/relation/read_csv_relation.cpp +7 -14
- package/src/duckdb/src/main/relation/read_json_relation.cpp +20 -0
- package/src/duckdb/src/main/relation/setop_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/table_function_relation.cpp +6 -0
- package/src/duckdb/src/main/relation/view_relation.cpp +10 -0
- package/src/duckdb/src/main/relation.cpp +12 -8
- package/src/duckdb/src/main/secret/default_secrets.cpp +108 -0
- package/src/duckdb/src/main/secret/secret.cpp +145 -2
- package/src/duckdb/src/main/secret/secret_manager.cpp +85 -35
- package/src/duckdb/src/main/secret/secret_storage.cpp +29 -17
- package/src/duckdb/src/main/settings/settings.cpp +503 -11
- package/src/duckdb/src/main/stream_query_result.cpp +75 -2
- package/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp +248 -0
- package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +28 -6
- package/src/duckdb/src/optimizer/compressed_materialization/compress_comparison_join.cpp +152 -0
- package/src/duckdb/src/optimizer/compressed_materialization.cpp +11 -1
- package/src/duckdb/src/optimizer/cse_optimizer.cpp +3 -0
- package/src/duckdb/src/optimizer/cte_filter_pusher.cpp +117 -0
- package/src/duckdb/src/optimizer/filter_combiner.cpp +30 -9
- package/src/duckdb/src/optimizer/filter_pullup.cpp +54 -2
- package/src/duckdb/src/optimizer/filter_pushdown.cpp +71 -3
- package/src/duckdb/src/optimizer/join_filter_pushdown_optimizer.cpp +154 -0
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +245 -114
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +42 -20
- package/src/duckdb/src/optimizer/join_order/join_relation_set.cpp +6 -2
- package/src/duckdb/src/optimizer/join_order/plan_enumerator.cpp +32 -10
- package/src/duckdb/src/optimizer/join_order/query_graph_manager.cpp +97 -131
- package/src/duckdb/src/optimizer/join_order/relation_manager.cpp +265 -51
- package/src/duckdb/src/optimizer/join_order/relation_statistics_helper.cpp +21 -17
- package/src/duckdb/src/optimizer/limit_pushdown.cpp +42 -0
- package/src/duckdb/src/optimizer/optimizer.cpp +51 -8
- package/src/duckdb/src/optimizer/pushdown/pushdown_aggregate.cpp +17 -17
- package/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp +22 -4
- package/src/duckdb/src/optimizer/pushdown/pushdown_get.cpp +1 -18
- package/src/duckdb/src/optimizer/pushdown/pushdown_inner_join.cpp +6 -0
- package/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp +4 -2
- package/src/duckdb/src/optimizer/pushdown/pushdown_window.cpp +91 -0
- package/src/duckdb/src/optimizer/remove_unused_columns.cpp +21 -25
- package/src/duckdb/src/optimizer/rule/comparison_simplification.cpp +1 -0
- package/src/duckdb/src/optimizer/rule/empty_needle_removal.cpp +3 -0
- package/src/duckdb/src/optimizer/rule/equal_or_null_simplification.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/in_clause_simplification_rule.cpp +8 -2
- package/src/duckdb/src/optimizer/rule/join_dependent_filter.cpp +135 -0
- package/src/duckdb/src/optimizer/rule/like_optimizations.cpp +1 -1
- package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +6 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp +7 -6
- package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +1 -1
- package/src/duckdb/src/optimizer/topn_optimizer.cpp +46 -7
- package/src/duckdb/src/parallel/executor.cpp +129 -51
- package/src/duckdb/src/parallel/executor_task.cpp +16 -3
- package/src/duckdb/src/parallel/meta_pipeline.cpp +98 -29
- package/src/duckdb/src/parallel/pipeline.cpp +17 -3
- package/src/duckdb/src/parallel/pipeline_executor.cpp +14 -2
- package/src/duckdb/src/parallel/pipeline_prepare_finish_event.cpp +34 -0
- package/src/duckdb/src/parallel/task_executor.cpp +84 -0
- package/src/duckdb/src/parallel/task_scheduler.cpp +94 -16
- package/src/duckdb/src/parallel/thread_context.cpp +1 -1
- package/src/duckdb/src/parser/expression/function_expression.cpp +14 -0
- package/src/duckdb/src/parser/expression/star_expression.cpp +35 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +5 -1
- package/src/duckdb/src/parser/parsed_data/attach_info.cpp +17 -0
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +37 -28
- package/src/duckdb/src/parser/parsed_data/create_macro_info.cpp +44 -2
- package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +21 -1
- package/src/duckdb/src/parser/parsed_expression_iterator.cpp +29 -25
- package/src/duckdb/src/parser/parser.cpp +41 -1
- package/src/duckdb/src/parser/query_node/recursive_cte_node.cpp +1 -0
- package/src/duckdb/src/parser/statement/explain_statement.cpp +28 -13
- package/src/duckdb/src/parser/statement/relation_statement.cpp +5 -0
- package/src/duckdb/src/parser/statement/set_statement.cpp +4 -2
- package/src/duckdb/src/parser/statement/transaction_statement.cpp +3 -3
- package/src/duckdb/src/parser/tableref/column_data_ref.cpp +1 -27
- package/src/duckdb/src/parser/tableref/delimgetref.cpp +30 -0
- package/src/duckdb/src/parser/tableref/joinref.cpp +4 -0
- package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +35 -29
- package/src/duckdb/src/parser/transform/expression/transform_array_access.cpp +32 -32
- package/src/duckdb/src/parser/transform/expression/transform_columnref.cpp +2 -1
- package/src/duckdb/src/parser/transform/expression/transform_constant.cpp +17 -0
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +5 -0
- package/src/duckdb/src/parser/transform/expression/transform_multi_assign_reference.cpp +36 -34
- package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +30 -14
- package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +1 -1
- package/src/duckdb/src/parser/transform/helpers/transform_alias.cpp +2 -1
- package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +27 -19
- package/src/duckdb/src/parser/transform/helpers/transform_orderby.cpp +31 -28
- package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +25 -27
- package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +53 -42
- package/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +6 -6
- package/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_type.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_explain.cpp +38 -3
- package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +1 -2
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_prepare.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_select.cpp +26 -21
- package/src/duckdb/src/parser/transform/statement/transform_set.cpp +8 -8
- package/src/duckdb/src/parser/transform/statement/transform_show.cpp +5 -2
- package/src/duckdb/src/parser/transform/statement/transform_show_select.cpp +6 -4
- package/src/duckdb/src/parser/transform/statement/transform_transaction.cpp +27 -6
- package/src/duckdb/src/parser/transform/statement/transform_update.cpp +8 -9
- package/src/duckdb/src/parser/transform/statement/transform_upsert.cpp +11 -12
- package/src/duckdb/src/parser/transform/statement/transform_vacuum.cpp +3 -3
- package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +16 -10
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +1 -1
- package/src/duckdb/src/parser/transform/tableref/transform_subquery.cpp +1 -1
- package/src/duckdb/src/parser/transformer.cpp +11 -7
- package/src/duckdb/src/planner/bind_context.cpp +3 -3
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +22 -7
- package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +3 -3
- package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +3 -2
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +11 -4
- package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +9 -54
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +3 -5
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +24 -27
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +7 -7
- package/src/duckdb/src/planner/binder/expression/bind_parameter_expression.cpp +9 -2
- package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +26 -7
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +5 -0
- package/src/duckdb/src/planner/binder/expression/bind_unpacked_star_expression.cpp +91 -0
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +2 -2
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +11 -8
- package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +1 -1
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +6 -10
- package/src/duckdb/src/planner/binder/query_node/plan_cte_node.cpp +14 -10
- package/src/duckdb/src/planner/binder/query_node/plan_setop.cpp +3 -3
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +46 -7
- package/src/duckdb/src/planner/binder/statement/bind_call.cpp +13 -20
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +105 -13
- package/src/duckdb/src/planner/binder/statement/bind_copy_database.cpp +7 -3
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +75 -55
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +5 -4
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_execute.cpp +24 -8
- package/src/duckdb/src/planner/binder/statement/bind_explain.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +5 -105
- package/src/duckdb/src/planner/binder/statement/bind_extension.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +109 -41
- package/src/duckdb/src/planner/binder/statement/bind_set.cpp +23 -7
- package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +4 -1
- package/src/duckdb/src/planner/binder/statement/bind_summarize.cpp +17 -3
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +5 -4
- package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +8 -6
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +55 -42
- package/src/duckdb/src/planner/binder/tableref/bind_column_data_ref.cpp +3 -2
- package/src/duckdb/src/planner/binder/tableref/bind_delimgetref.cpp +16 -0
- package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +31 -1
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +6 -0
- package/src/duckdb/src/planner/binder/tableref/bind_showref.cpp +2 -0
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +106 -46
- package/src/duckdb/src/planner/binder/tableref/plan_delimgetref.cpp +11 -0
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +15 -2
- package/src/duckdb/src/planner/binder/tableref/plan_table_function.cpp +4 -0
- package/src/duckdb/src/planner/binder.cpp +172 -15
- package/src/duckdb/src/planner/collation_binding.cpp +99 -0
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +10 -4
- package/src/duckdb/src/planner/expression/bound_between_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_case_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +14 -12
- package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_comparison_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_conjunction_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_constant_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_expanded_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_function_expression.cpp +8 -2
- package/src/duckdb/src/planner/expression/bound_lambda_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_lambdaref_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_operator_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_subquery_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_unnest_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +6 -6
- package/src/duckdb/src/planner/expression_binder/aggregate_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/alter_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/column_alias_binder.cpp +7 -0
- package/src/duckdb/src/planner/expression_binder/constant_binder.cpp +3 -3
- package/src/duckdb/src/planner/expression_binder/group_binder.cpp +26 -22
- package/src/duckdb/src/planner/expression_binder/having_binder.cpp +7 -1
- package/src/duckdb/src/planner/expression_binder/index_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/insert_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +61 -43
- package/src/duckdb/src/planner/expression_binder/qualify_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/relation_binder.cpp +4 -4
- package/src/duckdb/src/planner/expression_binder/returning_binder.cpp +3 -2
- package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +10 -3
- package/src/duckdb/src/planner/expression_binder/update_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/where_binder.cpp +9 -2
- package/src/duckdb/src/planner/expression_binder.cpp +121 -21
- package/src/duckdb/src/planner/expression_iterator.cpp +26 -1
- package/src/duckdb/src/planner/filter/conjunction_filter.cpp +33 -0
- package/src/duckdb/src/planner/filter/constant_filter.cpp +15 -0
- package/src/duckdb/src/planner/filter/null_filter.cpp +22 -0
- package/src/duckdb/src/planner/filter/struct_filter.cpp +16 -0
- package/src/duckdb/src/planner/logical_operator.cpp +24 -7
- package/src/duckdb/src/planner/operator/logical_aggregate.cpp +13 -7
- package/src/duckdb/src/planner/operator/logical_any_join.cpp +5 -2
- package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +13 -5
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +64 -8
- package/src/duckdb/src/planner/operator/logical_cteref.cpp +7 -0
- package/src/duckdb/src/planner/operator/logical_distinct.cpp +6 -5
- package/src/duckdb/src/planner/operator/logical_get.cpp +60 -18
- package/src/duckdb/src/planner/operator/logical_materialized_cte.cpp +7 -0
- package/src/duckdb/src/planner/operator/logical_order.cpp +7 -4
- package/src/duckdb/src/planner/operator/logical_top_n.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_vacuum.cpp +1 -1
- package/src/duckdb/src/planner/planner.cpp +2 -3
- package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +27 -10
- package/src/duckdb/src/planner/table_filter.cpp +51 -0
- package/src/duckdb/src/storage/arena_allocator.cpp +28 -10
- package/src/duckdb/src/storage/block.cpp +3 -2
- package/src/duckdb/src/storage/buffer/block_handle.cpp +29 -14
- package/src/duckdb/src/storage/buffer/block_manager.cpp +6 -5
- package/src/duckdb/src/storage/buffer/buffer_handle.cpp +1 -1
- package/src/duckdb/src/storage/buffer/buffer_pool.cpp +264 -125
- package/src/duckdb/src/storage/buffer_manager.cpp +5 -1
- package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +0 -6
- package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +26 -3
- package/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +21 -9
- package/src/duckdb/src/storage/checkpoint_manager.cpp +49 -24
- package/src/duckdb/src/storage/compression/alp/alp.cpp +6 -11
- package/src/duckdb/src/storage/compression/alprd.cpp +5 -9
- package/src/duckdb/src/storage/compression/bitpacking.cpp +35 -31
- package/src/duckdb/src/storage/compression/chimp/chimp.cpp +6 -8
- package/src/duckdb/src/storage/compression/dictionary_compression.cpp +71 -58
- package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +15 -13
- package/src/duckdb/src/storage/compression/fsst.cpp +66 -53
- package/src/duckdb/src/storage/compression/numeric_constant.cpp +4 -5
- package/src/duckdb/src/storage/compression/patas.cpp +6 -17
- package/src/duckdb/src/storage/compression/rle.cpp +20 -18
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +71 -52
- package/src/duckdb/src/storage/compression/uncompressed.cpp +2 -2
- package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +8 -7
- package/src/duckdb/src/storage/data_pointer.cpp +22 -0
- package/src/duckdb/src/storage/data_table.cpp +41 -12
- package/src/duckdb/src/storage/local_storage.cpp +22 -8
- package/src/duckdb/src/storage/metadata/metadata_manager.cpp +33 -17
- package/src/duckdb/src/storage/metadata/metadata_reader.cpp +4 -4
- package/src/duckdb/src/storage/metadata/metadata_writer.cpp +3 -3
- package/src/duckdb/src/storage/partial_block_manager.cpp +19 -8
- package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +11 -8
- package/src/duckdb/src/storage/serialization/serialize_expression.cpp +1 -1
- package/src/duckdb/src/storage/serialization/serialize_extension_install_info.cpp +2 -0
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +3 -3
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +19 -5
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +21 -1
- package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +4 -2
- package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +2 -2
- package/src/duckdb/src/storage/serialization/serialize_storage.cpp +2 -0
- package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +8 -4
- package/src/duckdb/src/storage/serialization/serialize_types.cpp +4 -4
- package/src/duckdb/src/storage/single_file_block_manager.cpp +170 -34
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +221 -64
- package/src/duckdb/src/storage/statistics/column_statistics.cpp +4 -3
- package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +36 -26
- package/src/duckdb/src/storage/statistics/numeric_stats.cpp +4 -15
- package/src/duckdb/src/storage/statistics/string_stats.cpp +14 -8
- package/src/duckdb/src/storage/statistics/struct_stats.cpp +2 -1
- package/src/duckdb/src/storage/storage_info.cpp +34 -9
- package/src/duckdb/src/storage/storage_manager.cpp +147 -74
- package/src/duckdb/src/storage/table/array_column_data.cpp +37 -17
- package/src/duckdb/src/storage/table/chunk_info.cpp +38 -0
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +10 -6
- package/src/duckdb/src/storage/table/column_data.cpp +252 -31
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +2 -12
- package/src/duckdb/src/storage/table/column_segment.cpp +63 -34
- package/src/duckdb/src/storage/table/list_column_data.cpp +34 -15
- package/src/duckdb/src/storage/table/row_group.cpp +228 -120
- package/src/duckdb/src/storage/table/row_group_collection.cpp +122 -120
- package/src/duckdb/src/storage/table/row_version_manager.cpp +27 -1
- package/src/duckdb/src/storage/table/scan_state.cpp +101 -18
- package/src/duckdb/src/storage/table/standard_column_data.cpp +20 -34
- package/src/duckdb/src/storage/table/struct_column_data.cpp +39 -42
- package/src/duckdb/src/storage/table/table_statistics.cpp +2 -1
- package/src/duckdb/src/storage/table/update_segment.cpp +9 -8
- package/src/duckdb/src/storage/table/validity_column_data.cpp +2 -2
- package/src/duckdb/src/storage/table_index_list.cpp +8 -7
- package/src/duckdb/src/storage/temporary_file_manager.cpp +11 -9
- package/src/duckdb/src/storage/temporary_memory_manager.cpp +227 -39
- package/src/duckdb/src/storage/wal_replay.cpp +68 -28
- package/src/duckdb/src/storage/write_ahead_log.cpp +56 -47
- package/src/duckdb/src/transaction/cleanup_state.cpp +9 -1
- package/src/duckdb/src/transaction/commit_state.cpp +7 -170
- package/src/duckdb/src/transaction/duck_transaction.cpp +87 -19
- package/src/duckdb/src/transaction/duck_transaction_manager.cpp +65 -10
- package/src/duckdb/src/transaction/meta_transaction.cpp +18 -3
- package/src/duckdb/src/transaction/transaction_context.cpp +21 -17
- package/src/duckdb/src/transaction/undo_buffer.cpp +20 -14
- package/src/duckdb/src/transaction/wal_write_state.cpp +292 -0
- package/src/duckdb/src/verification/prepared_statement_verifier.cpp +0 -1
- package/src/duckdb/third_party/brotli/common/brotli_constants.h +204 -0
- package/src/duckdb/third_party/brotli/common/brotli_platform.h +543 -0
- package/src/duckdb/third_party/brotli/common/constants.cpp +17 -0
- package/src/duckdb/third_party/brotli/common/context.cpp +156 -0
- package/src/duckdb/third_party/brotli/common/context.h +110 -0
- package/src/duckdb/third_party/brotli/common/dictionary.cpp +5912 -0
- package/src/duckdb/third_party/brotli/common/dictionary.h +60 -0
- package/src/duckdb/third_party/brotli/common/platform.cpp +24 -0
- package/src/duckdb/third_party/brotli/common/shared_dictionary.cpp +517 -0
- package/src/duckdb/third_party/brotli/common/shared_dictionary_internal.h +71 -0
- package/src/duckdb/third_party/brotli/common/transform.cpp +287 -0
- package/src/duckdb/third_party/brotli/common/transform.h +77 -0
- package/src/duckdb/third_party/brotli/common/version.h +51 -0
- package/src/duckdb/third_party/brotli/dec/bit_reader.cpp +74 -0
- package/src/duckdb/third_party/brotli/dec/bit_reader.h +419 -0
- package/src/duckdb/third_party/brotli/dec/decode.cpp +2758 -0
- package/src/duckdb/third_party/brotli/dec/huffman.cpp +338 -0
- package/src/duckdb/third_party/brotli/dec/huffman.h +118 -0
- package/src/duckdb/third_party/brotli/dec/prefix.h +733 -0
- package/src/duckdb/third_party/brotli/dec/state.cpp +178 -0
- package/src/duckdb/third_party/brotli/dec/state.h +386 -0
- package/src/duckdb/third_party/brotli/enc/backward_references.cpp +3775 -0
- package/src/duckdb/third_party/brotli/enc/backward_references.h +36 -0
- package/src/duckdb/third_party/brotli/enc/backward_references_hq.cpp +935 -0
- package/src/duckdb/third_party/brotli/enc/backward_references_hq.h +92 -0
- package/src/duckdb/third_party/brotli/enc/bit_cost.cpp +410 -0
- package/src/duckdb/third_party/brotli/enc/bit_cost.h +60 -0
- package/src/duckdb/third_party/brotli/enc/block_splitter.cpp +1653 -0
- package/src/duckdb/third_party/brotli/enc/block_splitter.h +48 -0
- package/src/duckdb/third_party/brotli/enc/brotli_bit_stream.cpp +1431 -0
- package/src/duckdb/third_party/brotli/enc/brotli_bit_stream.h +85 -0
- package/src/duckdb/third_party/brotli/enc/brotli_hash.h +4352 -0
- package/src/duckdb/third_party/brotli/enc/brotli_params.h +47 -0
- package/src/duckdb/third_party/brotli/enc/cluster.cpp +1025 -0
- package/src/duckdb/third_party/brotli/enc/cluster.h +1017 -0
- package/src/duckdb/third_party/brotli/enc/command.cpp +24 -0
- package/src/duckdb/third_party/brotli/enc/command.h +187 -0
- package/src/duckdb/third_party/brotli/enc/compound_dictionary.cpp +209 -0
- package/src/duckdb/third_party/brotli/enc/compound_dictionary.h +75 -0
- package/src/duckdb/third_party/brotli/enc/compress_fragment.cpp +796 -0
- package/src/duckdb/third_party/brotli/enc/compress_fragment.h +82 -0
- package/src/duckdb/third_party/brotli/enc/compress_fragment_two_pass.cpp +653 -0
- package/src/duckdb/third_party/brotli/enc/compress_fragment_two_pass.h +68 -0
- package/src/duckdb/third_party/brotli/enc/dictionary_hash.cpp +1844 -0
- package/src/duckdb/third_party/brotli/enc/dictionary_hash.h +21 -0
- package/src/duckdb/third_party/brotli/enc/encode.cpp +1990 -0
- package/src/duckdb/third_party/brotli/enc/encoder_dict.cpp +636 -0
- package/src/duckdb/third_party/brotli/enc/encoder_dict.h +153 -0
- package/src/duckdb/third_party/brotli/enc/entropy_encode.cpp +500 -0
- package/src/duckdb/third_party/brotli/enc/entropy_encode.h +119 -0
- package/src/duckdb/third_party/brotli/enc/entropy_encode_static.h +538 -0
- package/src/duckdb/third_party/brotli/enc/fast_log.cpp +101 -0
- package/src/duckdb/third_party/brotli/enc/fast_log.h +63 -0
- package/src/duckdb/third_party/brotli/enc/find_match_length.h +68 -0
- package/src/duckdb/third_party/brotli/enc/histogram.cpp +96 -0
- package/src/duckdb/third_party/brotli/enc/histogram.h +210 -0
- package/src/duckdb/third_party/brotli/enc/literal_cost.cpp +176 -0
- package/src/duckdb/third_party/brotli/enc/literal_cost.h +28 -0
- package/src/duckdb/third_party/brotli/enc/memory.cpp +190 -0
- package/src/duckdb/third_party/brotli/enc/memory.h +127 -0
- package/src/duckdb/third_party/brotli/enc/metablock.cpp +1225 -0
- package/src/duckdb/third_party/brotli/enc/metablock.h +102 -0
- package/src/duckdb/third_party/brotli/enc/prefix.h +50 -0
- package/src/duckdb/third_party/brotli/enc/quality.h +202 -0
- package/src/duckdb/third_party/brotli/enc/ringbuffer.h +164 -0
- package/src/duckdb/third_party/brotli/enc/state.h +106 -0
- package/src/duckdb/third_party/brotli/enc/static_dict.cpp +538 -0
- package/src/duckdb/third_party/brotli/enc/static_dict.h +37 -0
- package/src/duckdb/third_party/brotli/enc/static_dict_lut.h +5862 -0
- package/src/duckdb/third_party/brotli/enc/utf8_util.cpp +81 -0
- package/src/duckdb/third_party/brotli/enc/utf8_util.h +29 -0
- package/src/duckdb/third_party/brotli/enc/write_bits.h +84 -0
- package/src/duckdb/third_party/brotli/include/brotli/decode.h +405 -0
- package/src/duckdb/third_party/brotli/include/brotli/encode.h +489 -0
- package/src/duckdb/third_party/brotli/include/brotli/port.h +238 -0
- package/src/duckdb/third_party/brotli/include/brotli/shared_dictionary.h +96 -0
- package/src/duckdb/third_party/brotli/include/brotli/types.h +83 -0
- package/src/duckdb/third_party/fast_float/fast_float/fast_float.h +20 -4
- package/src/duckdb/third_party/fmt/include/fmt/format.h +54 -10
- package/src/duckdb/third_party/fsst/fsst.h +2 -2
- package/src/duckdb/third_party/fsst/libfsst.hpp +2 -2
- package/src/duckdb/third_party/httplib/httplib.hpp +6763 -5580
- package/src/duckdb/third_party/hyperloglog/hyperloglog.cpp +13 -30
- package/src/duckdb/third_party/hyperloglog/hyperloglog.hpp +8 -2
- package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +1 -0
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +22 -9
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +1041 -554
- package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +1 -0
- package/src/duckdb/third_party/libpg_query/postgres_parser.cpp +2 -1
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +21605 -21752
- package/src/duckdb/third_party/libpg_query/src_backend_parser_scan.cpp +538 -299
- package/src/duckdb/third_party/mbedtls/include/mbedtls/mbedtls_config.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls_wrapper.hpp +36 -12
- package/src/duckdb/third_party/mbedtls/library/md.cpp +6 -6
- package/src/duckdb/third_party/mbedtls/library/sha1.cpp +2 -0
- package/src/duckdb/third_party/mbedtls/library/sha256.cpp +3 -0
- package/src/duckdb/third_party/mbedtls/mbedtls_wrapper.cpp +99 -47
- package/src/duckdb/third_party/pcg/pcg_extras.hpp +1 -1
- package/src/duckdb/third_party/re2/re2/prog.cc +2 -2
- package/src/duckdb/third_party/snappy/snappy-internal.h +398 -0
- package/src/duckdb/third_party/snappy/snappy-sinksource.cc +111 -9
- package/src/duckdb/third_party/snappy/snappy-sinksource.h +158 -0
- package/src/duckdb/third_party/snappy/snappy-stubs-internal.h +523 -3
- package/src/duckdb/third_party/snappy/snappy-stubs-public.h +34 -1
- package/src/duckdb/third_party/snappy/snappy.cc +2626 -0
- package/src/duckdb/third_party/snappy/snappy.h +223 -0
- package/src/duckdb/third_party/snappy/snappy_version.hpp +11 -0
- package/src/duckdb/third_party/utf8proc/include/utf8proc.hpp +69 -101
- package/src/duckdb/third_party/utf8proc/include/utf8proc_wrapper.hpp +53 -0
- package/src/duckdb/third_party/utf8proc/utf8proc.cpp +627 -678
- package/src/duckdb/third_party/utf8proc/utf8proc_data.cpp +15008 -12868
- package/src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp +185 -29
- package/src/duckdb/ub_extension_json_json_functions.cpp +6 -0
- package/src/duckdb/ub_src_catalog_default.cpp +4 -0
- package/src/duckdb/ub_src_common.cpp +7 -1
- package/src/duckdb/ub_src_common_arrow.cpp +10 -0
- package/src/duckdb/ub_src_common_enums.cpp +2 -0
- package/src/duckdb/ub_src_common_tree_renderer.cpp +10 -0
- package/src/duckdb/ub_src_common_types.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_aggregate_holistic.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_aggregate_nested.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_generic.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_list.cpp +2 -4
- package/src/duckdb/ub_src_core_functions_scalar_map.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_string.cpp +4 -0
- package/src/duckdb/ub_src_execution_index_art.cpp +5 -3
- package/src/duckdb/ub_src_execution_operator_csv_scanner_scanner.cpp +2 -0
- package/src/duckdb/ub_src_execution_operator_helper.cpp +4 -0
- package/src/duckdb/ub_src_function.cpp +4 -0
- package/src/duckdb/ub_src_function_cast.cpp +2 -0
- package/src/duckdb/ub_src_function_scalar_generic.cpp +4 -0
- package/src/duckdb/ub_src_function_scalar_list.cpp +0 -2
- package/src/duckdb/ub_src_function_scalar_string.cpp +2 -0
- package/src/duckdb/ub_src_function_table.cpp +2 -0
- package/src/duckdb/ub_src_function_table_arrow.cpp +2 -0
- package/src/duckdb/ub_src_function_table_system.cpp +2 -0
- package/src/duckdb/ub_src_main.cpp +4 -0
- package/src/duckdb/ub_src_main_buffered_data.cpp +4 -0
- package/src/duckdb/ub_src_main_capi.cpp +10 -0
- package/src/duckdb/ub_src_main_chunk_scan_state.cpp +2 -0
- package/src/duckdb/ub_src_main_relation.cpp +2 -0
- package/src/duckdb/ub_src_main_secret.cpp +2 -0
- package/src/duckdb/ub_src_optimizer.cpp +8 -0
- package/src/duckdb/ub_src_optimizer_compressed_materialization.cpp +2 -0
- package/src/duckdb/ub_src_optimizer_pushdown.cpp +2 -0
- package/src/duckdb/ub_src_optimizer_rule.cpp +2 -0
- package/src/duckdb/ub_src_parallel.cpp +4 -0
- package/src/duckdb/ub_src_parser_tableref.cpp +2 -0
- package/src/duckdb/ub_src_planner.cpp +2 -0
- package/src/duckdb/ub_src_planner_binder_expression.cpp +2 -0
- package/src/duckdb/ub_src_planner_binder_tableref.cpp +4 -0
- package/src/duckdb/ub_src_storage_statistics.cpp +0 -2
- package/src/duckdb/ub_src_transaction.cpp +2 -0
- package/test/columns.test.ts +1 -1
- package/test/prepare.test.ts +1 -1
- package/test/test_all_types.test.ts +1 -1
@@ -1,34 +1,38 @@
|
|
1
1
|
#include "duckdb/execution/index/art/art.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/common/types/conflict_manager.hpp"
|
4
|
+
#include "duckdb/common/unordered_map.hpp"
|
4
5
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
5
6
|
#include "duckdb/execution/expression_executor.hpp"
|
6
7
|
#include "duckdb/execution/index/art/art_key.hpp"
|
8
|
+
#include "duckdb/execution/index/art/base_leaf.hpp"
|
9
|
+
#include "duckdb/execution/index/art/base_node.hpp"
|
7
10
|
#include "duckdb/execution/index/art/iterator.hpp"
|
8
11
|
#include "duckdb/execution/index/art/leaf.hpp"
|
9
|
-
#include "duckdb/execution/index/art/node16.hpp"
|
10
12
|
#include "duckdb/execution/index/art/node256.hpp"
|
11
|
-
#include "duckdb/execution/index/art/
|
13
|
+
#include "duckdb/execution/index/art/node256_leaf.hpp"
|
12
14
|
#include "duckdb/execution/index/art/node48.hpp"
|
13
15
|
#include "duckdb/execution/index/art/prefix.hpp"
|
16
|
+
#include "duckdb/optimizer/matcher/expression_matcher.hpp"
|
17
|
+
#include "duckdb/planner/expression/bound_between_expression.hpp"
|
18
|
+
#include "duckdb/planner/expression/bound_comparison_expression.hpp"
|
19
|
+
#include "duckdb/planner/expression/bound_constant_expression.hpp"
|
14
20
|
#include "duckdb/storage/arena_allocator.hpp"
|
15
21
|
#include "duckdb/storage/metadata/metadata_reader.hpp"
|
16
22
|
#include "duckdb/storage/table/scan_state.hpp"
|
17
23
|
#include "duckdb/storage/table_io_manager.hpp"
|
18
|
-
#include "duckdb/optimizer/matcher/expression_matcher.hpp"
|
19
24
|
|
20
25
|
namespace duckdb {
|
21
26
|
|
22
27
|
struct ARTIndexScanState : public IndexScanState {
|
23
|
-
|
24
|
-
//!
|
28
|
+
//! The predicates to scan.
|
29
|
+
//! A single predicate for point lookups, and two predicates for range scans.
|
25
30
|
Value values[2];
|
26
|
-
//!
|
31
|
+
//! The expressions over the scan predicates.
|
27
32
|
ExpressionType expressions[2];
|
28
33
|
bool checked = false;
|
29
|
-
//! All scanned row IDs
|
30
|
-
|
31
|
-
Iterator iterator;
|
34
|
+
//! All scanned row IDs.
|
35
|
+
unsafe_vector<row_t> row_ids;
|
32
36
|
};
|
33
37
|
|
34
38
|
//===--------------------------------------------------------------------===//
|
@@ -37,40 +41,13 @@ struct ARTIndexScanState : public IndexScanState {
|
|
37
41
|
|
38
42
|
ART::ART(const string &name, const IndexConstraintType index_constraint_type, const vector<column_t> &column_ids,
|
39
43
|
TableIOManager &table_io_manager, const vector<unique_ptr<Expression>> &unbound_expressions,
|
40
|
-
AttachedDatabase &db,
|
44
|
+
AttachedDatabase &db,
|
45
|
+
const shared_ptr<array<unsafe_unique_ptr<FixedSizeAllocator>, ALLOCATOR_COUNT>> &allocators_ptr,
|
41
46
|
const IndexStorageInfo &info)
|
42
47
|
: BoundIndex(name, ART::TYPE_NAME, index_constraint_type, column_ids, table_io_manager, unbound_expressions, db),
|
43
48
|
allocators(allocators_ptr), owns_data(false) {
|
44
49
|
|
45
|
-
//
|
46
|
-
if (!allocators) {
|
47
|
-
owns_data = true;
|
48
|
-
auto &block_manager = table_io_manager.GetIndexBlockManager();
|
49
|
-
|
50
|
-
array<unique_ptr<FixedSizeAllocator>, ALLOCATOR_COUNT> allocator_array = {
|
51
|
-
make_uniq<FixedSizeAllocator>(sizeof(Prefix), block_manager),
|
52
|
-
make_uniq<FixedSizeAllocator>(sizeof(Leaf), block_manager),
|
53
|
-
make_uniq<FixedSizeAllocator>(sizeof(Node4), block_manager),
|
54
|
-
make_uniq<FixedSizeAllocator>(sizeof(Node16), block_manager),
|
55
|
-
make_uniq<FixedSizeAllocator>(sizeof(Node48), block_manager),
|
56
|
-
make_uniq<FixedSizeAllocator>(sizeof(Node256), block_manager)};
|
57
|
-
allocators =
|
58
|
-
make_shared_ptr<array<unique_ptr<FixedSizeAllocator>, ALLOCATOR_COUNT>>(std::move(allocator_array));
|
59
|
-
}
|
60
|
-
|
61
|
-
// deserialize lazily
|
62
|
-
if (info.IsValid()) {
|
63
|
-
|
64
|
-
if (!info.root_block_ptr.IsValid()) {
|
65
|
-
InitAllocators(info);
|
66
|
-
|
67
|
-
} else {
|
68
|
-
// old storage file
|
69
|
-
Deserialize(info.root_block_ptr);
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
// validate the types of the key columns
|
50
|
+
// FIXME: Use the new byte representation function to support nested types.
|
74
51
|
for (idx_t i = 0; i < types.size(); i++) {
|
75
52
|
switch (types[i]) {
|
76
53
|
case PhysicalType::BOOL:
|
@@ -92,28 +69,61 @@ ART::ART(const string &name, const IndexConstraintType index_constraint_type, co
|
|
92
69
|
throw InvalidTypeException(logical_types[i], "Invalid type for index key.");
|
93
70
|
}
|
94
71
|
}
|
72
|
+
|
73
|
+
// Initialize the allocators.
|
74
|
+
SetPrefixCount(info);
|
75
|
+
if (!allocators) {
|
76
|
+
owns_data = true;
|
77
|
+
auto prefix_size = NumericCast<idx_t>(prefix_count) + NumericCast<idx_t>(Prefix::METADATA_SIZE);
|
78
|
+
auto &block_manager = table_io_manager.GetIndexBlockManager();
|
79
|
+
|
80
|
+
array<unsafe_unique_ptr<FixedSizeAllocator>, ALLOCATOR_COUNT> allocator_array = {
|
81
|
+
make_unsafe_uniq<FixedSizeAllocator>(prefix_size, block_manager),
|
82
|
+
make_unsafe_uniq<FixedSizeAllocator>(sizeof(Leaf), block_manager),
|
83
|
+
make_unsafe_uniq<FixedSizeAllocator>(sizeof(Node4), block_manager),
|
84
|
+
make_unsafe_uniq<FixedSizeAllocator>(sizeof(Node16), block_manager),
|
85
|
+
make_unsafe_uniq<FixedSizeAllocator>(sizeof(Node48), block_manager),
|
86
|
+
make_unsafe_uniq<FixedSizeAllocator>(sizeof(Node256), block_manager),
|
87
|
+
make_unsafe_uniq<FixedSizeAllocator>(sizeof(Node7Leaf), block_manager),
|
88
|
+
make_unsafe_uniq<FixedSizeAllocator>(sizeof(Node15Leaf), block_manager),
|
89
|
+
make_unsafe_uniq<FixedSizeAllocator>(sizeof(Node256Leaf), block_manager),
|
90
|
+
};
|
91
|
+
allocators =
|
92
|
+
make_shared_ptr<array<unsafe_unique_ptr<FixedSizeAllocator>, ALLOCATOR_COUNT>>(std::move(allocator_array));
|
93
|
+
}
|
94
|
+
|
95
|
+
if (!info.IsValid()) {
|
96
|
+
// We create a new ART.
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
|
100
|
+
if (info.root_block_ptr.IsValid()) {
|
101
|
+
// Backwards compatibility.
|
102
|
+
Deserialize(info.root_block_ptr);
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
|
106
|
+
// Set the root node and initialize the allocators.
|
107
|
+
tree.Set(info.root);
|
108
|
+
InitAllocators(info);
|
95
109
|
}
|
96
110
|
|
97
111
|
//===--------------------------------------------------------------------===//
|
98
|
-
// Initialize
|
112
|
+
// Initialize Scans
|
99
113
|
//===--------------------------------------------------------------------===//
|
100
114
|
|
101
|
-
|
102
|
-
static unique_ptr<IndexScanState> InitializeScanSinglePredicate(const Transaction &transaction, const Value &value,
|
115
|
+
static unique_ptr<IndexScanState> InitializeScanSinglePredicate(const Value &value,
|
103
116
|
const ExpressionType expression_type) {
|
104
|
-
// initialize point lookup
|
105
117
|
auto result = make_uniq<ARTIndexScanState>();
|
106
118
|
result->values[0] = value;
|
107
119
|
result->expressions[0] = expression_type;
|
108
120
|
return std::move(result);
|
109
121
|
}
|
110
122
|
|
111
|
-
|
112
|
-
static unique_ptr<IndexScanState> InitializeScanTwoPredicates(const Transaction &transaction, const Value &low_value,
|
123
|
+
static unique_ptr<IndexScanState> InitializeScanTwoPredicates(const Value &low_value,
|
113
124
|
const ExpressionType low_expression_type,
|
114
125
|
const Value &high_value,
|
115
126
|
const ExpressionType high_expression_type) {
|
116
|
-
// initialize range lookup
|
117
127
|
auto result = make_uniq<ARTIndexScanState>();
|
118
128
|
result->values[0] = low_value;
|
119
129
|
result->expressions[0] = low_expression_type;
|
@@ -122,64 +132,64 @@ static unique_ptr<IndexScanState> InitializeScanTwoPredicates(const Transaction
|
|
122
132
|
return std::move(result);
|
123
133
|
}
|
124
134
|
|
125
|
-
unique_ptr<IndexScanState> ART::TryInitializeScan(const
|
126
|
-
const Expression &filter_expr) {
|
127
|
-
|
135
|
+
unique_ptr<IndexScanState> ART::TryInitializeScan(const Expression &expr, const Expression &filter_expr) {
|
128
136
|
Value low_value, high_value, equal_value;
|
129
137
|
ExpressionType low_comparison_type = ExpressionType::INVALID, high_comparison_type = ExpressionType::INVALID;
|
130
|
-
// try to find a matching index for any of the filter expressions
|
131
138
|
|
132
|
-
//
|
139
|
+
// Try to find a matching index for any of the filter expressions.
|
133
140
|
ComparisonExpressionMatcher matcher;
|
134
|
-
//
|
141
|
+
// Match on a comparison type.
|
135
142
|
matcher.expr_type = make_uniq<ComparisonExpressionTypeMatcher>();
|
136
|
-
//
|
137
|
-
matcher.matchers.push_back(make_uniq<ExpressionEqualityMatcher>(
|
143
|
+
// Match on a constant comparison with the indexed expression.
|
144
|
+
matcher.matchers.push_back(make_uniq<ExpressionEqualityMatcher>(expr));
|
138
145
|
matcher.matchers.push_back(make_uniq<ConstantExpressionMatcher>());
|
139
|
-
|
140
146
|
matcher.policy = SetMatcher::Policy::UNORDERED;
|
141
147
|
|
142
148
|
vector<reference<Expression>> bindings;
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
//
|
147
|
-
//
|
148
|
-
//
|
149
|
+
auto filter_match =
|
150
|
+
matcher.Match(const_cast<Expression &>(filter_expr), bindings); // NOLINT: Match does not alter the expr.
|
151
|
+
if (filter_match) {
|
152
|
+
// This is a range or equality comparison with a constant value, so we can use the index.
|
153
|
+
// bindings[0] = the expression
|
154
|
+
// bindings[1] = the index expression
|
155
|
+
// bindings[2] = the constant
|
149
156
|
auto &comparison = bindings[0].get().Cast<BoundComparisonExpression>();
|
150
157
|
auto constant_value = bindings[2].get().Cast<BoundConstantExpression>().value;
|
151
158
|
auto comparison_type = comparison.type;
|
159
|
+
|
152
160
|
if (comparison.left->type == ExpressionType::VALUE_CONSTANT) {
|
153
|
-
//
|
161
|
+
// The expression is on the right side, we flip the comparison expression.
|
154
162
|
comparison_type = FlipComparisonExpression(comparison_type);
|
155
163
|
}
|
164
|
+
|
156
165
|
if (comparison_type == ExpressionType::COMPARE_EQUAL) {
|
157
|
-
// equality value
|
158
|
-
// equality overrides any other bounds so we just break here
|
166
|
+
// An equality value overrides any other bounds.
|
159
167
|
equal_value = constant_value;
|
160
168
|
} else if (comparison_type == ExpressionType::COMPARE_GREATERTHANOREQUALTO ||
|
161
169
|
comparison_type == ExpressionType::COMPARE_GREATERTHAN) {
|
162
|
-
//
|
170
|
+
// This is a lower bound.
|
163
171
|
low_value = constant_value;
|
164
172
|
low_comparison_type = comparison_type;
|
165
173
|
} else {
|
166
|
-
//
|
174
|
+
// This is an upper bound.
|
167
175
|
high_value = constant_value;
|
168
176
|
high_comparison_type = comparison_type;
|
169
177
|
}
|
178
|
+
|
170
179
|
} else if (filter_expr.type == ExpressionType::COMPARE_BETWEEN) {
|
171
|
-
// BETWEEN expression
|
172
180
|
auto &between = filter_expr.Cast<BoundBetweenExpression>();
|
173
|
-
if (!between.input->Equals(
|
174
|
-
// expression
|
181
|
+
if (!between.input->Equals(expr)) {
|
182
|
+
// The expression does not match the index expression.
|
175
183
|
return nullptr;
|
176
184
|
}
|
185
|
+
|
177
186
|
if (between.lower->type != ExpressionType::VALUE_CONSTANT ||
|
178
187
|
between.upper->type != ExpressionType::VALUE_CONSTANT) {
|
179
|
-
//
|
188
|
+
// Not a constant expression.
|
180
189
|
return nullptr;
|
181
190
|
}
|
182
|
-
|
191
|
+
|
192
|
+
low_value = between.lower->Cast<BoundConstantExpression>().value;
|
183
193
|
low_comparison_type = between.lower_inclusive ? ExpressionType::COMPARE_GREATERTHANOREQUALTO
|
184
194
|
: ExpressionType::COMPARE_GREATERTHAN;
|
185
195
|
high_value = (between.upper->Cast<BoundConstantExpression>()).value;
|
@@ -187,165 +197,177 @@ unique_ptr<IndexScanState> ART::TryInitializeScan(const Transaction &transaction
|
|
187
197
|
between.upper_inclusive ? ExpressionType::COMPARE_LESSTHANOREQUALTO : ExpressionType::COMPARE_LESSTHAN;
|
188
198
|
}
|
189
199
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
if (!equal_value.IsNull()) {
|
194
|
-
// equality predicate
|
195
|
-
index_state = InitializeScanSinglePredicate(transaction, equal_value, ExpressionType::COMPARE_EQUAL);
|
196
|
-
} else if (!low_value.IsNull() && !high_value.IsNull()) {
|
197
|
-
// two-sided predicate
|
198
|
-
index_state = InitializeScanTwoPredicates(transaction, low_value, low_comparison_type, high_value,
|
199
|
-
high_comparison_type);
|
200
|
-
} else if (!low_value.IsNull()) {
|
201
|
-
// less than predicate
|
202
|
-
index_state = InitializeScanSinglePredicate(transaction, low_value, low_comparison_type);
|
203
|
-
} else {
|
204
|
-
D_ASSERT(!high_value.IsNull());
|
205
|
-
index_state = InitializeScanSinglePredicate(transaction, high_value, high_comparison_type);
|
206
|
-
}
|
207
|
-
return index_state;
|
200
|
+
// We cannot use an index scan.
|
201
|
+
if (equal_value.IsNull() && low_value.IsNull() && high_value.IsNull()) {
|
202
|
+
return nullptr;
|
208
203
|
}
|
209
|
-
|
204
|
+
|
205
|
+
// Initialize the index scan state and return it.
|
206
|
+
if (!equal_value.IsNull()) {
|
207
|
+
// Equality predicate.
|
208
|
+
return InitializeScanSinglePredicate(equal_value, ExpressionType::COMPARE_EQUAL);
|
209
|
+
}
|
210
|
+
if (!low_value.IsNull() && !high_value.IsNull()) {
|
211
|
+
// Two-sided predicate.
|
212
|
+
return InitializeScanTwoPredicates(low_value, low_comparison_type, high_value, high_comparison_type);
|
213
|
+
}
|
214
|
+
if (!low_value.IsNull()) {
|
215
|
+
// Less-than predicate.
|
216
|
+
return InitializeScanSinglePredicate(low_value, low_comparison_type);
|
217
|
+
}
|
218
|
+
// Greater-than predicate.
|
219
|
+
return InitializeScanSinglePredicate(high_value, high_comparison_type);
|
210
220
|
}
|
211
221
|
|
212
222
|
//===--------------------------------------------------------------------===//
|
213
|
-
// Keys
|
223
|
+
// ART Keys
|
214
224
|
//===--------------------------------------------------------------------===//
|
215
225
|
|
216
|
-
template <class T>
|
217
|
-
static void TemplatedGenerateKeys(ArenaAllocator &allocator, Vector &input, idx_t count,
|
218
|
-
UnifiedVectorFormat idata;
|
219
|
-
input.ToUnifiedFormat(count, idata);
|
220
|
-
|
226
|
+
template <class T, bool IS_NOT_NULL>
|
227
|
+
static void TemplatedGenerateKeys(ArenaAllocator &allocator, Vector &input, idx_t count, unsafe_vector<ARTKey> &keys) {
|
221
228
|
D_ASSERT(keys.size() >= count);
|
222
|
-
|
229
|
+
|
230
|
+
UnifiedVectorFormat data;
|
231
|
+
input.ToUnifiedFormat(count, data);
|
232
|
+
auto input_data = UnifiedVectorFormat::GetData<T>(data);
|
233
|
+
|
223
234
|
for (idx_t i = 0; i < count; i++) {
|
224
|
-
auto idx =
|
225
|
-
if (
|
226
|
-
ARTKey::CreateARTKey<T>(allocator,
|
227
|
-
|
228
|
-
// we need to possibly reset the former key value in the keys vector
|
229
|
-
keys[i] = ARTKey();
|
235
|
+
auto idx = data.sel->get_index(i);
|
236
|
+
if (IS_NOT_NULL || data.validity.RowIsValid(idx)) {
|
237
|
+
ARTKey::CreateARTKey<T>(allocator, keys[i], input_data[idx]);
|
238
|
+
continue;
|
230
239
|
}
|
240
|
+
|
241
|
+
// We need to reset the key value in the reusable keys vector.
|
242
|
+
keys[i] = ARTKey();
|
231
243
|
}
|
232
244
|
}
|
233
245
|
|
234
|
-
template <class T>
|
235
|
-
static void ConcatenateKeys(ArenaAllocator &allocator, Vector &input, idx_t count,
|
236
|
-
UnifiedVectorFormat
|
237
|
-
input.ToUnifiedFormat(count,
|
246
|
+
template <class T, bool IS_NOT_NULL>
|
247
|
+
static void ConcatenateKeys(ArenaAllocator &allocator, Vector &input, idx_t count, unsafe_vector<ARTKey> &keys) {
|
248
|
+
UnifiedVectorFormat data;
|
249
|
+
input.ToUnifiedFormat(count, data);
|
250
|
+
auto input_data = UnifiedVectorFormat::GetData<T>(data);
|
238
251
|
|
239
|
-
auto input_data = UnifiedVectorFormat::GetData<T>(idata);
|
240
252
|
for (idx_t i = 0; i < count; i++) {
|
241
|
-
auto idx =
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
253
|
+
auto idx = data.sel->get_index(i);
|
254
|
+
|
255
|
+
if (IS_NOT_NULL) {
|
256
|
+
auto other_key = ARTKey::CreateARTKey<T>(allocator, input_data[idx]);
|
257
|
+
keys[i].Concat(allocator, other_key);
|
258
|
+
continue;
|
259
|
+
}
|
260
|
+
|
261
|
+
// A previous column entry was NULL.
|
262
|
+
if (keys[i].Empty()) {
|
263
|
+
continue;
|
252
264
|
}
|
265
|
+
|
266
|
+
// This column entry is NULL, so we set the whole key to NULL.
|
267
|
+
if (!data.validity.RowIsValid(idx)) {
|
268
|
+
keys[i] = ARTKey();
|
269
|
+
continue;
|
270
|
+
}
|
271
|
+
|
272
|
+
// Concatenate the keys.
|
273
|
+
auto other_key = ARTKey::CreateARTKey<T>(allocator, input_data[idx]);
|
274
|
+
keys[i].Concat(allocator, other_key);
|
253
275
|
}
|
254
276
|
}
|
255
277
|
|
256
|
-
|
257
|
-
|
278
|
+
template <bool IS_NOT_NULL>
|
279
|
+
void GenerateKeysInternal(ArenaAllocator &allocator, DataChunk &input, unsafe_vector<ARTKey> &keys) {
|
258
280
|
switch (input.data[0].GetType().InternalType()) {
|
259
281
|
case PhysicalType::BOOL:
|
260
|
-
TemplatedGenerateKeys<bool>(allocator, input.data[0], input.size(), keys);
|
282
|
+
TemplatedGenerateKeys<bool, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
261
283
|
break;
|
262
284
|
case PhysicalType::INT8:
|
263
|
-
TemplatedGenerateKeys<int8_t>(allocator, input.data[0], input.size(), keys);
|
285
|
+
TemplatedGenerateKeys<int8_t, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
264
286
|
break;
|
265
287
|
case PhysicalType::INT16:
|
266
|
-
TemplatedGenerateKeys<int16_t>(allocator, input.data[0], input.size(), keys);
|
288
|
+
TemplatedGenerateKeys<int16_t, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
267
289
|
break;
|
268
290
|
case PhysicalType::INT32:
|
269
|
-
TemplatedGenerateKeys<int32_t>(allocator, input.data[0], input.size(), keys);
|
291
|
+
TemplatedGenerateKeys<int32_t, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
270
292
|
break;
|
271
293
|
case PhysicalType::INT64:
|
272
|
-
TemplatedGenerateKeys<int64_t>(allocator, input.data[0], input.size(), keys);
|
294
|
+
TemplatedGenerateKeys<int64_t, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
273
295
|
break;
|
274
296
|
case PhysicalType::INT128:
|
275
|
-
TemplatedGenerateKeys<hugeint_t>(allocator, input.data[0], input.size(), keys);
|
297
|
+
TemplatedGenerateKeys<hugeint_t, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
276
298
|
break;
|
277
299
|
case PhysicalType::UINT8:
|
278
|
-
TemplatedGenerateKeys<uint8_t>(allocator, input.data[0], input.size(), keys);
|
300
|
+
TemplatedGenerateKeys<uint8_t, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
279
301
|
break;
|
280
302
|
case PhysicalType::UINT16:
|
281
|
-
TemplatedGenerateKeys<uint16_t>(allocator, input.data[0], input.size(), keys);
|
303
|
+
TemplatedGenerateKeys<uint16_t, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
282
304
|
break;
|
283
305
|
case PhysicalType::UINT32:
|
284
|
-
TemplatedGenerateKeys<uint32_t>(allocator, input.data[0], input.size(), keys);
|
306
|
+
TemplatedGenerateKeys<uint32_t, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
285
307
|
break;
|
286
308
|
case PhysicalType::UINT64:
|
287
|
-
TemplatedGenerateKeys<uint64_t>(allocator, input.data[0], input.size(), keys);
|
309
|
+
TemplatedGenerateKeys<uint64_t, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
288
310
|
break;
|
289
311
|
case PhysicalType::UINT128:
|
290
|
-
TemplatedGenerateKeys<uhugeint_t>(allocator, input.data[0], input.size(), keys);
|
312
|
+
TemplatedGenerateKeys<uhugeint_t, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
291
313
|
break;
|
292
314
|
case PhysicalType::FLOAT:
|
293
|
-
TemplatedGenerateKeys<float>(allocator, input.data[0], input.size(), keys);
|
315
|
+
TemplatedGenerateKeys<float, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
294
316
|
break;
|
295
317
|
case PhysicalType::DOUBLE:
|
296
|
-
TemplatedGenerateKeys<double>(allocator, input.data[0], input.size(), keys);
|
318
|
+
TemplatedGenerateKeys<double, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
297
319
|
break;
|
298
320
|
case PhysicalType::VARCHAR:
|
299
|
-
TemplatedGenerateKeys<string_t>(allocator, input.data[0], input.size(), keys);
|
321
|
+
TemplatedGenerateKeys<string_t, IS_NOT_NULL>(allocator, input.data[0], input.size(), keys);
|
300
322
|
break;
|
301
323
|
default:
|
302
324
|
throw InternalException("Invalid type for index");
|
303
325
|
}
|
304
326
|
|
327
|
+
// We concatenate the keys for each remaining column of a compound key.
|
305
328
|
for (idx_t i = 1; i < input.ColumnCount(); i++) {
|
306
|
-
// for each of the remaining columns, concatenate
|
307
329
|
switch (input.data[i].GetType().InternalType()) {
|
308
330
|
case PhysicalType::BOOL:
|
309
|
-
ConcatenateKeys<bool>(allocator, input.data[i], input.size(), keys);
|
331
|
+
ConcatenateKeys<bool, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
310
332
|
break;
|
311
333
|
case PhysicalType::INT8:
|
312
|
-
ConcatenateKeys<int8_t>(allocator, input.data[i], input.size(), keys);
|
334
|
+
ConcatenateKeys<int8_t, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
313
335
|
break;
|
314
336
|
case PhysicalType::INT16:
|
315
|
-
ConcatenateKeys<int16_t>(allocator, input.data[i], input.size(), keys);
|
337
|
+
ConcatenateKeys<int16_t, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
316
338
|
break;
|
317
339
|
case PhysicalType::INT32:
|
318
|
-
ConcatenateKeys<int32_t>(allocator, input.data[i], input.size(), keys);
|
340
|
+
ConcatenateKeys<int32_t, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
319
341
|
break;
|
320
342
|
case PhysicalType::INT64:
|
321
|
-
ConcatenateKeys<int64_t>(allocator, input.data[i], input.size(), keys);
|
343
|
+
ConcatenateKeys<int64_t, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
322
344
|
break;
|
323
345
|
case PhysicalType::INT128:
|
324
|
-
ConcatenateKeys<hugeint_t>(allocator, input.data[i], input.size(), keys);
|
346
|
+
ConcatenateKeys<hugeint_t, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
325
347
|
break;
|
326
348
|
case PhysicalType::UINT8:
|
327
|
-
ConcatenateKeys<uint8_t>(allocator, input.data[i], input.size(), keys);
|
349
|
+
ConcatenateKeys<uint8_t, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
328
350
|
break;
|
329
351
|
case PhysicalType::UINT16:
|
330
|
-
ConcatenateKeys<uint16_t>(allocator, input.data[i], input.size(), keys);
|
352
|
+
ConcatenateKeys<uint16_t, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
331
353
|
break;
|
332
354
|
case PhysicalType::UINT32:
|
333
|
-
ConcatenateKeys<uint32_t>(allocator, input.data[i], input.size(), keys);
|
355
|
+
ConcatenateKeys<uint32_t, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
334
356
|
break;
|
335
357
|
case PhysicalType::UINT64:
|
336
|
-
ConcatenateKeys<uint64_t>(allocator, input.data[i], input.size(), keys);
|
358
|
+
ConcatenateKeys<uint64_t, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
337
359
|
break;
|
338
360
|
case PhysicalType::UINT128:
|
339
|
-
ConcatenateKeys<uhugeint_t>(allocator, input.data[i], input.size(), keys);
|
361
|
+
ConcatenateKeys<uhugeint_t, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
340
362
|
break;
|
341
363
|
case PhysicalType::FLOAT:
|
342
|
-
ConcatenateKeys<float>(allocator, input.data[i], input.size(), keys);
|
364
|
+
ConcatenateKeys<float, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
343
365
|
break;
|
344
366
|
case PhysicalType::DOUBLE:
|
345
|
-
ConcatenateKeys<double>(allocator, input.data[i], input.size(), keys);
|
367
|
+
ConcatenateKeys<double, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
346
368
|
break;
|
347
369
|
case PhysicalType::VARCHAR:
|
348
|
-
ConcatenateKeys<string_t>(allocator, input.data[i], input.size(), keys);
|
370
|
+
ConcatenateKeys<string_t, IS_NOT_NULL>(allocator, input.data[i], input.size(), keys);
|
349
371
|
break;
|
350
372
|
default:
|
351
373
|
throw InternalException("Invalid type for index");
|
@@ -353,195 +375,168 @@ void ART::GenerateKeys(ArenaAllocator &allocator, DataChunk &input, vector<ARTKe
|
|
353
375
|
}
|
354
376
|
}
|
355
377
|
|
356
|
-
|
357
|
-
|
358
|
-
|
378
|
+
template <>
|
379
|
+
void ART::GenerateKeys<>(ArenaAllocator &allocator, DataChunk &input, unsafe_vector<ARTKey> &keys) {
|
380
|
+
GenerateKeysInternal<false>(allocator, input, keys);
|
381
|
+
}
|
359
382
|
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
: start(start_p), end(end_p), depth(key_section.depth + 1), key_byte(keys[end_p].data[key_section.depth]) {};
|
365
|
-
idx_t start;
|
366
|
-
idx_t end;
|
367
|
-
idx_t depth;
|
368
|
-
data_t key_byte;
|
369
|
-
};
|
383
|
+
template <>
|
384
|
+
void ART::GenerateKeys<true>(ArenaAllocator &allocator, DataChunk &input, unsafe_vector<ARTKey> &keys) {
|
385
|
+
GenerateKeysInternal<true>(allocator, input, keys);
|
386
|
+
}
|
370
387
|
|
371
|
-
void
|
388
|
+
void ART::GenerateKeyVectors(ArenaAllocator &allocator, DataChunk &input, Vector &row_ids, unsafe_vector<ARTKey> &keys,
|
389
|
+
unsafe_vector<ARTKey> &row_id_keys) {
|
390
|
+
GenerateKeys<>(allocator, input, keys);
|
372
391
|
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
}
|
379
|
-
}
|
380
|
-
child_sections.emplace_back(child_start_idx, key_section.end, keys, key_section);
|
392
|
+
DataChunk row_id_chunk;
|
393
|
+
row_id_chunk.Initialize(Allocator::DefaultAllocator(), vector<LogicalType> {LogicalType::ROW_TYPE}, input.size());
|
394
|
+
row_id_chunk.data[0].Reference(row_ids);
|
395
|
+
row_id_chunk.SetCardinality(input.size());
|
396
|
+
GenerateKeys<>(allocator, row_id_chunk, row_id_keys);
|
381
397
|
}
|
382
398
|
|
383
|
-
|
384
|
-
|
399
|
+
//===--------------------------------------------------------------------===//
|
400
|
+
// Construct from sorted data.
|
401
|
+
//===--------------------------------------------------------------------===//
|
385
402
|
|
386
|
-
|
387
|
-
|
388
|
-
D_ASSERT(
|
403
|
+
bool ART::ConstructInternal(const unsafe_vector<ARTKey> &keys, const unsafe_vector<ARTKey> &row_ids, Node &node,
|
404
|
+
ARTKeySection §ion) {
|
405
|
+
D_ASSERT(section.start < keys.size());
|
406
|
+
D_ASSERT(section.end < keys.size());
|
407
|
+
D_ASSERT(section.start <= section.end);
|
389
408
|
|
390
|
-
auto &
|
391
|
-
auto &
|
409
|
+
auto &start = keys[section.start];
|
410
|
+
auto &end = keys[section.end];
|
411
|
+
D_ASSERT(start.len != 0);
|
392
412
|
|
393
|
-
//
|
394
|
-
auto
|
395
|
-
while (
|
396
|
-
|
397
|
-
key_section.depth++;
|
413
|
+
// Increment the depth until we reach a leaf or find a mismatching byte.
|
414
|
+
auto prefix_depth = section.depth;
|
415
|
+
while (start.len != section.depth && start.ByteMatches(end, section.depth)) {
|
416
|
+
section.depth++;
|
398
417
|
}
|
399
418
|
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
// check for possible constraint violation
|
406
|
-
auto single_row_id = num_row_ids == 1;
|
407
|
-
if (has_constraint && !single_row_id) {
|
419
|
+
if (start.len == section.depth) {
|
420
|
+
// We reached a leaf. All the bytes of start_key and end_key match.
|
421
|
+
auto row_id_count = section.end - section.start + 1;
|
422
|
+
if (IsUnique() && row_id_count != 1) {
|
408
423
|
return false;
|
409
424
|
}
|
410
425
|
|
411
|
-
reference<Node>
|
412
|
-
|
413
|
-
|
414
|
-
if (
|
415
|
-
Leaf::New(
|
426
|
+
reference<Node> ref(node);
|
427
|
+
auto count = UnsafeNumericCast<uint8_t>(start.len - prefix_depth);
|
428
|
+
Prefix::New(*this, ref, start, prefix_depth, count);
|
429
|
+
if (row_id_count == 1) {
|
430
|
+
Leaf::New(ref, row_ids[section.start].GetRowId());
|
416
431
|
} else {
|
417
|
-
Leaf::New(
|
432
|
+
Leaf::New(*this, ref, row_ids, section.start, row_id_count);
|
418
433
|
}
|
419
434
|
return true;
|
420
435
|
}
|
421
436
|
|
422
|
-
//
|
423
|
-
|
424
|
-
|
425
|
-
vector<KeySection> child_sections;
|
426
|
-
GetChildSections(child_sections, keys, key_section);
|
437
|
+
// Create a new node and recurse.
|
438
|
+
unsafe_vector<ARTKeySection> children;
|
439
|
+
section.GetChildSections(children, keys);
|
427
440
|
|
428
|
-
//
|
429
|
-
reference<Node>
|
430
|
-
auto prefix_length =
|
431
|
-
Prefix::New(
|
432
|
-
UnsafeNumericCast<uint32_t>(prefix_length));
|
441
|
+
// Create the prefix.
|
442
|
+
reference<Node> ref(node);
|
443
|
+
auto prefix_length = section.depth - prefix_depth;
|
444
|
+
Prefix::New(*this, ref, start, prefix_depth, prefix_length);
|
433
445
|
|
434
|
-
//
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
// recurse on each child section
|
439
|
-
for (auto &child_section : child_sections) {
|
446
|
+
// Create the node.
|
447
|
+
Node::New(*this, ref, Node::GetNodeType(children.size()));
|
448
|
+
for (auto &child : children) {
|
440
449
|
Node new_child;
|
441
|
-
auto
|
442
|
-
Node::InsertChild(
|
443
|
-
if (!
|
450
|
+
auto success = ConstructInternal(keys, row_ids, new_child, child);
|
451
|
+
Node::InsertChild(*this, ref, child.key_byte, new_child);
|
452
|
+
if (!success) {
|
444
453
|
return false;
|
445
454
|
}
|
446
455
|
}
|
447
456
|
return true;
|
448
457
|
}
|
449
458
|
|
450
|
-
bool ART::
|
451
|
-
|
452
|
-
|
453
|
-
row_identifiers.Flatten(count);
|
454
|
-
auto row_ids = FlatVector::GetData<row_t>(row_identifiers);
|
455
|
-
|
456
|
-
auto key_section = KeySection(0, count - 1, 0, 0);
|
457
|
-
auto has_constraint = IsUnique();
|
458
|
-
if (!Construct(*this, keys, row_ids, tree, key_section, has_constraint)) {
|
459
|
+
bool ART::Construct(unsafe_vector<ARTKey> &keys, unsafe_vector<ARTKey> &row_ids, const idx_t row_count) {
|
460
|
+
ARTKeySection section(0, row_count - 1, 0, 0);
|
461
|
+
if (!ConstructInternal(keys, row_ids, tree, section)) {
|
459
462
|
return false;
|
460
463
|
}
|
461
464
|
|
462
465
|
#ifdef DEBUG
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
466
|
+
unsafe_vector<row_t> row_ids_debug;
|
467
|
+
Iterator it(*this);
|
468
|
+
it.FindMinimum(tree);
|
469
|
+
ARTKey empty_key = ARTKey();
|
470
|
+
it.Scan(empty_key, NumericLimits<row_t>().Maximum(), row_ids_debug, false);
|
471
|
+
D_ASSERT(row_count == row_ids_debug.size());
|
469
472
|
#endif
|
470
|
-
|
471
473
|
return true;
|
472
474
|
}
|
473
475
|
|
474
476
|
//===--------------------------------------------------------------------===//
|
475
|
-
// Insert
|
477
|
+
// Insert and Constraint Checking
|
476
478
|
//===--------------------------------------------------------------------===//
|
477
|
-
ErrorData ART::Insert(IndexLock &lock, DataChunk &input, Vector &row_ids) {
|
478
479
|
|
480
|
+
ErrorData ART::Insert(IndexLock &lock, DataChunk &input, Vector &row_ids) {
|
479
481
|
D_ASSERT(row_ids.GetType().InternalType() == ROW_TYPE);
|
480
|
-
|
482
|
+
auto row_count = input.size();
|
481
483
|
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
// get the corresponding row IDs
|
488
|
-
row_ids.Flatten(input.size());
|
489
|
-
auto row_identifiers = FlatVector::GetData<row_t>(row_ids);
|
484
|
+
ArenaAllocator allocator(BufferAllocator::Get(db));
|
485
|
+
unsafe_vector<ARTKey> keys(row_count);
|
486
|
+
unsafe_vector<ARTKey> row_id_keys(row_count);
|
487
|
+
GenerateKeyVectors(allocator, input, row_ids, keys, row_id_keys);
|
490
488
|
|
491
|
-
//
|
489
|
+
// Insert the entries into the index.
|
492
490
|
idx_t failed_index = DConstants::INVALID_INDEX;
|
493
|
-
|
491
|
+
auto was_empty = !tree.HasMetadata();
|
492
|
+
for (idx_t i = 0; i < row_count; i++) {
|
494
493
|
if (keys[i].Empty()) {
|
495
494
|
continue;
|
496
495
|
}
|
497
|
-
|
498
|
-
|
499
|
-
if (!Insert(tree, keys[i], 0, row_id)) {
|
500
|
-
// failed to insert because of constraint violation
|
496
|
+
if (!Insert(tree, keys[i], 0, row_id_keys[i], tree.GetGateStatus())) {
|
497
|
+
// Insertion failure due to a constraint violation.
|
501
498
|
failed_index = i;
|
502
499
|
break;
|
503
500
|
}
|
504
501
|
}
|
505
502
|
|
506
|
-
//
|
503
|
+
// Remove any previously inserted entries.
|
507
504
|
if (failed_index != DConstants::INVALID_INDEX) {
|
508
505
|
for (idx_t i = 0; i < failed_index; i++) {
|
509
506
|
if (keys[i].Empty()) {
|
510
507
|
continue;
|
511
508
|
}
|
512
|
-
|
513
|
-
Erase(tree, keys[i], 0, row_id);
|
509
|
+
Erase(tree, keys[i], 0, row_id_keys[i], tree.GetGateStatus());
|
514
510
|
}
|
515
511
|
}
|
516
512
|
|
513
|
+
if (was_empty) {
|
514
|
+
// All nodes are in-memory.
|
515
|
+
VerifyAllocationsInternal();
|
516
|
+
}
|
517
|
+
|
517
518
|
if (failed_index != DConstants::INVALID_INDEX) {
|
518
|
-
|
519
|
-
|
519
|
+
auto msg = AppendRowError(input, failed_index);
|
520
|
+
return ErrorData(ConstraintException("PRIMARY KEY or UNIQUE constraint violated: duplicate key \"%s\"", msg));
|
520
521
|
}
|
521
522
|
|
522
523
|
#ifdef DEBUG
|
523
|
-
for (idx_t i = 0; i <
|
524
|
+
for (idx_t i = 0; i < row_count; i++) {
|
524
525
|
if (keys[i].Empty()) {
|
525
526
|
continue;
|
526
527
|
}
|
527
|
-
|
528
|
-
auto leaf = Lookup(tree, keys[i], 0);
|
529
|
-
D_ASSERT(Leaf::ContainsRowId(*this, *leaf, row_identifiers[i]));
|
528
|
+
D_ASSERT(Lookup(tree, keys[i], 0));
|
530
529
|
}
|
531
530
|
#endif
|
532
|
-
|
533
531
|
return ErrorData();
|
534
532
|
}
|
535
533
|
|
536
|
-
ErrorData ART::Append(IndexLock &lock, DataChunk &
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
// now insert into the index
|
544
|
-
return Insert(lock, expression_result, row_identifiers);
|
534
|
+
ErrorData ART::Append(IndexLock &lock, DataChunk &input, Vector &row_ids) {
|
535
|
+
// Execute all column expressions before inserting the data chunk.
|
536
|
+
DataChunk expr_chunk;
|
537
|
+
expr_chunk.Initialize(Allocator::DefaultAllocator(), logical_types);
|
538
|
+
ExecuteExpressions(input, expr_chunk);
|
539
|
+
return Insert(lock, expr_chunk, row_ids);
|
545
540
|
}
|
546
541
|
|
547
542
|
void ART::VerifyAppend(DataChunk &chunk) {
|
@@ -554,87 +549,102 @@ void ART::VerifyAppend(DataChunk &chunk, ConflictManager &conflict_manager) {
|
|
554
549
|
CheckConstraintsForChunk(chunk, conflict_manager);
|
555
550
|
}
|
556
551
|
|
557
|
-
|
552
|
+
void ART::InsertIntoEmpty(Node &node, const ARTKey &key, const idx_t depth, const ARTKey &row_id,
|
553
|
+
const GateStatus status) {
|
554
|
+
D_ASSERT(depth <= key.len);
|
555
|
+
D_ASSERT(!node.HasMetadata());
|
558
556
|
|
559
|
-
if (
|
560
|
-
|
557
|
+
if (status == GateStatus::GATE_SET) {
|
558
|
+
Leaf::New(node, row_id.GetRowId());
|
559
|
+
return;
|
561
560
|
}
|
562
561
|
|
563
|
-
|
564
|
-
|
562
|
+
reference<Node> ref(node);
|
563
|
+
auto count = key.len - depth;
|
564
|
+
|
565
|
+
Prefix::New(*this, ref, key, depth, count);
|
566
|
+
Leaf::New(ref, row_id.GetRowId());
|
565
567
|
}
|
566
568
|
|
567
|
-
bool ART::
|
569
|
+
bool ART::InsertIntoNode(Node &node, const ARTKey &key, const idx_t depth, const ARTKey &row_id,
|
570
|
+
const GateStatus status) {
|
571
|
+
D_ASSERT(depth < key.len);
|
572
|
+
auto child = node.GetChildMutable(*this, key[depth]);
|
568
573
|
|
569
|
-
//
|
570
|
-
if (
|
571
|
-
D_ASSERT(
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
Leaf::New(ref_node, row_id);
|
576
|
-
return true;
|
574
|
+
// Recurse, if a child exists at key[depth].
|
575
|
+
if (child) {
|
576
|
+
D_ASSERT(child->HasMetadata());
|
577
|
+
bool success = Insert(*child, key, depth + 1, row_id, status);
|
578
|
+
node.ReplaceChild(*this, key[depth], *child);
|
579
|
+
return success;
|
577
580
|
}
|
578
581
|
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
582
|
+
// Create an inlined prefix at key[depth].
|
583
|
+
if (status == GateStatus::GATE_SET) {
|
584
|
+
Node remainder;
|
585
|
+
auto byte = key[depth];
|
586
|
+
auto success = Insert(remainder, key, depth + 1, row_id, status);
|
587
|
+
Node::InsertChild(*this, node, byte, remainder);
|
588
|
+
return success;
|
584
589
|
}
|
585
590
|
|
586
|
-
|
587
|
-
|
588
|
-
|
591
|
+
// Insert an inlined leaf at key[depth].
|
592
|
+
Node leaf;
|
593
|
+
reference<Node> ref(leaf);
|
589
594
|
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
return success;
|
595
|
-
}
|
596
|
-
|
597
|
-
// insert a new leaf node at key[depth]
|
598
|
-
Node leaf_node;
|
599
|
-
reference<Node> ref_node(leaf_node);
|
600
|
-
if (depth + 1 < key.len) {
|
601
|
-
Prefix::New(*this, ref_node, key, UnsafeNumericCast<uint32_t>(depth + 1),
|
602
|
-
UnsafeNumericCast<uint32_t>(key.len - depth - 1));
|
603
|
-
}
|
604
|
-
Leaf::New(ref_node, row_id);
|
605
|
-
Node::InsertChild(*this, node, key[depth], leaf_node);
|
606
|
-
return true;
|
595
|
+
// Create the prefix.
|
596
|
+
if (depth + 1 < key.len) {
|
597
|
+
auto count = key.len - depth - 1;
|
598
|
+
Prefix::New(*this, ref, key, depth + 1, count);
|
607
599
|
}
|
608
600
|
|
609
|
-
//
|
610
|
-
|
611
|
-
|
601
|
+
// Create the inlined leaf.
|
602
|
+
Leaf::New(ref, row_id.GetRowId());
|
603
|
+
Node::InsertChild(*this, node, key[depth], leaf);
|
604
|
+
return true;
|
605
|
+
}
|
612
606
|
|
613
|
-
|
614
|
-
if (
|
615
|
-
|
607
|
+
bool ART::Insert(Node &node, const ARTKey &key, idx_t depth, const ARTKey &row_id, const GateStatus status) {
|
608
|
+
if (!node.HasMetadata()) {
|
609
|
+
InsertIntoEmpty(node, key, depth, row_id, status);
|
610
|
+
return true;
|
616
611
|
}
|
617
612
|
|
618
|
-
//
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
Prefix::Split(*this, next_node, remaining_prefix, mismatch_position);
|
623
|
-
Node4::New(*this, next_node);
|
624
|
-
|
625
|
-
// insert remaining prefix
|
626
|
-
Node4::InsertChild(*this, next_node, prefix_byte, remaining_prefix);
|
613
|
+
// Enter a nested leaf.
|
614
|
+
if (status == GateStatus::GATE_NOT_SET && node.GetGateStatus() == GateStatus::GATE_SET) {
|
615
|
+
return Insert(node, row_id, 0, row_id, GateStatus::GATE_SET);
|
616
|
+
}
|
627
617
|
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
618
|
+
auto type = node.GetType();
|
619
|
+
switch (type) {
|
620
|
+
case NType::LEAF_INLINED: {
|
621
|
+
if (IsUnique()) {
|
622
|
+
return false;
|
623
|
+
}
|
624
|
+
Leaf::InsertIntoInlined(*this, node, row_id, depth, status);
|
625
|
+
return true;
|
626
|
+
}
|
627
|
+
case NType::LEAF: {
|
628
|
+
Leaf::TransformToNested(*this, node);
|
629
|
+
return Insert(node, key, depth, row_id, status);
|
630
|
+
}
|
631
|
+
case NType::NODE_7_LEAF:
|
632
|
+
case NType::NODE_15_LEAF:
|
633
|
+
case NType::NODE_256_LEAF: {
|
634
|
+
auto byte = key[Prefix::ROW_ID_COUNT];
|
635
|
+
Node::InsertChild(*this, node, byte);
|
636
|
+
return true;
|
637
|
+
}
|
638
|
+
case NType::NODE_4:
|
639
|
+
case NType::NODE_16:
|
640
|
+
case NType::NODE_48:
|
641
|
+
case NType::NODE_256:
|
642
|
+
return InsertIntoNode(node, key, depth, row_id, status);
|
643
|
+
case NType::PREFIX:
|
644
|
+
return Prefix::Insert(*this, node, key, depth, row_id, status);
|
645
|
+
default:
|
646
|
+
throw InternalException("Invalid node type for Insert.");
|
634
647
|
}
|
635
|
-
Leaf::New(ref_node, row_id);
|
636
|
-
Node4::InsertChild(*this, next_node, key[depth], leaf_node);
|
637
|
-
return true;
|
638
648
|
}
|
639
649
|
|
640
650
|
//===--------------------------------------------------------------------===//
|
@@ -649,356 +659,291 @@ void ART::CommitDrop(IndexLock &index_lock) {
|
|
649
659
|
}
|
650
660
|
|
651
661
|
void ART::Delete(IndexLock &state, DataChunk &input, Vector &row_ids) {
|
662
|
+
auto row_count = input.size();
|
652
663
|
|
653
|
-
DataChunk
|
654
|
-
|
664
|
+
DataChunk expr_chunk;
|
665
|
+
expr_chunk.Initialize(Allocator::DefaultAllocator(), logical_types);
|
666
|
+
ExecuteExpressions(input, expr_chunk);
|
655
667
|
|
656
|
-
|
657
|
-
|
668
|
+
ArenaAllocator allocator(BufferAllocator::Get(db));
|
669
|
+
unsafe_vector<ARTKey> keys(row_count);
|
670
|
+
unsafe_vector<ARTKey> row_id_keys(row_count);
|
671
|
+
GenerateKeyVectors(allocator, expr_chunk, row_ids, keys, row_id_keys);
|
658
672
|
|
659
|
-
|
660
|
-
ArenaAllocator arena_allocator(BufferAllocator::Get(db));
|
661
|
-
vector<ARTKey> keys(expression.size());
|
662
|
-
GenerateKeys(arena_allocator, expression, keys);
|
663
|
-
|
664
|
-
// now erase the elements from the database
|
665
|
-
row_ids.Flatten(input.size());
|
666
|
-
auto row_identifiers = FlatVector::GetData<row_t>(row_ids);
|
667
|
-
|
668
|
-
for (idx_t i = 0; i < input.size(); i++) {
|
673
|
+
for (idx_t i = 0; i < row_count; i++) {
|
669
674
|
if (keys[i].Empty()) {
|
670
675
|
continue;
|
671
676
|
}
|
672
|
-
Erase(tree, keys[i], 0,
|
677
|
+
Erase(tree, keys[i], 0, row_id_keys[i], tree.GetGateStatus());
|
678
|
+
}
|
679
|
+
|
680
|
+
if (!tree.HasMetadata()) {
|
681
|
+
// No more allocations.
|
682
|
+
VerifyAllocationsInternal();
|
673
683
|
}
|
674
684
|
|
675
685
|
#ifdef DEBUG
|
676
|
-
|
677
|
-
for (idx_t i = 0; i < input.size(); i++) {
|
686
|
+
for (idx_t i = 0; i < row_count; i++) {
|
678
687
|
if (keys[i].Empty()) {
|
679
688
|
continue;
|
680
689
|
}
|
681
|
-
|
682
690
|
auto leaf = Lookup(tree, keys[i], 0);
|
683
|
-
if (leaf) {
|
684
|
-
D_ASSERT(
|
691
|
+
if (leaf && leaf->GetType() == NType::LEAF_INLINED) {
|
692
|
+
D_ASSERT(leaf->GetRowId() != row_id_keys[i].GetRowId());
|
685
693
|
}
|
686
694
|
}
|
687
695
|
#endif
|
688
696
|
}
|
689
697
|
|
690
|
-
void ART::Erase(Node &node, const ARTKey
|
691
|
-
|
698
|
+
void ART::Erase(Node &node, reference<const ARTKey> key, idx_t depth, reference<const ARTKey> row_id,
|
699
|
+
GateStatus status) {
|
692
700
|
if (!node.HasMetadata()) {
|
693
701
|
return;
|
694
702
|
}
|
695
703
|
|
696
|
-
//
|
697
|
-
reference<Node>
|
698
|
-
if (
|
699
|
-
Prefix::TraverseMutable(*this,
|
700
|
-
|
704
|
+
// Traverse the prefix.
|
705
|
+
reference<Node> next(node);
|
706
|
+
if (next.get().GetType() == NType::PREFIX) {
|
707
|
+
Prefix::TraverseMutable(*this, next, key, depth);
|
708
|
+
|
709
|
+
// Prefixes don't match: nothing to erase.
|
710
|
+
if (next.get().GetType() == NType::PREFIX && next.get().GetGateStatus() == GateStatus::GATE_NOT_SET) {
|
701
711
|
return;
|
702
712
|
}
|
703
713
|
}
|
704
714
|
|
705
|
-
//
|
706
|
-
|
707
|
-
|
715
|
+
// Delete the row ID from the leaf.
|
716
|
+
// This is the root node, which can be a leaf with possible prefix nodes.
|
717
|
+
if (next.get().GetType() == NType::LEAF_INLINED) {
|
718
|
+
if (next.get().GetRowId() == row_id.get().GetRowId()) {
|
708
719
|
Node::Free(*this, node);
|
709
720
|
}
|
710
721
|
return;
|
711
722
|
}
|
712
723
|
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
724
|
+
// Transform a deprecated leaf.
|
725
|
+
if (next.get().GetType() == NType::LEAF) {
|
726
|
+
D_ASSERT(status == GateStatus::GATE_NOT_SET);
|
727
|
+
Leaf::TransformToNested(*this, next);
|
728
|
+
}
|
717
729
|
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
if (child_node.get().GetType() == NType::PREFIX) {
|
723
|
-
return;
|
724
|
-
}
|
725
|
-
}
|
730
|
+
// Enter a nested leaf.
|
731
|
+
if (status == GateStatus::GATE_NOT_SET && next.get().GetGateStatus() == GateStatus::GATE_SET) {
|
732
|
+
return Erase(next, row_id, 0, row_id, GateStatus::GATE_SET);
|
733
|
+
}
|
726
734
|
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
return;
|
735
|
+
D_ASSERT(depth < key.get().len);
|
736
|
+
if (next.get().IsLeafNode()) {
|
737
|
+
auto byte = key.get()[depth];
|
738
|
+
if (next.get().HasByte(*this, byte)) {
|
739
|
+
Node::DeleteChild(*this, next, node, key.get()[depth], status, key.get());
|
733
740
|
}
|
741
|
+
return;
|
742
|
+
}
|
734
743
|
|
735
|
-
|
736
|
-
|
737
|
-
|
744
|
+
auto child = next.get().GetChildMutable(*this, key.get()[depth]);
|
745
|
+
if (!child) {
|
746
|
+
// No child at the byte: nothing to erase.
|
747
|
+
return;
|
738
748
|
}
|
739
|
-
}
|
740
749
|
|
741
|
-
|
742
|
-
|
743
|
-
|
750
|
+
// Transform a deprecated leaf.
|
751
|
+
if (child->GetType() == NType::LEAF) {
|
752
|
+
D_ASSERT(status == GateStatus::GATE_NOT_SET);
|
753
|
+
Leaf::TransformToNested(*this, *child);
|
754
|
+
}
|
744
755
|
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
return
|
754
|
-
case PhysicalType::INT32:
|
755
|
-
return ARTKey::CreateARTKey<int32_t>(allocator, value.type(), value);
|
756
|
-
case PhysicalType::INT64:
|
757
|
-
return ARTKey::CreateARTKey<int64_t>(allocator, value.type(), value);
|
758
|
-
case PhysicalType::UINT8:
|
759
|
-
return ARTKey::CreateARTKey<uint8_t>(allocator, value.type(), value);
|
760
|
-
case PhysicalType::UINT16:
|
761
|
-
return ARTKey::CreateARTKey<uint16_t>(allocator, value.type(), value);
|
762
|
-
case PhysicalType::UINT32:
|
763
|
-
return ARTKey::CreateARTKey<uint32_t>(allocator, value.type(), value);
|
764
|
-
case PhysicalType::UINT64:
|
765
|
-
return ARTKey::CreateARTKey<uint64_t>(allocator, value.type(), value);
|
766
|
-
case PhysicalType::INT128:
|
767
|
-
return ARTKey::CreateARTKey<hugeint_t>(allocator, value.type(), value);
|
768
|
-
case PhysicalType::UINT128:
|
769
|
-
return ARTKey::CreateARTKey<uhugeint_t>(allocator, value.type(), value);
|
770
|
-
case PhysicalType::FLOAT:
|
771
|
-
return ARTKey::CreateARTKey<float>(allocator, value.type(), value);
|
772
|
-
case PhysicalType::DOUBLE:
|
773
|
-
return ARTKey::CreateARTKey<double>(allocator, value.type(), value);
|
774
|
-
case PhysicalType::VARCHAR:
|
775
|
-
return ARTKey::CreateARTKey<string_t>(allocator, value.type(), value);
|
776
|
-
default:
|
777
|
-
throw InternalException("Invalid type for the ART key");
|
756
|
+
// Enter a nested leaf.
|
757
|
+
if (status == GateStatus::GATE_NOT_SET && child->GetGateStatus() == GateStatus::GATE_SET) {
|
758
|
+
Erase(*child, row_id, 0, row_id, GateStatus::GATE_SET);
|
759
|
+
if (!child->HasMetadata()) {
|
760
|
+
Node::DeleteChild(*this, next, node, key.get()[depth], status, key.get());
|
761
|
+
} else {
|
762
|
+
next.get().ReplaceChild(*this, key.get()[depth], *child);
|
763
|
+
}
|
764
|
+
return;
|
778
765
|
}
|
779
|
-
}
|
780
766
|
|
781
|
-
|
767
|
+
auto temp_depth = depth + 1;
|
768
|
+
reference<Node> ref(*child);
|
782
769
|
|
783
|
-
|
784
|
-
|
785
|
-
return true;
|
786
|
-
}
|
787
|
-
return Leaf::GetRowIds(*this, *leaf, result_ids, max_count);
|
788
|
-
}
|
770
|
+
if (ref.get().GetType() == NType::PREFIX) {
|
771
|
+
Prefix::TraverseMutable(*this, ref, key, temp_depth);
|
789
772
|
|
790
|
-
|
773
|
+
// Prefixes don't match: nothing to erase.
|
774
|
+
if (ref.get().GetType() == NType::PREFIX && ref.get().GetGateStatus() == GateStatus::GATE_NOT_SET) {
|
775
|
+
return;
|
776
|
+
}
|
777
|
+
}
|
791
778
|
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
779
|
+
if (ref.get().GetType() == NType::LEAF_INLINED) {
|
780
|
+
if (ref.get().GetRowId() == row_id.get().GetRowId()) {
|
781
|
+
Node::DeleteChild(*this, next, node, key.get()[depth], status, key.get());
|
782
|
+
}
|
796
783
|
return;
|
797
784
|
}
|
798
785
|
|
799
|
-
//
|
800
|
-
|
801
|
-
|
802
|
-
|
786
|
+
// Recurse.
|
787
|
+
Erase(*child, key, depth + 1, row_id, status);
|
788
|
+
if (!child->HasMetadata()) {
|
789
|
+
Node::DeleteChild(*this, next, node, key.get()[depth], status, key.get());
|
790
|
+
} else {
|
791
|
+
next.get().ReplaceChild(*this, key.get()[depth], *child);
|
792
|
+
}
|
803
793
|
}
|
804
794
|
|
805
795
|
//===--------------------------------------------------------------------===//
|
806
|
-
//
|
796
|
+
// Point and range lookups
|
807
797
|
//===--------------------------------------------------------------------===//
|
808
798
|
|
809
|
-
|
799
|
+
const unsafe_optional_ptr<const Node> ART::Lookup(const Node &node, const ARTKey &key, idx_t depth) {
|
800
|
+
reference<const Node> ref(node);
|
801
|
+
while (ref.get().HasMetadata()) {
|
810
802
|
|
811
|
-
|
812
|
-
|
803
|
+
// Return the leaf.
|
804
|
+
if (ref.get().IsAnyLeaf() || ref.get().GetGateStatus() == GateStatus::GATE_SET) {
|
805
|
+
return unsafe_optional_ptr<const Node>(ref.get());
|
806
|
+
}
|
813
807
|
|
814
|
-
//
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
808
|
+
// Traverse the prefix.
|
809
|
+
if (ref.get().GetType() == NType::PREFIX) {
|
810
|
+
Prefix::Traverse(*this, ref, key, depth);
|
811
|
+
if (ref.get().GetType() == NType::PREFIX && ref.get().GetGateStatus() == GateStatus::GATE_NOT_SET) {
|
812
|
+
// Prefix mismatch, return nullptr.
|
819
813
|
return nullptr;
|
820
814
|
}
|
815
|
+
continue;
|
821
816
|
}
|
822
817
|
|
823
|
-
|
824
|
-
return &next_node.get();
|
825
|
-
}
|
826
|
-
|
818
|
+
// Get the child node.
|
827
819
|
D_ASSERT(depth < key.len);
|
828
|
-
auto child =
|
820
|
+
auto child = ref.get().GetChild(*this, key[depth]);
|
821
|
+
|
822
|
+
// No child at the matching byte, return nullptr.
|
829
823
|
if (!child) {
|
830
|
-
// prefix matches key, but no child at byte, ART/subtree does not contain key
|
831
824
|
return nullptr;
|
832
825
|
}
|
833
826
|
|
834
|
-
//
|
835
|
-
|
836
|
-
D_ASSERT(
|
827
|
+
// Continue in the child.
|
828
|
+
ref = *child;
|
829
|
+
D_ASSERT(ref.get().HasMetadata());
|
837
830
|
depth++;
|
838
831
|
}
|
839
832
|
|
840
833
|
return nullptr;
|
841
834
|
}
|
842
835
|
|
843
|
-
|
844
|
-
|
845
|
-
|
836
|
+
bool ART::SearchEqual(ARTKey &key, idx_t max_count, unsafe_vector<row_t> &row_ids) {
|
837
|
+
auto leaf = Lookup(tree, key, 0);
|
838
|
+
if (!leaf) {
|
839
|
+
return true;
|
840
|
+
}
|
846
841
|
|
847
|
-
|
842
|
+
Iterator it(*this);
|
843
|
+
it.FindMinimum(*leaf);
|
844
|
+
ARTKey empty_key = ARTKey();
|
845
|
+
return it.Scan(empty_key, max_count, row_ids, false);
|
846
|
+
}
|
848
847
|
|
848
|
+
bool ART::SearchGreater(ARTKey &key, bool equal, idx_t max_count, unsafe_vector<row_t> &row_ids) {
|
849
849
|
if (!tree.HasMetadata()) {
|
850
850
|
return true;
|
851
851
|
}
|
852
|
-
Iterator &it = state.iterator;
|
853
852
|
|
854
|
-
//
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
}
|
853
|
+
// Find the lowest value that satisfies the predicate.
|
854
|
+
Iterator it(*this);
|
855
|
+
|
856
|
+
// Early-out, if the maximum value in the ART is lower than the lower bound.
|
857
|
+
if (!it.LowerBound(tree, key, equal, 0)) {
|
858
|
+
return true;
|
861
859
|
}
|
862
860
|
|
863
|
-
//
|
864
|
-
//
|
865
|
-
ARTKey
|
866
|
-
return it.Scan(empty_key, max_count, result_ids, false);
|
861
|
+
// We continue the scan. We do not check the bounds as any value following this value is
|
862
|
+
// greater and satisfies our predicate.
|
863
|
+
return it.Scan(ARTKey(), max_count, row_ids, false);
|
867
864
|
}
|
868
865
|
|
869
|
-
bool ART::SearchLess(
|
870
|
-
vector<row_t> &result_ids) {
|
871
|
-
|
866
|
+
bool ART::SearchLess(ARTKey &upper_bound, bool equal, idx_t max_count, unsafe_vector<row_t> &row_ids) {
|
872
867
|
if (!tree.HasMetadata()) {
|
873
868
|
return true;
|
874
869
|
}
|
875
|
-
Iterator &it = state.iterator;
|
876
870
|
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
}
|
871
|
+
// Find the minimum value in the ART: we start scanning from this value.
|
872
|
+
Iterator it(*this);
|
873
|
+
it.FindMinimum(tree);
|
874
|
+
|
875
|
+
// Early-out, if the minimum value is higher than the upper bound.
|
876
|
+
if (it.current_key.GreaterThan(upper_bound, equal, it.GetNestedDepth())) {
|
877
|
+
return true;
|
885
878
|
}
|
886
879
|
|
887
|
-
//
|
888
|
-
return it.Scan(upper_bound, max_count,
|
880
|
+
// Continue the scan until we reach the upper bound.
|
881
|
+
return it.Scan(upper_bound, max_count, row_ids, equal);
|
889
882
|
}
|
890
883
|
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
bool ART::SearchCloseRange(ARTIndexScanState &state, ARTKey &lower_bound, ARTKey &upper_bound, bool left_equal,
|
896
|
-
bool right_equal, idx_t max_count, vector<row_t> &result_ids) {
|
884
|
+
bool ART::SearchCloseRange(ARTKey &lower_bound, ARTKey &upper_bound, bool left_equal, bool right_equal, idx_t max_count,
|
885
|
+
unsafe_vector<row_t> &row_ids) {
|
886
|
+
// Find the first node that satisfies the left predicate.
|
887
|
+
Iterator it(*this);
|
897
888
|
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
if (!it.art) {
|
902
|
-
it.art = this;
|
903
|
-
if (!it.LowerBound(tree, lower_bound, left_equal, 0)) {
|
904
|
-
// early-out, if the maximum value in the ART is lower than the lower bound
|
905
|
-
return true;
|
906
|
-
}
|
889
|
+
// Early-out, if the maximum value in the ART is lower than the lower bound.
|
890
|
+
if (!it.LowerBound(tree, lower_bound, left_equal, 0)) {
|
891
|
+
return true;
|
907
892
|
}
|
908
893
|
|
909
|
-
//
|
910
|
-
return it.Scan(upper_bound, max_count,
|
894
|
+
// Continue the scan until we reach the upper bound.
|
895
|
+
return it.Scan(upper_bound, max_count, row_ids, right_equal);
|
911
896
|
}
|
912
897
|
|
913
|
-
bool ART::Scan(
|
914
|
-
vector<row_t> &result_ids) {
|
915
|
-
|
898
|
+
bool ART::Scan(IndexScanState &state, const idx_t max_count, unsafe_vector<row_t> &row_ids) {
|
916
899
|
auto &scan_state = state.Cast<ARTIndexScanState>();
|
917
|
-
vector<row_t> row_ids;
|
918
|
-
bool success;
|
919
|
-
|
920
|
-
// FIXME: the key directly owning the data for a single key might be more efficient
|
921
900
|
D_ASSERT(scan_state.values[0].type().InternalType() == types[0]);
|
922
901
|
ArenaAllocator arena_allocator(Allocator::Get(db));
|
923
|
-
auto key = CreateKey(arena_allocator, types[0], scan_state.values[0]);
|
902
|
+
auto key = ARTKey::CreateKey(arena_allocator, types[0], scan_state.values[0]);
|
924
903
|
|
925
904
|
if (scan_state.values[1].IsNull()) {
|
926
|
-
|
927
|
-
// single predicate
|
905
|
+
// Single predicate.
|
928
906
|
lock_guard<mutex> l(lock);
|
929
907
|
switch (scan_state.expressions[0]) {
|
930
908
|
case ExpressionType::COMPARE_EQUAL:
|
931
|
-
|
932
|
-
break;
|
909
|
+
return SearchEqual(key, max_count, row_ids);
|
933
910
|
case ExpressionType::COMPARE_GREATERTHANOREQUALTO:
|
934
|
-
|
935
|
-
break;
|
911
|
+
return SearchGreater(key, true, max_count, row_ids);
|
936
912
|
case ExpressionType::COMPARE_GREATERTHAN:
|
937
|
-
|
938
|
-
break;
|
913
|
+
return SearchGreater(key, false, max_count, row_ids);
|
939
914
|
case ExpressionType::COMPARE_LESSTHANOREQUALTO:
|
940
|
-
|
941
|
-
break;
|
915
|
+
return SearchLess(key, true, max_count, row_ids);
|
942
916
|
case ExpressionType::COMPARE_LESSTHAN:
|
943
|
-
|
944
|
-
break;
|
917
|
+
return SearchLess(key, false, max_count, row_ids);
|
945
918
|
default:
|
946
919
|
throw InternalException("Index scan type not implemented");
|
947
920
|
}
|
948
|
-
|
949
|
-
} else {
|
950
|
-
|
951
|
-
// two predicates
|
952
|
-
lock_guard<mutex> l(lock);
|
953
|
-
|
954
|
-
D_ASSERT(scan_state.values[1].type().InternalType() == types[0]);
|
955
|
-
auto upper_bound = CreateKey(arena_allocator, types[0], scan_state.values[1]);
|
956
|
-
|
957
|
-
bool left_equal = scan_state.expressions[0] == ExpressionType ::COMPARE_GREATERTHANOREQUALTO;
|
958
|
-
bool right_equal = scan_state.expressions[1] == ExpressionType ::COMPARE_LESSTHANOREQUALTO;
|
959
|
-
success = SearchCloseRange(scan_state, key, upper_bound, left_equal, right_equal, max_count, row_ids);
|
960
|
-
}
|
961
|
-
|
962
|
-
if (!success) {
|
963
|
-
return false;
|
964
|
-
}
|
965
|
-
if (row_ids.empty()) {
|
966
|
-
return true;
|
967
921
|
}
|
968
922
|
|
969
|
-
//
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
if (row_ids[i] != row_ids[i - 1]) {
|
977
|
-
result_ids.push_back(row_ids[i]);
|
978
|
-
}
|
979
|
-
}
|
980
|
-
return true;
|
923
|
+
// Two predicates.
|
924
|
+
lock_guard<mutex> l(lock);
|
925
|
+
D_ASSERT(scan_state.values[1].type().InternalType() == types[0]);
|
926
|
+
auto upper_bound = ARTKey::CreateKey(arena_allocator, types[0], scan_state.values[1]);
|
927
|
+
bool left_equal = scan_state.expressions[0] == ExpressionType ::COMPARE_GREATERTHANOREQUALTO;
|
928
|
+
bool right_equal = scan_state.expressions[1] == ExpressionType ::COMPARE_LESSTHANOREQUALTO;
|
929
|
+
return SearchCloseRange(key, upper_bound, left_equal, right_equal, max_count, row_ids);
|
981
930
|
}
|
982
931
|
|
983
932
|
//===--------------------------------------------------------------------===//
|
984
|
-
// More
|
933
|
+
// More Constraint Checking
|
985
934
|
//===--------------------------------------------------------------------===//
|
986
935
|
|
987
|
-
string ART::GenerateErrorKeyName(DataChunk &input, idx_t
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
// re-executing the expressions is not very fast, but we're going to throw, so we don't care
|
992
|
-
DataChunk expression_chunk;
|
993
|
-
expression_chunk.Initialize(Allocator::DefaultAllocator(), logical_types);
|
994
|
-
ExecuteExpressions(input, expression_chunk);
|
936
|
+
string ART::GenerateErrorKeyName(DataChunk &input, idx_t row_idx) {
|
937
|
+
DataChunk expr_chunk;
|
938
|
+
expr_chunk.Initialize(Allocator::DefaultAllocator(), logical_types);
|
939
|
+
ExecuteExpressions(input, expr_chunk);
|
995
940
|
|
996
941
|
string key_name;
|
997
|
-
for (idx_t k = 0; k <
|
942
|
+
for (idx_t k = 0; k < expr_chunk.ColumnCount(); k++) {
|
998
943
|
if (k > 0) {
|
999
944
|
key_name += ", ";
|
1000
945
|
}
|
1001
|
-
key_name += unbound_expressions[k]->GetName() + ": " +
|
946
|
+
key_name += unbound_expressions[k]->GetName() + ": " + expr_chunk.data[k].GetValue(row_idx).ToString();
|
1002
947
|
}
|
1003
948
|
return key_name;
|
1004
949
|
}
|
@@ -1006,7 +951,7 @@ string ART::GenerateErrorKeyName(DataChunk &input, idx_t row) {
|
|
1006
951
|
string ART::GenerateConstraintErrorMessage(VerifyExistenceType verify_type, const string &key_name) {
|
1007
952
|
switch (verify_type) {
|
1008
953
|
case VerifyExistenceType::APPEND: {
|
1009
|
-
// APPEND to PK/UNIQUE table, but node/key already exists in PK/UNIQUE table
|
954
|
+
// APPEND to PK/UNIQUE table, but node/key already exists in PK/UNIQUE table.
|
1010
955
|
string type = IsPrimary() ? "primary key" : "unique";
|
1011
956
|
return StringUtil::Format("Duplicate key \"%s\" violates %s constraint. "
|
1012
957
|
"If this is an unexpected constraint violation please double "
|
@@ -1015,12 +960,12 @@ string ART::GenerateConstraintErrorMessage(VerifyExistenceType verify_type, cons
|
|
1015
960
|
key_name, type);
|
1016
961
|
}
|
1017
962
|
case VerifyExistenceType::APPEND_FK: {
|
1018
|
-
// APPEND_FK to FK table, node/key does not exist in PK/UNIQUE table
|
963
|
+
// APPEND_FK to FK table, node/key does not exist in PK/UNIQUE table.
|
1019
964
|
return StringUtil::Format(
|
1020
965
|
"Violates foreign key constraint because key \"%s\" does not exist in the referenced table", key_name);
|
1021
966
|
}
|
1022
967
|
case VerifyExistenceType::DELETE_FK: {
|
1023
|
-
// DELETE_FK that still exists in a FK table, i.e., not a valid delete
|
968
|
+
// DELETE_FK that still exists in a FK table, i.e., not a valid delete.
|
1024
969
|
return StringUtil::Format("Violates foreign key constraint because key \"%s\" is still referenced by a foreign "
|
1025
970
|
"key in a different table",
|
1026
971
|
key_name);
|
@@ -1031,23 +976,19 @@ string ART::GenerateConstraintErrorMessage(VerifyExistenceType verify_type, cons
|
|
1031
976
|
}
|
1032
977
|
|
1033
978
|
void ART::CheckConstraintsForChunk(DataChunk &input, ConflictManager &conflict_manager) {
|
1034
|
-
|
1035
|
-
// don't alter the index during constraint checking
|
979
|
+
// Lock the index during constraint checking.
|
1036
980
|
lock_guard<mutex> l(lock);
|
1037
981
|
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
ExecuteExpressions(input, expression_chunk);
|
982
|
+
DataChunk expr_chunk;
|
983
|
+
expr_chunk.Initialize(Allocator::DefaultAllocator(), logical_types);
|
984
|
+
ExecuteExpressions(input, expr_chunk);
|
1042
985
|
|
1043
|
-
// generate the keys for the given input
|
1044
986
|
ArenaAllocator arena_allocator(BufferAllocator::Get(db));
|
1045
|
-
|
1046
|
-
GenerateKeys(arena_allocator,
|
987
|
+
unsafe_vector<ARTKey> keys(expr_chunk.size());
|
988
|
+
GenerateKeys<>(arena_allocator, expr_chunk, keys);
|
1047
989
|
|
1048
|
-
|
990
|
+
auto found_conflict = DConstants::INVALID_INDEX;
|
1049
991
|
for (idx_t i = 0; found_conflict == DConstants::INVALID_INDEX && i < input.size(); i++) {
|
1050
|
-
|
1051
992
|
if (keys[i].Empty()) {
|
1052
993
|
if (conflict_manager.AddNull(i)) {
|
1053
994
|
found_conflict = i;
|
@@ -1063,8 +1004,8 @@ void ART::CheckConstraintsForChunk(DataChunk &input, ConflictManager &conflict_m
|
|
1063
1004
|
continue;
|
1064
1005
|
}
|
1065
1006
|
|
1066
|
-
//
|
1067
|
-
//
|
1007
|
+
// If we find a node, we need to update the 'matches' and 'row_ids'.
|
1008
|
+
// We only perform constraint checking on unique indexes, i.e., all leaves are inlined.
|
1068
1009
|
D_ASSERT(leaf->GetType() == NType::LEAF_INLINED);
|
1069
1010
|
if (conflict_manager.AddHit(i, leaf->GetRowId())) {
|
1070
1011
|
found_conflict = i;
|
@@ -1072,7 +1013,6 @@ void ART::CheckConstraintsForChunk(DataChunk &input, ConflictManager &conflict_m
|
|
1072
1013
|
}
|
1073
1014
|
|
1074
1015
|
conflict_manager.FinishLookup();
|
1075
|
-
|
1076
1016
|
if (found_conflict == DConstants::INVALID_INDEX) {
|
1077
1017
|
return;
|
1078
1018
|
}
|
@@ -1082,93 +1022,178 @@ void ART::CheckConstraintsForChunk(DataChunk &input, ConflictManager &conflict_m
|
|
1082
1022
|
throw ConstraintException(exception_msg);
|
1083
1023
|
}
|
1084
1024
|
|
1025
|
+
string ART::GetConstraintViolationMessage(VerifyExistenceType verify_type, idx_t failed_index, DataChunk &input) {
|
1026
|
+
auto key_name = GenerateErrorKeyName(input, failed_index);
|
1027
|
+
auto exception_msg = GenerateConstraintErrorMessage(verify_type, key_name);
|
1028
|
+
return exception_msg;
|
1029
|
+
}
|
1030
|
+
|
1085
1031
|
//===--------------------------------------------------------------------===//
|
1086
|
-
//
|
1032
|
+
// Storage and Memory
|
1087
1033
|
//===--------------------------------------------------------------------===//
|
1088
1034
|
|
1089
|
-
|
1035
|
+
void ART::TransformToDeprecated() {
|
1036
|
+
auto idx = Node::GetAllocatorIdx(NType::PREFIX);
|
1037
|
+
auto &block_manager = (*allocators)[idx]->block_manager;
|
1038
|
+
unsafe_unique_ptr<FixedSizeAllocator> deprecated_allocator;
|
1039
|
+
|
1040
|
+
if (prefix_count != Prefix::DEPRECATED_COUNT) {
|
1041
|
+
auto prefix_size = NumericCast<idx_t>(Prefix::DEPRECATED_COUNT) + NumericCast<idx_t>(Prefix::METADATA_SIZE);
|
1042
|
+
deprecated_allocator = make_unsafe_uniq<FixedSizeAllocator>(prefix_size, block_manager);
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
// Transform all leaves, and possibly the prefixes.
|
1046
|
+
if (tree.HasMetadata()) {
|
1047
|
+
Node::TransformToDeprecated(*this, tree, deprecated_allocator);
|
1048
|
+
}
|
1049
|
+
|
1050
|
+
// Replace the prefix allocator with the deprecated allocator.
|
1051
|
+
if (deprecated_allocator) {
|
1052
|
+
prefix_count = Prefix::DEPRECATED_COUNT;
|
1053
|
+
|
1054
|
+
D_ASSERT((*allocators)[idx]->IsEmpty());
|
1055
|
+
(*allocators)[idx]->Reset();
|
1056
|
+
(*allocators)[idx] = std::move(deprecated_allocator);
|
1057
|
+
}
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
IndexStorageInfo ART::GetStorageInfo(const case_insensitive_map_t<Value> &options, const bool to_wal) {
|
1061
|
+
// If the storage format uses deprecated leaf storage,
|
1062
|
+
// then we need to transform all nested leaves before serialization.
|
1063
|
+
auto v1_0_0_option = options.find("v1_0_0_storage");
|
1064
|
+
bool v1_0_0_storage = v1_0_0_option == options.end() || v1_0_0_option->second != Value(false);
|
1065
|
+
if (v1_0_0_storage) {
|
1066
|
+
TransformToDeprecated();
|
1067
|
+
}
|
1090
1068
|
|
1091
|
-
|
1092
|
-
IndexStorageInfo info;
|
1093
|
-
info.name = name;
|
1069
|
+
IndexStorageInfo info(name);
|
1094
1070
|
info.root = tree.Get();
|
1071
|
+
info.options = options;
|
1095
1072
|
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1073
|
+
for (auto &allocator : *allocators) {
|
1074
|
+
allocator->RemoveEmptyBuffers();
|
1075
|
+
}
|
1076
|
+
|
1077
|
+
#ifdef DEBUG
|
1078
|
+
if (v1_0_0_storage) {
|
1079
|
+
D_ASSERT((*allocators)[Node::GetAllocatorIdx(NType::NODE_7_LEAF)]->IsEmpty());
|
1080
|
+
D_ASSERT((*allocators)[Node::GetAllocatorIdx(NType::NODE_15_LEAF)]->IsEmpty());
|
1081
|
+
D_ASSERT((*allocators)[Node::GetAllocatorIdx(NType::NODE_256_LEAF)]->IsEmpty());
|
1082
|
+
D_ASSERT((*allocators)[Node::GetAllocatorIdx(NType::PREFIX)]->GetSegmentSize() ==
|
1083
|
+
Prefix::DEPRECATED_COUNT + Prefix::METADATA_SIZE);
|
1084
|
+
}
|
1085
|
+
#endif
|
1086
|
+
|
1087
|
+
auto allocator_count = v1_0_0_storage ? DEPRECATED_ALLOCATOR_COUNT : ALLOCATOR_COUNT;
|
1088
|
+
if (!to_wal) {
|
1089
|
+
// Store the data on disk as partial blocks and set the block ids.
|
1090
|
+
WritePartialBlocks(v1_0_0_storage);
|
1099
1091
|
|
1100
1092
|
} else {
|
1101
|
-
//
|
1102
|
-
for (
|
1103
|
-
info.buffers.push_back(
|
1093
|
+
// Set the correct allocation sizes and get the map containing all buffers.
|
1094
|
+
for (idx_t i = 0; i < allocator_count; i++) {
|
1095
|
+
info.buffers.push_back((*allocators)[i]->InitSerializationToWAL());
|
1104
1096
|
}
|
1105
1097
|
}
|
1106
1098
|
|
1107
|
-
for (
|
1108
|
-
info.allocator_infos.push_back(
|
1099
|
+
for (idx_t i = 0; i < allocator_count; i++) {
|
1100
|
+
info.allocator_infos.push_back((*allocators)[i]->GetInfo());
|
1109
1101
|
}
|
1110
|
-
|
1111
1102
|
return info;
|
1112
1103
|
}
|
1113
1104
|
|
1114
|
-
void ART::WritePartialBlocks() {
|
1115
|
-
|
1116
|
-
// use the partial block manager to serialize all allocator data
|
1105
|
+
void ART::WritePartialBlocks(const bool v1_0_0_storage) {
|
1117
1106
|
auto &block_manager = table_io_manager.GetIndexBlockManager();
|
1118
1107
|
PartialBlockManager partial_block_manager(block_manager, PartialBlockType::FULL_CHECKPOINT);
|
1119
1108
|
|
1120
|
-
|
1121
|
-
|
1109
|
+
idx_t allocator_count = v1_0_0_storage ? DEPRECATED_ALLOCATOR_COUNT : ALLOCATOR_COUNT;
|
1110
|
+
for (idx_t i = 0; i < allocator_count; i++) {
|
1111
|
+
(*allocators)[i]->SerializeBuffers(partial_block_manager);
|
1122
1112
|
}
|
1123
1113
|
partial_block_manager.FlushPartialBlocks();
|
1124
1114
|
}
|
1125
1115
|
|
1126
1116
|
void ART::InitAllocators(const IndexStorageInfo &info) {
|
1127
|
-
|
1128
|
-
// set the root node
|
1129
|
-
tree.Set(info.root);
|
1130
|
-
|
1131
|
-
// initialize the allocators
|
1132
|
-
D_ASSERT(info.allocator_infos.size() == ALLOCATOR_COUNT);
|
1133
1117
|
for (idx_t i = 0; i < info.allocator_infos.size(); i++) {
|
1134
1118
|
(*allocators)[i]->Init(info.allocator_infos[i]);
|
1135
1119
|
}
|
1136
1120
|
}
|
1137
1121
|
|
1138
1122
|
void ART::Deserialize(const BlockPointer &pointer) {
|
1139
|
-
|
1140
1123
|
D_ASSERT(pointer.IsValid());
|
1124
|
+
|
1141
1125
|
auto &metadata_manager = table_io_manager.GetMetadataManager();
|
1142
1126
|
MetadataReader reader(metadata_manager, pointer);
|
1143
1127
|
tree = reader.Read<Node>();
|
1144
1128
|
|
1145
|
-
for (idx_t i = 0; i <
|
1129
|
+
for (idx_t i = 0; i < DEPRECATED_ALLOCATOR_COUNT; i++) {
|
1146
1130
|
(*allocators)[i]->Deserialize(metadata_manager, reader.Read<BlockPointer>());
|
1147
1131
|
}
|
1148
1132
|
}
|
1149
1133
|
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1134
|
+
void ART::SetPrefixCount(const IndexStorageInfo &info) {
|
1135
|
+
auto numeric_max = NumericLimits<uint8_t>().Maximum();
|
1136
|
+
auto max_aligned = AlignValueFloor<uint8_t>(numeric_max - Prefix::METADATA_SIZE);
|
1137
|
+
|
1138
|
+
if (info.IsValid() && info.root_block_ptr.IsValid()) {
|
1139
|
+
prefix_count = Prefix::DEPRECATED_COUNT;
|
1140
|
+
return;
|
1141
|
+
}
|
1153
1142
|
|
1154
|
-
|
1155
|
-
|
1143
|
+
if (info.IsValid()) {
|
1144
|
+
auto serialized_count = info.allocator_infos[0].segment_size - Prefix::METADATA_SIZE;
|
1145
|
+
prefix_count = NumericCast<uint8_t>(serialized_count);
|
1146
|
+
return;
|
1147
|
+
}
|
1148
|
+
|
1149
|
+
if (!IsUnique()) {
|
1150
|
+
prefix_count = Prefix::ROW_ID_COUNT;
|
1151
|
+
return;
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
idx_t compound_size = 0;
|
1155
|
+
for (const auto &type : types) {
|
1156
|
+
compound_size += GetTypeIdSize(type);
|
1157
|
+
}
|
1158
|
+
|
1159
|
+
auto aligned = AlignValue(compound_size) - 1;
|
1160
|
+
if (aligned > NumericCast<idx_t>(max_aligned)) {
|
1161
|
+
prefix_count = max_aligned;
|
1162
|
+
return;
|
1163
|
+
}
|
1164
|
+
|
1165
|
+
prefix_count = NumericCast<uint8_t>(aligned);
|
1166
|
+
}
|
1167
|
+
|
1168
|
+
idx_t ART::GetInMemorySize(IndexLock &index_lock) {
|
1169
|
+
D_ASSERT(owns_data);
|
1170
|
+
|
1171
|
+
idx_t in_memory_size = 0;
|
1156
1172
|
for (auto &allocator : *allocators) {
|
1157
|
-
|
1173
|
+
in_memory_size += allocator->GetInMemorySize();
|
1158
1174
|
}
|
1175
|
+
return in_memory_size;
|
1159
1176
|
}
|
1160
1177
|
|
1161
|
-
|
1178
|
+
//===--------------------------------------------------------------------===//
|
1179
|
+
// Vacuum
|
1180
|
+
//===--------------------------------------------------------------------===//
|
1162
1181
|
|
1182
|
+
void ART::InitializeVacuum(unordered_set<uint8_t> &indexes) {
|
1163
1183
|
for (idx_t i = 0; i < allocators->size(); i++) {
|
1164
|
-
if (
|
1165
|
-
(
|
1184
|
+
if ((*allocators)[i]->InitializeVacuum()) {
|
1185
|
+
indexes.insert(NumericCast<uint8_t>(i));
|
1166
1186
|
}
|
1167
1187
|
}
|
1168
1188
|
}
|
1169
1189
|
|
1170
|
-
void ART::
|
1190
|
+
void ART::FinalizeVacuum(const unordered_set<uint8_t> &indexes) {
|
1191
|
+
for (const auto &idx : indexes) {
|
1192
|
+
(*allocators)[idx]->FinalizeVacuum();
|
1193
|
+
}
|
1194
|
+
}
|
1171
1195
|
|
1196
|
+
void ART::Vacuum(IndexLock &state) {
|
1172
1197
|
D_ASSERT(owns_data);
|
1173
1198
|
|
1174
1199
|
if (!tree.HasMetadata()) {
|
@@ -1178,60 +1203,34 @@ void ART::Vacuum(IndexLock &state) {
|
|
1178
1203
|
return;
|
1179
1204
|
}
|
1180
1205
|
|
1181
|
-
//
|
1182
|
-
|
1183
|
-
InitializeVacuum(
|
1206
|
+
// True, if an allocator needs a vacuum, false otherwise.
|
1207
|
+
unordered_set<uint8_t> indexes;
|
1208
|
+
InitializeVacuum(indexes);
|
1184
1209
|
|
1185
|
-
//
|
1186
|
-
|
1187
|
-
for (const auto &vacuum_flag : flags.vacuum_flags) {
|
1188
|
-
if (vacuum_flag) {
|
1189
|
-
perform_vacuum = true;
|
1190
|
-
break;
|
1191
|
-
}
|
1192
|
-
}
|
1193
|
-
if (!perform_vacuum) {
|
1210
|
+
// Skip vacuum, if no allocators require it.
|
1211
|
+
if (indexes.empty()) {
|
1194
1212
|
return;
|
1195
1213
|
}
|
1196
1214
|
|
1197
|
-
//
|
1198
|
-
tree.Vacuum(*this,
|
1199
|
-
|
1200
|
-
// finalize the vacuum operation
|
1201
|
-
FinalizeVacuum(flags);
|
1202
|
-
}
|
1215
|
+
// Traverse the allocated memory of the tree to perform a vacuum.
|
1216
|
+
tree.Vacuum(*this, indexes);
|
1203
1217
|
|
1204
|
-
|
1205
|
-
|
1206
|
-
//===--------------------------------------------------------------------===//
|
1207
|
-
|
1208
|
-
idx_t ART::GetInMemorySize(IndexLock &index_lock) {
|
1209
|
-
|
1210
|
-
D_ASSERT(owns_data);
|
1211
|
-
|
1212
|
-
idx_t in_memory_size = 0;
|
1213
|
-
for (auto &allocator : *allocators) {
|
1214
|
-
in_memory_size += allocator->GetInMemorySize();
|
1215
|
-
}
|
1216
|
-
return in_memory_size;
|
1218
|
+
// Finalize the vacuum operation.
|
1219
|
+
FinalizeVacuum(indexes);
|
1217
1220
|
}
|
1218
1221
|
|
1219
1222
|
//===--------------------------------------------------------------------===//
|
1220
1223
|
// Merging
|
1221
1224
|
//===--------------------------------------------------------------------===//
|
1222
1225
|
|
1223
|
-
void ART::InitializeMerge(
|
1224
|
-
|
1226
|
+
void ART::InitializeMerge(unsafe_vector<idx_t> &upper_bounds) {
|
1225
1227
|
D_ASSERT(owns_data);
|
1226
|
-
|
1227
|
-
flags.merge_buffer_counts.reserve(allocators->size());
|
1228
1228
|
for (auto &allocator : *allocators) {
|
1229
|
-
|
1229
|
+
upper_bounds.emplace_back(allocator->GetUpperBoundBufferId());
|
1230
1230
|
}
|
1231
1231
|
}
|
1232
1232
|
|
1233
1233
|
bool ART::MergeIndexes(IndexLock &state, BoundIndex &other_index) {
|
1234
|
-
|
1235
1234
|
auto &other_art = other_index.Cast<ART>();
|
1236
1235
|
if (!other_art.tree.HasMetadata()) {
|
1237
1236
|
return true;
|
@@ -1239,33 +1238,31 @@ bool ART::MergeIndexes(IndexLock &state, BoundIndex &other_index) {
|
|
1239
1238
|
|
1240
1239
|
if (other_art.owns_data) {
|
1241
1240
|
if (tree.HasMetadata()) {
|
1242
|
-
//
|
1243
|
-
|
1244
|
-
InitializeMerge(
|
1245
|
-
other_art.tree.
|
1241
|
+
// Fully deserialize other_index, and traverse it to increment its buffer IDs.
|
1242
|
+
unsafe_vector<idx_t> upper_bounds;
|
1243
|
+
InitializeMerge(upper_bounds);
|
1244
|
+
other_art.tree.InitMerge(other_art, upper_bounds);
|
1246
1245
|
}
|
1247
1246
|
|
1248
|
-
//
|
1247
|
+
// Merge the node storage.
|
1249
1248
|
for (idx_t i = 0; i < allocators->size(); i++) {
|
1250
1249
|
(*allocators)[i]->Merge(*(*other_art.allocators)[i]);
|
1251
1250
|
}
|
1252
1251
|
}
|
1253
1252
|
|
1254
|
-
//
|
1255
|
-
|
1253
|
+
// Merge the ARTs.
|
1254
|
+
D_ASSERT(tree.GetGateStatus() == other_art.tree.GetGateStatus());
|
1255
|
+
if (!tree.Merge(*this, other_art.tree, tree.GetGateStatus())) {
|
1256
1256
|
return false;
|
1257
1257
|
}
|
1258
1258
|
return true;
|
1259
1259
|
}
|
1260
1260
|
|
1261
1261
|
//===--------------------------------------------------------------------===//
|
1262
|
-
//
|
1262
|
+
// Verification
|
1263
1263
|
//===--------------------------------------------------------------------===//
|
1264
1264
|
|
1265
1265
|
string ART::VerifyAndToString(IndexLock &state, const bool only_verify) {
|
1266
|
-
// FIXME: this can be improved by counting the allocations of each node type,
|
1267
|
-
// FIXME: and by asserting that each fixed-size allocator lists an equal number of
|
1268
|
-
// FIXME: allocations of that type
|
1269
1266
|
return VerifyAndToStringInternal(only_verify);
|
1270
1267
|
}
|
1271
1268
|
|
@@ -1276,10 +1273,26 @@ string ART::VerifyAndToStringInternal(const bool only_verify) {
|
|
1276
1273
|
return "[empty]";
|
1277
1274
|
}
|
1278
1275
|
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1276
|
+
void ART::VerifyAllocations(IndexLock &state) {
|
1277
|
+
return VerifyAllocationsInternal();
|
1278
|
+
}
|
1279
|
+
|
1280
|
+
void ART::VerifyAllocationsInternal() {
|
1281
|
+
#ifdef DEBUG
|
1282
|
+
unordered_map<uint8_t, idx_t> node_counts;
|
1283
|
+
for (idx_t i = 0; i < allocators->size(); i++) {
|
1284
|
+
node_counts[NumericCast<uint8_t>(i)] = 0;
|
1285
|
+
}
|
1286
|
+
|
1287
|
+
if (tree.HasMetadata()) {
|
1288
|
+
tree.VerifyAllocations(*this, node_counts);
|
1289
|
+
}
|
1290
|
+
|
1291
|
+
for (idx_t i = 0; i < allocators->size(); i++) {
|
1292
|
+
auto segment_count = (*allocators)[i]->GetSegmentCount();
|
1293
|
+
D_ASSERT(segment_count == node_counts[NumericCast<uint8_t>(i)]);
|
1294
|
+
}
|
1295
|
+
#endif
|
1283
1296
|
}
|
1284
1297
|
|
1285
1298
|
constexpr const char *ART::TYPE_NAME;
|