duckdb 0.9.3-dev2.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/workflows/NodeJS.yml +1 -1
- package/README.md +6 -6
- package/binding.gyp +32 -7
- package/package.json +1 -1
- package/src/connection.cpp +6 -6
- package/src/database.cpp +12 -10
- package/src/duckdb/extension/icu/icu-datefunc.cpp +22 -10
- package/src/duckdb/extension/icu/icu-datepart.cpp +42 -22
- package/src/duckdb/extension/icu/icu-datetrunc.cpp +40 -7
- package/src/duckdb/extension/icu/icu-strptime.cpp +14 -8
- package/src/duckdb/extension/icu/icu-table-range.cpp +1 -1
- package/src/duckdb/extension/icu/icu-timezone.cpp +43 -16
- package/src/duckdb/extension/icu/icu_extension.cpp +1 -1
- package/src/duckdb/extension/icu/include/icu-datefunc.hpp +3 -0
- package/src/duckdb/extension/icu/third_party/icu/stubdata/stubdata.cpp +1 -1
- package/src/duckdb/extension/json/buffered_json_reader.cpp +78 -62
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +11 -7
- package/src/duckdb/extension/json/include/json_common.hpp +0 -14
- package/src/duckdb/extension/json/include/json_deserializer.hpp +1 -0
- package/src/duckdb/extension/json/include/json_functions.hpp +1 -0
- package/src/duckdb/extension/json/include/json_scan.hpp +19 -5
- package/src/duckdb/extension/json/include/json_serializer.hpp +2 -1
- package/src/duckdb/extension/json/include/json_structure.hpp +12 -10
- package/src/duckdb/extension/json/json_common.cpp +1 -0
- package/src/duckdb/extension/json/json_deserializer.cpp +13 -0
- package/src/duckdb/extension/json/json_extension.cpp +3 -3
- package/src/duckdb/extension/json/json_functions/copy_json.cpp +8 -4
- package/src/duckdb/extension/json/json_functions/json_array_length.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_contains.cpp +3 -3
- package/src/duckdb/extension/json/json_functions/json_create.cpp +53 -8
- package/src/duckdb/extension/json/json_functions/json_extract.cpp +10 -6
- package/src/duckdb/extension/json/json_functions/json_keys.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +2 -3
- package/src/duckdb/extension/json/json_functions/json_serialize_plan.cpp +210 -0
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +22 -19
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +71 -43
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +105 -8
- package/src/duckdb/extension/json/json_functions/json_type.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_valid.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/read_json.cpp +43 -18
- package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +1 -1
- package/src/duckdb/extension/json/json_functions.cpp +9 -5
- package/src/duckdb/extension/json/json_scan.cpp +147 -125
- package/src/duckdb/extension/json/json_serializer.cpp +9 -0
- package/src/duckdb/extension/json/serialize_json.cpp +6 -0
- package/src/duckdb/extension/parquet/column_reader.cpp +53 -18
- package/src/duckdb/extension/parquet/column_writer.cpp +29 -6
- package/src/duckdb/extension/parquet/include/column_reader.hpp +0 -1
- package/src/duckdb/extension/parquet/include/decode_utils.hpp +2 -2
- package/src/duckdb/extension/parquet/include/parquet_crypto.hpp +87 -0
- package/src/duckdb/extension/parquet/include/parquet_dbp_decoder.hpp +4 -3
- package/src/duckdb/extension/parquet/include/parquet_decimal_utils.hpp +16 -3
- package/src/duckdb/extension/parquet/include/parquet_metadata.hpp +10 -0
- package/src/duckdb/extension/parquet/include/parquet_reader.hpp +34 -6
- package/src/duckdb/extension/parquet/include/parquet_statistics.hpp +3 -2
- package/src/duckdb/extension/parquet/include/parquet_timestamp.hpp +2 -0
- package/src/duckdb/extension/parquet/include/parquet_writer.hpp +21 -1
- package/src/duckdb/extension/parquet/parquet_crypto.cpp +370 -0
- package/src/duckdb/extension/parquet/parquet_extension.cpp +254 -24
- package/src/duckdb/extension/parquet/parquet_metadata.cpp +204 -16
- package/src/duckdb/extension/parquet/parquet_reader.cpp +108 -34
- package/src/duckdb/extension/parquet/parquet_statistics.cpp +75 -30
- package/src/duckdb/extension/parquet/parquet_timestamp.cpp +15 -8
- package/src/duckdb/extension/parquet/parquet_writer.cpp +62 -10
- package/src/duckdb/extension/parquet/serialize_parquet.cpp +60 -0
- package/src/duckdb/src/catalog/catalog.cpp +23 -25
- package/src/duckdb/src/catalog/catalog_entry/column_dependency_manager.cpp +1 -0
- package/src/duckdb/src/catalog/catalog_entry/dependency/dependency_dependent_entry.cpp +31 -0
- package/src/duckdb/src/catalog/catalog_entry/dependency/dependency_entry.cpp +44 -0
- package/src/duckdb/src/catalog/catalog_entry/dependency/dependency_subject_entry.cpp +31 -0
- package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +35 -10
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +22 -6
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +110 -33
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +33 -17
- package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +16 -0
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +7 -6
- package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +88 -14
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +6 -15
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +20 -20
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +4 -0
- package/src/duckdb/src/catalog/catalog_entry.cpp +29 -0
- package/src/duckdb/src/catalog/catalog_set.cpp +358 -343
- package/src/duckdb/src/catalog/catalog_transaction.cpp +4 -0
- package/src/duckdb/src/catalog/default/default_functions.cpp +13 -4
- package/src/duckdb/src/catalog/default/default_schemas.cpp +5 -1
- package/src/duckdb/src/catalog/default/default_views.cpp +6 -2
- package/src/duckdb/src/catalog/dependency_catalog_set.cpp +51 -0
- package/src/duckdb/src/catalog/dependency_manager.cpp +510 -114
- package/src/duckdb/src/catalog/duck_catalog.cpp +4 -4
- package/src/duckdb/src/common/adbc/adbc.cpp +73 -53
- package/src/duckdb/src/common/adbc/driver_manager.cpp +1101 -268
- package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +20 -9
- package/src/duckdb/src/common/bind_helpers.cpp +1 -0
- package/src/duckdb/src/common/box_renderer.cpp +52 -1
- package/src/duckdb/src/common/compressed_file_system.cpp +1 -0
- package/src/duckdb/src/common/constants.cpp +0 -1
- package/src/duckdb/src/common/enum_util.cpp +522 -107
- package/src/duckdb/src/common/enums/catalog_type.cpp +64 -1
- package/src/duckdb/src/common/enums/compression_type.cpp +14 -0
- package/src/duckdb/src/common/enums/date_part_specifier.cpp +1 -0
- package/src/duckdb/src/common/enums/expression_type.cpp +4 -0
- package/src/duckdb/src/common/enums/file_compression_type.cpp +1 -0
- package/src/duckdb/src/common/enums/join_type.cpp +33 -0
- package/src/duckdb/src/common/enums/logical_operator_type.cpp +5 -3
- package/src/duckdb/src/common/enums/optimizer_type.cpp +9 -1
- package/src/duckdb/src/common/enums/physical_operator_type.cpp +8 -4
- package/src/duckdb/src/common/enums/statement_type.cpp +2 -2
- package/src/duckdb/src/common/error_data.cpp +113 -0
- package/src/duckdb/src/common/exception/binder_exception.cpp +47 -0
- package/src/duckdb/src/common/exception/catalog_exception.cpp +55 -0
- package/src/duckdb/src/common/exception/parser_exception.cpp +19 -0
- package/src/duckdb/src/common/exception.cpp +110 -121
- package/src/duckdb/src/common/exception_format_value.cpp +9 -1
- package/src/duckdb/src/common/extra_type_info.cpp +48 -0
- package/src/duckdb/src/common/file_system.cpp +12 -7
- package/src/duckdb/src/common/gzip_file_system.cpp +18 -18
- package/src/duckdb/src/common/hive_partitioning.cpp +5 -1
- package/src/duckdb/src/common/http_state.cpp +20 -3
- package/src/duckdb/src/common/local_file_system.cpp +214 -15
- package/src/duckdb/src/common/multi_file_reader.cpp +20 -7
- package/src/duckdb/src/common/operator/cast_operators.cpp +397 -414
- package/src/duckdb/src/common/operator/convert_to_string.cpp +4 -0
- package/src/duckdb/src/common/operator/string_cast.cpp +5 -0
- package/src/duckdb/src/common/progress_bar/progress_bar.cpp +61 -12
- package/src/duckdb/src/common/progress_bar/terminal_progress_bar_display.cpp +13 -4
- package/src/duckdb/src/common/radix_partitioning.cpp +1 -1
- package/src/duckdb/src/common/row_operations/row_aggregate.cpp +2 -1
- package/src/duckdb/src/common/row_operations/row_gather.cpp +7 -1
- package/src/duckdb/src/common/row_operations/row_heap_gather.cpp +78 -12
- package/src/duckdb/src/common/row_operations/row_heap_scatter.cpp +222 -61
- package/src/duckdb/src/common/row_operations/row_matcher.cpp +6 -1
- package/src/duckdb/src/common/row_operations/row_radix_scatter.cpp +51 -0
- package/src/duckdb/src/common/row_operations/row_scatter.cpp +8 -1
- package/src/duckdb/src/common/serializer/binary_deserializer.cpp +6 -0
- package/src/duckdb/src/common/serializer/binary_serializer.cpp +5 -0
- package/src/duckdb/src/common/serializer/serializer.cpp +19 -0
- package/src/duckdb/src/common/sort/comparators.cpp +126 -0
- package/src/duckdb/src/common/sort/partition_state.cpp +17 -17
- package/src/duckdb/src/common/sort/radix_sort.cpp +2 -1
- package/src/duckdb/src/common/sort/sort_state.cpp +10 -5
- package/src/duckdb/src/common/sort/sorted_block.cpp +7 -6
- package/src/duckdb/src/common/string_util.cpp +302 -24
- package/src/duckdb/src/common/tree_renderer.cpp +8 -6
- package/src/duckdb/src/common/types/cast_helpers.cpp +6 -0
- package/src/duckdb/src/common/types/column/column_data_allocator.cpp +1 -1
- package/src/duckdb/src/common/types/column/column_data_collection.cpp +58 -0
- package/src/duckdb/src/common/types/column/column_data_collection_segment.cpp +8 -1
- package/src/duckdb/src/common/types/data_chunk.cpp +9 -0
- package/src/duckdb/src/common/types/date.cpp +2 -2
- package/src/duckdb/src/common/types/hash.cpp +9 -1
- package/src/duckdb/src/common/types/hugeint.cpp +229 -51
- package/src/duckdb/src/common/types/hyperloglog.cpp +10 -3
- package/src/duckdb/src/common/types/interval.cpp +67 -12
- package/src/duckdb/src/common/types/list_segment.cpp +98 -4
- package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +11 -1
- package/src/duckdb/src/common/types/row/row_data_collection.cpp +1 -1
- package/src/duckdb/src/common/types/row/row_data_collection_scanner.cpp +2 -2
- package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +3 -2
- package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +63 -3
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +331 -127
- package/src/duckdb/src/common/types/time.cpp +47 -75
- package/src/duckdb/src/common/types/timestamp.cpp +16 -3
- package/src/duckdb/src/common/types/uhugeint.cpp +746 -0
- package/src/duckdb/src/common/types/validity_mask.cpp +6 -2
- package/src/duckdb/src/common/types/value.cpp +183 -27
- package/src/duckdb/src/common/types/vector.cpp +331 -30
- package/src/duckdb/src/common/types/vector_buffer.cpp +29 -1
- package/src/duckdb/src/common/types/vector_cache.cpp +22 -1
- package/src/duckdb/src/common/types.cpp +606 -90
- package/src/duckdb/src/common/value_operations/comparison_operations.cpp +21 -1
- package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +5 -0
- package/src/duckdb/src/common/vector_operations/generators.cpp +2 -2
- package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +131 -2
- package/src/duckdb/src/common/vector_operations/vector_copy.cpp +26 -4
- package/src/duckdb/src/common/vector_operations/vector_hash.cpp +41 -0
- package/src/duckdb/src/common/vector_operations/vector_storage.cpp +7 -0
- package/src/duckdb/src/common/virtual_file_system.cpp +0 -1
- package/src/duckdb/src/core_functions/aggregate/distributive/approx_count.cpp +2 -1
- package/src/duckdb/src/core_functions/aggregate/distributive/arg_min_max.cpp +144 -56
- package/src/duckdb/src/core_functions/aggregate/distributive/bitagg.cpp +2 -0
- package/src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp +27 -0
- package/src/duckdb/src/core_functions/aggregate/distributive/entropy.cpp +4 -3
- package/src/duckdb/src/core_functions/aggregate/distributive/kurtosis.cpp +25 -5
- package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +100 -3
- package/src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp +2 -1
- package/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp +9 -1
- package/src/duckdb/src/core_functions/aggregate/holistic/mode.cpp +83 -52
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +485 -289
- package/src/duckdb/src/core_functions/aggregate/holistic/reservoir_quantile.cpp +3 -3
- package/src/duckdb/src/core_functions/aggregate/nested/histogram.cpp +24 -26
- package/src/duckdb/src/core_functions/aggregate/nested/list.cpp +34 -37
- package/src/duckdb/src/core_functions/function_list.cpp +30 -1
- package/src/duckdb/src/core_functions/lambda_functions.cpp +416 -0
- package/src/duckdb/src/core_functions/scalar/array/array_functions.cpp +294 -0
- package/src/duckdb/src/core_functions/scalar/array/array_value.cpp +87 -0
- package/src/duckdb/src/core_functions/scalar/blob/create_sort_key.cpp +686 -0
- package/src/duckdb/src/core_functions/scalar/blob/encode.cpp +1 -0
- package/src/duckdb/src/core_functions/scalar/date/current.cpp +3 -3
- package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +295 -20
- package/src/duckdb/src/core_functions/scalar/date/make_date.cpp +1 -0
- package/src/duckdb/src/core_functions/scalar/date/strftime.cpp +8 -7
- package/src/duckdb/src/core_functions/scalar/date/to_interval.cpp +84 -23
- package/src/duckdb/src/core_functions/scalar/generic/error.cpp +4 -4
- package/src/duckdb/src/core_functions/scalar/generic/least.cpp +7 -8
- package/src/duckdb/src/core_functions/scalar/generic/stats.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/generic/system_functions.cpp +17 -6
- package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +8 -0
- package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +28 -14
- package/src/duckdb/src/core_functions/scalar/list/list_filter.cpp +49 -0
- package/src/duckdb/src/core_functions/scalar/list/list_reduce.cpp +230 -0
- package/src/duckdb/src/core_functions/scalar/list/list_sort.cpp +85 -16
- package/src/duckdb/src/core_functions/scalar/list/list_transform.cpp +41 -0
- package/src/duckdb/src/core_functions/scalar/list/list_value.cpp +21 -2
- package/src/duckdb/src/core_functions/scalar/map/map.cpp +6 -5
- package/src/duckdb/src/core_functions/scalar/map/map_entries.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/map/map_from_entries.cpp +1 -2
- package/src/duckdb/src/core_functions/scalar/math/numeric.cpp +24 -4
- package/src/duckdb/src/core_functions/scalar/operators/bitwise.cpp +6 -0
- package/src/duckdb/src/core_functions/scalar/random/random.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/random/setseed.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/secret/which_secret.cpp +28 -0
- package/src/duckdb/src/core_functions/scalar/string/bar.cpp +9 -4
- package/src/duckdb/src/core_functions/scalar/string/format_bytes.cpp +7 -2
- package/src/duckdb/src/core_functions/scalar/string/hex.cpp +63 -4
- package/src/duckdb/src/core_functions/scalar/string/pad.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/string/parse_path.cpp +348 -0
- package/src/duckdb/src/core_functions/scalar/string/regexp_escape.cpp +22 -0
- package/src/duckdb/src/core_functions/scalar/string/string_split.cpp +6 -5
- package/src/duckdb/src/core_functions/scalar/struct/struct_insert.cpp +3 -3
- package/src/duckdb/src/core_functions/scalar/struct/struct_pack.cpp +1 -1
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +9 -2
- package/src/duckdb/src/execution/column_binding_resolver.cpp +44 -10
- package/src/duckdb/src/execution/expression_executor/execute_between.cpp +4 -0
- package/src/duckdb/src/execution/expression_executor/execute_case.cpp +4 -0
- package/src/duckdb/src/execution/expression_executor/execute_comparison.cpp +4 -0
- package/src/duckdb/src/execution/expression_executor.cpp +2 -1
- package/src/duckdb/src/execution/index/art/art.cpp +202 -53
- package/src/duckdb/src/execution/index/art/art_key.cpp +20 -27
- package/src/duckdb/src/execution/index/fixed_size_allocator.cpp +52 -17
- package/src/duckdb/src/execution/index/fixed_size_buffer.cpp +14 -8
- package/src/duckdb/src/execution/index/index_type_set.cpp +32 -0
- package/src/duckdb/src/execution/index/unknown_index.cpp +65 -0
- package/src/duckdb/src/execution/join_hashtable.cpp +151 -174
- package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_inner.cpp +4 -0
- package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_mark.cpp +4 -0
- package/src/duckdb/src/execution/operator/aggregate/aggregate_object.cpp +2 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +82 -36
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +58 -32
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +35 -19
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer.cpp +90 -0
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.cpp +124 -0
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_file_handle.cpp +97 -0
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/base_scanner.cpp +71 -0
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/column_count_scanner.cpp +98 -0
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/scanner_boundary.cpp +105 -0
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/skip_scanner.cpp +63 -0
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +1091 -0
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +124 -26
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +117 -129
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +46 -22
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +83 -199
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_refinement.cpp +21 -122
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_replacement.cpp +18 -17
- package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine.cpp +22 -0
- package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.cpp +201 -0
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_file_scanner.cpp +221 -0
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/global_csv_state.cpp +204 -0
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_error.cpp +186 -0
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +532 -0
- package/src/duckdb/src/execution/operator/helper/physical_buffered_collector.cpp +85 -0
- package/src/duckdb/src/execution/operator/helper/physical_create_secret.cpp +21 -0
- package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +1 -1
- package/src/duckdb/src/execution/operator/helper/physical_pragma.cpp +2 -2
- package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +34 -9
- package/src/duckdb/src/execution/operator/helper/physical_result_collector.cpp +10 -0
- package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +1 -0
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +25 -10
- package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +7 -8
- 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 -2
- package/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +5 -127
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +221 -61
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +18 -21
- package/src/duckdb/src/execution/operator/join/physical_join.cpp +10 -5
- package/src/duckdb/src/execution/operator/join/physical_left_delim_join.cpp +137 -0
- package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +11 -4
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +2 -2
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +19 -4
- package/src/duckdb/src/execution/operator/join/physical_right_delim_join.cpp +121 -0
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +3 -2
- package/src/duckdb/src/execution/operator/persistent/physical_copy_database.cpp +59 -0
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +132 -92
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +54 -54
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +1 -1
- package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +4 -0
- package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +21 -3
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +1 -0
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +61 -43
- package/src/duckdb/src/execution/operator/schema/physical_create_art_index.cpp +15 -13
- package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +1 -0
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +10 -0
- package/src/duckdb/src/execution/operator/set/physical_cte.cpp +44 -90
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +3 -0
- package/src/duckdb/src/execution/operator/set/physical_union.cpp +8 -4
- package/src/duckdb/src/execution/physical_operator.cpp +3 -1
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +30 -143
- package/src/duckdb/src/execution/physical_plan/plan_copy_database.cpp +12 -0
- package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +11 -4
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +8 -8
- package/src/duckdb/src/execution/physical_plan/plan_create_secret.cpp +11 -0
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +9 -8
- package/src/duckdb/src/execution/physical_plan/plan_cte.cpp +5 -3
- package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +15 -6
- package/src/duckdb/src/execution/physical_plan/plan_positional_join.cpp +1 -0
- package/src/duckdb/src/execution/physical_plan/plan_pragma.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp +3 -1
- package/src/duckdb/src/execution/physical_plan/plan_set_operation.cpp +90 -12
- package/src/duckdb/src/execution/physical_plan/plan_window.cpp +67 -22
- package/src/duckdb/src/execution/physical_plan_generator.cpp +6 -3
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +163 -32
- package/src/duckdb/src/execution/reservoir_sample.cpp +112 -32
- package/src/duckdb/src/execution/window_executor.cpp +291 -26
- package/src/duckdb/src/execution/window_segment_tree.cpp +958 -114
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +18 -16
- package/src/duckdb/src/function/aggregate/distributive/first.cpp +11 -4
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +303 -131
- package/src/duckdb/src/function/cast/array_casts.cpp +226 -0
- package/src/duckdb/src/function/cast/bit_cast.cpp +2 -0
- package/src/duckdb/src/function/cast/cast_function_set.cpp +13 -2
- package/src/duckdb/src/function/cast/decimal_cast.cpp +2 -0
- package/src/duckdb/src/function/cast/default_casts.cpp +4 -1
- package/src/duckdb/src/function/cast/list_casts.cpp +151 -6
- package/src/duckdb/src/function/cast/numeric_casts.cpp +4 -0
- package/src/duckdb/src/function/cast/string_cast.cpp +95 -5
- package/src/duckdb/src/function/cast/struct_cast.cpp +53 -19
- package/src/duckdb/src/function/cast/time_casts.cpp +23 -1
- package/src/duckdb/src/function/cast/union/from_struct.cpp +1 -0
- package/src/duckdb/src/function/cast/union_casts.cpp +4 -3
- package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +8 -4
- package/src/duckdb/src/function/cast_rules.cpp +197 -31
- package/src/duckdb/src/function/compression_config.cpp +4 -0
- package/src/duckdb/src/function/function.cpp +15 -9
- package/src/duckdb/src/function/function_binder.cpp +80 -29
- package/src/duckdb/src/function/function_set.cpp +6 -6
- package/src/duckdb/src/function/pragma/pragma_functions.cpp +10 -8
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +34 -38
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_integral.cpp +12 -0
- package/src/duckdb/src/function/scalar/list/contains_or_position.cpp +10 -1
- package/src/duckdb/src/function/scalar/list/list_concat.cpp +11 -1
- package/src/duckdb/src/function/scalar/list/list_extract.cpp +14 -3
- package/src/duckdb/src/function/scalar/list/list_resize.cpp +4 -0
- package/src/duckdb/src/function/scalar/list/list_select.cpp +176 -0
- package/src/duckdb/src/function/scalar/list/list_zip.cpp +165 -0
- package/src/duckdb/src/function/scalar/nested_functions.cpp +33 -0
- package/src/duckdb/src/function/scalar/operators/add.cpp +53 -6
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +48 -14
- package/src/duckdb/src/function/scalar/operators/multiply.cpp +9 -1
- package/src/duckdb/src/function/scalar/operators/subtract.cpp +19 -4
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +28 -55
- package/src/duckdb/src/function/scalar/strftime_format.cpp +242 -19
- package/src/duckdb/src/function/scalar/string/caseconvert.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/concat.cpp +16 -6
- package/src/duckdb/src/function/scalar/string/length.cpp +124 -24
- package/src/duckdb/src/function/scalar/string/regexp.cpp +27 -27
- package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +64 -15
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +4 -3
- package/src/duckdb/src/function/scalar_function.cpp +8 -7
- package/src/duckdb/src/function/table/arrow/arrow_duck_schema.cpp +12 -0
- package/src/duckdb/src/function/table/arrow.cpp +20 -27
- package/src/duckdb/src/function/table/arrow_conversion.cpp +433 -150
- package/src/duckdb/src/function/table/copy_csv.cpp +62 -62
- package/src/duckdb/src/function/table/range.cpp +6 -3
- package/src/duckdb/src/function/table/read_csv.cpp +107 -759
- package/src/duckdb/src/function/table/read_file.cpp +242 -0
- package/src/duckdb/src/function/table/sniff_csv.cpp +275 -0
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +15 -3
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +5 -0
- package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +9 -13
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +67 -14
- package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +12 -15
- package/src/duckdb/src/function/table/system/duckdb_memory.cpp +63 -0
- package/src/duckdb/src/function/table/system/duckdb_optimizers.cpp +57 -0
- package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +5 -0
- package/src/duckdb/src/function/table/system/duckdb_secrets.cpp +128 -0
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +12 -6
- package/src/duckdb/src/function/table/system/duckdb_settings.cpp +0 -1
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +5 -0
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +6 -0
- package/src/duckdb/src/function/table/system/duckdb_views.cpp +5 -0
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +166 -64
- package/src/duckdb/src/function/table/system/test_all_types.cpp +2 -1
- package/src/duckdb/src/function/table/system_functions.cpp +3 -2
- package/src/duckdb/src/function/table/table_scan.cpp +50 -110
- package/src/duckdb/src/function/table/version/pragma_version.cpp +4 -44
- package/src/duckdb/src/function/table_function.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +4 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/dependency/dependency_dependent_entry.hpp +27 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/dependency/dependency_entry.hpp +66 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/dependency/dependency_subject_entry.hpp +27 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +25 -5
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +3 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +2 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +19 -5
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +2 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +26 -11
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +1 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +2 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +1 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +2 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +15 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +41 -49
- package/src/duckdb/src/include/duckdb/catalog/catalog_transaction.hpp +1 -0
- package/src/duckdb/src/include/duckdb/catalog/default/builtin_types/types.hpp +3 -1
- package/src/duckdb/src/include/duckdb/catalog/dependency.hpp +120 -8
- package/src/duckdb/src/include/duckdb/catalog/dependency_catalog_set.hpp +32 -0
- package/src/duckdb/src/include/duckdb/catalog/dependency_list.hpp +2 -0
- package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +92 -12
- package/src/duckdb/src/include/duckdb/catalog/standard_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/adbc/adbc-init.hpp +4 -2
- package/src/duckdb/src/include/duckdb/common/adbc/adbc.h +1153 -12
- package/src/duckdb/src/include/duckdb/common/adbc/adbc.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/adbc/driver_manager.h +0 -2
- package/src/duckdb/src/include/duckdb/common/adbc/options.h +64 -0
- package/src/duckdb/src/include/duckdb/common/adbc/single_batch_array_stream.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/arrow/arrow.hpp +25 -6
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_wrapper.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/arrow/result_arrow_wrapper.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/bit_utils.hpp +30 -0
- package/src/duckdb/src/include/duckdb/common/bitpacking.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/case_insensitive_map.hpp +10 -0
- package/src/duckdb/src/include/duckdb/common/constants.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +75 -19
- package/src/duckdb/src/include/duckdb/common/enums/catalog_type.hpp +11 -1
- package/src/duckdb/src/include/duckdb/common/enums/compression_type.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enums/index_constraint_type.hpp +35 -0
- package/src/duckdb/src/include/duckdb/common/enums/join_type.hpp +16 -3
- package/src/duckdb/src/include/duckdb/common/enums/logical_operator_type.hpp +6 -5
- package/src/duckdb/src/include/duckdb/common/enums/memory_tag.hpp +32 -0
- package/src/duckdb/src/include/duckdb/common/enums/on_create_conflict.hpp +26 -0
- package/src/duckdb/src/include/duckdb/common/enums/optimizer_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enums/pending_execution_result.hpp +7 -1
- package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +9 -3
- package/src/duckdb/src/include/duckdb/common/enums/statement_type.hpp +6 -5
- package/src/duckdb/src/include/duckdb/common/enums/tableref_type.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/enums/wal_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/error_data.hpp +72 -0
- package/src/duckdb/src/include/duckdb/common/exception/binder_exception.hpp +47 -0
- package/src/duckdb/src/include/duckdb/common/exception/catalog_exception.hpp +39 -0
- package/src/duckdb/src/include/duckdb/common/exception/conversion_exception.hpp +27 -0
- package/src/duckdb/src/include/duckdb/common/exception/http_exception.hpp +62 -0
- package/src/duckdb/src/include/duckdb/common/exception/list.hpp +6 -0
- package/src/duckdb/src/include/duckdb/common/exception/parser_exception.hpp +29 -0
- package/src/duckdb/src/include/duckdb/common/exception/transaction_exception.hpp +25 -0
- package/src/duckdb/src/include/duckdb/common/exception.hpp +52 -166
- package/src/duckdb/src/include/duckdb/common/exception_format_value.hpp +7 -4
- package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +53 -1
- package/src/duckdb/src/include/duckdb/common/helper.hpp +13 -3
- package/src/duckdb/src/include/duckdb/common/http_state.hpp +18 -4
- package/src/duckdb/src/include/duckdb/common/hugeint.hpp +5 -1
- package/src/duckdb/src/include/duckdb/common/limits.hpp +19 -1
- package/src/duckdb/src/include/duckdb/common/local_file_system.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +7 -2
- package/src/duckdb/src/include/duckdb/common/numeric_utils.hpp +16 -3
- package/src/duckdb/src/include/duckdb/common/operator/add.hpp +13 -2
- package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +114 -5
- package/src/duckdb/src/include/duckdb/common/operator/comparison_operators.hpp +0 -4
- package/src/duckdb/src/include/duckdb/common/operator/convert_to_string.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/operator/decimal_cast_operators.hpp +29 -0
- package/src/duckdb/src/include/duckdb/common/operator/double_cast_operator.hpp +52 -0
- package/src/duckdb/src/include/duckdb/common/operator/integer_cast_operator.hpp +459 -0
- package/src/duckdb/src/include/duckdb/common/operator/multiply.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/operator/numeric_cast.hpp +136 -0
- package/src/duckdb/src/include/duckdb/common/operator/string_cast.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/operator/subtract.hpp +7 -1
- package/src/duckdb/src/include/duckdb/common/optional_idx.hpp +7 -5
- package/src/duckdb/src/include/duckdb/common/platform.h +53 -0
- package/src/duckdb/src/include/duckdb/common/progress_bar/display/terminal_progress_bar_display.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/progress_bar/progress_bar.hpp +22 -6
- package/src/duckdb/src/include/duckdb/common/radix.hpp +6 -0
- package/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp +20 -6
- package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/serializer/deserializer.hpp +43 -4
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/serializer/serializer.hpp +15 -0
- package/src/duckdb/src/include/duckdb/common/sort/comparators.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/sort/partition_state.hpp +12 -2
- package/src/duckdb/src/include/duckdb/common/sort/sort.hpp +81 -0
- package/src/duckdb/src/include/duckdb/common/sort/sorted_block.hpp +0 -78
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +23 -1
- package/src/duckdb/src/include/duckdb/common/type_util.hpp +5 -1
- package/src/duckdb/src/include/duckdb/common/types/cast_helpers.hpp +26 -3
- package/src/duckdb/src/include/duckdb/common/types/conflict_manager.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/types/date.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/types/datetime.hpp +5 -3
- package/src/duckdb/src/include/duckdb/common/types/hash.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/types/hugeint.hpp +81 -15
- package/src/duckdb/src/include/duckdb/common/types/interval.hpp +57 -29
- package/src/duckdb/src/include/duckdb/common/types/list_segment.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +4 -2
- package/src/duckdb/src/include/duckdb/common/types/row/row_data_collection.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +26 -22
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_states.hpp +7 -0
- package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +7 -5
- package/src/duckdb/src/include/duckdb/common/types/time.hpp +6 -2
- package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/types/uhugeint.hpp +216 -0
- package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +18 -10
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +31 -0
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +18 -2
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +22 -1
- package/src/duckdb/src/include/duckdb/common/types.hpp +151 -49
- package/src/duckdb/src/include/duckdb/common/uhugeint.hpp +81 -0
- package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +70 -6
- package/src/duckdb/src/include/duckdb/common/vector_size.hpp +6 -6
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/distributive_functions.hpp +29 -2
- package/src/duckdb/src/include/duckdb/core_functions/lambda_functions.hpp +131 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/array_functions.hpp +69 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/blob_functions.hpp +9 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/date_functions.hpp +40 -4
- package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +42 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/secret_functions.hpp +27 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +56 -2
- package/src/duckdb/src/include/duckdb/core_functions/to_interval.hpp +29 -0
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +11 -13
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +34 -19
- package/src/duckdb/src/include/duckdb/execution/index/fixed_size_allocator.hpp +18 -14
- package/src/duckdb/src/include/duckdb/execution/index/fixed_size_buffer.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/index/index_type.hpp +57 -0
- package/src/duckdb/src/include/duckdb/execution/index/index_type_set.hpp +29 -0
- package/src/duckdb/src/include/duckdb/execution/index/unknown_index.hpp +65 -0
- package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +35 -24
- package/src/duckdb/src/include/duckdb/execution/merge_sort_tree.hpp +630 -0
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/buffer_manager/csv_buffer.hpp +103 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.hpp +74 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/buffer_manager/csv_file_handle.hpp +60 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/options/csv_option.hpp +155 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/options/csv_reader_options.hpp +163 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/options/state_machine_options.hpp +35 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/base_scanner.hpp +228 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/column_count_scanner.hpp +70 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/scanner_boundary.hpp +93 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/skip_scanner.hpp +60 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/scanner/string_value_scanner.hpp +197 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/csv_sniffer.hpp +189 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/quote_rules.hpp +21 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine/csv_state.hpp +30 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine/csv_state_machine.hpp +99 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.hpp +87 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/table_function/csv_file_scanner.hpp +70 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/table_function/global_csv_state.hpp +80 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/util/csv_casting.hpp +137 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/util/csv_error.hpp +104 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +0 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_buffered_collector.hpp +37 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_create_secret.hpp +38 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +4 -7
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +6 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +5 -18
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +14 -5
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_join.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_left_delim_join.hpp +37 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_range_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_right_delim_join.hpp +37 -0
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +0 -1
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +0 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_database.hpp +35 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +8 -3
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +14 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +1 -4
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_expression_scan.hpp +0 -1
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_cte.hpp +17 -12
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +4 -0
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_union.hpp +3 -1
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +6 -2
- package/src/duckdb/src/include/duckdb/execution/radix_partitioned_hashtable.hpp +3 -1
- package/src/duckdb/src/include/duckdb/execution/reservoir_sample.hpp +32 -18
- package/src/duckdb/src/include/duckdb/execution/task_error_manager.hpp +57 -0
- package/src/duckdb/src/include/duckdb/execution/window_executor.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +101 -19
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +46 -14
- package/src/duckdb/src/include/duckdb/function/aggregate_state.hpp +6 -2
- package/src/duckdb/src/include/duckdb/function/built_in_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/cast/bound_cast_data.hpp +26 -1
- package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +3 -0
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +7 -1
- package/src/duckdb/src/include/duckdb/function/compression/compression.hpp +10 -0
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +16 -4
- package/src/duckdb/src/include/duckdb/function/function.hpp +12 -7
- package/src/duckdb/src/include/duckdb/function/function_binder.hpp +15 -12
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +4 -3
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/pragma/pragma_functions.hpp +4 -1
- package/src/duckdb/src/include/duckdb/function/scalar/list/contains_or_position.hpp +3 -0
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +21 -1
- package/src/duckdb/src/include/duckdb/function/scalar/sequence_functions.hpp +22 -0
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +16 -2
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +22 -8
- package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_duck_schema.hpp +6 -0
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +35 -3
- package/src/duckdb/src/include/duckdb/function/table/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/table/range.hpp +12 -0
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +14 -16
- package/src/duckdb/src/include/duckdb/function/table/system_functions.hpp +12 -8
- package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +0 -2
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +8 -3
- package/src/duckdb/src/include/duckdb/main/appender.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +3 -2
- package/src/duckdb/src/include/duckdb/main/buffered_data/buffered_data.hpp +89 -0
- package/src/duckdb/src/include/duckdb/main/buffered_data/simple_buffered_data.hpp +53 -0
- package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/capi/cast/generic.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/chunk_scan_state/query_result.hpp +4 -4
- package/src/duckdb/src/include/duckdb/main/chunk_scan_state.hpp +3 -3
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +8 -10
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +22 -23
- package/src/duckdb/src/include/duckdb/main/client_context_state.hpp +37 -0
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +1 -7
- package/src/duckdb/src/include/duckdb/main/config.hpp +24 -7
- package/src/duckdb/src/include/duckdb/main/connection.hpp +8 -1
- package/src/duckdb/src/include/duckdb/main/connection_manager.hpp +17 -26
- package/src/duckdb/src/include/duckdb/main/database.hpp +4 -2
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +39 -7
- package/src/duckdb/src/include/duckdb/main/database_path_and_type.hpp +5 -4
- package/src/duckdb/src/include/duckdb/main/error_manager.hpp +4 -1
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +203 -197
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +42 -16
- package/src/duckdb/src/include/duckdb/main/extension_util.hpp +8 -1
- package/src/duckdb/src/include/duckdb/main/materialized_query_result.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/pending_query_result.hpp +5 -2
- package/src/duckdb/src/include/duckdb/main/prepared_statement.hpp +4 -4
- package/src/duckdb/src/include/duckdb/main/prepared_statement_data.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +0 -32
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +13 -12
- package/src/duckdb/src/include/duckdb/main/relation/read_csv_relation.hpp +6 -6
- package/src/duckdb/src/include/duckdb/main/relation/setop_relation.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/secret/secret.hpp +206 -0
- package/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp +211 -0
- package/src/duckdb/src/include/duckdb/main/secret/secret_storage.hpp +164 -0
- package/src/duckdb/src/include/duckdb/main/settings.hpp +52 -13
- package/src/duckdb/src/include/duckdb/main/stream_query_result.hpp +9 -1
- package/src/duckdb/src/include/duckdb/optimizer/deliminator.hpp +4 -1
- package/src/duckdb/src/include/duckdb/optimizer/filter_pushdown.hpp +2 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_node.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_relation.hpp +2 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph_manager.hpp +3 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/relation_statistics_helper.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parallel/event.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parallel/meta_pipeline.hpp +14 -22
- package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +20 -0
- package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +3 -5
- package/src/duckdb/src/include/duckdb/parallel/task.hpp +7 -0
- package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +10 -4
- package/src/duckdb/src/include/duckdb/parser/base_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/column_definition.hpp +8 -1
- package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +11 -4
- package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +16 -9
- package/src/duckdb/src/include/duckdb/parser/expression/lambdaref_expression.hpp +47 -0
- package/src/duckdb/src/include/duckdb/parser/expression/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +29 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +47 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/bound_pragma_info.hpp +29 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/comment_on_info.hpp +45 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +21 -22
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +5 -11
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_schema_info.hpp +23 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_secret_info.hpp +47 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +3 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +4 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +6 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/extra_drop_info.hpp +66 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +3 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/pragma_info.hpp +8 -4
- package/src/duckdb/src/include/duckdb/parser/parsed_expression.hpp +1 -3
- package/src/duckdb/src/include/duckdb/parser/parser_extension.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/qualified_name.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/query_error_context.hpp +5 -22
- package/src/duckdb/src/include/duckdb/parser/query_node/set_operation_node.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/statement/copy_database_statement.hpp +40 -0
- package/src/duckdb/src/include/duckdb/parser/statement/list.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/statement/set_statement.hpp +4 -3
- package/src/duckdb/src/include/duckdb/parser/tableref/emptytableref.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/tableref/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/showref.hpp +47 -0
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/tokens.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +20 -3
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +5 -1
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +24 -27
- package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +4 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_function_expression.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +4 -2
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +5 -6
- package/src/duckdb/src/include/duckdb/planner/expression/bound_window_expression.hpp +11 -0
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/column_alias_binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/index_binder.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/order_binder.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +65 -22
- package/src/duckdb/src/include/duckdb/planner/filter/struct_filter.hpp +41 -0
- package/src/duckdb/src/include/duckdb/planner/logical_tokens.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_database.hpp +45 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_secret.hpp +43 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +5 -10
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +11 -4
- package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_table_info.hpp +3 -3
- package/src/duckdb/src/include/duckdb/planner/pragma_handler.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/query_node/bound_set_operation_node.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/subquery/flatten_dependent_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/subquery/rewrite_cte_scan.hpp +29 -0
- package/src/duckdb/src/include/duckdb/planner/table_binding.hpp +9 -7
- package/src/duckdb/src/include/duckdb/planner/table_filter.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_dummytableref.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +9 -5
- package/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +23 -6
- package/src/duckdb/src/include/duckdb/storage/buffer/temporary_file_information.hpp +7 -0
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +11 -4
- package/src/duckdb/src/include/duckdb/storage/checkpoint/row_group_writer.hpp +0 -3
- package/src/duckdb/src/include/duckdb/storage/checkpoint/string_checkpoint_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +7 -7
- package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alp/algorithm/alp.hpp +408 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_analyze.hpp +173 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_compress.hpp +283 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_constants.hpp +134 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_fetch.hpp +42 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_scan.hpp +244 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_utils.hpp +103 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/algorithm/alprd.hpp +235 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_analyze.hpp +134 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_compress.hpp +301 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_constants.hpp +35 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_fetch.hpp +41 -0
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_scan.hpp +252 -0
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_analyze.hpp +7 -103
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +5 -234
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_analyze.hpp +7 -107
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +5 -184
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +12 -17
- package/src/duckdb/src/include/duckdb/storage/database_size.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/index.hpp +40 -42
- package/src/duckdb/src/include/duckdb/storage/index_storage_info.hpp +77 -0
- package/src/duckdb/src/include/duckdb/storage/metadata/metadata_manager.hpp +6 -2
- package/src/duckdb/src/include/duckdb/storage/object_cache.hpp +0 -1
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +12 -6
- package/src/duckdb/src/include/duckdb/storage/segment/uncompressed.hpp +8 -3
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +17 -17
- package/src/duckdb/src/include/duckdb/storage/statistics/array_stats.hpp +40 -0
- package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +12 -3
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats_union.hpp +3 -0
- package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/storage_info.hpp +49 -24
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +8 -4
- package/src/duckdb/src/include/duckdb/storage/table/array_column_data.hpp +67 -0
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/table/column_data_checkpointer.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +1 -2
- package/src/duckdb/src/include/duckdb/storage/table/data_table_info.hpp +8 -3
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +4 -2
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +7 -0
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +12 -1
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +16 -12
- package/src/duckdb/src/include/duckdb/storage/table/table_statistics.hpp +4 -0
- package/src/duckdb/src/include/duckdb/storage/table_storage_info.hpp +6 -9
- package/src/duckdb/src/include/duckdb/storage/temporary_memory_manager.hpp +119 -0
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +13 -55
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction_manager.hpp +4 -5
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +2 -2
- package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +6 -3
- package/src/duckdb/src/include/duckdb/transaction/transaction_context.hpp +4 -4
- package/src/duckdb/src/include/duckdb/transaction/transaction_manager.hpp +3 -3
- package/src/duckdb/src/include/duckdb/verification/fetch_row_verifier.hpp +25 -0
- package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +5 -0
- package/src/duckdb/src/include/duckdb.h +571 -143
- package/src/duckdb/src/main/appender.cpp +17 -2
- package/src/duckdb/src/main/attached_database.cpp +24 -12
- package/src/duckdb/src/main/buffered_data/simple_buffered_data.cpp +96 -0
- package/src/duckdb/src/main/capi/appender-c.cpp +42 -3
- package/src/duckdb/src/main/capi/arrow-c.cpp +32 -9
- package/src/duckdb/src/main/capi/datetime-c.cpp +22 -0
- package/src/duckdb/src/main/capi/duckdb-c.cpp +14 -4
- package/src/duckdb/src/main/capi/duckdb_value-c.cpp +66 -2
- package/src/duckdb/src/main/capi/helper-c.cpp +76 -2
- package/src/duckdb/src/main/capi/hugeint-c.cpp +23 -0
- package/src/duckdb/src/main/capi/logical_types-c.cpp +27 -3
- package/src/duckdb/src/main/capi/pending-c.cpp +43 -9
- package/src/duckdb/src/main/capi/prepared-c.cpp +38 -2
- package/src/duckdb/src/main/capi/result-c.cpp +54 -3
- package/src/duckdb/src/main/capi/table_function-c.cpp +4 -4
- package/src/duckdb/src/main/capi/value-c.cpp +10 -0
- package/src/duckdb/src/main/chunk_scan_state/query_result.cpp +3 -3
- package/src/duckdb/src/main/client_context.cpp +259 -250
- package/src/duckdb/src/main/client_data.cpp +0 -1
- package/src/duckdb/src/main/client_verify.cpp +26 -8
- package/src/duckdb/src/main/config.cpp +34 -13
- package/src/duckdb/src/main/connection.cpp +27 -6
- package/src/duckdb/src/main/connection_manager.cpp +54 -0
- package/src/duckdb/src/main/database.cpp +44 -39
- package/src/duckdb/src/main/database_manager.cpp +106 -8
- package/src/duckdb/src/main/database_path_and_type.cpp +27 -8
- package/src/duckdb/src/main/db_instance_cache.cpp +4 -4
- package/src/duckdb/src/main/error_manager.cpp +12 -3
- package/src/duckdb/src/main/extension/extension_alias.cpp +2 -2
- package/src/duckdb/src/main/extension/extension_helper.cpp +15 -16
- package/src/duckdb/src/main/extension/extension_install.cpp +33 -24
- package/src/duckdb/src/main/extension/extension_load.cpp +22 -21
- package/src/duckdb/src/main/extension/extension_util.cpp +12 -0
- package/src/duckdb/src/main/materialized_query_result.cpp +1 -1
- package/src/duckdb/src/main/pending_query_result.cpp +25 -8
- package/src/duckdb/src/main/prepared_statement.cpp +5 -5
- package/src/duckdb/src/main/prepared_statement_data.cpp +8 -1
- package/src/duckdb/src/main/query_profiler.cpp +11 -11
- package/src/duckdb/src/main/query_result.cpp +32 -6
- package/src/duckdb/src/main/relation/cross_product_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/join_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/read_csv_relation.cpp +38 -32
- package/src/duckdb/src/main/relation/setop_relation.cpp +5 -3
- package/src/duckdb/src/main/relation.cpp +5 -5
- package/src/duckdb/src/main/secret/secret.cpp +135 -0
- package/src/duckdb/src/main/secret/secret_manager.cpp +634 -0
- package/src/duckdb/src/main/secret/secret_storage.cpp +233 -0
- package/src/duckdb/src/main/settings/settings.cpp +133 -38
- package/src/duckdb/src/main/stream_query_result.cpp +53 -14
- package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +6 -0
- package/src/duckdb/src/optimizer/cse_optimizer.cpp +1 -1
- package/src/duckdb/src/optimizer/deliminator.cpp +136 -14
- package/src/duckdb/src/optimizer/filter_combiner.cpp +72 -26
- package/src/duckdb/src/optimizer/filter_pushdown.cpp +3 -0
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +2 -1
- package/src/duckdb/src/optimizer/join_order/cost_model.cpp +0 -1
- package/src/duckdb/src/optimizer/join_order/join_node.cpp +4 -0
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +3 -6
- package/src/duckdb/src/optimizer/join_order/join_relation_set.cpp +20 -0
- package/src/duckdb/src/optimizer/join_order/query_graph_manager.cpp +71 -40
- package/src/duckdb/src/optimizer/join_order/relation_manager.cpp +12 -3
- package/src/duckdb/src/optimizer/join_order/relation_statistics_helper.cpp +77 -3
- package/src/duckdb/src/optimizer/pushdown/pushdown_projection.cpp +7 -7
- package/src/duckdb/src/optimizer/pushdown/pushdown_semi_anti_join.cpp +56 -0
- package/src/duckdb/src/optimizer/remove_unused_columns.cpp +21 -0
- package/src/duckdb/src/optimizer/rule/date_part_simplification.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/move_constants.cpp +15 -10
- package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +70 -0
- package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +17 -5
- package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +1 -0
- package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +1 -0
- package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +1 -2
- package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +22 -9
- package/src/duckdb/src/optimizer/statistics/operator/propagate_window.cpp +28 -4
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +12 -7
- package/src/duckdb/src/parallel/event.cpp +2 -2
- package/src/duckdb/src/parallel/executor.cpp +114 -81
- package/src/duckdb/src/parallel/executor_task.cpp +2 -4
- package/src/duckdb/src/parallel/meta_pipeline.cpp +28 -29
- package/src/duckdb/src/parallel/pipeline.cpp +41 -41
- package/src/duckdb/src/parallel/pipeline_event.cpp +2 -4
- package/src/duckdb/src/parallel/pipeline_executor.cpp +13 -75
- package/src/duckdb/src/parallel/task_scheduler.cpp +22 -13
- package/src/duckdb/src/parser/column_definition.cpp +22 -4
- package/src/duckdb/src/parser/column_list.cpp +2 -1
- package/src/duckdb/src/parser/expression/function_expression.cpp +1 -1
- package/src/duckdb/src/parser/expression/lambda_expression.cpp +51 -0
- package/src/duckdb/src/parser/expression/lambdaref_expression.cpp +59 -0
- package/src/duckdb/src/parser/expression/window_expression.cpp +9 -1
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +40 -0
- package/src/duckdb/src/parser/parsed_data/attach_info.cpp +1 -0
- package/src/duckdb/src/parser/parsed_data/comment_on_info.cpp +19 -0
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +11 -9
- package/src/duckdb/src/parser/parsed_data/create_info.cpp +1 -0
- package/src/duckdb/src/parser/parsed_data/create_secret_info.cpp +22 -0
- package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +17 -0
- package/src/duckdb/src/parser/parsed_data/create_type_info.cpp +19 -0
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +13 -9
- package/src/duckdb/src/parser/parsed_data/drop_info.cpp +8 -9
- package/src/duckdb/src/parser/parsed_data/extra_drop_info.cpp +16 -0
- package/src/duckdb/src/parser/parsed_expression_iterator.cpp +3 -1
- package/src/duckdb/src/parser/parser.cpp +14 -8
- package/src/duckdb/src/parser/query_error_context.cpp +12 -13
- package/src/duckdb/src/parser/query_node/select_node.cpp +5 -1
- package/src/duckdb/src/parser/query_node/set_operation_node.cpp +8 -13
- package/src/duckdb/src/parser/statement/copy_database_statement.cpp +41 -0
- package/src/duckdb/src/parser/statement/set_statement.cpp +5 -1
- package/src/duckdb/src/parser/tableref/basetableref.cpp +1 -0
- package/src/duckdb/src/parser/tableref/showref.cpp +47 -0
- package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +6 -2
- package/src/duckdb/src/parser/transform/expression/transform_bool_expr.cpp +1 -0
- package/src/duckdb/src/parser/transform/expression/transform_boolean_test.cpp +30 -15
- package/src/duckdb/src/parser/transform/expression/transform_case.cpp +1 -0
- package/src/duckdb/src/parser/transform/expression/transform_columnref.cpp +3 -2
- package/src/duckdb/src/parser/transform/expression/transform_constant.cpp +34 -4
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +26 -12
- package/src/duckdb/src/parser/transform/expression/transform_grouping_function.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_interval.cpp +34 -5
- package/src/duckdb/src/parser/transform/expression/transform_is_null.cpp +3 -1
- package/src/duckdb/src/parser/transform/expression/transform_lambda.cpp +3 -1
- package/src/duckdb/src/parser/transform/expression/transform_multi_assign_reference.cpp +3 -3
- package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +3 -3
- package/src/duckdb/src/parser/transform/expression/transform_positional_reference.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +13 -13
- package/src/duckdb/src/parser/transform/helpers/nodetype_to_string.cpp +2 -0
- package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +1 -1
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +32 -1
- package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_attach.cpp +1 -0
- package/src/duckdb/src/parser/transform/statement/transform_comment_on.cpp +108 -0
- package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +45 -37
- package/src/duckdb/src/parser/transform/statement/transform_copy_database.cpp +29 -0
- package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +5 -14
- package/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +0 -1
- package/src/duckdb/src/parser/transform/statement/transform_delete.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +25 -6
- package/src/duckdb/src/parser/transform/statement/transform_import.cpp +2 -1
- package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +6 -14
- package/src/duckdb/src/parser/transform/statement/transform_secret.cpp +103 -0
- package/src/duckdb/src/parser/transform/statement/transform_select.cpp +8 -1
- package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +4 -8
- package/src/duckdb/src/parser/transform/statement/transform_set.cpp +18 -5
- package/src/duckdb/src/parser/transform/statement/transform_show.cpp +14 -41
- package/src/duckdb/src/parser/transform/statement/transform_show_select.cpp +13 -6
- package/src/duckdb/src/parser/transform/statement/transform_use.cpp +3 -1
- package/src/duckdb/src/parser/transform/tableref/transform_base_tableref.cpp +1 -1
- package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +1 -2
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +6 -5
- package/src/duckdb/src/parser/transform/tableref/transform_table_function.cpp +1 -1
- package/src/duckdb/src/parser/transformer.cpp +22 -0
- package/src/duckdb/src/planner/bind_context.cpp +23 -14
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +15 -14
- package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +20 -9
- package/src/duckdb/src/planner/binder/expression/bind_case_expression.cpp +12 -7
- package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +4 -4
- package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +3 -3
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +279 -195
- package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +103 -17
- package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +3 -3
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +91 -68
- package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +116 -84
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +85 -15
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +68 -31
- package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +7 -7
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +11 -7
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +42 -19
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +38 -16
- package/src/duckdb/src/planner/binder/query_node/bind_cte_node.cpp +16 -7
- package/src/duckdb/src/planner/binder/query_node/bind_recursive_cte_node.cpp +3 -0
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +83 -12
- package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +28 -37
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +3 -4
- package/src/duckdb/src/planner/binder/query_node/plan_cte_node.cpp +2 -2
- package/src/duckdb/src/planner/binder/query_node/plan_recursive_cte_node.cpp +3 -3
- package/src/duckdb/src/planner/binder/query_node/plan_setop.cpp +7 -5
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +10 -0
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +48 -50
- package/src/duckdb/src/planner/binder/statement/bind_copy_database.cpp +187 -0
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +38 -22
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +8 -15
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +6 -1
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +12 -10
- package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +37 -13
- package/src/duckdb/src/planner/binder/statement/bind_set.cpp +8 -2
- package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +2 -0
- package/src/duckdb/src/planner/binder/statement/bind_summarize.cpp +29 -14
- package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +16 -6
- package/src/duckdb/src/planner/binder/tableref/bind_expressionlistref.cpp +11 -4
- package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_named_parameters.cpp +2 -2
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +18 -17
- package/src/duckdb/src/planner/binder/tableref/bind_showref.cpp +85 -0
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +11 -17
- package/src/duckdb/src/planner/binder/tableref/plan_cteref.cpp +1 -9
- package/src/duckdb/src/planner/binder.cpp +31 -26
- package/src/duckdb/src/planner/bound_result_modifier.cpp +24 -0
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +10 -1
- package/src/duckdb/src/planner/expression/bound_function_expression.cpp +20 -4
- package/src/duckdb/src/planner/expression/bound_lambdaref_expression.cpp +9 -10
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +65 -3
- package/src/duckdb/src/planner/expression.cpp +15 -5
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +5 -6
- package/src/duckdb/src/planner/expression_binder/check_binder.cpp +9 -8
- package/src/duckdb/src/planner/expression_binder/column_alias_binder.cpp +10 -7
- package/src/duckdb/src/planner/expression_binder/having_binder.cpp +9 -4
- package/src/duckdb/src/planner/expression_binder/index_binder.cpp +0 -25
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +8 -11
- package/src/duckdb/src/planner/expression_binder/qualify_binder.cpp +3 -2
- package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +15 -8
- package/src/duckdb/src/planner/expression_binder/where_binder.cpp +3 -4
- package/src/duckdb/src/planner/expression_binder.cpp +51 -25
- package/src/duckdb/src/planner/expression_iterator.cpp +2 -1
- package/src/duckdb/src/planner/filter/constant_filter.cpp +1 -0
- package/src/duckdb/src/planner/filter/struct_filter.cpp +33 -0
- package/src/duckdb/src/planner/joinside.cpp +1 -1
- package/src/duckdb/src/planner/logical_operator.cpp +2 -1
- package/src/duckdb/src/planner/operator/logical_copy_database.cpp +32 -0
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +13 -4
- package/src/duckdb/src/planner/operator/logical_create_table.cpp +2 -0
- package/src/duckdb/src/planner/operator/logical_get.cpp +4 -1
- package/src/duckdb/src/planner/operator/logical_join.cpp +8 -0
- package/src/duckdb/src/planner/planner.cpp +24 -23
- package/src/duckdb/src/planner/pragma_handler.cpp +10 -19
- package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +99 -6
- package/src/duckdb/src/planner/subquery/rewrite_cte_scan.cpp +36 -0
- package/src/duckdb/src/planner/table_binding.cpp +14 -12
- package/src/duckdb/src/storage/buffer/block_handle.cpp +12 -10
- package/src/duckdb/src/storage/buffer/block_manager.cpp +1 -1
- package/src/duckdb/src/storage/buffer/buffer_pool.cpp +25 -9
- package/src/duckdb/src/storage/buffer/buffer_pool_reservation.cpp +4 -3
- package/src/duckdb/src/storage/buffer_manager.cpp +14 -3
- package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +0 -8
- package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +15 -7
- package/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +1 -1
- package/src/duckdb/src/storage/checkpoint_manager.cpp +94 -41
- package/src/duckdb/src/storage/compression/alp/alp.cpp +57 -0
- package/src/duckdb/src/storage/compression/alp/alp_constants.cpp +13 -0
- package/src/duckdb/src/storage/compression/alprd.cpp +57 -0
- package/src/duckdb/src/storage/compression/bitpacking.cpp +86 -55
- package/src/duckdb/src/storage/compression/bitpacking_hugeint.cpp +41 -41
- package/src/duckdb/src/storage/compression/dictionary_compression.cpp +1 -3
- package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +2 -0
- package/src/duckdb/src/storage/compression/fsst.cpp +4 -4
- package/src/duckdb/src/storage/compression/numeric_constant.cpp +3 -0
- package/src/duckdb/src/storage/compression/rle.cpp +6 -4
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +7 -7
- package/src/duckdb/src/storage/compression/uncompressed.cpp +1 -0
- package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +6 -6
- package/src/duckdb/src/storage/data_table.cpp +32 -96
- package/src/duckdb/src/storage/index.cpp +23 -11
- package/src/duckdb/src/storage/local_storage.cpp +36 -19
- package/src/duckdb/src/storage/metadata/metadata_manager.cpp +2 -2
- package/src/duckdb/src/storage/partial_block_manager.cpp +1 -1
- package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +9 -4
- package/src/duckdb/src/storage/serialization/serialize_expression.cpp +3 -3
- package/src/duckdb/src/storage/serialization/serialize_extra_drop_info.cpp +42 -0
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +7 -17
- package/src/duckdb/src/storage/serialization/serialize_macro_function.cpp +2 -2
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +84 -77
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +63 -4
- package/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +23 -0
- package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +2 -0
- package/src/duckdb/src/storage/serialization/serialize_storage.cpp +35 -0
- package/src/duckdb/src/storage/serialization/serialize_table_filter.cpp +19 -0
- package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +22 -1
- package/src/duckdb/src/storage/serialization/serialize_types.cpp +50 -0
- package/src/duckdb/src/storage/single_file_block_manager.cpp +46 -7
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +57 -28
- package/src/duckdb/src/storage/statistics/array_stats.cpp +131 -0
- package/src/duckdb/src/storage/statistics/base_statistics.cpp +62 -4
- package/src/duckdb/src/storage/statistics/column_statistics.cpp +1 -0
- package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +3 -1
- package/src/duckdb/src/storage/statistics/numeric_stats.cpp +21 -0
- package/src/duckdb/src/storage/statistics/numeric_stats_union.cpp +5 -0
- package/src/duckdb/src/storage/statistics/string_stats.cpp +2 -2
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/src/storage/storage_manager.cpp +47 -22
- package/src/duckdb/src/storage/table/array_column_data.cpp +241 -0
- package/src/duckdb/src/storage/table/chunk_info.cpp +2 -1
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +3 -1
- package/src/duckdb/src/storage/table/column_data.cpp +41 -18
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +12 -3
- package/src/duckdb/src/storage/table/column_segment.cpp +40 -6
- package/src/duckdb/src/storage/table/list_column_data.cpp +18 -15
- package/src/duckdb/src/storage/table/row_group.cpp +73 -21
- package/src/duckdb/src/storage/table/row_group_collection.cpp +395 -20
- package/src/duckdb/src/storage/table/row_version_manager.cpp +2 -1
- package/src/duckdb/src/storage/table/scan_state.cpp +4 -0
- package/src/duckdb/src/storage/table/standard_column_data.cpp +11 -5
- package/src/duckdb/src/storage/table/struct_column_data.cpp +30 -10
- package/src/duckdb/src/storage/table/table_statistics.cpp +7 -1
- package/src/duckdb/src/storage/table/update_segment.cpp +18 -2
- package/src/duckdb/src/storage/table_index_list.cpp +73 -7
- package/src/duckdb/src/storage/temporary_memory_manager.cpp +148 -0
- package/src/duckdb/src/storage/wal_replay.cpp +329 -152
- package/src/duckdb/src/storage/write_ahead_log.cpp +157 -137
- package/src/duckdb/src/transaction/cleanup_state.cpp +3 -2
- package/src/duckdb/src/transaction/commit_state.cpp +89 -63
- package/src/duckdb/src/transaction/duck_transaction.cpp +5 -3
- package/src/duckdb/src/transaction/duck_transaction_manager.cpp +26 -54
- package/src/duckdb/src/transaction/meta_transaction.cpp +37 -23
- package/src/duckdb/src/transaction/transaction_context.cpp +23 -4
- package/src/duckdb/src/transaction/undo_buffer.cpp +16 -2
- package/src/duckdb/src/verification/fetch_row_verifier.cpp +13 -0
- package/src/duckdb/src/verification/prepared_statement_verifier.cpp +5 -7
- package/src/duckdb/src/verification/statement_verifier.cpp +6 -5
- package/src/duckdb/third_party/fast_float/fast_float/fast_float.h +100 -29
- package/src/duckdb/third_party/fmt/include/fmt/format-inl.h +1 -1
- package/src/duckdb/third_party/fmt/include/fmt/format.h +4 -2
- package/src/duckdb/third_party/fmt/include/fmt/printf.h +5 -5
- package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +4 -0
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +82 -21
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +551 -1004
- package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +17 -3
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +24861 -23465
- package/src/duckdb/third_party/libpg_query/src_backend_parser_scan.cpp +420 -389
- package/src/duckdb/third_party/mbedtls/include/mbedtls/aes.h +640 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/aes_alt.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/aria.h +358 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/aria_alt.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/camellia.h +316 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/camellia_alt.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/ccm.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/ccm_alt.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/chacha20.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/chachapoly.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/cipher.h +124 -124
- package/src/duckdb/third_party/mbedtls/include/mbedtls/cmac.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/entropy.h +293 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/gcm.h +383 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/gcm_alt.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/mbedtls_config.h +9 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/nist_kw.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls/timing.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/mbedtls_wrapper.hpp +35 -6
- package/src/duckdb/third_party/mbedtls/library/aes.cpp +2171 -0
- package/src/duckdb/third_party/mbedtls/library/aesni.h +1 -0
- package/src/duckdb/third_party/mbedtls/library/aria.cpp +1058 -0
- package/src/duckdb/third_party/mbedtls/library/camellia.cpp +1087 -0
- package/src/duckdb/third_party/mbedtls/library/cipher.cpp +1633 -0
- package/src/duckdb/third_party/mbedtls/library/cipher_wrap.cpp +2270 -0
- package/src/duckdb/third_party/mbedtls/library/cipher_wrap.h +146 -0
- package/src/duckdb/third_party/mbedtls/library/entropy.cpp +701 -0
- package/src/duckdb/third_party/mbedtls/library/entropy_poll.cpp +237 -0
- package/src/duckdb/third_party/mbedtls/library/entropy_poll.h +76 -0
- package/src/duckdb/third_party/mbedtls/library/gcm.cpp +1161 -0
- package/src/duckdb/third_party/mbedtls/library/padlock.h +1 -0
- package/src/duckdb/third_party/mbedtls/mbedtls_wrapper.cpp +132 -24
- package/src/duckdb/third_party/pcg/pcg_uint128.hpp +1 -1
- package/src/duckdb/third_party/skiplist/HeadNode.h +934 -0
- package/src/duckdb/third_party/skiplist/IntegrityEnums.h +62 -0
- package/src/duckdb/third_party/skiplist/Node.h +641 -0
- package/src/duckdb/third_party/skiplist/NodeRefs.h +251 -0
- package/src/duckdb/third_party/skiplist/RollingMedian.h +202 -0
- package/src/duckdb/third_party/skiplist/SkipList.cpp +40 -0
- package/src/duckdb/third_party/skiplist/SkipList.h +549 -0
- package/src/duckdb/third_party/thrift/thrift/thrift-config.h +1 -1
- package/src/duckdb/ub_extension_json_json_functions.cpp +2 -0
- package/src/duckdb/ub_src_catalog.cpp +3 -1
- package/src/duckdb/ub_src_catalog_catalog_entry_dependency.cpp +6 -0
- package/src/duckdb/ub_src_common.cpp +1 -1
- package/src/duckdb/ub_src_common_exception.cpp +6 -0
- package/src/duckdb/ub_src_common_types.cpp +2 -2
- package/src/duckdb/ub_src_core_functions.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_array.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_scalar_blob.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_list.cpp +7 -3
- package/src/duckdb/ub_src_core_functions_scalar_secret.cpp +2 -0
- package/src/duckdb/ub_src_core_functions_scalar_string.cpp +4 -0
- package/src/duckdb/ub_src_execution_index.cpp +4 -0
- package/src/duckdb/ub_src_execution_operator_csv_scanner_buffer_manager.cpp +6 -0
- package/src/duckdb/ub_src_execution_operator_csv_scanner_scanner.cpp +10 -0
- package/src/duckdb/ub_src_execution_operator_csv_scanner_state_machine.cpp +4 -0
- package/src/duckdb/ub_src_execution_operator_csv_scanner_table_function.cpp +4 -0
- package/src/duckdb/ub_src_execution_operator_csv_scanner_util.cpp +4 -0
- package/src/duckdb/ub_src_execution_operator_helper.cpp +4 -0
- package/src/duckdb/ub_src_execution_operator_join.cpp +4 -2
- package/src/duckdb/ub_src_execution_operator_persistent.cpp +2 -0
- package/src/duckdb/ub_src_execution_physical_plan.cpp +4 -2
- package/src/duckdb/ub_src_function_cast.cpp +2 -0
- package/src/duckdb/ub_src_function_scalar_list.cpp +4 -0
- package/src/duckdb/ub_src_function_table.cpp +4 -4
- package/src/duckdb/ub_src_function_table_system.cpp +6 -0
- package/src/duckdb/ub_src_main.cpp +2 -0
- package/src/duckdb/ub_src_main_buffered_data.cpp +2 -0
- package/src/duckdb/ub_src_main_secret.cpp +6 -0
- package/src/duckdb/ub_src_optimizer_pushdown.cpp +2 -0
- package/src/duckdb/ub_src_parser_expression.cpp +2 -0
- package/src/duckdb/ub_src_parser_parsed_data.cpp +6 -0
- package/src/duckdb/ub_src_parser_statement.cpp +2 -2
- package/src/duckdb/ub_src_parser_tableref.cpp +2 -0
- package/src/duckdb/ub_src_parser_transform_statement.cpp +6 -0
- package/src/duckdb/ub_src_planner_binder_statement.cpp +2 -2
- package/src/duckdb/ub_src_planner_binder_tableref.cpp +2 -0
- package/src/duckdb/ub_src_planner_filter.cpp +2 -0
- package/src/duckdb/ub_src_planner_operator.cpp +2 -0
- package/src/duckdb/ub_src_planner_subquery.cpp +2 -0
- package/src/duckdb/ub_src_storage.cpp +2 -0
- package/src/duckdb/ub_src_storage_compression.cpp +2 -0
- package/src/duckdb/ub_src_storage_compression_alp.cpp +4 -0
- package/src/duckdb/ub_src_storage_serialization.cpp +2 -0
- package/src/duckdb/ub_src_storage_statistics.cpp +2 -0
- package/src/duckdb/ub_src_storage_table.cpp +2 -0
- package/src/duckdb_node.hpp +1 -1
- package/src/statement.cpp +18 -8
- package/src/utils.cpp +1 -15
- package/test/affected.test.ts +2 -2
- package/test/columns.test.ts +4 -3
- package/test/config.test.ts +30 -0
- package/test/each.test.ts +2 -2
- package/test/exec.test.ts +2 -2
- package/test/named_columns.test.ts +2 -2
- package/test/null_error.test.ts +2 -2
- package/test/prepare.test.ts +28 -26
- package/test/serialization.test.ts +7 -6
- package/test/test_all_types.test.ts +9 -4
- package/test/typescript_decls.test.ts +6 -6
- package/test/udf.test.ts +23 -23
- package/test/unicode.test.ts +2 -2
@@ -4,7 +4,6 @@
|
|
4
4
|
#include "duckdb/catalog/catalog_entry/type_catalog_entry.hpp"
|
5
5
|
#include "duckdb/catalog/dependency_manager.hpp"
|
6
6
|
#include "duckdb/catalog/duck_catalog.hpp"
|
7
|
-
#include "duckdb/catalog/mapping_value.hpp"
|
8
7
|
#include "duckdb/common/exception.hpp"
|
9
8
|
#include "duckdb/common/serializer/memory_stream.hpp"
|
10
9
|
#include "duckdb/common/serializer/binary_serializer.hpp"
|
@@ -13,33 +12,72 @@
|
|
13
12
|
#include "duckdb/parser/parsed_data/alter_table_info.hpp"
|
14
13
|
#include "duckdb/transaction/duck_transaction.hpp"
|
15
14
|
#include "duckdb/transaction/transaction_manager.hpp"
|
15
|
+
#include "duckdb/catalog/dependency_list.hpp"
|
16
|
+
#include "duckdb/common/exception/transaction_exception.hpp"
|
16
17
|
|
17
18
|
namespace duckdb {
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
//! If any exception is raised when this object exists, then its destructor will be called
|
25
|
-
//! and the entry will return to its previous state during deconstruction.
|
26
|
-
class EntryDropper {
|
27
|
-
public:
|
28
|
-
//! Both constructor and destructor are privates because they should only be called by DropEntryDependencies
|
29
|
-
explicit EntryDropper(EntryIndex &entry_index_p) : entry_index(entry_index_p) {
|
30
|
-
old_deleted = entry_index.GetEntry()->deleted;
|
20
|
+
void CatalogEntryMap::AddEntry(unique_ptr<CatalogEntry> entry) {
|
21
|
+
auto name = entry->name;
|
22
|
+
|
23
|
+
if (entries.find(name) != entries.end()) {
|
24
|
+
throw InternalException("Entry with name \"%s\" already exists", name);
|
31
25
|
}
|
26
|
+
entries.insert(make_pair(name, std::move(entry)));
|
27
|
+
}
|
32
28
|
|
33
|
-
|
34
|
-
|
29
|
+
void CatalogEntryMap::UpdateEntry(unique_ptr<CatalogEntry> catalog_entry) {
|
30
|
+
auto name = catalog_entry->name;
|
31
|
+
|
32
|
+
auto entry = entries.find(name);
|
33
|
+
if (entry == entries.end()) {
|
34
|
+
throw InternalException("Entry with name \"%s\" does not exist", name);
|
35
|
+
}
|
36
|
+
|
37
|
+
auto existing = std::move(entry->second);
|
38
|
+
entry->second = std::move(catalog_entry);
|
39
|
+
entry->second->SetChild(std::move(existing));
|
40
|
+
}
|
41
|
+
|
42
|
+
case_insensitive_tree_t<unique_ptr<CatalogEntry>> &CatalogEntryMap::Entries() {
|
43
|
+
return entries;
|
44
|
+
}
|
45
|
+
|
46
|
+
void CatalogEntryMap::DropEntry(CatalogEntry &entry) {
|
47
|
+
auto &name = entry.name;
|
48
|
+
auto chain = GetEntry(name);
|
49
|
+
if (!chain) {
|
50
|
+
throw InternalException("Attempting to drop entry with name \"%s\" but no chain with that name exists", name);
|
51
|
+
}
|
52
|
+
auto child = entry.TakeChild();
|
53
|
+
if (!entry.HasParent()) {
|
54
|
+
// This is the top of the chain
|
55
|
+
D_ASSERT(chain.get() == &entry);
|
56
|
+
auto it = entries.find(name);
|
57
|
+
D_ASSERT(it != entries.end());
|
58
|
+
|
59
|
+
// Remove the entry
|
60
|
+
it->second.reset();
|
61
|
+
if (child) {
|
62
|
+
// Replace it with its child
|
63
|
+
it->second = std::move(child);
|
64
|
+
} else {
|
65
|
+
entries.erase(it);
|
66
|
+
}
|
67
|
+
} else {
|
68
|
+
// Just replace the entry with its child
|
69
|
+
auto &parent = entry.Parent();
|
70
|
+
parent.SetChild(std::move(child));
|
35
71
|
}
|
72
|
+
}
|
36
73
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
74
|
+
optional_ptr<CatalogEntry> CatalogEntryMap::GetEntry(const string &name) {
|
75
|
+
auto entry = entries.find(name);
|
76
|
+
if (entry == entries.end()) {
|
77
|
+
return nullptr;
|
78
|
+
}
|
79
|
+
return entry->second.get();
|
80
|
+
}
|
43
81
|
|
44
82
|
CatalogSet::CatalogSet(Catalog &catalog_p, unique_ptr<DefaultGenerator> defaults)
|
45
83
|
: catalog(catalog_p.Cast<DuckCatalog>()), defaults(std::move(defaults)) {
|
@@ -48,115 +86,142 @@ CatalogSet::CatalogSet(Catalog &catalog_p, unique_ptr<DefaultGenerator> defaults
|
|
48
86
|
CatalogSet::~CatalogSet() {
|
49
87
|
}
|
50
88
|
|
51
|
-
|
52
|
-
|
53
|
-
|
89
|
+
bool IsDependencyEntry(CatalogEntry &entry) {
|
90
|
+
return entry.type == CatalogType::DEPENDENCY_ENTRY;
|
91
|
+
}
|
92
|
+
|
93
|
+
bool CatalogSet::StartChain(CatalogTransaction transaction, const string &name, unique_lock<mutex> &read_lock) {
|
94
|
+
D_ASSERT(!map.GetEntry(name));
|
95
|
+
|
96
|
+
// check if there is a default entry
|
97
|
+
auto entry = CreateDefaultEntry(transaction, name, read_lock);
|
98
|
+
if (entry) {
|
99
|
+
return false;
|
54
100
|
}
|
55
|
-
|
56
|
-
|
101
|
+
|
102
|
+
// first create a dummy deleted entry for this entry
|
103
|
+
// so transactions started before the commit of this transaction don't
|
104
|
+
// see it yet
|
105
|
+
auto dummy_node = make_uniq<InCatalogEntry>(CatalogType::INVALID, catalog, name);
|
106
|
+
dummy_node->timestamp = 0;
|
107
|
+
dummy_node->deleted = true;
|
108
|
+
dummy_node->set = this;
|
109
|
+
|
110
|
+
map.AddEntry(std::move(dummy_node));
|
111
|
+
return true;
|
57
112
|
}
|
58
113
|
|
59
|
-
|
60
|
-
|
61
|
-
if (entry
|
62
|
-
|
114
|
+
bool CatalogSet::VerifyVacancy(CatalogTransaction transaction, CatalogEntry &entry) {
|
115
|
+
// if it does, we have to check version numbers
|
116
|
+
if (HasConflict(transaction, entry.timestamp)) {
|
117
|
+
// current version has been written to by a currently active
|
118
|
+
// transaction
|
119
|
+
throw TransactionException("Catalog write-write conflict on create with \"%s\"", entry.name);
|
63
120
|
}
|
64
|
-
|
65
|
-
|
66
|
-
entry
|
121
|
+
// there is a current version that has been committed
|
122
|
+
// if it has not been deleted there is a conflict
|
123
|
+
if (!entry.deleted) {
|
124
|
+
return false;
|
125
|
+
}
|
126
|
+
return true;
|
67
127
|
}
|
68
128
|
|
69
|
-
|
70
|
-
|
71
|
-
if (value->internal && !catalog.IsSystemCatalog() && name != DEFAULT_SCHEMA) {
|
129
|
+
void CatalogSet::CheckCatalogEntryInvariants(CatalogEntry &value, const string &name) {
|
130
|
+
if (value.internal && !catalog.IsSystemCatalog() && name != DEFAULT_SCHEMA) {
|
72
131
|
throw InternalException("Attempting to create internal entry \"%s\" in non-system catalog - internal entries "
|
73
132
|
"can only be created in the system catalog",
|
74
133
|
name);
|
75
134
|
}
|
76
|
-
if (!value
|
77
|
-
if (!value
|
135
|
+
if (!value.internal) {
|
136
|
+
if (!value.temporary && catalog.IsSystemCatalog() && !IsDependencyEntry(value)) {
|
78
137
|
throw InternalException(
|
79
138
|
"Attempting to create non-internal entry \"%s\" in system catalog - the system catalog "
|
80
139
|
"can only contain internal entries",
|
81
140
|
name);
|
82
141
|
}
|
83
|
-
if (value
|
142
|
+
if (value.temporary && !catalog.IsTemporaryCatalog()) {
|
84
143
|
throw InternalException("Attempting to create temporary entry \"%s\" in non-temporary catalog", name);
|
85
144
|
}
|
86
|
-
if (!value
|
145
|
+
if (!value.temporary && catalog.IsTemporaryCatalog() && name != DEFAULT_SCHEMA) {
|
87
146
|
throw InvalidInputException("Cannot create non-temporary entry \"%s\" in temporary catalog", name);
|
88
147
|
}
|
89
148
|
}
|
90
|
-
|
91
|
-
lock_guard<mutex> write_lock(catalog.GetWriteLock());
|
92
|
-
// lock this catalog set to disallow reading
|
93
|
-
unique_lock<mutex> read_lock(catalog_lock);
|
149
|
+
}
|
94
150
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
151
|
+
optional_ptr<CatalogEntry> CatalogSet::CreateCommittedEntry(unique_ptr<CatalogEntry> entry) {
|
152
|
+
auto existing_entry = map.GetEntry(entry->name);
|
153
|
+
if (existing_entry) {
|
154
|
+
// Return null if an entry by that name already exists
|
155
|
+
return nullptr;
|
156
|
+
}
|
100
157
|
|
101
|
-
|
102
|
-
auto entry = CreateDefaultEntry(transaction, name, read_lock);
|
103
|
-
if (entry) {
|
104
|
-
return false;
|
105
|
-
}
|
158
|
+
auto catalog_entry = entry.get();
|
106
159
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
if (HasConflict(transaction, current.timestamp)) {
|
123
|
-
// current version has been written to by a currently active
|
124
|
-
// transaction
|
125
|
-
throw TransactionException("Catalog write-write conflict on create with \"%s\"", current.name);
|
160
|
+
entry->set = this;
|
161
|
+
// Set the timestamp to the first committed transaction
|
162
|
+
entry->timestamp = 0;
|
163
|
+
map.AddEntry(std::move(entry));
|
164
|
+
|
165
|
+
return catalog_entry;
|
166
|
+
}
|
167
|
+
|
168
|
+
bool CatalogSet::CreateEntryInternal(CatalogTransaction transaction, const string &name, unique_ptr<CatalogEntry> value,
|
169
|
+
unique_lock<mutex> &read_lock, bool should_be_empty) {
|
170
|
+
auto entry_value = map.GetEntry(name);
|
171
|
+
if (!entry_value) {
|
172
|
+
// Add a dummy node to start the chain
|
173
|
+
if (!StartChain(transaction, name, read_lock)) {
|
174
|
+
return false;
|
126
175
|
}
|
127
|
-
|
128
|
-
//
|
129
|
-
if (!
|
176
|
+
} else if (should_be_empty) {
|
177
|
+
// Verify that the chain is deleted, not altered by another transaction
|
178
|
+
if (!VerifyVacancy(transaction, *entry_value)) {
|
130
179
|
return false;
|
131
180
|
}
|
132
181
|
}
|
133
|
-
// create a new entry and replace the currently stored one
|
134
|
-
// set the timestamp to the timestamp of the current transaction
|
135
|
-
// and point it at the dummy node
|
136
|
-
value->timestamp = transaction.transaction_id;
|
137
|
-
value->set = this;
|
138
|
-
|
139
|
-
// now add the dependency set of this object to the dependency manager
|
140
|
-
catalog.GetDependencyManager().AddObject(transaction, *value, dependencies);
|
141
182
|
|
183
|
+
// Finally add the new entry to the chain
|
142
184
|
auto value_ptr = value.get();
|
143
|
-
|
144
|
-
PutEntry(std::move(entry_index), std::move(value));
|
185
|
+
map.UpdateEntry(std::move(value));
|
145
186
|
// push the old entry in the undo buffer for this transaction
|
146
187
|
if (transaction.transaction) {
|
147
188
|
auto &dtransaction = transaction.transaction->Cast<DuckTransaction>();
|
148
|
-
dtransaction.PushCatalogEntry(
|
189
|
+
dtransaction.PushCatalogEntry(value_ptr->Child());
|
149
190
|
}
|
150
191
|
return true;
|
151
192
|
}
|
152
193
|
|
194
|
+
bool CatalogSet::CreateEntry(CatalogTransaction transaction, const string &name, unique_ptr<CatalogEntry> value,
|
195
|
+
const DependencyList &dependencies) {
|
196
|
+
CheckCatalogEntryInvariants(*value, name);
|
197
|
+
|
198
|
+
// Set the timestamp to the timestamp of the current transaction
|
199
|
+
value->timestamp = transaction.transaction_id;
|
200
|
+
value->set = this;
|
201
|
+
// now add the dependency set of this object to the dependency manager
|
202
|
+
catalog.GetDependencyManager().AddObject(transaction, *value, dependencies);
|
203
|
+
|
204
|
+
// lock the catalog for writing
|
205
|
+
lock_guard<mutex> write_lock(catalog.GetWriteLock());
|
206
|
+
// lock this catalog set to disallow reading
|
207
|
+
unique_lock<mutex> read_lock(catalog_lock);
|
208
|
+
|
209
|
+
return CreateEntryInternal(transaction, name, std::move(value), read_lock);
|
210
|
+
}
|
211
|
+
|
153
212
|
bool CatalogSet::CreateEntry(ClientContext &context, const string &name, unique_ptr<CatalogEntry> value,
|
154
|
-
DependencyList &dependencies) {
|
213
|
+
const DependencyList &dependencies) {
|
155
214
|
return CreateEntry(catalog.GetCatalogTransaction(context), name, std::move(value), dependencies);
|
156
215
|
}
|
157
216
|
|
158
|
-
optional_ptr<CatalogEntry> CatalogSet::GetEntryInternal(CatalogTransaction transaction,
|
159
|
-
auto
|
217
|
+
optional_ptr<CatalogEntry> CatalogSet::GetEntryInternal(CatalogTransaction transaction, const string &name) {
|
218
|
+
auto entry_value = map.GetEntry(name);
|
219
|
+
if (!entry_value) {
|
220
|
+
// the entry does not exist, check if we can create a default entry
|
221
|
+
return nullptr;
|
222
|
+
}
|
223
|
+
auto &catalog_entry = *entry_value;
|
224
|
+
|
160
225
|
// if it does: we have to retrieve the entry and to check version numbers
|
161
226
|
if (HasConflict(transaction, catalog_entry.timestamp)) {
|
162
227
|
// current version has been written to by a currently active
|
@@ -172,162 +237,181 @@ optional_ptr<CatalogEntry> CatalogSet::GetEntryInternal(CatalogTransaction trans
|
|
172
237
|
return &catalog_entry;
|
173
238
|
}
|
174
239
|
|
175
|
-
optional_ptr<CatalogEntry> CatalogSet::GetEntryInternal(CatalogTransaction transaction, const string &name,
|
176
|
-
EntryIndex *entry_index) {
|
177
|
-
auto mapping_value = GetMapping(transaction, name);
|
178
|
-
if (mapping_value == nullptr || mapping_value->deleted) {
|
179
|
-
// the entry does not exist, check if we can create a default entry
|
180
|
-
return nullptr;
|
181
|
-
}
|
182
|
-
if (entry_index) {
|
183
|
-
*entry_index = mapping_value->index.Copy();
|
184
|
-
}
|
185
|
-
return GetEntryInternal(transaction, mapping_value->index);
|
186
|
-
}
|
187
|
-
|
188
240
|
bool CatalogSet::AlterOwnership(CatalogTransaction transaction, ChangeOwnershipInfo &info) {
|
189
|
-
|
241
|
+
// lock the catalog for writing
|
242
|
+
unique_lock<mutex> write_lock(catalog.GetWriteLock());
|
243
|
+
|
244
|
+
auto entry = GetEntryInternal(transaction, info.name);
|
190
245
|
if (!entry) {
|
191
246
|
return false;
|
192
247
|
}
|
193
248
|
|
194
249
|
auto &owner_entry = catalog.GetEntry(transaction.GetContext(), info.owner_schema, info.owner_name);
|
250
|
+
write_lock.unlock();
|
195
251
|
catalog.GetDependencyManager().AddOwnership(transaction, owner_entry, *entry);
|
196
252
|
return true;
|
197
253
|
}
|
198
254
|
|
255
|
+
bool CatalogSet::RenameEntryInternal(CatalogTransaction transaction, CatalogEntry &old, const string &new_name,
|
256
|
+
AlterInfo &alter_info, unique_lock<mutex> &read_lock) {
|
257
|
+
auto &original_name = old.name;
|
258
|
+
|
259
|
+
auto &context = *transaction.context;
|
260
|
+
auto entry_value = map.GetEntry(new_name);
|
261
|
+
if (entry_value) {
|
262
|
+
auto &existing_entry = GetEntryForTransaction(transaction, *entry_value);
|
263
|
+
if (!existing_entry.deleted) {
|
264
|
+
// There exists an entry by this name that is not deleted
|
265
|
+
old.UndoAlter(context, alter_info);
|
266
|
+
throw CatalogException("Could not rename \"%s\" to \"%s\": another entry with this name already exists!",
|
267
|
+
original_name, new_name);
|
268
|
+
}
|
269
|
+
}
|
270
|
+
|
271
|
+
// Add a RENAMED_ENTRY before adding a DELETED_ENTRY, this makes it so that when this is committed
|
272
|
+
// we know that this was not a DROP statement.
|
273
|
+
auto renamed_tombstone = make_uniq<InCatalogEntry>(CatalogType::RENAMED_ENTRY, old.ParentCatalog(), original_name);
|
274
|
+
renamed_tombstone->timestamp = transaction.transaction_id;
|
275
|
+
renamed_tombstone->deleted = false;
|
276
|
+
renamed_tombstone->set = this;
|
277
|
+
if (!CreateEntryInternal(transaction, original_name, std::move(renamed_tombstone), read_lock,
|
278
|
+
/*should_be_empty = */ false)) {
|
279
|
+
return false;
|
280
|
+
}
|
281
|
+
if (!DropEntryInternal(transaction, original_name, false)) {
|
282
|
+
return false;
|
283
|
+
}
|
284
|
+
|
285
|
+
// Add the renamed entry
|
286
|
+
// Start this off with a RENAMED_ENTRY node, for commit/cleanup/rollback purposes
|
287
|
+
auto renamed_node = make_uniq<InCatalogEntry>(CatalogType::RENAMED_ENTRY, catalog, new_name);
|
288
|
+
renamed_node->timestamp = transaction.transaction_id;
|
289
|
+
renamed_node->deleted = false;
|
290
|
+
renamed_node->set = this;
|
291
|
+
return CreateEntryInternal(transaction, new_name, std::move(renamed_node), read_lock);
|
292
|
+
}
|
293
|
+
|
199
294
|
bool CatalogSet::AlterEntry(CatalogTransaction transaction, const string &name, AlterInfo &alter_info) {
|
200
295
|
// lock the catalog for writing
|
201
|
-
|
296
|
+
unique_lock<mutex> write_lock(catalog.GetWriteLock());
|
202
297
|
// lock this catalog set to disallow reading
|
203
|
-
|
298
|
+
unique_lock<mutex> read_lock(catalog_lock);
|
204
299
|
|
205
|
-
//
|
206
|
-
|
207
|
-
auto entry = GetEntryInternal(transaction, name, &entry_index);
|
300
|
+
// If the entry does not exist, we error
|
301
|
+
auto entry = GetEntryInternal(transaction, name);
|
208
302
|
if (!entry) {
|
209
303
|
return false;
|
210
304
|
}
|
211
305
|
if (!alter_info.allow_internal && entry->internal) {
|
212
306
|
throw CatalogException("Cannot alter entry \"%s\" because it is an internal system entry", entry->name);
|
213
307
|
}
|
214
|
-
|
215
|
-
// create a new entry and replace the currently stored one
|
216
|
-
// set the timestamp to the timestamp of the current transaction
|
217
|
-
// and point it to the updated table node
|
218
|
-
string original_name = entry->name;
|
219
308
|
if (!transaction.context) {
|
220
309
|
throw InternalException("Cannot AlterEntry without client context");
|
221
310
|
}
|
311
|
+
|
222
312
|
auto &context = *transaction.context;
|
223
|
-
auto value = entry->AlterEntry(context, alter_info);
|
224
|
-
if (!value) {
|
225
|
-
// alter failed, but did not result in an error
|
226
|
-
return true;
|
227
|
-
}
|
228
313
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
314
|
+
unique_ptr<CatalogEntry> value;
|
315
|
+
if (alter_info.type == AlterType::SET_COMMENT) {
|
316
|
+
// Copy the existing entry; we are only changing metadata here
|
317
|
+
value = entry->Copy(context);
|
318
|
+
value->comment = alter_info.Cast<SetCommentInfo>().comment_value;
|
319
|
+
} else {
|
320
|
+
// Use the existing entry to create the altered entry
|
321
|
+
value = entry->AlterEntry(context, alter_info);
|
322
|
+
if (!value) {
|
323
|
+
// alter failed, but did not result in an error
|
324
|
+
return true;
|
239
325
|
}
|
240
326
|
}
|
241
327
|
|
242
|
-
|
243
|
-
// Do PutMapping and DeleteMapping after dependency check
|
244
|
-
PutMapping(transaction, value->name, entry_index.Copy());
|
245
|
-
DeleteMapping(transaction, original_name);
|
246
|
-
}
|
247
|
-
|
328
|
+
// Mark this entry as being created by this transaction
|
248
329
|
value->timestamp = transaction.transaction_id;
|
249
330
|
value->set = this;
|
250
|
-
auto new_entry = value.get();
|
251
|
-
PutEntry(std::move(entry_index), std::move(value));
|
252
331
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
332
|
+
if (!StringUtil::CIEquals(value->name, entry->name)) {
|
333
|
+
if (!RenameEntryInternal(transaction, *entry, value->name, alter_info, read_lock)) {
|
334
|
+
return false;
|
335
|
+
}
|
336
|
+
}
|
337
|
+
auto new_entry = value.get();
|
338
|
+
map.UpdateEntry(std::move(value));
|
260
339
|
|
261
340
|
// push the old entry in the undo buffer for this transaction
|
262
341
|
if (transaction.transaction) {
|
342
|
+
// serialize the AlterInfo into a temporary buffer
|
343
|
+
MemoryStream stream;
|
344
|
+
BinarySerializer serializer(stream);
|
345
|
+
serializer.Begin();
|
346
|
+
serializer.WriteProperty(100, "column_name", alter_info.GetColumnName());
|
347
|
+
serializer.WriteProperty(101, "alter_info", &alter_info);
|
348
|
+
serializer.End();
|
349
|
+
|
263
350
|
auto &dtransaction = transaction.transaction->Cast<DuckTransaction>();
|
264
|
-
dtransaction.PushCatalogEntry(
|
351
|
+
dtransaction.PushCatalogEntry(new_entry->Child(), stream.GetData(), stream.GetPosition());
|
265
352
|
}
|
266
353
|
|
354
|
+
read_lock.unlock();
|
355
|
+
write_lock.unlock();
|
356
|
+
|
267
357
|
// Check the dependency manager to verify that there are no conflicting dependencies with this alter
|
268
|
-
// Note that we do this AFTER the new entry has been entirely set up in the catalog set
|
269
|
-
// that is because in case the alter fails because of a dependency conflict, we need to be able to cleanly roll back
|
270
|
-
// to the old entry.
|
271
358
|
catalog.GetDependencyManager().AlterObject(transaction, *entry, *new_entry);
|
272
359
|
|
273
360
|
return true;
|
274
361
|
}
|
275
362
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
363
|
+
bool CatalogSet::DropDependencies(CatalogTransaction transaction, const string &name, bool cascade,
|
364
|
+
bool allow_drop_internal) {
|
365
|
+
auto entry = GetEntry(transaction, name);
|
366
|
+
if (!entry) {
|
367
|
+
return false;
|
368
|
+
}
|
369
|
+
if (entry->internal && !allow_drop_internal) {
|
370
|
+
throw CatalogException("Cannot drop entry \"%s\" because it is an internal system entry", entry->name);
|
371
|
+
}
|
284
372
|
// check any dependencies of this object
|
285
|
-
D_ASSERT(entry
|
286
|
-
auto &duck_catalog = entry
|
287
|
-
duck_catalog.GetDependencyManager().DropObject(transaction, entry, cascade);
|
288
|
-
|
289
|
-
// dropper destructor is called here
|
290
|
-
// the destructor makes sure to return the value to the previous state
|
291
|
-
// dropper.~EntryDropper()
|
373
|
+
D_ASSERT(entry->ParentCatalog().IsDuckCatalog());
|
374
|
+
auto &duck_catalog = entry->ParentCatalog().Cast<DuckCatalog>();
|
375
|
+
duck_catalog.GetDependencyManager().DropObject(transaction, *entry, cascade);
|
376
|
+
return true;
|
292
377
|
}
|
293
378
|
|
294
|
-
|
295
|
-
|
296
|
-
|
379
|
+
bool CatalogSet::DropEntryInternal(CatalogTransaction transaction, const string &name, bool allow_drop_internal) {
|
380
|
+
// lock the catalog for writing
|
381
|
+
// we can only delete an entry that exists
|
382
|
+
auto entry = GetEntryInternal(transaction, name);
|
383
|
+
if (!entry) {
|
384
|
+
return false;
|
385
|
+
}
|
386
|
+
if (entry->internal && !allow_drop_internal) {
|
387
|
+
throw CatalogException("Cannot drop entry \"%s\" because it is an internal system entry", entry->name);
|
388
|
+
}
|
297
389
|
|
298
|
-
// create a new entry and replace the currently stored one
|
390
|
+
// create a new tombstone entry and replace the currently stored one
|
299
391
|
// set the timestamp to the timestamp of the current transaction
|
300
|
-
// and point it at the
|
301
|
-
auto value = make_uniq<InCatalogEntry>(CatalogType::DELETED_ENTRY, entry
|
392
|
+
// and point it at the tombstone node
|
393
|
+
auto value = make_uniq<InCatalogEntry>(CatalogType::DELETED_ENTRY, entry->ParentCatalog(), entry->name);
|
302
394
|
value->timestamp = transaction.transaction_id;
|
303
395
|
value->set = this;
|
304
396
|
value->deleted = true;
|
305
397
|
auto value_ptr = value.get();
|
306
|
-
|
398
|
+
map.UpdateEntry(std::move(value));
|
307
399
|
|
308
400
|
// push the old entry in the undo buffer for this transaction
|
309
401
|
if (transaction.transaction) {
|
310
402
|
auto &dtransaction = transaction.transaction->Cast<DuckTransaction>();
|
311
|
-
dtransaction.PushCatalogEntry(
|
403
|
+
dtransaction.PushCatalogEntry(value_ptr->Child());
|
312
404
|
}
|
405
|
+
return true;
|
313
406
|
}
|
314
407
|
|
315
408
|
bool CatalogSet::DropEntry(CatalogTransaction transaction, const string &name, bool cascade, bool allow_drop_internal) {
|
316
|
-
|
317
|
-
lock_guard<mutex> write_lock(catalog.GetWriteLock());
|
318
|
-
lock_guard<mutex> read_lock(catalog_lock);
|
319
|
-
// we can only delete an entry that exists
|
320
|
-
EntryIndex entry_index;
|
321
|
-
auto entry = GetEntryInternal(transaction, name, &entry_index);
|
322
|
-
if (!entry) {
|
409
|
+
if (!DropDependencies(transaction, name, cascade, allow_drop_internal)) {
|
323
410
|
return false;
|
324
411
|
}
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
DropEntryInternal(transaction, std::move(entry_index), *entry, cascade);
|
330
|
-
return true;
|
412
|
+
lock_guard<mutex> write_lock(catalog.GetWriteLock());
|
413
|
+
lock_guard<mutex> read_lock(catalog_lock);
|
414
|
+
return DropEntryInternal(transaction, name, allow_drop_internal);
|
331
415
|
}
|
332
416
|
|
333
417
|
bool CatalogSet::DropEntry(ClientContext &context, const string &name, bool cascade, bool allow_drop_internal) {
|
@@ -340,79 +424,31 @@ DuckCatalog &CatalogSet::GetCatalog() {
|
|
340
424
|
|
341
425
|
void CatalogSet::CleanupEntry(CatalogEntry &catalog_entry) {
|
342
426
|
// destroy the backed up entry: it is no longer required
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
auto parent = catalog_entry.parent;
|
353
|
-
parent->child = std::move(catalog_entry.child);
|
354
|
-
if (parent->deleted && !parent->child && !parent->parent) {
|
355
|
-
auto mapping_entry = mapping.find(parent->name);
|
356
|
-
D_ASSERT(mapping_entry != mapping.end());
|
357
|
-
auto &entry = mapping_entry->second->index.GetEntry();
|
358
|
-
D_ASSERT(entry);
|
359
|
-
if (entry.get() == parent.get()) {
|
360
|
-
mapping.erase(mapping_entry);
|
361
|
-
}
|
362
|
-
}
|
427
|
+
lock_guard<mutex> write_lock(catalog.GetWriteLock());
|
428
|
+
lock_guard<mutex> lock(catalog_lock);
|
429
|
+
auto &parent = catalog_entry.Parent();
|
430
|
+
map.DropEntry(catalog_entry);
|
431
|
+
if (parent.deleted && !parent.HasChild() && !parent.HasParent()) {
|
432
|
+
// The entry's parent is a tombstone and the entry had no child
|
433
|
+
// clean up the mapping and the tombstone entry as well
|
434
|
+
D_ASSERT(map.GetEntry(parent.name).get() == &parent);
|
435
|
+
map.DropEntry(parent);
|
363
436
|
}
|
364
437
|
}
|
365
438
|
|
366
|
-
bool CatalogSet::
|
367
|
-
|
368
|
-
|
439
|
+
bool CatalogSet::CreatedByOtherActiveTransaction(CatalogTransaction transaction, transaction_t timestamp) {
|
440
|
+
// True if this transaction is not committed yet and the entry was made by another active (not committed)
|
441
|
+
// transaction
|
442
|
+
return (timestamp >= TRANSACTION_ID_START && timestamp != transaction.transaction_id);
|
369
443
|
}
|
370
444
|
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
if (entry != mapping.end()) {
|
375
|
-
mapping_value = entry->second.get();
|
376
|
-
} else {
|
377
|
-
|
378
|
-
return nullptr;
|
379
|
-
}
|
380
|
-
if (get_latest) {
|
381
|
-
return mapping_value;
|
382
|
-
}
|
383
|
-
while (mapping_value->child) {
|
384
|
-
if (UseTimestamp(transaction, mapping_value->timestamp)) {
|
385
|
-
break;
|
386
|
-
}
|
387
|
-
mapping_value = mapping_value->child.get();
|
388
|
-
D_ASSERT(mapping_value);
|
389
|
-
}
|
390
|
-
return mapping_value;
|
391
|
-
}
|
392
|
-
|
393
|
-
void CatalogSet::PutMapping(CatalogTransaction transaction, const string &name, EntryIndex entry_index) {
|
394
|
-
auto entry = mapping.find(name);
|
395
|
-
auto new_value = make_uniq<MappingValue>(std::move(entry_index));
|
396
|
-
new_value->timestamp = transaction.transaction_id;
|
397
|
-
if (entry != mapping.end()) {
|
398
|
-
if (HasConflict(transaction, entry->second->timestamp)) {
|
399
|
-
throw TransactionException("Catalog write-write conflict on name \"%s\"", name);
|
400
|
-
}
|
401
|
-
new_value->child = std::move(entry->second);
|
402
|
-
new_value->child->parent = new_value.get();
|
403
|
-
}
|
404
|
-
mapping[name] = std::move(new_value);
|
445
|
+
bool CatalogSet::CommittedAfterStarting(CatalogTransaction transaction, transaction_t timestamp) {
|
446
|
+
// The entry has been committed after this transaction started, this is not our source of truth.
|
447
|
+
return (timestamp < TRANSACTION_ID_START && timestamp > transaction.start_time);
|
405
448
|
}
|
406
449
|
|
407
|
-
|
408
|
-
|
409
|
-
D_ASSERT(entry != mapping.end());
|
410
|
-
auto delete_marker = make_uniq<MappingValue>(entry->second->index.Copy());
|
411
|
-
delete_marker->deleted = true;
|
412
|
-
delete_marker->timestamp = transaction.transaction_id;
|
413
|
-
delete_marker->child = std::move(entry->second);
|
414
|
-
delete_marker->child->parent = delete_marker.get();
|
415
|
-
mapping[name] = std::move(delete_marker);
|
450
|
+
bool CatalogSet::HasConflict(CatalogTransaction transaction, transaction_t timestamp) {
|
451
|
+
return CreatedByOtherActiveTransaction(transaction, timestamp) || CommittedAfterStarting(transaction, timestamp);
|
416
452
|
}
|
417
453
|
|
418
454
|
bool CatalogSet::UseTimestamp(CatalogTransaction transaction, transaction_t timestamp) {
|
@@ -429,23 +465,23 @@ bool CatalogSet::UseTimestamp(CatalogTransaction transaction, transaction_t time
|
|
429
465
|
|
430
466
|
CatalogEntry &CatalogSet::GetEntryForTransaction(CatalogTransaction transaction, CatalogEntry ¤t) {
|
431
467
|
reference<CatalogEntry> entry(current);
|
432
|
-
while (entry.get().
|
468
|
+
while (entry.get().HasChild()) {
|
433
469
|
if (UseTimestamp(transaction, entry.get().timestamp)) {
|
434
470
|
break;
|
435
471
|
}
|
436
|
-
entry =
|
472
|
+
entry = entry.get().Child();
|
437
473
|
}
|
438
474
|
return entry.get();
|
439
475
|
}
|
440
476
|
|
441
477
|
CatalogEntry &CatalogSet::GetCommittedEntry(CatalogEntry ¤t) {
|
442
478
|
reference<CatalogEntry> entry(current);
|
443
|
-
while (entry.get().
|
479
|
+
while (entry.get().HasChild()) {
|
444
480
|
if (entry.get().timestamp < TRANSACTION_ID_START) {
|
445
481
|
// this entry is committed: use it
|
446
482
|
break;
|
447
483
|
}
|
448
|
-
entry =
|
484
|
+
entry = entry.get().Child();
|
449
485
|
}
|
450
486
|
return entry.get();
|
451
487
|
}
|
@@ -455,38 +491,18 @@ SimilarCatalogEntry CatalogSet::SimilarEntry(CatalogTransaction transaction, con
|
|
455
491
|
CreateDefaultEntries(transaction, lock);
|
456
492
|
|
457
493
|
SimilarCatalogEntry result;
|
458
|
-
for (auto &kv :
|
459
|
-
auto
|
460
|
-
if (
|
461
|
-
|
462
|
-
|
463
|
-
result.distance = ldist;
|
464
|
-
result.name = kv.first;
|
465
|
-
}
|
494
|
+
for (auto &kv : map.Entries()) {
|
495
|
+
auto ldist = StringUtil::SimilarityScore(kv.first, name);
|
496
|
+
if (ldist < result.distance) {
|
497
|
+
result.distance = ldist;
|
498
|
+
result.name = kv.first;
|
466
499
|
}
|
467
500
|
}
|
468
501
|
return result;
|
469
502
|
}
|
470
503
|
|
471
|
-
optional_ptr<CatalogEntry> CatalogSet::CreateEntryInternal(CatalogTransaction transaction,
|
472
|
-
unique_ptr<CatalogEntry> entry) {
|
473
|
-
if (mapping.find(entry->name) != mapping.end()) {
|
474
|
-
return nullptr;
|
475
|
-
}
|
476
|
-
auto &name = entry->name;
|
477
|
-
auto catalog_entry = entry.get();
|
478
|
-
|
479
|
-
entry->set = this;
|
480
|
-
entry->timestamp = 0;
|
481
|
-
|
482
|
-
auto entry_index = PutEntry(current_entry++, std::move(entry));
|
483
|
-
PutMapping(transaction, name, std::move(entry_index));
|
484
|
-
mapping[name]->timestamp = 0;
|
485
|
-
return catalog_entry;
|
486
|
-
}
|
487
|
-
|
488
504
|
optional_ptr<CatalogEntry> CatalogSet::CreateDefaultEntry(CatalogTransaction transaction, const string &name,
|
489
|
-
unique_lock<mutex> &
|
505
|
+
unique_lock<mutex> &read_lock) {
|
490
506
|
// no entry found with this name, check for defaults
|
491
507
|
if (!defaults || defaults->created_all_entries) {
|
492
508
|
// no defaults either: return null
|
@@ -498,41 +514,51 @@ optional_ptr<CatalogEntry> CatalogSet::CreateDefaultEntry(CatalogTransaction tra
|
|
498
514
|
// no context - cannot create default entry
|
499
515
|
return nullptr;
|
500
516
|
}
|
501
|
-
|
517
|
+
read_lock.unlock();
|
502
518
|
auto entry = defaults->CreateDefaultEntry(*transaction.context, name);
|
503
519
|
|
504
|
-
|
520
|
+
read_lock.lock();
|
505
521
|
if (!entry) {
|
506
522
|
// no default entry
|
507
523
|
return nullptr;
|
508
524
|
}
|
509
525
|
// there is a default entry! create it
|
510
|
-
auto result =
|
526
|
+
auto result = CreateCommittedEntry(std::move(entry));
|
511
527
|
if (result) {
|
512
528
|
return result;
|
513
529
|
}
|
514
530
|
// we found a default entry, but failed
|
515
531
|
// this means somebody else created the entry first
|
516
532
|
// just retry?
|
517
|
-
|
533
|
+
read_lock.unlock();
|
518
534
|
return GetEntry(transaction, name);
|
519
535
|
}
|
520
536
|
|
521
|
-
|
522
|
-
unique_lock<mutex>
|
523
|
-
auto
|
524
|
-
if (
|
537
|
+
CatalogSet::EntryLookup CatalogSet::GetEntryDetailed(CatalogTransaction transaction, const string &name) {
|
538
|
+
unique_lock<mutex> read_lock(catalog_lock);
|
539
|
+
auto entry_value = map.GetEntry(name);
|
540
|
+
if (entry_value) {
|
525
541
|
// we found an entry for this name
|
526
542
|
// check the version numbers
|
527
543
|
|
528
|
-
auto &catalog_entry = *
|
544
|
+
auto &catalog_entry = *entry_value;
|
529
545
|
auto ¤t = GetEntryForTransaction(transaction, catalog_entry);
|
530
|
-
if (current.deleted
|
531
|
-
return nullptr;
|
546
|
+
if (current.deleted) {
|
547
|
+
return EntryLookup {nullptr, EntryLookup::FailureReason::DELETED};
|
532
548
|
}
|
533
|
-
|
549
|
+
D_ASSERT(StringUtil::CIEquals(name, current.name));
|
550
|
+
return EntryLookup {¤t, EntryLookup::FailureReason::SUCCESS};
|
551
|
+
}
|
552
|
+
auto default_entry = CreateDefaultEntry(transaction, name, read_lock);
|
553
|
+
if (!default_entry) {
|
554
|
+
return EntryLookup {default_entry, EntryLookup::FailureReason::NOT_PRESENT};
|
534
555
|
}
|
535
|
-
return
|
556
|
+
return EntryLookup {default_entry, EntryLookup::FailureReason::SUCCESS};
|
557
|
+
}
|
558
|
+
|
559
|
+
optional_ptr<CatalogEntry> CatalogSet::GetEntry(CatalogTransaction transaction, const string &name) {
|
560
|
+
auto lookup = GetEntryDetailed(transaction, name);
|
561
|
+
return lookup.result;
|
536
562
|
}
|
537
563
|
|
538
564
|
optional_ptr<CatalogEntry> CatalogSet::GetEntry(ClientContext &context, const string &name) {
|
@@ -541,7 +567,6 @@ optional_ptr<CatalogEntry> CatalogSet::GetEntry(ClientContext &context, const st
|
|
541
567
|
|
542
568
|
void CatalogSet::UpdateTimestamp(CatalogEntry &entry, transaction_t timestamp) {
|
543
569
|
entry.timestamp = timestamp;
|
544
|
-
mapping[entry.name]->timestamp = timestamp;
|
545
570
|
}
|
546
571
|
|
547
572
|
void CatalogSet::Undo(CatalogEntry &entry) {
|
@@ -552,69 +577,41 @@ void CatalogSet::Undo(CatalogEntry &entry) {
|
|
552
577
|
// and entry->parent has to be removed ("rolled back")
|
553
578
|
|
554
579
|
// i.e. we have to place (entry) as (entry->parent) again
|
555
|
-
auto &to_be_removed_node =
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
dependency_manager.EraseObject(to_be_removed_node);
|
561
|
-
}
|
562
|
-
if (!StringUtil::CIEquals(entry.name, to_be_removed_node.name)) {
|
563
|
-
// rename: clean up the new name when the rename is rolled back
|
564
|
-
auto removed_entry = mapping.find(to_be_removed_node.name);
|
565
|
-
if (removed_entry->second->child) {
|
566
|
-
removed_entry->second->child->parent = nullptr;
|
567
|
-
mapping[to_be_removed_node.name] = std::move(removed_entry->second->child);
|
568
|
-
} else {
|
569
|
-
mapping.erase(removed_entry);
|
570
|
-
}
|
580
|
+
auto &to_be_removed_node = entry.Parent();
|
581
|
+
|
582
|
+
D_ASSERT(StringUtil::CIEquals(entry.name, to_be_removed_node.name));
|
583
|
+
if (!to_be_removed_node.HasParent()) {
|
584
|
+
to_be_removed_node.Child().SetAsRoot();
|
571
585
|
}
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
entry
|
577
|
-
} else {
|
578
|
-
// otherwise we need to update the base entry tables
|
579
|
-
auto &name = entry.name;
|
580
|
-
to_be_removed_node.child->SetAsRoot();
|
581
|
-
mapping[name]->index.GetEntry() = std::move(to_be_removed_node.child);
|
582
|
-
entry.parent = nullptr;
|
583
|
-
}
|
584
|
-
|
585
|
-
// restore the name if it was deleted
|
586
|
-
auto restored_entry = mapping.find(entry.name);
|
587
|
-
if (restored_entry->second->deleted || entry.type == CatalogType::INVALID) {
|
588
|
-
if (restored_entry->second->child) {
|
589
|
-
restored_entry->second->child->parent = nullptr;
|
590
|
-
mapping[entry.name] = std::move(restored_entry->second->child);
|
591
|
-
} else {
|
592
|
-
mapping.erase(restored_entry);
|
593
|
-
}
|
586
|
+
map.DropEntry(to_be_removed_node);
|
587
|
+
|
588
|
+
if (entry.type == CatalogType::INVALID) {
|
589
|
+
// This was the root of the entry chain
|
590
|
+
map.DropEntry(entry);
|
594
591
|
}
|
595
592
|
// we mark the catalog as being modified, since this action can lead to e.g. tables being dropped
|
596
593
|
catalog.ModifyCatalog();
|
597
594
|
}
|
598
595
|
|
599
|
-
void CatalogSet::CreateDefaultEntries(CatalogTransaction transaction, unique_lock<mutex> &
|
596
|
+
void CatalogSet::CreateDefaultEntries(CatalogTransaction transaction, unique_lock<mutex> &read_lock) {
|
600
597
|
if (!defaults || defaults->created_all_entries || !transaction.context) {
|
601
598
|
return;
|
602
599
|
}
|
603
600
|
// this catalog set has a default set defined:
|
604
601
|
auto default_entries = defaults->GetDefaultEntries();
|
605
602
|
for (auto &default_entry : default_entries) {
|
606
|
-
auto
|
607
|
-
if (
|
603
|
+
auto entry_value = map.GetEntry(default_entry);
|
604
|
+
if (!entry_value) {
|
608
605
|
// we unlock during the CreateEntry, since it might reference other catalog sets...
|
609
606
|
// specifically for views this can happen since the view will be bound
|
610
|
-
|
607
|
+
read_lock.unlock();
|
611
608
|
auto entry = defaults->CreateDefaultEntry(*transaction.context, default_entry);
|
612
609
|
if (!entry) {
|
613
610
|
throw InternalException("Failed to create default entry for %s", default_entry);
|
614
611
|
}
|
615
612
|
|
616
|
-
|
617
|
-
|
613
|
+
read_lock.lock();
|
614
|
+
CreateCommittedEntry(std::move(entry));
|
618
615
|
}
|
619
616
|
}
|
620
617
|
defaults->created_all_entries = true;
|
@@ -625,8 +622,8 @@ void CatalogSet::Scan(CatalogTransaction transaction, const std::function<void(C
|
|
625
622
|
unique_lock<mutex> lock(catalog_lock);
|
626
623
|
CreateDefaultEntries(transaction, lock);
|
627
624
|
|
628
|
-
for (auto &kv :
|
629
|
-
auto &entry = *kv.second
|
625
|
+
for (auto &kv : map.Entries()) {
|
626
|
+
auto &entry = *kv.second;
|
630
627
|
auto &entry_for_transaction = GetEntryForTransaction(transaction, entry);
|
631
628
|
if (!entry_for_transaction.deleted) {
|
632
629
|
callback(entry_for_transaction);
|
@@ -638,12 +635,30 @@ void CatalogSet::Scan(ClientContext &context, const std::function<void(CatalogEn
|
|
638
635
|
Scan(catalog.GetCatalogTransaction(context), callback);
|
639
636
|
}
|
640
637
|
|
638
|
+
void CatalogSet::ScanWithPrefix(CatalogTransaction transaction, const std::function<void(CatalogEntry &)> &callback,
|
639
|
+
const string &prefix) {
|
640
|
+
// lock the catalog set
|
641
|
+
unique_lock<mutex> lock(catalog_lock);
|
642
|
+
CreateDefaultEntries(transaction, lock);
|
643
|
+
|
644
|
+
auto &entries = map.Entries();
|
645
|
+
auto it = entries.lower_bound(prefix);
|
646
|
+
auto end = entries.upper_bound(prefix + char(255));
|
647
|
+
for (; it != end; it++) {
|
648
|
+
auto &entry = *it->second;
|
649
|
+
auto &entry_for_transaction = GetEntryForTransaction(transaction, entry);
|
650
|
+
if (!entry_for_transaction.deleted) {
|
651
|
+
callback(entry_for_transaction);
|
652
|
+
}
|
653
|
+
}
|
654
|
+
}
|
655
|
+
|
641
656
|
void CatalogSet::Scan(const std::function<void(CatalogEntry &)> &callback) {
|
642
657
|
// lock the catalog set
|
643
658
|
lock_guard<mutex> lock(catalog_lock);
|
644
|
-
for (auto &kv :
|
645
|
-
auto entry = kv.second
|
646
|
-
auto &commited_entry = GetCommittedEntry(
|
659
|
+
for (auto &kv : map.Entries()) {
|
660
|
+
auto &entry = *kv.second;
|
661
|
+
auto &commited_entry = GetCommittedEntry(entry);
|
647
662
|
if (!commited_entry.deleted) {
|
648
663
|
callback(commited_entry);
|
649
664
|
}
|