duckdb 0.7.2-dev225.0 → 0.7.2-dev2320.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +13 -6
- package/lib/duckdb.d.ts +55 -2
- package/lib/duckdb.js +20 -1
- package/package.json +1 -1
- package/src/connection.cpp +13 -14
- package/src/data_chunk.cpp +14 -2
- package/src/database.cpp +15 -16
- package/src/duckdb/extension/icu/icu-dateadd.cpp +2 -2
- package/src/duckdb/extension/icu/icu-datefunc.cpp +23 -11
- package/src/duckdb/extension/icu/icu-datepart.cpp +18 -18
- package/src/duckdb/extension/icu/icu-datesub.cpp +2 -2
- package/src/duckdb/extension/icu/icu-datetrunc.cpp +1 -1
- package/src/duckdb/extension/icu/icu-extension.cpp +32 -29
- package/src/duckdb/extension/icu/icu-list-range.cpp +207 -0
- package/src/duckdb/extension/icu/icu-makedate.cpp +1 -1
- package/src/duckdb/extension/icu/icu-strptime.cpp +133 -45
- package/src/duckdb/extension/icu/icu-table-range.cpp +10 -10
- package/src/duckdb/extension/icu/icu-timebucket.cpp +6 -6
- package/src/duckdb/extension/icu/icu-timezone.cpp +19 -18
- package/src/duckdb/extension/icu/include/icu-datefunc.hpp +10 -8
- package/src/duckdb/extension/icu/include/icu-list-range.hpp +17 -0
- package/src/duckdb/extension/icu/third_party/icu/common/unicode/localpointer.h +22 -22
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/numberformatter.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/stubdata/stubdata.cpp +1 -1
- package/src/duckdb/extension/json/buffered_json_reader.cpp +3 -3
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +5 -5
- package/src/duckdb/extension/json/include/json_common.hpp +1 -0
- package/src/duckdb/extension/json/include/json_deserializer.hpp +92 -0
- package/src/duckdb/extension/json/include/json_executors.hpp +2 -2
- package/src/duckdb/extension/json/include/json_functions.hpp +8 -1
- package/src/duckdb/extension/json/include/json_scan.hpp +9 -10
- package/src/duckdb/extension/json/include/json_serializer.hpp +82 -0
- package/src/duckdb/extension/json/include/json_structure.hpp +1 -1
- package/src/duckdb/extension/json/json-extension.cpp +6 -0
- package/src/duckdb/extension/json/json_deserializer.cpp +306 -0
- package/src/duckdb/extension/json/json_functions/copy_json.cpp +19 -19
- package/src/duckdb/extension/json/json_functions/json_create.cpp +27 -26
- package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +2 -2
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +279 -0
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +3 -3
- package/src/duckdb/extension/json/json_functions/read_json.cpp +26 -35
- package/src/duckdb/extension/json/json_functions.cpp +35 -18
- package/src/duckdb/extension/json/json_scan.cpp +9 -32
- package/src/duckdb/extension/json/json_serializer.cpp +253 -0
- package/src/duckdb/extension/parquet/column_reader.cpp +162 -99
- package/src/duckdb/extension/parquet/column_writer.cpp +106 -105
- package/src/duckdb/extension/parquet/include/boolean_column_reader.hpp +5 -3
- package/src/duckdb/extension/parquet/include/callback_column_reader.hpp +3 -0
- package/src/duckdb/extension/parquet/include/cast_column_reader.hpp +7 -4
- package/src/duckdb/extension/parquet/include/column_reader.hpp +26 -10
- package/src/duckdb/extension/parquet/include/column_writer.hpp +7 -8
- package/src/duckdb/extension/parquet/include/decode_utils.hpp +5 -4
- package/src/duckdb/extension/parquet/include/list_column_reader.hpp +6 -4
- package/src/duckdb/extension/parquet/include/parquet_dbp_decoder.hpp +3 -3
- package/src/duckdb/extension/parquet/include/parquet_decimal_utils.hpp +3 -3
- package/src/duckdb/extension/parquet/include/parquet_file_metadata_cache.hpp +2 -2
- package/src/duckdb/extension/parquet/include/parquet_metadata.hpp +1 -0
- package/src/duckdb/extension/parquet/include/parquet_reader.hpp +27 -52
- package/src/duckdb/extension/parquet/include/parquet_statistics.hpp +2 -2
- package/src/duckdb/extension/parquet/include/parquet_support.hpp +10 -9
- package/src/duckdb/extension/parquet/include/parquet_timestamp.hpp +2 -1
- package/src/duckdb/extension/parquet/include/parquet_writer.hpp +3 -3
- package/src/duckdb/extension/parquet/include/row_number_column_reader.hpp +6 -3
- package/src/duckdb/extension/parquet/include/string_column_reader.hpp +4 -1
- package/src/duckdb/extension/parquet/include/struct_column_reader.hpp +7 -3
- package/src/duckdb/extension/parquet/include/templated_column_reader.hpp +3 -0
- package/src/duckdb/extension/parquet/include/zstd_file_system.hpp +2 -2
- package/src/duckdb/extension/parquet/parquet-extension.cpp +113 -253
- package/src/duckdb/extension/parquet/parquet_metadata.cpp +11 -19
- package/src/duckdb/extension/parquet/parquet_reader.cpp +120 -255
- package/src/duckdb/extension/parquet/parquet_statistics.cpp +53 -40
- package/src/duckdb/extension/parquet/parquet_timestamp.cpp +16 -6
- package/src/duckdb/extension/parquet/parquet_writer.cpp +2 -2
- package/src/duckdb/extension/parquet/zstd_file_system.cpp +4 -4
- package/src/duckdb/src/catalog/catalog.cpp +79 -49
- package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +33 -33
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +52 -75
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +5 -5
- package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +8 -12
- package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +11 -5
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_entry.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_set.cpp +56 -53
- package/src/duckdb/src/catalog/default/default_functions.cpp +15 -11
- package/src/duckdb/src/catalog/default/default_schemas.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_types.cpp +4 -4
- package/src/duckdb/src/catalog/default/default_views.cpp +5 -5
- package/src/duckdb/src/catalog/dependency_list.cpp +15 -2
- package/src/duckdb/src/catalog/dependency_manager.cpp +46 -40
- package/src/duckdb/src/catalog/duck_catalog.cpp +37 -10
- package/src/duckdb/src/common/adbc/adbc.cpp +441 -0
- package/src/duckdb/src/common/adbc/driver_manager.cpp +749 -0
- package/src/duckdb/src/common/allocator.cpp +2 -2
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +121 -52
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +5 -5
- package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +21 -3
- package/src/duckdb/src/common/box_renderer.cpp +113 -25
- package/src/duckdb/src/common/compressed_file_system.cpp +15 -0
- package/src/duckdb/src/common/constants.cpp +10 -1
- package/src/duckdb/src/common/enums/expression_type.cpp +8 -222
- package/src/duckdb/src/common/enums/join_type.cpp +3 -22
- package/src/duckdb/src/common/enums/logical_operator_type.cpp +4 -0
- package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -0
- package/src/duckdb/src/common/exception.cpp +19 -1
- package/src/duckdb/src/common/exception_format_value.cpp +1 -1
- package/src/duckdb/src/common/field_writer.cpp +2 -1
- package/src/duckdb/src/common/file_system.cpp +5 -3
- package/src/duckdb/src/common/filename_pattern.cpp +41 -0
- package/src/duckdb/src/common/gzip_file_system.cpp +69 -5
- package/src/duckdb/src/common/hive_partitioning.cpp +150 -19
- package/src/duckdb/src/common/local_file_system.cpp +82 -14
- package/src/duckdb/src/common/multi_file_reader.cpp +373 -0
- package/src/duckdb/src/common/operator/cast_operators.cpp +1 -1
- package/src/duckdb/src/common/pipe_file_system.cpp +2 -1
- package/src/duckdb/src/common/preserved_error.cpp +7 -5
- package/src/duckdb/src/common/progress_bar/progress_bar.cpp +8 -1
- package/src/duckdb/src/common/radix_partitioning.cpp +102 -370
- package/src/duckdb/src/common/random_engine.cpp +1 -1
- package/src/duckdb/src/common/re2_regex.cpp +4 -4
- package/src/duckdb/src/common/row_operations/row_aggregate.cpp +22 -17
- package/src/duckdb/src/common/row_operations/row_external.cpp +1 -1
- package/src/duckdb/src/common/row_operations/row_gather.cpp +5 -3
- package/src/duckdb/src/common/row_operations/row_match.cpp +117 -22
- package/src/duckdb/src/common/row_operations/row_scatter.cpp +6 -4
- package/src/duckdb/src/common/serializer/buffered_deserializer.cpp +4 -0
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +21 -3
- package/src/duckdb/src/common/serializer/enum_serializer.cpp +1180 -0
- package/src/duckdb/src/common/sort/comparators.cpp +14 -5
- package/src/duckdb/src/common/sort/merge_sorter.cpp +3 -3
- package/src/duckdb/src/common/sort/partition_state.cpp +644 -0
- package/src/duckdb/src/common/sort/sort_state.cpp +18 -19
- package/src/duckdb/src/common/sort/sorted_block.cpp +23 -18
- package/src/duckdb/src/common/string_util.cpp +43 -3
- package/src/duckdb/src/common/tree_renderer.cpp +7 -9
- package/src/duckdb/src/common/types/batched_data_collection.cpp +5 -4
- package/src/duckdb/src/common/types/bit.cpp +89 -47
- package/src/duckdb/src/common/types/blob.cpp +3 -3
- package/src/duckdb/src/common/types/chunk_collection.cpp +4 -4
- package/src/duckdb/src/common/types/{column_data_allocator.cpp → column/column_data_allocator.cpp} +3 -2
- package/src/duckdb/src/common/types/{column_data_collection.cpp → column/column_data_collection.cpp} +67 -7
- package/src/duckdb/src/common/types/{column_data_collection_segment.cpp → column/column_data_collection_segment.cpp} +14 -11
- package/src/duckdb/src/common/types/{column_data_consumer.cpp → column/column_data_consumer.cpp} +1 -1
- package/src/duckdb/src/common/types/{partitioned_column_data.cpp → column/partitioned_column_data.cpp} +14 -12
- package/src/duckdb/src/common/types/conflict_manager.cpp +5 -4
- package/src/duckdb/src/common/types/data_chunk.cpp +1 -1
- package/src/duckdb/src/common/types/hyperloglog.cpp +2 -2
- package/src/duckdb/src/common/types/interval.cpp +0 -41
- package/src/duckdb/src/common/types/list_segment.cpp +658 -0
- package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +316 -0
- package/src/duckdb/src/common/types/{row_data_collection.cpp → row/row_data_collection.cpp} +2 -2
- package/src/duckdb/src/common/types/{row_data_collection_scanner.cpp → row/row_data_collection_scanner.cpp} +3 -3
- package/src/duckdb/src/common/types/{row_layout.cpp → row/row_layout.cpp} +1 -1
- package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +465 -0
- package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +511 -0
- package/src/duckdb/src/common/types/row/tuple_data_iterator.cpp +96 -0
- package/src/duckdb/src/common/types/row/tuple_data_layout.cpp +119 -0
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +1200 -0
- package/src/duckdb/src/common/types/row/tuple_data_segment.cpp +170 -0
- package/src/duckdb/src/common/types/string_heap.cpp +1 -1
- package/src/duckdb/src/common/types/string_type.cpp +1 -1
- package/src/duckdb/src/common/types/time.cpp +13 -0
- package/src/duckdb/src/common/types/validity_mask.cpp +24 -7
- package/src/duckdb/src/common/types/value.cpp +184 -101
- package/src/duckdb/src/common/types/vector.cpp +205 -144
- package/src/duckdb/src/common/types/vector_buffer.cpp +3 -3
- package/src/duckdb/src/common/types/vector_cache.cpp +4 -4
- package/src/duckdb/src/common/types.cpp +314 -152
- package/src/duckdb/src/common/value_operations/comparison_operations.cpp +14 -22
- package/src/duckdb/src/common/vector.cpp +12 -0
- package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +10 -10
- package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +11 -10
- package/src/duckdb/src/common/vector_operations/vector_cast.cpp +2 -1
- package/src/duckdb/src/common/vector_operations/vector_copy.cpp +14 -11
- package/src/duckdb/src/common/virtual_file_system.cpp +1 -1
- package/src/duckdb/src/execution/adaptive_filter.cpp +1 -1
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +331 -339
- package/src/duckdb/src/execution/column_binding_resolver.cpp +27 -11
- package/src/duckdb/src/execution/expression_executor/execute_between.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor/execute_case.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +3 -2
- package/src/duckdb/src/execution/expression_executor/execute_comparison.cpp +3 -3
- package/src/duckdb/src/execution/expression_executor/execute_conjunction.cpp +6 -6
- package/src/duckdb/src/execution/expression_executor/execute_constant.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor/execute_function.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor/execute_operator.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor/execute_parameter.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor/execute_reference.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor.cpp +5 -4
- package/src/duckdb/src/execution/expression_executor_state.cpp +3 -4
- package/src/duckdb/src/execution/index/art/art.cpp +27 -15
- package/src/duckdb/src/execution/join_hashtable.cpp +203 -337
- package/src/duckdb/src/execution/operator/aggregate/aggregate_object.cpp +12 -3
- package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +12 -12
- package/src/duckdb/src/execution/operator/aggregate/grouped_aggregate_data.cpp +2 -2
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +44 -44
- package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +22 -23
- package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +13 -9
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +43 -29
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +237 -917
- package/src/duckdb/src/execution/operator/filter/physical_filter.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +9 -9
- package/src/duckdb/src/execution/operator/helper/physical_execute.cpp +3 -8
- package/src/duckdb/src/execution/operator/helper/physical_explain_analyze.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +11 -8
- package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +8 -9
- package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +14 -10
- package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +5 -5
- package/src/duckdb/src/execution/operator/helper/physical_result_collector.cpp +8 -14
- package/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp +6 -6
- package/src/duckdb/src/execution/operator/helper/physical_streaming_sample.cpp +3 -3
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +13 -11
- package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +37 -22
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +78 -31
- package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +7 -7
- package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +18 -17
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +193 -169
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +42 -38
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +29 -19
- package/src/duckdb/src/execution/operator/join/physical_join.cpp +9 -20
- package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +21 -21
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +28 -33
- package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +6 -7
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +4 -2
- package/src/duckdb/src/execution/operator/order/physical_order.cpp +17 -17
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +14 -14
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +54 -46
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +96 -43
- package/src/duckdb/src/execution/operator/persistent/csv_buffer.cpp +17 -13
- package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +12 -19
- package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +134 -30
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +41 -36
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +31 -29
- package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +11 -12
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +30 -29
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +51 -49
- package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +15 -14
- package/src/duckdb/src/execution/operator/projection/physical_pivot.cpp +81 -0
- package/src/duckdb/src/execution/operator/projection/physical_projection.cpp +37 -3
- package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +7 -7
- package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +5 -6
- package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +14 -8
- package/src/duckdb/src/execution/operator/scan/physical_dummy_scan.cpp +1 -1
- package/src/duckdb/src/execution/operator/scan/physical_expression_scan.cpp +1 -1
- package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +26 -11
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +27 -15
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +17 -16
- package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +4 -4
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +26 -46
- package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +2 -2
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +19 -23
- package/src/duckdb/src/execution/operator/set/physical_union.cpp +15 -4
- package/src/duckdb/src/execution/partitionable_hashtable.cpp +30 -43
- package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +35 -39
- package/src/duckdb/src/execution/physical_operator.cpp +22 -37
- package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +34 -28
- package/src/duckdb/src/execution/physical_plan/plan_any_join.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp +97 -0
- package/src/duckdb/src/execution/physical_plan/plan_column_data_get.cpp +2 -4
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +119 -70
- package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +3 -3
- package/src/duckdb/src/execution/physical_plan/plan_create.cpp +9 -9
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +16 -16
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +6 -6
- package/src/duckdb/src/execution/physical_plan/plan_cross_product.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_delim_get.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +12 -13
- package/src/duckdb/src/execution/physical_plan/plan_distinct.cpp +15 -16
- package/src/duckdb/src/execution/physical_plan/plan_dummy_scan.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_empty_result.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_execute.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_explain.cpp +9 -12
- package/src/duckdb/src/execution/physical_plan/plan_export.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_expression_get.cpp +6 -6
- package/src/duckdb/src/execution/physical_plan/plan_filter.cpp +3 -3
- package/src/duckdb/src/execution/physical_plan/plan_get.cpp +12 -13
- package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +28 -8
- package/src/duckdb/src/execution/physical_plan/plan_limit.cpp +6 -7
- package/src/duckdb/src/execution/physical_plan/plan_limit_percent.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_order.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_pivot.cpp +14 -0
- package/src/duckdb/src/execution/physical_plan/plan_positional_join.cpp +14 -5
- package/src/duckdb/src/execution/physical_plan/plan_pragma.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_prepare.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_projection.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp +7 -7
- package/src/duckdb/src/execution/physical_plan/plan_reset.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_sample.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_set.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_set_operation.cpp +5 -5
- package/src/duckdb/src/execution/physical_plan/plan_show_select.cpp +3 -5
- package/src/duckdb/src/execution/physical_plan/plan_simple.cpp +14 -14
- package/src/duckdb/src/execution/physical_plan/plan_top_n.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_unnest.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_update.cpp +3 -3
- package/src/duckdb/src/execution/physical_plan/plan_window.cpp +13 -13
- package/src/duckdb/src/execution/physical_plan_generator.cpp +53 -43
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +84 -54
- package/src/duckdb/src/execution/reservoir_sample.cpp +3 -3
- package/src/duckdb/src/execution/window_segment_tree.cpp +196 -26
- package/src/duckdb/src/function/aggregate/algebraic/avg.cpp +4 -4
- package/src/duckdb/src/function/aggregate/distributive/approx_count.cpp +1 -1
- package/src/duckdb/src/function/aggregate/distributive/arg_min_max.cpp +1 -1
- package/src/duckdb/src/function/aggregate/distributive/bitagg.cpp +1 -1
- package/src/duckdb/src/function/aggregate/distributive/bitstring_agg.cpp +33 -25
- package/src/duckdb/src/function/aggregate/distributive/bool.cpp +2 -0
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +3 -4
- package/src/duckdb/src/function/aggregate/distributive/entropy.cpp +1 -1
- package/src/duckdb/src/function/aggregate/distributive/first.cpp +10 -8
- package/src/duckdb/src/function/aggregate/distributive/minmax.cpp +23 -23
- package/src/duckdb/src/function/aggregate/distributive/string_agg.cpp +8 -8
- package/src/duckdb/src/function/aggregate/distributive/sum.cpp +19 -13
- package/src/duckdb/src/function/aggregate/holistic/approximate_quantile.cpp +10 -7
- package/src/duckdb/src/function/aggregate/holistic/mode.cpp +2 -2
- package/src/duckdb/src/function/aggregate/holistic/quantile.cpp +25 -10
- package/src/duckdb/src/function/aggregate/holistic/reservoir_quantile.cpp +6 -6
- package/src/duckdb/src/function/aggregate/nested/histogram.cpp +2 -2
- package/src/duckdb/src/function/aggregate/nested/list.cpp +42 -804
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +289 -98
- package/src/duckdb/src/function/cast/cast_function_set.cpp +3 -2
- package/src/duckdb/src/function/cast/enum_casts.cpp +28 -6
- package/src/duckdb/src/function/cast/list_casts.cpp +19 -6
- package/src/duckdb/src/function/cast/map_cast.cpp +6 -3
- package/src/duckdb/src/function/cast/string_cast.cpp +39 -13
- package/src/duckdb/src/function/cast/struct_cast.cpp +27 -7
- package/src/duckdb/src/function/cast/time_casts.cpp +2 -2
- package/src/duckdb/src/function/cast/union_casts.cpp +40 -14
- package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +2 -3
- package/src/duckdb/src/function/cast_rules.cpp +9 -4
- package/src/duckdb/src/function/compression_config.cpp +9 -9
- package/src/duckdb/src/function/function.cpp +4 -4
- package/src/duckdb/src/function/function_binder.cpp +8 -14
- package/src/duckdb/src/function/macro_function.cpp +3 -3
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +25 -2
- package/src/duckdb/src/function/pragma_function.cpp +1 -1
- package/src/duckdb/src/function/scalar/bit/bitstring.cpp +4 -3
- package/src/duckdb/src/function/scalar/date/current.cpp +0 -2
- package/src/duckdb/src/function/scalar/date/date_diff.cpp +0 -1
- package/src/duckdb/src/function/scalar/date/date_part.cpp +22 -30
- package/src/duckdb/src/function/scalar/date/date_sub.cpp +0 -1
- package/src/duckdb/src/function/scalar/date/date_trunc.cpp +10 -14
- package/src/duckdb/src/function/scalar/date/strftime.cpp +133 -36
- package/src/duckdb/src/function/scalar/generic/alias.cpp +1 -1
- package/src/duckdb/src/function/scalar/generic/constant_or_null.cpp +6 -6
- package/src/duckdb/src/function/scalar/generic/current_setting.cpp +4 -4
- package/src/duckdb/src/function/scalar/generic/error.cpp +21 -0
- package/src/duckdb/src/function/scalar/generic/stats.cpp +6 -8
- package/src/duckdb/src/function/scalar/generic_functions.cpp +1 -0
- package/src/duckdb/src/function/scalar/list/array_slice.cpp +1 -1
- package/src/duckdb/src/function/scalar/list/contains_or_position.cpp +5 -147
- package/src/duckdb/src/function/scalar/list/flatten.cpp +7 -14
- package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +12 -11
- package/src/duckdb/src/function/scalar/list/list_concat.cpp +9 -13
- package/src/duckdb/src/function/scalar/list/list_extract.cpp +6 -13
- package/src/duckdb/src/function/scalar/list/list_lambdas.cpp +13 -9
- package/src/duckdb/src/function/scalar/list/list_sort.cpp +32 -25
- package/src/duckdb/src/function/scalar/list/list_value.cpp +7 -11
- package/src/duckdb/src/function/scalar/map/cardinality.cpp +1 -1
- package/src/duckdb/src/function/scalar/map/map.cpp +48 -2
- package/src/duckdb/src/function/scalar/map/map_entries.cpp +2 -2
- package/src/duckdb/src/function/scalar/map/map_extract.cpp +69 -27
- package/src/duckdb/src/function/scalar/map/map_from_entries.cpp +1 -1
- package/src/duckdb/src/function/scalar/map/map_keys_values.cpp +1 -1
- package/src/duckdb/src/function/scalar/math/numeric.cpp +163 -22
- package/src/duckdb/src/function/scalar/math/random.cpp +3 -3
- package/src/duckdb/src/function/scalar/math/setseed.cpp +4 -4
- package/src/duckdb/src/function/scalar/math_functions.cpp +4 -0
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +50 -51
- package/src/duckdb/src/function/scalar/operators/multiply.cpp +5 -0
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +35 -35
- package/src/duckdb/src/function/scalar/string/caseconvert.cpp +2 -6
- package/src/duckdb/src/function/scalar/string/damerau_levenshtein.cpp +106 -0
- package/src/duckdb/src/function/scalar/string/hex.cpp +384 -0
- package/src/duckdb/src/function/scalar/string/instr.cpp +2 -6
- package/src/duckdb/src/function/scalar/string/length.cpp +2 -6
- package/src/duckdb/src/function/scalar/string/levenshtein.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/like.cpp +6 -10
- package/src/duckdb/src/function/scalar/string/printf.cpp +4 -4
- package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +243 -0
- package/src/duckdb/src/function/scalar/string/regexp/regexp_util.cpp +79 -0
- package/src/duckdb/src/function/scalar/string/regexp.cpp +183 -125
- package/src/duckdb/src/function/scalar/string/string_split.cpp +3 -3
- package/src/duckdb/src/function/scalar/string/substring.cpp +2 -6
- package/src/duckdb/src/function/scalar/string_functions.cpp +2 -0
- package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +9 -14
- package/src/duckdb/src/function/scalar/struct/struct_insert.cpp +12 -15
- package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +9 -10
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +12 -12
- package/src/duckdb/src/function/scalar/union/union_extract.cpp +4 -4
- package/src/duckdb/src/function/scalar/union/union_value.cpp +2 -2
- package/src/duckdb/src/function/scalar_macro_function.cpp +4 -4
- package/src/duckdb/src/function/table/arrow.cpp +17 -14
- package/src/duckdb/src/function/table/arrow_conversion.cpp +28 -4
- package/src/duckdb/src/function/table/checkpoint.cpp +12 -8
- package/src/duckdb/src/function/table/copy_csv.cpp +22 -18
- package/src/duckdb/src/function/table/glob.cpp +7 -12
- package/src/duckdb/src/function/table/pragma_detailed_profiling_output.cpp +15 -14
- package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +13 -11
- package/src/duckdb/src/function/table/range.cpp +10 -10
- package/src/duckdb/src/function/table/read_csv.cpp +318 -278
- package/src/duckdb/src/function/table/repeat.cpp +4 -4
- package/src/duckdb/src/function/table/summary.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +25 -25
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +21 -20
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +4 -4
- package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +13 -13
- package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +4 -4
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +3 -3
- package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +3 -3
- package/src/duckdb/src/function/table/system/duckdb_keywords.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +3 -3
- package/src/duckdb/src/function/table/system/duckdb_settings.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +4 -4
- package/src/duckdb/src/function/table/system/duckdb_temporary_files.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_views.cpp +2 -2
- package/src/duckdb/src/function/table/system/pragma_collations.cpp +2 -2
- package/src/duckdb/src/function/table/system/pragma_database_size.cpp +3 -3
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +9 -7
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +22 -23
- package/src/duckdb/src/function/table/system/test_all_types.cpp +6 -6
- package/src/duckdb/src/function/table/system/test_vector_types.cpp +6 -6
- package/src/duckdb/src/function/table/table_scan.cpp +55 -62
- package/src/duckdb/src/function/table/unnest.cpp +10 -10
- package/src/duckdb/src/function/table/version/pragma_version.cpp +6 -4
- package/src/duckdb/src/function/table_function.cpp +11 -11
- package/src/duckdb/src/function/table_macro_function.cpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +31 -12
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +3 -4
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +5 -5
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +3 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +3 -4
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +14 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry_map.hpp +38 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +5 -5
- package/src/duckdb/src/include/duckdb/catalog/catalog_transaction.hpp +4 -3
- package/src/duckdb/src/include/duckdb/catalog/default/default_functions.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/default/default_types.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/default/default_views.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/dependency.hpp +4 -5
- package/src/duckdb/src/include/duckdb/catalog/dependency_list.hpp +6 -4
- package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +10 -9
- package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/adbc/adbc-init.hpp +37 -0
- package/src/duckdb/src/include/duckdb/common/adbc/adbc.h +1088 -0
- package/src/duckdb/src/include/duckdb/common/adbc/adbc.hpp +85 -0
- package/src/duckdb/src/include/duckdb/common/adbc/driver_manager.h +84 -0
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/bit_utils.hpp +147 -0
- package/src/duckdb/src/include/duckdb/common/box_renderer.hpp +8 -2
- package/src/duckdb/src/include/duckdb/common/case_insensitive_map.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/common.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/compressed_file_system.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/constants.hpp +9 -29
- package/src/duckdb/src/include/duckdb/common/enums/aggregate_handling.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/enums/file_glob_options.hpp +20 -0
- package/src/duckdb/src/include/duckdb/common/enums/joinref_type.hpp +7 -4
- package/src/duckdb/src/include/duckdb/common/enums/logical_operator_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enums/order_preservation_type.hpp +24 -0
- package/src/duckdb/src/include/duckdb/common/enums/order_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enums/set_operation_type.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/exception.hpp +77 -5
- package/src/duckdb/src/include/duckdb/common/exception_format_value.hpp +6 -2
- package/src/duckdb/src/include/duckdb/common/fast_mem.hpp +528 -0
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +12 -4
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/filename_pattern.hpp +34 -0
- package/src/duckdb/src/include/duckdb/common/gzip_file_system.hpp +4 -1
- package/src/duckdb/src/include/duckdb/common/helper.hpp +70 -9
- package/src/duckdb/src/include/duckdb/common/hive_partitioning.hpp +16 -6
- package/src/duckdb/src/include/duckdb/common/{http_stats.hpp → http_state.hpp} +18 -4
- package/src/duckdb/src/include/duckdb/common/hugeint.hpp +63 -0
- package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +199 -0
- package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +28 -0
- package/src/duckdb/src/include/duckdb/common/operator/comparison_operators.hpp +45 -149
- package/src/duckdb/src/include/duckdb/common/operator/multiply.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +76 -0
- package/src/duckdb/src/include/duckdb/common/perfect_map_set.hpp +34 -0
- package/src/duckdb/src/include/duckdb/common/preserved_error.hpp +6 -1
- package/src/duckdb/src/include/duckdb/common/progress_bar/progress_bar.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/radix_partitioning.hpp +80 -27
- package/src/duckdb/src/include/duckdb/common/re2_regex.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/reference_map.hpp +38 -0
- package/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp +21 -9
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_deserializer.hpp +4 -2
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +9 -2
- package/src/duckdb/src/include/duckdb/common/serializer/enum_serializer.hpp +113 -0
- package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +373 -0
- package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +248 -0
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +109 -0
- package/src/duckdb/src/include/duckdb/common/serializer.hpp +13 -0
- package/src/duckdb/src/include/duckdb/common/shared_ptr.hpp +11 -0
- package/src/duckdb/src/include/duckdb/common/sort/comparators.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/sort/partition_state.hpp +247 -0
- package/src/duckdb/src/include/duckdb/common/sort/sort.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/sort/sorted_block.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +39 -0
- package/src/duckdb/src/include/duckdb/common/typedefs.hpp +31 -0
- package/src/duckdb/src/include/duckdb/common/types/batched_data_collection.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/bit.hpp +7 -6
- package/src/duckdb/src/include/duckdb/common/types/{column_data_allocator.hpp → column/column_data_allocator.hpp} +4 -4
- package/src/duckdb/src/include/duckdb/common/types/{column_data_collection.hpp → column/column_data_collection.hpp} +4 -4
- package/src/duckdb/src/include/duckdb/common/types/{column_data_collection_iterators.hpp → column/column_data_collection_iterators.hpp} +2 -2
- package/src/duckdb/src/include/duckdb/common/types/{column_data_collection_segment.hpp → column/column_data_collection_segment.hpp} +3 -3
- package/src/duckdb/src/include/duckdb/common/types/{column_data_consumer.hpp → column/column_data_consumer.hpp} +8 -4
- package/src/duckdb/src/include/duckdb/common/types/{column_data_scan_states.hpp → column/column_data_scan_states.hpp} +1 -1
- package/src/duckdb/src/include/duckdb/common/types/{partitioned_column_data.hpp → column/partitioned_column_data.hpp} +16 -8
- package/src/duckdb/src/include/duckdb/common/types/conflict_manager.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/types/interval.hpp +39 -3
- package/src/duckdb/src/include/duckdb/common/types/list_segment.hpp +62 -0
- package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +140 -0
- package/src/duckdb/src/include/duckdb/common/types/{row_data_collection.hpp → row/row_data_collection.hpp} +4 -3
- package/src/duckdb/src/include/duckdb/common/types/{row_data_collection_scanner.hpp → row/row_data_collection_scanner.hpp} +2 -2
- package/src/duckdb/src/include/duckdb/common/types/{row_layout.hpp → row/row_layout.hpp} +3 -1
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_allocator.hpp +116 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +239 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_iterator.hpp +64 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_layout.hpp +113 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_segment.hpp +124 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_states.hpp +74 -0
- package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +73 -3
- package/src/duckdb/src/include/duckdb/common/types/time.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +7 -1
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +20 -53
- package/src/duckdb/src/include/duckdb/common/types/value_map.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/types.hpp +43 -59
- package/src/duckdb/src/include/duckdb/common/union_by_name.hpp +17 -66
- package/src/duckdb/src/include/duckdb/common/unique_ptr.hpp +61 -0
- package/src/duckdb/src/include/duckdb/common/vector.hpp +45 -2
- package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/vector_operations/unary_executor.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +69 -47
- package/src/duckdb/src/include/duckdb/execution/base_aggregate_hashtable.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/execution_context.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +7 -7
- package/src/duckdb/src/include/duckdb/execution/expression_executor.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +4 -15
- package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +41 -67
- package/src/duckdb/src/include/duckdb/execution/nested_loop_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/aggregate_object.hpp +15 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +12 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +12 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_streaming_window.hpp +5 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +9 -0
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +9 -3
- package/src/duckdb/src/include/duckdb/execution/operator/filter/physical_filter.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_execute.hpp +6 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +8 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +8 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +4 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_result_collector.hpp +6 -3
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp +4 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_sample.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/outer_join_marker.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/perfect_hash_join_executor.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +13 -7
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +10 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_index_join.hpp +9 -7
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_join.hpp +11 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +3 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +5 -2
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +11 -1
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +10 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/base_csv_reader.hpp +15 -10
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/buffered_csv_reader.hpp +4 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_buffer.hpp +8 -3
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_file_handle.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +19 -15
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/parallel_csv_reader.hpp +5 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +11 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +12 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +8 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +18 -7
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_pivot.hpp +38 -0
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_projection.hpp +8 -0
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_tableinout_function.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_unnest.hpp +3 -1
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +11 -5
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_expression_scan.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +6 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +9 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +7 -0
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +9 -2
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_union.hpp +5 -1
- package/src/duckdb/src/include/duckdb/execution/partitionable_hashtable.hpp +7 -3
- package/src/duckdb/src/include/duckdb/execution/perfect_aggregate_hashtable.hpp +4 -0
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +37 -70
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +150 -0
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +2 -3
- package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +55 -5
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +21 -9
- package/src/duckdb/src/include/duckdb/function/cast/bound_cast_data.hpp +84 -0
- package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +42 -65
- package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +22 -0
- package/src/duckdb/src/include/duckdb/function/function.hpp +22 -4
- package/src/duckdb/src/include/duckdb/function/function_binder.hpp +3 -6
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/pragma_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp +4 -0
- package/src/duckdb/src/include/duckdb/function/scalar/list/contains_or_position.hpp +138 -0
- package/src/duckdb/src/include/duckdb/function/scalar/math_functions.hpp +12 -0
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +50 -3
- package/src/duckdb/src/include/duckdb/function/scalar/regexp.hpp +81 -1
- package/src/duckdb/src/include/duckdb/function/scalar/strftime.hpp +4 -0
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +8 -0
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +13 -2
- package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +13 -2
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +41 -6
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +30 -0
- package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +3 -3
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +10 -2
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +6 -3
- package/src/duckdb/src/include/duckdb/main/config.hpp +4 -6
- package/src/duckdb/src/include/duckdb/main/connection_manager.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +4 -3
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +5 -0
- package/src/duckdb/src/include/duckdb/main/materialized_query_result.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/prepared_statement.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +10 -9
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +18 -4
- package/src/duckdb/src/include/duckdb/main/relation/explain_relation.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/relation.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/settings.hpp +29 -0
- package/src/duckdb/src/include/duckdb/optimizer/expression_rewriter.hpp +3 -3
- package/src/duckdb/src/include/duckdb/optimizer/filter_combiner.hpp +9 -9
- package/src/duckdb/src/include/duckdb/optimizer/filter_pushdown.hpp +2 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +16 -16
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_node.hpp +8 -8
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_order_optimizer.hpp +23 -15
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_relation.hpp +9 -10
- package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph.hpp +18 -11
- package/src/duckdb/src/include/duckdb/optimizer/matcher/expression_matcher.hpp +11 -11
- package/src/duckdb/src/include/duckdb/optimizer/matcher/set_matcher.hpp +8 -8
- package/src/duckdb/src/include/duckdb/optimizer/rule/arithmetic_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/case_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/comparison_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/conjunction_simplification.hpp +2 -2
- package/src/duckdb/src/include/duckdb/optimizer/rule/constant_folding.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/date_part_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/distributivity.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/empty_needle_removal.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/enum_comparison.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/equal_or_null_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/in_clause_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/like_optimizations.hpp +2 -2
- package/src/duckdb/src/include/duckdb/optimizer/rule/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/optimizer/rule/move_constants.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/ordered_aggregate_optimizer.hpp +24 -0
- package/src/duckdb/src/include/duckdb/optimizer/rule/regex_optimizations.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parallel/concurrentqueue.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parallel/meta_pipeline.hpp +5 -5
- package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +19 -18
- package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/base_expression.hpp +19 -1
- package/src/duckdb/src/include/duckdb/parser/common_table_expression_info.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/constraint.hpp +18 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/check_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/foreign_key_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/not_null_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +6 -0
- package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +8 -0
- package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +6 -0
- package/src/duckdb/src/include/duckdb/parser/expression/default_expression.hpp +4 -0
- package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +7 -2
- package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +7 -2
- package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +10 -0
- package/src/duckdb/src/include/duckdb/parser/expression_map.hpp +19 -6
- package/src/duckdb/src/include/duckdb/parser/expression_util.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +6 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_database_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_schema_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +6 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/load_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/pragma_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/sample_options.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/show_select_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +4 -3
- package/src/duckdb/src/include/duckdb/parser/parsed_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/parser.hpp +1 -7
- package/src/duckdb/src/include/duckdb/parser/parser_options.hpp +23 -0
- package/src/duckdb/src/include/duckdb/parser/query_error_context.hpp +4 -2
- package/src/duckdb/src/include/duckdb/parser/query_node/list.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/query_node/recursive_cte_node.hpp +6 -0
- package/src/duckdb/src/include/duckdb/parser/query_node/select_node.hpp +8 -0
- package/src/duckdb/src/include/duckdb/parser/query_node/set_operation_node.hpp +6 -0
- package/src/duckdb/src/include/duckdb/parser/query_node.hpp +29 -1
- package/src/duckdb/src/include/duckdb/parser/result_modifier.hpp +24 -1
- package/src/duckdb/src/include/duckdb/parser/sql_statement.hpp +20 -1
- package/src/duckdb/src/include/duckdb/parser/statement/alter_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/attach_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/call_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/copy_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/create_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/delete_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/detach_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/drop_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/execute_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/explain_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/export_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/extension_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/insert_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/statement/load_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/logical_plan_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/multi_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/pragma_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/prepare_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/relation_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/select_statement.hpp +9 -1
- package/src/duckdb/src/include/duckdb/parser/statement/set_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/show_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/transaction_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/update_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/vacuum_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/basetableref.hpp +7 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/emptytableref.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/expressionlistref.hpp +6 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/joinref.hpp +6 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +27 -2
- package/src/duckdb/src/include/duckdb/parser/tableref/subqueryref.hpp +6 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/table_function_ref.hpp +6 -0
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +20 -1
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +24 -41
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +17 -16
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +38 -32
- package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +19 -1
- package/src/duckdb/src/include/duckdb/planner/bound_query_node.hpp +17 -0
- package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +8 -1
- package/src/duckdb/src/include/duckdb/planner/bound_tableref.hpp +17 -0
- package/src/duckdb/src/include/duckdb/planner/bound_tokens.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_check_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_foreign_key_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_not_null_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_unique_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_aggregate_expression.hpp +7 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_conjunction_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_constant_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +4 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_function_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_operator_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_reference_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_subquery_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_unnest_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_window_expression.hpp +4 -1
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +64 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder/having_binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/index_binder.hpp +4 -4
- package/src/duckdb/src/include/duckdb/planner/expression_binder/order_binder.hpp +7 -4
- package/src/duckdb/src/include/duckdb/planner/expression_binder/qualify_binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/select_binder.hpp +9 -38
- package/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/where_binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +6 -4
- package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +17 -0
- package/src/duckdb/src/include/duckdb/planner/logical_tokens.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_any_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_asof_join.hpp +27 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +4 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +8 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +6 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +6 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cross_product.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +15 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_empty_result.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_execute.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_export.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_extension_operator.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_filter.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_limit.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +36 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_positional_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_prepare.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +9 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_reset.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_sample.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_simple.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_unconditional_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator_extension.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_function_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_table_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/pragma_handler.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/query_node/bound_recursive_cte_node.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/query_node/bound_select_node.hpp +11 -2
- package/src/duckdb/src/include/duckdb/planner/query_node/bound_set_operation_node.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/query_node/list.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/table_binding.hpp +6 -5
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_basetableref.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_cteref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_dummytableref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_expressionlistref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_joinref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_pivotref.hpp +43 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_pos_join_ref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_subqueryref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_table_function.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +7 -0
- package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +16 -9
- package/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +80 -0
- package/src/duckdb/src/include/duckdb/storage/buffer/temporary_file_information.hpp +12 -0
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +49 -182
- package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/chimp128.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/chimp_utils.hpp +0 -97
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_analyze.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +6 -10
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/compression/patas/algorithm/patas.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_analyze.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +6 -10
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +4 -3
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +7 -5
- package/src/duckdb/src/include/duckdb/storage/index.hpp +20 -6
- package/src/duckdb/src/include/duckdb/storage/meta_block_reader.hpp +7 -0
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +159 -0
- package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +93 -31
- package/src/duckdb/src/include/duckdb/storage/statistics/column_statistics.hpp +22 -3
- package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +8 -6
- package/src/duckdb/src/include/duckdb/storage/statistics/list_stats.hpp +41 -0
- package/src/duckdb/src/include/duckdb/storage/statistics/node_statistics.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats.hpp +114 -0
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats_union.hpp +62 -0
- package/src/duckdb/src/include/duckdb/storage/statistics/segment_statistics.hpp +2 -7
- package/src/duckdb/src/include/duckdb/storage/statistics/string_stats.hpp +74 -0
- package/src/duckdb/src/include/duckdb/storage/statistics/struct_stats.hpp +42 -0
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +3 -4
- package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +21 -7
- package/src/duckdb/src/include/duckdb/storage/table/column_data_checkpointer.hpp +5 -3
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +7 -7
- package/src/duckdb/src/include/duckdb/storage/table/column_segment_tree.hpp +18 -0
- package/src/duckdb/src/include/duckdb/storage/table/persistent_table_data.hpp +6 -3
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +42 -46
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +24 -8
- package/src/duckdb/src/include/duckdb/storage/table/row_group_segment_tree.hpp +35 -0
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +19 -29
- package/src/duckdb/src/include/duckdb/storage/table/segment_base.hpp +6 -6
- package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +281 -26
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +0 -4
- package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/table_statistics.hpp +5 -0
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +4 -5
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +21 -21
- package/src/duckdb/src/include/duckdb/transaction/cleanup_state.hpp +3 -3
- package/src/duckdb/src/include/duckdb/transaction/commit_state.hpp +6 -6
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +3 -3
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +37 -33
- package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +6 -5
- package/src/duckdb/src/include/duckdb/transaction/transaction_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/transaction/undo_buffer.hpp +1 -1
- package/src/duckdb/src/include/duckdb.h +22 -1
- package/src/duckdb/src/main/appender.cpp +9 -9
- package/src/duckdb/src/main/attached_database.cpp +6 -7
- package/src/duckdb/src/main/capi/appender-c.cpp +1 -1
- package/src/duckdb/src/main/capi/duckdb-c.cpp +1 -1
- package/src/duckdb/src/main/capi/pending-c.cpp +4 -4
- package/src/duckdb/src/main/capi/replacement_scan-c.cpp +4 -4
- package/src/duckdb/src/main/capi/result-c.cpp +1 -1
- package/src/duckdb/src/main/capi/table_function-c.cpp +38 -15
- package/src/duckdb/src/main/capi/threading-c.cpp +1 -1
- package/src/duckdb/src/main/client_context.cpp +84 -85
- package/src/duckdb/src/main/client_data.cpp +11 -10
- package/src/duckdb/src/main/client_verify.cpp +2 -2
- package/src/duckdb/src/main/config.cpp +73 -1
- package/src/duckdb/src/main/connection.cpp +3 -3
- package/src/duckdb/src/main/database.cpp +29 -19
- package/src/duckdb/src/main/database_manager.cpp +6 -6
- package/src/duckdb/src/main/extension/extension_helper.cpp +18 -3
- package/src/duckdb/src/main/extension/extension_install.cpp +18 -2
- package/src/duckdb/src/main/extension/extension_load.cpp +30 -4
- package/src/duckdb/src/main/materialized_query_result.cpp +2 -2
- package/src/duckdb/src/main/pending_query_result.cpp +1 -1
- package/src/duckdb/src/main/prepared_statement.cpp +5 -1
- package/src/duckdb/src/main/query_profiler.cpp +48 -44
- package/src/duckdb/src/main/query_result.cpp +13 -0
- package/src/duckdb/src/main/relation/aggregate_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/create_table_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/create_view_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/cross_product_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/delete_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/explain_relation.cpp +4 -4
- package/src/duckdb/src/main/relation/filter_relation.cpp +4 -4
- package/src/duckdb/src/main/relation/insert_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/join_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/limit_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/order_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/projection_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/query_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/read_csv_relation.cpp +4 -2
- package/src/duckdb/src/main/relation/setop_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/table_function_relation.cpp +11 -11
- package/src/duckdb/src/main/relation/table_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/update_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/value_relation.cpp +4 -4
- package/src/duckdb/src/main/relation/view_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/write_csv_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/write_parquet_relation.cpp +1 -1
- package/src/duckdb/src/main/relation.cpp +8 -7
- package/src/duckdb/src/main/settings/settings.cpp +78 -15
- package/src/duckdb/src/main/stream_query_result.cpp +5 -5
- package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +4 -3
- package/src/duckdb/src/optimizer/common_aggregate_optimizer.cpp +3 -3
- package/src/duckdb/src/optimizer/cse_optimizer.cpp +9 -9
- package/src/duckdb/src/optimizer/deliminator.cpp +28 -27
- package/src/duckdb/src/optimizer/expression_heuristics.cpp +11 -11
- package/src/duckdb/src/optimizer/expression_rewriter.cpp +10 -10
- package/src/duckdb/src/optimizer/filter_combiner.cpp +139 -138
- package/src/duckdb/src/optimizer/filter_pullup.cpp +6 -4
- package/src/duckdb/src/optimizer/filter_pushdown.cpp +17 -11
- package/src/duckdb/src/optimizer/in_clause_rewriter.cpp +12 -12
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +102 -111
- package/src/duckdb/src/optimizer/join_order/join_node.cpp +8 -11
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +224 -213
- package/src/duckdb/src/optimizer/join_order/join_relation_set.cpp +30 -30
- package/src/duckdb/src/optimizer/join_order/query_graph.cpp +37 -38
- package/src/duckdb/src/optimizer/matcher/expression_matcher.cpp +28 -26
- package/src/duckdb/src/optimizer/optimizer.cpp +15 -14
- package/src/duckdb/src/optimizer/pullup/pullup_filter.cpp +1 -1
- package/src/duckdb/src/optimizer/pullup/pullup_from_left.cpp +2 -2
- package/src/duckdb/src/optimizer/pullup/pullup_projection.cpp +3 -3
- package/src/duckdb/src/optimizer/pullup/pullup_set_operation.cpp +3 -3
- package/src/duckdb/src/optimizer/pushdown/pushdown_aggregate.cpp +36 -8
- package/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp +1 -1
- package/src/duckdb/src/optimizer/pushdown/pushdown_filter.cpp +2 -2
- package/src/duckdb/src/optimizer/pushdown/pushdown_get.cpp +2 -2
- package/src/duckdb/src/optimizer/pushdown/pushdown_inner_join.cpp +9 -6
- package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +11 -18
- package/src/duckdb/src/optimizer/pushdown/pushdown_limit.cpp +2 -2
- package/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp +5 -5
- package/src/duckdb/src/optimizer/pushdown/pushdown_projection.cpp +4 -4
- package/src/duckdb/src/optimizer/pushdown/pushdown_set_operation.cpp +8 -8
- package/src/duckdb/src/optimizer/pushdown/pushdown_single_join.cpp +2 -2
- package/src/duckdb/src/optimizer/regex_range_filter.cpp +9 -9
- package/src/duckdb/src/optimizer/remove_unused_columns.cpp +17 -12
- package/src/duckdb/src/optimizer/rule/arithmetic_simplification.cpp +31 -30
- package/src/duckdb/src/optimizer/rule/case_simplification.cpp +10 -10
- package/src/duckdb/src/optimizer/rule/comparison_simplification.cpp +22 -23
- package/src/duckdb/src/optimizer/rule/conjunction_simplification.cpp +17 -16
- package/src/duckdb/src/optimizer/rule/constant_folding.cpp +9 -9
- package/src/duckdb/src/optimizer/rule/date_part_simplification.cpp +8 -8
- package/src/duckdb/src/optimizer/rule/distributivity.cpp +23 -23
- package/src/duckdb/src/optimizer/rule/empty_needle_removal.cpp +14 -15
- package/src/duckdb/src/optimizer/rule/enum_comparison.cpp +15 -16
- package/src/duckdb/src/optimizer/rule/equal_or_null_simplification.cpp +35 -38
- package/src/duckdb/src/optimizer/rule/in_clause_simplification_rule.cpp +16 -17
- package/src/duckdb/src/optimizer/rule/like_optimizations.cpp +22 -22
- package/src/duckdb/src/optimizer/rule/move_constants.cpp +46 -40
- package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +30 -0
- package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +25 -17
- package/src/duckdb/src/optimizer/statistics/expression/propagate_aggregate.cpp +9 -3
- package/src/duckdb/src/optimizer/statistics/expression/propagate_and_compress.cpp +9 -10
- package/src/duckdb/src/optimizer/statistics/expression/propagate_between.cpp +6 -6
- package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +14 -11
- package/src/duckdb/src/optimizer/statistics/expression/propagate_columnref.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +15 -17
- package/src/duckdb/src/optimizer/statistics/expression/propagate_conjunction.cpp +2 -3
- package/src/duckdb/src/optimizer/statistics/expression/propagate_constant.cpp +3 -75
- package/src/duckdb/src/optimizer/statistics/expression/propagate_function.cpp +7 -2
- package/src/duckdb/src/optimizer/statistics/expression/propagate_operator.cpp +12 -2
- package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +2 -3
- package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +40 -42
- package/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +9 -9
- package/src/duckdb/src/optimizer/statistics/operator/propagate_limit.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_set_operation.cpp +3 -3
- package/src/duckdb/src/optimizer/statistics_propagator.cpp +34 -22
- package/src/duckdb/src/optimizer/topn_optimizer.cpp +3 -3
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +16 -16
- package/src/duckdb/src/parallel/executor.cpp +59 -53
- package/src/duckdb/src/parallel/meta_pipeline.cpp +8 -15
- package/src/duckdb/src/parallel/pipeline.cpp +67 -35
- package/src/duckdb/src/parallel/pipeline_executor.cpp +23 -23
- package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +1 -1
- package/src/duckdb/src/parallel/task_scheduler.cpp +6 -6
- package/src/duckdb/src/parser/column_definition.cpp +6 -6
- package/src/duckdb/src/parser/common_table_expression_info.cpp +19 -0
- package/src/duckdb/src/parser/constraints/check_constraint.cpp +2 -2
- package/src/duckdb/src/parser/constraints/foreign_key_constraint.cpp +2 -2
- package/src/duckdb/src/parser/constraints/not_null_constraint.cpp +2 -2
- package/src/duckdb/src/parser/constraints/unique_constraint.cpp +4 -4
- package/src/duckdb/src/parser/expression/between_expression.cpp +19 -2
- package/src/duckdb/src/parser/expression/case_expression.cpp +30 -2
- package/src/duckdb/src/parser/expression/cast_expression.cpp +19 -2
- package/src/duckdb/src/parser/expression/collate_expression.cpp +18 -2
- package/src/duckdb/src/parser/expression/columnref_expression.cpp +19 -7
- package/src/duckdb/src/parser/expression/comparison_expression.cpp +18 -2
- package/src/duckdb/src/parser/expression/conjunction_expression.cpp +20 -3
- package/src/duckdb/src/parser/expression/constant_expression.cpp +17 -3
- package/src/duckdb/src/parser/expression/default_expression.cpp +9 -2
- package/src/duckdb/src/parser/expression/function_expression.cpp +42 -6
- package/src/duckdb/src/parser/expression/lambda_expression.cpp +18 -2
- package/src/duckdb/src/parser/expression/operator_expression.cpp +17 -2
- package/src/duckdb/src/parser/expression/parameter_expression.cpp +17 -2
- package/src/duckdb/src/parser/expression/positional_reference_expression.cpp +16 -2
- package/src/duckdb/src/parser/expression/star_expression.cpp +30 -8
- package/src/duckdb/src/parser/expression/subquery_expression.cpp +22 -2
- package/src/duckdb/src/parser/expression/window_expression.cpp +72 -2
- package/src/duckdb/src/parser/expression_util.cpp +6 -6
- package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/alter_table_function_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +27 -28
- package/src/duckdb/src/parser/parsed_data/create_aggregate_function_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/create_collation_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/create_copy_function_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_pragma_function_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +3 -3
- package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +3 -3
- package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +3 -3
- package/src/duckdb/src/parser/parsed_data/sample_options.cpp +24 -12
- package/src/duckdb/src/parser/parsed_expression.cpp +72 -0
- package/src/duckdb/src/parser/parsed_expression_iterator.cpp +26 -20
- package/src/duckdb/src/parser/parser.cpp +12 -12
- package/src/duckdb/src/parser/query_node/recursive_cte_node.cpp +27 -6
- package/src/duckdb/src/parser/query_node/select_node.cpp +43 -12
- package/src/duckdb/src/parser/query_node/set_operation_node.cpp +23 -6
- package/src/duckdb/src/parser/query_node.cpp +54 -4
- package/src/duckdb/src/parser/result_modifier.cpp +97 -8
- package/src/duckdb/src/parser/statement/copy_statement.cpp +1 -1
- package/src/duckdb/src/parser/statement/drop_statement.cpp +1 -1
- package/src/duckdb/src/parser/statement/extension_statement.cpp +1 -1
- package/src/duckdb/src/parser/statement/insert_statement.cpp +1 -1
- package/src/duckdb/src/parser/statement/pragma_statement.cpp +1 -1
- package/src/duckdb/src/parser/statement/select_statement.cpp +59 -3
- package/src/duckdb/src/parser/statement/show_statement.cpp +1 -1
- package/src/duckdb/src/parser/statement/transaction_statement.cpp +2 -2
- package/src/duckdb/src/parser/statement/vacuum_statement.cpp +1 -1
- package/src/duckdb/src/parser/tableref/basetableref.cpp +23 -2
- package/src/duckdb/src/parser/tableref/emptytableref.cpp +6 -2
- package/src/duckdb/src/parser/tableref/expressionlistref.cpp +19 -2
- package/src/duckdb/src/parser/tableref/joinref.cpp +31 -2
- package/src/duckdb/src/parser/tableref/pivotref.cpp +88 -11
- package/src/duckdb/src/parser/tableref/subqueryref.cpp +17 -2
- package/src/duckdb/src/parser/tableref/table_function.cpp +19 -2
- package/src/duckdb/src/parser/tableref.cpp +46 -0
- package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +7 -7
- package/src/duckdb/src/parser/transform/expression/transform_array_access.cpp +16 -5
- package/src/duckdb/src/parser/transform/expression/transform_bool_expr.cpp +6 -6
- package/src/duckdb/src/parser/transform/expression/transform_boolean_test.cpp +39 -0
- package/src/duckdb/src/parser/transform/expression/transform_case.cpp +3 -3
- package/src/duckdb/src/parser/transform/expression/transform_cast.cpp +2 -2
- package/src/duckdb/src/parser/transform/expression/transform_coalesce.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_columnref.cpp +19 -4
- package/src/duckdb/src/parser/transform/expression/transform_constant.cpp +7 -7
- package/src/duckdb/src/parser/transform/expression/transform_expression.cpp +5 -2
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +96 -119
- package/src/duckdb/src/parser/transform/expression/transform_grouping_function.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_interval.cpp +5 -5
- package/src/duckdb/src/parser/transform/expression/transform_lambda.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +29 -25
- package/src/duckdb/src/parser/transform/expression/transform_param_ref.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_positional_reference.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +11 -11
- package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +5 -5
- package/src/duckdb/src/parser/transform/helpers/transform_groupby.cpp +11 -4
- package/src/duckdb/src/parser/transform/helpers/transform_orderby.cpp +0 -7
- package/src/duckdb/src/parser/transform/helpers/transform_sample.cpp +1 -1
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +3 -2
- package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +3 -3
- package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +10 -10
- package/src/duckdb/src/parser/transform/statement/transform_attach.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_call.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_checkpoint.cpp +3 -3
- package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_database.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +4 -4
- package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +4 -4
- package/src/duckdb/src/parser/transform/statement/transform_create_schema.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_create_sequence.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +3 -3
- package/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_create_type.cpp +2 -3
- package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_delete.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_detach.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_explain.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_export.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_import.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_load.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +57 -25
- package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +7 -7
- package/src/duckdb/src/parser/transform/statement/transform_prepare.cpp +3 -3
- package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +7 -8
- package/src/duckdb/src/parser/transform/statement/transform_select.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +27 -28
- package/src/duckdb/src/parser/transform/statement/transform_set.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_show.cpp +5 -5
- package/src/duckdb/src/parser/transform/statement/transform_show_select.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_transaction.cpp +3 -3
- package/src/duckdb/src/parser/transform/statement/transform_update.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_upsert.cpp +3 -3
- package/src/duckdb/src/parser/transform/statement/transform_use.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_vacuum.cpp +1 -1
- package/src/duckdb/src/parser/transform/tableref/transform_base_tableref.cpp +1 -1
- package/src/duckdb/src/parser/transform/tableref/transform_from.cpp +3 -3
- package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +13 -2
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +23 -7
- package/src/duckdb/src/parser/transform/tableref/transform_subquery.cpp +2 -2
- package/src/duckdb/src/parser/transform/tableref/transform_table_function.cpp +1 -1
- package/src/duckdb/src/parser/transformer.cpp +54 -12
- package/src/duckdb/src/planner/bind_context.cpp +96 -96
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +14 -12
- package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +8 -8
- package/src/duckdb/src/planner/binder/expression/bind_case_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +59 -15
- package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +2 -2
- package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_constant_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +32 -22
- package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +12 -11
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +4 -4
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +15 -2
- package/src/duckdb/src/planner/binder/expression/bind_parameter_expression.cpp +2 -2
- package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +176 -0
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +8 -4
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +163 -24
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/query_node/bind_recursive_cte_node.cpp +1 -1
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +134 -133
- package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +18 -18
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +2 -2
- package/src/duckdb/src/planner/binder/query_node/plan_query_node.cpp +17 -6
- package/src/duckdb/src/planner/binder/query_node/plan_recursive_cte_node.cpp +4 -5
- package/src/duckdb/src/planner/binder/query_node/plan_select_node.cpp +20 -17
- package/src/duckdb/src/planner/binder/query_node/plan_setop.cpp +6 -7
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +29 -31
- package/src/duckdb/src/planner/binder/statement/bind_attach.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_call.cpp +3 -2
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +28 -16
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +49 -50
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +31 -23
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +9 -9
- package/src/duckdb/src/planner/binder/statement/bind_detach.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_execute.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_explain.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +25 -26
- package/src/duckdb/src/planner/binder/statement/bind_extension.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +39 -36
- package/src/duckdb/src/planner/binder/statement/bind_load.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_prepare.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_set.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_show.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_summarize.cpp +28 -28
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +27 -25
- package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +10 -9
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +37 -34
- package/src/duckdb/src/planner/binder/tableref/bind_emptytableref.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_expressionlistref.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +45 -27
- package/src/duckdb/src/planner/binder/tableref/bind_named_parameters.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +324 -98
- package/src/duckdb/src/planner/binder/tableref/bind_subqueryref.cpp +7 -7
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +37 -18
- package/src/duckdb/src/planner/binder/tableref/plan_cteref.cpp +2 -1
- package/src/duckdb/src/planner/binder/tableref/plan_dummytableref.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/plan_expressionlistref.cpp +2 -2
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +74 -26
- package/src/duckdb/src/planner/binder/tableref/plan_pivotref.cpp +13 -0
- package/src/duckdb/src/planner/binder.cpp +85 -94
- package/src/duckdb/src/planner/bound_result_modifier.cpp +27 -1
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +20 -13
- package/src/duckdb/src/planner/expression/bound_between_expression.cpp +9 -9
- package/src/duckdb/src/planner/expression/bound_case_expression.cpp +3 -3
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +8 -9
- package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_comparison_expression.cpp +5 -6
- package/src/duckdb/src/planner/expression/bound_conjunction_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_constant_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_expression.cpp +4 -0
- package/src/duckdb/src/planner/expression/bound_function_expression.cpp +8 -8
- package/src/duckdb/src/planner/expression/bound_lambda_expression.cpp +5 -5
- package/src/duckdb/src/planner/expression/bound_lambdaref_expression.cpp +5 -5
- package/src/duckdb/src/planner/expression/bound_operator_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +5 -5
- package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_unnest_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +21 -22
- package/src/duckdb/src/planner/expression_binder/alter_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +146 -0
- package/src/duckdb/src/planner/expression_binder/check_binder.cpp +3 -3
- package/src/duckdb/src/planner/expression_binder/constant_binder.cpp +11 -1
- package/src/duckdb/src/planner/expression_binder/group_binder.cpp +4 -4
- package/src/duckdb/src/planner/expression_binder/having_binder.cpp +7 -4
- package/src/duckdb/src/planner/expression_binder/index_binder.cpp +4 -3
- package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +3 -3
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +8 -8
- package/src/duckdb/src/planner/expression_binder/qualify_binder.cpp +5 -4
- package/src/duckdb/src/planner/expression_binder/select_binder.cpp +1 -132
- package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +8 -4
- package/src/duckdb/src/planner/expression_binder/where_binder.cpp +3 -2
- package/src/duckdb/src/planner/expression_binder.cpp +41 -42
- package/src/duckdb/src/planner/expression_iterator.cpp +34 -27
- package/src/duckdb/src/planner/filter/conjunction_filter.cpp +2 -2
- package/src/duckdb/src/planner/filter/constant_filter.cpp +5 -7
- package/src/duckdb/src/planner/filter/null_filter.cpp +2 -2
- package/src/duckdb/src/planner/joinside.cpp +5 -5
- package/src/duckdb/src/planner/logical_operator.cpp +10 -2
- package/src/duckdb/src/planner/logical_operator_visitor.cpp +32 -26
- package/src/duckdb/src/planner/operator/logical_aggregate.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_any_join.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_asof_join.cpp +14 -0
- package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +3 -3
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +4 -4
- package/src/duckdb/src/planner/operator/logical_create.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_create_table.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_cross_product.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_cteref.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_delete.cpp +5 -5
- package/src/duckdb/src/planner/operator/logical_delim_get.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_delim_join.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_distinct.cpp +6 -1
- package/src/duckdb/src/planner/operator/logical_dummy_scan.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_expression_get.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_filter.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_get.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_insert.cpp +6 -7
- package/src/duckdb/src/planner/operator/logical_join.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_limit.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_limit_percent.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_order.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_pivot.cpp +35 -0
- package/src/duckdb/src/planner/operator/logical_positional_join.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_projection.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_reset.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_sample.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_set.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_simple.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_top_n.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_unnest.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_update.cpp +6 -7
- package/src/duckdb/src/planner/operator/logical_window.cpp +1 -1
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +4 -5
- package/src/duckdb/src/planner/planner.cpp +2 -1
- package/src/duckdb/src/planner/pragma_handler.cpp +9 -7
- package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +64 -60
- package/src/duckdb/src/planner/subquery/rewrite_correlated_expressions.cpp +5 -6
- package/src/duckdb/src/planner/table_binding.cpp +18 -17
- package/src/duckdb/src/planner/table_filter.cpp +2 -2
- package/src/duckdb/src/storage/arena_allocator.cpp +34 -2
- package/src/duckdb/src/storage/buffer/block_handle.cpp +129 -0
- package/src/duckdb/src/storage/buffer/block_manager.cpp +83 -0
- package/src/duckdb/src/storage/buffer/buffer_handle.cpp +1 -0
- package/src/duckdb/src/storage/buffer/buffer_pool.cpp +136 -0
- package/src/duckdb/src/storage/buffer/buffer_pool_reservation.cpp +35 -0
- package/src/duckdb/src/storage/buffer_manager.cpp +35 -1077
- package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +1 -1
- package/src/duckdb/src/storage/checkpoint/table_data_reader.cpp +5 -16
- package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +13 -7
- package/src/duckdb/src/storage/checkpoint_manager.cpp +38 -32
- package/src/duckdb/src/storage/compression/bitpacking.cpp +12 -13
- package/src/duckdb/src/storage/compression/dictionary_compression.cpp +11 -12
- package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +9 -8
- package/src/duckdb/src/storage/compression/fsst.cpp +12 -14
- package/src/duckdb/src/storage/compression/numeric_constant.cpp +10 -11
- package/src/duckdb/src/storage/compression/patas.cpp +1 -1
- package/src/duckdb/src/storage/compression/rle.cpp +10 -11
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +6 -6
- package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +9 -9
- package/src/duckdb/src/storage/data_table.cpp +50 -50
- package/src/duckdb/src/storage/index.cpp +17 -7
- package/src/duckdb/src/storage/local_storage.cpp +98 -91
- package/src/duckdb/src/storage/meta_block_reader.cpp +23 -0
- package/src/duckdb/src/storage/single_file_block_manager.cpp +2 -2
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +801 -0
- package/src/duckdb/src/storage/statistics/base_statistics.cpp +373 -128
- package/src/duckdb/src/storage/statistics/column_statistics.cpp +57 -3
- package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +10 -11
- package/src/duckdb/src/storage/statistics/list_stats.cpp +121 -0
- package/src/duckdb/src/storage/statistics/numeric_stats.cpp +591 -0
- package/src/duckdb/src/storage/statistics/numeric_stats_union.cpp +65 -0
- package/src/duckdb/src/storage/statistics/segment_statistics.cpp +2 -11
- package/src/duckdb/src/storage/statistics/string_stats.cpp +273 -0
- package/src/duckdb/src/storage/statistics/struct_stats.cpp +133 -0
- package/src/duckdb/src/storage/storage_info.cpp +2 -2
- package/src/duckdb/src/storage/storage_lock.cpp +2 -2
- package/src/duckdb/src/storage/storage_manager.cpp +20 -21
- package/src/duckdb/src/storage/table/chunk_info.cpp +2 -2
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +7 -13
- package/src/duckdb/src/storage/table/column_data.cpp +123 -70
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +28 -15
- package/src/duckdb/src/storage/table/column_segment.cpp +55 -71
- package/src/duckdb/src/storage/table/list_column_data.cpp +21 -27
- package/src/duckdb/src/storage/table/persistent_table_data.cpp +2 -1
- package/src/duckdb/src/storage/table/row_group.cpp +222 -152
- package/src/duckdb/src/storage/table/row_group_collection.cpp +154 -108
- package/src/duckdb/src/storage/table/scan_state.cpp +46 -34
- package/src/duckdb/src/storage/table/standard_column_data.cpp +13 -14
- package/src/duckdb/src/storage/table/struct_column_data.cpp +30 -37
- package/src/duckdb/src/storage/table/table_statistics.cpp +28 -8
- package/src/duckdb/src/storage/table/update_segment.cpp +41 -36
- package/src/duckdb/src/storage/table_index_list.cpp +3 -3
- package/src/duckdb/src/storage/wal_replay.cpp +11 -8
- package/src/duckdb/src/storage/write_ahead_log.cpp +47 -47
- package/src/duckdb/src/transaction/cleanup_state.cpp +10 -10
- package/src/duckdb/src/transaction/commit_state.cpp +66 -62
- package/src/duckdb/src/transaction/duck_transaction.cpp +9 -9
- package/src/duckdb/src/transaction/duck_transaction_manager.cpp +4 -4
- package/src/duckdb/src/transaction/meta_transaction.cpp +13 -13
- package/src/duckdb/src/transaction/rollback_state.cpp +2 -2
- package/src/duckdb/src/transaction/transaction.cpp +1 -1
- package/src/duckdb/src/transaction/transaction_context.cpp +2 -2
- package/src/duckdb/src/transaction/undo_buffer.cpp +2 -1
- package/src/duckdb/src/verification/copied_statement_verifier.cpp +1 -1
- package/src/duckdb/src/verification/deserialized_statement_verifier.cpp +2 -3
- package/src/duckdb/src/verification/external_statement_verifier.cpp +1 -1
- package/src/duckdb/src/verification/parsed_statement_verifier.cpp +1 -1
- package/src/duckdb/src/verification/prepared_statement_verifier.cpp +7 -7
- package/src/duckdb/src/verification/statement_verifier.cpp +3 -3
- package/src/duckdb/src/verification/unoptimized_statement_verifier.cpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +32 -0
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +2 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/primnodes.hpp +3 -3
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +949 -961
- package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +4 -11
- package/src/duckdb/third_party/libpg_query/include/postgres_parser.hpp +3 -2
- package/src/duckdb/third_party/libpg_query/postgres_parser.cpp +5 -6
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +18328 -17747
- package/src/duckdb/third_party/libpg_query/src_backend_parser_scan.cpp +503 -493
- package/src/duckdb/third_party/parquet/parquet_types.cpp +32 -32
- package/src/duckdb/third_party/parquet/parquet_types.h +34 -32
- package/src/duckdb/third_party/re2/re2/re2.cc +9 -0
- package/src/duckdb/third_party/re2/re2/re2.h +2 -0
- package/src/duckdb/third_party/thrift/thrift/TToString.h +3 -3
- package/src/duckdb/third_party/thrift/thrift/protocol/TProtocol.h +1 -1
- package/src/duckdb/third_party/thrift/thrift/protocol/TProtocolDecorator.h +2 -1
- package/src/duckdb/third_party/thrift/thrift/protocol/TVirtualProtocol.h +5 -4
- package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +5 -5
- package/src/duckdb/ub_extension_json_json_functions.cpp +2 -0
- package/src/duckdb/ub_src_common.cpp +6 -0
- package/src/duckdb/ub_src_common_adbc.cpp +4 -0
- package/src/duckdb/ub_src_common_serializer.cpp +2 -0
- package/src/duckdb/ub_src_common_sort.cpp +2 -0
- package/src/duckdb/ub_src_common_types.cpp +1 -15
- package/src/duckdb/ub_src_common_types_column.cpp +10 -0
- package/src/duckdb/ub_src_common_types_row.cpp +20 -0
- package/src/duckdb/ub_src_execution_operator_projection.cpp +2 -0
- package/src/duckdb/ub_src_execution_physical_plan.cpp +4 -0
- package/src/duckdb/ub_src_function_scalar_generic.cpp +2 -0
- package/src/duckdb/ub_src_function_scalar_string.cpp +4 -0
- package/src/duckdb/ub_src_function_scalar_string_regexp.cpp +4 -0
- package/src/duckdb/ub_src_optimizer_rule.cpp +2 -0
- package/src/duckdb/ub_src_parser.cpp +2 -0
- package/src/duckdb/ub_src_parser_transform_expression.cpp +2 -0
- package/src/duckdb/ub_src_planner_binder_expression.cpp +2 -0
- package/src/duckdb/ub_src_planner_binder_tableref.cpp +2 -0
- package/src/duckdb/ub_src_planner_expression_binder.cpp +2 -0
- package/src/duckdb/ub_src_planner_operator.cpp +4 -0
- package/src/duckdb/ub_src_storage.cpp +2 -0
- package/src/duckdb/ub_src_storage_buffer.cpp +8 -0
- package/src/duckdb/ub_src_storage_statistics.cpp +6 -6
- package/src/duckdb/ub_src_storage_table.cpp +0 -2
- package/src/duckdb_node.hpp +15 -10
- package/src/statement.cpp +28 -24
- package/src/utils.cpp +27 -2
- package/test/extension.test.ts +44 -26
- package/test/syntax_error.test.ts +3 -1
- package/test/udf.test.ts +9 -0
- package/filelist.cache +0 -0
- package/src/duckdb/extension/parquet/include/generated_column_reader.hpp +0 -65
- package/src/duckdb/src/include/duckdb/common/single_thread_ptr.hpp +0 -183
- package/src/duckdb/src/include/duckdb/storage/statistics/list_statistics.hpp +0 -36
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_statistics.hpp +0 -75
- package/src/duckdb/src/include/duckdb/storage/statistics/string_statistics.hpp +0 -49
- package/src/duckdb/src/include/duckdb/storage/statistics/struct_statistics.hpp +0 -36
- package/src/duckdb/src/include/duckdb/storage/statistics/validity_statistics.hpp +0 -45
- package/src/duckdb/src/storage/statistics/list_statistics.cpp +0 -94
- package/src/duckdb/src/storage/statistics/numeric_statistics.cpp +0 -307
- package/src/duckdb/src/storage/statistics/string_statistics.cpp +0 -220
- package/src/duckdb/src/storage/statistics/struct_statistics.cpp +0 -108
- package/src/duckdb/src/storage/statistics/validity_statistics.cpp +0 -91
- package/src/duckdb/src/storage/table/segment_tree.cpp +0 -179
@@ -3,9 +3,10 @@
|
|
3
3
|
#include "duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp"
|
4
4
|
#include "duckdb/common/algorithm.hpp"
|
5
5
|
#include "duckdb/common/exception.hpp"
|
6
|
+
#include "duckdb/common/radix_partitioning.hpp"
|
6
7
|
#include "duckdb/common/row_operations/row_operations.hpp"
|
7
8
|
#include "duckdb/common/types/null_value.hpp"
|
8
|
-
#include "duckdb/common/types/
|
9
|
+
#include "duckdb/common/types/row/tuple_data_iterator.hpp"
|
9
10
|
#include "duckdb/common/vector_operations/unary_executor.hpp"
|
10
11
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
11
12
|
#include "duckdb/execution/expression_executor.hpp"
|
@@ -16,14 +17,14 @@
|
|
16
17
|
|
17
18
|
namespace duckdb {
|
18
19
|
|
19
|
-
using ValidityBytes =
|
20
|
+
using ValidityBytes = TupleDataLayout::ValidityBytes;
|
20
21
|
|
21
22
|
GroupedAggregateHashTable::GroupedAggregateHashTable(ClientContext &context, Allocator &allocator,
|
22
23
|
vector<LogicalType> group_types, vector<LogicalType> payload_types,
|
23
24
|
const vector<BoundAggregateExpression *> &bindings,
|
24
|
-
HtEntryType entry_type)
|
25
|
+
HtEntryType entry_type, idx_t initial_capacity)
|
25
26
|
: GroupedAggregateHashTable(context, allocator, std::move(group_types), std::move(payload_types),
|
26
|
-
AggregateObject::CreateAggregateObjects(bindings), entry_type) {
|
27
|
+
AggregateObject::CreateAggregateObjects(bindings), entry_type, initial_capacity) {
|
27
28
|
}
|
28
29
|
|
29
30
|
GroupedAggregateHashTable::GroupedAggregateHashTable(ClientContext &context, Allocator &allocator,
|
@@ -31,40 +32,44 @@ GroupedAggregateHashTable::GroupedAggregateHashTable(ClientContext &context, All
|
|
31
32
|
: GroupedAggregateHashTable(context, allocator, std::move(group_types), {}, vector<AggregateObject>()) {
|
32
33
|
}
|
33
34
|
|
35
|
+
AggregateHTAppendState::AggregateHTAppendState()
|
36
|
+
: ht_offsets(LogicalTypeId::BIGINT), hash_salts(LogicalTypeId::SMALLINT),
|
37
|
+
group_compare_vector(STANDARD_VECTOR_SIZE), no_match_vector(STANDARD_VECTOR_SIZE),
|
38
|
+
empty_vector(STANDARD_VECTOR_SIZE), new_groups(STANDARD_VECTOR_SIZE), addresses(LogicalType::POINTER),
|
39
|
+
chunk_state_initialized(false) {
|
40
|
+
}
|
41
|
+
|
34
42
|
GroupedAggregateHashTable::GroupedAggregateHashTable(ClientContext &context, Allocator &allocator,
|
35
43
|
vector<LogicalType> group_types_p,
|
36
44
|
vector<LogicalType> payload_types_p,
|
37
45
|
vector<AggregateObject> aggregate_objects_p,
|
38
|
-
HtEntryType entry_type)
|
46
|
+
HtEntryType entry_type, idx_t initial_capacity)
|
39
47
|
: BaseAggregateHashTable(context, allocator, aggregate_objects_p, std::move(payload_types_p)),
|
40
|
-
entry_type(entry_type), capacity(0),
|
41
|
-
|
42
|
-
group_compare_vector(STANDARD_VECTOR_SIZE), no_match_vector(STANDARD_VECTOR_SIZE),
|
43
|
-
empty_vector(STANDARD_VECTOR_SIZE) {
|
44
|
-
|
48
|
+
entry_type(entry_type), capacity(0), is_finalized(false),
|
49
|
+
aggregate_allocator(make_shared<ArenaAllocator>(allocator)) {
|
45
50
|
// Append hash column to the end and initialise the row layout
|
46
51
|
group_types_p.emplace_back(LogicalType::HASH);
|
47
52
|
layout.Initialize(std::move(group_types_p), std::move(aggregate_objects_p));
|
53
|
+
tuple_size = layout.GetRowWidth();
|
54
|
+
tuples_per_block = Storage::BLOCK_SIZE / tuple_size;
|
48
55
|
|
49
56
|
// HT layout
|
50
57
|
hash_offset = layout.GetOffsets()[layout.ColumnCount() - 1];
|
58
|
+
data_collection = make_uniq<TupleDataCollection>(buffer_manager, layout);
|
59
|
+
data_collection->InitializeAppend(td_pin_state, TupleDataPinProperties::KEEP_EVERYTHING_PINNED);
|
51
60
|
|
52
|
-
tuple_size = layout.GetRowWidth();
|
53
|
-
|
54
|
-
D_ASSERT(tuple_size <= Storage::BLOCK_SIZE);
|
55
|
-
tuples_per_block = Storage::BLOCK_SIZE / tuple_size;
|
56
61
|
hashes_hdl = buffer_manager.Allocate(Storage::BLOCK_SIZE);
|
57
62
|
hashes_hdl_ptr = hashes_hdl.Ptr();
|
58
63
|
|
59
64
|
switch (entry_type) {
|
60
65
|
case HtEntryType::HT_WIDTH_64: {
|
61
66
|
hash_prefix_shift = (HASH_WIDTH - sizeof(aggr_ht_entry_64::salt)) * 8;
|
62
|
-
Resize<aggr_ht_entry_64>(
|
67
|
+
Resize<aggr_ht_entry_64>(initial_capacity);
|
63
68
|
break;
|
64
69
|
}
|
65
70
|
case HtEntryType::HT_WIDTH_32: {
|
66
71
|
hash_prefix_shift = (HASH_WIDTH - sizeof(aggr_ht_entry_32::salt)) * 8;
|
67
|
-
Resize<aggr_ht_entry_32>(
|
72
|
+
Resize<aggr_ht_entry_32>(initial_capacity);
|
68
73
|
break;
|
69
74
|
}
|
70
75
|
default:
|
@@ -72,44 +77,18 @@ GroupedAggregateHashTable::GroupedAggregateHashTable(ClientContext &context, All
|
|
72
77
|
}
|
73
78
|
|
74
79
|
predicates.resize(layout.ColumnCount() - 1, ExpressionType::COMPARE_EQUAL);
|
75
|
-
string_heap = make_unique<RowDataCollection>(buffer_manager, (idx_t)Storage::BLOCK_SIZE, 1, true);
|
76
80
|
}
|
77
81
|
|
78
82
|
GroupedAggregateHashTable::~GroupedAggregateHashTable() {
|
79
83
|
Destroy();
|
80
84
|
}
|
81
85
|
|
82
|
-
|
83
|
-
|
84
|
-
if (entries == 0) {
|
86
|
+
void GroupedAggregateHashTable::Destroy() {
|
87
|
+
if (data_collection->Count() == 0) {
|
85
88
|
return;
|
86
89
|
}
|
87
|
-
idx_t apply_entries = entries;
|
88
|
-
idx_t page_nr = 0;
|
89
|
-
idx_t page_offset = 0;
|
90
|
-
|
91
|
-
for (auto &payload_chunk_ptr : payload_hds_ptrs) {
|
92
|
-
auto this_entries = MinValue(tuples_per_block, apply_entries);
|
93
|
-
page_offset = 0;
|
94
|
-
for (data_ptr_t ptr = payload_chunk_ptr, end = payload_chunk_ptr + this_entries * tuple_size; ptr < end;
|
95
|
-
ptr += tuple_size) {
|
96
|
-
fun(page_nr, page_offset++, ptr);
|
97
|
-
}
|
98
|
-
apply_entries -= this_entries;
|
99
|
-
page_nr++;
|
100
|
-
}
|
101
|
-
D_ASSERT(apply_entries == 0);
|
102
|
-
}
|
103
|
-
|
104
|
-
void GroupedAggregateHashTable::NewBlock() {
|
105
|
-
auto pin = buffer_manager.Allocate(Storage::BLOCK_SIZE);
|
106
|
-
payload_hds.push_back(std::move(pin));
|
107
|
-
payload_hds_ptrs.push_back(payload_hds.back().Ptr());
|
108
|
-
payload_page_offset = 0;
|
109
|
-
}
|
110
90
|
|
111
|
-
|
112
|
-
// check if there is a destructor
|
91
|
+
// Check if there is an aggregate with a destructor
|
113
92
|
bool has_destructor = false;
|
114
93
|
for (auto &aggr : layout.GetAggregates()) {
|
115
94
|
if (aggr.function.destructor) {
|
@@ -119,31 +98,25 @@ void GroupedAggregateHashTable::Destroy() {
|
|
119
98
|
if (!has_destructor) {
|
120
99
|
return;
|
121
100
|
}
|
122
|
-
// there are aggregates with destructors: loop over the hash table
|
123
|
-
// and call the destructor method for each of the aggregates
|
124
|
-
data_ptr_t data_pointers[STANDARD_VECTOR_SIZE];
|
125
|
-
Vector state_vector(LogicalType::POINTER, (data_ptr_t)data_pointers);
|
126
|
-
idx_t count = 0;
|
127
101
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
});
|
135
|
-
|
102
|
+
// There are aggregates with destructors: Call the destructor for each of the aggregates
|
103
|
+
RowOperationsState state(aggregate_allocator->GetAllocator());
|
104
|
+
TupleDataChunkIterator iterator(*data_collection, TupleDataPinProperties::DESTROY_AFTER_DONE, false);
|
105
|
+
auto &row_locations = iterator.GetChunkState().row_locations;
|
106
|
+
do {
|
107
|
+
RowOperations::DestroyStates(state, layout, row_locations, iterator.GetCurrentChunkCount());
|
108
|
+
} while (iterator.Next());
|
109
|
+
data_collection->Reset();
|
136
110
|
}
|
137
111
|
|
138
112
|
template <class ENTRY>
|
139
113
|
void GroupedAggregateHashTable::VerifyInternal() {
|
140
114
|
auto hashes_ptr = (ENTRY *)hashes_hdl_ptr;
|
141
|
-
D_ASSERT(payload_hds.size() == payload_hds_ptrs.size());
|
142
115
|
idx_t count = 0;
|
143
116
|
for (idx_t i = 0; i < capacity; i++) {
|
144
117
|
if (hashes_ptr[i].page_nr > 0) {
|
145
118
|
D_ASSERT(hashes_ptr[i].page_offset < tuples_per_block);
|
146
|
-
D_ASSERT(hashes_ptr[i].page_nr <=
|
119
|
+
D_ASSERT(hashes_ptr[i].page_nr <= payload_hds_ptrs.size());
|
147
120
|
auto ptr = payload_hds_ptrs[hashes_ptr[i].page_nr - 1] + ((hashes_ptr[i].page_offset) * tuple_size);
|
148
121
|
auto hash = Load<hash_t>(ptr + hash_offset);
|
149
122
|
D_ASSERT((hashes_ptr[i].salt) == (hash >> hash_prefix_shift));
|
@@ -152,28 +125,37 @@ void GroupedAggregateHashTable::VerifyInternal() {
|
|
152
125
|
}
|
153
126
|
}
|
154
127
|
(void)count;
|
155
|
-
D_ASSERT(count ==
|
128
|
+
D_ASSERT(count == Count());
|
156
129
|
}
|
157
130
|
|
158
|
-
idx_t GroupedAggregateHashTable::
|
159
|
-
|
160
|
-
|
131
|
+
idx_t GroupedAggregateHashTable::InitialCapacity() {
|
132
|
+
return STANDARD_VECTOR_SIZE * 2ULL;
|
133
|
+
}
|
134
|
+
|
135
|
+
idx_t GroupedAggregateHashTable::GetMaxCapacity(HtEntryType entry_type, idx_t tuple_size) {
|
136
|
+
idx_t max_pages;
|
137
|
+
idx_t max_tuples;
|
161
138
|
|
162
139
|
switch (entry_type) {
|
163
140
|
case HtEntryType::HT_WIDTH_32:
|
164
141
|
max_pages = NumericLimits<uint8_t>::Maximum();
|
165
142
|
max_tuples = NumericLimits<uint16_t>::Maximum();
|
166
143
|
break;
|
167
|
-
|
168
|
-
D_ASSERT(entry_type == HtEntryType::HT_WIDTH_64);
|
144
|
+
case HtEntryType::HT_WIDTH_64:
|
169
145
|
max_pages = NumericLimits<uint32_t>::Maximum();
|
170
146
|
max_tuples = NumericLimits<uint16_t>::Maximum();
|
171
147
|
break;
|
148
|
+
default:
|
149
|
+
throw InternalException("Unsupported hash table width");
|
172
150
|
}
|
173
151
|
|
174
152
|
return max_pages * MinValue(max_tuples, (idx_t)Storage::BLOCK_SIZE / tuple_size);
|
175
153
|
}
|
176
154
|
|
155
|
+
idx_t GroupedAggregateHashTable::MaxCapacity() {
|
156
|
+
return GetMaxCapacity(entry_type, tuple_size);
|
157
|
+
}
|
158
|
+
|
177
159
|
void GroupedAggregateHashTable::Verify() {
|
178
160
|
#ifdef DEBUG
|
179
161
|
switch (entry_type) {
|
@@ -189,53 +171,71 @@ void GroupedAggregateHashTable::Verify() {
|
|
189
171
|
|
190
172
|
template <class ENTRY>
|
191
173
|
void GroupedAggregateHashTable::Resize(idx_t size) {
|
192
|
-
Verify();
|
193
|
-
|
194
174
|
D_ASSERT(!is_finalized);
|
175
|
+
D_ASSERT(size >= STANDARD_VECTOR_SIZE);
|
176
|
+
D_ASSERT(IsPowerOfTwo(size));
|
195
177
|
|
196
|
-
if (size
|
178
|
+
if (size < capacity) {
|
197
179
|
throw InternalException("Cannot downsize a hash table!");
|
198
180
|
}
|
199
|
-
|
200
|
-
|
201
|
-
// size needs to be a power of 2
|
202
|
-
D_ASSERT((size & (size - 1)) == 0);
|
203
|
-
bitmask = size - 1;
|
181
|
+
capacity = size;
|
204
182
|
|
205
|
-
|
183
|
+
bitmask = capacity - 1;
|
184
|
+
const auto byte_size = capacity * sizeof(ENTRY);
|
206
185
|
if (byte_size > (idx_t)Storage::BLOCK_SIZE) {
|
207
186
|
hashes_hdl = buffer_manager.Allocate(byte_size);
|
208
187
|
hashes_hdl_ptr = hashes_hdl.Ptr();
|
209
188
|
}
|
210
189
|
memset(hashes_hdl_ptr, 0, byte_size);
|
211
|
-
hashes_end_ptr = hashes_hdl_ptr + byte_size;
|
212
|
-
capacity = size;
|
213
190
|
|
214
|
-
|
191
|
+
if (Count() != 0) {
|
192
|
+
D_ASSERT(!payload_hds_ptrs.empty());
|
193
|
+
auto hashes_arr = (ENTRY *)hashes_hdl_ptr;
|
194
|
+
|
195
|
+
idx_t block_id = 0;
|
196
|
+
auto block_pointer = payload_hds_ptrs[block_id];
|
197
|
+
auto block_end = block_pointer + tuples_per_block * tuple_size;
|
198
|
+
|
199
|
+
TupleDataChunkIterator iterator(*data_collection, TupleDataPinProperties::ALREADY_PINNED, false);
|
200
|
+
const auto row_locations = iterator.GetRowLocations();
|
201
|
+
do {
|
202
|
+
for (idx_t i = 0; i < iterator.GetCurrentChunkCount(); i++) {
|
203
|
+
const auto &row_location = row_locations[i];
|
204
|
+
if (row_location > block_end || row_location < block_pointer) {
|
205
|
+
block_id++;
|
206
|
+
D_ASSERT(block_id < payload_hds_ptrs.size());
|
207
|
+
block_pointer = payload_hds_ptrs[block_id];
|
208
|
+
block_end = block_pointer + tuples_per_block * tuple_size;
|
209
|
+
}
|
210
|
+
D_ASSERT(row_location >= block_pointer && row_location < block_end);
|
211
|
+
D_ASSERT((row_location - block_pointer) % tuple_size == 0);
|
212
|
+
|
213
|
+
const auto hash = Load<hash_t>(row_location + hash_offset);
|
214
|
+
D_ASSERT((hash & bitmask) == (hash % capacity));
|
215
|
+
D_ASSERT(hash >> hash_prefix_shift <= NumericLimits<uint16_t>::Maximum());
|
216
|
+
|
217
|
+
auto entry_idx = (idx_t)hash & bitmask;
|
218
|
+
while (hashes_arr[entry_idx].page_nr > 0) {
|
219
|
+
entry_idx++;
|
220
|
+
if (entry_idx >= capacity) {
|
221
|
+
entry_idx = 0;
|
222
|
+
}
|
223
|
+
}
|
215
224
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
entry_idx++;
|
222
|
-
if (entry_idx >= capacity) {
|
223
|
-
entry_idx = 0;
|
225
|
+
auto &ht_entry = hashes_arr[entry_idx];
|
226
|
+
D_ASSERT(!ht_entry.page_nr);
|
227
|
+
ht_entry.salt = hash >> hash_prefix_shift;
|
228
|
+
ht_entry.page_nr = block_id + 1;
|
229
|
+
ht_entry.page_offset = (row_location - block_pointer) / tuple_size;
|
224
230
|
}
|
225
|
-
}
|
226
|
-
|
227
|
-
D_ASSERT(!hashes_arr[entry_idx].page_nr);
|
228
|
-
D_ASSERT(hash >> hash_prefix_shift <= NumericLimits<uint16_t>::Maximum());
|
229
|
-
|
230
|
-
hashes_arr[entry_idx].salt = hash >> hash_prefix_shift;
|
231
|
-
hashes_arr[entry_idx].page_nr = page_nr + 1;
|
232
|
-
hashes_arr[entry_idx].page_offset = page_offset;
|
233
|
-
});
|
231
|
+
} while (iterator.Next());
|
232
|
+
}
|
234
233
|
|
235
234
|
Verify();
|
236
235
|
}
|
237
236
|
|
238
|
-
idx_t GroupedAggregateHashTable::AddChunk(DataChunk &groups, DataChunk &payload,
|
237
|
+
idx_t GroupedAggregateHashTable::AddChunk(AggregateHTAppendState &state, DataChunk &groups, DataChunk &payload,
|
238
|
+
AggregateType filter) {
|
239
239
|
vector<idx_t> aggregate_filter;
|
240
240
|
|
241
241
|
auto &aggregates = layout.GetAggregates();
|
@@ -245,60 +245,59 @@ idx_t GroupedAggregateHashTable::AddChunk(DataChunk &groups, DataChunk &payload,
|
|
245
245
|
aggregate_filter.push_back(i);
|
246
246
|
}
|
247
247
|
}
|
248
|
-
return AddChunk(groups, payload, aggregate_filter);
|
248
|
+
return AddChunk(state, groups, payload, aggregate_filter);
|
249
249
|
}
|
250
250
|
|
251
|
-
idx_t GroupedAggregateHashTable::AddChunk(DataChunk &groups, DataChunk &payload,
|
251
|
+
idx_t GroupedAggregateHashTable::AddChunk(AggregateHTAppendState &state, DataChunk &groups, DataChunk &payload,
|
252
|
+
const vector<idx_t> &filter) {
|
252
253
|
Vector hashes(LogicalType::HASH);
|
253
254
|
groups.Hash(hashes);
|
254
255
|
|
255
|
-
return AddChunk(groups, hashes, payload, filter);
|
256
|
+
return AddChunk(state, groups, hashes, payload, filter);
|
256
257
|
}
|
257
258
|
|
258
|
-
idx_t GroupedAggregateHashTable::AddChunk(DataChunk &groups, Vector &group_hashes,
|
259
|
-
const vector<idx_t> &filter) {
|
259
|
+
idx_t GroupedAggregateHashTable::AddChunk(AggregateHTAppendState &state, DataChunk &groups, Vector &group_hashes,
|
260
|
+
DataChunk &payload, const vector<idx_t> &filter) {
|
260
261
|
D_ASSERT(!is_finalized);
|
261
|
-
|
262
262
|
if (groups.size() == 0) {
|
263
263
|
return 0;
|
264
264
|
}
|
265
|
-
// dummy
|
266
|
-
SelectionVector new_groups(STANDARD_VECTOR_SIZE);
|
267
265
|
|
266
|
+
#ifdef DEBUG
|
268
267
|
D_ASSERT(groups.ColumnCount() + 1 == layout.ColumnCount());
|
269
268
|
for (idx_t i = 0; i < groups.ColumnCount(); i++) {
|
270
269
|
D_ASSERT(groups.GetTypes()[i] == layout.GetTypes()[i]);
|
271
270
|
}
|
271
|
+
#endif
|
272
272
|
|
273
|
-
|
274
|
-
|
275
|
-
VectorOperations::AddInPlace(addresses, layout.GetAggrOffset(), payload.size());
|
276
|
-
|
277
|
-
// now every cell has an entry
|
278
|
-
// update the aggregates
|
279
|
-
idx_t payload_idx = 0;
|
273
|
+
auto new_group_count = FindOrCreateGroups(state, groups, group_hashes, state.addresses, state.new_groups);
|
274
|
+
VectorOperations::AddInPlace(state.addresses, layout.GetAggrOffset(), payload.size());
|
280
275
|
|
276
|
+
// Now every cell has an entry, update the aggregates
|
281
277
|
auto &aggregates = layout.GetAggregates();
|
282
278
|
idx_t filter_idx = 0;
|
279
|
+
idx_t payload_idx = 0;
|
280
|
+
RowOperationsState row_state(aggregate_allocator->GetAllocator());
|
283
281
|
for (idx_t i = 0; i < aggregates.size(); i++) {
|
284
282
|
auto &aggr = aggregates[i];
|
285
283
|
if (filter_idx >= filter.size() || i < filter[filter_idx]) {
|
286
284
|
// Skip all the aggregates that are not in the filter
|
287
285
|
payload_idx += aggr.child_count;
|
288
|
-
VectorOperations::AddInPlace(addresses, aggr.payload_size, payload.size());
|
286
|
+
VectorOperations::AddInPlace(state.addresses, aggr.payload_size, payload.size());
|
289
287
|
continue;
|
290
288
|
}
|
291
289
|
D_ASSERT(i == filter[filter_idx]);
|
292
290
|
|
293
291
|
if (aggr.aggr_type != AggregateType::DISTINCT && aggr.filter) {
|
294
|
-
RowOperations::UpdateFilteredStates(filter_set.GetFilterData(i), aggr, addresses, payload,
|
292
|
+
RowOperations::UpdateFilteredStates(row_state, filter_set.GetFilterData(i), aggr, state.addresses, payload,
|
293
|
+
payload_idx);
|
295
294
|
} else {
|
296
|
-
RowOperations::UpdateStates(aggr, addresses, payload, payload_idx, payload.size());
|
295
|
+
RowOperations::UpdateStates(row_state, aggr, state.addresses, payload, payload_idx, payload.size());
|
297
296
|
}
|
298
297
|
|
299
|
-
//
|
298
|
+
// Move to the next aggregate
|
300
299
|
payload_idx += aggr.child_count;
|
301
|
-
VectorOperations::AddInPlace(addresses, aggr.payload_size, payload.size());
|
300
|
+
VectorOperations::AddInPlace(state.addresses, aggr.payload_size, payload.size());
|
302
301
|
filter_idx++;
|
303
302
|
}
|
304
303
|
|
@@ -316,209 +315,258 @@ void GroupedAggregateHashTable::FetchAggregates(DataChunk &groups, DataChunk &re
|
|
316
315
|
if (groups.size() == 0) {
|
317
316
|
return;
|
318
317
|
}
|
318
|
+
|
319
319
|
// find the groups associated with the addresses
|
320
320
|
// FIXME: this should not use the FindOrCreateGroups, creating them is unnecessary
|
321
|
+
AggregateHTAppendState append_state;
|
321
322
|
Vector addresses(LogicalType::POINTER);
|
322
|
-
FindOrCreateGroups(groups, addresses);
|
323
|
+
FindOrCreateGroups(append_state, groups, addresses);
|
323
324
|
// now fetch the aggregates
|
324
|
-
|
325
|
+
RowOperationsState row_state(aggregate_allocator->GetAllocator());
|
326
|
+
RowOperations::FinalizeStates(row_state, layout, addresses, result, 0);
|
327
|
+
}
|
328
|
+
|
329
|
+
idx_t GroupedAggregateHashTable::ResizeThreshold() {
|
330
|
+
return capacity / LOAD_FACTOR;
|
325
331
|
}
|
326
332
|
|
327
333
|
template <class ENTRY>
|
328
|
-
idx_t GroupedAggregateHashTable::FindOrCreateGroupsInternal(
|
334
|
+
idx_t GroupedAggregateHashTable::FindOrCreateGroupsInternal(AggregateHTAppendState &state, DataChunk &groups,
|
335
|
+
Vector &group_hashes_v, Vector &addresses_v,
|
329
336
|
SelectionVector &new_groups_out) {
|
330
337
|
D_ASSERT(!is_finalized);
|
338
|
+
D_ASSERT(groups.ColumnCount() + 1 == layout.ColumnCount());
|
339
|
+
D_ASSERT(group_hashes_v.GetType() == LogicalType::HASH);
|
340
|
+
D_ASSERT(state.ht_offsets.GetVectorType() == VectorType::FLAT_VECTOR);
|
341
|
+
D_ASSERT(state.ht_offsets.GetType() == LogicalType::BIGINT);
|
342
|
+
D_ASSERT(addresses_v.GetType() == LogicalType::POINTER);
|
343
|
+
D_ASSERT(state.hash_salts.GetType() == LogicalType::SMALLINT);
|
331
344
|
|
332
|
-
if (
|
345
|
+
if (Count() + groups.size() > MaxCapacity()) {
|
333
346
|
throw InternalException("Hash table capacity reached");
|
334
347
|
}
|
335
348
|
|
336
|
-
//
|
337
|
-
if (capacity -
|
349
|
+
// Resize at 50% capacity, also need to fit the entire vector
|
350
|
+
if (capacity - Count() <= groups.size() || Count() > ResizeThreshold()) {
|
351
|
+
Verify();
|
338
352
|
Resize<ENTRY>(capacity * 2);
|
339
353
|
}
|
354
|
+
D_ASSERT(capacity - Count() >= groups.size()); // we need to be able to fit at least one vector of data
|
340
355
|
|
341
|
-
|
342
|
-
|
343
|
-
// we need to be able to fit at least one vector of data
|
344
|
-
D_ASSERT(capacity - entries >= groups.size());
|
345
|
-
D_ASSERT(group_hashes.GetType() == LogicalType::HASH);
|
356
|
+
group_hashes_v.Flatten(groups.size());
|
357
|
+
auto group_hashes = FlatVector::GetData<hash_t>(group_hashes_v);
|
346
358
|
|
347
|
-
|
348
|
-
auto
|
359
|
+
addresses_v.Flatten(groups.size());
|
360
|
+
auto addresses = FlatVector::GetData<data_ptr_t>(addresses_v);
|
349
361
|
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
// now compute the entry in the table based on the hash using a modulo
|
358
|
-
UnaryExecutor::Execute<hash_t, uint64_t>(group_hashes, ht_offsets, groups.size(), [&](hash_t element) {
|
362
|
+
// Compute the entry in the table based on the hash using a modulo,
|
363
|
+
// and precompute the hash salts for faster comparison below
|
364
|
+
auto ht_offsets_ptr = FlatVector::GetData<uint64_t>(state.ht_offsets);
|
365
|
+
auto hash_salts_ptr = FlatVector::GetData<uint16_t>(state.hash_salts);
|
366
|
+
for (idx_t r = 0; r < groups.size(); r++) {
|
367
|
+
auto element = group_hashes[r];
|
359
368
|
D_ASSERT((element & bitmask) == (element % capacity));
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
// precompute the hash salts for faster comparison below
|
365
|
-
D_ASSERT(hash_salts.GetType() == LogicalType::SMALLINT);
|
366
|
-
UnaryExecutor::Execute<hash_t, uint16_t>(group_hashes, hash_salts, groups.size(),
|
367
|
-
[&](hash_t element) { return (element >> hash_prefix_shift); });
|
368
|
-
auto hash_salts_ptr = FlatVector::GetData<uint16_t>(hash_salts);
|
369
|
-
|
369
|
+
ht_offsets_ptr[r] = element & bitmask;
|
370
|
+
hash_salts_ptr[r] = element >> hash_prefix_shift;
|
371
|
+
}
|
370
372
|
// we start out with all entries [0, 1, 2, ..., groups.size()]
|
371
373
|
const SelectionVector *sel_vector = FlatVector::IncrementalSelectionVector();
|
372
374
|
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
group_chunk.
|
375
|
+
// Make a chunk that references the groups and the hashes and convert to unified format
|
376
|
+
if (state.group_chunk.ColumnCount() == 0) {
|
377
|
+
state.group_chunk.InitializeEmpty(layout.GetTypes());
|
378
|
+
}
|
379
|
+
D_ASSERT(state.group_chunk.ColumnCount() == layout.GetTypes().size());
|
378
380
|
for (idx_t grp_idx = 0; grp_idx < groups.ColumnCount(); grp_idx++) {
|
379
|
-
group_chunk.data[grp_idx].Reference(groups.data[grp_idx]);
|
381
|
+
state.group_chunk.data[grp_idx].Reference(groups.data[grp_idx]);
|
380
382
|
}
|
381
|
-
group_chunk.data[groups.ColumnCount()].Reference(
|
382
|
-
group_chunk.SetCardinality(groups);
|
383
|
+
state.group_chunk.data[groups.ColumnCount()].Reference(group_hashes_v);
|
384
|
+
state.group_chunk.SetCardinality(groups);
|
383
385
|
|
384
386
|
// convert all vectors to unified format
|
385
|
-
|
387
|
+
if (!state.chunk_state_initialized) {
|
388
|
+
data_collection->InitializeAppend(state.chunk_state);
|
389
|
+
state.chunk_state_initialized = true;
|
390
|
+
}
|
391
|
+
TupleDataCollection::ToUnifiedFormat(state.chunk_state, state.group_chunk);
|
392
|
+
if (!state.group_data) {
|
393
|
+
state.group_data = unique_ptr<UnifiedVectorFormat[]>(new UnifiedVectorFormat[state.group_chunk.ColumnCount()]);
|
394
|
+
}
|
395
|
+
TupleDataCollection::GetVectorData(state.chunk_state, state.group_data.get());
|
386
396
|
|
387
397
|
idx_t new_group_count = 0;
|
398
|
+
idx_t remaining_entries = groups.size();
|
388
399
|
while (remaining_entries > 0) {
|
389
400
|
idx_t new_entry_count = 0;
|
390
401
|
idx_t need_compare_count = 0;
|
391
402
|
idx_t no_match_count = 0;
|
392
403
|
|
393
|
-
//
|
404
|
+
// For each remaining entry, figure out whether or not it belongs to a full or empty group
|
394
405
|
for (idx_t i = 0; i < remaining_entries; i++) {
|
395
406
|
const idx_t index = sel_vector->get_index(i);
|
396
|
-
|
397
|
-
if (
|
398
|
-
|
399
|
-
|
400
|
-
NewBlock();
|
401
|
-
}
|
402
|
-
|
403
|
-
auto entry_payload_ptr = payload_hds_ptrs.back() + (payload_page_offset * tuple_size);
|
404
|
-
|
405
|
-
D_ASSERT(group_hashes_ptr[index] >> hash_prefix_shift <= NumericLimits<uint16_t>::Maximum());
|
406
|
-
D_ASSERT(payload_page_offset < tuples_per_block);
|
407
|
-
D_ASSERT(payload_hds.size() < NumericLimits<uint32_t>::Maximum());
|
408
|
-
D_ASSERT(payload_page_offset + 1 < NumericLimits<uint16_t>::Maximum());
|
409
|
-
|
410
|
-
ht_entry_ptr->salt = group_hashes_ptr[index] >> hash_prefix_shift;
|
407
|
+
auto &ht_entry = *(((ENTRY *)this->hashes_hdl_ptr) + ht_offsets_ptr[index]);
|
408
|
+
if (ht_entry.page_nr == 0) { // Cell is unoccupied (we use page number 0 as a "unused marker")
|
409
|
+
D_ASSERT(group_hashes[index] >> hash_prefix_shift <= NumericLimits<uint16_t>::Maximum());
|
410
|
+
D_ASSERT(payload_hds_ptrs.size() < NumericLimits<uint32_t>::Maximum());
|
411
411
|
|
412
|
-
// page
|
413
|
-
|
414
|
-
|
415
|
-
ht_entry_ptr->page_offset = payload_page_offset++;
|
412
|
+
// Set page nr to 1 for now to mark it as occupied (will be corrected later) and set the salt
|
413
|
+
ht_entry.page_nr = 1;
|
414
|
+
ht_entry.salt = group_hashes[index] >> hash_prefix_shift;
|
416
415
|
|
417
|
-
//
|
418
|
-
empty_vector.set_index(new_entry_count++, index);
|
416
|
+
// Update selection lists for outer loops
|
417
|
+
state.empty_vector.set_index(new_entry_count++, index);
|
419
418
|
new_groups_out.set_index(new_group_count++, index);
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
} else {
|
425
|
-
// cell is occupied: add to check list
|
426
|
-
// only need to check if hash salt in ptr == prefix of hash in payload
|
427
|
-
if (ht_entry_ptr->salt == hash_salts_ptr[index]) {
|
428
|
-
group_compare_vector.set_index(need_compare_count++, index);
|
429
|
-
|
430
|
-
auto page_ptr = payload_hds_ptrs[ht_entry_ptr->page_nr - 1];
|
431
|
-
auto page_offset = ht_entry_ptr->page_offset * tuple_size;
|
432
|
-
addresses_ptr[index] = page_ptr + page_offset;
|
433
|
-
|
419
|
+
} else { // Cell is occupied: Compare salts
|
420
|
+
if (ht_entry.salt == hash_salts_ptr[index]) {
|
421
|
+
state.group_compare_vector.set_index(need_compare_count++, index);
|
434
422
|
} else {
|
435
|
-
no_match_vector.set_index(no_match_count++, index);
|
423
|
+
state.no_match_vector.set_index(no_match_count++, index);
|
436
424
|
}
|
437
425
|
}
|
438
426
|
}
|
439
427
|
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
428
|
+
if (new_entry_count != 0) {
|
429
|
+
// Append everything that belongs to an empty group
|
430
|
+
data_collection->AppendUnified(td_pin_state, state.chunk_state, state.group_chunk, state.empty_vector,
|
431
|
+
new_entry_count);
|
432
|
+
RowOperations::InitializeStates(layout, state.chunk_state.row_locations,
|
433
|
+
*FlatVector::IncrementalSelectionVector(), new_entry_count);
|
434
|
+
|
435
|
+
// Get the pointers to the (possibly) newly created blocks of the data collection
|
436
|
+
idx_t block_id = payload_hds_ptrs.empty() ? 0 : payload_hds_ptrs.size() - 1;
|
437
|
+
UpdateBlockPointers();
|
438
|
+
auto block_pointer = payload_hds_ptrs[block_id];
|
439
|
+
auto block_end = block_pointer + tuples_per_block * tuple_size;
|
440
|
+
|
441
|
+
// Set the page nrs/offsets in the 1st part of the HT now that the data has been appended
|
442
|
+
const auto row_locations = FlatVector::GetData<data_ptr_t>(state.chunk_state.row_locations);
|
443
|
+
for (idx_t new_entry_idx = 0; new_entry_idx < new_entry_count; new_entry_idx++) {
|
444
|
+
const auto &row_location = row_locations[new_entry_idx];
|
445
|
+
if (row_location > block_end || row_location < block_pointer) {
|
446
|
+
block_id++;
|
447
|
+
D_ASSERT(block_id < payload_hds_ptrs.size());
|
448
|
+
block_pointer = payload_hds_ptrs[block_id];
|
449
|
+
block_end = block_pointer + tuples_per_block * tuple_size;
|
450
|
+
}
|
451
|
+
D_ASSERT(row_location >= block_pointer && row_location < block_end);
|
452
|
+
D_ASSERT((row_location - block_pointer) % tuple_size == 0);
|
453
|
+
const auto index = state.empty_vector.get_index(new_entry_idx);
|
454
|
+
auto &ht_entry = *(((ENTRY *)this->hashes_hdl_ptr) + ht_offsets_ptr[index]);
|
455
|
+
ht_entry.page_nr = block_id + 1;
|
456
|
+
ht_entry.page_offset = (row_location - block_pointer) / tuple_size;
|
457
|
+
addresses[index] = row_location;
|
458
|
+
}
|
459
|
+
}
|
444
460
|
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
461
|
+
if (need_compare_count != 0) {
|
462
|
+
// Get the pointers to the rows that need to be compared
|
463
|
+
for (idx_t need_compare_idx = 0; need_compare_idx < need_compare_count; need_compare_idx++) {
|
464
|
+
const auto index = state.group_compare_vector.get_index(need_compare_idx);
|
465
|
+
const auto &ht_entry = *(((ENTRY *)this->hashes_hdl_ptr) + ht_offsets_ptr[index]);
|
466
|
+
auto page_ptr = payload_hds_ptrs[ht_entry.page_nr - 1];
|
467
|
+
auto page_offset = ht_entry.page_offset * tuple_size;
|
468
|
+
addresses[index] = page_ptr + page_offset;
|
469
|
+
}
|
449
470
|
|
450
|
-
|
471
|
+
// Perform group comparisons
|
472
|
+
RowOperations::Match(state.group_chunk, state.group_data.get(), layout, addresses_v, predicates,
|
473
|
+
state.group_compare_vector, need_compare_count, &state.no_match_vector,
|
474
|
+
no_match_count);
|
475
|
+
}
|
476
|
+
|
477
|
+
// Linear probing: each of the entries that do not match move to the next entry in the HT
|
451
478
|
for (idx_t i = 0; i < no_match_count; i++) {
|
452
|
-
idx_t index = no_match_vector.get_index(i);
|
479
|
+
idx_t index = state.no_match_vector.get_index(i);
|
453
480
|
ht_offsets_ptr[index]++;
|
454
481
|
if (ht_offsets_ptr[index] >= capacity) {
|
455
482
|
ht_offsets_ptr[index] = 0;
|
456
483
|
}
|
457
484
|
}
|
458
|
-
sel_vector = &no_match_vector;
|
485
|
+
sel_vector = &state.no_match_vector;
|
459
486
|
remaining_entries = no_match_count;
|
460
487
|
}
|
461
488
|
|
462
489
|
return new_group_count;
|
463
490
|
}
|
464
491
|
|
492
|
+
void GroupedAggregateHashTable::UpdateBlockPointers() {
|
493
|
+
for (const auto &id_and_handle : td_pin_state.row_handles) {
|
494
|
+
const auto &id = id_and_handle.first;
|
495
|
+
const auto &handle = id_and_handle.second;
|
496
|
+
if (payload_hds_ptrs.empty() || id > payload_hds_ptrs.size() - 1) {
|
497
|
+
payload_hds_ptrs.resize(id + 1);
|
498
|
+
}
|
499
|
+
payload_hds_ptrs[id] = handle.Ptr();
|
500
|
+
}
|
501
|
+
}
|
502
|
+
|
465
503
|
// this is to support distinct aggregations where we need to record whether we
|
466
504
|
// have already seen a value for a group
|
467
|
-
idx_t GroupedAggregateHashTable::FindOrCreateGroups(
|
505
|
+
idx_t GroupedAggregateHashTable::FindOrCreateGroups(AggregateHTAppendState &state, DataChunk &groups,
|
506
|
+
Vector &group_hashes, Vector &addresses_out,
|
468
507
|
SelectionVector &new_groups_out) {
|
469
508
|
switch (entry_type) {
|
470
509
|
case HtEntryType::HT_WIDTH_64:
|
471
|
-
return FindOrCreateGroupsInternal<aggr_ht_entry_64>(groups, group_hashes, addresses_out, new_groups_out);
|
510
|
+
return FindOrCreateGroupsInternal<aggr_ht_entry_64>(state, groups, group_hashes, addresses_out, new_groups_out);
|
472
511
|
case HtEntryType::HT_WIDTH_32:
|
473
|
-
return FindOrCreateGroupsInternal<aggr_ht_entry_32>(groups, group_hashes, addresses_out, new_groups_out);
|
512
|
+
return FindOrCreateGroupsInternal<aggr_ht_entry_32>(state, groups, group_hashes, addresses_out, new_groups_out);
|
474
513
|
default:
|
475
514
|
throw InternalException("Unknown HT entry width");
|
476
515
|
}
|
477
516
|
}
|
478
517
|
|
479
|
-
void GroupedAggregateHashTable::FindOrCreateGroups(
|
518
|
+
void GroupedAggregateHashTable::FindOrCreateGroups(AggregateHTAppendState &state, DataChunk &groups,
|
519
|
+
Vector &addresses) {
|
480
520
|
// create a dummy new_groups sel vector
|
481
|
-
|
482
|
-
FindOrCreateGroups(groups, addresses, new_groups);
|
521
|
+
FindOrCreateGroups(state, groups, addresses, state.new_groups);
|
483
522
|
}
|
484
523
|
|
485
|
-
idx_t GroupedAggregateHashTable::FindOrCreateGroups(
|
486
|
-
SelectionVector &new_groups_out) {
|
524
|
+
idx_t GroupedAggregateHashTable::FindOrCreateGroups(AggregateHTAppendState &state, DataChunk &groups,
|
525
|
+
Vector &addresses_out, SelectionVector &new_groups_out) {
|
487
526
|
Vector hashes(LogicalType::HASH);
|
488
527
|
groups.Hash(hashes);
|
489
|
-
return FindOrCreateGroups(groups, hashes, addresses_out, new_groups_out);
|
528
|
+
return FindOrCreateGroups(state, groups, hashes, addresses_out, new_groups_out);
|
490
529
|
}
|
491
530
|
|
492
531
|
struct FlushMoveState {
|
493
|
-
FlushMoveState(
|
494
|
-
:
|
532
|
+
explicit FlushMoveState(TupleDataCollection &collection_p)
|
533
|
+
: collection(collection_p), hashes(LogicalType::HASH), group_addresses(LogicalType::POINTER),
|
495
534
|
new_groups_sel(STANDARD_VECTOR_SIZE) {
|
496
|
-
|
497
|
-
|
535
|
+
const auto &layout = collection.GetLayout();
|
536
|
+
vector<column_t> column_ids;
|
537
|
+
column_ids.reserve(layout.ColumnCount() - 1);
|
538
|
+
for (idx_t col_idx = 0; col_idx < layout.ColumnCount() - 1; col_idx++) {
|
539
|
+
column_ids.emplace_back(col_idx);
|
540
|
+
}
|
541
|
+
// FIXME DESTROY_AFTER_DONE if we make it possible to pass a selection vector to RowOperations::DestroyStates?
|
542
|
+
collection.InitializeScan(scan_state, column_ids, TupleDataPinProperties::UNPIN_AFTER_DONE);
|
543
|
+
collection.InitializeScanChunk(scan_state, groups);
|
544
|
+
hash_col_idx = layout.ColumnCount() - 1;
|
498
545
|
}
|
499
546
|
|
547
|
+
bool Scan();
|
548
|
+
|
549
|
+
TupleDataCollection &collection;
|
550
|
+
TupleDataScanState scan_state;
|
500
551
|
DataChunk groups;
|
501
|
-
|
552
|
+
|
553
|
+
idx_t hash_col_idx;
|
554
|
+
Vector hashes;
|
555
|
+
|
556
|
+
AggregateHTAppendState append_state;
|
502
557
|
Vector group_addresses;
|
503
558
|
SelectionVector new_groups_sel;
|
504
559
|
};
|
505
560
|
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
state.groups.Reset();
|
512
|
-
state.groups.SetCardinality(count);
|
513
|
-
for (idx_t col_no = 0; col_no < state.groups.ColumnCount(); col_no++) {
|
514
|
-
auto &column = state.groups.data[col_no];
|
515
|
-
RowOperations::Gather(source_addresses, *FlatVector::IncrementalSelectionVector(), column,
|
516
|
-
*FlatVector::IncrementalSelectionVector(), count, layout, col_no);
|
561
|
+
bool FlushMoveState::Scan() {
|
562
|
+
if (collection.Scan(scan_state, groups)) {
|
563
|
+
collection.Gather(scan_state.chunk_state.row_locations, *FlatVector::IncrementalSelectionVector(),
|
564
|
+
groups.size(), hash_col_idx, hashes, *FlatVector::IncrementalSelectionVector());
|
565
|
+
return true;
|
517
566
|
}
|
518
567
|
|
519
|
-
|
520
|
-
|
521
|
-
RowOperations::CombineStates(layout, source_addresses, state.group_addresses, count);
|
568
|
+
collection.FinalizePinState(scan_state.pin_state);
|
569
|
+
return false;
|
522
570
|
}
|
523
571
|
|
524
572
|
void GroupedAggregateHashTable::Combine(GroupedAggregateHashTable &other) {
|
@@ -527,126 +575,67 @@ void GroupedAggregateHashTable::Combine(GroupedAggregateHashTable &other) {
|
|
527
575
|
D_ASSERT(other.layout.GetAggrWidth() == layout.GetAggrWidth());
|
528
576
|
D_ASSERT(other.layout.GetDataWidth() == layout.GetDataWidth());
|
529
577
|
D_ASSERT(other.layout.GetRowWidth() == layout.GetRowWidth());
|
530
|
-
D_ASSERT(other.tuples_per_block == tuples_per_block);
|
531
578
|
|
532
|
-
if (other.
|
579
|
+
if (other.Count() == 0) {
|
533
580
|
return;
|
534
581
|
}
|
535
582
|
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
FlushMoveState state(allocator, layout);
|
545
|
-
other.PayloadApply([&](idx_t page_nr, idx_t page_offset, data_ptr_t ptr) {
|
546
|
-
auto hash = Load<hash_t>(ptr + hash_offset);
|
583
|
+
FlushMoveState state(*other.data_collection);
|
584
|
+
RowOperationsState row_state(aggregate_allocator->GetAllocator());
|
585
|
+
while (state.Scan()) {
|
586
|
+
FindOrCreateGroups(state.append_state, state.groups, state.hashes, state.group_addresses, state.new_groups_sel);
|
587
|
+
RowOperations::CombineStates(row_state, layout, state.scan_state.chunk_state.row_locations,
|
588
|
+
state.group_addresses, state.groups.size());
|
589
|
+
}
|
547
590
|
|
548
|
-
hashes_ptr[group_idx] = hash;
|
549
|
-
addresses_ptr[group_idx] = ptr;
|
550
|
-
group_idx++;
|
551
|
-
if (group_idx == STANDARD_VECTOR_SIZE) {
|
552
|
-
FlushMove(state, addresses, hashes, group_idx);
|
553
|
-
group_idx = 0;
|
554
|
-
}
|
555
|
-
});
|
556
|
-
FlushMove(state, addresses, hashes, group_idx);
|
557
|
-
string_heap->Merge(*other.string_heap);
|
558
591
|
Verify();
|
559
592
|
}
|
560
593
|
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
PayloadApply([&](idx_t page_nr, idx_t page_offset, data_ptr_t ptr) {
|
580
|
-
auto hash = Load<hash_t>(ptr + hash_offset);
|
581
|
-
|
582
|
-
idx_t partition = (hash & mask) >> shift;
|
583
|
-
D_ASSERT(partition < partition_hts.size());
|
584
|
-
|
585
|
-
auto &info = partition_info[partition];
|
586
|
-
|
587
|
-
info.hashes_ptr[info.group_count] = hash;
|
588
|
-
info.addresses_ptr[info.group_count] = ptr;
|
589
|
-
info.group_count++;
|
590
|
-
if (info.group_count == STANDARD_VECTOR_SIZE) {
|
591
|
-
D_ASSERT(partition_hts[partition]);
|
592
|
-
partition_hts[partition]->FlushMove(state, info.addresses, info.hashes, info.group_count);
|
593
|
-
info.group_count = 0;
|
594
|
-
}
|
595
|
-
});
|
596
|
-
|
597
|
-
idx_t info_idx = 0;
|
598
|
-
idx_t total_count = 0;
|
599
|
-
for (auto &partition_entry : partition_hts) {
|
600
|
-
auto &info = partition_info[info_idx++];
|
601
|
-
partition_entry->FlushMove(state, info.addresses, info.hashes, info.group_count);
|
602
|
-
|
603
|
-
partition_entry->string_heap->Merge(*string_heap);
|
604
|
-
partition_entry->Verify();
|
605
|
-
total_count += partition_entry->Size();
|
594
|
+
void GroupedAggregateHashTable::Partition(vector<GroupedAggregateHashTable *> &partition_hts, idx_t radix_bits) {
|
595
|
+
const auto num_partitions = RadixPartitioning::NumberOfPartitions(radix_bits);
|
596
|
+
D_ASSERT(partition_hts.size() == num_partitions);
|
597
|
+
|
598
|
+
// Partition the data
|
599
|
+
auto partitioned_data =
|
600
|
+
make_uniq<RadixPartitionedTupleData>(buffer_manager, layout, radix_bits, layout.ColumnCount() - 1);
|
601
|
+
partitioned_data->Partition(*data_collection, TupleDataPinProperties::KEEP_EVERYTHING_PINNED);
|
602
|
+
D_ASSERT(partitioned_data->GetPartitions().size() == num_partitions);
|
603
|
+
|
604
|
+
// Move the partitioned data collections to the partitioned hash tables and initialize the 1st part of the HT
|
605
|
+
auto &partitions = partitioned_data->GetPartitions();
|
606
|
+
for (idx_t partition_idx = 0; partition_idx < num_partitions; partition_idx++) {
|
607
|
+
auto &partition_ht = *partition_hts[partition_idx];
|
608
|
+
partition_ht.data_collection = std::move(partitions[partition_idx]);
|
609
|
+
partition_ht.aggregate_allocator = aggregate_allocator;
|
610
|
+
partition_ht.InitializeFirstPart();
|
611
|
+
partition_ht.Verify();
|
606
612
|
}
|
607
|
-
(void)total_count;
|
608
|
-
D_ASSERT(total_count == entries);
|
609
613
|
}
|
610
614
|
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
auto chunk_idx = scan_state.scan_position / tuples_per_block;
|
624
|
-
auto chunk_offset = (scan_state.scan_position % tuples_per_block) * tuple_size;
|
625
|
-
D_ASSERT(chunk_offset + tuple_size <= Storage::BLOCK_SIZE);
|
626
|
-
|
627
|
-
auto read_ptr = payload_hds_ptrs[chunk_idx++];
|
628
|
-
for (idx_t i = 0; i < this_n; i++) {
|
629
|
-
data_pointers[i] = read_ptr + chunk_offset;
|
630
|
-
chunk_offset += tuple_size;
|
631
|
-
if (chunk_offset >= tuples_per_block * tuple_size) {
|
632
|
-
read_ptr = payload_hds_ptrs[chunk_idx++];
|
633
|
-
chunk_offset = 0;
|
634
|
-
}
|
635
|
-
}
|
636
|
-
scan_state.scan_position += this_n;
|
615
|
+
void GroupedAggregateHashTable::InitializeFirstPart() {
|
616
|
+
data_collection->GetBlockPointers(payload_hds_ptrs);
|
617
|
+
auto size = MaxValue<idx_t>(NextPowerOfTwo(Count() * 2L), capacity);
|
618
|
+
switch (entry_type) {
|
619
|
+
case HtEntryType::HT_WIDTH_64:
|
620
|
+
Resize<aggr_ht_entry_64>(size);
|
621
|
+
break;
|
622
|
+
case HtEntryType::HT_WIDTH_32:
|
623
|
+
Resize<aggr_ht_entry_32>(size);
|
624
|
+
break;
|
625
|
+
default:
|
626
|
+
throw InternalException("Unknown HT entry width");
|
637
627
|
}
|
628
|
+
}
|
638
629
|
|
639
|
-
|
640
|
-
|
630
|
+
idx_t GroupedAggregateHashTable::Scan(TupleDataParallelScanState &gstate, TupleDataLocalScanState &lstate,
|
631
|
+
DataChunk &result) {
|
632
|
+
data_collection->Scan(gstate, lstate, result);
|
633
|
+
|
634
|
+
RowOperationsState row_state(aggregate_allocator->GetAllocator());
|
641
635
|
const auto group_cols = layout.ColumnCount() - 1;
|
642
|
-
|
643
|
-
auto &column = result.data[col_no];
|
644
|
-
RowOperations::Gather(addresses, *FlatVector::IncrementalSelectionVector(), column,
|
645
|
-
*FlatVector::IncrementalSelectionVector(), result.size(), layout, col_no);
|
646
|
-
}
|
636
|
+
RowOperations::FinalizeStates(row_state, layout, lstate.chunk_state.row_locations, result, group_cols);
|
647
637
|
|
648
|
-
|
649
|
-
return this_n;
|
638
|
+
return result.size();
|
650
639
|
}
|
651
640
|
|
652
641
|
void GroupedAggregateHashTable::Finalize() {
|
@@ -654,8 +643,11 @@ void GroupedAggregateHashTable::Finalize() {
|
|
654
643
|
return;
|
655
644
|
}
|
656
645
|
|
657
|
-
//
|
646
|
+
// Early release hashes (not needed for partition/scan) and data collection (will be pinned again when scanning)
|
658
647
|
hashes_hdl.Destroy();
|
648
|
+
data_collection->FinalizePinState(td_pin_state);
|
649
|
+
data_collection->Unpin();
|
650
|
+
|
659
651
|
is_finalized = true;
|
660
652
|
}
|
661
653
|
|