duckdb 0.6.2-dev971.0 → 0.7.1-dev2.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 +14 -8
- package/configure.py +2 -2
- package/lib/duckdb.d.ts +20 -3
- package/lib/duckdb.js +13 -1
- package/package.json +3 -1
- package/src/connection.cpp +5 -3
- package/src/database.cpp +117 -11
- package/src/duckdb/extension/icu/icu-dateadd.cpp +70 -7
- package/src/duckdb/extension/icu/icu-datefunc.cpp +0 -8
- package/src/duckdb/extension/icu/icu-datepart.cpp +1 -1
- package/src/duckdb/extension/icu/icu-extension.cpp +5 -3
- package/src/duckdb/extension/icu/icu-strptime.cpp +2 -2
- package/src/duckdb/extension/icu/icu-timebucket.cpp +637 -0
- package/src/duckdb/extension/icu/icu-timezone.cpp +7 -3
- package/src/duckdb/extension/icu/include/icu-datefunc.hpp +11 -1
- package/src/duckdb/{src/include/duckdb/main/replacement_opens.hpp → extension/icu/include/icu-timebucket.hpp} +3 -6
- package/src/duckdb/extension/icu/third_party/icu/common/uloc.cpp +3 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/choicfmt.cpp +3 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/plurrule.cpp +3 -1
- package/src/duckdb/extension/json/buffered_json_reader.cpp +254 -0
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +148 -0
- package/src/duckdb/extension/json/include/json_common.hpp +148 -226
- package/src/duckdb/extension/json/include/json_executors.hpp +139 -0
- package/src/duckdb/extension/json/include/json_functions.hpp +71 -30
- package/src/duckdb/extension/json/include/json_scan.hpp +310 -0
- package/src/duckdb/extension/json/include/json_structure.hpp +87 -0
- package/src/duckdb/extension/json/include/json_transform.hpp +72 -0
- package/src/duckdb/extension/json/json-extension.cpp +35 -17
- package/src/duckdb/extension/json/json_common.cpp +10 -87
- package/src/duckdb/extension/json/json_functions/copy_json.cpp +109 -0
- package/src/duckdb/extension/json/json_functions/json_array_length.cpp +18 -13
- package/src/duckdb/extension/json/json_functions/json_contains.cpp +95 -44
- package/src/duckdb/extension/json/json_functions/json_create.cpp +48 -39
- package/src/duckdb/extension/json/json_functions/json_extract.cpp +30 -21
- package/src/duckdb/extension/json/json_functions/json_keys.cpp +60 -0
- package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +33 -11
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +483 -155
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +369 -116
- package/src/duckdb/extension/json/json_functions/json_type.cpp +19 -14
- package/src/duckdb/extension/json/json_functions/json_valid.cpp +16 -6
- package/src/duckdb/extension/json/json_functions/read_json.cpp +282 -0
- package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +65 -0
- package/src/duckdb/extension/json/json_functions.cpp +225 -0
- package/src/duckdb/extension/json/json_scan.cpp +666 -0
- package/src/duckdb/extension/json/yyjson/include/yyjson.hpp +3847 -3398
- package/src/duckdb/extension/json/yyjson/yyjson.cpp +6625 -6411
- package/src/duckdb/extension/parquet/column_reader.cpp +28 -23
- package/src/duckdb/extension/parquet/column_writer.cpp +79 -77
- package/src/duckdb/extension/parquet/include/boolean_column_reader.hpp +5 -1
- package/src/duckdb/extension/parquet/include/callback_column_reader.hpp +1 -1
- package/src/duckdb/extension/parquet/include/column_reader.hpp +2 -0
- package/src/duckdb/extension/parquet/include/generated_column_reader.hpp +1 -1
- package/src/duckdb/extension/parquet/include/parquet_reader.hpp +18 -3
- package/src/duckdb/extension/parquet/include/parquet_rle_bp_decoder.hpp +1 -1
- package/src/duckdb/extension/parquet/include/templated_column_reader.hpp +3 -3
- package/src/duckdb/extension/parquet/parquet-extension.cpp +102 -35
- package/src/duckdb/extension/parquet/parquet_metadata.cpp +2 -2
- package/src/duckdb/extension/parquet/parquet_reader.cpp +108 -39
- package/src/duckdb/extension/parquet/parquet_statistics.cpp +8 -4
- package/src/duckdb/extension/parquet/parquet_writer.cpp +23 -7
- package/src/duckdb/extension/parquet/zstd_file_system.cpp +2 -2
- package/src/duckdb/src/catalog/catalog.cpp +36 -134
- package/src/duckdb/src/catalog/catalog_entry/column_dependency_manager.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +27 -0
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +330 -0
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +758 -0
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +4 -13
- package/src/duckdb/src/catalog/catalog_entry/pragma_function_catalog_entry.cpp +2 -1
- 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 +5 -5
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +11 -308
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +44 -708
- package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +2 -1
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_search_path.cpp +10 -10
- package/src/duckdb/src/catalog/catalog_set.cpp +68 -62
- package/src/duckdb/src/catalog/catalog_transaction.cpp +9 -3
- package/src/duckdb/src/catalog/default/default_functions.cpp +7 -7
- package/src/duckdb/src/catalog/default/default_schemas.cpp +2 -2
- package/src/duckdb/src/catalog/default/default_types.cpp +2 -1
- package/src/duckdb/src/catalog/default/default_views.cpp +8 -16
- package/src/duckdb/src/catalog/dependency_manager.cpp +6 -6
- package/src/duckdb/src/catalog/duck_catalog.cpp +111 -0
- package/src/duckdb/src/catalog/similar_catalog_entry.cpp +26 -0
- package/src/duckdb/src/common/allocator.cpp +1 -1
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +9 -9
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +6 -6
- package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +1 -1
- package/src/duckdb/src/common/bind_helpers.cpp +67 -0
- package/src/duckdb/src/common/box_renderer.cpp +11 -3
- package/src/duckdb/src/common/compressed_file_system.cpp +2 -2
- package/src/duckdb/src/common/enums/expression_type.cpp +2 -0
- package/src/duckdb/src/common/enums/logical_operator_type.cpp +2 -0
- package/src/duckdb/src/common/enums/optimizer_type.cpp +1 -0
- package/src/duckdb/src/common/enums/physical_operator_type.cpp +6 -0
- package/src/duckdb/src/common/enums/relation_type.cpp +2 -0
- package/src/duckdb/src/common/exception_format_value.cpp +2 -2
- package/src/duckdb/src/common/file_buffer.cpp +9 -34
- package/src/duckdb/src/common/file_system.cpp +28 -4
- package/src/duckdb/src/common/gzip_file_system.cpp +3 -3
- package/src/duckdb/src/common/hive_partitioning.cpp +129 -4
- package/src/duckdb/src/common/local_file_system.cpp +9 -7
- package/src/duckdb/src/common/operator/cast_operators.cpp +131 -28
- package/src/duckdb/src/common/pipe_file_system.cpp +2 -2
- package/src/duckdb/src/common/preserved_error.cpp +1 -1
- package/src/duckdb/src/common/radix_partitioning.cpp +5 -4
- package/src/duckdb/src/common/row_operations/row_aggregate.cpp +2 -2
- package/src/duckdb/src/common/serializer/buffered_serializer.cpp +1 -1
- package/src/duckdb/src/common/sort/merge_sorter.cpp +11 -5
- package/src/duckdb/src/common/sort/sort_state.cpp +19 -16
- package/src/duckdb/src/common/sort/sorted_block.cpp +12 -11
- package/src/duckdb/src/common/string_util.cpp +9 -1
- package/src/duckdb/src/common/tree_renderer.cpp +17 -8
- package/src/duckdb/src/common/types/batched_data_collection.cpp +4 -4
- package/src/duckdb/src/common/types/bit.cpp +278 -0
- package/src/duckdb/src/common/types/chunk_collection.cpp +7 -7
- package/src/duckdb/src/common/types/column_data_allocator.cpp +6 -6
- package/src/duckdb/src/common/types/column_data_collection.cpp +56 -32
- package/src/duckdb/src/common/types/column_data_collection_segment.cpp +2 -2
- package/src/duckdb/src/common/types/column_data_consumer.cpp +1 -1
- package/src/duckdb/src/common/types/conflict_info.cpp +18 -0
- package/src/duckdb/src/common/types/conflict_manager.cpp +257 -0
- package/src/duckdb/src/common/types/data_chunk.cpp +17 -7
- package/src/duckdb/src/common/types/date.cpp +7 -2
- package/src/duckdb/src/common/types/hash.cpp +2 -2
- package/src/duckdb/src/common/types/partitioned_column_data.cpp +7 -2
- package/src/duckdb/src/common/types/row_data_collection.cpp +7 -7
- package/src/duckdb/src/common/types/row_data_collection_scanner.cpp +10 -2
- package/src/duckdb/src/common/types/row_layout.cpp +4 -4
- package/src/duckdb/src/common/types/string_type.cpp +1 -0
- package/src/duckdb/src/common/types/time.cpp +10 -6
- package/src/duckdb/src/common/types/validity_mask.cpp +2 -2
- package/src/duckdb/src/common/types/value.cpp +35 -41
- package/src/duckdb/src/common/types/vector.cpp +149 -37
- package/src/duckdb/src/common/types/vector_buffer.cpp +4 -4
- package/src/duckdb/src/common/types/vector_cache.cpp +2 -2
- package/src/duckdb/src/common/types.cpp +64 -56
- package/src/duckdb/src/common/vector_operations/vector_cast.cpp +7 -2
- package/src/duckdb/src/common/virtual_file_system.cpp +3 -3
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +10 -8
- package/src/duckdb/src/execution/base_aggregate_hashtable.cpp +1 -1
- package/src/duckdb/src/execution/column_binding_resolver.cpp +21 -1
- package/src/duckdb/src/execution/expression_executor/execute_case.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +10 -4
- package/src/duckdb/src/execution/expression_executor/execute_conjunction.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.cpp +1 -1
- package/src/duckdb/src/execution/index/art/art.cpp +258 -197
- package/src/duckdb/src/execution/index/art/art_key.cpp +10 -0
- package/src/duckdb/src/execution/index/art/leaf.cpp +68 -25
- package/src/duckdb/src/execution/index/art/node.cpp +183 -90
- package/src/duckdb/src/execution/index/art/node16.cpp +62 -34
- package/src/duckdb/src/execution/index/art/node256.cpp +50 -30
- package/src/duckdb/src/execution/index/art/node4.cpp +63 -34
- package/src/duckdb/src/execution/index/art/node48.cpp +63 -38
- package/src/duckdb/src/execution/index/art/prefix.cpp +24 -14
- package/src/duckdb/src/execution/index/art/swizzleable_pointer.cpp +5 -2
- package/src/duckdb/src/execution/join_hashtable.cpp +18 -19
- package/src/duckdb/src/execution/operator/aggregate/aggregate_object.cpp +1 -1
- package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +2 -2
- package/src/duckdb/src/execution/operator/aggregate/grouped_aggregate_data.cpp +4 -4
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +22 -20
- package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +3 -3
- package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +1 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +11 -11
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +322 -420
- package/src/duckdb/src/execution/operator/filter/physical_filter.cpp +8 -5
- package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +3 -3
- package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +3 -2
- package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +5 -5
- package/src/duckdb/src/execution/operator/helper/physical_set.cpp +9 -8
- package/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp +3 -3
- package/src/duckdb/src/execution/operator/helper/physical_streaming_sample.cpp +1 -1
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +4 -3
- package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +2 -2
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp +3 -2
- package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +6 -6
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +19 -19
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +7 -7
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +11 -10
- package/src/duckdb/src/execution/operator/join/physical_join.cpp +8 -1
- package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +4 -3
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +13 -8
- package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +195 -0
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +7 -7
- package/src/duckdb/src/execution/operator/order/physical_order.cpp +6 -6
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +3 -3
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +184 -26
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +92 -46
- package/src/duckdb/src/execution/operator/persistent/csv_buffer.cpp +19 -8
- package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +44 -55
- package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +137 -36
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +32 -28
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +114 -19
- package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +2 -1
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +258 -24
- package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +5 -3
- package/src/duckdb/src/execution/operator/projection/physical_projection.cpp +2 -2
- package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +5 -5
- package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +183 -124
- package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +187 -0
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +9 -8
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +33 -8
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +63 -86
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +22 -0
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +4 -3
- package/src/duckdb/src/execution/operator/set/physical_union.cpp +3 -3
- package/src/duckdb/src/execution/partitionable_hashtable.cpp +5 -5
- package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +4 -4
- package/src/duckdb/src/execution/physical_operator.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +20 -19
- package/src/duckdb/src/execution/physical_plan/plan_any_join.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_column_data_get.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +25 -23
- package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +11 -6
- package/src/duckdb/src/execution/physical_plan/plan_create.cpp +6 -6
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +63 -14
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +24 -18
- package/src/duckdb/src/execution/physical_plan/plan_cross_product.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +14 -8
- package/src/duckdb/src/execution/physical_plan/plan_delim_get.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_distinct.cpp +14 -13
- package/src/duckdb/src/execution/physical_plan/plan_execute.cpp +3 -3
- package/src/duckdb/src/execution/physical_plan/plan_explain.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_export.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_expression_get.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_filter.cpp +6 -6
- package/src/duckdb/src/execution/physical_plan/plan_get.cpp +15 -13
- package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +32 -17
- package/src/duckdb/src/execution/physical_plan/plan_limit.cpp +8 -7
- package/src/duckdb/src/execution/physical_plan/plan_limit_percent.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_order.cpp +5 -4
- package/src/duckdb/src/execution/physical_plan/plan_positional_join.cpp +21 -0
- package/src/duckdb/src/execution/physical_plan/plan_prepare.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_projection.cpp +3 -3
- package/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp +5 -5
- package/src/duckdb/src/execution/physical_plan/plan_sample.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_set_operation.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_show_select.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_simple.cpp +10 -8
- package/src/duckdb/src/execution/physical_plan/plan_top_n.cpp +3 -3
- package/src/duckdb/src/execution/physical_plan/plan_unnest.cpp +3 -3
- package/src/duckdb/src/execution/physical_plan/plan_update.cpp +13 -6
- package/src/duckdb/src/execution/physical_plan/plan_window.cpp +10 -8
- package/src/duckdb/src/execution/physical_plan_generator.cpp +5 -1
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +2 -2
- package/src/duckdb/src/execution/reservoir_sample.cpp +2 -2
- package/src/duckdb/src/execution/window_segment_tree.cpp +2 -1
- package/src/duckdb/src/function/aggregate/distributive/approx_count.cpp +2 -2
- package/src/duckdb/src/function/aggregate/distributive/arg_min_max.cpp +232 -72
- package/src/duckdb/src/function/aggregate/distributive/first.cpp +2 -2
- package/src/duckdb/src/function/aggregate/distributive/minmax.cpp +3 -3
- package/src/duckdb/src/function/aggregate/distributive/string_agg.cpp +2 -2
- package/src/duckdb/src/function/aggregate/holistic/approximate_quantile.cpp +2 -2
- package/src/duckdb/src/function/aggregate/holistic/quantile.cpp +4 -1
- package/src/duckdb/src/function/aggregate/holistic/reservoir_quantile.cpp +2 -2
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +6 -5
- package/src/duckdb/src/function/built_in_functions.cpp +10 -10
- package/src/duckdb/src/function/cast/bit_cast.cpp +19 -0
- package/src/duckdb/src/function/cast/blob_cast.cpp +1 -0
- package/src/duckdb/src/function/cast/cast_function_set.cpp +5 -5
- package/src/duckdb/src/function/cast/decimal_cast.cpp +2 -2
- package/src/duckdb/src/function/cast/default_casts.cpp +12 -9
- package/src/duckdb/src/function/cast/enum_casts.cpp +2 -3
- package/src/duckdb/src/function/cast/list_casts.cpp +1 -2
- package/src/duckdb/src/function/cast/map_cast.cpp +12 -1
- package/src/duckdb/src/function/cast/numeric_casts.cpp +0 -1
- package/src/duckdb/src/function/cast/string_cast.cpp +92 -7
- package/src/duckdb/src/function/cast/struct_cast.cpp +3 -4
- package/src/duckdb/src/function/cast/time_casts.cpp +0 -9
- package/src/duckdb/src/function/cast/union_casts.cpp +11 -9
- package/src/duckdb/src/function/cast/uuid_casts.cpp +0 -1
- package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +161 -53
- package/src/duckdb/src/function/cast_rules.cpp +2 -7
- package/src/duckdb/src/function/function.cpp +5 -5
- package/src/duckdb/src/function/function_binder.cpp +8 -8
- package/src/duckdb/src/function/function_set.cpp +3 -3
- package/src/duckdb/src/function/macro_function.cpp +12 -10
- package/src/duckdb/src/function/pragma/pragma_functions.cpp +1 -0
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +24 -6
- package/src/duckdb/src/function/pragma_function.cpp +7 -6
- package/src/duckdb/src/function/scalar/date/date_part.cpp +11 -11
- package/src/duckdb/src/function/scalar/date/date_trunc.cpp +1 -1
- package/src/duckdb/src/function/scalar/date/strftime.cpp +14 -13
- package/src/duckdb/src/function/scalar/date/time_bucket.cpp +371 -0
- package/src/duckdb/src/function/scalar/date_functions.cpp +1 -0
- package/src/duckdb/src/function/scalar/generic/constant_or_null.cpp +3 -3
- package/src/duckdb/src/function/scalar/generic/current_setting.cpp +1 -1
- package/src/duckdb/src/function/scalar/generic/stats.cpp +1 -1
- package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +9 -9
- package/src/duckdb/src/function/scalar/list/list_concat.cpp +1 -1
- package/src/duckdb/src/function/scalar/list/list_lambdas.cpp +20 -4
- package/src/duckdb/src/function/scalar/list/list_sort.cpp +4 -5
- package/src/duckdb/src/function/scalar/list/list_value.cpp +3 -3
- package/src/duckdb/src/function/scalar/map/map_extract.cpp +1 -4
- package/src/duckdb/src/function/scalar/math/numeric.cpp +35 -5
- package/src/duckdb/src/function/scalar/math/setseed.cpp +1 -1
- package/src/duckdb/src/function/scalar/math_functions.cpp +1 -0
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +11 -11
- package/src/duckdb/src/function/scalar/operators/bitwise.cpp +160 -10
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +5 -5
- package/src/duckdb/src/function/scalar/string/bar.cpp +93 -0
- package/src/duckdb/src/function/scalar/string/left_right.cpp +5 -1
- package/src/duckdb/src/function/scalar/string/length.cpp +30 -4
- package/src/duckdb/src/function/scalar/string/like.cpp +5 -4
- package/src/duckdb/src/function/scalar/string/regexp.cpp +12 -11
- package/src/duckdb/src/function/scalar/string/string_split.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/substring.cpp +8 -0
- package/src/duckdb/src/function/scalar/string_functions.cpp +7 -0
- package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +2 -1
- package/src/duckdb/src/function/scalar/struct/struct_insert.cpp +2 -2
- package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +2 -2
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +4 -4
- package/src/duckdb/src/function/scalar/system/system_functions.cpp +9 -2
- package/src/duckdb/src/function/scalar/union/union_extract.cpp +2 -1
- package/src/duckdb/src/function/scalar/union/union_value.cpp +1 -1
- package/src/duckdb/src/function/scalar_function.cpp +5 -4
- package/src/duckdb/src/function/scalar_macro_function.cpp +2 -2
- package/src/duckdb/src/function/table/arrow.cpp +7 -7
- package/src/duckdb/src/function/table/arrow_conversion.cpp +1 -2
- package/src/duckdb/src/function/table/checkpoint.cpp +1 -0
- package/src/duckdb/src/function/table/copy_csv.cpp +23 -24
- package/src/duckdb/src/function/table/glob.cpp +1 -1
- package/src/duckdb/src/function/table/pragma_detailed_profiling_output.cpp +4 -4
- package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +3 -3
- package/src/duckdb/src/function/table/range.cpp +2 -2
- package/src/duckdb/src/function/table/read_csv.cpp +223 -122
- package/src/duckdb/src/function/table/repeat.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +6 -6
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +71 -60
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +89 -0
- package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +14 -10
- package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +5 -5
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +13 -13
- package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +17 -10
- package/src/duckdb/src/function/table/system/duckdb_keywords.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_settings.cpp +4 -4
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +10 -6
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_views.cpp +2 -2
- package/src/duckdb/src/function/table/system/pragma_collations.cpp +1 -1
- package/src/duckdb/src/function/table/system/pragma_database_size.cpp +4 -4
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +42 -19
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +17 -11
- package/src/duckdb/src/function/table/system/test_all_types.cpp +22 -19
- package/src/duckdb/src/function/table/system/test_vector_types.cpp +8 -8
- package/src/duckdb/src/function/table/system_functions.cpp +1 -1
- package/src/duckdb/src/function/table/table_scan.cpp +34 -30
- package/src/duckdb/src/function/table/unnest.cpp +5 -5
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/table_function.cpp +1 -1
- package/src/duckdb/src/function/table_macro_function.cpp +2 -2
- package/src/duckdb/src/function/udf_function.cpp +4 -4
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +44 -20
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +29 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +69 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +71 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +3 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +19 -50
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +48 -39
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +9 -6
- package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +75 -0
- package/src/duckdb/src/include/duckdb/catalog/mapping_value.hpp +2 -1
- package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +32 -0
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/assert.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/bind_helpers.hpp +21 -0
- package/src/duckdb/src/include/duckdb/common/box_renderer.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enums/access_mode.hpp +17 -0
- package/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/enums/joinref_type.hpp +25 -0
- package/src/duckdb/src/include/duckdb/common/enums/logical_operator_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/optimizer_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +4 -1
- package/src/duckdb/src/include/duckdb/common/enums/relation_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/tableref_type.hpp +0 -1
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/file_buffer.hpp +3 -16
- package/src/duckdb/src/include/duckdb/common/file_opener.hpp +4 -1
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +17 -6
- package/src/duckdb/src/include/duckdb/common/gzip_file_system.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/helper.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/hive_partitioning.hpp +71 -2
- package/src/duckdb/src/include/duckdb/common/http_stats.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/index_vector.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/limits.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/local_file_system.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +41 -0
- package/src/duckdb/src/include/duckdb/common/operator/convert_to_string.hpp +18 -18
- package/src/duckdb/src/include/duckdb/common/operator/decimal_cast_operators.hpp +20 -0
- package/src/duckdb/src/include/duckdb/common/operator/numeric_cast.hpp +39 -0
- package/src/duckdb/src/include/duckdb/common/operator/subtract.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/progress_bar/display/terminal_progress_bar_display.hpp +6 -7
- package/src/duckdb/src/include/duckdb/common/radix_partitioning.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/serializer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/tree_renderer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/bit.hpp +57 -0
- package/src/duckdb/src/include/duckdb/common/types/chunk_collection.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/conflict_manager.hpp +71 -0
- package/src/duckdb/src/include/duckdb/common/types/constraint_conflict_info.hpp +27 -0
- package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/types/hugeint.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/types/partitioned_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/row_data_collection_scanner.hpp +4 -1
- package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +84 -4
- package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +1 -9
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +6 -5
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +17 -3
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/types.hpp +7 -5
- package/src/duckdb/src/include/duckdb/common/unicode_bar.hpp +35 -0
- package/src/duckdb/src/include/duckdb/common/union_by_name.hpp +93 -0
- package/src/duckdb/src/include/duckdb/common/vector_operations/generic_executor.hpp +141 -0
- package/src/duckdb/src/include/duckdb/common/vector_operations/ternary_executor.hpp +14 -0
- package/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +23 -4
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +26 -20
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +17 -8
- package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +21 -9
- package/src/duckdb/src/include/duckdb/execution/index/art/node16.hpp +15 -5
- package/src/duckdb/src/include/duckdb/execution/index/art/node256.hpp +14 -5
- package/src/duckdb/src/include/duckdb/execution/index/art/node4.hpp +16 -8
- package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +14 -5
- package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +26 -20
- package/src/duckdb/src/include/duckdb/execution/index/art/swizzleable_pointer.hpp +4 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +50 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/base_csv_reader.hpp +9 -8
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/buffered_csv_reader.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_buffer.hpp +9 -3
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_file_handle.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +31 -3
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/parallel_csv_reader.hpp +14 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +7 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +37 -2
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_unnest.hpp +5 -1
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_expression_scan.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +41 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +9 -17
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +37 -13
- package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +11 -2
- package/src/duckdb/src/include/duckdb/function/compression_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +12 -3
- package/src/duckdb/src/include/duckdb/function/create_database_extension.hpp +37 -0
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/function_set.hpp +4 -2
- package/src/duckdb/src/include/duckdb/function/replacement_scan.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/scalar/bit_functions.hpp +28 -0
- package/src/duckdb/src/include/duckdb/function/scalar/date_functions.hpp +4 -0
- package/src/duckdb/src/include/duckdb/function/scalar/math_functions.hpp +4 -0
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/scalar/strftime.hpp +4 -3
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +4 -0
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +7 -0
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +6 -4
- package/src/duckdb/src/include/duckdb/function/table/system_functions.hpp +6 -6
- package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +3 -2
- package/src/duckdb/src/include/duckdb/function/udf_function.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +6 -0
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +9 -1
- package/src/duckdb/src/include/duckdb/main/config.hpp +13 -8
- package/src/duckdb/src/include/duckdb/main/connection.hpp +7 -3
- package/src/duckdb/src/include/duckdb/main/connection_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/database.hpp +6 -0
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/extension_functions.hpp +5 -0
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +5 -5
- package/src/duckdb/src/include/duckdb/main/materialized_query_result.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/prepared_statement.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/relation/read_csv_relation.hpp +10 -11
- package/src/duckdb/src/include/duckdb/main/relation/read_json_relation.hpp +23 -0
- package/src/duckdb/src/include/duckdb/main/relation/table_function_relation.hpp +11 -2
- package/src/duckdb/src/include/duckdb/main/relation/write_csv_relation.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/relation/write_parquet_relation.hpp +34 -0
- package/src/duckdb/src/include/duckdb/main/relation.hpp +14 -1
- package/src/duckdb/src/include/duckdb/main/settings.hpp +9 -0
- package/src/duckdb/src/include/duckdb/main/valid_checker.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/deliminator.hpp +4 -1
- package/src/duckdb/src/include/duckdb/optimizer/filter_combiner.hpp +3 -3
- package/src/duckdb/src/include/duckdb/optimizer/filter_pushdown.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +3 -6
- package/src/duckdb/src/include/duckdb/optimizer/join_order/estimated_properties.hpp +0 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_node.hpp +0 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_order_optimizer.hpp +1 -2
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_relation.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/matcher/expression_type_matcher.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/matcher/function_matcher.hpp +2 -2
- package/src/duckdb/src/include/duckdb/optimizer/statistics_propagator.hpp +1 -0
- package/src/duckdb/src/include/duckdb/optimizer/unnest_rewriter.hpp +84 -0
- package/src/duckdb/src/include/duckdb/parallel/task_counter.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +3 -3
- package/src/duckdb/src/include/duckdb/parser/column_list.hpp +3 -1
- package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +3 -3
- package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +4 -3
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_database_info.hpp +50 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +1 -1
- 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 +1 -1
- 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 +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +28 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/load_info.hpp +17 -0
- package/src/duckdb/src/include/duckdb/parser/parser_extension.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/qualified_name.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/result_modifier.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/statement/copy_statement.hpp +4 -0
- package/src/duckdb/src/include/duckdb/parser/statement/insert_statement.hpp +33 -0
- package/src/duckdb/src/include/duckdb/parser/statement/logical_plan_statement.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/statement/update_statement.hpp +20 -3
- package/src/duckdb/src/include/duckdb/parser/tableref/joinref.hpp +6 -3
- package/src/duckdb/src/include/duckdb/parser/tableref/list.hpp +0 -1
- package/src/duckdb/src/include/duckdb/parser/tableref/table_function_ref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/tokens.hpp +0 -1
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +23 -0
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +4 -3
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +32 -20
- package/src/duckdb/src/include/duckdb/planner/bound_tokens.hpp +0 -1
- package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_foreign_key_constraint.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_unique_constraint.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +54 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/column_alias_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/returning_binder.hpp +0 -4
- package/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +3 -4
- package/src/duckdb/src/include/duckdb/planner/logical_tokens.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +8 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +3 -3
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cross_product.hpp +3 -8
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +4 -20
- package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_execute.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_export.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_extension_operator.hpp +2 -3
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +28 -18
- package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_positional_join.hpp +28 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_prepare.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_simple.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_unconditional_join.hpp +31 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +1 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +4 -18
- package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_function_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_table_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/table_binding.hpp +8 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_basetableref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_joinref.hpp +5 -1
- package/src/duckdb/src/include/duckdb/planner/tableref/{bound_crossproductref.hpp → bound_pos_join_ref.hpp} +9 -9
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_subqueryref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_table_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/tableref/list.hpp +0 -1
- package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +12 -7
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +10 -5
- package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +1 -3
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +3 -3
- 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 +3 -3
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +14 -9
- package/src/duckdb/src/include/duckdb/storage/database_size.hpp +24 -0
- package/src/duckdb/src/include/duckdb/storage/index.hpp +32 -11
- package/src/duckdb/src/include/duckdb/storage/magic_bytes.hpp +28 -0
- package/src/duckdb/src/include/duckdb/storage/object_cache.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp +9 -1
- package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +43 -0
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +1 -9
- package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +6 -4
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/table/segment_base.hpp +9 -1
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +8 -2
- package/src/duckdb/src/include/duckdb/storage/table_storage_info.hpp +48 -0
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +5 -5
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +68 -0
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction_manager.hpp +75 -0
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +9 -7
- package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +3 -0
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +9 -42
- package/src/duckdb/src/include/duckdb/transaction/transaction_data.hpp +3 -2
- package/src/duckdb/src/include/duckdb/transaction/transaction_manager.hpp +12 -41
- package/src/duckdb/src/include/duckdb.h +32 -2
- package/src/duckdb/src/include/duckdb.hpp +1 -0
- package/src/duckdb/src/main/appender.cpp +4 -3
- package/src/duckdb/src/main/attached_database.cpp +32 -9
- package/src/duckdb/src/main/capi/arrow-c.cpp +1 -1
- package/src/duckdb/src/main/capi/data_chunk-c.cpp +20 -1
- package/src/duckdb/src/main/capi/duckdb-c.cpp +1 -1
- package/src/duckdb/src/main/capi/helper-c.cpp +2 -4
- package/src/duckdb/src/main/capi/pending-c.cpp +1 -1
- package/src/duckdb/src/main/capi/prepared-c.cpp +2 -2
- package/src/duckdb/src/main/capi/replacement_scan-c.cpp +6 -6
- package/src/duckdb/src/main/capi/result-c.cpp +1 -1
- package/src/duckdb/src/main/capi/table_function-c.cpp +4 -4
- package/src/duckdb/src/main/capi/threading-c.cpp +8 -0
- package/src/duckdb/src/main/client_context.cpp +90 -61
- package/src/duckdb/src/main/client_context_file_opener.cpp +14 -0
- package/src/duckdb/src/main/client_data.cpp +2 -0
- package/src/duckdb/src/main/client_verify.cpp +7 -7
- package/src/duckdb/src/main/config.cpp +13 -2
- package/src/duckdb/src/main/connection.cpp +14 -15
- package/src/duckdb/src/main/database.cpp +88 -34
- package/src/duckdb/src/main/database_manager.cpp +6 -4
- package/src/duckdb/src/main/error_manager.cpp +1 -1
- package/src/duckdb/src/main/extension/extension_alias.cpp +1 -0
- package/src/duckdb/src/main/extension/extension_helper.cpp +18 -1
- package/src/duckdb/src/main/extension/extension_install.cpp +6 -1
- package/src/duckdb/src/main/extension/extension_load.cpp +22 -28
- package/src/duckdb/src/main/materialized_query_result.cpp +16 -4
- package/src/duckdb/src/main/pending_query_result.cpp +4 -4
- package/src/duckdb/src/main/prepared_statement.cpp +16 -3
- package/src/duckdb/src/main/query_profiler.cpp +6 -6
- package/src/duckdb/src/main/query_result.cpp +12 -7
- package/src/duckdb/src/main/relation/aggregate_relation.cpp +6 -6
- package/src/duckdb/src/main/relation/create_table_relation.cpp +4 -4
- package/src/duckdb/src/main/relation/create_view_relation.cpp +7 -6
- package/src/duckdb/src/main/relation/cross_product_relation.cpp +6 -5
- package/src/duckdb/src/main/relation/delete_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/distinct_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/explain_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/filter_relation.cpp +4 -3
- package/src/duckdb/src/main/relation/insert_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/join_relation.cpp +7 -7
- package/src/duckdb/src/main/relation/limit_relation.cpp +2 -2
- package/src/duckdb/src/main/relation/order_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/projection_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/query_relation.cpp +5 -4
- package/src/duckdb/src/main/relation/read_csv_relation.cpp +31 -39
- package/src/duckdb/src/main/relation/read_json_relation.cpp +20 -0
- package/src/duckdb/src/main/relation/setop_relation.cpp +3 -3
- package/src/duckdb/src/main/relation/subquery_relation.cpp +2 -1
- package/src/duckdb/src/main/relation/table_function_relation.cpp +29 -17
- package/src/duckdb/src/main/relation/table_relation.cpp +7 -7
- package/src/duckdb/src/main/relation/update_relation.cpp +9 -6
- package/src/duckdb/src/main/relation/value_relation.cpp +6 -6
- package/src/duckdb/src/main/relation/view_relation.cpp +4 -3
- package/src/duckdb/src/main/relation/write_csv_relation.cpp +6 -3
- package/src/duckdb/src/main/relation/write_parquet_relation.cpp +37 -0
- package/src/duckdb/src/main/relation.cpp +53 -30
- package/src/duckdb/src/main/settings/settings.cpp +20 -3
- package/src/duckdb/src/main/stream_query_result.cpp +6 -5
- package/src/duckdb/src/main/valid_checker.cpp +1 -1
- package/src/duckdb/src/optimizer/cse_optimizer.cpp +5 -5
- package/src/duckdb/src/optimizer/deliminator.cpp +16 -9
- package/src/duckdb/src/optimizer/expression_heuristics.cpp +2 -2
- package/src/duckdb/src/optimizer/expression_rewriter.cpp +7 -7
- package/src/duckdb/src/optimizer/filter_combiner.cpp +41 -36
- package/src/duckdb/src/optimizer/filter_pullup.cpp +17 -17
- package/src/duckdb/src/optimizer/filter_pushdown.cpp +24 -24
- package/src/duckdb/src/optimizer/in_clause_rewriter.cpp +14 -14
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +8 -7
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +77 -61
- package/src/duckdb/src/optimizer/join_order/join_relation_set.cpp +5 -5
- package/src/duckdb/src/optimizer/join_order/query_graph.cpp +1 -1
- package/src/duckdb/src/optimizer/optimizer.cpp +19 -11
- package/src/duckdb/src/optimizer/pullup/pullup_both_side.cpp +4 -4
- package/src/duckdb/src/optimizer/pullup/pullup_filter.cpp +4 -4
- package/src/duckdb/src/optimizer/pullup/pullup_from_left.cpp +3 -3
- package/src/duckdb/src/optimizer/pullup/pullup_projection.cpp +7 -7
- package/src/duckdb/src/optimizer/pullup/pullup_set_operation.cpp +2 -2
- package/src/duckdb/src/optimizer/pushdown/pushdown_aggregate.cpp +6 -6
- package/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp +8 -7
- package/src/duckdb/src/optimizer/pushdown/pushdown_filter.cpp +4 -4
- package/src/duckdb/src/optimizer/pushdown/pushdown_get.cpp +5 -5
- package/src/duckdb/src/optimizer/pushdown/pushdown_inner_join.cpp +8 -8
- package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +13 -13
- package/src/duckdb/src/optimizer/pushdown/pushdown_limit.cpp +2 -2
- package/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp +4 -4
- package/src/duckdb/src/optimizer/pushdown/pushdown_projection.cpp +6 -6
- package/src/duckdb/src/optimizer/pushdown/pushdown_set_operation.cpp +9 -9
- package/src/duckdb/src/optimizer/pushdown/pushdown_single_join.cpp +4 -4
- package/src/duckdb/src/optimizer/regex_range_filter.cpp +5 -5
- package/src/duckdb/src/optimizer/remove_unused_columns.cpp +13 -4
- package/src/duckdb/src/optimizer/rule/arithmetic_simplification.cpp +6 -6
- package/src/duckdb/src/optimizer/rule/case_simplification.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/comparison_simplification.cpp +6 -6
- package/src/duckdb/src/optimizer/rule/conjunction_simplification.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/constant_folding.cpp +1 -1
- package/src/duckdb/src/optimizer/rule/date_part_simplification.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/distributivity.cpp +11 -11
- package/src/duckdb/src/optimizer/rule/empty_needle_removal.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/enum_comparison.cpp +8 -7
- package/src/duckdb/src/optimizer/rule/equal_or_null_simplification.cpp +7 -7
- package/src/duckdb/src/optimizer/rule/in_clause_simplification_rule.cpp +5 -5
- package/src/duckdb/src/optimizer/rule/like_optimizations.cpp +8 -8
- package/src/duckdb/src/optimizer/rule/move_constants.cpp +14 -14
- package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +3 -3
- package/src/duckdb/src/optimizer/statistics/expression/propagate_and_compress.cpp +12 -12
- package/src/duckdb/src/optimizer/statistics/expression/propagate_between.cpp +12 -10
- package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +6 -6
- package/src/duckdb/src/optimizer/statistics/expression/propagate_conjunction.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_constant.cpp +4 -4
- package/src/duckdb/src/optimizer/statistics/expression/propagate_operator.cpp +3 -3
- package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +3 -3
- package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp +3 -3
- package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +69 -13
- package/src/duckdb/src/optimizer/statistics/operator/propagate_order.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_projection.cpp +3 -3
- package/src/duckdb/src/optimizer/statistics/operator/propagate_set_operation.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_window.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics_propagator.cpp +3 -1
- package/src/duckdb/src/optimizer/topn_optimizer.cpp +4 -4
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +312 -0
- package/src/duckdb/src/parallel/base_pipeline_event.cpp +1 -1
- package/src/duckdb/src/parallel/event.cpp +4 -4
- package/src/duckdb/src/parallel/executor.cpp +13 -9
- package/src/duckdb/src/parallel/pipeline.cpp +4 -4
- package/src/duckdb/src/parallel/pipeline_event.cpp +1 -1
- package/src/duckdb/src/parallel/pipeline_executor.cpp +1 -1
- package/src/duckdb/src/parallel/pipeline_finish_event.cpp +1 -1
- package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +3 -3
- package/src/duckdb/src/parallel/task_scheduler.cpp +10 -10
- package/src/duckdb/src/parser/column_definition.cpp +16 -12
- package/src/duckdb/src/parser/column_list.cpp +20 -2
- package/src/duckdb/src/parser/constraints/check_constraint.cpp +2 -2
- package/src/duckdb/src/parser/constraints/foreign_key_constraint.cpp +3 -3
- package/src/duckdb/src/parser/constraints/unique_constraint.cpp +5 -5
- package/src/duckdb/src/parser/expression/between_expression.cpp +5 -5
- package/src/duckdb/src/parser/expression/case_expression.cpp +5 -5
- package/src/duckdb/src/parser/expression/cast_expression.cpp +5 -5
- package/src/duckdb/src/parser/expression/collate_expression.cpp +5 -5
- package/src/duckdb/src/parser/expression/columnref_expression.cpp +10 -8
- package/src/duckdb/src/parser/expression/comparison_expression.cpp +4 -4
- package/src/duckdb/src/parser/expression/conjunction_expression.cpp +9 -9
- package/src/duckdb/src/parser/expression/constant_expression.cpp +4 -4
- package/src/duckdb/src/parser/expression/default_expression.cpp +1 -1
- package/src/duckdb/src/parser/expression/function_expression.cpp +12 -11
- package/src/duckdb/src/parser/expression/lambda_expression.cpp +4 -4
- package/src/duckdb/src/parser/expression/operator_expression.cpp +6 -6
- package/src/duckdb/src/parser/expression/parameter_expression.cpp +3 -3
- package/src/duckdb/src/parser/expression/positional_reference_expression.cpp +4 -4
- package/src/duckdb/src/parser/expression/star_expression.cpp +5 -5
- package/src/duckdb/src/parser/expression/subquery_expression.cpp +4 -4
- package/src/duckdb/src/parser/expression/window_expression.cpp +6 -6
- package/src/duckdb/src/parser/parsed_data/alter_function_info.cpp +4 -2
- package/src/duckdb/src/parser/parsed_data/alter_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +45 -41
- package/src/duckdb/src/parser/parsed_data/create_aggregate_function_info.cpp +3 -3
- package/src/duckdb/src/parser/parsed_data/create_collation_info.cpp +3 -3
- package/src/duckdb/src/parser/parsed_data/create_copy_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/create_info.cpp +3 -0
- package/src/duckdb/src/parser/parsed_data/create_pragma_function_info.cpp +4 -4
- package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +4 -4
- package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +4 -4
- package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +4 -3
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +56 -3
- package/src/duckdb/src/parser/parsed_expression.cpp +17 -17
- package/src/duckdb/src/parser/parsed_expression_iterator.cpp +2 -7
- package/src/duckdb/src/parser/parser.cpp +148 -31
- package/src/duckdb/src/parser/query_node/recursive_cte_node.cpp +2 -2
- package/src/duckdb/src/parser/query_node/select_node.cpp +2 -2
- package/src/duckdb/src/parser/query_node/set_operation_node.cpp +2 -2
- package/src/duckdb/src/parser/query_node.cpp +5 -5
- package/src/duckdb/src/parser/result_modifier.cpp +9 -9
- package/src/duckdb/src/parser/statement/copy_statement.cpp +102 -0
- package/src/duckdb/src/parser/statement/explain_statement.cpp +1 -1
- package/src/duckdb/src/parser/statement/export_statement.cpp +1 -1
- package/src/duckdb/src/parser/statement/extension_statement.cpp +2 -1
- package/src/duckdb/src/parser/statement/insert_statement.cpp +87 -1
- package/src/duckdb/src/parser/statement/relation_statement.cpp +1 -1
- package/src/duckdb/src/parser/statement/set_statement.cpp +3 -3
- package/src/duckdb/src/parser/statement/update_statement.cpp +21 -6
- package/src/duckdb/src/parser/tableref/basetableref.cpp +2 -2
- package/src/duckdb/src/parser/tableref/expressionlistref.cpp +4 -4
- package/src/duckdb/src/parser/tableref/joinref.cpp +20 -9
- package/src/duckdb/src/parser/tableref/subqueryref.cpp +5 -5
- package/src/duckdb/src/parser/tableref/table_function.cpp +2 -2
- package/src/duckdb/src/parser/tableref.cpp +2 -5
- package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +2 -2
- package/src/duckdb/src/parser/transform/expression/transform_array_access.cpp +5 -5
- package/src/duckdb/src/parser/transform/expression/transform_bool_expr.cpp +9 -7
- package/src/duckdb/src/parser/transform/expression/transform_case.cpp +4 -4
- package/src/duckdb/src/parser/transform/expression/transform_cast.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_coalesce.cpp +2 -2
- package/src/duckdb/src/parser/transform/expression/transform_columnref.cpp +5 -5
- package/src/duckdb/src/parser/transform/expression/transform_constant.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_expression.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +24 -24
- package/src/duckdb/src/parser/transform/expression/transform_grouping_function.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_interval.cpp +4 -4
- package/src/duckdb/src/parser/transform/expression/transform_is_null.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_lambda.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +37 -36
- 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 +13 -13
- package/src/duckdb/src/parser/transform/helpers/nodetype_to_string.cpp +2 -0
- package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +1 -1
- package/src/duckdb/src/parser/transform/helpers/transform_groupby.cpp +6 -6
- package/src/duckdb/src/parser/transform/helpers/transform_orderby.cpp +1 -1
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +35 -4
- package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +8 -8
- package/src/duckdb/src/parser/transform/statement/transform_attach.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_checkpoint.cpp +3 -3
- package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +5 -3
- package/src/duckdb/src/parser/transform/statement/transform_create_database.cpp +29 -0
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +6 -6
- package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +25 -18
- package/src/duckdb/src/parser/transform/statement/transform_create_schema.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_sequence.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +4 -4
- 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 -2
- package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_delete.cpp +1 -2
- package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +13 -4
- package/src/duckdb/src/parser/transform/statement/transform_export.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +20 -5
- package/src/duckdb/src/parser/transform/statement/transform_load.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +9 -2
- package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +4 -4
- package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +5 -5
- package/src/duckdb/src/parser/transform/statement/transform_show.cpp +8 -7
- package/src/duckdb/src/parser/transform/statement/transform_update.cpp +15 -7
- package/src/duckdb/src/parser/transform/statement/transform_upsert.cpp +95 -0
- 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 +10 -10
- package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +12 -10
- 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 +4 -2
- package/src/duckdb/src/planner/bind_context.cpp +15 -14
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +9 -9
- package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +12 -12
- package/src/duckdb/src/planner/binder/expression/bind_case_expression.cpp +5 -5
- package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +5 -5
- package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +13 -12
- package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +9 -8
- package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +3 -2
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +59 -16
- package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +44 -26
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/expression/bind_parameter_expression.cpp +3 -3
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +12 -12
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +3 -3
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +19 -19
- 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 +38 -34
- package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +5 -5
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +1 -1
- package/src/duckdb/src/planner/binder/query_node/plan_query_node.cpp +14 -14
- package/src/duckdb/src/planner/binder/query_node/plan_recursive_cte_node.cpp +9 -8
- package/src/duckdb/src/planner/binder/query_node/plan_select_node.cpp +31 -31
- package/src/duckdb/src/planner/binder/query_node/plan_setop.cpp +21 -19
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +63 -61
- package/src/duckdb/src/planner/binder/statement/bind_attach.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_call.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +102 -25
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +141 -52
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +10 -10
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +13 -12
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_execute.cpp +7 -7
- package/src/duckdb/src/planner/binder/statement/bind_explain.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +30 -25
- package/src/duckdb/src/planner/binder/statement/bind_extension.cpp +3 -2
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +361 -20
- package/src/duckdb/src/planner/binder/statement/bind_load.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_logical_plan.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_prepare.cpp +3 -3
- package/src/duckdb/src/planner/binder/statement/bind_show.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_summarize.cpp +31 -29
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +75 -57
- package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +11 -10
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +19 -10
- package/src/duckdb/src/planner/binder/tableref/bind_expressionlistref.cpp +4 -4
- package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +24 -16
- package/src/duckdb/src/planner/binder/tableref/bind_subqueryref.cpp +2 -2
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +22 -18
- package/src/duckdb/src/planner/binder/tableref/plan_basetableref.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/plan_expressionlistref.cpp +3 -3
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +43 -32
- package/src/duckdb/src/planner/binder/tableref/plan_table_function.cpp +1 -1
- package/src/duckdb/src/planner/binder.cpp +38 -23
- package/src/duckdb/src/planner/bound_result_modifier.cpp +3 -3
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +6 -6
- package/src/duckdb/src/planner/expression/bound_between_expression.cpp +4 -3
- package/src/duckdb/src/planner/expression/bound_case_expression.cpp +12 -12
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +9 -8
- package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_comparison_expression.cpp +4 -3
- package/src/duckdb/src/planner/expression/bound_conjunction_expression.cpp +5 -5
- package/src/duckdb/src/planner/expression/bound_constant_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_function_expression.cpp +8 -7
- package/src/duckdb/src/planner/expression/bound_lambda_expression.cpp +3 -3
- package/src/duckdb/src/planner/expression/bound_lambdaref_expression.cpp +71 -0
- package/src/duckdb/src/planner/expression/bound_operator_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +3 -3
- package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +3 -3
- package/src/duckdb/src/planner/expression/bound_subquery_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_unnest_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +8 -7
- package/src/duckdb/src/planner/expression.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/alter_binder.cpp +3 -4
- package/src/duckdb/src/planner/expression_binder/check_binder.cpp +16 -2
- package/src/duckdb/src/planner/expression_binder/column_alias_binder.cpp +6 -4
- package/src/duckdb/src/planner/expression_binder/constant_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/group_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/having_binder.cpp +5 -2
- package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +6 -5
- package/src/duckdb/src/planner/expression_binder/relation_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/returning_binder.cpp +1 -9
- package/src/duckdb/src/planner/expression_binder/select_binder.cpp +7 -2
- package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +15 -2
- package/src/duckdb/src/planner/expression_binder.cpp +6 -6
- package/src/duckdb/src/planner/expression_iterator.cpp +4 -7
- package/src/duckdb/src/planner/filter/conjunction_filter.cpp +2 -2
- package/src/duckdb/src/planner/filter/constant_filter.cpp +1 -1
- package/src/duckdb/src/planner/joinside.cpp +10 -9
- package/src/duckdb/src/planner/logical_operator.cpp +6 -3
- package/src/duckdb/src/planner/logical_operator_visitor.cpp +11 -1
- package/src/duckdb/src/planner/operator/logical_aggregate.cpp +8 -7
- package/src/duckdb/src/planner/operator/logical_any_join.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +4 -3
- package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +10 -5
- 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 +1 -1
- package/src/duckdb/src/planner/operator/logical_cross_product.cpp +3 -19
- package/src/duckdb/src/planner/operator/logical_delete.cpp +22 -1
- package/src/duckdb/src/planner/operator/logical_delim_join.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_distinct.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_empty_result.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_explain.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_expression_get.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_filter.cpp +6 -6
- package/src/duckdb/src/planner/operator/logical_get.cpp +10 -10
- package/src/duckdb/src/planner/operator/logical_insert.cpp +26 -3
- package/src/duckdb/src/planner/operator/logical_limit.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_limit_percent.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_order.cpp +3 -3
- package/src/duckdb/src/planner/operator/logical_positional_join.cpp +30 -0
- package/src/duckdb/src/planner/operator/logical_projection.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_sample.cpp +4 -4
- package/src/duckdb/src/planner/operator/logical_show.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_simple.cpp +33 -2
- package/src/duckdb/src/planner/operator/logical_top_n.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_unconditional_join.cpp +26 -0
- package/src/duckdb/src/planner/operator/logical_unnest.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_update.cpp +20 -1
- package/src/duckdb/src/planner/operator/logical_window.cpp +1 -1
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +1 -1
- package/src/duckdb/src/planner/planner.cpp +7 -9
- package/src/duckdb/src/planner/pragma_handler.cpp +3 -3
- package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +66 -60
- package/src/duckdb/src/planner/subquery/rewrite_correlated_expressions.cpp +4 -3
- package/src/duckdb/src/planner/table_binding.cpp +61 -30
- package/src/duckdb/src/planner/table_filter.cpp +6 -6
- package/src/duckdb/src/storage/arena_allocator.cpp +37 -7
- package/src/duckdb/src/storage/block.cpp +2 -2
- package/src/duckdb/src/storage/buffer/buffer_handle.cpp +1 -1
- package/src/duckdb/src/storage/buffer_manager.cpp +48 -33
- package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +2 -2
- package/src/duckdb/src/storage/checkpoint/table_data_reader.cpp +1 -1
- package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +6 -4
- package/src/duckdb/src/storage/checkpoint_manager.cpp +14 -13
- package/src/duckdb/src/storage/compression/bitpacking.cpp +5 -4
- package/src/duckdb/src/storage/compression/dictionary_compression.cpp +3 -3
- package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +5 -5
- package/src/duckdb/src/storage/compression/fsst.cpp +40 -25
- package/src/duckdb/src/storage/compression/rle.cpp +3 -3
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +8 -8
- package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +2 -2
- package/src/duckdb/src/storage/data_table.cpp +309 -104
- package/src/duckdb/src/storage/index.cpp +12 -6
- package/src/duckdb/src/storage/local_storage.cpp +27 -32
- package/src/duckdb/src/storage/magic_bytes.cpp +31 -0
- package/src/duckdb/src/storage/meta_block_writer.cpp +1 -1
- package/src/duckdb/src/storage/partial_block_manager.cpp +4 -4
- package/src/duckdb/src/storage/single_file_block_manager.cpp +108 -71
- package/src/duckdb/src/storage/statistics/base_statistics.cpp +13 -12
- package/src/duckdb/src/storage/statistics/column_statistics.cpp +2 -2
- package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +2 -2
- package/src/duckdb/src/storage/statistics/list_statistics.cpp +4 -4
- package/src/duckdb/src/storage/statistics/numeric_statistics.cpp +106 -8
- package/src/duckdb/src/storage/statistics/segment_statistics.cpp +2 -2
- package/src/duckdb/src/storage/statistics/string_statistics.cpp +4 -4
- package/src/duckdb/src/storage/statistics/struct_statistics.cpp +5 -4
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/src/storage/storage_manager.cpp +8 -4
- package/src/duckdb/src/storage/table/chunk_info.cpp +2 -2
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +4 -4
- package/src/duckdb/src/storage/table/column_data.cpp +28 -38
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +5 -5
- package/src/duckdb/src/storage/table/column_segment.cpp +16 -16
- package/src/duckdb/src/storage/table/list_column_data.cpp +11 -11
- package/src/duckdb/src/storage/table/row_group.cpp +21 -18
- package/src/duckdb/src/storage/table/row_group_collection.cpp +21 -22
- package/src/duckdb/src/storage/table/scan_state.cpp +3 -3
- package/src/duckdb/src/storage/table/segment_tree.cpp +5 -5
- package/src/duckdb/src/storage/table/standard_column_data.cpp +11 -11
- package/src/duckdb/src/storage/table/struct_column_data.cpp +13 -13
- package/src/duckdb/src/storage/table/table_statistics.cpp +1 -1
- package/src/duckdb/src/storage/table/update_segment.cpp +7 -6
- package/src/duckdb/src/storage/table_index_list.cpp +12 -10
- package/src/duckdb/src/storage/wal_replay.cpp +6 -6
- package/src/duckdb/src/transaction/commit_state.cpp +9 -3
- package/src/duckdb/src/transaction/duck_transaction.cpp +155 -0
- package/src/duckdb/src/transaction/duck_transaction_manager.cpp +342 -0
- package/src/duckdb/src/transaction/meta_transaction.cpp +3 -0
- package/src/duckdb/src/transaction/transaction.cpp +10 -132
- package/src/duckdb/src/transaction/transaction_context.cpp +2 -2
- package/src/duckdb/src/transaction/transaction_manager.cpp +1 -321
- package/src/duckdb/src/verification/copied_statement_verifier.cpp +1 -1
- package/src/duckdb/src/verification/deserialized_statement_verifier.cpp +1 -1
- package/src/duckdb/src/verification/external_statement_verifier.cpp +1 -1
- package/src/duckdb/src/verification/parsed_statement_verifier.cpp +2 -2
- package/src/duckdb/src/verification/prepared_statement_verifier.cpp +12 -12
- package/src/duckdb/src/verification/statement_verifier.cpp +5 -4
- package/src/duckdb/src/verification/unoptimized_statement_verifier.cpp +1 -1
- package/src/duckdb/third_party/fast_float/fast_float/fast_float.h +22 -19
- package/src/duckdb/third_party/fmt/include/fmt/core.h +5 -3
- package/src/duckdb/third_party/fmt/include/fmt/format.h +10 -10
- package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +19 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +12 -0
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +355 -352
- package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +1 -0
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +19986 -19619
- package/src/duckdb/third_party/libpg_query/src_backend_parser_scan.cpp +2 -2
- package/src/duckdb/third_party/mbedtls/library/bignum.cpp +1 -3
- package/src/duckdb/third_party/thrift/thrift/TApplicationException.h +0 -3
- package/src/duckdb/third_party/zstd/decompress/huf_decompress.cpp +4 -4
- package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +6 -6
- package/src/duckdb/ub_extension_json_json_functions.cpp +8 -0
- package/src/duckdb/ub_src_catalog.cpp +4 -0
- package/src/duckdb/ub_src_catalog_catalog_entry.cpp +6 -0
- package/src/duckdb/ub_src_common.cpp +2 -0
- package/src/duckdb/ub_src_common_types.cpp +6 -0
- package/src/duckdb/ub_src_execution_operator_join.cpp +2 -0
- package/src/duckdb/ub_src_execution_operator_scan.cpp +2 -0
- package/src/duckdb/ub_src_execution_physical_plan.cpp +2 -0
- package/src/duckdb/ub_src_function_cast.cpp +2 -0
- package/src/duckdb/ub_src_function_scalar_date.cpp +2 -0
- package/src/duckdb/ub_src_function_scalar_string.cpp +2 -0
- package/src/duckdb/ub_src_function_table_system.cpp +2 -2
- package/src/duckdb/ub_src_main.cpp +0 -2
- package/src/duckdb/ub_src_main_relation.cpp +4 -0
- package/src/duckdb/ub_src_optimizer.cpp +2 -0
- package/src/duckdb/ub_src_parser_tableref.cpp +0 -2
- package/src/duckdb/ub_src_parser_transform_statement.cpp +4 -0
- package/src/duckdb/ub_src_planner_binder_tableref.cpp +0 -4
- package/src/duckdb/ub_src_planner_expression.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_transaction.cpp +4 -0
- package/src/duckdb_node.hpp +8 -0
- package/src/statement.cpp +5 -50
- package/src/utils.cpp +42 -0
- package/test/replacement_scan.test.ts +144 -0
- package/test/udf.test.ts +9 -0
- package/src/duckdb/src/function/table/system/pragma_database_list.cpp +0 -59
- package/src/duckdb/src/include/duckdb/function/replacement_open.hpp +0 -45
- package/src/duckdb/src/include/duckdb/parser/tableref/crossproductref.hpp +0 -36
- package/src/duckdb/src/main/extension_prefix_opener.cpp +0 -47
- package/src/duckdb/src/parser/tableref/crossproductref.cpp +0 -43
- package/src/duckdb/src/planner/binder/tableref/bind_crossproductref.cpp +0 -31
- package/src/duckdb/src/planner/binder/tableref/plan_crossproductref.cpp +0 -26
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include "duckdb/common/row_operations/row_operations.hpp"
|
|
6
6
|
#include "duckdb/common/sort/sort.hpp"
|
|
7
7
|
#include "duckdb/common/types/chunk_collection.hpp"
|
|
8
|
+
#include "duckdb/common/types/column_data_consumer.hpp"
|
|
8
9
|
#include "duckdb/common/types/row_data_collection_scanner.hpp"
|
|
9
10
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
|
10
11
|
#include "duckdb/common/windows_undefs.hpp"
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
#include "duckdb/parallel/base_pipeline_event.hpp"
|
|
17
18
|
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
|
18
19
|
#include "duckdb/planner/expression/bound_window_expression.hpp"
|
|
20
|
+
#include "duckdb/common/radix_partitioning.hpp"
|
|
19
21
|
|
|
20
22
|
#include <algorithm>
|
|
21
23
|
#include <cmath>
|
|
@@ -23,8 +25,6 @@
|
|
|
23
25
|
|
|
24
26
|
namespace duckdb {
|
|
25
27
|
|
|
26
|
-
using counts_t = std::vector<size_t>;
|
|
27
|
-
|
|
28
28
|
class WindowGlobalHashGroup {
|
|
29
29
|
public:
|
|
30
30
|
using GlobalSortStatePtr = unique_ptr<GlobalSortState>;
|
|
@@ -33,8 +33,8 @@ public:
|
|
|
33
33
|
using Types = vector<LogicalType>;
|
|
34
34
|
|
|
35
35
|
WindowGlobalHashGroup(BufferManager &buffer_manager, const Orders &partitions, const Orders &orders,
|
|
36
|
-
const Types &payload_types,
|
|
37
|
-
:
|
|
36
|
+
const Types &payload_types, bool external)
|
|
37
|
+
: count(0) {
|
|
38
38
|
|
|
39
39
|
RowLayout payload_layout;
|
|
40
40
|
payload_layout.Initialize(payload_types);
|
|
@@ -44,17 +44,8 @@ public:
|
|
|
44
44
|
partition_layout = global_sort->sort_layout.GetPrefixComparisonLayout(partitions.size());
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
void Combine(LocalSortState &local_sort) {
|
|
48
|
-
global_sort->AddLocalState(local_sort);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
void PrepareMergePhase() {
|
|
52
|
-
global_sort->PrepareMergePhase();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
47
|
void ComputeMasks(ValidityMask &partition_mask, ValidityMask &order_mask);
|
|
56
48
|
|
|
57
|
-
const idx_t memory_per_thread;
|
|
58
49
|
GlobalSortStatePtr global_sort;
|
|
59
50
|
atomic<idx_t> count;
|
|
60
51
|
|
|
@@ -100,19 +91,19 @@ public:
|
|
|
100
91
|
using Orders = vector<BoundOrderByNode>;
|
|
101
92
|
using Types = vector<LogicalType>;
|
|
102
93
|
|
|
94
|
+
using GroupingPartition = unique_ptr<PartitionedColumnData>;
|
|
95
|
+
using GroupingAppend = unique_ptr<PartitionedColumnDataAppendState>;
|
|
96
|
+
|
|
103
97
|
WindowGlobalSinkState(const PhysicalWindow &op_p, ClientContext &context)
|
|
104
98
|
: op(op_p), context(context), buffer_manager(BufferManager::GetBufferManager(context)),
|
|
105
|
-
allocator(Allocator::Get(context)),
|
|
106
|
-
|
|
107
|
-
memory_per_thread(0), count(0), mode(DBConfig::GetConfig(context).options.window_mode) {
|
|
99
|
+
allocator(Allocator::Get(context)), payload_types(op.children[0]->types), memory_per_thread(0), count(0),
|
|
100
|
+
mode(DBConfig::GetConfig(context).options.window_mode) {
|
|
108
101
|
|
|
109
102
|
D_ASSERT(op.select_list[0]->GetExpressionClass() == ExpressionClass::BOUND_WINDOW);
|
|
110
103
|
auto wexpr = reinterpret_cast<BoundWindowExpression *>(op.select_list[0].get());
|
|
111
104
|
|
|
112
105
|
// we sort by both 1) partition by expression list and 2) order by expressions
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
partition_cols = wexpr->partitions.size();
|
|
106
|
+
const auto partition_cols = wexpr->partitions.size();
|
|
116
107
|
for (idx_t prt_idx = 0; prt_idx < partition_cols; prt_idx++) {
|
|
117
108
|
auto &pexpr = wexpr->partitions[prt_idx];
|
|
118
109
|
|
|
@@ -131,77 +122,37 @@ public:
|
|
|
131
122
|
|
|
132
123
|
memory_per_thread = op.GetMaxThreadMemory(context);
|
|
133
124
|
external = ClientConfig::GetConfig(context).force_external;
|
|
134
|
-
}
|
|
135
125
|
|
|
136
|
-
|
|
137
|
-
|
|
126
|
+
if (!orders.empty()) {
|
|
127
|
+
grouping_types = payload_types;
|
|
128
|
+
grouping_types.push_back(LogicalType::HASH);
|
|
138
129
|
|
|
139
|
-
|
|
140
|
-
ungrouped = make_unique<WindowGlobalHashGroup>(buffer_manager, partitions, orders, payload_types,
|
|
141
|
-
memory_per_thread, external);
|
|
130
|
+
ResizeGroupingData(op.estimated_cardinality);
|
|
142
131
|
}
|
|
143
|
-
|
|
144
|
-
return ungrouped.get();
|
|
145
132
|
}
|
|
146
133
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
lock_guard<mutex> guard(lock);
|
|
150
|
-
if (hash_groups.size() < partition_info.n_partitions) {
|
|
151
|
-
hash_groups.resize(partition_info.n_partitions);
|
|
152
|
-
}
|
|
134
|
+
void UpdateLocalPartition(GroupingPartition &local_partition, GroupingAppend &local_append);
|
|
135
|
+
void CombineLocalPartition(GroupingPartition &local_partition, GroupingAppend &local_append);
|
|
153
136
|
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
idx_t GroupCount() const {
|
|
158
|
-
return std::accumulate(
|
|
159
|
-
hash_groups.begin(), hash_groups.end(), 0,
|
|
160
|
-
[&](const idx_t &n, const HashGroupPtr &group) { return n + (group ? idx_t(group->count) : 0); });
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
WindowGlobalHashGroup *GetHashGroup(idx_t group) {
|
|
164
|
-
lock_guard<mutex> guard(lock);
|
|
165
|
-
D_ASSERT(group < hash_groups.size());
|
|
166
|
-
auto &hash_group = hash_groups[group];
|
|
167
|
-
if (!hash_group) {
|
|
168
|
-
const auto maxmem = memory_per_thread / partition_info.n_partitions;
|
|
169
|
-
hash_group =
|
|
170
|
-
make_unique<WindowGlobalHashGroup>(buffer_manager, partitions, orders, payload_types, maxmem, external);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return hash_group.get();
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
void Finalize();
|
|
177
|
-
|
|
178
|
-
size_t GetNextSortGroup() {
|
|
179
|
-
for (auto group = next_sort++; group < hash_groups.size(); group = next_sort++) {
|
|
180
|
-
// Only non-empty groups exist.
|
|
181
|
-
if (hash_groups[group]) {
|
|
182
|
-
return group;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return hash_groups.size();
|
|
187
|
-
}
|
|
137
|
+
void BuildSortState(ColumnDataCollection &group_data, WindowGlobalHashGroup &global_sort);
|
|
188
138
|
|
|
189
139
|
const PhysicalWindow &op;
|
|
190
140
|
ClientContext &context;
|
|
191
141
|
BufferManager &buffer_manager;
|
|
192
142
|
Allocator &allocator;
|
|
193
|
-
size_t partition_cols;
|
|
194
|
-
const RadixPartitionInfo partition_info;
|
|
195
143
|
mutex lock;
|
|
196
144
|
|
|
197
|
-
//
|
|
145
|
+
// OVER(PARTITION BY...) (hash grouping)
|
|
146
|
+
unique_ptr<RadixPartitionedColumnData> grouping_data;
|
|
147
|
+
//! Payload plus hash column
|
|
148
|
+
Types grouping_types;
|
|
149
|
+
|
|
150
|
+
// OVER(...) (sorting)
|
|
198
151
|
Orders partitions;
|
|
199
152
|
Orders orders;
|
|
200
|
-
Types payload_types;
|
|
201
|
-
HashGroupPtr ungrouped;
|
|
153
|
+
const Types payload_types;
|
|
202
154
|
vector<HashGroupPtr> hash_groups;
|
|
203
155
|
bool external;
|
|
204
|
-
atomic<size_t> next_sort;
|
|
205
156
|
|
|
206
157
|
// OVER() (no sorting)
|
|
207
158
|
unique_ptr<RowDataCollection> rows;
|
|
@@ -211,253 +162,250 @@ public:
|
|
|
211
162
|
idx_t memory_per_thread;
|
|
212
163
|
atomic<idx_t> count;
|
|
213
164
|
WindowAggregationMode mode;
|
|
165
|
+
|
|
166
|
+
private:
|
|
167
|
+
void ResizeGroupingData(idx_t cardinality);
|
|
168
|
+
void SyncLocalPartition(GroupingPartition &local_partition, GroupingAppend &local_append);
|
|
214
169
|
};
|
|
215
170
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
171
|
+
void WindowGlobalSinkState::ResizeGroupingData(idx_t cardinality) {
|
|
172
|
+
// Is the average partition size too large?
|
|
173
|
+
const idx_t partition_size = STANDARD_ROW_GROUPS_SIZE;
|
|
174
|
+
const auto bits = grouping_data ? grouping_data->GetRadixBits() : 0;
|
|
175
|
+
auto new_bits = bits ? bits : 4;
|
|
176
|
+
while (new_bits < 10 && (cardinality / RadixPartitioning::NumberOfPartitions(new_bits)) > partition_size) {
|
|
177
|
+
++new_bits;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Repartition the grouping data
|
|
181
|
+
if (new_bits != bits) {
|
|
182
|
+
const auto hash_col_idx = payload_types.size();
|
|
183
|
+
auto new_grouping_data =
|
|
184
|
+
make_unique<RadixPartitionedColumnData>(context, grouping_types, new_bits, hash_col_idx);
|
|
185
|
+
|
|
186
|
+
// We have to append to a shared copy for some reason
|
|
187
|
+
if (grouping_data) {
|
|
188
|
+
auto new_shared = new_grouping_data->CreateShared();
|
|
189
|
+
PartitionedColumnDataAppendState shared_append;
|
|
190
|
+
new_shared->InitializeAppendState(shared_append);
|
|
191
|
+
|
|
192
|
+
auto &partitions = grouping_data->GetPartitions();
|
|
193
|
+
for (auto &partition : partitions) {
|
|
194
|
+
ColumnDataScanState scanner;
|
|
195
|
+
partition->InitializeScan(scanner);
|
|
196
|
+
|
|
197
|
+
DataChunk scan_chunk;
|
|
198
|
+
partition->InitializeScanChunk(scan_chunk);
|
|
199
|
+
for (scan_chunk.Reset(); partition->Scan(scanner, scan_chunk); scan_chunk.Reset()) {
|
|
200
|
+
new_shared->Append(shared_append, scan_chunk);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
new_shared->FlushAppendState(shared_append);
|
|
204
|
+
new_grouping_data->Combine(*new_shared);
|
|
205
|
+
}
|
|
221
206
|
|
|
222
|
-
|
|
207
|
+
grouping_data = std::move(new_grouping_data);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
void WindowGlobalSinkState::SyncLocalPartition(GroupingPartition &local_partition, GroupingAppend &local_append) {
|
|
212
|
+
// We are done if the local_partition is right sized.
|
|
213
|
+
auto local_radix = (RadixPartitionedColumnData *)local_partition.get();
|
|
214
|
+
if (local_radix->GetRadixBits() == grouping_data->GetRadixBits()) {
|
|
215
|
+
return;
|
|
223
216
|
}
|
|
224
217
|
|
|
225
|
-
|
|
226
|
-
|
|
218
|
+
// If the local partition is now too small, flush it and reallocate
|
|
219
|
+
auto new_partition = grouping_data->CreateShared();
|
|
220
|
+
auto new_append = make_unique<PartitionedColumnDataAppendState>();
|
|
221
|
+
new_partition->InitializeAppendState(*new_append);
|
|
227
222
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
223
|
+
local_partition->FlushAppendState(*local_append);
|
|
224
|
+
auto &local_groups = local_partition->GetPartitions();
|
|
225
|
+
for (auto &local_group : local_groups) {
|
|
226
|
+
ColumnDataScanState scanner;
|
|
227
|
+
local_group->InitializeScan(scanner);
|
|
228
|
+
|
|
229
|
+
DataChunk scan_chunk;
|
|
230
|
+
local_group->InitializeScanChunk(scan_chunk);
|
|
231
|
+
for (scan_chunk.Reset(); local_group->Scan(scanner, scan_chunk); scan_chunk.Reset()) {
|
|
232
|
+
new_partition->Append(*new_append, scan_chunk);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// The append state has stale pointers to the old local partition, so nuke it from orbit.
|
|
237
|
+
new_partition->FlushAppendState(*new_append);
|
|
238
|
+
|
|
239
|
+
local_partition = std::move(new_partition);
|
|
240
|
+
local_append = make_unique<PartitionedColumnDataAppendState>();
|
|
241
|
+
local_partition->InitializeAppendState(*local_append);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
void WindowGlobalSinkState::UpdateLocalPartition(GroupingPartition &local_partition, GroupingAppend &local_append) {
|
|
245
|
+
// Make sure grouping_data doesn't change under us.
|
|
246
|
+
lock_guard<mutex> guard(lock);
|
|
232
247
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
local_sort = make_unique<LocalSortState>();
|
|
239
|
-
local_sort->Initialize(global_sort, global_sort.buffer_manager);
|
|
248
|
+
if (!local_partition) {
|
|
249
|
+
local_partition = grouping_data->CreateShared();
|
|
250
|
+
local_append = make_unique<PartitionedColumnDataAppendState>();
|
|
251
|
+
local_partition->InitializeAppendState(*local_append);
|
|
252
|
+
return;
|
|
240
253
|
}
|
|
241
254
|
|
|
242
|
-
|
|
255
|
+
// Grow the groups if they are too big
|
|
256
|
+
ResizeGroupingData(count);
|
|
257
|
+
|
|
258
|
+
// Sync local partition to have the same bit count
|
|
259
|
+
SyncLocalPartition(local_partition, local_append);
|
|
260
|
+
}
|
|
243
261
|
|
|
244
|
-
|
|
245
|
-
|
|
262
|
+
void WindowGlobalSinkState::CombineLocalPartition(GroupingPartition &local_partition, GroupingAppend &local_append) {
|
|
263
|
+
if (!local_partition) {
|
|
264
|
+
return;
|
|
246
265
|
}
|
|
266
|
+
local_partition->FlushAppendState(*local_append);
|
|
247
267
|
|
|
248
|
-
|
|
268
|
+
// Make sure grouping_data doesn't change under us.
|
|
269
|
+
// Combine has an internal mutex, so this is single-threaded anyway.
|
|
270
|
+
lock_guard<mutex> guard(lock);
|
|
271
|
+
SyncLocalPartition(local_partition, local_append);
|
|
272
|
+
grouping_data->Combine(*local_partition);
|
|
249
273
|
}
|
|
250
274
|
|
|
251
|
-
void
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
275
|
+
void WindowGlobalSinkState::BuildSortState(ColumnDataCollection &group_data, WindowGlobalHashGroup &hash_group) {
|
|
276
|
+
auto &global_sort = *hash_group.global_sort;
|
|
277
|
+
|
|
278
|
+
// Set up the sort expression computation.
|
|
279
|
+
vector<LogicalType> sort_types;
|
|
280
|
+
ExpressionExecutor executor(context);
|
|
281
|
+
for (auto &order : orders) {
|
|
282
|
+
auto &oexpr = order.expression;
|
|
283
|
+
sort_types.emplace_back(oexpr->return_type);
|
|
284
|
+
executor.AddExpression(*oexpr);
|
|
256
285
|
}
|
|
286
|
+
DataChunk sort_chunk;
|
|
287
|
+
sort_chunk.Initialize(allocator, sort_types);
|
|
288
|
+
|
|
289
|
+
// Copy the data from the group into the sort code.
|
|
290
|
+
LocalSortState local_sort;
|
|
291
|
+
local_sort.Initialize(global_sort, global_sort.buffer_manager);
|
|
292
|
+
|
|
293
|
+
// Strip hash column
|
|
294
|
+
DataChunk payload_chunk;
|
|
295
|
+
payload_chunk.Initialize(allocator, payload_types);
|
|
296
|
+
|
|
297
|
+
vector<column_t> column_ids;
|
|
298
|
+
column_ids.reserve(payload_types.size());
|
|
299
|
+
for (column_t i = 0; i < payload_types.size(); ++i) {
|
|
300
|
+
column_ids.emplace_back(i);
|
|
301
|
+
}
|
|
302
|
+
ColumnDataConsumer scanner(group_data, column_ids);
|
|
303
|
+
ColumnDataConsumerScanState chunk_state;
|
|
304
|
+
chunk_state.current_chunk_state.properties = ColumnDataScanProperties::ALLOW_ZERO_COPY;
|
|
305
|
+
scanner.InitializeScan();
|
|
306
|
+
for (auto chunk_idx = scanner.ChunkCount(); chunk_idx-- > 0;) {
|
|
307
|
+
if (!scanner.AssignChunk(chunk_state)) {
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
scanner.ScanChunk(chunk_state, payload_chunk);
|
|
311
|
+
|
|
312
|
+
sort_chunk.Reset();
|
|
313
|
+
executor.Execute(payload_chunk, sort_chunk);
|
|
314
|
+
|
|
315
|
+
local_sort.SinkChunk(sort_chunk, payload_chunk);
|
|
316
|
+
if (local_sort.SizeInBytes() > memory_per_thread) {
|
|
317
|
+
local_sort.Sort(global_sort, true);
|
|
318
|
+
}
|
|
319
|
+
scanner.FinishChunk(chunk_state);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
global_sort.AddLocalState(local_sort);
|
|
323
|
+
|
|
324
|
+
hash_group.count += group_data.Count();
|
|
257
325
|
}
|
|
258
326
|
|
|
259
327
|
// Per-thread sink state
|
|
260
328
|
class WindowLocalSinkState : public LocalSinkState {
|
|
261
329
|
public:
|
|
262
|
-
using LocalHashGroupPtr = unique_ptr<WindowLocalHashGroup>;
|
|
263
|
-
|
|
264
330
|
WindowLocalSinkState(ClientContext &context, const PhysicalWindow &op_p)
|
|
265
|
-
: op(op_p),
|
|
266
|
-
|
|
331
|
+
: op(op_p), allocator(Allocator::Get(context)), executor(context) {
|
|
267
332
|
D_ASSERT(op.select_list[0]->GetExpressionClass() == ExpressionClass::BOUND_WINDOW);
|
|
268
333
|
auto wexpr = reinterpret_cast<BoundWindowExpression *>(op.select_list[0].get());
|
|
269
|
-
partition_cols = wexpr->partitions.size();
|
|
270
334
|
|
|
271
|
-
|
|
272
|
-
auto &payload_types = op.children[0]->types;
|
|
273
|
-
vector<LogicalType> over_types;
|
|
335
|
+
vector<LogicalType> group_types;
|
|
274
336
|
for (idx_t prt_idx = 0; prt_idx < wexpr->partitions.size(); prt_idx++) {
|
|
275
337
|
auto &pexpr = wexpr->partitions[prt_idx];
|
|
276
|
-
|
|
338
|
+
group_types.push_back(pexpr->return_type);
|
|
277
339
|
executor.AddExpression(*pexpr);
|
|
278
340
|
}
|
|
341
|
+
sort_cols = wexpr->orders.size() + group_types.size();
|
|
279
342
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
343
|
+
if (sort_cols) {
|
|
344
|
+
if (!group_types.empty()) {
|
|
345
|
+
// OVER(PARTITION BY...)
|
|
346
|
+
group_chunk.Initialize(allocator, group_types);
|
|
347
|
+
}
|
|
348
|
+
// OVER(...)
|
|
349
|
+
auto payload_types = op.children[0]->types;
|
|
350
|
+
payload_types.emplace_back(LogicalType::HASH);
|
|
351
|
+
payload_chunk.Initialize(allocator, payload_types);
|
|
352
|
+
} else {
|
|
353
|
+
// OVER()
|
|
354
|
+
payload_layout.Initialize(op.children[0]->types);
|
|
290
355
|
}
|
|
291
|
-
|
|
292
|
-
payload_chunk.Initialize(allocator, payload_types);
|
|
293
|
-
payload_subset.Initialize(allocator, payload_types);
|
|
294
|
-
payload_layout.Initialize(payload_types);
|
|
295
356
|
}
|
|
296
357
|
|
|
297
358
|
// Global state
|
|
298
359
|
const PhysicalWindow &op;
|
|
360
|
+
Allocator &allocator;
|
|
299
361
|
|
|
300
|
-
//
|
|
362
|
+
// OVER(PARTITION BY...) (hash grouping)
|
|
301
363
|
ExpressionExecutor executor;
|
|
302
|
-
DataChunk
|
|
364
|
+
DataChunk group_chunk;
|
|
303
365
|
DataChunk payload_chunk;
|
|
304
|
-
|
|
366
|
+
unique_ptr<PartitionedColumnData> local_partition;
|
|
367
|
+
unique_ptr<PartitionedColumnDataAppendState> local_append;
|
|
305
368
|
|
|
306
|
-
//
|
|
307
|
-
|
|
308
|
-
counts_t counts;
|
|
309
|
-
counts_t offsets;
|
|
310
|
-
Vector hash_vector;
|
|
311
|
-
SelectionVector sel;
|
|
312
|
-
DataChunk over_subset;
|
|
313
|
-
DataChunk payload_subset;
|
|
314
|
-
LocalHashGroupPtr ungrouped;
|
|
315
|
-
vector<LocalHashGroupPtr> hash_groups;
|
|
369
|
+
// OVER(...) (sorting)
|
|
370
|
+
size_t sort_cols;
|
|
316
371
|
|
|
317
372
|
// OVER() (no sorting)
|
|
318
373
|
RowLayout payload_layout;
|
|
319
374
|
unique_ptr<RowDataCollection> rows;
|
|
320
375
|
unique_ptr<RowDataCollection> strings;
|
|
321
376
|
|
|
322
|
-
//!
|
|
323
|
-
void
|
|
324
|
-
//! Compute the OVER values
|
|
325
|
-
void Over(DataChunk &input_chunk);
|
|
326
|
-
//! Hash the data and group it
|
|
327
|
-
void Hash(WindowGlobalSinkState &gstate, DataChunk &input_chunk);
|
|
377
|
+
//! Compute the hash values
|
|
378
|
+
void Hash(DataChunk &input_chunk, Vector &hash_vector);
|
|
328
379
|
//! Sink an input chunk
|
|
329
380
|
void Sink(DataChunk &input_chunk, WindowGlobalSinkState &gstate);
|
|
330
381
|
//! Merge the state into the global state.
|
|
331
382
|
void Combine(WindowGlobalSinkState &gstate);
|
|
332
383
|
};
|
|
333
384
|
|
|
334
|
-
void WindowLocalSinkState::
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
// There are three types of hash grouping:
|
|
344
|
-
// 1. No partitions (no sorting)
|
|
345
|
-
// 2. One group (sorting, but no hash grouping)
|
|
346
|
-
// 3. Multiple groups (sorting and hash grouping)
|
|
347
|
-
if (over_chunk.ColumnCount() == 0) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
const auto count = over_chunk.size();
|
|
352
|
-
auto hashes = FlatVector::GetData<hash_t>(hash_vector);
|
|
353
|
-
if (hash_groups.empty()) {
|
|
354
|
-
// Ungrouped, so take them all
|
|
355
|
-
counts.resize(1, count);
|
|
356
|
-
} else {
|
|
357
|
-
// First pass: count bins sizes
|
|
358
|
-
counts.resize(0);
|
|
359
|
-
counts.resize(hash_groups.size(), 0);
|
|
360
|
-
|
|
361
|
-
VectorOperations::Hash(over_chunk.data[0], hash_vector, count);
|
|
362
|
-
for (idx_t prt_idx = 1; prt_idx < partition_cols; ++prt_idx) {
|
|
363
|
-
VectorOperations::CombineHash(hash_vector, over_chunk.data[prt_idx], count);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
const auto &partition_info = gstate.partition_info;
|
|
367
|
-
if (hash_vector.GetVectorType() == VectorType::CONSTANT_VECTOR) {
|
|
368
|
-
const auto group = partition_info.GetHashPartition(hashes[0]);
|
|
369
|
-
counts[group] = count;
|
|
370
|
-
for (idx_t i = 0; i < count; ++i) {
|
|
371
|
-
sel.set_index(i, i);
|
|
372
|
-
}
|
|
373
|
-
} else {
|
|
374
|
-
for (idx_t i = 0; i < count; ++i) {
|
|
375
|
-
const auto group = partition_info.GetHashPartition(hashes[i]);
|
|
376
|
-
++counts[group];
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// Second pass: Initialise offsets
|
|
380
|
-
offsets.resize(counts.size());
|
|
381
|
-
size_t offset = 0;
|
|
382
|
-
for (size_t c = 0; c < counts.size(); ++c) {
|
|
383
|
-
offsets[c] = offset;
|
|
384
|
-
offset += counts[c];
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
// Third pass: Build sequential selections
|
|
388
|
-
for (idx_t i = 0; i < count; ++i) {
|
|
389
|
-
const auto group = partition_info.GetHashPartition(hashes[i]);
|
|
390
|
-
auto &group_idx = offsets[group];
|
|
391
|
-
sel.set_index(group_idx++, i);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
idx_t group_offset = 0;
|
|
397
|
-
for (size_t group = 0; group < counts.size(); ++group) {
|
|
398
|
-
const auto group_size = counts[group];
|
|
399
|
-
if (group_size) {
|
|
400
|
-
auto &local_group = hash_groups[group];
|
|
401
|
-
if (!local_group) {
|
|
402
|
-
auto global_group = gstate.GetHashGroup(group);
|
|
403
|
-
local_group = make_unique<WindowLocalHashGroup>(*global_group);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
if (counts.size() == 1) {
|
|
407
|
-
local_group->SinkChunk(over_chunk, input_chunk);
|
|
408
|
-
} else {
|
|
409
|
-
SelectionVector psel(sel.data() + group_offset);
|
|
410
|
-
over_subset.Slice(over_chunk, psel, group_size);
|
|
411
|
-
payload_subset.Slice(input_chunk, psel, group_size);
|
|
412
|
-
local_group->SinkChunk(over_subset, payload_subset);
|
|
413
|
-
group_offset += group_size;
|
|
414
|
-
}
|
|
385
|
+
void WindowLocalSinkState::Hash(DataChunk &input_chunk, Vector &hash_vector) {
|
|
386
|
+
const auto count = input_chunk.size();
|
|
387
|
+
if (group_chunk.ColumnCount() > 0) {
|
|
388
|
+
// OVER(PARTITION BY...) (hash grouping)
|
|
389
|
+
group_chunk.Reset();
|
|
390
|
+
executor.Execute(input_chunk, group_chunk);
|
|
391
|
+
VectorOperations::Hash(group_chunk.data[0], hash_vector, count);
|
|
392
|
+
for (idx_t prt_idx = 1; prt_idx < group_chunk.ColumnCount(); ++prt_idx) {
|
|
393
|
+
VectorOperations::CombineHash(hash_vector, group_chunk.data[prt_idx], count);
|
|
415
394
|
}
|
|
395
|
+
} else {
|
|
396
|
+
// OVER(...) (sorting)
|
|
397
|
+
// Single partition => single hash value
|
|
398
|
+
hash_vector.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
399
|
+
auto hashes = ConstantVector::GetData<hash_t>(hash_vector);
|
|
400
|
+
hashes[0] = 0;
|
|
416
401
|
}
|
|
417
402
|
}
|
|
418
403
|
|
|
419
|
-
void WindowLocalSinkState::Group(WindowGlobalSinkState &gstate) {
|
|
420
|
-
if (!gstate.partition_cols) {
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
if (!hash_groups.empty()) {
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
hash_groups.resize(gstate.Group());
|
|
429
|
-
|
|
430
|
-
if (!ungrouped) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
auto &payload_data = *ungrouped->local_sort->payload_data;
|
|
435
|
-
auto rows = payload_data.CloneEmpty(payload_data.keep_pinned);
|
|
436
|
-
|
|
437
|
-
auto &payload_heap = *ungrouped->local_sort->payload_heap;
|
|
438
|
-
auto heap = payload_heap.CloneEmpty(payload_heap.keep_pinned);
|
|
439
|
-
|
|
440
|
-
RowDataCollectionScanner::AlignHeapBlocks(*rows, *heap, payload_data, payload_heap, payload_layout);
|
|
441
|
-
RowDataCollectionScanner scanner(*rows, *heap, payload_layout, true);
|
|
442
|
-
while (scanner.Remaining()) {
|
|
443
|
-
payload_chunk.Reset();
|
|
444
|
-
scanner.Scan(payload_chunk);
|
|
445
|
-
|
|
446
|
-
Over(payload_chunk);
|
|
447
|
-
Hash(gstate, payload_chunk);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
ungrouped.reset();
|
|
451
|
-
}
|
|
452
|
-
|
|
453
404
|
void WindowLocalSinkState::Sink(DataChunk &input_chunk, WindowGlobalSinkState &gstate) {
|
|
454
405
|
gstate.count += input_chunk.size();
|
|
455
|
-
count += input_chunk.size();
|
|
456
|
-
|
|
457
|
-
Over(input_chunk);
|
|
458
406
|
|
|
459
407
|
// OVER()
|
|
460
|
-
if (
|
|
408
|
+
if (sort_cols == 0) {
|
|
461
409
|
// No sorts, so build paged row chunks
|
|
462
410
|
if (!rows) {
|
|
463
411
|
const auto entry_size = payload_layout.GetRowWidth();
|
|
@@ -483,27 +431,23 @@ void WindowLocalSinkState::Sink(DataChunk &input_chunk, WindowGlobalSinkState &g
|
|
|
483
431
|
return;
|
|
484
432
|
}
|
|
485
433
|
|
|
486
|
-
//
|
|
487
|
-
|
|
488
|
-
auto global_ungrouped = gstate.GetUngrouped();
|
|
489
|
-
if (!ungrouped) {
|
|
490
|
-
ungrouped = make_unique<WindowLocalHashGroup>(*global_ungrouped);
|
|
491
|
-
}
|
|
434
|
+
// OVER(...)
|
|
435
|
+
gstate.UpdateLocalPartition(local_partition, local_append);
|
|
492
436
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
437
|
+
payload_chunk.Reset();
|
|
438
|
+
auto &hash_vector = payload_chunk.data.back();
|
|
439
|
+
Hash(input_chunk, hash_vector);
|
|
440
|
+
for (idx_t col_idx = 0; col_idx < input_chunk.ColumnCount(); ++col_idx) {
|
|
441
|
+
payload_chunk.data[col_idx].Reference(input_chunk.data[col_idx]);
|
|
498
442
|
}
|
|
443
|
+
payload_chunk.SetCardinality(input_chunk);
|
|
499
444
|
|
|
500
|
-
|
|
501
|
-
Hash(gstate, input_chunk);
|
|
445
|
+
local_partition->Append(*local_append, payload_chunk);
|
|
502
446
|
}
|
|
503
447
|
|
|
504
448
|
void WindowLocalSinkState::Combine(WindowGlobalSinkState &gstate) {
|
|
505
449
|
// OVER()
|
|
506
|
-
if (
|
|
450
|
+
if (sort_cols == 0) {
|
|
507
451
|
// Only one partition again, so need a global lock.
|
|
508
452
|
lock_guard<mutex> glock(gstate.lock);
|
|
509
453
|
if (gstate.rows) {
|
|
@@ -514,95 +458,20 @@ void WindowLocalSinkState::Combine(WindowGlobalSinkState &gstate) {
|
|
|
514
458
|
strings.reset();
|
|
515
459
|
}
|
|
516
460
|
} else {
|
|
517
|
-
gstate.rows = move(rows);
|
|
518
|
-
gstate.strings = move(strings);
|
|
461
|
+
gstate.rows = std::move(rows);
|
|
462
|
+
gstate.strings = std::move(strings);
|
|
519
463
|
}
|
|
520
464
|
return;
|
|
521
465
|
}
|
|
522
466
|
|
|
523
|
-
//
|
|
524
|
-
|
|
525
|
-
if (ungrouped) {
|
|
526
|
-
check += ungrouped->count;
|
|
527
|
-
ungrouped->Combine();
|
|
528
|
-
ungrouped.reset();
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
// Grouped data
|
|
532
|
-
for (auto &local_group : hash_groups) {
|
|
533
|
-
if (local_group) {
|
|
534
|
-
check += local_group->count;
|
|
535
|
-
local_group->Combine();
|
|
536
|
-
local_group.reset();
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
(void)check;
|
|
541
|
-
D_ASSERT(check == count);
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
void WindowGlobalSinkState::Finalize() {
|
|
545
|
-
if (!ungrouped) {
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
if (hash_groups.empty()) {
|
|
550
|
-
hash_groups.emplace_back(move(ungrouped));
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
// If we have grouped data, merge the remaining ungrouped data into it.
|
|
555
|
-
// This can happen if only SOME of the threads ended up regrouping.
|
|
556
|
-
// The simplest thing to do is to fake a local thread state,
|
|
557
|
-
// push the ungrouped data into it and then use that state to partition the data.
|
|
558
|
-
// This is probably OK because this situation will only happen
|
|
559
|
-
// with relatively small amounts of data.
|
|
560
|
-
|
|
561
|
-
// Sort the data so we can scan it
|
|
562
|
-
auto &global_sort = *ungrouped->global_sort;
|
|
563
|
-
if (global_sort.sorted_blocks.empty()) {
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
global_sort.PrepareMergePhase();
|
|
568
|
-
while (global_sort.sorted_blocks.size() > 1) {
|
|
569
|
-
global_sort.InitializeMergeRound();
|
|
570
|
-
MergeSorter merge_sorter(global_sort, global_sort.buffer_manager);
|
|
571
|
-
merge_sorter.PerformInMergeRound();
|
|
572
|
-
global_sort.CompleteMergeRound(true);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
// Sink it into a temporary local sink state
|
|
576
|
-
auto lstate = make_unique<WindowLocalSinkState>(context, op);
|
|
577
|
-
|
|
578
|
-
// Match the grouping.
|
|
579
|
-
lstate->Group(*this);
|
|
580
|
-
|
|
581
|
-
// Write into the state chunks directly to hash them
|
|
582
|
-
auto &payload_chunk = lstate->payload_chunk;
|
|
583
|
-
|
|
584
|
-
// Now scan the sorted data
|
|
585
|
-
PayloadScanner scanner(global_sort);
|
|
586
|
-
while (scanner.Remaining()) {
|
|
587
|
-
lstate->payload_chunk.Reset();
|
|
588
|
-
scanner.Scan(lstate->payload_chunk);
|
|
589
|
-
if (payload_chunk.size() == 0) {
|
|
590
|
-
break;
|
|
591
|
-
}
|
|
592
|
-
lstate->count += payload_chunk.size();
|
|
593
|
-
|
|
594
|
-
lstate->Over(payload_chunk);
|
|
595
|
-
lstate->Hash(*this, payload_chunk);
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
// Merge the grouped data in.
|
|
599
|
-
lstate->Combine(*this);
|
|
467
|
+
// OVER(...)
|
|
468
|
+
gstate.CombineLocalPartition(local_partition, local_append);
|
|
600
469
|
}
|
|
601
470
|
|
|
602
471
|
// this implements a sorted window functions variant
|
|
603
472
|
PhysicalWindow::PhysicalWindow(vector<LogicalType> types, vector<unique_ptr<Expression>> select_list_p,
|
|
604
473
|
idx_t estimated_cardinality, PhysicalOperatorType type)
|
|
605
|
-
: PhysicalOperator(type, move(types), estimated_cardinality), select_list(move(select_list_p)) {
|
|
474
|
+
: PhysicalOperator(type, std::move(types), estimated_cardinality), select_list(std::move(select_list_p)) {
|
|
606
475
|
is_order_dependent = false;
|
|
607
476
|
for (auto &expr : select_list) {
|
|
608
477
|
D_ASSERT(expr->expression_class == ExpressionClass::BOUND_WINDOW);
|
|
@@ -1215,6 +1084,7 @@ WindowExecutor::WindowExecutor(BoundWindowExpression *wexpr, ClientContext &cont
|
|
|
1215
1084
|
|
|
1216
1085
|
// evaluate inner expressions of window functions, could be more complex
|
|
1217
1086
|
vector<Expression *> exprs;
|
|
1087
|
+
exprs.reserve(wexpr->children.size());
|
|
1218
1088
|
for (auto &child : wexpr->children) {
|
|
1219
1089
|
exprs.push_back(child.get());
|
|
1220
1090
|
}
|
|
@@ -1521,6 +1391,10 @@ public:
|
|
|
1521
1391
|
bool TaskFinished() {
|
|
1522
1392
|
return finished;
|
|
1523
1393
|
}
|
|
1394
|
+
|
|
1395
|
+
void Prepare();
|
|
1396
|
+
void Merge();
|
|
1397
|
+
|
|
1524
1398
|
void ExecuteTask();
|
|
1525
1399
|
|
|
1526
1400
|
WindowGlobalMergeState *merge_state;
|
|
@@ -1530,8 +1404,19 @@ public:
|
|
|
1530
1404
|
|
|
1531
1405
|
class WindowGlobalMergeState {
|
|
1532
1406
|
public:
|
|
1533
|
-
|
|
1534
|
-
|
|
1407
|
+
using GroupDataPtr = unique_ptr<ColumnDataCollection>;
|
|
1408
|
+
|
|
1409
|
+
explicit WindowGlobalMergeState(WindowGlobalSinkState &sink, GroupDataPtr group_data)
|
|
1410
|
+
: sink(sink), group_data(std::move(group_data)), stage(WindowSortStage::INIT), total_tasks(0),
|
|
1411
|
+
tasks_assigned(0), tasks_completed(0) {
|
|
1412
|
+
|
|
1413
|
+
const auto group_idx = sink.hash_groups.size();
|
|
1414
|
+
auto new_group = make_unique<WindowGlobalHashGroup>(sink.buffer_manager, sink.partitions, sink.orders,
|
|
1415
|
+
sink.payload_types, sink.external);
|
|
1416
|
+
sink.hash_groups.emplace_back(std::move(new_group));
|
|
1417
|
+
|
|
1418
|
+
hash_group = sink.hash_groups[group_idx].get();
|
|
1419
|
+
global_sort = sink.hash_groups[group_idx]->global_sort.get();
|
|
1535
1420
|
}
|
|
1536
1421
|
|
|
1537
1422
|
bool IsSorted() const {
|
|
@@ -1543,7 +1428,10 @@ public:
|
|
|
1543
1428
|
bool TryPrepareNextStage();
|
|
1544
1429
|
void CompleteTask();
|
|
1545
1430
|
|
|
1546
|
-
|
|
1431
|
+
WindowGlobalSinkState &sink;
|
|
1432
|
+
GroupDataPtr group_data;
|
|
1433
|
+
WindowGlobalHashGroup *hash_group;
|
|
1434
|
+
GlobalSortState *global_sort;
|
|
1547
1435
|
|
|
1548
1436
|
private:
|
|
1549
1437
|
mutable mutex lock;
|
|
@@ -1553,17 +1441,28 @@ private:
|
|
|
1553
1441
|
idx_t tasks_completed;
|
|
1554
1442
|
};
|
|
1555
1443
|
|
|
1444
|
+
void WindowLocalMergeState::Prepare() {
|
|
1445
|
+
auto &global_sort = *merge_state->global_sort;
|
|
1446
|
+
merge_state->sink.BuildSortState(*merge_state->group_data, *merge_state->hash_group);
|
|
1447
|
+
merge_state->group_data.reset();
|
|
1448
|
+
|
|
1449
|
+
global_sort.PrepareMergePhase();
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
void WindowLocalMergeState::Merge() {
|
|
1453
|
+
auto &global_sort = *merge_state->global_sort;
|
|
1454
|
+
MergeSorter merge_sorter(global_sort, global_sort.buffer_manager);
|
|
1455
|
+
merge_sorter.PerformInMergeRound();
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1556
1458
|
void WindowLocalMergeState::ExecuteTask() {
|
|
1557
|
-
auto &global_sort = merge_state->sort_state;
|
|
1558
1459
|
switch (stage) {
|
|
1559
1460
|
case WindowSortStage::PREPARE:
|
|
1560
|
-
|
|
1461
|
+
Prepare();
|
|
1561
1462
|
break;
|
|
1562
|
-
case WindowSortStage::MERGE:
|
|
1563
|
-
|
|
1564
|
-
merge_sorter.PerformInMergeRound();
|
|
1463
|
+
case WindowSortStage::MERGE:
|
|
1464
|
+
Merge();
|
|
1565
1465
|
break;
|
|
1566
|
-
}
|
|
1567
1466
|
default:
|
|
1568
1467
|
throw InternalException("Unexpected WindowGlobalMergeState in ExecuteTask!");
|
|
1569
1468
|
}
|
|
@@ -1609,21 +1508,21 @@ bool WindowGlobalMergeState::TryPrepareNextStage() {
|
|
|
1609
1508
|
return true;
|
|
1610
1509
|
|
|
1611
1510
|
case WindowSortStage::PREPARE:
|
|
1612
|
-
total_tasks =
|
|
1511
|
+
total_tasks = global_sort->sorted_blocks.size() / 2;
|
|
1613
1512
|
if (!total_tasks) {
|
|
1614
1513
|
break;
|
|
1615
1514
|
}
|
|
1616
1515
|
stage = WindowSortStage::MERGE;
|
|
1617
|
-
|
|
1516
|
+
global_sort->InitializeMergeRound();
|
|
1618
1517
|
return true;
|
|
1619
1518
|
|
|
1620
1519
|
case WindowSortStage::MERGE:
|
|
1621
|
-
|
|
1622
|
-
total_tasks =
|
|
1520
|
+
global_sort->CompleteMergeRound(true);
|
|
1521
|
+
total_tasks = global_sort->sorted_blocks.size() / 2;
|
|
1623
1522
|
if (!total_tasks) {
|
|
1624
1523
|
break;
|
|
1625
1524
|
}
|
|
1626
|
-
|
|
1525
|
+
global_sort->InitializeMergeRound();
|
|
1627
1526
|
return true;
|
|
1628
1527
|
|
|
1629
1528
|
case WindowSortStage::SORTED:
|
|
@@ -1639,14 +1538,14 @@ class WindowGlobalMergeStates {
|
|
|
1639
1538
|
public:
|
|
1640
1539
|
using WindowGlobalMergeStatePtr = unique_ptr<WindowGlobalMergeState>;
|
|
1641
1540
|
|
|
1642
|
-
WindowGlobalMergeStates(WindowGlobalSinkState &sink
|
|
1541
|
+
explicit WindowGlobalMergeStates(WindowGlobalSinkState &sink) {
|
|
1643
1542
|
// Schedule all the sorts for maximum thread utilisation
|
|
1644
|
-
for (
|
|
1645
|
-
auto &hash_group = *sink.hash_groups[group];
|
|
1646
|
-
|
|
1543
|
+
for (auto &group_data : sink.grouping_data->GetPartitions()) {
|
|
1647
1544
|
// Prepare for merge sort phase
|
|
1648
|
-
|
|
1649
|
-
|
|
1545
|
+
if (group_data->Count()) {
|
|
1546
|
+
auto state = make_unique<WindowGlobalMergeState>(sink, std::move(group_data));
|
|
1547
|
+
states.emplace_back(std::move(state));
|
|
1548
|
+
}
|
|
1650
1549
|
}
|
|
1651
1550
|
}
|
|
1652
1551
|
|
|
@@ -1656,7 +1555,7 @@ public:
|
|
|
1656
1555
|
class WindowMergeTask : public ExecutorTask {
|
|
1657
1556
|
public:
|
|
1658
1557
|
WindowMergeTask(shared_ptr<Event> event_p, ClientContext &context_p, WindowGlobalMergeStates &hash_groups_p)
|
|
1659
|
-
: ExecutorTask(context_p), event(move(event_p)), hash_groups(hash_groups_p) {
|
|
1558
|
+
: ExecutorTask(context_p), event(std::move(event_p)), hash_groups(hash_groups_p) {
|
|
1660
1559
|
}
|
|
1661
1560
|
|
|
1662
1561
|
TaskExecutionResult ExecuteTask(TaskExecutionMode mode) override;
|
|
@@ -1726,8 +1625,8 @@ TaskExecutionResult WindowMergeTask::ExecuteTask(TaskExecutionMode mode) {
|
|
|
1726
1625
|
|
|
1727
1626
|
class WindowMergeEvent : public BasePipelineEvent {
|
|
1728
1627
|
public:
|
|
1729
|
-
WindowMergeEvent(WindowGlobalSinkState &gstate_p, Pipeline &pipeline_p
|
|
1730
|
-
: BasePipelineEvent(pipeline_p), gstate(gstate_p), merge_states(gstate_p
|
|
1628
|
+
WindowMergeEvent(WindowGlobalSinkState &gstate_p, Pipeline &pipeline_p)
|
|
1629
|
+
: BasePipelineEvent(pipeline_p), gstate(gstate_p), merge_states(gstate_p) {
|
|
1731
1630
|
}
|
|
1732
1631
|
|
|
1733
1632
|
WindowGlobalSinkState &gstate;
|
|
@@ -1745,7 +1644,7 @@ public:
|
|
|
1745
1644
|
for (idx_t tnum = 0; tnum < num_threads; tnum++) {
|
|
1746
1645
|
merge_tasks.push_back(make_unique<WindowMergeTask>(shared_from_this(), context, merge_states));
|
|
1747
1646
|
}
|
|
1748
|
-
SetTasks(move(merge_tasks));
|
|
1647
|
+
SetTasks(std::move(merge_tasks));
|
|
1749
1648
|
}
|
|
1750
1649
|
};
|
|
1751
1650
|
|
|
@@ -1753,24 +1652,27 @@ SinkFinalizeType PhysicalWindow::Finalize(Pipeline &pipeline, Event &event, Clie
|
|
|
1753
1652
|
GlobalSinkState &gstate_p) const {
|
|
1754
1653
|
auto &state = (WindowGlobalSinkState &)gstate_p;
|
|
1755
1654
|
|
|
1655
|
+
// Did we get any data?
|
|
1656
|
+
if (!state.count) {
|
|
1657
|
+
return SinkFinalizeType::NO_OUTPUT_POSSIBLE;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1756
1660
|
// Do we have any sorting to schedule?
|
|
1757
1661
|
if (state.rows) {
|
|
1758
|
-
D_ASSERT(state.
|
|
1662
|
+
D_ASSERT(!state.grouping_data);
|
|
1759
1663
|
return state.rows->count ? SinkFinalizeType::READY : SinkFinalizeType::NO_OUTPUT_POSSIBLE;
|
|
1760
1664
|
}
|
|
1761
1665
|
|
|
1762
1666
|
// Find the first group to sort
|
|
1763
|
-
state.
|
|
1764
|
-
|
|
1765
|
-
auto group = state.GetNextSortGroup();
|
|
1766
|
-
if (group >= state.hash_groups.size()) {
|
|
1667
|
+
auto &groups = state.grouping_data->GetPartitions();
|
|
1668
|
+
if (groups.empty()) {
|
|
1767
1669
|
// Empty input!
|
|
1768
1670
|
return SinkFinalizeType::NO_OUTPUT_POSSIBLE;
|
|
1769
1671
|
}
|
|
1770
1672
|
|
|
1771
1673
|
// Schedule all the sorts for maximum thread utilisation
|
|
1772
|
-
auto new_event = make_shared<WindowMergeEvent>(state, pipeline
|
|
1773
|
-
event.InsertEvent(move(new_event));
|
|
1674
|
+
auto new_event = make_shared<WindowMergeEvent>(state, pipeline);
|
|
1675
|
+
event.InsertEvent(std::move(new_event));
|
|
1774
1676
|
|
|
1775
1677
|
return SinkFinalizeType::READY;
|
|
1776
1678
|
}
|
|
@@ -1792,18 +1694,16 @@ public:
|
|
|
1792
1694
|
auto &state = (WindowGlobalSinkState &)*op.sink_state;
|
|
1793
1695
|
|
|
1794
1696
|
// If there is only one partition, we have to process it on one thread.
|
|
1795
|
-
if (state.
|
|
1697
|
+
if (!state.grouping_data) {
|
|
1796
1698
|
return 1;
|
|
1797
1699
|
}
|
|
1798
1700
|
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
max_threads++;
|
|
1803
|
-
}
|
|
1701
|
+
// If there is not a lot of data, process serially.
|
|
1702
|
+
if (state.count < STANDARD_ROW_GROUPS_SIZE) {
|
|
1703
|
+
return 1;
|
|
1804
1704
|
}
|
|
1805
1705
|
|
|
1806
|
-
return
|
|
1706
|
+
return state.hash_groups.size();
|
|
1807
1707
|
}
|
|
1808
1708
|
};
|
|
1809
1709
|
|
|
@@ -1814,8 +1714,8 @@ public:
|
|
|
1814
1714
|
using WindowExecutorPtr = unique_ptr<WindowExecutor>;
|
|
1815
1715
|
using WindowExecutors = vector<WindowExecutorPtr>;
|
|
1816
1716
|
|
|
1817
|
-
WindowLocalSourceState(
|
|
1818
|
-
: context(context.client), allocator(
|
|
1717
|
+
WindowLocalSourceState(const PhysicalWindow &op, ExecutionContext &context, WindowGlobalSourceState &gstate)
|
|
1718
|
+
: context(context.client), allocator(Allocator::Get(context.client)) {
|
|
1819
1719
|
vector<LogicalType> output_types;
|
|
1820
1720
|
for (idx_t expr_idx = 0; expr_idx < op.select_list.size(); ++expr_idx) {
|
|
1821
1721
|
D_ASSERT(op.select_list[expr_idx]->GetExpressionClass() == ExpressionClass::BOUND_WINDOW);
|
|
@@ -1882,7 +1782,7 @@ void WindowLocalSourceState::MaterializeSortedData() {
|
|
|
1882
1782
|
D_ASSERT(!sd.data_blocks.empty());
|
|
1883
1783
|
auto &block = sd.data_blocks[0];
|
|
1884
1784
|
rows = make_unique<RowDataCollection>(buffer_manager, block->capacity, block->entry_size);
|
|
1885
|
-
rows->blocks = move(sd.data_blocks);
|
|
1785
|
+
rows->blocks = std::move(sd.data_blocks);
|
|
1886
1786
|
rows->count = std::accumulate(rows->blocks.begin(), rows->blocks.end(), idx_t(0),
|
|
1887
1787
|
[&](idx_t c, const unique_ptr<RowDataBlock> &b) { return c + b->count; });
|
|
1888
1788
|
|
|
@@ -1890,7 +1790,7 @@ void WindowLocalSourceState::MaterializeSortedData() {
|
|
|
1890
1790
|
if (!sd.heap_blocks.empty()) {
|
|
1891
1791
|
auto &block = sd.heap_blocks[0];
|
|
1892
1792
|
heap = make_unique<RowDataCollection>(buffer_manager, block->capacity, block->entry_size);
|
|
1893
|
-
heap->blocks = move(sd.heap_blocks);
|
|
1793
|
+
heap->blocks = std::move(sd.heap_blocks);
|
|
1894
1794
|
hash_group.reset();
|
|
1895
1795
|
} else {
|
|
1896
1796
|
heap = make_unique<RowDataCollection>(buffer_manager, (idx_t)Storage::BLOCK_SIZE, 1, true);
|
|
@@ -1904,7 +1804,6 @@ void WindowLocalSourceState::GeneratePartition(WindowGlobalSinkState &gstate, co
|
|
|
1904
1804
|
|
|
1905
1805
|
// Get rid of any stale data
|
|
1906
1806
|
hash_bin = hash_bin_p;
|
|
1907
|
-
hash_group.reset();
|
|
1908
1807
|
|
|
1909
1808
|
// There are three types of partitions:
|
|
1910
1809
|
// 1. No partition (no sorting)
|
|
@@ -1927,7 +1826,7 @@ void WindowLocalSourceState::GeneratePartition(WindowGlobalSinkState &gstate, co
|
|
|
1927
1826
|
D_ASSERT(op.select_list[expr_idx]->GetExpressionClass() == ExpressionClass::BOUND_WINDOW);
|
|
1928
1827
|
auto wexpr = reinterpret_cast<BoundWindowExpression *>(op.select_list[expr_idx].get());
|
|
1929
1828
|
auto wexec = make_unique<WindowExecutor>(wexpr, context, count);
|
|
1930
|
-
window_execs.emplace_back(move(wexec));
|
|
1829
|
+
window_execs.emplace_back(std::move(wexec));
|
|
1931
1830
|
}
|
|
1932
1831
|
|
|
1933
1832
|
// Initialise masks to false
|
|
@@ -1953,7 +1852,7 @@ void WindowLocalSourceState::GeneratePartition(WindowGlobalSinkState &gstate, co
|
|
|
1953
1852
|
external = true;
|
|
1954
1853
|
} else if (hash_bin < gstate.hash_groups.size() && gstate.hash_groups[hash_bin]) {
|
|
1955
1854
|
// Overwrite the collections with the sorted data
|
|
1956
|
-
hash_group = move(gstate.hash_groups[hash_bin]);
|
|
1855
|
+
hash_group = std::move(gstate.hash_groups[hash_bin]);
|
|
1957
1856
|
hash_group->ComputeMasks(partition_mask, order_mask);
|
|
1958
1857
|
MaterializeSortedData();
|
|
1959
1858
|
} else {
|
|
@@ -1987,13 +1886,12 @@ void WindowLocalSourceState::GeneratePartition(WindowGlobalSinkState &gstate, co
|
|
|
1987
1886
|
scanner->ReSwizzle();
|
|
1988
1887
|
|
|
1989
1888
|
// Second pass can flush
|
|
1990
|
-
scanner
|
|
1889
|
+
scanner->Reset(true);
|
|
1991
1890
|
}
|
|
1992
1891
|
|
|
1993
1892
|
void WindowLocalSourceState::Scan(DataChunk &result) {
|
|
1994
1893
|
D_ASSERT(scanner);
|
|
1995
1894
|
if (!scanner->Remaining()) {
|
|
1996
|
-
scanner.reset();
|
|
1997
1895
|
return;
|
|
1998
1896
|
}
|
|
1999
1897
|
|
|
@@ -2021,8 +1919,9 @@ void WindowLocalSourceState::Scan(DataChunk &result) {
|
|
|
2021
1919
|
}
|
|
2022
1920
|
|
|
2023
1921
|
unique_ptr<LocalSourceState> PhysicalWindow::GetLocalSourceState(ExecutionContext &context,
|
|
2024
|
-
GlobalSourceState &
|
|
2025
|
-
|
|
1922
|
+
GlobalSourceState &gstate_p) const {
|
|
1923
|
+
auto &gstate = (WindowGlobalSourceState &)gstate_p;
|
|
1924
|
+
return make_unique<WindowLocalSourceState>(*this, context, gstate);
|
|
2026
1925
|
}
|
|
2027
1926
|
|
|
2028
1927
|
unique_ptr<GlobalSourceState> PhysicalWindow::GetGlobalSourceState(ClientContext &context) const {
|
|
@@ -2037,25 +1936,28 @@ void PhysicalWindow::GetData(ExecutionContext &context, DataChunk &chunk, Global
|
|
|
2037
1936
|
|
|
2038
1937
|
const auto bin_count = gstate.hash_groups.empty() ? 1 : gstate.hash_groups.size();
|
|
2039
1938
|
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
state.scanner.
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
1939
|
+
while (chunk.size() == 0) {
|
|
1940
|
+
// Move to the next bin if we are done.
|
|
1941
|
+
while (!state.scanner || !state.scanner->Remaining()) {
|
|
1942
|
+
state.scanner.reset();
|
|
1943
|
+
state.rows.reset();
|
|
1944
|
+
state.heap.reset();
|
|
1945
|
+
state.hash_group.reset();
|
|
1946
|
+
auto hash_bin = global_source.next_bin++;
|
|
1947
|
+
if (hash_bin >= bin_count) {
|
|
1948
|
+
return;
|
|
1949
|
+
}
|
|
2049
1950
|
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
1951
|
+
for (; hash_bin < gstate.hash_groups.size(); hash_bin = global_source.next_bin++) {
|
|
1952
|
+
if (gstate.hash_groups[hash_bin]) {
|
|
1953
|
+
break;
|
|
1954
|
+
}
|
|
2053
1955
|
}
|
|
1956
|
+
state.GeneratePartition(gstate, hash_bin);
|
|
2054
1957
|
}
|
|
2055
|
-
state.GeneratePartition(gstate, hash_bin);
|
|
2056
|
-
}
|
|
2057
1958
|
|
|
2058
|
-
|
|
1959
|
+
state.Scan(chunk);
|
|
1960
|
+
}
|
|
2059
1961
|
}
|
|
2060
1962
|
|
|
2061
1963
|
string PhysicalWindow::ParamsToString() const {
|