duckdb 0.10.2-dev0.0 → 0.10.2-dev3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +22 -18
- package/binding.gyp.in +3 -0
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-timezone.cpp +3 -1
- package/src/duckdb/extension/icu/icu_extension.cpp +6 -2
- package/src/duckdb/extension/json/buffered_json_reader.cpp +10 -3
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +2 -0
- package/src/duckdb/extension/json/include/json_scan.hpp +13 -7
- package/src/duckdb/extension/json/include/json_serializer.hpp +5 -4
- package/src/duckdb/extension/json/include/json_structure.hpp +3 -3
- package/src/duckdb/extension/json/json_functions/json_serialize_plan.cpp +15 -5
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +15 -6
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +21 -20
- package/src/duckdb/extension/json/json_functions/read_json.cpp +37 -3
- package/src/duckdb/extension/json/json_functions.cpp +7 -2
- package/src/duckdb/extension/json/json_scan.cpp +57 -33
- package/src/duckdb/extension/parquet/column_reader.cpp +12 -3
- package/src/duckdb/extension/parquet/column_writer.cpp +44 -7
- package/src/duckdb/extension/parquet/include/parquet_writer.hpp +5 -1
- package/src/duckdb/extension/parquet/parquet_extension.cpp +30 -3
- package/src/duckdb/extension/parquet/parquet_metadata.cpp +1 -1
- package/src/duckdb/extension/parquet/parquet_writer.cpp +4 -2
- package/src/duckdb/extension/parquet/zstd_file_system.cpp +1 -1
- package/src/duckdb/src/catalog/catalog.cpp +5 -1
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +21 -5
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +8 -9
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +3 -7
- package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +6 -7
- package/src/duckdb/src/catalog/catalog_entry.cpp +8 -0
- package/src/duckdb/src/catalog/catalog_search_path.cpp +5 -0
- package/src/duckdb/src/catalog/catalog_set.cpp +2 -2
- package/src/duckdb/src/catalog/default/default_functions.cpp +6 -6
- package/src/duckdb/src/catalog/default/default_schemas.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_views.cpp +7 -7
- package/src/duckdb/src/catalog/dependency_catalog_set.cpp +2 -1
- package/src/duckdb/src/catalog/dependency_list.cpp +92 -8
- package/src/duckdb/src/catalog/dependency_manager.cpp +53 -68
- package/src/duckdb/src/catalog/duck_catalog.cpp +1 -1
- package/src/duckdb/src/common/adbc/adbc.cpp +287 -45
- package/src/duckdb/src/common/arrow/appender/union_data.cpp +2 -2
- package/src/duckdb/src/common/box_renderer.cpp +12 -12
- package/src/duckdb/src/common/crypto/md5.cpp +2 -1
- package/src/duckdb/src/common/enum_util.cpp +307 -1
- package/src/duckdb/src/common/enums/expression_type.cpp +4 -0
- package/src/duckdb/src/common/enums/optimizer_type.cpp +1 -1
- package/src/duckdb/src/common/file_system.cpp +60 -13
- package/src/duckdb/src/common/filename_pattern.cpp +13 -13
- package/src/duckdb/src/common/gzip_file_system.cpp +1 -1
- package/src/duckdb/src/common/http_state.cpp +1 -1
- package/src/duckdb/src/common/local_file_system.cpp +72 -71
- package/src/duckdb/src/common/multi_file_reader.cpp +48 -28
- package/src/duckdb/src/common/row_operations/row_matcher.cpp +2 -2
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +13 -1
- package/src/duckdb/src/common/serializer/buffered_file_writer.cpp +32 -13
- package/src/duckdb/src/common/string_util.cpp +2 -3
- package/src/duckdb/src/common/tree_renderer.cpp +32 -67
- package/src/duckdb/src/common/types/bit.cpp +6 -6
- package/src/duckdb/src/common/types/data_chunk.cpp +2 -2
- package/src/duckdb/src/common/types/hash.cpp +6 -6
- package/src/duckdb/src/common/types/hyperloglog.cpp +2 -0
- package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +13 -0
- package/src/duckdb/src/common/types/row/tuple_data_layout.cpp +5 -7
- package/src/duckdb/src/common/types/uuid.cpp +1 -1
- package/src/duckdb/src/common/types/vector.cpp +22 -14
- package/src/duckdb/src/common/types.cpp +8 -1
- package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +20 -18
- package/src/duckdb/src/common/vector_operations/generators.cpp +1 -1
- package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +267 -110
- package/src/duckdb/src/common/vector_operations/vector_hash.cpp +52 -23
- package/src/duckdb/src/common/virtual_file_system.cpp +33 -20
- package/src/duckdb/src/core_functions/aggregate/algebraic/avg.cpp +2 -2
- package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +3 -3
- package/src/duckdb/src/core_functions/aggregate/distributive/sum.cpp +31 -16
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +3 -0
- package/src/duckdb/src/core_functions/aggregate/nested/list.cpp +2 -0
- package/src/duckdb/src/core_functions/core_functions.cpp +1 -1
- package/src/duckdb/src/core_functions/function_list.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/date/time_bucket.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/generic/system_functions.cpp +46 -17
- package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +1 -1
- package/src/duckdb/src/core_functions/scalar/list/flatten.cpp +82 -45
- package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/list/list_sort.cpp +3 -0
- package/src/duckdb/src/core_functions/scalar/math/numeric.cpp +3 -2
- package/src/duckdb/src/core_functions/scalar/string/hex.cpp +2 -4
- package/src/duckdb/src/core_functions/scalar/string/repeat.cpp +12 -21
- package/src/duckdb/src/execution/column_binding_resolver.cpp +2 -10
- package/src/duckdb/src/execution/expression_executor/execute_comparison.cpp +133 -66
- package/src/duckdb/src/execution/expression_executor/execute_function.cpp +0 -2
- package/src/duckdb/src/execution/expression_executor.cpp +0 -4
- package/src/duckdb/src/execution/expression_executor_state.cpp +1 -1
- package/src/duckdb/src/execution/index/art/art.cpp +2 -2
- package/src/duckdb/src/execution/index/unknown_index.cpp +13 -13
- package/src/duckdb/src/execution/join_hashtable.cpp +1 -1
- package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_mark.cpp +0 -1
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer.cpp +10 -7
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.cpp +32 -1
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_file_handle.cpp +16 -2
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/scanner_boundary.cpp +7 -7
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +354 -159
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +11 -2
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +22 -7
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.cpp +10 -10
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_file_scanner.cpp +9 -18
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/global_csv_state.cpp +180 -47
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_error.cpp +100 -58
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +88 -21
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +12 -13
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +2 -0
- package/src/duckdb/src/execution/operator/persistent/csv_rejects_table.cpp +118 -23
- package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +14 -5
- package/src/duckdb/src/execution/operator/persistent/physical_copy_database.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +5 -5
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_simple.cpp +0 -9
- package/src/duckdb/src/execution/physical_plan/plan_vacuum.cpp +18 -0
- package/src/duckdb/src/execution/physical_plan_generator.cpp +5 -3
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +81 -106
- package/src/duckdb/src/execution/reservoir_sample.cpp +1 -1
- package/src/duckdb/src/execution/window_executor.cpp +48 -28
- package/src/duckdb/src/execution/window_segment_tree.cpp +20 -23
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +1 -1
- package/src/duckdb/src/function/cast/enum_casts.cpp +20 -55
- package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +10 -9
- package/src/duckdb/src/function/cast_rules.cpp +9 -1
- package/src/duckdb/src/function/compression_config.cpp +1 -1
- package/src/duckdb/src/function/function_binder.cpp +45 -44
- package/src/duckdb/src/function/function_set.cpp +9 -9
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +1 -2
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_integral.cpp +21 -5
- package/src/duckdb/src/function/scalar/compressed_materialization/compress_string.cpp +2 -2
- package/src/duckdb/src/function/scalar/list/list_select.cpp +5 -2
- package/src/duckdb/src/function/scalar/list/list_zip.cpp +5 -4
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +60 -32
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +1 -1
- package/src/duckdb/src/function/scalar/strftime_format.cpp +31 -25
- package/src/duckdb/src/function/scalar/string/caseconvert.cpp +6 -6
- package/src/duckdb/src/function/scalar/string/length.cpp +23 -2
- package/src/duckdb/src/function/scalar/string/like.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +1 -1
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +3 -3
- package/src/duckdb/src/function/table/arrow/arrow_array_scan_state.cpp +1 -1
- package/src/duckdb/src/function/table/arrow.cpp +7 -1
- package/src/duckdb/src/function/table/copy_csv.cpp +17 -13
- package/src/duckdb/src/function/table/read_csv.cpp +52 -39
- package/src/duckdb/src/function/table/sniff_csv.cpp +7 -13
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +7 -1
- package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +12 -2
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +1 -2
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +2 -2
- package/src/duckdb/src/function/table/system/pragma_metadata_info.cpp +9 -2
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +10 -6
- package/src/duckdb/src/function/table/table_scan.cpp +1 -4
- package/src/duckdb/src/function/table/version/pragma_version.cpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +6 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +6 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/default/default_functions.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/dependency.hpp +26 -4
- package/src/duckdb/src/include/duckdb/catalog/dependency_list.hpp +39 -6
- package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +19 -14
- package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/standard_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_wrapper.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/bit_utils.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/box_renderer.hpp +16 -16
- package/src/duckdb/src/include/duckdb/common/crypto/md5.hpp +0 -1
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +32 -0
- package/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +4 -2
- package/src/duckdb/src/include/duckdb/common/exception/binder_exception.hpp +14 -10
- package/src/duckdb/src/include/duckdb/common/exception/catalog_exception.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/exception/conversion_exception.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/exception/http_exception.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/exception/parser_exception.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/exception/transaction_exception.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/exception.hpp +57 -58
- package/src/duckdb/src/include/duckdb/common/exception_format_value.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/file_open_flags.hpp +134 -0
- package/src/duckdb/src/include/duckdb/common/file_opener.hpp +9 -6
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +35 -36
- package/src/duckdb/src/include/duckdb/common/filename_pattern.hpp +4 -6
- package/src/duckdb/src/include/duckdb/common/fixed_size_map.hpp +13 -13
- package/src/duckdb/src/include/duckdb/common/helper.hpp +42 -47
- package/src/duckdb/src/include/duckdb/common/http_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/hugeint.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/index_vector.hpp +10 -10
- package/src/duckdb/src/include/duckdb/common/local_file_system.hpp +13 -10
- package/src/duckdb/src/include/duckdb/common/memory_safety.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/opener_file_system.hpp +50 -24
- package/src/duckdb/src/include/duckdb/common/operator/abs.hpp +12 -4
- package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/pipe_file_system.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/platform.h +1 -1
- package/src/duckdb/src/include/duckdb/common/printer.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/profiler.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/progress_bar/display/terminal_progress_bar_display.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/random_engine.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/re2_regex.hpp +7 -7
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_writer.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/serializer/deserialization_data.hpp +17 -6
- package/src/duckdb/src/include/duckdb/common/serializer/deserializer.hpp +12 -0
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +14 -0
- package/src/duckdb/src/include/duckdb/common/serializer/serializer.hpp +16 -0
- package/src/duckdb/src/include/duckdb/common/sort/duckdb_pdqsort.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/sort/partition_state.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/tree_renderer.hpp +24 -25
- package/src/duckdb/src/include/duckdb/common/typedefs.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/types/cast_helpers.hpp +1 -2
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +10 -10
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_iterators.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/types/column/partitioned_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/constraint_conflict_info.hpp +1 -2
- package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/date.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/hash.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/types/hyperloglog.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/interval.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_layout.hpp +10 -3
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_segment.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +12 -12
- package/src/duckdb/src/include/duckdb/common/types/string_heap.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +21 -20
- package/src/duckdb/src/include/duckdb/common/types/time.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/types/uuid.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +15 -7
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types.hpp +14 -10
- package/src/duckdb/src/include/duckdb/common/uhugeint.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/union_by_name.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/unique_ptr.hpp +15 -14
- package/src/duckdb/src/include/duckdb/common/vector.hpp +21 -21
- package/src/duckdb/src/include/duckdb/common/vector_operations/aggregate_executor.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/vector_operations/general_cast.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/vector_operations/generic_executor.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/vector_operations/unary_executor.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/vector_operations/vector_operations.hpp +50 -32
- package/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +10 -11
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/distributive_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/sum_helpers.hpp +13 -1
- package/src/duckdb/src/include/duckdb/core_functions/function_list.hpp +1 -1
- package/src/duckdb/src/include/duckdb/core_functions/lambda_functions.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/column_binding_resolver.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/expression_executor.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +2 -5
- package/src/duckdb/src/include/duckdb/execution/merge_sort_tree.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/aggregate_object.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/distinct_aggregate_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/base_scanner.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/column_count_scanner.hpp +0 -3
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer.hpp +9 -6
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer_manager.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_error.hpp +40 -22
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_handle.hpp +5 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_file_scanner.hpp +1 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_option.hpp +6 -4
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +24 -10
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_state_machine.hpp +4 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/global_csv_state.hpp +3 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/skip_scanner.hpp +0 -3
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/string_value_scanner.hpp +58 -17
- 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_explain_analyze.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +4 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_rejects_table.hpp +16 -5
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +6 -6
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/window_executor.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +5 -5
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/cast/vector_cast_helpers.hpp +6 -6
- package/src/duckdb/src/include/duckdb/function/compression_function.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +10 -13
- package/src/duckdb/src/include/duckdb/function/function.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/function_binder.hpp +24 -23
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/function_set.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/pragma_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar/regexp.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +7 -7
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +6 -6
- package/src/duckdb/src/include/duckdb/function/table/arrow/arrow_duck_schema.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +1 -3
- package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +12 -11
- package/src/duckdb/src/include/duckdb/function/udf_function.hpp +66 -60
- package/src/duckdb/src/include/duckdb/main/appender.hpp +6 -6
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/buffered_data/buffered_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/buffered_data/simple_buffered_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/chunk_scan_state/query_result.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/client_context_file_opener.hpp +3 -2
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/client_properties.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/config.hpp +14 -5
- package/src/duckdb/src/include/duckdb/main/connection.hpp +27 -26
- package/src/duckdb/src/include/duckdb/main/database.hpp +19 -3
- package/src/duckdb/src/include/duckdb/main/database_file_opener.hpp +58 -0
- package/src/duckdb/src/include/duckdb/main/database_path_and_type.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/error_manager.hpp +6 -6
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +8 -0
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/external_dependencies.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/prepared_statement.hpp +8 -8
- package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +2 -59
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +3 -3
- package/src/duckdb/src/include/duckdb/main/relation/query_relation.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/relation.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/secret/secret.hpp +11 -7
- package/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/secret/secret_storage.hpp +4 -4
- package/src/duckdb/src/include/duckdb/main/settings.hpp +78 -70
- package/src/duckdb/src/include/duckdb/optimizer/column_lifetime_analyzer.hpp +45 -0
- package/src/duckdb/src/include/duckdb/optimizer/compressed_materialization.hpp +11 -13
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +2 -2
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cost_model.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_node.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/join_order/relation_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/matcher/expression_matcher.hpp +7 -7
- package/src/duckdb/src/include/duckdb/optimizer/matcher/function_matcher.hpp +7 -7
- package/src/duckdb/src/include/duckdb/optimizer/matcher/type_matcher.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/optimizer.hpp +3 -0
- package/src/duckdb/src/include/duckdb/optimizer/statistics_propagator.hpp +32 -30
- package/src/duckdb/src/include/duckdb/optimizer/unnest_rewriter.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/event.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/executor_task.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parallel/pipeline_event.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/column_list.hpp +4 -4
- package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +49 -8
- package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_scalar_function_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_function_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_database_info.hpp +40 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_function_info.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_pragma_function_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_secret_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/extra_drop_info.hpp +3 -3
- package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +2 -5
- package/src/duckdb/src/include/duckdb/parser/parser.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parser_extension.hpp +3 -3
- package/src/duckdb/src/include/duckdb/parser/query_error_context.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +3 -5
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +16 -9
- package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_expanded_expression.hpp +34 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_subquery_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +5 -8
- package/src/duckdb/src/include/duckdb/planner/expression_binder/column_alias_binder.hpp +3 -4
- package/src/duckdb/src/include/duckdb/planner/expression_binder/group_binder.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/having_binder.hpp +3 -5
- package/src/duckdb/src/include/duckdb/planner/expression_binder/order_binder.hpp +6 -14
- package/src/duckdb/src/include/duckdb/planner/expression_binder/qualify_binder.hpp +3 -6
- package/src/duckdb/src/include/duckdb/planner/expression_binder/select_bind_state.hpp +52 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder/select_binder.hpp +4 -10
- package/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/expression_iterator.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/filter/conjunction_filter.hpp +3 -6
- package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +2 -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_copy_database.hpp +4 -12
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_secret.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_export.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_extension_operator.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_materialized_cte.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_prepare.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +3 -3
- package/src/duckdb/src/include/duckdb/planner/operator/logical_reset.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_vacuum.hpp +52 -0
- package/src/duckdb/src/include/duckdb/planner/operator_extension.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_table_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/query_node/bound_select_node.hpp +5 -4
- package/src/duckdb/src/include/duckdb/planner/subquery/flatten_dependent_join.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +4 -1
- package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/checkpoint/row_group_writer.hpp +2 -3
- package/src/duckdb/src/include/duckdb/storage/checkpoint/string_checkpoint_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +5 -5
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_analyze.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_compress.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alp/alp_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/algorithm/alprd.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_analyze.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_compress.hpp +1 -1
- 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 +3 -3
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/flag_buffer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/leading_zero_buffer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_analyze.hpp +0 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_analyze.hpp +0 -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 +3 -3
- package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/index.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/magic_bytes.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/object_cache.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/optimistic_data_writer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp +4 -1
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +24 -24
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats_union.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/statistics/segment_statistics.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/storage_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +9 -6
- package/src/duckdb/src/include/duckdb/storage/table/append_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/chunk_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +10 -1
- package/src/duckdb/src/include/duckdb/storage/table/data_table_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group_segment_tree.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_version_manager.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/table/segment_lock.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +2 -0
- package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/table/table_statistics.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table_storage_info.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/delete_info.hpp +20 -1
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/transaction_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/undo_buffer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/update_info.hpp +1 -1
- package/src/duckdb/src/main/appender.cpp +1 -1
- package/src/duckdb/src/main/attached_database.cpp +11 -3
- package/src/duckdb/src/main/capi/arrow-c.cpp +6 -2
- package/src/duckdb/src/main/capi/cast/utils-c.cpp +1 -1
- package/src/duckdb/src/main/capi/duckdb-c.cpp +1 -1
- package/src/duckdb/src/main/capi/pending-c.cpp +1 -1
- package/src/duckdb/src/main/capi/prepared-c.cpp +2 -2
- package/src/duckdb/src/main/capi/result-c.cpp +4 -4
- package/src/duckdb/src/main/client_context.cpp +4 -12
- package/src/duckdb/src/main/client_context_file_opener.cpp +15 -3
- package/src/duckdb/src/main/client_data.cpp +5 -0
- package/src/duckdb/src/main/config.cpp +82 -82
- package/src/duckdb/src/main/database.cpp +31 -7
- package/src/duckdb/src/main/database_manager.cpp +3 -2
- package/src/duckdb/src/main/database_path_and_type.cpp +4 -4
- package/src/duckdb/src/main/error_manager.cpp +1 -1
- package/src/duckdb/src/main/extension/extension_alias.cpp +9 -9
- package/src/duckdb/src/main/extension/extension_helper.cpp +10 -5
- package/src/duckdb/src/main/extension/extension_install.cpp +1 -1
- package/src/duckdb/src/main/extension/extension_load.cpp +111 -37
- package/src/duckdb/src/main/query_profiler.cpp +1 -118
- package/src/duckdb/src/main/secret/secret_manager.cpp +1 -2
- package/src/duckdb/src/main/secret/secret_storage.cpp +1 -1
- package/src/duckdb/src/main/settings/settings.cpp +81 -65
- package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +8 -1
- package/src/duckdb/src/optimizer/compressed_materialization/compress_aggregate.cpp +3 -0
- package/src/duckdb/src/optimizer/compressed_materialization.cpp +26 -28
- package/src/duckdb/src/optimizer/cse_optimizer.cpp +5 -5
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +10 -6
- package/src/duckdb/src/optimizer/optimizer.cpp +14 -17
- package/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp +16 -5
- package/src/duckdb/src/optimizer/pushdown/pushdown_inner_join.cpp +7 -4
- package/src/duckdb/src/optimizer/pushdown/pushdown_set_operation.cpp +2 -2
- package/src/duckdb/src/optimizer/remove_unused_columns.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/expression/propagate_aggregate.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_between.cpp +8 -8
- package/src/duckdb/src/optimizer/statistics/expression/propagate_case.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_columnref.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +7 -7
- package/src/duckdb/src/optimizer/statistics/expression/propagate_conjunction.cpp +6 -6
- package/src/duckdb/src/optimizer/statistics/expression/propagate_constant.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_function.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/expression/propagate_operator.cpp +10 -10
- package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_cross_product.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +14 -7
- package/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +9 -9
- package/src/duckdb/src/optimizer/statistics/operator/propagate_limit.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_order.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_projection.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/operator/propagate_set_operation.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/operator/propagate_window.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics_propagator.cpp +39 -18
- package/src/duckdb/src/parallel/pipeline_finish_event.cpp +1 -1
- package/src/duckdb/src/parallel/task_scheduler.cpp +8 -1
- package/src/duckdb/src/parser/constraints/unique_constraint.cpp +4 -2
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +64 -0
- package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +1 -0
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +13 -5
- package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +24 -0
- package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +1 -8
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +2 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +3 -0
- package/src/duckdb/src/parser/transform/statement/transform_delete.cpp +2 -6
- package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +2 -6
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +2 -6
- package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_select.cpp +5 -2
- package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +2 -8
- package/src/duckdb/src/parser/transform/statement/transform_update.cpp +1 -6
- package/src/duckdb/src/parser/transform/statement/transform_use.cpp +3 -2
- package/src/duckdb/src/parser/transformer.cpp +14 -2
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +40 -17
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +8 -3
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +32 -30
- package/src/duckdb/src/planner/binder/query_node/bind_cte_node.cpp +28 -17
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +146 -101
- package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +28 -26
- package/src/duckdb/src/planner/binder/query_node/plan_cte_node.cpp +29 -0
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +10 -10
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +3 -2
- package/src/duckdb/src/planner/binder/statement/bind_copy_database.cpp +23 -28
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +11 -12
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +9 -11
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +10 -13
- package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +3 -3
- package/src/duckdb/src/planner/binder/statement/bind_set.cpp +3 -0
- package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +66 -65
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +54 -46
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +3 -0
- package/src/duckdb/src/planner/binder/tableref/bind_subqueryref.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +5 -5
- package/src/duckdb/src/planner/binder.cpp +78 -6
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +11 -3
- package/src/duckdb/src/planner/expression/bound_expanded_expression.cpp +22 -0
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +11 -58
- package/src/duckdb/src/planner/expression_binder/column_alias_binder.cpp +5 -8
- package/src/duckdb/src/planner/expression_binder/group_binder.cpp +5 -4
- package/src/duckdb/src/planner/expression_binder/having_binder.cpp +5 -19
- package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +8 -8
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +42 -26
- package/src/duckdb/src/planner/expression_binder/qualify_binder.cpp +3 -22
- package/src/duckdb/src/planner/expression_binder/select_bind_state.cpp +52 -0
- package/src/duckdb/src/planner/expression_binder/select_binder.cpp +43 -5
- package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +19 -7
- package/src/duckdb/src/planner/logical_operator.cpp +20 -3
- package/src/duckdb/src/planner/operator/logical_copy_database.cpp +4 -14
- package/src/duckdb/src/planner/operator/logical_delete.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_get.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_insert.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_update.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_vacuum.cpp +65 -0
- package/src/duckdb/src/planner/planner.cpp +4 -4
- package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +26 -27
- package/src/duckdb/src/storage/arena_allocator.cpp +9 -0
- package/src/duckdb/src/storage/buffer/buffer_pool_reservation.cpp +1 -1
- package/src/duckdb/src/storage/buffer_manager.cpp +2 -10
- package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +2 -3
- package/src/duckdb/src/storage/checkpoint_manager.cpp +15 -8
- package/src/duckdb/src/storage/compression/bitpacking.cpp +6 -1
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +1 -1
- package/src/duckdb/src/storage/data_pointer.cpp +1 -1
- package/src/duckdb/src/storage/data_table.cpp +18 -7
- package/src/duckdb/src/storage/local_storage.cpp +8 -5
- package/src/duckdb/src/storage/magic_bytes.cpp +6 -5
- package/src/duckdb/src/storage/partial_block_manager.cpp +1 -1
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +20 -9
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +12 -10
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +23 -0
- package/src/duckdb/src/storage/single_file_block_manager.cpp +46 -19
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +21 -5
- package/src/duckdb/src/storage/statistics/array_stats.cpp +1 -1
- package/src/duckdb/src/storage/statistics/base_statistics.cpp +2 -3
- package/src/duckdb/src/storage/statistics/list_stats.cpp +1 -1
- package/src/duckdb/src/storage/statistics/struct_stats.cpp +1 -1
- package/src/duckdb/src/storage/storage_info.cpp +19 -19
- package/src/duckdb/src/storage/storage_manager.cpp +18 -13
- package/src/duckdb/src/storage/table/chunk_info.cpp +11 -3
- package/src/duckdb/src/storage/table/column_data.cpp +88 -66
- package/src/duckdb/src/storage/table/row_group.cpp +7 -7
- package/src/duckdb/src/storage/table/row_version_manager.cpp +2 -2
- package/src/duckdb/src/storage/table/standard_column_data.cpp +4 -0
- package/src/duckdb/src/storage/table/update_segment.cpp +3 -1
- package/src/duckdb/src/storage/table_index_list.cpp +6 -1
- package/src/duckdb/src/storage/temporary_file_manager.cpp +1 -1
- package/src/duckdb/src/storage/wal_replay.cpp +8 -7
- package/src/duckdb/src/storage/write_ahead_log.cpp +3 -4
- package/src/duckdb/src/transaction/cleanup_state.cpp +10 -3
- package/src/duckdb/src/transaction/commit_state.cpp +11 -4
- package/src/duckdb/src/transaction/duck_transaction.cpp +23 -3
- package/src/duckdb/src/transaction/rollback_state.cpp +1 -1
- package/src/duckdb/src/transaction/transaction_context.cpp +1 -1
- package/src/duckdb/src/transaction/undo_buffer.cpp +3 -1
- package/src/duckdb/third_party/fmt/include/fmt/core.h +0 -5
- package/src/duckdb/third_party/fsst/fsst.h +1 -1
- package/src/duckdb/third_party/fsst/libfsst.cpp +1 -140
- package/src/duckdb/third_party/fsst/libfsst.hpp +0 -13
- package/src/duckdb/third_party/hyperloglog/hyperloglog.hpp +4 -0
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +8 -1
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +2 -1
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +15401 -15354
- package/src/duckdb/third_party/libpg_query/src_backend_parser_scan.cpp +299 -538
- package/src/duckdb/third_party/lz4/lz4.cpp +2605 -0
- package/src/duckdb/third_party/lz4/lz4.hpp +843 -0
- package/src/duckdb/third_party/parquet/parquet_types.cpp +3 -0
- package/src/duckdb/third_party/parquet/parquet_types.h +2 -1
- package/src/duckdb/third_party/re2/re2/bitmap256.cc +44 -0
- package/src/duckdb/third_party/re2/re2/bitmap256.h +3 -35
- package/src/duckdb/third_party/re2/re2/bitstate.cc +31 -24
- package/src/duckdb/third_party/re2/re2/compile.cc +146 -164
- package/src/duckdb/third_party/re2/re2/dfa.cc +174 -181
- package/src/duckdb/third_party/re2/re2/filtered_re2.cc +19 -3
- package/src/duckdb/third_party/re2/re2/filtered_re2.h +27 -23
- package/src/duckdb/third_party/re2/re2/mimics_pcre.cc +21 -11
- package/src/duckdb/third_party/re2/re2/nfa.cc +91 -131
- package/src/duckdb/third_party/re2/re2/onepass.cc +11 -10
- package/src/duckdb/third_party/re2/re2/parse.cc +171 -154
- package/src/duckdb/third_party/re2/re2/perl_groups.cc +35 -35
- package/src/duckdb/third_party/re2/re2/pod_array.h +55 -0
- package/src/duckdb/third_party/re2/re2/prefilter.cc +40 -40
- package/src/duckdb/third_party/re2/re2/prefilter.h +24 -2
- package/src/duckdb/third_party/re2/re2/prefilter_tree.cc +70 -84
- package/src/duckdb/third_party/re2/re2/prefilter_tree.h +5 -4
- package/src/duckdb/third_party/re2/re2/prog.cc +315 -58
- package/src/duckdb/third_party/re2/re2/prog.h +77 -44
- package/src/duckdb/third_party/re2/re2/re2.cc +333 -221
- package/src/duckdb/third_party/re2/re2/re2.h +277 -201
- package/src/duckdb/third_party/re2/re2/regexp.cc +137 -105
- package/src/duckdb/third_party/re2/re2/regexp.h +45 -40
- package/src/duckdb/third_party/re2/re2/set.cc +40 -17
- package/src/duckdb/third_party/re2/re2/set.h +11 -6
- package/src/duckdb/third_party/re2/re2/simplify.cc +50 -41
- package/src/duckdb/third_party/re2/re2/sparse_array.h +392 -0
- package/src/duckdb/third_party/re2/re2/sparse_set.h +264 -0
- package/src/duckdb/third_party/re2/re2/stringpiece.cc +1 -1
- package/src/duckdb/third_party/re2/re2/stringpiece.h +11 -8
- package/src/duckdb/third_party/re2/re2/tostring.cc +8 -6
- package/src/duckdb/third_party/re2/re2/unicode_casefold.cc +39 -10
- package/src/duckdb/third_party/re2/re2/unicode_casefold.h +1 -1
- package/src/duckdb/third_party/re2/re2/unicode_groups.cc +5019 -4566
- package/src/duckdb/third_party/re2/re2/unicode_groups.h +1 -1
- package/src/duckdb/third_party/re2/re2/walker-inl.h +21 -20
- package/src/duckdb/third_party/re2/util/logging.h +14 -18
- package/src/duckdb/third_party/re2/util/mix.h +4 -4
- package/src/duckdb/third_party/re2/util/mutex.h +48 -15
- package/src/duckdb/third_party/re2/util/rune.cc +5 -5
- package/src/duckdb/third_party/re2/util/strutil.cc +1 -16
- package/src/duckdb/third_party/re2/util/strutil.h +1 -3
- package/src/duckdb/third_party/re2/util/utf.h +1 -1
- package/src/duckdb/third_party/re2/util/util.h +9 -1
- package/src/duckdb/third_party/utf8proc/include/utf8proc_wrapper.hpp +2 -0
- package/src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp +36 -1
- package/src/duckdb/ub_src_common.cpp +0 -2
- package/src/duckdb/ub_src_execution_physical_plan.cpp +2 -0
- package/src/duckdb/ub_src_planner_expression.cpp +2 -0
- package/src/duckdb/ub_src_planner_expression_binder.cpp +2 -0
- package/src/duckdb/ub_src_planner_operator.cpp +2 -0
|
@@ -69,13 +69,27 @@ unique_ptr<GroupedAggregateHashTable> RadixPartitionedHashTable::CreateHT(Client
|
|
|
69
69
|
//===--------------------------------------------------------------------===//
|
|
70
70
|
// Sink
|
|
71
71
|
//===--------------------------------------------------------------------===//
|
|
72
|
+
enum class AggregatePartitionState : uint8_t {
|
|
73
|
+
//! Can be finalized
|
|
74
|
+
READY_TO_FINALIZE = 0,
|
|
75
|
+
//! Finalize is in progress
|
|
76
|
+
FINALIZE_IN_PROGRESS = 1,
|
|
77
|
+
//! Finalized, ready to scan
|
|
78
|
+
READY_TO_SCAN = 2
|
|
79
|
+
};
|
|
80
|
+
|
|
72
81
|
struct AggregatePartition {
|
|
73
82
|
explicit AggregatePartition(unique_ptr<TupleDataCollection> data_p)
|
|
74
|
-
: data(std::move(data_p)), progress(0)
|
|
83
|
+
: state(AggregatePartitionState::READY_TO_FINALIZE), data(std::move(data_p)), progress(0) {
|
|
75
84
|
}
|
|
85
|
+
|
|
86
|
+
mutex lock;
|
|
87
|
+
AggregatePartitionState state;
|
|
88
|
+
|
|
76
89
|
unique_ptr<TupleDataCollection> data;
|
|
77
90
|
atomic<double> progress;
|
|
78
|
-
|
|
91
|
+
|
|
92
|
+
vector<InterruptState> blocked_tasks;
|
|
79
93
|
};
|
|
80
94
|
|
|
81
95
|
class RadixHTGlobalSinkState;
|
|
@@ -165,9 +179,7 @@ public:
|
|
|
165
179
|
|
|
166
180
|
//! Partitions that are finalized during GetData
|
|
167
181
|
vector<unique_ptr<AggregatePartition>> partitions;
|
|
168
|
-
|
|
169
|
-
//! For synchronizing finalize tasks
|
|
170
|
-
atomic<idx_t> finalize_idx;
|
|
182
|
+
//! For keeping track of progress
|
|
171
183
|
atomic<idx_t> finalize_done;
|
|
172
184
|
|
|
173
185
|
//! Pin properties when scanning
|
|
@@ -176,16 +188,13 @@ public:
|
|
|
176
188
|
idx_t count_before_combining;
|
|
177
189
|
//! Maximum partition size if all unique
|
|
178
190
|
idx_t max_partition_size;
|
|
179
|
-
|
|
180
|
-
vector<InterruptState> blocked_tasks;
|
|
181
191
|
};
|
|
182
192
|
|
|
183
193
|
RadixHTGlobalSinkState::RadixHTGlobalSinkState(ClientContext &context_p, const RadixPartitionedHashTable &radix_ht_p)
|
|
184
194
|
: context(context_p), temporary_memory_state(TemporaryMemoryManager::Get(context).Register(context)),
|
|
185
195
|
radix_ht(radix_ht_p), config(context, *this), finalized(false), external(false), active_threads(0),
|
|
186
|
-
any_combined(false),
|
|
187
|
-
|
|
188
|
-
max_partition_size(0) {
|
|
196
|
+
any_combined(false), finalize_done(0), scan_pin_properties(TupleDataPinProperties::DESTROY_AFTER_DONE),
|
|
197
|
+
count_before_combining(0), max_partition_size(0) {
|
|
189
198
|
|
|
190
199
|
auto tuples_per_block = Storage::BLOCK_ALLOC_SIZE / radix_ht.GetLayout().GetRowWidth();
|
|
191
200
|
idx_t ht_count = config.sink_capacity / GroupedAggregateHashTable::LOAD_FACTOR;
|
|
@@ -516,8 +525,9 @@ void RadixPartitionedHashTable::Finalize(ClientContext &context, GlobalSinkState
|
|
|
516
525
|
|
|
517
526
|
gstate.partitions.emplace_back(make_uniq<AggregatePartition>(std::move(partition)));
|
|
518
527
|
if (single_ht) {
|
|
519
|
-
gstate.
|
|
520
|
-
gstate.partitions.back()->
|
|
528
|
+
gstate.finalize_done++;
|
|
529
|
+
gstate.partitions.back()->progress = 1;
|
|
530
|
+
gstate.partitions.back()->state = AggregatePartitionState::READY_TO_SCAN;
|
|
521
531
|
}
|
|
522
532
|
}
|
|
523
533
|
} else {
|
|
@@ -566,7 +576,8 @@ public:
|
|
|
566
576
|
RadixHTGlobalSourceState(ClientContext &context, const RadixPartitionedHashTable &radix_ht);
|
|
567
577
|
|
|
568
578
|
//! Assigns a task to a local source state
|
|
569
|
-
|
|
579
|
+
SourceResultType AssignTask(RadixHTGlobalSinkState &sink, RadixHTLocalSourceState &lstate,
|
|
580
|
+
InterruptState &interrupt_state);
|
|
570
581
|
|
|
571
582
|
public:
|
|
572
583
|
//! The client context
|
|
@@ -577,10 +588,10 @@ public:
|
|
|
577
588
|
//! Column ids for scanning
|
|
578
589
|
vector<column_t> column_ids;
|
|
579
590
|
|
|
580
|
-
//! For synchronizing
|
|
591
|
+
//! For synchronizing tasks
|
|
581
592
|
mutex lock;
|
|
582
|
-
idx_t
|
|
583
|
-
atomic<idx_t>
|
|
593
|
+
idx_t task_idx;
|
|
594
|
+
atomic<idx_t> task_done;
|
|
584
595
|
};
|
|
585
596
|
|
|
586
597
|
enum class RadixHTScanStatus : uint8_t { INIT, IN_PROGRESS, DONE };
|
|
@@ -629,61 +640,44 @@ unique_ptr<LocalSourceState> RadixPartitionedHashTable::GetLocalSourceState(Exec
|
|
|
629
640
|
}
|
|
630
641
|
|
|
631
642
|
RadixHTGlobalSourceState::RadixHTGlobalSourceState(ClientContext &context_p, const RadixPartitionedHashTable &radix_ht)
|
|
632
|
-
: context(context_p), finished(false),
|
|
643
|
+
: context(context_p), finished(false), task_idx(0), task_done(0) {
|
|
633
644
|
for (column_t column_id = 0; column_id < radix_ht.group_types.size(); column_id++) {
|
|
634
645
|
column_ids.push_back(column_id);
|
|
635
646
|
}
|
|
636
647
|
}
|
|
637
648
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
649
|
+
SourceResultType RadixHTGlobalSourceState::AssignTask(RadixHTGlobalSinkState &sink, RadixHTLocalSourceState &lstate,
|
|
650
|
+
InterruptState &interrupt_state) {
|
|
651
|
+
// First, try to get a partition index
|
|
652
|
+
lock_guard<mutex> gstate_guard(lock);
|
|
642
653
|
if (finished) {
|
|
643
|
-
return
|
|
654
|
+
return SourceResultType::FINISHED;
|
|
644
655
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
bool scan_assigned = false;
|
|
648
|
-
if (scan_idx < n_partitions && sink.partitions[scan_idx]->finalized) {
|
|
649
|
-
lstate.task_idx = scan_idx++;
|
|
650
|
-
scan_assigned = true;
|
|
651
|
-
if (scan_idx == n_partitions) {
|
|
652
|
-
// We will never be able to assign another task, unblock blocked tasks
|
|
653
|
-
lock_guard<mutex> sink_guard(sink.lock);
|
|
654
|
-
if (!sink.blocked_tasks.empty()) {
|
|
655
|
-
for (auto &state : sink.blocked_tasks) {
|
|
656
|
-
state.Callback();
|
|
657
|
-
}
|
|
658
|
-
sink.blocked_tasks.clear();
|
|
659
|
-
}
|
|
660
|
-
}
|
|
656
|
+
if (task_idx == sink.partitions.size()) {
|
|
657
|
+
return SourceResultType::FINISHED;
|
|
661
658
|
}
|
|
659
|
+
lstate.task_idx = task_idx++;
|
|
662
660
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
661
|
+
// We got a partition index
|
|
662
|
+
auto &partition = *sink.partitions[lstate.task_idx];
|
|
663
|
+
auto partition_lock = unique_lock<mutex>(partition.lock);
|
|
664
|
+
switch (partition.state) {
|
|
665
|
+
case AggregatePartitionState::READY_TO_FINALIZE:
|
|
666
|
+
partition.state = AggregatePartitionState::FINALIZE_IN_PROGRESS;
|
|
667
|
+
lstate.task = RadixHTSourceTaskType::FINALIZE;
|
|
668
|
+
return SourceResultType::HAVE_MORE_OUTPUT;
|
|
669
|
+
case AggregatePartitionState::FINALIZE_IN_PROGRESS:
|
|
666
670
|
lstate.task = RadixHTSourceTaskType::SCAN;
|
|
667
671
|
lstate.scan_status = RadixHTScanStatus::INIT;
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
// We can just increment the atomic here, much simpler than assigning the scan task
|
|
678
|
-
lstate.task_idx = sink.finalize_idx++;
|
|
679
|
-
if (lstate.task_idx < n_partitions) {
|
|
680
|
-
// We successfully assigned a Finalize task
|
|
681
|
-
lstate.task = RadixHTSourceTaskType::FINALIZE;
|
|
682
|
-
return true;
|
|
672
|
+
partition.blocked_tasks.push_back(interrupt_state);
|
|
673
|
+
return SourceResultType::BLOCKED;
|
|
674
|
+
case AggregatePartitionState::READY_TO_SCAN:
|
|
675
|
+
lstate.task = RadixHTSourceTaskType::SCAN;
|
|
676
|
+
lstate.scan_status = RadixHTScanStatus::INIT;
|
|
677
|
+
return SourceResultType::HAVE_MORE_OUTPUT;
|
|
678
|
+
default:
|
|
679
|
+
throw InternalException("Unexpected AggregatePartitionState in RadixHTLocalSourceState::Finalize!");
|
|
683
680
|
}
|
|
684
|
-
|
|
685
|
-
// We didn't manage to assign a Finalize task because there are none left
|
|
686
|
-
return false;
|
|
687
681
|
}
|
|
688
682
|
|
|
689
683
|
RadixHTLocalSourceState::RadixHTLocalSourceState(ExecutionContext &context, const RadixPartitionedHashTable &radix_ht)
|
|
@@ -699,6 +693,7 @@ RadixHTLocalSourceState::RadixHTLocalSourceState(ExecutionContext &context, cons
|
|
|
699
693
|
|
|
700
694
|
void RadixHTLocalSourceState::ExecuteTask(RadixHTGlobalSinkState &sink, RadixHTGlobalSourceState &gstate,
|
|
701
695
|
DataChunk &chunk) {
|
|
696
|
+
D_ASSERT(task != RadixHTSourceTaskType::NO_TASK);
|
|
702
697
|
switch (task) {
|
|
703
698
|
case RadixHTSourceTaskType::FINALIZE:
|
|
704
699
|
Finalize(sink, gstate);
|
|
@@ -714,12 +709,7 @@ void RadixHTLocalSourceState::ExecuteTask(RadixHTGlobalSinkState &sink, RadixHTG
|
|
|
714
709
|
void RadixHTLocalSourceState::Finalize(RadixHTGlobalSinkState &sink, RadixHTGlobalSourceState &gstate) {
|
|
715
710
|
D_ASSERT(task == RadixHTSourceTaskType::FINALIZE);
|
|
716
711
|
D_ASSERT(scan_status != RadixHTScanStatus::IN_PROGRESS);
|
|
717
|
-
|
|
718
712
|
auto &partition = *sink.partitions[task_idx];
|
|
719
|
-
if (partition.data->Count() == 0) {
|
|
720
|
-
partition.finalized = true;
|
|
721
|
-
return;
|
|
722
|
-
}
|
|
723
713
|
|
|
724
714
|
if (!ht) {
|
|
725
715
|
// This capacity would always be sufficient for all data
|
|
@@ -730,7 +720,7 @@ void RadixHTLocalSourceState::Finalize(RadixHTGlobalSinkState &sink, RadixHTGlob
|
|
|
730
720
|
const idx_t memory_limit = BufferManager::GetBufferManager(gstate.context).GetMaxMemory();
|
|
731
721
|
const idx_t thread_limit = 0.6 * memory_limit / n_threads;
|
|
732
722
|
|
|
733
|
-
const idx_t size_per_entry = partition.data->SizeInBytes() / partition.data->Count() +
|
|
723
|
+
const idx_t size_per_entry = partition.data->SizeInBytes() / MaxValue<idx_t>(partition.data->Count(), 1) +
|
|
734
724
|
idx_t(GroupedAggregateHashTable::LOAD_FACTOR * sizeof(aggr_ht_entry_t));
|
|
735
725
|
const auto capacity_limit = NextPowerOfTwo(thread_limit / size_per_entry);
|
|
736
726
|
|
|
@@ -745,32 +735,34 @@ void RadixHTLocalSourceState::Finalize(RadixHTGlobalSinkState &sink, RadixHTGlob
|
|
|
745
735
|
// Now combine the uncombined data using this thread's HT
|
|
746
736
|
ht->Combine(*partition.data, &partition.progress);
|
|
747
737
|
ht->UnpinData();
|
|
738
|
+
partition.progress = 1;
|
|
748
739
|
|
|
749
740
|
// Move the combined data back to the partition
|
|
750
741
|
partition.data =
|
|
751
742
|
make_uniq<TupleDataCollection>(BufferManager::GetBufferManager(gstate.context), sink.radix_ht.GetLayout());
|
|
752
743
|
partition.data->Combine(*ht->GetPartitionedData()->GetPartitions()[0]);
|
|
753
744
|
|
|
754
|
-
//
|
|
755
|
-
lock_guard<mutex>
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
745
|
+
// Update thread-global state
|
|
746
|
+
lock_guard<mutex> global_guard(gstate.lock);
|
|
747
|
+
sink.stored_allocators.emplace_back(ht->GetAggregateAllocator());
|
|
748
|
+
const auto finalizes_done = ++sink.finalize_done;
|
|
749
|
+
D_ASSERT(finalizes_done <= sink.partitions.size());
|
|
750
|
+
if (finalizes_done == sink.partitions.size()) {
|
|
759
751
|
// All finalizes are done, set remaining size to 0
|
|
760
752
|
sink.temporary_memory_state->SetRemainingSize(sink.context, 0);
|
|
761
753
|
}
|
|
762
754
|
|
|
763
|
-
//
|
|
764
|
-
lock_guard<mutex>
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
}
|
|
769
|
-
sink.blocked_tasks.clear();
|
|
755
|
+
// Update partition state
|
|
756
|
+
lock_guard<mutex> partition_guard(partition.lock);
|
|
757
|
+
partition.state = AggregatePartitionState::READY_TO_SCAN;
|
|
758
|
+
for (auto &blocked_task : partition.blocked_tasks) {
|
|
759
|
+
blocked_task.Callback();
|
|
770
760
|
}
|
|
761
|
+
partition.blocked_tasks.clear();
|
|
771
762
|
|
|
772
|
-
//
|
|
773
|
-
|
|
763
|
+
// This thread will scan the partition
|
|
764
|
+
task = RadixHTSourceTaskType::SCAN;
|
|
765
|
+
scan_status = RadixHTScanStatus::INIT;
|
|
774
766
|
}
|
|
775
767
|
|
|
776
768
|
void RadixHTLocalSourceState::Scan(RadixHTGlobalSinkState &sink, RadixHTGlobalSourceState &gstate, DataChunk &chunk) {
|
|
@@ -778,36 +770,24 @@ void RadixHTLocalSourceState::Scan(RadixHTGlobalSinkState &sink, RadixHTGlobalSo
|
|
|
778
770
|
D_ASSERT(scan_status != RadixHTScanStatus::DONE);
|
|
779
771
|
|
|
780
772
|
auto &partition = *sink.partitions[task_idx];
|
|
781
|
-
D_ASSERT(partition.
|
|
773
|
+
D_ASSERT(partition.state == AggregatePartitionState::READY_TO_SCAN);
|
|
782
774
|
auto &data_collection = *partition.data;
|
|
783
775
|
|
|
784
|
-
if (data_collection.Count() == 0) {
|
|
785
|
-
scan_status = RadixHTScanStatus::DONE;
|
|
786
|
-
lock_guard<mutex> gstate_guard(gstate.lock);
|
|
787
|
-
if (++gstate.scan_done == sink.partitions.size()) {
|
|
788
|
-
gstate.finished = true;
|
|
789
|
-
}
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
776
|
if (scan_status == RadixHTScanStatus::INIT) {
|
|
794
777
|
data_collection.InitializeScan(scan_state, gstate.column_ids, sink.scan_pin_properties);
|
|
795
778
|
scan_status = RadixHTScanStatus::IN_PROGRESS;
|
|
796
779
|
}
|
|
797
780
|
|
|
798
781
|
if (!data_collection.Scan(scan_state, scan_chunk)) {
|
|
799
|
-
scan_status = RadixHTScanStatus::DONE;
|
|
800
782
|
if (sink.scan_pin_properties == TupleDataPinProperties::DESTROY_AFTER_DONE) {
|
|
801
783
|
data_collection.Reset();
|
|
802
784
|
}
|
|
803
|
-
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
if (data_collection.ScanComplete(scan_state)) {
|
|
785
|
+
scan_status = RadixHTScanStatus::DONE;
|
|
807
786
|
lock_guard<mutex> gstate_guard(gstate.lock);
|
|
808
|
-
if (++gstate.
|
|
787
|
+
if (++gstate.task_done == sink.partitions.size()) {
|
|
809
788
|
gstate.finished = true;
|
|
810
789
|
}
|
|
790
|
+
return;
|
|
811
791
|
}
|
|
812
792
|
|
|
813
793
|
RowOperationsState row_state(aggregate_allocator);
|
|
@@ -902,15 +882,10 @@ SourceResultType RadixPartitionedHashTable::GetData(ExecutionContext &context, D
|
|
|
902
882
|
|
|
903
883
|
while (!gstate.finished && chunk.size() == 0) {
|
|
904
884
|
if (lstate.TaskFinished()) {
|
|
905
|
-
|
|
906
|
-
if (
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
sink.blocked_tasks.push_back(input.interrupt_state);
|
|
910
|
-
return SourceResultType::BLOCKED;
|
|
911
|
-
} else {
|
|
912
|
-
return SourceResultType::FINISHED;
|
|
913
|
-
}
|
|
885
|
+
const auto res = gstate.AssignTask(sink, lstate, input.interrupt_state);
|
|
886
|
+
if (res != SourceResultType::HAVE_MORE_OUTPUT) {
|
|
887
|
+
D_ASSERT(res == SourceResultType::FINISHED || res == SourceResultType::BLOCKED);
|
|
888
|
+
return res;
|
|
914
889
|
}
|
|
915
890
|
}
|
|
916
891
|
lstate.ExecuteTask(sink, gstate, chunk);
|
|
@@ -931,11 +906,11 @@ double RadixPartitionedHashTable::GetProgress(ClientContext &, GlobalSinkState &
|
|
|
931
906
|
// Get partition combine progress, weigh it 2x
|
|
932
907
|
double total_progress = 0;
|
|
933
908
|
for (auto &partition : sink.partitions) {
|
|
934
|
-
total_progress += partition->progress
|
|
909
|
+
total_progress += 2.0 * partition->progress;
|
|
935
910
|
}
|
|
936
911
|
|
|
937
912
|
// Get scan progress, weigh it 1x
|
|
938
|
-
total_progress += gstate.
|
|
913
|
+
total_progress += 1.0 * gstate.task_done;
|
|
939
914
|
|
|
940
915
|
// Divide by 3x for the weights, and the number of partitions to get a value between 0 and 1 again
|
|
941
916
|
total_progress /= 3.0 * sink.partitions.size();
|
|
@@ -305,7 +305,7 @@ void BaseReservoirSampling::ReplaceElement(double with_weight) {
|
|
|
305
305
|
r2 = with_weight;
|
|
306
306
|
}
|
|
307
307
|
//! now we insert the new weight into the reservoir
|
|
308
|
-
reservoir_weights.
|
|
308
|
+
reservoir_weights.emplace(-r2, min_weighted_entry_index);
|
|
309
309
|
//! we update the min entry with the new min entry in the reservoir
|
|
310
310
|
SetNextEntry();
|
|
311
311
|
}
|
|
@@ -199,17 +199,34 @@ struct OperationCompare : public std::function<bool(T, T)> {
|
|
|
199
199
|
|
|
200
200
|
template <typename T, typename OP, bool FROM>
|
|
201
201
|
static idx_t FindTypedRangeBound(const WindowInputColumn &over, const idx_t order_begin, const idx_t order_end,
|
|
202
|
-
WindowInputExpression &boundary, const idx_t chunk_idx,
|
|
202
|
+
const WindowBoundary range, WindowInputExpression &boundary, const idx_t chunk_idx,
|
|
203
|
+
const FrameBounds &prev) {
|
|
203
204
|
D_ASSERT(!boundary.CellIsNull(chunk_idx));
|
|
204
205
|
const auto val = boundary.GetCell<T>(chunk_idx);
|
|
205
206
|
|
|
206
207
|
OperationCompare<T, OP> comp;
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
|
|
209
|
+
// Check that the value we are searching for is in range.
|
|
210
|
+
if (range == WindowBoundary::EXPR_PRECEDING_RANGE) {
|
|
211
|
+
// Preceding but value past the end
|
|
212
|
+
const auto cur_val = over.GetCell<T>(order_end);
|
|
213
|
+
if (comp(cur_val, val)) {
|
|
214
|
+
throw OutOfRangeException("Invalid RANGE PRECEDING value");
|
|
215
|
+
}
|
|
216
|
+
} else {
|
|
217
|
+
// Following but value before beginning
|
|
218
|
+
D_ASSERT(range == WindowBoundary::EXPR_FOLLOWING_RANGE);
|
|
219
|
+
const auto cur_val = over.GetCell<T>(order_begin);
|
|
220
|
+
if (comp(val, cur_val)) {
|
|
221
|
+
throw OutOfRangeException("Invalid RANGE FOLLOWING value");
|
|
222
|
+
}
|
|
223
|
+
}
|
|
209
224
|
|
|
210
225
|
// Try to reuse the previous bounds to restrict the search.
|
|
211
226
|
// This is only valid if the previous bounds were non-empty
|
|
212
227
|
// Only inject the comparisons if the previous bounds are a strict subset.
|
|
228
|
+
WindowColumnIterator<T> begin(over, order_begin);
|
|
229
|
+
WindowColumnIterator<T> end(over, order_end);
|
|
213
230
|
if (prev.start < prev.end) {
|
|
214
231
|
if (order_begin < prev.start && prev.start < order_end) {
|
|
215
232
|
const auto first = over.GetCell<T>(prev.start);
|
|
@@ -237,37 +254,40 @@ static idx_t FindTypedRangeBound(const WindowInputColumn &over, const idx_t orde
|
|
|
237
254
|
|
|
238
255
|
template <typename OP, bool FROM>
|
|
239
256
|
static idx_t FindRangeBound(const WindowInputColumn &over, const idx_t order_begin, const idx_t order_end,
|
|
240
|
-
WindowInputExpression &boundary, const idx_t chunk_idx,
|
|
257
|
+
const WindowBoundary range, WindowInputExpression &boundary, const idx_t chunk_idx,
|
|
258
|
+
const FrameBounds &prev) {
|
|
241
259
|
D_ASSERT(boundary.chunk.ColumnCount() == 1);
|
|
242
260
|
D_ASSERT(boundary.chunk.data[0].GetType().InternalType() == over.input_expr.ptype);
|
|
243
261
|
|
|
244
262
|
switch (over.input_expr.ptype) {
|
|
245
263
|
case PhysicalType::INT8:
|
|
246
|
-
return FindTypedRangeBound<int8_t, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
264
|
+
return FindTypedRangeBound<int8_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
247
265
|
case PhysicalType::INT16:
|
|
248
|
-
return FindTypedRangeBound<int16_t, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
266
|
+
return FindTypedRangeBound<int16_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
249
267
|
case PhysicalType::INT32:
|
|
250
|
-
return FindTypedRangeBound<int32_t, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
268
|
+
return FindTypedRangeBound<int32_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
251
269
|
case PhysicalType::INT64:
|
|
252
|
-
return FindTypedRangeBound<int64_t, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
270
|
+
return FindTypedRangeBound<int64_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
253
271
|
case PhysicalType::UINT8:
|
|
254
|
-
return FindTypedRangeBound<uint8_t, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
272
|
+
return FindTypedRangeBound<uint8_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
255
273
|
case PhysicalType::UINT16:
|
|
256
|
-
return FindTypedRangeBound<uint16_t, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
274
|
+
return FindTypedRangeBound<uint16_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
257
275
|
case PhysicalType::UINT32:
|
|
258
|
-
return FindTypedRangeBound<uint32_t, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
276
|
+
return FindTypedRangeBound<uint32_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
259
277
|
case PhysicalType::UINT64:
|
|
260
|
-
return FindTypedRangeBound<uint64_t, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
278
|
+
return FindTypedRangeBound<uint64_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
261
279
|
case PhysicalType::INT128:
|
|
262
|
-
return FindTypedRangeBound<hugeint_t, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
280
|
+
return FindTypedRangeBound<hugeint_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
263
281
|
case PhysicalType::UINT128:
|
|
264
|
-
return FindTypedRangeBound<uhugeint_t, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx,
|
|
282
|
+
return FindTypedRangeBound<uhugeint_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx,
|
|
283
|
+
prev);
|
|
265
284
|
case PhysicalType::FLOAT:
|
|
266
|
-
return FindTypedRangeBound<float, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
285
|
+
return FindTypedRangeBound<float, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
267
286
|
case PhysicalType::DOUBLE:
|
|
268
|
-
return FindTypedRangeBound<double, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
287
|
+
return FindTypedRangeBound<double, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
269
288
|
case PhysicalType::INTERVAL:
|
|
270
|
-
return FindTypedRangeBound<interval_t, OP, FROM>(over, order_begin, order_end, boundary, chunk_idx,
|
|
289
|
+
return FindTypedRangeBound<interval_t, OP, FROM>(over, order_begin, order_end, range, boundary, chunk_idx,
|
|
290
|
+
prev);
|
|
271
291
|
default:
|
|
272
292
|
throw InternalException("Unsupported column type for RANGE");
|
|
273
293
|
}
|
|
@@ -275,13 +295,13 @@ static idx_t FindRangeBound(const WindowInputColumn &over, const idx_t order_beg
|
|
|
275
295
|
|
|
276
296
|
template <bool FROM>
|
|
277
297
|
static idx_t FindOrderedRangeBound(const WindowInputColumn &over, const OrderType range_sense, const idx_t order_begin,
|
|
278
|
-
const idx_t order_end, WindowInputExpression &boundary,
|
|
279
|
-
const FrameBounds &prev) {
|
|
298
|
+
const idx_t order_end, const WindowBoundary range, WindowInputExpression &boundary,
|
|
299
|
+
const idx_t chunk_idx, const FrameBounds &prev) {
|
|
280
300
|
switch (range_sense) {
|
|
281
301
|
case OrderType::ASCENDING:
|
|
282
|
-
return FindRangeBound<LessThan, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
302
|
+
return FindRangeBound<LessThan, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
283
303
|
case OrderType::DESCENDING:
|
|
284
|
-
return FindRangeBound<GreaterThan, FROM>(over, order_begin, order_end, boundary, chunk_idx, prev);
|
|
304
|
+
return FindRangeBound<GreaterThan, FROM>(over, order_begin, order_end, range, boundary, chunk_idx, prev);
|
|
285
305
|
default:
|
|
286
306
|
throw InternalException("Unsupported ORDER BY sense for RANGE");
|
|
287
307
|
}
|
|
@@ -458,7 +478,7 @@ void WindowBoundariesState::Update(const idx_t row_idx, const WindowInputColumn
|
|
|
458
478
|
window_start = peer_start;
|
|
459
479
|
} else {
|
|
460
480
|
prev.start = FindOrderedRangeBound<true>(range_collection, range_sense, valid_start, row_idx,
|
|
461
|
-
boundary_start, chunk_idx, prev);
|
|
481
|
+
start_boundary, boundary_start, chunk_idx, prev);
|
|
462
482
|
window_start = prev.start;
|
|
463
483
|
}
|
|
464
484
|
break;
|
|
@@ -467,8 +487,8 @@ void WindowBoundariesState::Update(const idx_t row_idx, const WindowInputColumn
|
|
|
467
487
|
if (boundary_start.CellIsNull(chunk_idx)) {
|
|
468
488
|
window_start = peer_start;
|
|
469
489
|
} else {
|
|
470
|
-
prev.start = FindOrderedRangeBound<true>(range_collection, range_sense, row_idx, valid_end,
|
|
471
|
-
chunk_idx, prev);
|
|
490
|
+
prev.start = FindOrderedRangeBound<true>(range_collection, range_sense, row_idx, valid_end, start_boundary,
|
|
491
|
+
boundary_start, chunk_idx, prev);
|
|
472
492
|
window_start = prev.start;
|
|
473
493
|
}
|
|
474
494
|
break;
|
|
@@ -502,8 +522,8 @@ void WindowBoundariesState::Update(const idx_t row_idx, const WindowInputColumn
|
|
|
502
522
|
if (boundary_end.CellIsNull(chunk_idx)) {
|
|
503
523
|
window_end = peer_end;
|
|
504
524
|
} else {
|
|
505
|
-
prev.end = FindOrderedRangeBound<false>(range_collection, range_sense, valid_start, row_idx,
|
|
506
|
-
chunk_idx, prev);
|
|
525
|
+
prev.end = FindOrderedRangeBound<false>(range_collection, range_sense, valid_start, row_idx, end_boundary,
|
|
526
|
+
boundary_end, chunk_idx, prev);
|
|
507
527
|
window_end = prev.end;
|
|
508
528
|
}
|
|
509
529
|
break;
|
|
@@ -512,8 +532,8 @@ void WindowBoundariesState::Update(const idx_t row_idx, const WindowInputColumn
|
|
|
512
532
|
if (boundary_end.CellIsNull(chunk_idx)) {
|
|
513
533
|
window_end = peer_end;
|
|
514
534
|
} else {
|
|
515
|
-
prev.end = FindOrderedRangeBound<false>(range_collection, range_sense, row_idx, valid_end,
|
|
516
|
-
chunk_idx, prev);
|
|
535
|
+
prev.end = FindOrderedRangeBound<false>(range_collection, range_sense, row_idx, valid_end, end_boundary,
|
|
536
|
+
boundary_end, chunk_idx, prev);
|
|
517
537
|
window_end = prev.end;
|
|
518
538
|
}
|
|
519
539
|
break;
|
|
@@ -18,9 +18,9 @@ namespace duckdb {
|
|
|
18
18
|
WindowAggregatorState::WindowAggregatorState() : allocator(Allocator::DefaultAllocator()) {
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
WindowAggregator::WindowAggregator(AggregateObject
|
|
21
|
+
WindowAggregator::WindowAggregator(AggregateObject aggr_p, const LogicalType &result_type_p,
|
|
22
22
|
const WindowExcludeMode exclude_mode_p, idx_t partition_count_p)
|
|
23
|
-
: aggr(std::move(
|
|
23
|
+
: aggr(std::move(aggr_p)), result_type(result_type_p), partition_count(partition_count_p),
|
|
24
24
|
state_size(aggr.function.state_size()), filter_pos(0), exclude_mode(exclude_mode_p) {
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -470,7 +470,7 @@ WindowNaiveState::WindowNaiveState(const WindowNaiveAggregator &gstate)
|
|
|
470
470
|
row_set(STANDARD_VECTOR_SIZE, hash_row, equal_row) {
|
|
471
471
|
InitSubFrames(frames, gstate.exclude_mode);
|
|
472
472
|
|
|
473
|
-
auto &inputs =
|
|
473
|
+
auto &inputs = gstate.GetInputs();
|
|
474
474
|
if (inputs.ColumnCount() > 0) {
|
|
475
475
|
leaves.Initialize(Allocator::DefaultAllocator(), inputs.GetTypes());
|
|
476
476
|
}
|
|
@@ -494,9 +494,8 @@ void WindowNaiveState::FlushStates() {
|
|
|
494
494
|
return;
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
auto &inputs =
|
|
498
|
-
leaves.
|
|
499
|
-
leaves.Slice(update_sel, flush_count);
|
|
497
|
+
auto &inputs = gstate.GetInputs();
|
|
498
|
+
leaves.Slice(inputs, update_sel, flush_count);
|
|
500
499
|
|
|
501
500
|
auto &aggr = gstate.aggr;
|
|
502
501
|
AggregateInputData aggr_input_data(aggr.GetFunctionData(), allocator);
|
|
@@ -506,19 +505,18 @@ void WindowNaiveState::FlushStates() {
|
|
|
506
505
|
}
|
|
507
506
|
|
|
508
507
|
size_t WindowNaiveState::Hash(idx_t rid) {
|
|
509
|
-
auto &inputs =
|
|
510
|
-
leaves.Reference(inputs);
|
|
508
|
+
auto &inputs = gstate.GetInputs();
|
|
511
509
|
|
|
512
510
|
auto s = UnsafeNumericCast<sel_t>(rid);
|
|
513
511
|
SelectionVector sel(&s);
|
|
514
|
-
leaves.Slice(sel, 1);
|
|
512
|
+
leaves.Slice(inputs, sel, 1);
|
|
515
513
|
leaves.Hash(hashes);
|
|
516
514
|
|
|
517
515
|
return *FlatVector::GetData<hash_t>(hashes);
|
|
518
516
|
}
|
|
519
517
|
|
|
520
518
|
bool WindowNaiveState::KeyEqual(const idx_t &lhs, const idx_t &rhs) {
|
|
521
|
-
auto &inputs =
|
|
519
|
+
auto &inputs = gstate.GetInputs();
|
|
522
520
|
|
|
523
521
|
auto l = UnsafeNumericCast<sel_t>(lhs);
|
|
524
522
|
SelectionVector lsel(&l);
|
|
@@ -644,7 +642,7 @@ public:
|
|
|
644
642
|
|
|
645
643
|
enum FramePart : uint8_t { FULL = 0, LEFT = 1, RIGHT = 2 };
|
|
646
644
|
|
|
647
|
-
WindowSegmentTreePart(ArenaAllocator &allocator, const AggregateObject &aggr, DataChunk &inputs,
|
|
645
|
+
WindowSegmentTreePart(ArenaAllocator &allocator, const AggregateObject &aggr, const DataChunk &inputs,
|
|
648
646
|
const ValidityMask &filter_mask);
|
|
649
647
|
~WindowSegmentTreePart();
|
|
650
648
|
|
|
@@ -681,7 +679,7 @@ public:
|
|
|
681
679
|
//! Order insensitive aggregate (we can optimise internal combines)
|
|
682
680
|
const bool order_insensitive;
|
|
683
681
|
//! The partition arguments
|
|
684
|
-
DataChunk &inputs;
|
|
682
|
+
const DataChunk &inputs;
|
|
685
683
|
//! The filtered rows in inputs
|
|
686
684
|
const ValidityMask &filter_mask;
|
|
687
685
|
//! The size of a single aggregate state
|
|
@@ -706,14 +704,14 @@ public:
|
|
|
706
704
|
|
|
707
705
|
class WindowSegmentTreeState : public WindowAggregatorState {
|
|
708
706
|
public:
|
|
709
|
-
WindowSegmentTreeState(const AggregateObject &aggr, DataChunk &inputs, const ValidityMask &filter_mask)
|
|
707
|
+
WindowSegmentTreeState(const AggregateObject &aggr, const DataChunk &inputs, const ValidityMask &filter_mask)
|
|
710
708
|
: aggr(aggr), inputs(inputs), filter_mask(filter_mask), part(allocator, aggr, inputs, filter_mask) {
|
|
711
709
|
}
|
|
712
710
|
|
|
713
711
|
//! The aggregate function
|
|
714
712
|
const AggregateObject &aggr;
|
|
715
713
|
//! The aggregate function
|
|
716
|
-
DataChunk &inputs;
|
|
714
|
+
const DataChunk &inputs;
|
|
717
715
|
//! The filtered rows in inputs
|
|
718
716
|
const ValidityMask &filter_mask;
|
|
719
717
|
//! The left (default) segment tree part
|
|
@@ -722,8 +720,8 @@ public:
|
|
|
722
720
|
unique_ptr<WindowSegmentTreePart> right_part;
|
|
723
721
|
};
|
|
724
722
|
|
|
725
|
-
WindowSegmentTreePart::WindowSegmentTreePart(ArenaAllocator &allocator, const AggregateObject &aggr,
|
|
726
|
-
const ValidityMask &filter_mask)
|
|
723
|
+
WindowSegmentTreePart::WindowSegmentTreePart(ArenaAllocator &allocator, const AggregateObject &aggr,
|
|
724
|
+
const DataChunk &inputs, const ValidityMask &filter_mask)
|
|
727
725
|
: allocator(allocator), aggr(aggr),
|
|
728
726
|
order_insensitive(aggr.function.order_dependent == AggregateOrderDependent::NOT_ORDER_DEPENDENT), inputs(inputs),
|
|
729
727
|
filter_mask(filter_mask), state_size(aggr.function.state_size()), state(state_size * STANDARD_VECTOR_SIZE),
|
|
@@ -749,7 +747,7 @@ WindowSegmentTreePart::~WindowSegmentTreePart() {
|
|
|
749
747
|
}
|
|
750
748
|
|
|
751
749
|
unique_ptr<WindowAggregatorState> WindowSegmentTree::GetLocalState() const {
|
|
752
|
-
return make_uniq<WindowSegmentTreeState>(aggr,
|
|
750
|
+
return make_uniq<WindowSegmentTreeState>(aggr, inputs, filter_mask);
|
|
753
751
|
}
|
|
754
752
|
|
|
755
753
|
void WindowSegmentTreePart::FlushStates(bool combining) {
|
|
@@ -762,8 +760,7 @@ void WindowSegmentTreePart::FlushStates(bool combining) {
|
|
|
762
760
|
statel.Verify(flush_count);
|
|
763
761
|
aggr.function.combine(statel, statep, aggr_input_data, flush_count);
|
|
764
762
|
} else {
|
|
765
|
-
leaves.
|
|
766
|
-
leaves.Slice(filter_sel, flush_count);
|
|
763
|
+
leaves.Slice(inputs, filter_sel, flush_count);
|
|
767
764
|
aggr.function.update(&leaves.data[0], aggr_input_data, leaves.ColumnCount(), statep, flush_count);
|
|
768
765
|
}
|
|
769
766
|
|
|
@@ -1382,7 +1379,7 @@ WindowDistinctAggregator::DistinctSortTree::DistinctSortTree(ZippedElements &&pr
|
|
|
1382
1379
|
|
|
1383
1380
|
class WindowDistinctState : public WindowAggregatorState {
|
|
1384
1381
|
public:
|
|
1385
|
-
WindowDistinctState(const AggregateObject &aggr, DataChunk &inputs, const WindowDistinctAggregator &tree);
|
|
1382
|
+
WindowDistinctState(const AggregateObject &aggr, const DataChunk &inputs, const WindowDistinctAggregator &tree);
|
|
1386
1383
|
|
|
1387
1384
|
void Evaluate(const DataChunk &bounds, Vector &result, idx_t count, idx_t row_idx);
|
|
1388
1385
|
|
|
@@ -1393,7 +1390,7 @@ protected:
|
|
|
1393
1390
|
//! The aggregate function
|
|
1394
1391
|
const AggregateObject &aggr;
|
|
1395
1392
|
//! The aggregate function
|
|
1396
|
-
DataChunk &inputs;
|
|
1393
|
+
const DataChunk &inputs;
|
|
1397
1394
|
//! The merge sort tree data
|
|
1398
1395
|
const WindowDistinctAggregator &tree;
|
|
1399
1396
|
//! The size of a single aggregate state
|
|
@@ -1412,7 +1409,7 @@ protected:
|
|
|
1412
1409
|
SubFrames frames;
|
|
1413
1410
|
};
|
|
1414
1411
|
|
|
1415
|
-
WindowDistinctState::WindowDistinctState(const AggregateObject &aggr, DataChunk &inputs,
|
|
1412
|
+
WindowDistinctState::WindowDistinctState(const AggregateObject &aggr, const DataChunk &inputs,
|
|
1416
1413
|
const WindowDistinctAggregator &tree)
|
|
1417
1414
|
: aggr(aggr), inputs(inputs), tree(tree), state_size(aggr.function.state_size()),
|
|
1418
1415
|
state((state_size * STANDARD_VECTOR_SIZE)), statef(LogicalType::POINTER), statep(LogicalType::POINTER),
|
|
@@ -1488,7 +1485,7 @@ void WindowDistinctState::Evaluate(const DataChunk &bounds, Vector &result, idx_
|
|
|
1488
1485
|
}
|
|
1489
1486
|
|
|
1490
1487
|
unique_ptr<WindowAggregatorState> WindowDistinctAggregator::GetLocalState() const {
|
|
1491
|
-
return make_uniq<WindowDistinctState>(aggr,
|
|
1488
|
+
return make_uniq<WindowDistinctState>(aggr, inputs, *this);
|
|
1492
1489
|
}
|
|
1493
1490
|
|
|
1494
1491
|
void WindowDistinctAggregator::Evaluate(WindowAggregatorState &lstate, const DataChunk &bounds, Vector &result,
|
|
@@ -538,7 +538,7 @@ struct SortedAggregateFunction {
|
|
|
538
538
|
template <class STATE, class OP>
|
|
539
539
|
static void Combine(const STATE &source, STATE &target, AggregateInputData &aggr_input_data) {
|
|
540
540
|
auto &order_bind = aggr_input_data.bind_data->Cast<SortedAggregateBindData>();
|
|
541
|
-
auto &other = const_cast<STATE &>(source);
|
|
541
|
+
auto &other = const_cast<STATE &>(source); // NOLINT: absorb explicitly allows destruction
|
|
542
542
|
target.Absorb(order_bind, other);
|
|
543
543
|
}
|
|
544
544
|
|