duckdb 1.3.4 → 1.4.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/.github/workflows/NodeJS.yml +8 -20
- package/binding.gyp +9 -1
- package/package.json +1 -1
- package/src/connection.cpp +1 -1
- package/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp +4 -0
- package/src/duckdb/extension/core_functions/aggregate/distributive/approx_count.cpp +8 -4
- package/src/duckdb/extension/core_functions/aggregate/distributive/arg_min_max.cpp +16 -12
- package/src/duckdb/extension/core_functions/aggregate/distributive/bitagg.cpp +5 -1
- package/src/duckdb/extension/core_functions/aggregate/distributive/bitstring_agg.cpp +5 -1
- package/src/duckdb/extension/core_functions/aggregate/distributive/bool.cpp +4 -0
- package/src/duckdb/extension/core_functions/aggregate/distributive/kurtosis.cpp +4 -0
- package/src/duckdb/extension/core_functions/aggregate/distributive/product.cpp +4 -0
- package/src/duckdb/extension/core_functions/aggregate/distributive/skew.cpp +4 -0
- package/src/duckdb/extension/core_functions/aggregate/distributive/string_agg.cpp +6 -2
- package/src/duckdb/extension/core_functions/aggregate/distributive/sum.cpp +64 -0
- package/src/duckdb/extension/core_functions/aggregate/holistic/approx_top_k.cpp +7 -3
- package/src/duckdb/extension/core_functions/aggregate/holistic/approximate_quantile.cpp +7 -4
- package/src/duckdb/extension/core_functions/aggregate/holistic/mad.cpp +6 -3
- package/src/duckdb/extension/core_functions/aggregate/holistic/mode.cpp +8 -1
- package/src/duckdb/extension/core_functions/aggregate/holistic/quantile.cpp +7 -46
- package/src/duckdb/extension/core_functions/aggregate/holistic/reservoir_quantile.cpp +9 -15
- package/src/duckdb/extension/core_functions/aggregate/nested/binned_histogram.cpp +12 -8
- package/src/duckdb/extension/core_functions/aggregate/nested/histogram.cpp +7 -5
- package/src/duckdb/extension/core_functions/aggregate/nested/list.cpp +14 -24
- package/src/duckdb/extension/core_functions/aggregate/regression/regr_avg.cpp +5 -0
- package/src/duckdb/extension/core_functions/aggregate/regression/regr_intercept.cpp +3 -0
- package/src/duckdb/extension/core_functions/aggregate/regression/regr_r2.cpp +5 -0
- package/src/duckdb/extension/core_functions/aggregate/regression/regr_sxx_syy.cpp +3 -0
- package/src/duckdb/extension/core_functions/aggregate/regression/regr_sxy.cpp +4 -0
- package/src/duckdb/extension/core_functions/core_functions_extension.cpp +6 -18
- package/src/duckdb/extension/core_functions/function_list.cpp +6 -3
- package/src/duckdb/extension/core_functions/include/core_functions/aggregate/algebraic/stddev.hpp +1 -1
- package/src/duckdb/extension/core_functions/include/core_functions/aggregate/algebraic_functions.hpp +2 -2
- package/src/duckdb/extension/core_functions/include/core_functions/aggregate/distributive_functions.hpp +4 -4
- package/src/duckdb/extension/core_functions/include/core_functions/aggregate/holistic_functions.hpp +1 -1
- package/src/duckdb/extension/core_functions/include/core_functions/aggregate/quantile_sort_tree.hpp +32 -45
- package/src/duckdb/extension/core_functions/include/core_functions/aggregate/quantile_state.hpp +1 -1
- package/src/duckdb/extension/core_functions/include/core_functions/aggregate/regression_functions.hpp +8 -8
- package/src/duckdb/extension/core_functions/include/core_functions/aggregate/sum_helpers.hpp +1 -1
- package/src/duckdb/extension/core_functions/include/core_functions/scalar/array_functions.hpp +22 -22
- package/src/duckdb/extension/core_functions/include/core_functions/scalar/blob_functions.hpp +2 -2
- package/src/duckdb/extension/core_functions/include/core_functions/scalar/date_functions.hpp +15 -5
- package/src/duckdb/extension/core_functions/include/core_functions/scalar/generic_functions.hpp +22 -12
- package/src/duckdb/extension/core_functions/include/core_functions/scalar/list_functions.hpp +56 -56
- package/src/duckdb/extension/core_functions/include/core_functions/scalar/map_functions.hpp +2 -2
- package/src/duckdb/extension/core_functions/include/core_functions/scalar/math_functions.hpp +3 -3
- package/src/duckdb/extension/core_functions/include/core_functions/scalar/string_functions.hpp +118 -118
- package/src/duckdb/extension/core_functions/include/core_functions/scalar/struct_functions.hpp +10 -0
- package/src/duckdb/extension/core_functions/include/core_functions_extension.hpp +1 -1
- package/src/duckdb/extension/core_functions/lambda_functions.cpp +4 -4
- package/src/duckdb/extension/core_functions/scalar/array/array_functions.cpp +2 -1
- package/src/duckdb/extension/core_functions/scalar/array/array_value.cpp +7 -3
- package/src/duckdb/extension/core_functions/scalar/bit/bitstring.cpp +7 -0
- package/src/duckdb/extension/core_functions/scalar/blob/base64.cpp +5 -2
- package/src/duckdb/extension/core_functions/scalar/blob/encode.cpp +6 -2
- package/src/duckdb/extension/core_functions/scalar/date/date_diff.cpp +7 -3
- package/src/duckdb/extension/core_functions/scalar/date/date_part.cpp +187 -33
- package/src/duckdb/extension/core_functions/scalar/date/date_sub.cpp +7 -3
- package/src/duckdb/extension/core_functions/scalar/date/date_trunc.cpp +12 -8
- package/src/duckdb/extension/core_functions/scalar/date/epoch.cpp +16 -12
- package/src/duckdb/extension/core_functions/scalar/date/make_date.cpp +11 -7
- package/src/duckdb/extension/core_functions/scalar/date/time_bucket.cpp +7 -3
- package/src/duckdb/extension/core_functions/scalar/date/to_interval.cpp +4 -0
- package/src/duckdb/extension/core_functions/scalar/enum/enum_functions.cpp +6 -6
- package/src/duckdb/extension/core_functions/scalar/generic/binning.cpp +8 -4
- package/src/duckdb/extension/core_functions/scalar/generic/can_implicitly_cast.cpp +6 -2
- package/src/duckdb/extension/core_functions/scalar/generic/cast_to_type.cpp +4 -1
- package/src/duckdb/extension/core_functions/scalar/generic/current_setting.cpp +5 -2
- package/src/duckdb/extension/core_functions/scalar/generic/least.cpp +5 -2
- package/src/duckdb/extension/core_functions/scalar/generic/replace_type.cpp +34 -0
- package/src/duckdb/extension/core_functions/scalar/generic/stats.cpp +5 -2
- package/src/duckdb/extension/core_functions/scalar/generic/system_functions.cpp +13 -9
- package/src/duckdb/extension/core_functions/scalar/generic/typeof.cpp +5 -1
- package/src/duckdb/extension/core_functions/scalar/list/array_slice.cpp +29 -26
- package/src/duckdb/extension/core_functions/scalar/list/flatten.cpp +9 -49
- package/src/duckdb/extension/core_functions/scalar/list/list_aggregates.cpp +17 -34
- package/src/duckdb/extension/core_functions/scalar/list/list_has_any_or_all.cpp +4 -50
- package/src/duckdb/extension/core_functions/scalar/list/list_reduce.cpp +46 -42
- package/src/duckdb/extension/core_functions/scalar/list/list_sort.cpp +48 -51
- package/src/duckdb/extension/core_functions/scalar/list/list_value.cpp +224 -144
- package/src/duckdb/extension/core_functions/scalar/list/range.cpp +5 -1
- package/src/duckdb/extension/core_functions/scalar/map/map.cpp +13 -41
- package/src/duckdb/extension/core_functions/scalar/map/map_concat.cpp +6 -6
- package/src/duckdb/extension/core_functions/scalar/map/map_entries.cpp +6 -42
- package/src/duckdb/extension/core_functions/scalar/map/map_extract.cpp +10 -59
- package/src/duckdb/extension/core_functions/scalar/map/map_from_entries.cpp +7 -32
- package/src/duckdb/extension/core_functions/scalar/map/map_keys_values.cpp +10 -45
- package/src/duckdb/extension/core_functions/scalar/math/numeric.cpp +364 -139
- package/src/duckdb/extension/core_functions/scalar/operators/bitwise.cpp +29 -7
- package/src/duckdb/extension/core_functions/scalar/random/random.cpp +18 -14
- package/src/duckdb/extension/core_functions/scalar/random/setseed.cpp +5 -1
- package/src/duckdb/extension/core_functions/scalar/string/hex.cpp +2 -2
- package/src/duckdb/extension/core_functions/scalar/string/instr.cpp +5 -3
- package/src/duckdb/extension/core_functions/scalar/string/printf.cpp +16 -0
- package/src/duckdb/extension/core_functions/scalar/string/repeat.cpp +2 -17
- package/src/duckdb/extension/core_functions/scalar/struct/struct_insert.cpp +1 -1
- package/src/duckdb/extension/core_functions/scalar/struct/struct_update.cpp +161 -0
- package/src/duckdb/extension/core_functions/scalar/union/union_extract.cpp +7 -3
- package/src/duckdb/extension/core_functions/scalar/union/union_tag.cpp +7 -3
- package/src/duckdb/extension/core_functions/scalar/union/union_value.cpp +7 -3
- package/src/duckdb/extension/icu/icu-current.cpp +5 -5
- package/src/duckdb/extension/icu/icu-dateadd.cpp +11 -11
- package/src/duckdb/extension/icu/icu-datepart.cpp +44 -44
- package/src/duckdb/extension/icu/icu-datesub.cpp +10 -10
- package/src/duckdb/extension/icu/icu-datetrunc.cpp +6 -6
- package/src/duckdb/extension/icu/icu-list-range.cpp +7 -6
- package/src/duckdb/extension/icu/icu-makedate.cpp +8 -11
- package/src/duckdb/extension/icu/icu-strptime.cpp +25 -30
- package/src/duckdb/extension/icu/icu-table-range.cpp +8 -6
- package/src/duckdb/extension/icu/icu-timebucket.cpp +5 -5
- package/src/duckdb/extension/icu/icu-timezone.cpp +24 -30
- package/src/duckdb/extension/icu/icu_extension.cpp +22 -34
- package/src/duckdb/extension/icu/include/icu-casts.hpp +2 -2
- package/src/duckdb/extension/icu/include/icu-current.hpp +3 -3
- package/src/duckdb/extension/icu/include/icu-dateadd.hpp +3 -3
- package/src/duckdb/extension/icu/include/icu-datepart.hpp +3 -3
- package/src/duckdb/extension/icu/include/icu-datesub.hpp +3 -3
- package/src/duckdb/extension/icu/include/icu-datetrunc.hpp +3 -3
- package/src/duckdb/extension/icu/include/icu-list-range.hpp +3 -3
- package/src/duckdb/extension/icu/include/icu-makedate.hpp +3 -3
- package/src/duckdb/extension/icu/include/icu-strptime.hpp +3 -3
- package/src/duckdb/extension/icu/include/icu-table-range.hpp +3 -3
- package/src/duckdb/extension/icu/include/icu-timebucket.hpp +3 -3
- package/src/duckdb/extension/icu/include/icu-timezone.hpp +3 -3
- package/src/duckdb/extension/icu/include/icu_extension.hpp +1 -1
- package/src/duckdb/extension/json/include/json_common.hpp +12 -6
- package/src/duckdb/extension/json/include/json_enums.hpp +3 -1
- package/src/duckdb/extension/json/include/json_extension.hpp +1 -1
- package/src/duckdb/extension/json/include/json_functions.hpp +4 -4
- package/src/duckdb/extension/json/include/json_multi_file_info.hpp +2 -2
- package/src/duckdb/extension/json/include/json_reader.hpp +3 -1
- package/src/duckdb/extension/json/json_enums.cpp +5 -0
- package/src/duckdb/extension/json/json_extension.cpp +27 -38
- package/src/duckdb/extension/json/json_functions/copy_json.cpp +8 -3
- package/src/duckdb/extension/json/json_functions/json_create.cpp +9 -6
- package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +3 -20
- package/src/duckdb/extension/json/json_functions/json_pretty.cpp +3 -3
- package/src/duckdb/extension/json/json_functions/json_serialize_plan.cpp +6 -4
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +6 -4
- package/src/duckdb/extension/json/json_functions/json_table_in_out.cpp +6 -2
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +5 -3
- package/src/duckdb/extension/json/json_functions/read_json.cpp +4 -3
- package/src/duckdb/extension/json/json_functions.cpp +139 -8
- package/src/duckdb/extension/json/json_multi_file_info.cpp +5 -2
- package/src/duckdb/extension/json/json_reader.cpp +7 -6
- package/src/duckdb/extension/parquet/column_reader.cpp +46 -21
- package/src/duckdb/extension/parquet/column_writer.cpp +46 -125
- package/src/duckdb/extension/parquet/geo_parquet.cpp +251 -176
- package/src/duckdb/extension/parquet/include/column_reader.hpp +0 -2
- package/src/duckdb/extension/parquet/include/column_writer.hpp +4 -3
- package/src/duckdb/extension/parquet/include/geo_parquet.hpp +188 -67
- package/src/duckdb/extension/parquet/include/parquet_column_schema.hpp +6 -4
- package/src/duckdb/extension/parquet/include/parquet_crypto.hpp +0 -3
- package/src/duckdb/extension/parquet/include/parquet_extension.hpp +1 -1
- package/src/duckdb/extension/parquet/include/parquet_file_metadata_cache.hpp +5 -2
- package/src/duckdb/extension/parquet/include/parquet_multi_file_info.hpp +2 -2
- package/src/duckdb/extension/parquet/include/parquet_reader.hpp +10 -2
- package/src/duckdb/extension/parquet/include/parquet_rle_bp_encoder.hpp +3 -0
- package/src/duckdb/extension/parquet/include/parquet_statistics.hpp +0 -2
- package/src/duckdb/extension/parquet/include/parquet_timestamp.hpp +10 -6
- package/src/duckdb/extension/parquet/include/parquet_writer.hpp +11 -5
- package/src/duckdb/extension/parquet/include/reader/row_number_column_reader.hpp +0 -2
- package/src/duckdb/extension/parquet/include/reader/string_column_reader.hpp +13 -0
- package/src/duckdb/extension/parquet/include/reader/uuid_column_reader.hpp +3 -13
- package/src/duckdb/extension/parquet/include/reader/variant/variant_binary_decoder.hpp +150 -0
- package/src/duckdb/extension/parquet/include/reader/variant/variant_shredded_conversion.hpp +23 -0
- package/src/duckdb/extension/parquet/include/reader/variant/variant_value.hpp +54 -0
- package/src/duckdb/extension/parquet/include/reader/variant_column_reader.hpp +44 -0
- package/src/duckdb/extension/parquet/include/resizable_buffer.hpp +0 -2
- package/src/duckdb/extension/parquet/include/thrift_tools.hpp +3 -3
- package/src/duckdb/extension/parquet/include/writer/array_column_writer.hpp +6 -1
- package/src/duckdb/extension/parquet/include/writer/list_column_writer.hpp +2 -1
- package/src/duckdb/extension/parquet/include/writer/parquet_write_operators.hpp +47 -10
- package/src/duckdb/extension/parquet/include/writer/parquet_write_stats.hpp +55 -1
- package/src/duckdb/extension/parquet/include/writer/primitive_column_writer.hpp +4 -3
- package/src/duckdb/extension/parquet/include/writer/struct_column_writer.hpp +2 -1
- package/src/duckdb/extension/parquet/include/writer/templated_column_writer.hpp +6 -3
- package/src/duckdb/extension/parquet/include/zstd_file_system.hpp +1 -3
- package/src/duckdb/extension/parquet/parquet_crypto.cpp +11 -11
- package/src/duckdb/extension/parquet/parquet_extension.cpp +140 -69
- package/src/duckdb/extension/parquet/parquet_file_metadata_cache.cpp +4 -4
- package/src/duckdb/extension/parquet/parquet_float16.cpp +0 -3
- package/src/duckdb/extension/parquet/parquet_metadata.cpp +115 -17
- package/src/duckdb/extension/parquet/parquet_multi_file_info.cpp +25 -10
- package/src/duckdb/extension/parquet/parquet_reader.cpp +185 -57
- package/src/duckdb/extension/parquet/parquet_statistics.cpp +31 -15
- package/src/duckdb/extension/parquet/parquet_timestamp.cpp +14 -4
- package/src/duckdb/extension/parquet/parquet_writer.cpp +129 -21
- package/src/duckdb/extension/parquet/reader/decimal_column_reader.cpp +1 -1
- package/src/duckdb/extension/parquet/reader/string_column_reader.cpp +17 -4
- package/src/duckdb/extension/parquet/reader/variant/variant_binary_decoder.cpp +367 -0
- package/src/duckdb/extension/parquet/reader/variant/variant_shredded_conversion.cpp +565 -0
- package/src/duckdb/extension/parquet/reader/variant/variant_value.cpp +85 -0
- package/src/duckdb/extension/parquet/reader/variant_column_reader.cpp +161 -0
- package/src/duckdb/extension/parquet/writer/array_column_writer.cpp +27 -30
- package/src/duckdb/extension/parquet/writer/enum_column_writer.cpp +1 -1
- package/src/duckdb/extension/parquet/writer/list_column_writer.cpp +6 -3
- package/src/duckdb/extension/parquet/writer/primitive_column_writer.cpp +36 -8
- package/src/duckdb/extension/parquet/writer/struct_column_writer.cpp +7 -4
- package/src/duckdb/extension/parquet/zstd_file_system.cpp +7 -6
- package/src/duckdb/src/catalog/catalog.cpp +92 -62
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +8 -8
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +14 -8
- package/src/duckdb/src/catalog/catalog_search_path.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_set.cpp +2 -2
- package/src/duckdb/src/catalog/default/default_functions.cpp +4 -4
- package/src/duckdb/src/catalog/default/default_table_functions.cpp +5 -4
- package/src/duckdb/src/catalog/default/default_views.cpp +1 -1
- package/src/duckdb/src/catalog/duck_catalog.cpp +28 -0
- package/src/duckdb/src/common/adbc/adbc.cpp +243 -125
- package/src/duckdb/src/common/adbc/driver_manager.cpp +3 -3
- package/src/duckdb/src/common/arrow/appender/append_data.cpp +29 -0
- package/src/duckdb/src/common/arrow/appender/bool_data.cpp +6 -7
- package/src/duckdb/src/common/arrow/appender/fixed_size_list_data.cpp +1 -1
- package/src/duckdb/src/common/arrow/appender/struct_data.cpp +1 -1
- package/src/duckdb/src/common/arrow/appender/union_data.cpp +0 -1
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +13 -17
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +14 -6
- package/src/duckdb/src/common/arrow/arrow_type_extension.cpp +6 -6
- package/src/duckdb/src/common/arrow/physical_arrow_collector.cpp +16 -10
- package/src/duckdb/src/common/arrow/schema_metadata.cpp +2 -2
- package/src/duckdb/src/common/bignum.cpp +362 -0
- package/src/duckdb/src/common/box_renderer.cpp +83 -32
- package/src/duckdb/src/common/complex_json.cpp +20 -5
- package/src/duckdb/src/common/compressed_file_system.cpp +6 -5
- package/src/duckdb/src/common/csv_writer.cpp +381 -0
- package/src/duckdb/src/common/encryption_functions.cpp +228 -0
- package/src/duckdb/src/common/encryption_key_manager.cpp +143 -0
- package/src/duckdb/src/common/encryption_state.cpp +56 -9
- package/src/duckdb/src/common/enum_util.cpp +425 -51
- 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/metric_type.cpp +6 -0
- package/src/duckdb/src/common/enums/optimizer_type.cpp +1 -0
- package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -0
- package/src/duckdb/src/common/enums/statement_type.cpp +2 -0
- package/src/duckdb/src/common/error_data.cpp +11 -0
- package/src/duckdb/src/common/exception_format_value.cpp +15 -1
- package/src/duckdb/src/common/extra_type_info.cpp +43 -0
- package/src/duckdb/src/common/file_buffer.cpp +11 -8
- package/src/duckdb/src/common/file_system.cpp +79 -39
- package/src/duckdb/src/common/gzip_file_system.cpp +13 -11
- package/src/duckdb/src/common/local_file_system.cpp +25 -16
- package/src/duckdb/src/common/multi_file/base_file_reader.cpp +4 -0
- package/src/duckdb/src/common/multi_file/multi_file_column_mapper.cpp +7 -11
- package/src/duckdb/src/common/multi_file/multi_file_function.cpp +8 -0
- package/src/duckdb/src/common/multi_file/multi_file_list.cpp +8 -4
- package/src/duckdb/src/common/multi_file/multi_file_reader.cpp +9 -5
- package/src/duckdb/src/common/operator/cast_operators.cpp +147 -6
- package/src/duckdb/src/common/operator/string_cast.cpp +41 -12
- package/src/duckdb/src/common/pipe_file_system.cpp +10 -5
- package/src/duckdb/src/common/progress_bar/progress_bar.cpp +2 -2
- package/src/duckdb/src/common/progress_bar/terminal_progress_bar_display.cpp +81 -7
- package/src/duckdb/src/common/progress_bar/unscented_kalman_filter.cpp +288 -0
- package/src/duckdb/src/common/radix_partitioning.cpp +2 -2
- package/src/duckdb/src/common/row_operations/row_aggregate.cpp +8 -11
- package/src/duckdb/src/common/row_operations/row_external.cpp +0 -7
- package/src/duckdb/src/common/row_operations/row_gather.cpp +0 -5
- package/src/duckdb/src/common/row_operations/row_matcher.cpp +55 -37
- package/src/duckdb/src/common/row_operations/row_scatter.cpp +0 -6
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +4 -0
- package/src/duckdb/src/common/serializer/buffered_file_writer.cpp +4 -0
- package/src/duckdb/src/common/serializer/memory_stream.cpp +4 -0
- package/src/duckdb/src/common/sort/partition_state.cpp +3 -3
- package/src/duckdb/src/common/sorting/hashed_sort.cpp +724 -0
- package/src/duckdb/src/common/sorting/sort.cpp +532 -0
- package/src/duckdb/src/common/sorting/sorted_run.cpp +341 -0
- package/src/duckdb/src/common/sorting/sorted_run_merger.cpp +970 -0
- package/src/duckdb/src/common/string_util.cpp +88 -44
- package/src/duckdb/src/common/tree_renderer/text_tree_renderer.cpp +40 -3
- package/src/duckdb/src/common/tree_renderer/yaml_tree_renderer.cpp +144 -0
- package/src/duckdb/src/common/tree_renderer.cpp +3 -0
- package/src/duckdb/src/common/types/bignum.cpp +350 -0
- package/src/duckdb/src/common/types/column/column_data_allocator.cpp +27 -29
- package/src/duckdb/src/common/types/column/column_data_collection.cpp +216 -68
- package/src/duckdb/src/common/types/column/column_data_collection_segment.cpp +3 -2
- package/src/duckdb/src/common/types/conflict_info.cpp +1 -2
- package/src/duckdb/src/common/types/conflict_manager.cpp +82 -207
- package/src/duckdb/src/common/types/data_chunk.cpp +10 -3
- package/src/duckdb/src/common/types/date.cpp +8 -10
- package/src/duckdb/src/common/types/hash.cpp +7 -7
- package/src/duckdb/src/common/types/row/block_iterator.cpp +34 -0
- package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +38 -29
- package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +272 -54
- package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +156 -45
- package/src/duckdb/src/common/types/row/tuple_data_iterator.cpp +5 -5
- package/src/duckdb/src/common/types/row/tuple_data_layout.cpp +122 -18
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +466 -83
- package/src/duckdb/src/common/types/row/tuple_data_segment.cpp +8 -28
- package/src/duckdb/src/common/types/time.cpp +2 -2
- package/src/duckdb/src/common/types/timestamp.cpp +26 -14
- package/src/duckdb/src/common/types/uuid.cpp +33 -2
- package/src/duckdb/src/common/types/value.cpp +79 -16
- package/src/duckdb/src/common/types/vector.cpp +190 -22
- package/src/duckdb/src/common/types/vector_buffer.cpp +4 -0
- package/src/duckdb/src/common/types/vector_cache.cpp +4 -0
- package/src/duckdb/src/common/types.cpp +110 -22
- package/src/duckdb/src/common/value_operations/comparison_operations.cpp +24 -27
- package/src/duckdb/src/common/vector_operations/boolean_operators.cpp +12 -9
- package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +5 -4
- package/src/duckdb/src/common/vector_operations/generators.cpp +1 -1
- package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +70 -135
- package/src/duckdb/src/common/vector_operations/null_operations.cpp +1 -1
- package/src/duckdb/src/common/vector_operations/vector_copy.cpp +5 -2
- package/src/duckdb/src/common/vector_operations/vector_hash.cpp +110 -55
- package/src/duckdb/src/common/vector_operations/vector_storage.cpp +14 -10
- package/src/duckdb/src/common/virtual_file_system.cpp +71 -13
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +88 -50
- package/src/duckdb/src/execution/column_binding_resolver.cpp +7 -6
- package/src/duckdb/src/execution/expression_executor/execute_function.cpp +113 -2
- package/src/duckdb/src/execution/expression_executor.cpp +44 -4
- package/src/duckdb/src/execution/index/art/art.cpp +78 -216
- package/src/duckdb/src/execution/index/art/art_builder.cpp +91 -0
- package/src/duckdb/src/execution/index/art/art_key.cpp +0 -23
- package/src/duckdb/src/execution/index/art/art_merger.cpp +3 -7
- package/src/duckdb/src/execution/index/art/base_leaf.cpp +10 -11
- package/src/duckdb/src/execution/index/art/base_node.cpp +103 -75
- package/src/duckdb/src/execution/index/art/iterator.cpp +3 -3
- package/src/duckdb/src/execution/index/art/leaf.cpp +9 -11
- package/src/duckdb/src/execution/index/art/node.cpp +54 -53
- package/src/duckdb/src/execution/index/art/node256.cpp +30 -56
- package/src/duckdb/src/execution/index/art/node256_leaf.cpp +43 -30
- package/src/duckdb/src/execution/index/art/node48.cpp +69 -101
- package/src/duckdb/src/execution/index/art/plan_art.cpp +2 -1
- package/src/duckdb/src/execution/index/art/prefix.cpp +119 -125
- package/src/duckdb/src/execution/index/bound_index.cpp +39 -10
- package/src/duckdb/src/execution/index/fixed_size_allocator.cpp +23 -8
- package/src/duckdb/src/execution/index/fixed_size_buffer.cpp +35 -23
- package/src/duckdb/src/execution/index/unbound_index.cpp +26 -6
- package/src/duckdb/src/execution/join_hashtable.cpp +52 -55
- package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_inner.cpp +3 -0
- package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +6 -4
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +27 -18
- package/src/duckdb/src/execution/operator/aggregate/physical_partitioned_aggregate.cpp +4 -2
- package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +4 -2
- package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +8 -2
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +6 -4
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +433 -387
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer.cpp +5 -4
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_file_handle.cpp +12 -4
- package/src/duckdb/src/execution/operator/csv_scanner/encode/csv_encoder.cpp +8 -7
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +8 -6
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +15 -2
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +4 -4
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_multi_file_info.cpp +12 -3
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_error.cpp +7 -2
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +4 -0
- package/src/duckdb/src/execution/operator/filter/physical_filter.cpp +14 -12
- package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +2 -1
- package/src/duckdb/src/execution/operator/helper/physical_buffered_batch_collector.cpp +2 -2
- package/src/duckdb/src/execution/operator/helper/physical_buffered_collector.cpp +3 -2
- package/src/duckdb/src/execution/operator/helper/physical_execute.cpp +2 -2
- package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +3 -3
- package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +4 -3
- package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +3 -2
- package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +29 -9
- package/src/duckdb/src/execution/operator/helper/physical_result_collector.cpp +23 -20
- package/src/duckdb/src/execution/operator/helper/physical_set.cpp +28 -11
- package/src/duckdb/src/execution/operator/helper/physical_set_variable.cpp +3 -2
- package/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp +4 -3
- package/src/duckdb/src/execution/operator/helper/physical_streaming_sample.cpp +3 -3
- package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +7 -3
- package/src/duckdb/src/execution/operator/helper/physical_verify_vector.cpp +4 -2
- package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +11 -10
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +3 -2
- package/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp +4 -4
- package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +4 -3
- package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +2 -2
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +13 -8
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +15 -14
- package/src/duckdb/src/execution/operator/join/physical_join.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_left_delim_join.cpp +5 -4
- package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +7 -7
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +20 -21
- package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +4 -3
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +18 -6
- package/src/duckdb/src/execution/operator/join/physical_right_delim_join.cpp +5 -4
- package/src/duckdb/src/execution/operator/order/physical_order.cpp +62 -203
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +5 -4
- package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +5 -3
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +9 -7
- package/src/duckdb/src/execution/operator/persistent/physical_copy_database.cpp +7 -5
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +12 -7
- package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +34 -5
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +6 -20
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +91 -74
- package/src/duckdb/src/execution/operator/persistent/physical_merge_into.cpp +516 -0
- package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +11 -9
- package/src/duckdb/src/execution/operator/projection/physical_pivot.cpp +7 -4
- package/src/duckdb/src/execution/operator/projection/physical_projection.cpp +3 -36
- package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +26 -4
- package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +5 -3
- package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +9 -7
- package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +3 -3
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +6 -5
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +12 -10
- package/src/duckdb/src/execution/operator/schema/physical_create_art_index.cpp +5 -4
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +3 -3
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +3 -2
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +3 -2
- package/src/duckdb/src/execution/operator/set/physical_cte.cpp +5 -4
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +5 -3
- package/src/duckdb/src/execution/operator/set/physical_union.cpp +3 -3
- package/src/duckdb/src/execution/physical_operator.cpp +42 -32
- package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +24 -12
- package/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp +8 -6
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +12 -18
- package/src/duckdb/src/execution/physical_plan/plan_get.cpp +3 -1
- package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +11 -10
- package/src/duckdb/src/execution/physical_plan/plan_merge_into.cpp +132 -0
- package/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp +16 -18
- package/src/duckdb/src/execution/physical_plan_generator.cpp +8 -5
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +16 -27
- package/src/duckdb/src/execution/sample/base_reservoir_sample.cpp +22 -22
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +14 -11
- package/src/duckdb/src/function/aggregate/distributive/first_last_any.cpp +23 -19
- package/src/duckdb/src/function/aggregate/distributive/minmax.cpp +14 -7
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +185 -234
- package/src/duckdb/src/function/cast/bignum_casts.cpp +315 -0
- package/src/duckdb/src/function/cast/blob_cast.cpp +3 -0
- package/src/duckdb/src/function/cast/cast_function_set.cpp +24 -4
- package/src/duckdb/src/function/cast/decimal_cast.cpp +3 -3
- package/src/duckdb/src/function/cast/default_casts.cpp +12 -4
- package/src/duckdb/src/function/cast/enum_casts.cpp +4 -3
- package/src/duckdb/src/function/cast/numeric_casts.cpp +3 -3
- package/src/duckdb/src/function/cast/string_cast.cpp +14 -11
- package/src/duckdb/src/function/cast/struct_cast.cpp +127 -2
- package/src/duckdb/src/function/cast/time_casts.cpp +18 -0
- package/src/duckdb/src/function/cast/union_casts.cpp +7 -6
- package/src/duckdb/src/function/cast/uuid_casts.cpp +3 -0
- package/src/duckdb/src/function/cast/variant/from_variant.cpp +697 -0
- package/src/duckdb/src/function/cast/variant/to_json.cpp +272 -0
- package/src/duckdb/src/function/cast/variant/to_variant.cpp +193 -0
- package/src/duckdb/src/function/cast_rules.cpp +38 -4
- package/src/duckdb/src/function/copy_blob.cpp +157 -0
- package/src/duckdb/src/function/copy_function.cpp +15 -0
- package/src/duckdb/src/function/function.cpp +2 -0
- package/src/duckdb/src/function/function_binder.cpp +239 -13
- package/src/duckdb/src/function/function_list.cpp +8 -0
- package/src/duckdb/src/function/macro_function.cpp +263 -70
- package/src/duckdb/src/function/pragma/pragma_functions.cpp +6 -38
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +37 -22
- package/src/duckdb/src/function/register_function_list.cpp +5 -5
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_integral.cpp +43 -34
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_string.cpp +61 -38
- package/src/duckdb/src/function/scalar/create_sort_key.cpp +374 -154
- package/src/duckdb/src/function/scalar/date/strftime.cpp +31 -28
- package/src/duckdb/src/function/scalar/generic/constant_or_null.cpp +18 -14
- package/src/duckdb/src/function/scalar/generic/error.cpp +18 -7
- package/src/duckdb/src/function/scalar/generic/getvariable.cpp +5 -2
- package/src/duckdb/src/function/scalar/list/contains_or_position.cpp +4 -52
- package/src/duckdb/src/function/scalar/list/list_extract.cpp +5 -12
- package/src/duckdb/src/function/scalar/list/list_resize.cpp +1 -1
- package/src/duckdb/src/function/scalar/list/list_select.cpp +11 -27
- package/src/duckdb/src/function/scalar/map/map_contains.cpp +5 -31
- package/src/duckdb/src/function/scalar/operator/add.cpp +6 -1
- package/src/duckdb/src/function/scalar/operator/arithmetic.cpp +130 -10
- package/src/duckdb/src/function/scalar/operator/multiply.cpp +4 -2
- package/src/duckdb/src/function/scalar/operator/subtract.cpp +3 -1
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +7 -3
- package/src/duckdb/src/function/scalar/strftime_format.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/caseconvert.cpp +4 -0
- package/src/duckdb/src/function/scalar/string/concat.cpp +18 -19
- package/src/duckdb/src/function/scalar/string/contains.cpp +14 -7
- package/src/duckdb/src/function/scalar/string/length.cpp +13 -9
- package/src/duckdb/src/function/scalar/string/like.cpp +146 -143
- package/src/duckdb/src/function/scalar/string/md5.cpp +6 -2
- package/src/duckdb/src/function/scalar/string/nfc_normalize.cpp +5 -1
- package/src/duckdb/src/function/scalar/string/prefix.cpp +11 -8
- package/src/duckdb/src/function/scalar/string/regexp_escape.cpp +5 -1
- package/src/duckdb/src/function/scalar/string/sha1.cpp +5 -1
- package/src/duckdb/src/function/scalar/string/sha256.cpp +5 -1
- package/src/duckdb/src/function/scalar/string/string_split.cpp +7 -3
- package/src/duckdb/src/function/scalar/string/strip_accents.cpp +5 -1
- package/src/duckdb/src/function/scalar/string/substring.cpp +10 -6
- package/src/duckdb/src/function/scalar/string/suffix.cpp +10 -8
- package/src/duckdb/src/function/scalar/struct/remap_struct.cpp +20 -17
- package/src/duckdb/src/function/scalar/struct/struct_concat.cpp +1 -1
- package/src/duckdb/src/function/scalar/struct/struct_contains.cpp +255 -0
- package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +2 -2
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +34 -31
- package/src/duckdb/src/function/scalar/system/current_connection_id.cpp +5 -1
- package/src/duckdb/src/function/scalar/system/current_query_id.cpp +5 -1
- package/src/duckdb/src/function/scalar/system/current_transaction_id.cpp +5 -1
- package/src/duckdb/src/function/scalar/system/parse_log_message.cpp +5 -1
- package/src/duckdb/src/function/scalar/system/write_log.cpp +11 -13
- package/src/duckdb/src/function/scalar/variant/variant_extract.cpp +234 -0
- package/src/duckdb/src/function/scalar/variant/variant_typeof.cpp +70 -0
- package/src/duckdb/src/function/scalar/variant/variant_utils.cpp +412 -0
- package/src/duckdb/src/function/scalar_macro_function.cpp +8 -11
- package/src/duckdb/src/function/table/arrow/arrow_array_scan_state.cpp +2 -3
- package/src/duckdb/src/function/table/arrow/arrow_duck_schema.cpp +27 -2
- package/src/duckdb/src/function/table/arrow.cpp +37 -17
- package/src/duckdb/src/function/table/arrow_conversion.cpp +186 -236
- package/src/duckdb/src/function/table/copy_csv.cpp +76 -245
- package/src/duckdb/src/function/table/direct_file_reader.cpp +172 -0
- package/src/duckdb/src/function/table/read_file.cpp +90 -220
- package/src/duckdb/src/function/table/sniff_csv.cpp +0 -1
- package/src/duckdb/src/function/table/system/duckdb_approx_database_count.cpp +43 -0
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_connection_count.cpp +45 -0
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +3 -7
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +20 -5
- package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +10 -5
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +6 -22
- package/src/duckdb/src/function/table/system/duckdb_log.cpp +41 -5
- package/src/duckdb/src/function/table/system/duckdb_log_contexts.cpp +15 -6
- package/src/duckdb/src/function/table/system/duckdb_settings.cpp +40 -7
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +4 -0
- package/src/duckdb/src/function/table/system/logging_utils.cpp +154 -0
- package/src/duckdb/src/function/table/system/pragma_database_size.cpp +2 -2
- package/src/duckdb/src/function/table/system/test_all_types.cpp +30 -6
- package/src/duckdb/src/function/table/system_functions.cpp +3 -0
- package/src/duckdb/src/function/table/table_scan.cpp +82 -48
- package/src/duckdb/src/function/table/version/pragma_version.cpp +7 -4
- package/src/duckdb/src/function/window/window_aggregate_function.cpp +56 -46
- package/src/duckdb/src/function/window/window_aggregator.cpp +33 -19
- package/src/duckdb/src/function/window/window_boundaries_state.cpp +12 -2
- package/src/duckdb/src/function/window/window_collection.cpp +30 -0
- package/src/duckdb/src/function/window/window_constant_aggregator.cpp +32 -24
- package/src/duckdb/src/function/window/window_custom_aggregator.cpp +54 -40
- package/src/duckdb/src/function/window/window_distinct_aggregator.cpp +200 -251
- package/src/duckdb/src/function/window/window_executor.cpp +44 -36
- package/src/duckdb/src/function/window/window_index_tree.cpp +26 -16
- package/src/duckdb/src/function/window/window_merge_sort_tree.cpp +98 -151
- package/src/duckdb/src/function/window/window_naive_aggregator.cpp +94 -72
- package/src/duckdb/src/function/window/window_rank_function.cpp +57 -63
- package/src/duckdb/src/function/window/window_rownumber_function.cpp +45 -47
- package/src/duckdb/src/function/window/window_segment_tree.cpp +28 -22
- package/src/duckdb/src/function/window/window_token_tree.cpp +46 -41
- package/src/duckdb/src/function/window/window_value_function.cpp +632 -93
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +24 -5
- package/src/duckdb/src/include/duckdb/catalog/default/builtin_types/types.hpp +5 -2
- package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +16 -0
- package/src/duckdb/src/include/duckdb/common/adbc/adbc.hpp +68 -1
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/arena_linked_list.hpp +169 -0
- package/src/duckdb/src/include/duckdb/common/arrow/appender/append_data.hpp +31 -55
- package/src/duckdb/src/include/duckdb/common/arrow/appender/enum_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/arrow/appender/list_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/arrow/appender/list_view_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/arrow/appender/map_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/arrow/appender/scalar_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/arrow/appender/varchar_data.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_wrapper.hpp +10 -0
- package/src/duckdb/src/include/duckdb/common/arrow/physical_arrow_batch_collector.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/arrow/physical_arrow_collector.hpp +3 -4
- package/src/duckdb/src/include/duckdb/common/bignum.hpp +85 -0
- package/src/duckdb/src/include/duckdb/common/box_renderer.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/chrono.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/complex_json.hpp +15 -4
- package/src/duckdb/src/include/duckdb/common/compressed_file_system.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/csv_writer.hpp +153 -0
- package/src/duckdb/src/include/duckdb/common/encryption_functions.hpp +54 -0
- package/src/duckdb/src/include/duckdb/common/encryption_key_manager.hpp +80 -0
- package/src/duckdb/src/include/duckdb/common/encryption_state.hpp +25 -9
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +128 -0
- package/src/duckdb/src/include/duckdb/common/enums/arrow_format_version.hpp +33 -0
- package/src/duckdb/src/include/duckdb/common/enums/checkpoint_abort.hpp +22 -0
- package/src/duckdb/src/include/duckdb/common/enums/checkpoint_type.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/enums/copy_option_mode.hpp +17 -0
- package/src/duckdb/src/include/duckdb/common/enums/debug_vector_verification.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/enums/explain_format.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/file_glob_options.hpp +11 -3
- package/src/duckdb/src/include/duckdb/common/enums/logical_operator_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/merge_action_type.hpp +19 -0
- package/src/duckdb/src/include/duckdb/common/enums/metric_type.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/enums/optimizer_type.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/enums/ordinality_request_type.hpp +16 -0
- package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/statement_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/tableref_type.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/enums/thread_pin_mode.hpp +17 -0
- package/src/duckdb/src/include/duckdb/common/enums/tuple_data_layout_enums.hpp +25 -0
- package/src/duckdb/src/include/duckdb/common/enums/undo_flags.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/error_data.hpp +4 -2
- package/src/duckdb/src/include/duckdb/common/exception_format_value.hpp +9 -1
- package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +25 -1
- package/src/duckdb/src/include/duckdb/common/file_buffer.hpp +15 -6
- package/src/duckdb/src/include/duckdb/common/file_open_flags.hpp +14 -0
- package/src/duckdb/src/include/duckdb/common/file_opener.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +14 -6
- package/src/duckdb/src/include/duckdb/common/fsst.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/gzip_file_system.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/helper.hpp +21 -3
- package/src/duckdb/src/include/duckdb/common/local_file_system.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/multi_file/base_file_reader.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/multi_file/multi_file_function.hpp +43 -14
- package/src/duckdb/src/include/duckdb/common/multi_file/multi_file_list.hpp +4 -3
- package/src/duckdb/src/include/duckdb/common/multi_file/multi_file_reader.hpp +10 -3
- package/src/duckdb/src/include/duckdb/common/multi_file/multi_file_states.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/numeric_utils.hpp +57 -0
- package/src/duckdb/src/include/duckdb/common/opener_file_system.hpp +7 -3
- package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +84 -0
- package/src/duckdb/src/include/duckdb/common/operator/interpolate.hpp +39 -0
- package/src/duckdb/src/include/duckdb/common/operator/string_cast.hpp +6 -0
- package/src/duckdb/src/include/duckdb/common/optionally_owned_ptr.hpp +18 -2
- package/src/duckdb/src/include/duckdb/common/owning_string_map.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/pipe_file_system.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/progress_bar/display/terminal_progress_bar_display.hpp +44 -5
- package/src/duckdb/src/include/duckdb/common/progress_bar/progress_bar.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/progress_bar/unscented_kalman_filter.hpp +65 -0
- package/src/duckdb/src/include/duckdb/common/row_operations/row_matcher.hpp +8 -14
- package/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp +0 -12
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/serializer/deserializer.hpp +17 -2
- package/src/duckdb/src/include/duckdb/common/serializer/memory_stream.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/serializer/read_stream.hpp +9 -1
- package/src/duckdb/src/include/duckdb/common/serializer/varint.hpp +62 -0
- package/src/duckdb/src/include/duckdb/common/sorting/hashed_sort.hpp +76 -0
- package/src/duckdb/src/include/duckdb/common/sorting/sort.hpp +85 -0
- package/src/duckdb/src/include/duckdb/common/sorting/sort_key.hpp +442 -0
- package/src/duckdb/src/include/duckdb/common/sorting/sort_projection_column.hpp +21 -0
- package/src/duckdb/src/include/duckdb/common/sorting/sorted_run.hpp +55 -0
- package/src/duckdb/src/include/duckdb/common/sorting/sorted_run_merger.hpp +62 -0
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/tree_renderer/text_tree_renderer.hpp +5 -0
- package/src/duckdb/src/include/duckdb/common/tree_renderer/yaml_tree_renderer.hpp +40 -0
- package/src/duckdb/src/include/duckdb/common/type_util.hpp +34 -4
- package/src/duckdb/src/include/duckdb/common/type_visitor.hpp +36 -6
- package/src/duckdb/src/include/duckdb/common/types/bignum.hpp +159 -0
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_allocator.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_segment.hpp +4 -2
- package/src/duckdb/src/include/duckdb/common/types/conflict_manager.hpp +202 -56
- package/src/duckdb/src/include/duckdb/common/types/constraint_conflict_info.hpp +7 -5
- package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +3 -1
- package/src/duckdb/src/include/duckdb/common/types/date.hpp +9 -5
- package/src/duckdb/src/include/duckdb/common/types/datetime.hpp +11 -2
- package/src/duckdb/src/include/duckdb/common/types/double_na_equal.hpp +65 -0
- package/src/duckdb/src/include/duckdb/common/types/hash.hpp +22 -10
- package/src/duckdb/src/include/duckdb/common/types/hugeint.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/types/row/block_iterator.hpp +360 -0
- package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/row/row_data_collection.hpp +1 -2
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_allocator.hpp +7 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +26 -2
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_layout.hpp +43 -5
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_segment.hpp +4 -11
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_states.hpp +10 -1
- package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +8 -58
- package/src/duckdb/src/include/duckdb/common/types/string.hpp +338 -0
- package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +7 -1
- package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +7 -3
- package/src/duckdb/src/include/duckdb/common/types/uhugeint.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/types/uuid.hpp +5 -0
- package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +14 -5
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +15 -2
- package/src/duckdb/src/include/duckdb/common/types/variant.hpp +202 -0
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +118 -5
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/types.hpp +26 -6
- package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +50 -11
- package/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +6 -4
- package/src/duckdb/src/include/duckdb/common/winapi.hpp +0 -4
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +8 -6
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +0 -2
- package/src/duckdb/src/include/duckdb/execution/expression_executor.hpp +4 -0
- package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +21 -2
- package/src/duckdb/src/include/duckdb/execution/ht_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +15 -16
- package/src/duckdb/src/include/duckdb/execution/index/art/art_builder.hpp +55 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/art_key.hpp +0 -13
- package/src/duckdb/src/include/duckdb/execution/index/art/art_merger.hpp +1 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/art_operator.hpp +113 -1
- package/src/duckdb/src/include/duckdb/execution/index/art/art_scanner.hpp +5 -2
- package/src/duckdb/src/include/duckdb/execution/index/art/base_leaf.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/index/art/base_node.hpp +18 -15
- package/src/duckdb/src/include/duckdb/execution/index/art/iterator.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +30 -3
- package/src/duckdb/src/include/duckdb/execution/index/art/node256.hpp +30 -8
- package/src/duckdb/src/include/duckdb/execution/index/art/node256_leaf.hpp +8 -5
- package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +36 -9
- package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +9 -20
- package/src/duckdb/src/include/duckdb/execution/index/bound_index.hpp +8 -6
- package/src/duckdb/src/include/duckdb/execution/index/fixed_size_allocator.hpp +21 -4
- package/src/duckdb/src/include/duckdb/execution/index/fixed_size_buffer.hpp +95 -11
- package/src/duckdb/src/include/duckdb/execution/index/unbound_index.hpp +22 -11
- package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +6 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/distinct_aggregate_data.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +12 -8
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_partitioned_aggregate.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_streaming_window.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_error.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_handle.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_multi_file_info.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/encode/csv_encoder.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/filter/physical_filter.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_buffered_batch_collector.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_buffered_collector.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_create_secret.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_execute.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +5 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_result_collector.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +6 -3
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set_variable.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_sample.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_update_extensions.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_verify_vector.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_asof_join.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_comparison_join.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +4 -3
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +4 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +5 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_join.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_left_delim_join.hpp +4 -3
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +6 -5
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_range_join.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_right_delim_join.hpp +4 -3
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +13 -9
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_database.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +2 -2
- 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 +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_merge_into.hpp +87 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_pivot.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_projection.hpp +2 -7
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_tableinout_function.hpp +6 -1
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_unnest.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +4 -4
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_expression_scan.hpp +4 -3
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +4 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_art_index.hpp +4 -4
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_cte.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_union.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +23 -22
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +7 -2
- package/src/duckdb/src/include/duckdb/execution/radix_partitioned_hashtable.hpp +4 -1
- package/src/duckdb/src/include/duckdb/execution/reservoir_sample.hpp +0 -1
- package/src/duckdb/src/include/duckdb/function/aggregate/distributive_functions.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +36 -11
- package/src/duckdb/src/include/duckdb/function/built_in_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/cast/bound_cast_data.hpp +28 -0
- package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +6 -1
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +5 -1
- package/src/duckdb/src/include/duckdb/function/cast/variant/array_to_variant.hpp +66 -0
- package/src/duckdb/src/include/duckdb/function/cast/variant/json_to_variant.hpp +283 -0
- package/src/duckdb/src/include/duckdb/function/cast/variant/list_to_variant.hpp +70 -0
- package/src/duckdb/src/include/duckdb/function/cast/variant/primitive_to_variant.hpp +399 -0
- package/src/duckdb/src/include/duckdb/function/cast/variant/struct_to_variant.hpp +111 -0
- package/src/duckdb/src/include/duckdb/function/cast/variant/to_variant.hpp +66 -0
- package/src/duckdb/src/include/duckdb/function/cast/variant/to_variant_fwd.hpp +179 -0
- package/src/duckdb/src/include/duckdb/function/cast/variant/union_to_variant.hpp +59 -0
- package/src/duckdb/src/include/duckdb/function/cast/variant/variant_to_variant.hpp +275 -0
- package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +2 -3
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +28 -10
- package/src/duckdb/src/include/duckdb/function/create_sort_key.hpp +13 -0
- package/src/duckdb/src/include/duckdb/function/function_binder.hpp +3 -0
- package/src/duckdb/src/include/duckdb/function/function_list.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +25 -3
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +18 -6
- package/src/duckdb/src/include/duckdb/function/pragma/pragma_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/register_function_list_helper.hpp +34 -2
- package/src/duckdb/src/include/duckdb/function/scalar/compressed_materialization_functions.hpp +10 -0
- package/src/duckdb/src/include/duckdb/function/scalar/date_functions.hpp +6 -6
- package/src/duckdb/src/include/duckdb/function/scalar/list/contains_or_position.hpp +5 -5
- package/src/duckdb/src/include/duckdb/function/scalar/list_functions.hpp +19 -19
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +103 -103
- package/src/duckdb/src/include/duckdb/function/scalar/struct_functions.hpp +32 -0
- package/src/duckdb/src/include/duckdb/function/scalar/system_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar/variant_functions.hpp +38 -0
- package/src/duckdb/src/include/duckdb/function/scalar/variant_utils.hpp +85 -0
- package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_duck_schema.hpp +8 -2
- package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_type_info.hpp +2 -0
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +26 -11
- package/src/duckdb/src/include/duckdb/function/table/direct_file_reader.hpp +39 -0
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +2 -12
- package/src/duckdb/src/include/duckdb/function/table/read_file.hpp +83 -0
- package/src/duckdb/src/include/duckdb/function/table/system_functions.hpp +13 -1
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +8 -5
- package/src/duckdb/src/include/duckdb/function/window/window_aggregate_function.hpp +10 -10
- package/src/duckdb/src/include/duckdb/function/window/window_aggregator.hpp +25 -48
- package/src/duckdb/src/include/duckdb/function/window/window_collection.hpp +142 -0
- package/src/duckdb/src/include/duckdb/function/window/window_constant_aggregator.hpp +11 -12
- package/src/duckdb/src/include/duckdb/function/window/window_custom_aggregator.hpp +8 -8
- package/src/duckdb/src/include/duckdb/function/window/window_distinct_aggregator.hpp +10 -10
- package/src/duckdb/src/include/duckdb/function/window/window_executor.hpp +26 -40
- package/src/duckdb/src/include/duckdb/function/window/window_index_tree.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/window/window_merge_sort_tree.hpp +32 -30
- package/src/duckdb/src/include/duckdb/function/window/window_naive_aggregator.hpp +5 -3
- package/src/duckdb/src/include/duckdb/function/window/window_rank_function.hpp +17 -16
- package/src/duckdb/src/include/duckdb/function/window/window_rownumber_function.hpp +10 -9
- package/src/duckdb/src/include/duckdb/function/window/window_segment_tree.hpp +8 -8
- package/src/duckdb/src/include/duckdb/function/window/window_token_tree.hpp +6 -6
- package/src/duckdb/src/include/duckdb/function/window/window_value_function.hpp +44 -21
- package/src/duckdb/src/include/duckdb/logging/log_manager.hpp +12 -4
- package/src/duckdb/src/include/duckdb/logging/log_storage.hpp +271 -50
- package/src/duckdb/src/include/duckdb/logging/log_type.hpp +26 -3
- package/src/duckdb/src/include/duckdb/main/appender.hpp +37 -16
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +22 -4
- package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +23 -6
- package/src/duckdb/src/include/duckdb/main/capi/extension_api.hpp +92 -8
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +11 -70
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +30 -5
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +21 -23
- package/src/duckdb/src/include/duckdb/main/client_properties.hpp +3 -19
- package/src/duckdb/src/include/duckdb/main/config.hpp +48 -111
- package/src/duckdb/src/include/duckdb/main/connection.hpp +0 -1
- package/src/duckdb/src/include/duckdb/main/connection_manager.hpp +0 -1
- package/src/duckdb/src/include/duckdb/main/database.hpp +23 -27
- package/src/duckdb/src/include/duckdb/main/database_file_opener.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/database_file_path_manager.hpp +50 -0
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +21 -20
- package/src/duckdb/src/include/duckdb/main/database_path_and_type.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/db_instance_cache.hpp +8 -4
- package/src/duckdb/src/include/duckdb/main/error_manager.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/extension/extension_loader.hpp +120 -0
- package/src/duckdb/src/include/duckdb/main/extension.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +35 -0
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/extension_manager.hpp +59 -0
- package/src/duckdb/src/include/duckdb/main/extension_util.hpp +6 -77
- package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +41 -23
- package/src/duckdb/src/include/duckdb/main/relation/create_table_relation.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/relation/create_view_relation.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/relation/delete_relation.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/relation/explain_relation.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/relation/insert_relation.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/relation/query_relation.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/relation/update_relation.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/relation/write_csv_relation.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/relation/write_parquet_relation.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/relation.hpp +3 -2
- package/src/duckdb/src/include/duckdb/main/secret/secret.hpp +4 -1
- package/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp +18 -18
- package/src/duckdb/src/include/duckdb/main/setting_info.hpp +109 -0
- package/src/duckdb/src/include/duckdb/main/settings.hpp +168 -184
- package/src/duckdb/src/include/duckdb/main/valid_checker.hpp +5 -2
- package/src/duckdb/src/include/duckdb/optimizer/build_probe_side_optimizer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/column_lifetime_analyzer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/compressed_materialization.hpp +4 -0
- package/src/duckdb/src/include/duckdb/optimizer/cte_inlining.hpp +50 -0
- package/src/duckdb/src/include/duckdb/optimizer/filter_pushdown.hpp +7 -3
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_order_optimizer.hpp +3 -0
- package/src/duckdb/src/include/duckdb/optimizer/late_materialization.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/date_trunc_simplification.hpp +73 -0
- package/src/duckdb/src/include/duckdb/optimizer/rule/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +9 -3
- package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/common_table_expression_info.hpp +3 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +18 -8
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +3 -4
- package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +6 -4
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_expression_iterator.hpp +14 -0
- package/src/duckdb/src/include/duckdb/parser/parser.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/qualified_name.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/query_node/cte_node.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/statement/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/statement/merge_into_statement.hpp +72 -0
- package/src/duckdb/src/include/duckdb/parser/statement/select_statement.hpp +1 -4
- package/src/duckdb/src/include/duckdb/parser/statement/update_statement.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/bound_ref_wrapper.hpp +38 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/column_data_ref.hpp +4 -9
- package/src/duckdb/src/include/duckdb/parser/tableref/joinref.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/showref.hpp +5 -1
- package/src/duckdb/src/include/duckdb/parser/tableref/table_function_ref.hpp +4 -0
- package/src/duckdb/src/include/duckdb/parser/tokens.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +9 -2
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +5 -0
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +107 -11
- package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/bound_tokens.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_check_constraint.hpp +8 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_foreign_key_constraint.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_not_null_constraint.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_unique_constraint.hpp +5 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/lateral_binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/projection_binder.hpp +37 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +3 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +3 -8
- package/src/duckdb/src/include/duckdb/planner/expression_iterator.hpp +18 -0
- package/src/duckdb/src/include/duckdb/planner/extension_callback.hpp +8 -0
- package/src/duckdb/src/include/duckdb/planner/logical_operator_deep_copy.hpp +67 -0
- 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_aggregate.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cte.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_dependent_join.hpp +3 -3
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +28 -22
- package/src/duckdb/src/include/duckdb/planner/operator/logical_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_materialized_cte.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_merge_into.hpp +75 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/query_node/bound_cte_node.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/subquery/flatten_dependent_join.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/subquery/has_correlated_expressions.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/subquery/rewrite_cte_scan.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_joinref.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +26 -0
- package/src/duckdb/src/include/duckdb/storage/block.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/block_manager.hpp +24 -8
- package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +3 -1
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +55 -36
- package/src/duckdb/src/include/duckdb/storage/caching_file_system.hpp +10 -4
- package/src/duckdb/src/include/duckdb/storage/checkpoint/row_group_writer.hpp +19 -6
- package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_reader.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +15 -8
- package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +6 -8
- package/src/duckdb/src/include/duckdb/storage/compression/alp/algorithm/alp.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_analyze.hpp +6 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_analyze.hpp +9 -3
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/packed_data.hpp +3 -1
- package/src/duckdb/src/include/duckdb/storage/compression/dict_fsst/compression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/dict_fsst/decompression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp +7 -2
- package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +5 -0
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +14 -9
- package/src/duckdb/src/include/duckdb/storage/external_file_cache.hpp +6 -5
- package/src/duckdb/src/include/duckdb/storage/in_memory_block_manager.hpp +7 -2
- package/src/duckdb/src/include/duckdb/storage/magic_bytes.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/metadata/metadata_manager.hpp +24 -7
- package/src/duckdb/src/include/duckdb/storage/metadata/metadata_reader.hpp +7 -0
- package/src/duckdb/src/include/duckdb/storage/metadata/metadata_writer.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/optimistic_data_writer.hpp +10 -3
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +14 -3
- package/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp +65 -20
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +6 -6
- package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/statistics/string_stats.hpp +2 -0
- package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/storage_info.hpp +80 -20
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +43 -17
- package/src/duckdb/src/include/duckdb/storage/storage_options.hpp +21 -0
- package/src/duckdb/src/include/duckdb/storage/table/array_column_data.hpp +5 -4
- package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +13 -7
- package/src/duckdb/src/include/duckdb/storage/table/column_data_checkpointer.hpp +5 -2
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +10 -7
- package/src/duckdb/src/include/duckdb/storage/table/data_table_info.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/table/in_memory_checkpoint.hpp +93 -0
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +5 -4
- package/src/duckdb/src/include/duckdb/storage/table/persistent_table_data.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +20 -5
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +16 -4
- package/src/duckdb/src/include/duckdb/storage/table/row_group_segment_tree.hpp +5 -0
- package/src/duckdb/src/include/duckdb/storage/table/row_id_column_data.hpp +68 -0
- package/src/duckdb/src/include/duckdb/storage/table/segment_lock.hpp +4 -0
- package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +34 -14
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +5 -4
- package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +5 -4
- package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +55 -46
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +5 -2
- package/src/duckdb/src/include/duckdb/storage/temporary_file_manager.hpp +17 -6
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +2 -1
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +5 -1
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction_manager.hpp +1 -0
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +3 -1
- package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +22 -1
- package/src/duckdb/src/include/duckdb/transaction/undo_buffer_allocator.hpp +2 -0
- package/src/duckdb/src/include/duckdb/transaction/update_info.hpp +4 -1
- package/src/duckdb/src/include/duckdb/transaction/wal_write_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/verification/explain_statement_verifier.hpp +23 -0
- package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +14 -7
- package/src/duckdb/src/include/duckdb.h +537 -121
- package/src/duckdb/src/include/duckdb_extension.h +122 -14
- package/src/duckdb/src/logging/log_manager.cpp +59 -15
- package/src/duckdb/src/logging/log_storage.cpp +672 -128
- package/src/duckdb/src/logging/log_types.cpp +63 -0
- package/src/duckdb/src/main/appender.cpp +129 -88
- package/src/duckdb/src/main/attached_database.cpp +63 -55
- package/src/duckdb/src/main/capi/aggregate_function-c.cpp +18 -9
- package/src/duckdb/src/main/capi/appender-c.cpp +82 -28
- package/src/duckdb/src/main/capi/arrow-c.cpp +181 -17
- package/src/duckdb/src/main/capi/config-c.cpp +18 -3
- package/src/duckdb/src/main/capi/data_chunk-c.cpp +22 -10
- package/src/duckdb/src/main/capi/duckdb-c.cpp +64 -21
- package/src/duckdb/src/main/capi/duckdb_value-c.cpp +13 -7
- package/src/duckdb/src/main/capi/error_data-c.cpp +46 -0
- package/src/duckdb/src/main/capi/expression-c.cpp +57 -0
- package/src/duckdb/src/main/capi/helper-c.cpp +227 -39
- package/src/duckdb/src/main/capi/logical_types-c.cpp +48 -28
- package/src/duckdb/src/main/capi/prepared-c.cpp +68 -10
- package/src/duckdb/src/main/capi/profiling_info-c.cpp +6 -4
- package/src/duckdb/src/main/capi/result-c.cpp +16 -95
- package/src/duckdb/src/main/capi/scalar_function-c.cpp +43 -1
- package/src/duckdb/src/main/capi/table_function-c.cpp +9 -0
- package/src/duckdb/src/main/client_config.cpp +21 -0
- package/src/duckdb/src/main/client_context.cpp +179 -95
- package/src/duckdb/src/main/client_context_file_opener.cpp +1 -0
- package/src/duckdb/src/main/client_data.cpp +139 -1
- package/src/duckdb/src/main/client_verify.cpp +14 -6
- package/src/duckdb/src/main/config.cpp +214 -121
- package/src/duckdb/src/main/connection.cpp +2 -5
- package/src/duckdb/src/main/database.cpp +31 -58
- package/src/duckdb/src/main/database_file_path_manager.cpp +59 -0
- package/src/duckdb/src/main/database_manager.cpp +148 -107
- package/src/duckdb/src/main/database_path_and_type.cpp +4 -3
- package/src/duckdb/src/main/db_instance_cache.cpp +64 -35
- package/src/duckdb/src/main/error_manager.cpp +2 -1
- package/src/duckdb/src/main/extension/extension_helper.cpp +3 -22
- package/src/duckdb/src/main/extension/extension_install.cpp +6 -6
- package/src/duckdb/src/main/extension/extension_load.cpp +24 -9
- package/src/duckdb/src/main/extension/extension_loader.cpp +234 -0
- package/src/duckdb/src/main/extension_manager.cpp +115 -0
- package/src/duckdb/src/main/http/http_util.cpp +21 -6
- package/src/duckdb/src/main/profiling_info.cpp +8 -2
- package/src/duckdb/src/main/query_profiler.cpp +65 -30
- package/src/duckdb/src/main/query_result.cpp +1 -1
- package/src/duckdb/src/main/relation/create_table_relation.cpp +8 -0
- package/src/duckdb/src/main/relation/create_view_relation.cpp +8 -0
- package/src/duckdb/src/main/relation/delete_relation.cpp +8 -0
- package/src/duckdb/src/main/relation/explain_relation.cpp +8 -0
- package/src/duckdb/src/main/relation/insert_relation.cpp +8 -0
- package/src/duckdb/src/main/relation/query_relation.cpp +27 -0
- package/src/duckdb/src/main/relation/update_relation.cpp +8 -0
- package/src/duckdb/src/main/relation/write_csv_relation.cpp +8 -0
- package/src/duckdb/src/main/relation/write_parquet_relation.cpp +8 -0
- package/src/duckdb/src/main/relation.cpp +2 -2
- package/src/duckdb/src/main/secret/secret_manager.cpp +8 -7
- package/src/duckdb/src/main/settings/autogenerated_settings.cpp +50 -645
- package/src/duckdb/src/main/settings/custom_settings.cpp +111 -152
- package/src/duckdb/src/main/valid_checker.cpp +10 -4
- package/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp +7 -5
- package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +7 -7
- package/src/duckdb/src/optimizer/compressed_materialization/compress_comparison_join.cpp +11 -7
- package/src/duckdb/src/optimizer/compressed_materialization.cpp +56 -39
- package/src/duckdb/src/optimizer/cte_inlining.cpp +225 -0
- package/src/duckdb/src/optimizer/empty_result_pullup.cpp +8 -1
- package/src/duckdb/src/optimizer/filter_combiner.cpp +12 -7
- package/src/duckdb/src/optimizer/filter_pushdown.cpp +12 -3
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +18 -2
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +1 -0
- package/src/duckdb/src/optimizer/join_order/plan_enumerator.cpp +4 -3
- package/src/duckdb/src/optimizer/join_order/query_graph_manager.cpp +11 -15
- package/src/duckdb/src/optimizer/join_order/relation_manager.cpp +40 -23
- package/src/duckdb/src/optimizer/late_materialization.cpp +16 -23
- package/src/duckdb/src/optimizer/optimizer.cpp +15 -0
- package/src/duckdb/src/optimizer/pushdown/pushdown_aggregate.cpp +15 -20
- package/src/duckdb/src/optimizer/pushdown/pushdown_get.cpp +4 -1
- package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +11 -13
- package/src/duckdb/src/optimizer/pushdown/pushdown_outer_join.cpp +201 -0
- package/src/duckdb/src/optimizer/pushdown/pushdown_projection.cpp +20 -26
- package/src/duckdb/src/optimizer/pushdown/pushdown_set_operation.cpp +11 -14
- package/src/duckdb/src/optimizer/remove_unused_columns.cpp +2 -1
- package/src/duckdb/src/optimizer/rule/comparison_simplification.cpp +3 -7
- package/src/duckdb/src/optimizer/rule/date_trunc_simplification.cpp +446 -0
- package/src/duckdb/src/optimizer/rule/join_dependent_filter.cpp +3 -9
- package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +1 -6
- package/src/duckdb/src/optimizer/rule/timestamp_comparison.cpp +3 -6
- package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +33 -1
- package/src/duckdb/src/parallel/event.cpp +1 -3
- package/src/duckdb/src/parallel/executor.cpp +0 -7
- package/src/duckdb/src/parallel/pipeline.cpp +2 -2
- package/src/duckdb/src/parallel/pipeline_executor.cpp +2 -2
- package/src/duckdb/src/parallel/task_scheduler.cpp +146 -34
- package/src/duckdb/src/parallel/thread_context.cpp +2 -9
- package/src/duckdb/src/parser/column_definition.cpp +3 -6
- package/src/duckdb/src/parser/expression/window_expression.cpp +3 -0
- package/src/duckdb/src/parser/parsed_data/attach_info.cpp +8 -35
- package/src/duckdb/src/parser/parsed_data/copy_info.cpp +27 -7
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +8 -13
- package/src/duckdb/src/parser/parsed_data/create_info.cpp +16 -0
- package/src/duckdb/src/parser/parsed_data/create_macro_info.cpp +7 -17
- package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +1 -14
- package/src/duckdb/src/parser/parsed_data/create_type_info.cpp +1 -12
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +1 -13
- package/src/duckdb/src/parser/parsed_expression_iterator.cpp +22 -0
- package/src/duckdb/src/parser/parser.cpp +5 -0
- package/src/duckdb/src/parser/qualified_name.cpp +26 -0
- package/src/duckdb/src/parser/query_node/cte_node.cpp +1 -0
- package/src/duckdb/src/parser/query_node/select_node.cpp +1 -0
- package/src/duckdb/src/parser/query_node.cpp +1 -0
- package/src/duckdb/src/parser/statement/export_statement.cpp +1 -3
- package/src/duckdb/src/parser/statement/merge_into_statement.cpp +167 -0
- package/src/duckdb/src/parser/statement/relation_statement.cpp +1 -4
- package/src/duckdb/src/parser/statement/update_statement.cpp +19 -16
- package/src/duckdb/src/parser/tableref/bound_ref_wrapper.cpp +29 -0
- package/src/duckdb/src/parser/tableref/column_data_ref.cpp +26 -1
- package/src/duckdb/src/parser/tableref/joinref.cpp +3 -2
- package/src/duckdb/src/parser/tableref/showref.cpp +14 -0
- package/src/duckdb/src/parser/tableref/table_function.cpp +6 -1
- package/src/duckdb/src/parser/transform/expression/transform_expression.cpp +0 -1
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +6 -1
- package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +8 -11
- package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +3 -0
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +7 -5
- package/src/duckdb/src/parser/transform/statement/transform_attach.cpp +4 -4
- package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +16 -80
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +29 -22
- package/src/duckdb/src/parser/transform/statement/transform_create_type.cpp +0 -1
- package/src/duckdb/src/parser/transform/statement/transform_explain.cpp +1 -2
- package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +22 -14
- package/src/duckdb/src/parser/transform/statement/transform_merge_into.cpp +111 -0
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +2 -0
- package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_show.cpp +22 -4
- package/src/duckdb/src/parser/transform/tableref/transform_from.cpp +3 -1
- package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +12 -6
- package/src/duckdb/src/parser/transform/tableref/transform_table_function.cpp +3 -3
- package/src/duckdb/src/parser/transformer.cpp +8 -7
- package/src/duckdb/src/planner/bind_context.cpp +19 -2
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +13 -6
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +3 -0
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +18 -4
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +8 -25
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +31 -4
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +2 -0
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +48 -11
- package/src/duckdb/src/planner/binder/query_node/bind_cte_node.cpp +9 -1
- package/src/duckdb/src/planner/binder/query_node/bind_recursive_cte_node.cpp +4 -0
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +6 -6
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +11 -26
- package/src/duckdb/src/planner/binder/query_node/plan_cte_node.cpp +4 -3
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +18 -10
- package/src/duckdb/src/planner/binder/statement/bind_attach.cpp +15 -0
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +239 -58
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +153 -55
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +30 -25
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +2 -3
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +28 -3
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +36 -0
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +282 -322
- package/src/duckdb/src/planner/binder/statement/bind_merge_into.cpp +343 -0
- package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +20 -3
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +23 -14
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +37 -27
- package/src/duckdb/src/planner/binder/tableref/bind_bound_table_ref.cpp +13 -0
- package/src/duckdb/src/planner/binder/tableref/bind_column_data_ref.cpp +4 -1
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +127 -38
- package/src/duckdb/src/planner/binder/tableref/bind_showref.cpp +30 -0
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +81 -3
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +7 -12
- package/src/duckdb/src/planner/binder/tableref/plan_table_function.cpp +15 -1
- package/src/duckdb/src/planner/binder.cpp +44 -177
- package/src/duckdb/src/planner/bound_result_modifier.cpp +8 -0
- package/src/duckdb/src/planner/collation_binding.cpp +2 -1
- package/src/duckdb/src/planner/expression.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +9 -13
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +4 -2
- package/src/duckdb/src/planner/expression_binder/projection_binder.cpp +46 -0
- package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +12 -6
- package/src/duckdb/src/planner/expression_binder.cpp +3 -1
- package/src/duckdb/src/planner/expression_iterator.cpp +31 -0
- package/src/duckdb/src/planner/logical_operator_deep_copy.cpp +264 -0
- package/src/duckdb/src/planner/logical_operator_visitor.cpp +18 -4
- package/src/duckdb/src/planner/operator/logical_aggregate.cpp +2 -1
- package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +4 -2
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +3 -0
- package/src/duckdb/src/planner/operator/logical_dependent_join.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_get.cpp +7 -2
- package/src/duckdb/src/planner/operator/logical_insert.cpp +5 -2
- package/src/duckdb/src/planner/operator/logical_join.cpp +6 -7
- package/src/duckdb/src/planner/operator/logical_materialized_cte.cpp +1 -0
- package/src/duckdb/src/planner/operator/logical_merge_into.cpp +43 -0
- package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +8 -0
- package/src/duckdb/src/planner/planner.cpp +4 -2
- package/src/duckdb/src/planner/pragma_handler.cpp +1 -1
- package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +85 -18
- package/src/duckdb/src/planner/subquery/has_correlated_expressions.cpp +1 -1
- package/src/duckdb/src/planner/subquery/rewrite_cte_scan.cpp +2 -2
- package/src/duckdb/src/planner/table_binding.cpp +6 -12
- package/src/duckdb/src/storage/block.cpp +2 -1
- package/src/duckdb/src/storage/buffer/block_handle.cpp +7 -4
- package/src/duckdb/src/storage/buffer/block_manager.cpp +14 -6
- package/src/duckdb/src/storage/buffer/buffer_pool.cpp +2 -2
- package/src/duckdb/src/storage/buffer_manager.cpp +45 -13
- package/src/duckdb/src/storage/caching_file_system.cpp +20 -12
- package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +26 -3
- package/src/duckdb/src/storage/checkpoint/table_data_reader.cpp +3 -1
- package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +56 -35
- package/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +1 -1
- package/src/duckdb/src/storage/checkpoint_manager.cpp +12 -11
- package/src/duckdb/src/storage/compression/bitpacking.cpp +5 -3
- package/src/duckdb/src/storage/compression/dict_fsst/compression.cpp +48 -25
- package/src/duckdb/src/storage/compression/dict_fsst/decompression.cpp +10 -13
- package/src/duckdb/src/storage/compression/dict_fsst.cpp +2 -2
- package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +10 -5
- package/src/duckdb/src/storage/compression/fsst.cpp +3 -2
- package/src/duckdb/src/storage/compression/rle.cpp +1 -1
- package/src/duckdb/src/storage/compression/zstd.cpp +5 -6
- package/src/duckdb/src/storage/data_table.cpp +169 -146
- package/src/duckdb/src/storage/external_file_cache.cpp +6 -6
- package/src/duckdb/src/storage/local_storage.cpp +133 -69
- package/src/duckdb/src/storage/magic_bytes.cpp +3 -2
- package/src/duckdb/src/storage/metadata/metadata_manager.cpp +147 -34
- package/src/duckdb/src/storage/metadata/metadata_reader.cpp +26 -3
- package/src/duckdb/src/storage/metadata/metadata_writer.cpp +7 -0
- package/src/duckdb/src/storage/open_file_storage_extension.cpp +3 -3
- package/src/duckdb/src/storage/optimistic_data_writer.cpp +5 -3
- package/src/duckdb/src/storage/partial_block_manager.cpp +26 -5
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +72 -22
- package/src/duckdb/src/storage/serialization/serialize_macro_function.cpp +9 -3
- package/src/duckdb/src/storage/serialization/serialize_query_node.cpp +2 -0
- package/src/duckdb/src/storage/serialization/serialize_tableref.cpp +12 -2
- package/src/duckdb/src/storage/serialization/serialize_types.cpp +14 -0
- package/src/duckdb/src/storage/single_file_block_manager.cpp +381 -86
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +86 -30
- package/src/duckdb/src/storage/statistics/base_statistics.cpp +3 -3
- package/src/duckdb/src/storage/statistics/string_stats.cpp +10 -2
- package/src/duckdb/src/storage/statistics/struct_stats.cpp +1 -1
- package/src/duckdb/src/storage/storage_info.cpp +13 -7
- package/src/duckdb/src/storage/storage_manager.cpp +110 -35
- package/src/duckdb/src/storage/table/array_column_data.cpp +10 -5
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +22 -15
- package/src/duckdb/src/storage/table/column_data.cpp +76 -23
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +31 -17
- package/src/duckdb/src/storage/table/column_segment.cpp +23 -21
- package/src/duckdb/src/storage/table/in_memory_checkpoint.cpp +136 -0
- package/src/duckdb/src/storage/table/list_column_data.cpp +11 -5
- package/src/duckdb/src/storage/table/row_group.cpp +231 -159
- package/src/duckdb/src/storage/table/row_group_collection.cpp +157 -54
- package/src/duckdb/src/storage/table/row_id_column_data.cpp +174 -0
- package/src/duckdb/src/storage/table/row_version_manager.cpp +1 -1
- package/src/duckdb/src/storage/table/standard_column_data.cpp +21 -8
- package/src/duckdb/src/storage/table/struct_column_data.cpp +25 -9
- package/src/duckdb/src/storage/table/update_segment.cpp +123 -15
- package/src/duckdb/src/storage/table_index_list.cpp +137 -73
- package/src/duckdb/src/storage/temporary_file_manager.cpp +103 -28
- package/src/duckdb/src/storage/wal_replay.cpp +158 -36
- package/src/duckdb/src/storage/write_ahead_log.cpp +102 -17
- package/src/duckdb/src/transaction/commit_state.cpp +20 -0
- package/src/duckdb/src/transaction/duck_transaction.cpp +14 -12
- package/src/duckdb/src/transaction/duck_transaction_manager.cpp +66 -35
- package/src/duckdb/src/transaction/meta_transaction.cpp +85 -23
- package/src/duckdb/src/transaction/rollback_state.cpp +7 -0
- package/src/duckdb/src/transaction/transaction_context.cpp +3 -4
- package/src/duckdb/src/transaction/undo_buffer.cpp +5 -4
- package/src/duckdb/src/transaction/undo_buffer_allocator.cpp +1 -0
- package/src/duckdb/src/transaction/wal_write_state.cpp +7 -5
- package/src/duckdb/src/verification/explain_statement_verifier.cpp +16 -0
- package/src/duckdb/src/verification/prepared_statement_verifier.cpp +1 -1
- package/src/duckdb/src/verification/statement_verifier.cpp +10 -5
- package/src/duckdb/third_party/brotli/common/shared_dictionary.cpp +4 -4
- package/src/duckdb/third_party/fmt/include/fmt/core.h +6 -12
- package/src/duckdb/third_party/fmt/include/fmt/format-inl.h +5 -1
- package/src/duckdb/third_party/fmt/include/fmt/format.h +34 -24
- package/src/duckdb/third_party/fmt/include/fmt/printf.h +49 -21
- package/src/duckdb/third_party/httplib/httplib.hpp +19 -6
- package/src/duckdb/third_party/jaro_winkler/details/jaro_impl.hpp +4 -4
- package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +3 -0
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +56 -1
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +744 -733
- package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +6 -1
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +19098 -18654
- package/src/duckdb/third_party/mbedtls/include/des_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/aes_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/aria_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/block_cipher.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/build_info.h +4 -4
- package/src/duckdb/third_party/mbedtls/include/mbedtls/camellia_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/ccm_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/chacha20.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/chachapoly.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/cmac.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/config_psa.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/ecdsa.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/gcm_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/mbedtls_config.h +5 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/md5.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/nist_kw.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/pkcs12.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/pkcs5.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/psa_util.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/ripemd160.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/sha3.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/threading.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/timing.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls_wrapper.hpp +16 -7
- package/src/duckdb/third_party/mbedtls/include/platform_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/psa/build_info.h +20 -0
- package/src/duckdb/third_party/mbedtls/include/psa/crypto.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/psa/crypto_config.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/psa/crypto_se_driver.h +1 -0
- package/src/duckdb/third_party/mbedtls/include/rsa_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/sha1_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/sha256_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/sha512_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/ssl_misc.h +1 -1
- package/src/duckdb/third_party/mbedtls/library/aes.cpp +1 -1
- package/src/duckdb/third_party/mbedtls/library/aesce.h +136 -1
- package/src/duckdb/third_party/mbedtls/library/alignment.h +9 -9
- package/src/duckdb/third_party/mbedtls/library/asn1parse.cpp +1 -1
- package/src/duckdb/third_party/mbedtls/library/asn1write.cpp +6 -3
- package/src/duckdb/third_party/mbedtls/library/base64.cpp +48 -24
- package/src/duckdb/third_party/mbedtls/library/base64_internal.h +45 -1
- package/src/duckdb/third_party/mbedtls/library/bignum.cpp +3 -3
- package/src/duckdb/third_party/mbedtls/library/bignum_core.cpp +16 -14
- package/src/duckdb/third_party/mbedtls/library/bignum_core.h +10 -18
- package/src/duckdb/third_party/mbedtls/library/block_cipher_internal.h +99 -1
- package/src/duckdb/third_party/mbedtls/library/check_crypto_config.h +141 -1
- package/src/duckdb/third_party/mbedtls/library/cipher.cpp +18 -12
- package/src/duckdb/third_party/mbedtls/library/cipher_invasive.h +1 -0
- package/src/duckdb/third_party/mbedtls/library/cipher_wrap.cpp +110 -10
- package/src/duckdb/third_party/mbedtls/library/cipher_wrap.h +1 -1
- package/src/duckdb/third_party/mbedtls/library/common.h +20 -4
- package/src/duckdb/third_party/mbedtls/library/constant_time.cpp +1 -1
- package/src/duckdb/third_party/mbedtls/library/constant_time_impl.h +28 -43
- package/src/duckdb/third_party/mbedtls/library/constant_time_internal.h +24 -24
- package/src/duckdb/third_party/mbedtls/library/ctr.h +35 -1
- package/src/duckdb/third_party/mbedtls/library/gcm.cpp +2 -2
- package/src/duckdb/third_party/mbedtls/library/md.cpp +11 -11
- package/src/duckdb/third_party/mbedtls/library/md_psa.h +1 -1
- package/src/duckdb/third_party/mbedtls/library/oid.cpp +2 -2
- package/src/duckdb/third_party/mbedtls/library/pem.cpp +5 -2
- package/src/duckdb/third_party/mbedtls/library/pk.cpp +1 -5
- package/src/duckdb/third_party/mbedtls/library/pk_internal.h +4 -4
- package/src/duckdb/third_party/mbedtls/library/pk_wrap.cpp +16 -18
- package/src/duckdb/third_party/mbedtls/library/pkwrite.h +121 -1
- package/src/duckdb/third_party/mbedtls/library/psa_crypto_core.h +995 -1
- package/src/duckdb/third_party/mbedtls/library/psa_util_internal.h +100 -1
- package/src/duckdb/third_party/mbedtls/library/rsa.cpp +4 -4
- package/src/duckdb/third_party/mbedtls/mbedtls_wrapper.cpp +114 -42
- package/src/duckdb/third_party/parquet/parquet_types.cpp +2340 -769
- package/src/duckdb/third_party/parquet/parquet_types.h +400 -4
- package/src/duckdb/third_party/pdqsort/pdqsort.h +550 -0
- package/src/duckdb/third_party/ska_sort/ska_sort.hpp +1494 -0
- package/src/duckdb/third_party/snappy/snappy-stubs-internal.h +18 -18
- package/src/duckdb/third_party/snappy/snappy.cc +6 -6
- package/src/duckdb/third_party/thrift/thrift/protocol/TCompactProtocol.h +4 -4
- package/src/duckdb/third_party/thrift/thrift/protocol/TCompactProtocol.tcc +36 -36
- package/src/duckdb/third_party/utf8proc/include/utf8proc_wrapper.hpp +1 -1
- package/src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp +1 -1
- package/src/duckdb/third_party/vergesort/detail/insertion_sort.h +56 -0
- package/src/duckdb/third_party/vergesort/detail/is_sorted_until.h +51 -0
- package/src/duckdb/third_party/vergesort/detail/iter_sort3.h +48 -0
- package/src/duckdb/third_party/vergesort/detail/log2.h +41 -0
- package/src/duckdb/third_party/vergesort/detail/prevnext.h +68 -0
- package/src/duckdb/third_party/vergesort/detail/quicksort.h +138 -0
- package/src/duckdb/third_party/vergesort/vergesort.h +352 -0
- package/src/duckdb/ub_extension_core_functions_scalar_generic.cpp +2 -0
- package/src/duckdb/ub_extension_core_functions_scalar_struct.cpp +2 -0
- package/src/duckdb/ub_extension_parquet_reader.cpp +2 -0
- package/src/duckdb/ub_extension_parquet_reader_variant.cpp +6 -0
- package/src/duckdb/ub_src_common.cpp +8 -0
- package/src/duckdb/ub_src_common_arrow_appender.cpp +2 -0
- package/src/duckdb/ub_src_common_progress_bar.cpp +2 -0
- package/src/duckdb/ub_src_common_sorting.cpp +8 -0
- package/src/duckdb/ub_src_common_tree_renderer.cpp +2 -0
- package/src/duckdb/ub_src_common_types.cpp +1 -1
- package/src/duckdb/ub_src_common_types_row.cpp +2 -0
- package/src/duckdb/ub_src_execution_index_art.cpp +11 -9
- package/src/duckdb/ub_src_execution_operator_persistent.cpp +2 -0
- package/src/duckdb/ub_src_execution_physical_plan.cpp +2 -0
- package/src/duckdb/ub_src_function.cpp +2 -0
- package/src/duckdb/ub_src_function_cast.cpp +1 -1
- package/src/duckdb/ub_src_function_cast_variant.cpp +6 -0
- package/src/duckdb/ub_src_function_scalar_struct.cpp +2 -0
- package/src/duckdb/ub_src_function_scalar_variant.cpp +6 -0
- package/src/duckdb/ub_src_function_table.cpp +2 -0
- package/src/duckdb/ub_src_function_table_system.cpp +6 -0
- package/src/duckdb/ub_src_main.cpp +4 -0
- package/src/duckdb/ub_src_main_capi.cpp +4 -0
- package/src/duckdb/ub_src_optimizer.cpp +2 -0
- package/src/duckdb/ub_src_optimizer_pushdown.cpp +2 -0
- package/src/duckdb/ub_src_optimizer_rule.cpp +2 -0
- package/src/duckdb/ub_src_parser_statement.cpp +2 -0
- package/src/duckdb/ub_src_parser_tableref.cpp +2 -0
- package/src/duckdb/ub_src_parser_transform_statement.cpp +2 -0
- package/src/duckdb/ub_src_planner.cpp +2 -0
- package/src/duckdb/ub_src_planner_binder_statement.cpp +2 -0
- package/src/duckdb/ub_src_planner_binder_tableref.cpp +2 -0
- package/src/duckdb/ub_src_planner_expression_binder.cpp +2 -0
- package/src/duckdb/ub_src_planner_operator.cpp +2 -0
- package/src/duckdb/ub_src_storage_table.cpp +4 -0
- package/test/columns.test.ts +1 -1
- package/test/exec.test.ts +3 -3
- package/test/jsdoc.test.ts +2 -1
- package/test/syntax_error.test.ts +1 -1
- package/test/test_all_types.test.ts +1 -1
@@ -1,6 +1,8 @@
|
|
1
1
|
#include "duckdb/execution/operator/aggregate/physical_window.hpp"
|
2
2
|
|
3
|
-
#include "duckdb/common/
|
3
|
+
#include "duckdb/common/sorting/hashed_sort.hpp"
|
4
|
+
#include "duckdb/common/types/row/tuple_data_collection.hpp"
|
5
|
+
#include "duckdb/common/types/row/tuple_data_iterator.hpp"
|
4
6
|
#include "duckdb/function/window/window_aggregate_function.hpp"
|
5
7
|
#include "duckdb/function/window/window_executor.hpp"
|
6
8
|
#include "duckdb/function/window/window_rank_function.hpp"
|
@@ -8,27 +10,26 @@
|
|
8
10
|
#include "duckdb/function/window/window_shared_expressions.hpp"
|
9
11
|
#include "duckdb/function/window/window_value_function.hpp"
|
10
12
|
#include "duckdb/planner/expression/bound_window_expression.hpp"
|
11
|
-
|
12
|
-
#include <numeric>
|
13
|
+
#include "duckdb/main/settings.hpp"
|
13
14
|
|
14
15
|
namespace duckdb {
|
15
16
|
|
16
17
|
// Global sink state
|
17
18
|
class WindowGlobalSinkState;
|
18
19
|
|
19
|
-
enum WindowGroupStage : uint8_t { SINK, FINALIZE, GETDATA, DONE };
|
20
|
+
enum WindowGroupStage : uint8_t { MASK, SINK, FINALIZE, GETDATA, DONE };
|
20
21
|
|
21
22
|
struct WindowSourceTask {
|
22
|
-
WindowSourceTask(
|
23
|
-
: stage(stage), group_idx(group_idx), thread_idx(0), max_idx(max_idx) {
|
23
|
+
WindowSourceTask() {
|
24
24
|
}
|
25
|
-
|
25
|
+
|
26
|
+
WindowGroupStage stage = WindowGroupStage::DONE;
|
26
27
|
//! The hash group
|
27
|
-
idx_t group_idx;
|
28
|
+
idx_t group_idx = 0;
|
28
29
|
//! The thread index (for local state)
|
29
|
-
idx_t thread_idx;
|
30
|
+
idx_t thread_idx = 0;
|
30
31
|
//! The total block index count
|
31
|
-
idx_t max_idx;
|
32
|
+
idx_t max_idx = 0;
|
32
33
|
//! The first block index count
|
33
34
|
idx_t begin_idx = 0;
|
34
35
|
//! The end block index count
|
@@ -37,34 +38,38 @@ struct WindowSourceTask {
|
|
37
38
|
|
38
39
|
class WindowHashGroup {
|
39
40
|
public:
|
40
|
-
using HashGroupPtr = unique_ptr<
|
41
|
-
using OrderMasks =
|
42
|
-
using ExecutorGlobalStatePtr = unique_ptr<
|
41
|
+
using HashGroupPtr = unique_ptr<ColumnDataCollection>;
|
42
|
+
using OrderMasks = unordered_map<idx_t, ValidityMask>;
|
43
|
+
using ExecutorGlobalStatePtr = unique_ptr<GlobalSinkState>;
|
43
44
|
using ExecutorGlobalStates = vector<ExecutorGlobalStatePtr>;
|
44
|
-
using ExecutorLocalStatePtr = unique_ptr<
|
45
|
+
using ExecutorLocalStatePtr = unique_ptr<LocalSinkState>;
|
45
46
|
using ExecutorLocalStates = vector<ExecutorLocalStatePtr>;
|
46
47
|
using ThreadLocalStates = vector<ExecutorLocalStates>;
|
47
48
|
using Task = WindowSourceTask;
|
48
49
|
using TaskPtr = optional_ptr<Task>;
|
50
|
+
using ScannerPtr = unique_ptr<WindowCollectionChunkScanner>;
|
49
51
|
|
50
|
-
WindowHashGroup(WindowGlobalSinkState &
|
52
|
+
WindowHashGroup(WindowGlobalSinkState &gsink, HashGroupPtr &sorted, const idx_t hash_bin_p);
|
51
53
|
|
52
|
-
|
54
|
+
void AllocateMasks();
|
55
|
+
void ComputeMasks(const idx_t begin_idx, const idx_t end_idx);
|
53
56
|
|
54
|
-
|
55
|
-
unique_ptr<RowDataCollectionScanner> GetBuildScanner(idx_t block_idx) const {
|
56
|
-
if (!rows) {
|
57
|
-
return nullptr;
|
58
|
-
}
|
59
|
-
return make_uniq<RowDataCollectionScanner>(*rows, *heap, layout, external, block_idx, false);
|
60
|
-
}
|
57
|
+
ExecutorGlobalStates &GetGlobalStates(ClientContext &client);
|
61
58
|
|
62
|
-
//
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
59
|
+
// The total number of tasks we will execute per thread
|
60
|
+
inline idx_t GetTaskCount() const {
|
61
|
+
return GetThreadCount() * (uint8_t(WindowGroupStage::DONE) - uint8_t(WindowGroupStage::MASK));
|
62
|
+
}
|
63
|
+
// The total number of threads we will use
|
64
|
+
inline idx_t GetThreadCount() const {
|
65
|
+
return group_threads;
|
67
66
|
}
|
67
|
+
// Set up the task parameters
|
68
|
+
idx_t InitTasks(idx_t per_thread);
|
69
|
+
|
70
|
+
// Scan all of the chunks, starting at a given point
|
71
|
+
ScannerPtr GetScanner(const idx_t begin_idx) const;
|
72
|
+
void UpdateScanner(ScannerPtr &scanner, idx_t begin_idx) const;
|
68
73
|
|
69
74
|
// The processing stage for this group
|
70
75
|
WindowGroupStage GetStage() const {
|
@@ -74,6 +79,12 @@ public:
|
|
74
79
|
bool TryPrepareNextStage() {
|
75
80
|
lock_guard<mutex> prepare_guard(lock);
|
76
81
|
switch (stage.load()) {
|
82
|
+
case WindowGroupStage::MASK:
|
83
|
+
if (masked == blocks) {
|
84
|
+
stage = WindowGroupStage::SINK;
|
85
|
+
return true;
|
86
|
+
}
|
87
|
+
return false;
|
77
88
|
case WindowGroupStage::SINK:
|
78
89
|
if (sunk == count) {
|
79
90
|
stage = WindowGroupStage::FINALIZE;
|
@@ -86,19 +97,29 @@ public:
|
|
86
97
|
return true;
|
87
98
|
}
|
88
99
|
return false;
|
89
|
-
|
100
|
+
case WindowGroupStage::GETDATA:
|
101
|
+
case WindowGroupStage::DONE:
|
90
102
|
// never block in GETDATA
|
91
103
|
return true;
|
92
104
|
}
|
105
|
+
|
106
|
+
// Stop Linux whinging about control flow...
|
107
|
+
return true;
|
93
108
|
}
|
94
109
|
|
95
|
-
bool TryNextTask(
|
96
|
-
if (next_task >=
|
110
|
+
bool TryNextTask(Task &task) {
|
111
|
+
if (next_task >= GetTaskCount()) {
|
97
112
|
return false;
|
98
113
|
}
|
99
|
-
|
100
|
-
auto
|
101
|
-
|
114
|
+
const auto group_stage = GetStage();
|
115
|
+
const auto group_threads = GetThreadCount();
|
116
|
+
task.stage = WindowGroupStage(next_task / group_threads);
|
117
|
+
if (task.stage == group_stage) {
|
118
|
+
task.thread_idx = next_task % group_threads;
|
119
|
+
task.group_idx = hash_bin;
|
120
|
+
task.begin_idx = task.thread_idx * per_thread;
|
121
|
+
task.max_idx = rows->ChunkCount();
|
122
|
+
task.end_idx = MinValue<idx_t>(task.begin_idx + per_thread, task.max_idx);
|
102
123
|
++next_task;
|
103
124
|
return true;
|
104
125
|
}
|
@@ -106,23 +127,22 @@ public:
|
|
106
127
|
return false;
|
107
128
|
}
|
108
129
|
|
130
|
+
//! The shared global state from sinking
|
131
|
+
WindowGlobalSinkState &gsink;
|
109
132
|
//! The hash partition data
|
110
133
|
HashGroupPtr hash_group;
|
111
134
|
//! The size of the group
|
112
135
|
idx_t count = 0;
|
113
136
|
//! The number of blocks in the group
|
114
137
|
idx_t blocks = 0;
|
115
|
-
unique_ptr<
|
116
|
-
|
117
|
-
RowLayout layout;
|
138
|
+
unique_ptr<ColumnDataCollection> rows;
|
139
|
+
TupleDataLayout layout;
|
118
140
|
//! The partition boundary mask
|
119
141
|
ValidityMask partition_mask;
|
120
142
|
//! The order boundary mask
|
121
143
|
OrderMasks order_masks;
|
122
144
|
//! The fully materialised data collection
|
123
145
|
unique_ptr<WindowCollection> collection;
|
124
|
-
//! External paging
|
125
|
-
bool external;
|
126
146
|
// The processing stage for this group
|
127
147
|
atomic<WindowGroupStage> stage;
|
128
148
|
//! The function global states for this hash group
|
@@ -134,10 +154,14 @@ public:
|
|
134
154
|
idx_t hash_bin;
|
135
155
|
//! Single threading lock
|
136
156
|
mutex lock;
|
137
|
-
//! The
|
138
|
-
|
157
|
+
//! The the number of blocks per thread.
|
158
|
+
idx_t per_thread = 0;
|
159
|
+
//! The the number of blocks per thread.
|
160
|
+
idx_t group_threads = 0;
|
139
161
|
//! The next task to process
|
140
162
|
idx_t next_task = 0;
|
163
|
+
//! Count of masked blocks
|
164
|
+
std::atomic<idx_t> masked;
|
141
165
|
//! Count of sunk rows
|
142
166
|
std::atomic<idx_t> sunk;
|
143
167
|
//! Count of finalized blocks
|
@@ -146,13 +170,8 @@ public:
|
|
146
170
|
std::atomic<idx_t> completed;
|
147
171
|
//! The output ordering batch index this hash group starts at
|
148
172
|
idx_t batch_base;
|
149
|
-
|
150
|
-
private:
|
151
|
-
void MaterializeSortedData();
|
152
173
|
};
|
153
174
|
|
154
|
-
class WindowPartitionGlobalSinkState;
|
155
|
-
|
156
175
|
class WindowGlobalSinkState : public GlobalSinkState {
|
157
176
|
public:
|
158
177
|
using ExecutorPtr = unique_ptr<WindowExecutor>;
|
@@ -160,68 +179,45 @@ public:
|
|
160
179
|
|
161
180
|
WindowGlobalSinkState(const PhysicalWindow &op, ClientContext &context);
|
162
181
|
|
182
|
+
SinkFinalizeType Finalize(ClientContext &client, InterruptState &interrupt_state) {
|
183
|
+
OperatorSinkFinalizeInput finalize {*hashed_sink, interrupt_state};
|
184
|
+
auto result = global_partition->Finalize(client, finalize);
|
185
|
+
|
186
|
+
return result;
|
187
|
+
}
|
188
|
+
|
163
189
|
//! Parent operator
|
164
190
|
const PhysicalWindow &op;
|
165
|
-
//!
|
166
|
-
ClientContext &
|
191
|
+
//! Client context
|
192
|
+
ClientContext &client;
|
193
|
+
//! The partitioned sunk data
|
194
|
+
unique_ptr<HashedSort> global_partition;
|
167
195
|
//! The partitioned sunk data
|
168
|
-
unique_ptr<
|
196
|
+
unique_ptr<GlobalSinkState> hashed_sink;
|
197
|
+
//! The number of sunk rows (for progress)
|
198
|
+
atomic<idx_t> count;
|
169
199
|
//! The execution functions
|
170
200
|
Executors executors;
|
171
201
|
//! The shared expressions library
|
172
202
|
WindowSharedExpressions shared;
|
173
203
|
};
|
174
204
|
|
175
|
-
class WindowPartitionGlobalSinkState : public PartitionGlobalSinkState {
|
176
|
-
public:
|
177
|
-
using WindowHashGroupPtr = unique_ptr<WindowHashGroup>;
|
178
|
-
|
179
|
-
WindowPartitionGlobalSinkState(WindowGlobalSinkState &gsink, const BoundWindowExpression &wexpr)
|
180
|
-
: PartitionGlobalSinkState(gsink.context, wexpr.partitions, wexpr.orders, gsink.op.children[0].get().GetTypes(),
|
181
|
-
wexpr.partitions_stats, gsink.op.estimated_cardinality),
|
182
|
-
gsink(gsink) {
|
183
|
-
}
|
184
|
-
~WindowPartitionGlobalSinkState() override = default;
|
185
|
-
|
186
|
-
void OnBeginMerge() override {
|
187
|
-
PartitionGlobalSinkState::OnBeginMerge();
|
188
|
-
window_hash_groups.resize(hash_groups.size());
|
189
|
-
}
|
190
|
-
|
191
|
-
void OnSortedPartition(const idx_t group_idx) override {
|
192
|
-
PartitionGlobalSinkState::OnSortedPartition(group_idx);
|
193
|
-
window_hash_groups[group_idx] = make_uniq<WindowHashGroup>(gsink, group_idx);
|
194
|
-
}
|
195
|
-
|
196
|
-
//! Operator global sink state
|
197
|
-
WindowGlobalSinkState &gsink;
|
198
|
-
//! The sorted hash groups
|
199
|
-
vector<WindowHashGroupPtr> window_hash_groups;
|
200
|
-
};
|
201
|
-
|
202
205
|
// Per-thread sink state
|
203
206
|
class WindowLocalSinkState : public LocalSinkState {
|
204
207
|
public:
|
205
|
-
WindowLocalSinkState(
|
206
|
-
:
|
208
|
+
WindowLocalSinkState(ExecutionContext &context, const WindowGlobalSinkState &gstate)
|
209
|
+
: local_group(gstate.global_partition->GetLocalSinkState(context)) {
|
207
210
|
}
|
208
211
|
|
209
|
-
|
210
|
-
local_partition.Sink(input_chunk);
|
211
|
-
}
|
212
|
-
|
213
|
-
void Combine() {
|
214
|
-
local_partition.Combine();
|
215
|
-
}
|
216
|
-
|
217
|
-
PartitionLocalSinkState local_partition;
|
212
|
+
unique_ptr<LocalSinkState> local_group;
|
218
213
|
};
|
219
214
|
|
220
215
|
// this implements a sorted window functions variant
|
221
|
-
PhysicalWindow::PhysicalWindow(vector<LogicalType> types,
|
222
|
-
idx_t estimated_cardinality,
|
223
|
-
|
224
|
-
|
216
|
+
PhysicalWindow::PhysicalWindow(PhysicalPlan &physical_plan, vector<LogicalType> types,
|
217
|
+
vector<unique_ptr<Expression>> select_list_p, idx_t estimated_cardinality,
|
218
|
+
PhysicalOperatorType type)
|
219
|
+
: PhysicalOperator(physical_plan, type, std::move(types), estimated_cardinality),
|
220
|
+
select_list(std::move(select_list_p)), order_idx(0), is_order_dependent(false) {
|
225
221
|
|
226
222
|
idx_t max_orders = 0;
|
227
223
|
for (idx_t i = 0; i < select_list.size(); ++i) {
|
@@ -239,108 +235,109 @@ PhysicalWindow::PhysicalWindow(vector<LogicalType> types, vector<unique_ptr<Expr
|
|
239
235
|
}
|
240
236
|
}
|
241
237
|
|
242
|
-
static unique_ptr<WindowExecutor> WindowExecutorFactory(BoundWindowExpression &wexpr, ClientContext &
|
238
|
+
static unique_ptr<WindowExecutor> WindowExecutorFactory(BoundWindowExpression &wexpr, ClientContext &client,
|
243
239
|
WindowSharedExpressions &shared, WindowAggregationMode mode) {
|
244
240
|
switch (wexpr.GetExpressionType()) {
|
245
241
|
case ExpressionType::WINDOW_AGGREGATE:
|
246
|
-
return make_uniq<WindowAggregateExecutor>(wexpr,
|
242
|
+
return make_uniq<WindowAggregateExecutor>(wexpr, client, shared, mode);
|
247
243
|
case ExpressionType::WINDOW_ROW_NUMBER:
|
248
|
-
return make_uniq<WindowRowNumberExecutor>(wexpr,
|
244
|
+
return make_uniq<WindowRowNumberExecutor>(wexpr, shared);
|
249
245
|
case ExpressionType::WINDOW_RANK_DENSE:
|
250
|
-
return make_uniq<WindowDenseRankExecutor>(wexpr,
|
246
|
+
return make_uniq<WindowDenseRankExecutor>(wexpr, shared);
|
251
247
|
case ExpressionType::WINDOW_RANK:
|
252
|
-
return make_uniq<WindowRankExecutor>(wexpr,
|
248
|
+
return make_uniq<WindowRankExecutor>(wexpr, shared);
|
253
249
|
case ExpressionType::WINDOW_PERCENT_RANK:
|
254
|
-
return make_uniq<WindowPercentRankExecutor>(wexpr,
|
250
|
+
return make_uniq<WindowPercentRankExecutor>(wexpr, shared);
|
255
251
|
case ExpressionType::WINDOW_CUME_DIST:
|
256
|
-
return make_uniq<WindowCumeDistExecutor>(wexpr,
|
252
|
+
return make_uniq<WindowCumeDistExecutor>(wexpr, shared);
|
257
253
|
case ExpressionType::WINDOW_NTILE:
|
258
|
-
return make_uniq<WindowNtileExecutor>(wexpr,
|
254
|
+
return make_uniq<WindowNtileExecutor>(wexpr, shared);
|
259
255
|
case ExpressionType::WINDOW_LEAD:
|
260
256
|
case ExpressionType::WINDOW_LAG:
|
261
|
-
return make_uniq<WindowLeadLagExecutor>(wexpr,
|
257
|
+
return make_uniq<WindowLeadLagExecutor>(wexpr, shared);
|
258
|
+
case ExpressionType::WINDOW_FILL:
|
259
|
+
return make_uniq<WindowFillExecutor>(wexpr, shared);
|
262
260
|
case ExpressionType::WINDOW_FIRST_VALUE:
|
263
|
-
return make_uniq<WindowFirstValueExecutor>(wexpr,
|
261
|
+
return make_uniq<WindowFirstValueExecutor>(wexpr, shared);
|
264
262
|
case ExpressionType::WINDOW_LAST_VALUE:
|
265
|
-
return make_uniq<WindowLastValueExecutor>(wexpr,
|
263
|
+
return make_uniq<WindowLastValueExecutor>(wexpr, shared);
|
266
264
|
case ExpressionType::WINDOW_NTH_VALUE:
|
267
|
-
return make_uniq<WindowNthValueExecutor>(wexpr,
|
265
|
+
return make_uniq<WindowNthValueExecutor>(wexpr, shared);
|
268
266
|
break;
|
269
267
|
default:
|
270
268
|
throw InternalException("Window aggregate type %s", ExpressionTypeToString(wexpr.GetExpressionType()));
|
271
269
|
}
|
272
270
|
}
|
273
271
|
|
274
|
-
WindowGlobalSinkState::WindowGlobalSinkState(const PhysicalWindow &op, ClientContext &
|
275
|
-
: op(op),
|
272
|
+
WindowGlobalSinkState::WindowGlobalSinkState(const PhysicalWindow &op, ClientContext &client)
|
273
|
+
: op(op), client(client), count(0) {
|
276
274
|
|
277
275
|
D_ASSERT(op.select_list[op.order_idx]->GetExpressionClass() == ExpressionClass::BOUND_WINDOW);
|
278
276
|
auto &wexpr = op.select_list[op.order_idx]->Cast<BoundWindowExpression>();
|
279
277
|
|
280
|
-
const auto mode = DBConfig::
|
278
|
+
const auto mode = DBConfig::GetSetting<DebugWindowModeSetting>(client);
|
281
279
|
for (idx_t expr_idx = 0; expr_idx < op.select_list.size(); ++expr_idx) {
|
282
280
|
D_ASSERT(op.select_list[expr_idx]->GetExpressionClass() == ExpressionClass::BOUND_WINDOW);
|
283
281
|
auto &wexpr = op.select_list[expr_idx]->Cast<BoundWindowExpression>();
|
284
|
-
auto wexec = WindowExecutorFactory(wexpr,
|
282
|
+
auto wexec = WindowExecutorFactory(wexpr, client, shared, mode);
|
285
283
|
executors.emplace_back(std::move(wexec));
|
286
284
|
}
|
287
285
|
|
288
|
-
global_partition = make_uniq<
|
286
|
+
global_partition = make_uniq<HashedSort>(client, wexpr.partitions, wexpr.orders, op.children[0].get().GetTypes(),
|
287
|
+
wexpr.partitions_stats, op.estimated_cardinality);
|
288
|
+
hashed_sink = global_partition->GetGlobalSinkState(client);
|
289
289
|
}
|
290
290
|
|
291
291
|
//===--------------------------------------------------------------------===//
|
292
292
|
// Sink
|
293
293
|
//===--------------------------------------------------------------------===//
|
294
|
-
SinkResultType PhysicalWindow::Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &
|
295
|
-
auto &
|
296
|
-
|
297
|
-
|
294
|
+
SinkResultType PhysicalWindow::Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &sink) const {
|
295
|
+
auto &gstate = sink.global_state.Cast<WindowGlobalSinkState>();
|
296
|
+
auto &lstate = sink.local_state.Cast<WindowLocalSinkState>();
|
297
|
+
gstate.count += chunk.size();
|
298
298
|
|
299
|
-
|
299
|
+
OperatorSinkInput hsink {*gstate.hashed_sink, *lstate.local_group, sink.interrupt_state};
|
300
|
+
return gstate.global_partition->Sink(context, chunk, hsink);
|
300
301
|
}
|
301
302
|
|
302
|
-
SinkCombineResultType PhysicalWindow::Combine(ExecutionContext &context, OperatorSinkCombineInput &
|
303
|
-
auto &
|
304
|
-
lstate.
|
303
|
+
SinkCombineResultType PhysicalWindow::Combine(ExecutionContext &context, OperatorSinkCombineInput &combine) const {
|
304
|
+
auto &gstate = combine.global_state.Cast<WindowGlobalSinkState>();
|
305
|
+
auto &lstate = combine.local_state.Cast<WindowLocalSinkState>();
|
305
306
|
|
306
|
-
|
307
|
+
OperatorSinkCombineInput hcombine {*gstate.hashed_sink, *lstate.local_group, combine.interrupt_state};
|
308
|
+
return gstate.global_partition->Combine(context, hcombine);
|
307
309
|
}
|
308
310
|
|
309
311
|
unique_ptr<LocalSinkState> PhysicalWindow::GetLocalSinkState(ExecutionContext &context) const {
|
310
312
|
auto &gstate = sink_state->Cast<WindowGlobalSinkState>();
|
311
|
-
return make_uniq<WindowLocalSinkState>(context
|
313
|
+
return make_uniq<WindowLocalSinkState>(context, gstate);
|
312
314
|
}
|
313
315
|
|
314
|
-
unique_ptr<GlobalSinkState> PhysicalWindow::GetGlobalSinkState(ClientContext &
|
315
|
-
return make_uniq<WindowGlobalSinkState>(*this,
|
316
|
+
unique_ptr<GlobalSinkState> PhysicalWindow::GetGlobalSinkState(ClientContext &client) const {
|
317
|
+
return make_uniq<WindowGlobalSinkState>(*this, client);
|
316
318
|
}
|
317
319
|
|
318
|
-
SinkFinalizeType PhysicalWindow::Finalize(Pipeline &pipeline, Event &event, ClientContext &
|
320
|
+
SinkFinalizeType PhysicalWindow::Finalize(Pipeline &pipeline, Event &event, ClientContext &client,
|
319
321
|
OperatorSinkFinalizeInput &input) const {
|
320
|
-
auto &
|
321
|
-
|
322
|
-
|
323
|
-
if (!state.global_partition->count) {
|
324
|
-
return SinkFinalizeType::NO_OUTPUT_POSSIBLE;
|
325
|
-
}
|
322
|
+
auto &gsink = input.global_state.Cast<WindowGlobalSinkState>();
|
323
|
+
auto &global_partition = *gsink.global_partition;
|
324
|
+
auto &hashed_sink = *gsink.hashed_sink;
|
326
325
|
|
327
|
-
|
328
|
-
|
329
|
-
D_ASSERT(!state.global_partition->grouping_data);
|
330
|
-
return state.global_partition->rows->count ? SinkFinalizeType::READY : SinkFinalizeType::NO_OUTPUT_POSSIBLE;
|
331
|
-
}
|
326
|
+
OperatorSinkFinalizeInput hfinalize {hashed_sink, input.interrupt_state};
|
327
|
+
auto result = global_partition.Finalize(client, hfinalize);
|
332
328
|
|
333
|
-
//
|
334
|
-
if (
|
335
|
-
|
336
|
-
return SinkFinalizeType::NO_OUTPUT_POSSIBLE;
|
329
|
+
// Did we get any data?
|
330
|
+
if (result != SinkFinalizeType::READY) {
|
331
|
+
return result;
|
337
332
|
}
|
338
333
|
|
339
|
-
|
340
|
-
|
341
|
-
event.InsertEvent(std::move(new_event));
|
334
|
+
return global_partition.MaterializeHashGroups(pipeline, event, *this, hfinalize);
|
335
|
+
}
|
342
336
|
|
343
|
-
|
337
|
+
ProgressData PhysicalWindow::GetSinkProgress(ClientContext &context, GlobalSinkState &gstate,
|
338
|
+
const ProgressData source_progress) const {
|
339
|
+
auto &gsink = gstate.Cast<WindowGlobalSinkState>();
|
340
|
+
return gsink.global_partition->GetSinkProgress(context, *gsink.hashed_sink, source_progress);
|
344
341
|
}
|
345
342
|
|
346
343
|
//===--------------------------------------------------------------------===//
|
@@ -348,16 +345,14 @@ SinkFinalizeType PhysicalWindow::Finalize(Pipeline &pipeline, Event &event, Clie
|
|
348
345
|
//===--------------------------------------------------------------------===//
|
349
346
|
class WindowGlobalSourceState : public GlobalSourceState {
|
350
347
|
public:
|
351
|
-
using
|
348
|
+
using WindowHashGroupPtr = unique_ptr<WindowHashGroup>;
|
349
|
+
using ScannerPtr = unique_ptr<TupleDataChunkIterator>;
|
352
350
|
using Task = WindowSourceTask;
|
353
351
|
using TaskPtr = optional_ptr<Task>;
|
354
352
|
using PartitionBlock = std::pair<idx_t, idx_t>;
|
355
353
|
|
356
354
|
WindowGlobalSourceState(ClientContext &context_p, WindowGlobalSinkState &gsink_p);
|
357
355
|
|
358
|
-
//! Build task list
|
359
|
-
void CreateTaskList();
|
360
|
-
|
361
356
|
//! Are there any more tasks?
|
362
357
|
bool HasMoreTasks() const {
|
363
358
|
return !stopped && started < total_tasks;
|
@@ -366,12 +361,14 @@ public:
|
|
366
361
|
return !stopped && finished < total_tasks;
|
367
362
|
}
|
368
363
|
//! Get the next task given the current state
|
369
|
-
bool TryNextTask(TaskPtr &task);
|
364
|
+
bool TryNextTask(TaskPtr &task, Task &task_local);
|
370
365
|
|
371
366
|
//! Context for executing computations
|
372
|
-
ClientContext &
|
367
|
+
ClientContext &client;
|
373
368
|
//! All the sunk data
|
374
369
|
WindowGlobalSinkState &gsink;
|
370
|
+
//! The sorted hash groups
|
371
|
+
vector<WindowHashGroupPtr> window_hash_groups;
|
375
372
|
//! The total number of blocks to process;
|
376
373
|
idx_t total_blocks = 0;
|
377
374
|
//! The sorted list of (blocks, group_idx) pairs
|
@@ -390,8 +387,8 @@ public:
|
|
390
387
|
atomic<idx_t> finished;
|
391
388
|
//! Stop producing tasks
|
392
389
|
atomic<bool> stopped;
|
393
|
-
//! The number of
|
394
|
-
atomic<idx_t>
|
390
|
+
//! The number of tasks completed. This will combine both build and evaluate.
|
391
|
+
atomic<idx_t> completed;
|
395
392
|
|
396
393
|
public:
|
397
394
|
idx_t MaxThreads() override {
|
@@ -399,55 +396,38 @@ public:
|
|
399
396
|
}
|
400
397
|
|
401
398
|
protected:
|
399
|
+
//! Build task list
|
400
|
+
void CreateTaskList();
|
402
401
|
//! Finish a task
|
403
402
|
void FinishTask(TaskPtr task);
|
404
403
|
};
|
405
404
|
|
406
|
-
WindowGlobalSourceState::WindowGlobalSourceState(ClientContext &
|
407
|
-
:
|
408
|
-
returned(0) {
|
409
|
-
auto &gpart = gsink.global_partition;
|
410
|
-
auto &window_hash_groups = gsink.global_partition->window_hash_groups;
|
405
|
+
WindowGlobalSourceState::WindowGlobalSourceState(ClientContext &client, WindowGlobalSinkState &gsink_p)
|
406
|
+
: client(client), gsink(gsink_p), next_group(0), locals(0), started(0), finished(0), stopped(false), completed(0) {
|
411
407
|
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
window_hash_groups.emplace_back(make_uniq<WindowHashGroup>(gsink, idx_t(0)));
|
417
|
-
total_blocks = gpart->rows->blocks.size();
|
418
|
-
}
|
419
|
-
} else {
|
420
|
-
idx_t batch_base = 0;
|
421
|
-
for (auto &window_hash_group : window_hash_groups) {
|
422
|
-
if (!window_hash_group) {
|
423
|
-
continue;
|
424
|
-
}
|
425
|
-
auto &rows = window_hash_group->rows;
|
426
|
-
if (!rows) {
|
427
|
-
continue;
|
428
|
-
}
|
408
|
+
auto &global_partition = *gsink.global_partition;
|
409
|
+
auto hashed_source = global_partition.GetGlobalSourceState(client, *gsink.hashed_sink);
|
410
|
+
auto &hash_groups = global_partition.GetHashGroups(*hashed_source);
|
411
|
+
window_hash_groups.resize(hash_groups.size());
|
429
412
|
|
430
|
-
|
431
|
-
|
432
|
-
|
413
|
+
for (idx_t group_idx = 0; group_idx < hash_groups.size(); ++group_idx) {
|
414
|
+
auto rows = std::move(hash_groups[group_idx]);
|
415
|
+
if (!rows) {
|
416
|
+
continue;
|
433
417
|
}
|
434
|
-
total_blocks = batch_base;
|
435
|
-
}
|
436
|
-
}
|
437
|
-
|
438
|
-
void WindowGlobalSourceState::CreateTaskList() {
|
439
|
-
// Check whether we have a task list outside the mutex.
|
440
|
-
if (started.load()) {
|
441
|
-
return;
|
442
|
-
}
|
443
418
|
|
444
|
-
|
419
|
+
auto window_hash_group = make_uniq<WindowHashGroup>(gsink, rows, group_idx);
|
420
|
+
const auto block_count = window_hash_group->rows->ChunkCount();
|
421
|
+
window_hash_group->batch_base = total_blocks;
|
422
|
+
total_blocks += block_count;
|
445
423
|
|
446
|
-
|
447
|
-
if (!partition_blocks.empty()) {
|
448
|
-
return;
|
424
|
+
window_hash_groups[group_idx] = std::move(window_hash_group);
|
449
425
|
}
|
450
426
|
|
427
|
+
CreateTaskList();
|
428
|
+
}
|
429
|
+
|
430
|
+
void WindowGlobalSourceState::CreateTaskList() {
|
451
431
|
// Sort the groups from largest to smallest
|
452
432
|
if (window_hash_groups.empty()) {
|
453
433
|
return;
|
@@ -455,100 +435,92 @@ void WindowGlobalSourceState::CreateTaskList() {
|
|
455
435
|
|
456
436
|
for (idx_t group_idx = 0; group_idx < window_hash_groups.size(); ++group_idx) {
|
457
437
|
auto &window_hash_group = window_hash_groups[group_idx];
|
458
|
-
|
438
|
+
if (!window_hash_group) {
|
439
|
+
continue;
|
440
|
+
}
|
441
|
+
partition_blocks.emplace_back(window_hash_group->rows->ChunkCount(), group_idx);
|
459
442
|
}
|
460
443
|
std::sort(partition_blocks.begin(), partition_blocks.end(), std::greater<PartitionBlock>());
|
461
444
|
|
462
445
|
// Schedule the largest group on as many threads as possible
|
463
|
-
|
446
|
+
auto &ts = TaskScheduler::GetScheduler(client);
|
447
|
+
const auto threads = NumericCast<idx_t>(ts.NumberOfThreads());
|
448
|
+
|
464
449
|
const auto &max_block = partition_blocks.front();
|
465
|
-
|
450
|
+
|
451
|
+
// To compute masks in parallel, we need to have the row count of the number of chunks per thread
|
452
|
+
// be a multiple of the mask entry size. Usually, this is not a problem because
|
453
|
+
// STANDARD_VECTOR_SIZE >> ValidityMask::BITS_PER_VALUE, but if STANDARD_VECTOR_SIZE is say 2,
|
454
|
+
// we need to align the chunk count to the mask width.
|
455
|
+
const auto aligned_scale = MaxValue<idx_t>(ValidityMask::BITS_PER_VALUE / STANDARD_VECTOR_SIZE, 1);
|
456
|
+
const auto aligned_count = (max_block.first + aligned_scale - 1) / aligned_scale;
|
457
|
+
const auto per_thread = aligned_scale * ((aligned_count + threads - 1) / threads);
|
466
458
|
if (!per_thread) {
|
467
459
|
throw InternalException("No blocks per thread! %ld threads, %ld groups, %ld blocks, %ld hash group", threads,
|
468
460
|
partition_blocks.size(), max_block.first, max_block.second);
|
469
461
|
}
|
470
462
|
|
471
|
-
// TODO: Generate dynamically instead of building a big list?
|
472
|
-
vector<WindowGroupStage> stages {WindowGroupStage::SINK, WindowGroupStage::FINALIZE, WindowGroupStage::GETDATA};
|
473
463
|
for (const auto &b : partition_blocks) {
|
474
|
-
|
475
|
-
auto &tasks = window_hash_group.tasks;
|
476
|
-
for (const auto &stage : stages) {
|
477
|
-
idx_t thread_count = 0;
|
478
|
-
for (Task task(stage, b.second, b.first); task.begin_idx < task.max_idx; task.begin_idx += per_thread) {
|
479
|
-
task.end_idx = MinValue<idx_t>(task.begin_idx + per_thread, task.max_idx);
|
480
|
-
tasks.emplace_back(task);
|
481
|
-
thread_count = ++task.thread_idx;
|
482
|
-
++total_tasks;
|
483
|
-
}
|
484
|
-
window_hash_group.thread_states.resize(thread_count);
|
485
|
-
}
|
486
|
-
}
|
487
|
-
}
|
488
|
-
|
489
|
-
void WindowHashGroup::MaterializeSortedData() {
|
490
|
-
auto &global_sort_state = *hash_group->global_sort;
|
491
|
-
if (global_sort_state.sorted_blocks.empty()) {
|
492
|
-
return;
|
493
|
-
}
|
494
|
-
|
495
|
-
// scan the sorted row data
|
496
|
-
D_ASSERT(global_sort_state.sorted_blocks.size() == 1);
|
497
|
-
auto &sb = *global_sort_state.sorted_blocks[0];
|
498
|
-
|
499
|
-
// Free up some memory before allocating more
|
500
|
-
sb.radix_sorting_data.clear();
|
501
|
-
sb.blob_sorting_data = nullptr;
|
502
|
-
|
503
|
-
// Move the sorting row blocks into our RDCs
|
504
|
-
auto &buffer_manager = global_sort_state.buffer_manager;
|
505
|
-
auto &sd = *sb.payload_data;
|
506
|
-
|
507
|
-
// Data blocks are required
|
508
|
-
D_ASSERT(!sd.data_blocks.empty());
|
509
|
-
auto &block = sd.data_blocks[0];
|
510
|
-
rows = make_uniq<RowDataCollection>(buffer_manager, block->capacity, block->entry_size);
|
511
|
-
rows->blocks = std::move(sd.data_blocks);
|
512
|
-
rows->count = std::accumulate(rows->blocks.begin(), rows->blocks.end(), idx_t(0),
|
513
|
-
[&](idx_t c, const unique_ptr<RowDataBlock> &b) { return c + b->count; });
|
514
|
-
|
515
|
-
// Heap blocks are optional, but we want both for iteration.
|
516
|
-
if (!sd.heap_blocks.empty()) {
|
517
|
-
auto &block = sd.heap_blocks[0];
|
518
|
-
heap = make_uniq<RowDataCollection>(buffer_manager, block->capacity, block->entry_size);
|
519
|
-
heap->blocks = std::move(sd.heap_blocks);
|
520
|
-
hash_group.reset();
|
521
|
-
} else {
|
522
|
-
heap = make_uniq<RowDataCollection>(buffer_manager, buffer_manager.GetBlockSize(), 1U, true);
|
464
|
+
total_tasks += window_hash_groups[b.second]->InitTasks(per_thread);
|
523
465
|
}
|
524
|
-
heap->count = std::accumulate(heap->blocks.begin(), heap->blocks.end(), idx_t(0),
|
525
|
-
[&](idx_t c, const unique_ptr<RowDataBlock> &b) { return c + b->count; });
|
526
466
|
}
|
527
467
|
|
528
|
-
WindowHashGroup::WindowHashGroup(WindowGlobalSinkState &
|
529
|
-
: count(0), blocks(0),
|
530
|
-
batch_base(0) {
|
468
|
+
WindowHashGroup::WindowHashGroup(WindowGlobalSinkState &gsink, HashGroupPtr &sorted, const idx_t hash_bin_p)
|
469
|
+
: gsink(gsink), count(0), blocks(0), rows(std::move(sorted)), stage(WindowGroupStage::MASK), hash_bin(hash_bin_p),
|
470
|
+
masked(0), sunk(0), finalized(0), completed(0), batch_base(0) {
|
531
471
|
// There are three types of partitions:
|
532
472
|
// 1. No partition (no sorting)
|
533
473
|
// 2. One partition (sorting, but no hashing)
|
534
474
|
// 3. Multiple partitions (sorting and hashing)
|
535
475
|
|
536
476
|
// How big is the partition?
|
537
|
-
auto &gpart = *
|
538
|
-
layout.Initialize(gpart.payload_types);
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
477
|
+
auto &gpart = *gsink.global_partition;
|
478
|
+
layout.Initialize(gpart.payload_types, TupleDataValidityType::CAN_HAVE_NULL_VALUES);
|
479
|
+
|
480
|
+
if (rows) {
|
481
|
+
count = rows->Count();
|
482
|
+
blocks = rows->ChunkCount();
|
483
|
+
}
|
484
|
+
|
485
|
+
// Set up the collection for any fully materialised data
|
486
|
+
const auto &shared = WindowSharedExpressions::GetSortedExpressions(gsink.shared.coll_shared);
|
487
|
+
vector<LogicalType> types;
|
488
|
+
for (auto &expr : shared) {
|
489
|
+
types.emplace_back(expr->return_type);
|
490
|
+
}
|
491
|
+
auto &buffer_manager = BufferManager::GetBufferManager(gsink.client);
|
492
|
+
collection = make_uniq<WindowCollection>(buffer_manager, count, types);
|
493
|
+
}
|
494
|
+
|
495
|
+
unique_ptr<WindowCollectionChunkScanner> WindowHashGroup::GetScanner(const idx_t begin_idx) const {
|
496
|
+
if (!rows) {
|
497
|
+
return nullptr;
|
498
|
+
}
|
499
|
+
|
500
|
+
auto &scan_ids = gsink.global_partition->scan_ids;
|
501
|
+
return make_uniq<WindowCollectionChunkScanner>(*rows, scan_ids, begin_idx);
|
502
|
+
}
|
503
|
+
|
504
|
+
void WindowHashGroup::UpdateScanner(ScannerPtr &scanner, idx_t begin_idx) const {
|
505
|
+
if (!scanner || &scanner->collection != rows.get()) {
|
506
|
+
scanner.reset();
|
507
|
+
scanner = GetScanner(begin_idx);
|
543
508
|
} else {
|
509
|
+
scanner->Seek(begin_idx);
|
510
|
+
}
|
511
|
+
}
|
512
|
+
|
513
|
+
void WindowHashGroup::AllocateMasks() {
|
514
|
+
// Single-threaded building as this is mostly memory allocation
|
515
|
+
lock_guard<mutex> gestate_guard(lock);
|
516
|
+
if (partition_mask.IsMaskSet()) {
|
544
517
|
return;
|
545
518
|
}
|
546
519
|
|
547
|
-
//
|
520
|
+
// Allocate masks inside the lock
|
548
521
|
partition_mask.Initialize(count);
|
549
|
-
partition_mask.SetAllInvalid(count);
|
550
522
|
|
551
|
-
const auto &executors =
|
523
|
+
const auto &executors = gsink.executors;
|
552
524
|
for (auto &wexec : executors) {
|
553
525
|
auto &wexpr = wexec->wexpr;
|
554
526
|
auto &order_mask = order_masks[wexpr.partitions.size() + wexpr.orders.size()];
|
@@ -556,43 +528,102 @@ WindowHashGroup::WindowHashGroup(WindowGlobalSinkState &gstate, const idx_t hash
|
|
556
528
|
continue;
|
557
529
|
}
|
558
530
|
order_mask.Initialize(count);
|
559
|
-
order_mask.SetAllInvalid(count);
|
560
531
|
}
|
532
|
+
}
|
533
|
+
|
534
|
+
void WindowHashGroup::ComputeMasks(const idx_t block_begin, const idx_t block_end) {
|
535
|
+
D_ASSERT(count > 0);
|
536
|
+
|
537
|
+
// Initialise our range
|
538
|
+
AllocateMasks();
|
539
|
+
const auto begin_entry = partition_mask.EntryCount(block_begin * STANDARD_VECTOR_SIZE);
|
540
|
+
const auto end_entry = partition_mask.EntryCount(MinValue<idx_t>(block_end * STANDARD_VECTOR_SIZE, count));
|
561
541
|
|
562
|
-
//
|
563
|
-
|
564
|
-
if (
|
565
|
-
|
542
|
+
// If the data is unsorted, then the chunk sizes may be < STANDARD_VECTOR_SIZE,
|
543
|
+
// and the entry range may be empty.
|
544
|
+
if (begin_entry >= end_entry) {
|
545
|
+
D_ASSERT(gsink.global_partition->sort_col_count == 0);
|
546
|
+
return;
|
547
|
+
}
|
548
|
+
|
549
|
+
partition_mask.SetRangeInvalid(count, begin_entry, end_entry);
|
550
|
+
if (!block_begin) {
|
566
551
|
partition_mask.SetValidUnsafe(0);
|
567
|
-
|
552
|
+
}
|
553
|
+
for (auto &order_mask : order_masks) {
|
554
|
+
order_mask.second.SetRangeInvalid(count, begin_entry, end_entry);
|
555
|
+
if (!block_begin) {
|
568
556
|
order_mask.second.SetValidUnsafe(0);
|
569
557
|
}
|
570
|
-
// No partition - align the heap blocks with the row blocks
|
571
|
-
rows = gpart.rows->CloneEmpty(gpart.rows->keep_pinned);
|
572
|
-
heap = gpart.strings->CloneEmpty(gpart.strings->keep_pinned);
|
573
|
-
RowDataCollectionScanner::AlignHeapBlocks(*rows, *heap, *gpart.rows, *gpart.strings, layout);
|
574
|
-
external = true;
|
575
|
-
} else if (hash_bin < gpart.hash_groups.size()) {
|
576
|
-
// Overwrite the collections with the sorted data
|
577
|
-
D_ASSERT(gpart.hash_groups[hash_bin].get());
|
578
|
-
hash_group = std::move(gpart.hash_groups[hash_bin]);
|
579
|
-
hash_group->ComputeMasks(partition_mask, order_masks);
|
580
|
-
external = hash_group->global_sort->external;
|
581
|
-
MaterializeSortedData();
|
582
558
|
}
|
583
559
|
|
584
|
-
|
585
|
-
|
560
|
+
// If we are not sorting, then only the partition boundaries are needed.
|
561
|
+
if (!gsink.global_partition->sort) {
|
562
|
+
return;
|
586
563
|
}
|
587
564
|
|
588
|
-
//
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
auto &
|
595
|
-
|
565
|
+
// Set up the partition compare structs
|
566
|
+
auto &partitions = gsink.global_partition->partitions;
|
567
|
+
const auto key_count = partitions.size();
|
568
|
+
|
569
|
+
// Set up the order data structures
|
570
|
+
auto &collection = *rows;
|
571
|
+
auto &scan_cols = gsink.global_partition->sort_ids;
|
572
|
+
WindowCollectionChunkScanner scanner(collection, scan_cols, block_begin);
|
573
|
+
unordered_map<idx_t, DataChunk> prefixes;
|
574
|
+
for (auto &order_mask : order_masks) {
|
575
|
+
D_ASSERT(order_mask.first >= partitions.size());
|
576
|
+
auto order_type = scanner.PrefixStructType(order_mask.first, partitions.size());
|
577
|
+
vector<LogicalType> types(2, order_type);
|
578
|
+
auto &keys = prefixes[order_mask.first];
|
579
|
+
// We can't use InitializeEmpty here because it doesn't set up all of the STRUCT internals...
|
580
|
+
keys.Initialize(collection.GetAllocator(), types);
|
581
|
+
}
|
582
|
+
|
583
|
+
WindowDeltaScanner(collection, block_begin, block_end, scan_cols, key_count,
|
584
|
+
[&](const idx_t row_idx, DataChunk &prev, DataChunk &curr, const idx_t ndistinct,
|
585
|
+
SelectionVector &distinct, const SelectionVector &matching) {
|
586
|
+
// Process the partition boundaries
|
587
|
+
for (idx_t i = 0; i < ndistinct; ++i) {
|
588
|
+
const idx_t curr_index = row_idx + distinct.get_index(i);
|
589
|
+
partition_mask.SetValidUnsafe(curr_index);
|
590
|
+
for (auto &order_mask : order_masks) {
|
591
|
+
order_mask.second.SetValidUnsafe(curr_index);
|
592
|
+
}
|
593
|
+
}
|
594
|
+
|
595
|
+
// Process the peers with each partition
|
596
|
+
const auto count = MinValue<idx_t>(prev.size(), curr.size());
|
597
|
+
const auto nmatch = count - ndistinct;
|
598
|
+
if (!nmatch) {
|
599
|
+
return;
|
600
|
+
}
|
601
|
+
|
602
|
+
for (auto &order_mask : order_masks) {
|
603
|
+
// If there are no order columns, then all the partition elements are peers and we are
|
604
|
+
// done
|
605
|
+
if (partitions.size() == order_mask.first) {
|
606
|
+
continue;
|
607
|
+
}
|
608
|
+
auto &prefix = prefixes[order_mask.first];
|
609
|
+
prefix.Reset();
|
610
|
+
auto &order_prev = prefix.data[0];
|
611
|
+
auto &order_curr = prefix.data[1];
|
612
|
+
scanner.ReferenceStructColumns(prev, order_prev, order_mask.first, partitions.size());
|
613
|
+
scanner.ReferenceStructColumns(curr, order_curr, order_mask.first, partitions.size());
|
614
|
+
if (ndistinct) {
|
615
|
+
prefix.Slice(matching, nmatch);
|
616
|
+
} else {
|
617
|
+
prefix.SetCardinality(nmatch);
|
618
|
+
}
|
619
|
+
const auto m = VectorOperations::DistinctFrom(order_curr, order_prev, nullptr, nmatch,
|
620
|
+
&distinct, nullptr);
|
621
|
+
for (idx_t i = 0; i < m; ++i) {
|
622
|
+
const idx_t curr_index = row_idx + matching.get_index(distinct.get_index(i));
|
623
|
+
order_mask.second.SetValidUnsafe(curr_index);
|
624
|
+
}
|
625
|
+
}
|
626
|
+
});
|
596
627
|
}
|
597
628
|
|
598
629
|
// Per-thread scan state
|
@@ -615,7 +646,7 @@ public:
|
|
615
646
|
//! Assign the next task
|
616
647
|
bool TryAssignTask();
|
617
648
|
//! Execute a step in the current task
|
618
|
-
void ExecuteTask(DataChunk &chunk);
|
649
|
+
void ExecuteTask(ExecutionContext &context, DataChunk &chunk, InterruptState &interrupt);
|
619
650
|
|
620
651
|
//! The shared source state
|
621
652
|
WindowGlobalSourceState &gsource;
|
@@ -623,19 +654,24 @@ public:
|
|
623
654
|
idx_t batch_index;
|
624
655
|
//! The task this thread is working on
|
625
656
|
TaskPtr task;
|
657
|
+
//! The task storage
|
658
|
+
Task task_local;
|
626
659
|
//! The current source being processed
|
627
660
|
optional_ptr<WindowHashGroup> window_hash_group;
|
628
661
|
//! The scan cursor
|
629
|
-
unique_ptr<
|
630
|
-
//! Buffer for the inputs
|
631
|
-
DataChunk input_chunk;
|
662
|
+
unique_ptr<WindowCollectionChunkScanner> scanner;
|
632
663
|
//! Buffer for window results
|
633
664
|
DataChunk output_chunk;
|
634
665
|
|
635
666
|
protected:
|
636
|
-
|
637
|
-
void
|
638
|
-
|
667
|
+
//! Compute a mask range
|
668
|
+
void Mask(ExecutionContext &context, InterruptState &interrupt);
|
669
|
+
//! Sink tuples into function global states
|
670
|
+
void Sink(ExecutionContext &context, InterruptState &interrupt);
|
671
|
+
//! Post process function global state construction
|
672
|
+
void Finalize(ExecutionContext &context, InterruptState &interrupt);
|
673
|
+
//! Get a chunk by evaluating functions
|
674
|
+
void GetData(ExecutionContext &context, DataChunk &chunk, InterruptState &interrupt);
|
639
675
|
|
640
676
|
//! Storage and evaluation for the fully materialised data
|
641
677
|
unique_ptr<WindowBuilder> builder;
|
@@ -651,7 +687,26 @@ protected:
|
|
651
687
|
DataChunk eval_chunk;
|
652
688
|
};
|
653
689
|
|
654
|
-
|
690
|
+
idx_t WindowHashGroup::InitTasks(idx_t per_thread_p) {
|
691
|
+
per_thread = per_thread_p;
|
692
|
+
group_threads = (rows->ChunkCount() + per_thread - 1) / per_thread;
|
693
|
+
thread_states.resize(GetThreadCount());
|
694
|
+
|
695
|
+
return GetTaskCount();
|
696
|
+
}
|
697
|
+
|
698
|
+
void WindowLocalSourceState::Mask(ExecutionContext &context, InterruptState &interrupt) {
|
699
|
+
D_ASSERT(task);
|
700
|
+
D_ASSERT(task->stage == WindowGroupStage::MASK);
|
701
|
+
|
702
|
+
window_hash_group->ComputeMasks(task->begin_idx, task->end_idx);
|
703
|
+
|
704
|
+
// Mark this range as done
|
705
|
+
window_hash_group->masked += (task->end_idx - task->begin_idx);
|
706
|
+
task->begin_idx = task->end_idx;
|
707
|
+
}
|
708
|
+
|
709
|
+
WindowHashGroup::ExecutorGlobalStates &WindowHashGroup::GetGlobalStates(ClientContext &client) {
|
655
710
|
// Single-threaded building as this is mostly memory allocation
|
656
711
|
lock_guard<mutex> gestate_guard(lock);
|
657
712
|
const auto &executors = gsink.executors;
|
@@ -663,13 +718,13 @@ WindowHashGroup::ExecutorGlobalStates &WindowHashGroup::Initialize(WindowGlobalS
|
|
663
718
|
for (auto &wexec : executors) {
|
664
719
|
auto &wexpr = wexec->wexpr;
|
665
720
|
auto &order_mask = order_masks[wexpr.partitions.size() + wexpr.orders.size()];
|
666
|
-
gestates.emplace_back(wexec->GetGlobalState(count, partition_mask, order_mask));
|
721
|
+
gestates.emplace_back(wexec->GetGlobalState(client, count, partition_mask, order_mask));
|
667
722
|
}
|
668
723
|
|
669
724
|
return gestates;
|
670
725
|
}
|
671
726
|
|
672
|
-
void WindowLocalSourceState::Sink() {
|
727
|
+
void WindowLocalSourceState::Sink(ExecutionContext &context, InterruptState &interrupt) {
|
673
728
|
D_ASSERT(task);
|
674
729
|
D_ASSERT(task->stage == WindowGroupStage::SINK);
|
675
730
|
|
@@ -678,67 +733,61 @@ void WindowLocalSourceState::Sink() {
|
|
678
733
|
|
679
734
|
// Create the global state for each function
|
680
735
|
// These can be large so we defer building them until we are ready.
|
681
|
-
auto &gestates = window_hash_group->
|
736
|
+
auto &gestates = window_hash_group->GetGlobalStates(context.client);
|
682
737
|
|
683
738
|
// Set up the local states
|
684
739
|
auto &local_states = window_hash_group->thread_states.at(task->thread_idx);
|
685
740
|
if (local_states.empty()) {
|
686
741
|
for (idx_t w = 0; w < executors.size(); ++w) {
|
687
|
-
local_states.emplace_back(executors[w]->GetLocalState(*gestates[w]));
|
742
|
+
local_states.emplace_back(executors[w]->GetLocalState(context, *gestates[w]));
|
688
743
|
}
|
689
744
|
}
|
690
745
|
|
691
746
|
// First pass over the input without flushing
|
747
|
+
scanner = window_hash_group->GetScanner(task->begin_idx);
|
748
|
+
if (!scanner) {
|
749
|
+
return;
|
750
|
+
}
|
692
751
|
for (; task->begin_idx < task->end_idx; ++task->begin_idx) {
|
693
|
-
|
694
|
-
if (!scanner) {
|
752
|
+
const idx_t input_idx = scanner->Scanned();
|
753
|
+
if (!scanner->Scan()) {
|
695
754
|
break;
|
696
755
|
}
|
697
|
-
|
698
|
-
// TODO: Try to align on validity mask boundaries by starting ragged?
|
699
|
-
idx_t input_idx = scanner->Scanned();
|
700
|
-
input_chunk.Reset();
|
701
|
-
scanner->Scan(input_chunk);
|
702
|
-
if (input_chunk.size() == 0) {
|
703
|
-
break;
|
704
|
-
}
|
756
|
+
auto &input_chunk = scanner->chunk;
|
705
757
|
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
}
|
716
|
-
|
717
|
-
builder->Sink(coll_chunk, input_idx);
|
758
|
+
// Compute fully materialised expressions
|
759
|
+
if (coll_chunk.data.empty()) {
|
760
|
+
coll_chunk.SetCardinality(input_chunk);
|
761
|
+
} else {
|
762
|
+
coll_chunk.Reset();
|
763
|
+
coll_exec.Execute(input_chunk, coll_chunk);
|
764
|
+
auto collection = window_hash_group->collection.get();
|
765
|
+
if (!builder || &builder->collection != collection) {
|
766
|
+
builder = make_uniq<WindowBuilder>(*collection);
|
718
767
|
}
|
719
768
|
|
720
|
-
|
721
|
-
|
722
|
-
sink_chunk.SetCardinality(input_chunk);
|
723
|
-
} else {
|
724
|
-
sink_chunk.Reset();
|
725
|
-
sink_exec.Execute(input_chunk, sink_chunk);
|
726
|
-
}
|
769
|
+
builder->Sink(coll_chunk, input_idx);
|
770
|
+
}
|
727
771
|
|
728
|
-
|
729
|
-
|
730
|
-
|
772
|
+
// Compute sink expressions
|
773
|
+
if (sink_chunk.data.empty()) {
|
774
|
+
sink_chunk.SetCardinality(input_chunk);
|
775
|
+
} else {
|
776
|
+
sink_chunk.Reset();
|
777
|
+
sink_exec.Execute(input_chunk, sink_chunk);
|
778
|
+
}
|
731
779
|
|
732
|
-
|
780
|
+
for (idx_t w = 0; w < executors.size(); ++w) {
|
781
|
+
OperatorSinkInput sink {*gestates[w], *local_states[w], interrupt};
|
782
|
+
executors[w]->Sink(context, sink_chunk, coll_chunk, input_idx, sink);
|
733
783
|
}
|
734
784
|
|
735
|
-
|
736
|
-
scanner->SwizzleBlock(task->begin_idx);
|
737
|
-
scanner.reset();
|
785
|
+
window_hash_group->sunk += input_chunk.size();
|
738
786
|
}
|
787
|
+
scanner.reset();
|
739
788
|
}
|
740
789
|
|
741
|
-
void WindowLocalSourceState::Finalize() {
|
790
|
+
void WindowLocalSourceState::Finalize(ExecutionContext &context, InterruptState &interrupt) {
|
742
791
|
D_ASSERT(task);
|
743
792
|
D_ASSERT(task->stage == WindowGroupStage::FINALIZE);
|
744
793
|
|
@@ -755,7 +804,8 @@ void WindowLocalSourceState::Finalize() {
|
|
755
804
|
auto &gestates = window_hash_group->gestates;
|
756
805
|
auto &local_states = window_hash_group->thread_states.at(task->thread_idx);
|
757
806
|
for (idx_t w = 0; w < executors.size(); ++w) {
|
758
|
-
|
807
|
+
OperatorSinkInput sink {*gestates[w], *local_states[w], interrupt};
|
808
|
+
executors[w]->Finalize(context, window_hash_group->collection, sink);
|
759
809
|
}
|
760
810
|
|
761
811
|
// Mark this range as done
|
@@ -764,19 +814,16 @@ void WindowLocalSourceState::Finalize() {
|
|
764
814
|
}
|
765
815
|
|
766
816
|
WindowLocalSourceState::WindowLocalSourceState(WindowGlobalSourceState &gsource)
|
767
|
-
: gsource(gsource), batch_index(0), coll_exec(gsource.
|
768
|
-
eval_exec(gsource.
|
817
|
+
: gsource(gsource), batch_index(0), coll_exec(gsource.client), sink_exec(gsource.client),
|
818
|
+
eval_exec(gsource.client) {
|
769
819
|
auto &gsink = gsource.gsink;
|
770
|
-
auto &global_partition = *gsink.global_partition;
|
771
|
-
|
772
|
-
input_chunk.Initialize(global_partition.allocator, global_partition.payload_types);
|
773
820
|
|
774
821
|
vector<LogicalType> output_types;
|
775
822
|
for (auto &wexec : gsink.executors) {
|
776
823
|
auto &wexpr = wexec->wexpr;
|
777
824
|
output_types.emplace_back(wexpr.return_type);
|
778
825
|
}
|
779
|
-
output_chunk.Initialize(
|
826
|
+
output_chunk.Initialize(gsource.client, output_types);
|
780
827
|
|
781
828
|
auto &shared = gsink.shared;
|
782
829
|
shared.PrepareCollection(coll_exec, coll_chunk);
|
@@ -786,7 +833,7 @@ WindowLocalSourceState::WindowLocalSourceState(WindowGlobalSourceState &gsource)
|
|
786
833
|
++gsource.locals;
|
787
834
|
}
|
788
835
|
|
789
|
-
bool WindowGlobalSourceState::TryNextTask(TaskPtr &task) {
|
836
|
+
bool WindowGlobalSourceState::TryNextTask(TaskPtr &task, Task &task_local) {
|
790
837
|
auto guard = Lock();
|
791
838
|
FinishTask(task);
|
792
839
|
|
@@ -796,13 +843,13 @@ bool WindowGlobalSourceState::TryNextTask(TaskPtr &task) {
|
|
796
843
|
}
|
797
844
|
|
798
845
|
// Run through the active groups looking for one that can assign a task
|
799
|
-
auto &gpart = *gsink.global_partition;
|
800
846
|
for (const auto &group_idx : active_groups) {
|
801
|
-
auto &window_hash_group =
|
847
|
+
auto &window_hash_group = window_hash_groups[group_idx];
|
802
848
|
if (window_hash_group->TryPrepareNextStage()) {
|
803
849
|
UnblockTasks(guard);
|
804
850
|
}
|
805
|
-
if (window_hash_group->TryNextTask(
|
851
|
+
if (window_hash_group->TryNextTask(task_local)) {
|
852
|
+
task = task_local;
|
806
853
|
++started;
|
807
854
|
return true;
|
808
855
|
}
|
@@ -813,15 +860,16 @@ bool WindowGlobalSourceState::TryNextTask(TaskPtr &task) {
|
|
813
860
|
const auto group_idx = partition_blocks[next_group++].second;
|
814
861
|
active_groups.emplace_back(group_idx);
|
815
862
|
|
816
|
-
auto &window_hash_group =
|
863
|
+
auto &window_hash_group = window_hash_groups[group_idx];
|
817
864
|
if (window_hash_group->TryPrepareNextStage()) {
|
818
865
|
UnblockTasks(guard);
|
819
866
|
}
|
820
|
-
if (!window_hash_group->TryNextTask(
|
867
|
+
if (!window_hash_group->TryNextTask(task_local)) {
|
821
868
|
// Group has no tasks (empty?)
|
822
869
|
continue;
|
823
870
|
}
|
824
871
|
|
872
|
+
task = task_local;
|
825
873
|
++started;
|
826
874
|
return true;
|
827
875
|
}
|
@@ -836,17 +884,19 @@ void WindowGlobalSourceState::FinishTask(TaskPtr task) {
|
|
836
884
|
return;
|
837
885
|
}
|
838
886
|
|
839
|
-
auto &gpart = *gsink.global_partition;
|
840
887
|
const auto group_idx = task->group_idx;
|
841
|
-
auto &finished_hash_group =
|
888
|
+
auto &finished_hash_group = window_hash_groups[group_idx];
|
842
889
|
D_ASSERT(finished_hash_group);
|
843
890
|
|
844
|
-
if (++finished_hash_group->completed >= finished_hash_group->
|
891
|
+
if (++finished_hash_group->completed >= finished_hash_group->GetTaskCount()) {
|
845
892
|
finished_hash_group.reset();
|
846
893
|
// Remove it from the active groups
|
847
894
|
auto &v = active_groups;
|
848
895
|
v.erase(std::remove(v.begin(), v.end(), group_idx), v.end());
|
849
896
|
}
|
897
|
+
|
898
|
+
// Count the global tasks completed.
|
899
|
+
++completed;
|
850
900
|
}
|
851
901
|
|
852
902
|
bool WindowLocalSourceState::TryAssignTask() {
|
@@ -862,30 +912,32 @@ bool WindowLocalSourceState::TryAssignTask() {
|
|
862
912
|
// Scanner first, as it may be referencing sort blocks in the hash group
|
863
913
|
scanner.reset();
|
864
914
|
|
865
|
-
return gsource.TryNextTask(task);
|
915
|
+
return gsource.TryNextTask(task, task_local);
|
866
916
|
}
|
867
917
|
|
868
|
-
void WindowLocalSourceState::ExecuteTask(DataChunk &result) {
|
869
|
-
auto &gsink = gsource.gsink;
|
870
|
-
|
918
|
+
void WindowLocalSourceState::ExecuteTask(ExecutionContext &context, DataChunk &result, InterruptState &interrupt) {
|
871
919
|
// Update the hash group
|
872
|
-
window_hash_group =
|
920
|
+
window_hash_group = gsource.window_hash_groups[task->group_idx].get();
|
873
921
|
|
874
922
|
// Process the new state
|
875
923
|
switch (task->stage) {
|
924
|
+
case WindowGroupStage::MASK:
|
925
|
+
Mask(context, interrupt);
|
926
|
+
D_ASSERT(TaskFinished());
|
927
|
+
break;
|
876
928
|
case WindowGroupStage::SINK:
|
877
|
-
Sink();
|
929
|
+
Sink(context, interrupt);
|
878
930
|
D_ASSERT(TaskFinished());
|
879
931
|
break;
|
880
932
|
case WindowGroupStage::FINALIZE:
|
881
|
-
Finalize();
|
933
|
+
Finalize(context, interrupt);
|
882
934
|
D_ASSERT(TaskFinished());
|
883
935
|
break;
|
884
936
|
case WindowGroupStage::GETDATA:
|
885
937
|
D_ASSERT(!TaskFinished());
|
886
|
-
GetData(result);
|
938
|
+
GetData(context, result, interrupt);
|
887
939
|
break;
|
888
|
-
|
940
|
+
case WindowGroupStage::DONE:
|
889
941
|
throw InternalException("Invalid window source state.");
|
890
942
|
}
|
891
943
|
|
@@ -895,17 +947,15 @@ void WindowLocalSourceState::ExecuteTask(DataChunk &result) {
|
|
895
947
|
}
|
896
948
|
}
|
897
949
|
|
898
|
-
void WindowLocalSourceState::GetData(DataChunk &result) {
|
950
|
+
void WindowLocalSourceState::GetData(ExecutionContext &context, DataChunk &result, InterruptState &interrupt) {
|
899
951
|
D_ASSERT(window_hash_group->GetStage() == WindowGroupStage::GETDATA);
|
900
952
|
|
901
|
-
|
902
|
-
|
903
|
-
batch_index = window_hash_group->batch_base + task->begin_idx;
|
904
|
-
}
|
953
|
+
window_hash_group->UpdateScanner(scanner, task->begin_idx);
|
954
|
+
batch_index = window_hash_group->batch_base + task->begin_idx;
|
905
955
|
|
906
956
|
const auto position = scanner->Scanned();
|
907
|
-
input_chunk
|
908
|
-
scanner->Scan(
|
957
|
+
auto &input_chunk = scanner->chunk;
|
958
|
+
scanner->Scan();
|
909
959
|
|
910
960
|
const auto &executors = gsource.gsink.executors;
|
911
961
|
auto &gestates = window_hash_group->gestates;
|
@@ -913,8 +963,6 @@ void WindowLocalSourceState::GetData(DataChunk &result) {
|
|
913
963
|
output_chunk.Reset();
|
914
964
|
for (idx_t expr_idx = 0; expr_idx < executors.size(); ++expr_idx) {
|
915
965
|
auto &executor = *executors[expr_idx];
|
916
|
-
auto &gstate = *gestates[expr_idx];
|
917
|
-
auto &lstate = *local_states[expr_idx];
|
918
966
|
auto &result = output_chunk.data[expr_idx];
|
919
967
|
if (eval_chunk.data.empty()) {
|
920
968
|
eval_chunk.SetCardinality(input_chunk);
|
@@ -922,7 +970,8 @@ void WindowLocalSourceState::GetData(DataChunk &result) {
|
|
922
970
|
eval_chunk.Reset();
|
923
971
|
eval_exec.Execute(input_chunk, eval_chunk);
|
924
972
|
}
|
925
|
-
|
973
|
+
OperatorSinkInput sink {*gestates[expr_idx], *local_states[expr_idx], interrupt};
|
974
|
+
executor.Evaluate(context, position, eval_chunk, result, sink);
|
926
975
|
}
|
927
976
|
output_chunk.SetCardinality(input_chunk);
|
928
977
|
output_chunk.Verify();
|
@@ -936,10 +985,8 @@ void WindowLocalSourceState::GetData(DataChunk &result) {
|
|
936
985
|
result.data[out_idx++].Reference(output_chunk.data[col_idx]);
|
937
986
|
}
|
938
987
|
|
939
|
-
//
|
940
|
-
|
941
|
-
++task->begin_idx;
|
942
|
-
}
|
988
|
+
// Move to the next chunk
|
989
|
+
++task->begin_idx;
|
943
990
|
|
944
991
|
result.Verify();
|
945
992
|
}
|
@@ -950,9 +997,9 @@ unique_ptr<LocalSourceState> PhysicalWindow::GetLocalSourceState(ExecutionContex
|
|
950
997
|
return make_uniq<WindowLocalSourceState>(gsource);
|
951
998
|
}
|
952
999
|
|
953
|
-
unique_ptr<GlobalSourceState> PhysicalWindow::GetGlobalSourceState(ClientContext &
|
1000
|
+
unique_ptr<GlobalSourceState> PhysicalWindow::GetGlobalSourceState(ClientContext &client) const {
|
954
1001
|
auto &gsink = sink_state->Cast<WindowGlobalSinkState>();
|
955
|
-
return make_uniq<WindowGlobalSourceState>(
|
1002
|
+
return make_uniq<WindowGlobalSourceState>(client, gsink);
|
956
1003
|
}
|
957
1004
|
|
958
1005
|
bool PhysicalWindow::SupportsPartitioning(const OperatorPartitionInfo &partition_info) const {
|
@@ -980,19 +1027,22 @@ OrderPreservationType PhysicalWindow::SourceOrder() const {
|
|
980
1027
|
return OrderPreservationType::FIXED_ORDER;
|
981
1028
|
}
|
982
1029
|
|
983
|
-
ProgressData PhysicalWindow::GetProgress(ClientContext &
|
1030
|
+
ProgressData PhysicalWindow::GetProgress(ClientContext &client, GlobalSourceState &gsource_p) const {
|
984
1031
|
auto &gsource = gsource_p.Cast<WindowGlobalSourceState>();
|
985
|
-
const auto returned = gsource.returned.load();
|
986
|
-
|
987
1032
|
auto &gsink = gsource.gsink;
|
988
|
-
const auto count = gsink.
|
1033
|
+
const auto count = gsink.count.load();
|
1034
|
+
const auto completed = gsource.completed.load();
|
1035
|
+
|
989
1036
|
ProgressData res;
|
990
1037
|
if (count) {
|
991
|
-
res.done = double(
|
992
|
-
res.total = double(
|
1038
|
+
res.done = double(completed);
|
1039
|
+
res.total = double(gsource.total_tasks);
|
1040
|
+
// Convert to tuples.
|
1041
|
+
res.Normalize(double(count));
|
993
1042
|
} else {
|
994
1043
|
res.SetInvalid();
|
995
1044
|
}
|
1045
|
+
|
996
1046
|
return res;
|
997
1047
|
}
|
998
1048
|
|
@@ -1007,16 +1057,14 @@ OperatorPartitionData PhysicalWindow::GetPartitionData(ExecutionContext &context
|
|
1007
1057
|
}
|
1008
1058
|
|
1009
1059
|
SourceResultType PhysicalWindow::GetData(ExecutionContext &context, DataChunk &chunk,
|
1010
|
-
OperatorSourceInput &
|
1011
|
-
auto &gsource =
|
1012
|
-
auto &lsource =
|
1013
|
-
|
1014
|
-
gsource.CreateTaskList();
|
1060
|
+
OperatorSourceInput &source) const {
|
1061
|
+
auto &gsource = source.global_state.Cast<WindowGlobalSourceState>();
|
1062
|
+
auto &lsource = source.local_state.Cast<WindowLocalSourceState>();
|
1015
1063
|
|
1016
1064
|
while (gsource.HasUnfinishedTasks() && chunk.size() == 0) {
|
1017
1065
|
if (!lsource.TaskFinished() || lsource.TryAssignTask()) {
|
1018
1066
|
try {
|
1019
|
-
lsource.ExecuteTask(chunk);
|
1067
|
+
lsource.ExecuteTask(context, chunk, source.interrupt_state);
|
1020
1068
|
} catch (...) {
|
1021
1069
|
gsource.stopped = true;
|
1022
1070
|
throw;
|
@@ -1030,13 +1078,11 @@ SourceResultType PhysicalWindow::GetData(ExecutionContext &context, DataChunk &c
|
|
1030
1078
|
} else {
|
1031
1079
|
// there are more tasks available, but we can't execute them yet
|
1032
1080
|
// block the source
|
1033
|
-
return gsource.BlockSource(guard,
|
1081
|
+
return gsource.BlockSource(guard, source.interrupt_state);
|
1034
1082
|
}
|
1035
1083
|
}
|
1036
1084
|
}
|
1037
1085
|
|
1038
|
-
gsource.returned += chunk.size();
|
1039
|
-
|
1040
1086
|
if (chunk.size() == 0) {
|
1041
1087
|
return SourceResultType::FINISHED;
|
1042
1088
|
}
|