duckdb 0.7.2-dev2867.0 → 0.7.2-dev3117.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 +2 -0
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-datepart.cpp +5 -1
- package/src/duckdb/extension/json/include/json_deserializer.hpp +1 -0
- package/src/duckdb/extension/json/include/json_serializer.hpp +8 -1
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +1 -3
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +3 -3
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +3 -2
- package/src/duckdb/extension/parquet/parquet-extension.cpp +9 -7
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +18 -7
- package/src/duckdb/src/catalog/default/default_functions.cpp +2 -0
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +3 -3
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +2 -2
- package/src/duckdb/src/common/enum_util.cpp +5908 -0
- package/src/duckdb/src/common/enums/expression_type.cpp +216 -4
- package/src/duckdb/src/common/enums/join_type.cpp +6 -5
- package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -0
- package/src/duckdb/src/common/exception.cpp +1 -1
- package/src/duckdb/src/common/exception_format_value.cpp +2 -2
- package/src/duckdb/src/common/multi_file_reader.cpp +14 -0
- package/src/duckdb/src/common/serializer/binary_deserializer.cpp +143 -0
- package/src/duckdb/src/common/serializer/binary_serializer.cpp +160 -0
- package/src/duckdb/src/common/sort/partition_state.cpp +1 -1
- package/src/duckdb/src/common/string_util.cpp +6 -1
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +3 -3
- package/src/duckdb/src/common/types.cpp +11 -10
- package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +4 -4
- package/src/duckdb/src/core_functions/function_list.cpp +2 -0
- package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +2 -1
- package/src/duckdb/src/core_functions/scalar/list/list_sort.cpp +2 -3
- package/src/duckdb/src/core_functions/scalar/string/format_bytes.cpp +29 -0
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +3 -3
- package/src/duckdb/src/execution/index/art/art.cpp +5 -1
- package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +1 -1
- package/src/duckdb/src/execution/operator/aggregate/grouped_aggregate_data.cpp +2 -2
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +65 -45
- package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +17 -11
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +32 -39
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +10 -9
- package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_explain_analyze.cpp +6 -21
- package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +13 -13
- package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +15 -14
- package/src/duckdb/src/execution/operator/helper/physical_load.cpp +3 -2
- package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_pragma.cpp +4 -2
- package/src/duckdb/src/execution/operator/helper/physical_prepare.cpp +4 -2
- package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +10 -8
- package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +4 -3
- package/src/duckdb/src/execution/operator/helper/physical_set.cpp +7 -6
- package/src/duckdb/src/execution/operator/helper/physical_streaming_sample.cpp +2 -1
- package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +4 -2
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +8 -8
- package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +17 -16
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +12 -9
- package/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp +2 -1
- package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +3 -4
- package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +5 -5
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +16 -15
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +13 -12
- package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +12 -10
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +13 -11
- package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +8 -6
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +1 -1
- package/src/duckdb/src/execution/operator/order/physical_order.cpp +13 -13
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +8 -8
- package/src/duckdb/src/execution/operator/persistent/physical_batch_copy_to_file.cpp +165 -0
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +160 -145
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +11 -26
- package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +14 -19
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +7 -6
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +18 -30
- package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +14 -18
- package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +6 -4
- package/src/duckdb/src/execution/operator/scan/physical_dummy_scan.cpp +4 -19
- package/src/duckdb/src/execution/operator/scan/physical_empty_result.cpp +3 -2
- package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +14 -5
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +6 -4
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +3 -19
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +13 -25
- package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +8 -9
- package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +9 -26
- package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +3 -19
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +9 -8
- package/src/duckdb/src/execution/operator/set/physical_union.cpp +1 -1
- package/src/duckdb/src/execution/partitionable_hashtable.cpp +2 -2
- package/src/duckdb/src/execution/physical_operator.cpp +11 -5
- package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +25 -4
- package/src/duckdb/src/execution/physical_plan/plan_sample.cpp +2 -1
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +16 -16
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +5 -4
- package/src/duckdb/src/function/table/arrow_conversion.cpp +3 -3
- package/src/duckdb/src/function/table/copy_csv.cpp +85 -29
- package/src/duckdb/src/function/table/read_csv.cpp +17 -11
- package/src/duckdb/src/function/table/system/duckdb_settings.cpp +2 -1
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +2 -1
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +7 -1
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +958 -0
- package/src/duckdb/src/include/duckdb/common/enums/join_type.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/enums/operator_result_type.hpp +16 -4
- package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/exception.hpp +4 -4
- package/src/duckdb/src/include/duckdb/common/exception_format_value.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +44 -0
- package/src/duckdb/src/include/duckdb/common/optional_idx.hpp +45 -0
- package/src/duckdb/src/include/duckdb/common/serializer/binary_deserializer.hpp +93 -0
- package/src/duckdb/src/include/duckdb/common/serializer/binary_serializer.hpp +92 -0
- package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +7 -3
- package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/set.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_segment.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/vector.hpp +61 -14
- package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +15 -0
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +10 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/distinct_aggregate_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/grouped_aggregate_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +8 -11
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +3 -7
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +2 -5
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_asof_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_copy_to_file.hpp +68 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +3 -5
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +4 -5
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +2 -5
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/partitionable_hashtable.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +7 -4
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +26 -6
- package/src/duckdb/src/include/duckdb/execution/radix_partitioned_hashtable.hpp +6 -6
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +2 -1
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +32 -4
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +4 -2
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +0 -1
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/config.hpp +4 -0
- package/src/duckdb/src/include/duckdb/main/database.hpp +1 -3
- package/src/duckdb/src/include/duckdb/main/database_path_and_type.hpp +24 -0
- package/src/duckdb/src/include/duckdb/main/relation/setop_relation.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parallel/event.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +63 -0
- package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +16 -3
- package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +51 -7
- package/src/duckdb/src/include/duckdb/parallel/task.hpp +21 -2
- package/src/duckdb/src/include/duckdb/parallel/task_counter.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/sample_options.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +2 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/query_node/bound_select_node.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/optimistic_data_writer.hpp +46 -0
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +24 -3
- package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +46 -1
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +9 -10
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/table/segment_base.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +22 -0
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +0 -2
- package/src/duckdb/src/include/duckdb/storage/table/validity_column_data.hpp +1 -2
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +9 -34
- package/src/duckdb/src/include/duckdb/verification/deserialized_statement_verifier_v2.hpp +26 -0
- package/src/duckdb/src/include/duckdb/verification/no_operator_caching_verifier.hpp +25 -0
- package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +6 -0
- package/src/duckdb/src/main/client_context.cpp +1 -0
- package/src/duckdb/src/main/client_verify.cpp +5 -0
- package/src/duckdb/src/main/config.cpp +4 -0
- package/src/duckdb/src/main/database.cpp +22 -34
- package/src/duckdb/src/main/database_path_and_type.cpp +23 -0
- package/src/duckdb/src/main/extension/extension_load.cpp +19 -15
- package/src/duckdb/src/main/relation/join_relation.cpp +2 -1
- package/src/duckdb/src/main/relation/setop_relation.cpp +2 -3
- package/src/duckdb/src/parallel/event.cpp +1 -1
- package/src/duckdb/src/parallel/executor.cpp +39 -3
- package/src/duckdb/src/parallel/executor_task.cpp +11 -0
- package/src/duckdb/src/parallel/interrupt.cpp +57 -0
- package/src/duckdb/src/parallel/pipeline.cpp +49 -6
- package/src/duckdb/src/parallel/pipeline_executor.cpp +248 -69
- package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +1 -1
- package/src/duckdb/src/parallel/task_scheduler.cpp +57 -22
- package/src/duckdb/src/parser/base_expression.cpp +6 -0
- package/src/duckdb/src/parser/expression/window_expression.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/sample_options.cpp +2 -2
- package/src/duckdb/src/parser/query_node/select_node.cpp +1 -1
- package/src/duckdb/src/parser/result_modifier.cpp +2 -2
- package/src/duckdb/src/parser/statement/select_statement.cpp +0 -44
- package/src/duckdb/src/parser/tableref/joinref.cpp +3 -3
- package/src/duckdb/src/parser/tableref.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +3 -3
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +6 -0
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +4 -1
- package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +17 -3
- package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +8 -2
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +7 -0
- package/src/duckdb/src/planner/operator/logical_aggregate.cpp +14 -2
- package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_cteref.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_delete.cpp +10 -0
- package/src/duckdb/src/planner/operator/logical_delim_get.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_dummy_scan.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_expression_get.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_get.cpp +10 -4
- package/src/duckdb/src/planner/operator/logical_insert.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_pivot.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_projection.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_set_operation.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_unnest.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_update.cpp +10 -0
- package/src/duckdb/src/planner/operator/logical_window.cpp +11 -0
- package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -1
- package/src/duckdb/src/storage/data_table.cpp +5 -0
- package/src/duckdb/src/storage/local_storage.cpp +40 -110
- package/src/duckdb/src/storage/optimistic_data_writer.cpp +96 -0
- package/src/duckdb/src/storage/partial_block_manager.cpp +73 -9
- package/src/duckdb/src/storage/single_file_block_manager.cpp +3 -1
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +17 -12
- package/src/duckdb/src/storage/statistics/base_statistics.cpp +3 -0
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +90 -82
- package/src/duckdb/src/storage/table/column_data.cpp +19 -45
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +7 -7
- package/src/duckdb/src/storage/table/column_segment.cpp +1 -1
- package/src/duckdb/src/storage/table/list_column_data.cpp +6 -11
- package/src/duckdb/src/storage/table/row_group.cpp +13 -14
- package/src/duckdb/src/storage/table/row_group_collection.cpp +10 -4
- package/src/duckdb/src/storage/table/standard_column_data.cpp +6 -10
- package/src/duckdb/src/storage/table/struct_column_data.cpp +7 -13
- package/src/duckdb/src/storage/table/update_segment.cpp +0 -25
- package/src/duckdb/src/storage/table/validity_column_data.cpp +2 -6
- package/src/duckdb/src/transaction/commit_state.cpp +4 -4
- package/src/duckdb/src/verification/deserialized_statement_verifier.cpp +2 -1
- package/src/duckdb/src/verification/deserialized_statement_verifier_v2.cpp +20 -0
- package/src/duckdb/src/verification/no_operator_caching_verifier.cpp +13 -0
- package/src/duckdb/src/verification/statement_verifier.cpp +7 -0
- package/src/duckdb/ub_src_common.cpp +2 -2
- package/src/duckdb/ub_src_common_serializer.cpp +4 -2
- package/src/duckdb/ub_src_core_functions_scalar_string.cpp +2 -0
- package/src/duckdb/ub_src_execution_operator_persistent.cpp +2 -0
- package/src/duckdb/ub_src_main.cpp +2 -0
- package/src/duckdb/ub_src_parallel.cpp +2 -0
- package/src/duckdb/ub_src_storage.cpp +2 -0
- package/src/duckdb/src/common/serializer/enum_serializer.cpp +0 -1180
- package/src/duckdb/src/common/vector.cpp +0 -12
- package/src/duckdb/src/include/duckdb/common/serializer/enum_serializer.hpp +0 -113
@@ -28,7 +28,7 @@
|
|
28
28
|
#include "duckdb/parser/parser.hpp"
|
29
29
|
|
30
30
|
#include "duckdb/common/serializer/format_deserializer.hpp"
|
31
|
-
#include "duckdb/common/
|
31
|
+
#include "duckdb/common/enum_util.hpp"
|
32
32
|
#include "duckdb/common/serializer/format_serializer.hpp"
|
33
33
|
|
34
34
|
#include <cmath>
|
@@ -158,6 +158,11 @@ PhysicalType LogicalType::GetInternalType() {
|
|
158
158
|
}
|
159
159
|
}
|
160
160
|
|
161
|
+
// **DEPRECATED**: Use EnumUtil directly instead.
|
162
|
+
string LogicalTypeIdToString(LogicalTypeId type) {
|
163
|
+
return EnumUtil::ToString(type);
|
164
|
+
}
|
165
|
+
|
161
166
|
constexpr const LogicalTypeId LogicalType::INVALID;
|
162
167
|
constexpr const LogicalTypeId LogicalType::SQLNULL;
|
163
168
|
constexpr const LogicalTypeId LogicalType::BOOLEAN;
|
@@ -331,10 +336,6 @@ bool TypeIsInteger(PhysicalType type) {
|
|
331
336
|
return (type >= PhysicalType::UINT8 && type <= PhysicalType::INT64) || type == PhysicalType::INT128;
|
332
337
|
}
|
333
338
|
|
334
|
-
string LogicalTypeIdToString(LogicalTypeId id) {
|
335
|
-
return EnumSerializer::EnumToString(id);
|
336
|
-
}
|
337
|
-
|
338
339
|
string LogicalType::ToString() const {
|
339
340
|
auto alias = GetAlias();
|
340
341
|
if (!alias.empty()) {
|
@@ -406,7 +407,7 @@ string LogicalType::ToString() const {
|
|
406
407
|
return AggregateStateType::GetTypeName(*this);
|
407
408
|
}
|
408
409
|
default:
|
409
|
-
return
|
410
|
+
return EnumUtil::ToString(id_);
|
410
411
|
}
|
411
412
|
}
|
412
413
|
// LCOV_EXCL_STOP
|
@@ -1566,17 +1567,18 @@ void ExtraTypeInfo::Serialize(ExtraTypeInfo *info, FieldWriter &writer) {
|
|
1566
1567
|
}
|
1567
1568
|
void ExtraTypeInfo::FormatSerialize(FormatSerializer &serializer) const {
|
1568
1569
|
serializer.WriteProperty("type", type);
|
1570
|
+
// BREAKING: we used to write the alias last if there was additional type info, but now we write it second.
|
1569
1571
|
serializer.WriteProperty("alias", alias);
|
1570
1572
|
}
|
1571
1573
|
|
1572
1574
|
shared_ptr<ExtraTypeInfo> ExtraTypeInfo::FormatDeserialize(FormatDeserializer &deserializer) {
|
1573
1575
|
auto type = deserializer.ReadProperty<ExtraTypeInfoType>("type");
|
1576
|
+
auto alias = deserializer.ReadProperty<string>("alias");
|
1577
|
+
// BREAKING: we used to read the alias last, but now we read it second.
|
1574
1578
|
|
1575
1579
|
shared_ptr<ExtraTypeInfo> result;
|
1576
1580
|
switch (type) {
|
1577
1581
|
case ExtraTypeInfoType::INVALID_TYPE_INFO: {
|
1578
|
-
string alias;
|
1579
|
-
deserializer.ReadOptionalProperty("alias", alias);
|
1580
1582
|
if (!alias.empty()) {
|
1581
1583
|
return make_shared<ExtraTypeInfo>(type, alias);
|
1582
1584
|
}
|
@@ -1620,11 +1622,10 @@ shared_ptr<ExtraTypeInfo> ExtraTypeInfo::FormatDeserialize(FormatDeserializer &d
|
|
1620
1622
|
case ExtraTypeInfoType::AGGREGATE_STATE_TYPE_INFO:
|
1621
1623
|
result = AggregateStateTypeInfo::FormatDeserialize(deserializer);
|
1622
1624
|
break;
|
1623
|
-
|
1624
1625
|
default:
|
1625
1626
|
throw InternalException("Unimplemented type info in ExtraTypeInfo::Deserialize");
|
1626
1627
|
}
|
1627
|
-
|
1628
|
+
result->alias = alias;
|
1628
1629
|
return result;
|
1629
1630
|
}
|
1630
1631
|
|
@@ -900,15 +900,15 @@ idx_t VectorOperations::DistinctLessThan(Vector &left, Vector &right, const Sele
|
|
900
900
|
// true := A < B with nulls being minimal
|
901
901
|
idx_t VectorOperations::DistinctLessThanNullsFirst(Vector &left, Vector &right, const SelectionVector *sel, idx_t count,
|
902
902
|
SelectionVector *true_sel, SelectionVector *false_sel) {
|
903
|
-
return TemplatedDistinctSelectOperation<duckdb::
|
904
|
-
|
903
|
+
return TemplatedDistinctSelectOperation<duckdb::DistinctGreaterThanNullsFirst, duckdb::DistinctGreaterThan>(
|
904
|
+
right, left, sel, count, true_sel, false_sel);
|
905
905
|
}
|
906
906
|
|
907
907
|
// true := A <= B with nulls being maximal
|
908
908
|
idx_t VectorOperations::DistinctLessThanEquals(Vector &left, Vector &right, const SelectionVector *sel, idx_t count,
|
909
909
|
SelectionVector *true_sel, SelectionVector *false_sel) {
|
910
|
-
return
|
911
|
-
|
910
|
+
return count -
|
911
|
+
TemplatedDistinctSelectOperation<duckdb::DistinctGreaterThan>(left, right, sel, count, false_sel, true_sel);
|
912
912
|
}
|
913
913
|
|
914
914
|
// true := A != B with nulls being equal, inputs selected
|
@@ -148,6 +148,8 @@ static StaticFunctionDefinition internal_functions[] = {
|
|
148
148
|
DUCKDB_SCALAR_FUNCTION(ListFlattenFun),
|
149
149
|
DUCKDB_SCALAR_FUNCTION_SET(FloorFun),
|
150
150
|
DUCKDB_SCALAR_FUNCTION(FormatFun),
|
151
|
+
DUCKDB_SCALAR_FUNCTION_ALIAS(FormatreadabledecimalsizeFun),
|
152
|
+
DUCKDB_SCALAR_FUNCTION(FormatBytesFun),
|
151
153
|
DUCKDB_SCALAR_FUNCTION(FromBase64Fun),
|
152
154
|
DUCKDB_SCALAR_FUNCTION_ALIAS(FromBinaryFun),
|
153
155
|
DUCKDB_SCALAR_FUNCTION_ALIAS(FromHexFun),
|
@@ -3,6 +3,7 @@
|
|
3
3
|
#include "duckdb/common/enums/date_part_specifier.hpp"
|
4
4
|
#include "duckdb/common/exception.hpp"
|
5
5
|
#include "duckdb/common/string_util.hpp"
|
6
|
+
#include "duckdb/common/enum_util.hpp"
|
6
7
|
#include "duckdb/common/types/date.hpp"
|
7
8
|
#include "duckdb/common/types/timestamp.hpp"
|
8
9
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
@@ -81,7 +82,7 @@ DatePartSpecifier GetDateTypePartSpecifier(const string &specifier, LogicalType
|
|
81
82
|
break;
|
82
83
|
}
|
83
84
|
|
84
|
-
throw NotImplementedException("\"%s\" units \"%s\" not recognized",
|
85
|
+
throw NotImplementedException("\"%s\" units \"%s\" not recognized", EnumUtil::ToString(type.id()), specifier);
|
85
86
|
}
|
86
87
|
|
87
88
|
template <int64_t MIN, int64_t MAX>
|
@@ -1,11 +1,10 @@
|
|
1
1
|
#include "duckdb/core_functions/scalar/list_functions.hpp"
|
2
|
-
#include "duckdb/common/
|
2
|
+
#include "duckdb/common/enum_util.hpp"
|
3
3
|
#include "duckdb/common/types/chunk_collection.hpp"
|
4
4
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
5
5
|
#include "duckdb/execution/expression_executor.hpp"
|
6
6
|
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
7
7
|
#include "duckdb/main/config.hpp"
|
8
|
-
|
9
8
|
#include "duckdb/common/sort/sort.hpp"
|
10
9
|
|
11
10
|
namespace duckdb {
|
@@ -251,7 +250,7 @@ static T GetOrder(ClientContext &context, Expression &expr) {
|
|
251
250
|
}
|
252
251
|
Value order_value = ExpressionExecutor::EvaluateScalar(context, expr);
|
253
252
|
auto order_name = StringUtil::Upper(order_value.ToString());
|
254
|
-
return
|
253
|
+
return EnumUtil::FromString<T>(order_name.c_str());
|
255
254
|
}
|
256
255
|
|
257
256
|
static unique_ptr<FunctionData> ListNormalSortBind(ClientContext &context, ScalarFunction &bound_function,
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#include "duckdb/core_functions/scalar/string_functions.hpp"
|
2
|
+
#include "duckdb/common/types/data_chunk.hpp"
|
3
|
+
#include "duckdb/common/string_util.hpp"
|
4
|
+
|
5
|
+
namespace duckdb {
|
6
|
+
|
7
|
+
static void FormatBytesFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
8
|
+
UnaryExecutor::Execute<int64_t, string_t>(args.data[0], result, args.size(), [&](int64_t bytes) {
|
9
|
+
bool is_negative = bytes < 0;
|
10
|
+
idx_t unsigned_bytes;
|
11
|
+
if (bytes < 0) {
|
12
|
+
if (bytes == NumericLimits<int64_t>::Minimum()) {
|
13
|
+
unsigned_bytes = idx_t(NumericLimits<int64_t>::Maximum()) + 1;
|
14
|
+
} else {
|
15
|
+
unsigned_bytes = idx_t(-bytes);
|
16
|
+
}
|
17
|
+
} else {
|
18
|
+
unsigned_bytes = idx_t(bytes);
|
19
|
+
}
|
20
|
+
return StringVector::AddString(result, (is_negative ? "-" : "") +
|
21
|
+
StringUtil::BytesToHumanReadableString(unsigned_bytes));
|
22
|
+
});
|
23
|
+
}
|
24
|
+
|
25
|
+
ScalarFunction FormatBytesFun::GetFunction() {
|
26
|
+
return ScalarFunction({LogicalType::BIGINT}, LogicalType::VARCHAR, FormatBytesFunction);
|
27
|
+
}
|
28
|
+
|
29
|
+
} // namespace duckdb
|
@@ -236,7 +236,7 @@ void GroupedAggregateHashTable::Resize(idx_t size) {
|
|
236
236
|
|
237
237
|
idx_t GroupedAggregateHashTable::AddChunk(AggregateHTAppendState &state, DataChunk &groups, DataChunk &payload,
|
238
238
|
AggregateType filter) {
|
239
|
-
|
239
|
+
unsafe_vector<idx_t> aggregate_filter;
|
240
240
|
|
241
241
|
auto &aggregates = layout.GetAggregates();
|
242
242
|
for (idx_t i = 0; i < aggregates.size(); i++) {
|
@@ -249,7 +249,7 @@ idx_t GroupedAggregateHashTable::AddChunk(AggregateHTAppendState &state, DataChu
|
|
249
249
|
}
|
250
250
|
|
251
251
|
idx_t GroupedAggregateHashTable::AddChunk(AggregateHTAppendState &state, DataChunk &groups, DataChunk &payload,
|
252
|
-
const
|
252
|
+
const unsafe_vector<idx_t> &filter) {
|
253
253
|
Vector hashes(LogicalType::HASH);
|
254
254
|
groups.Hash(hashes);
|
255
255
|
|
@@ -257,7 +257,7 @@ idx_t GroupedAggregateHashTable::AddChunk(AggregateHTAppendState &state, DataChu
|
|
257
257
|
}
|
258
258
|
|
259
259
|
idx_t GroupedAggregateHashTable::AddChunk(AggregateHTAppendState &state, DataChunk &groups, Vector &group_hashes,
|
260
|
-
DataChunk &payload, const
|
260
|
+
DataChunk &payload, const unsafe_vector<idx_t> &filter) {
|
261
261
|
D_ASSERT(!is_finalized);
|
262
262
|
if (groups.size() == 0) {
|
263
263
|
return 0;
|
@@ -879,7 +879,11 @@ string ART::GenerateConstraintErrorMessage(VerifyExistenceType verify_type, cons
|
|
879
879
|
case VerifyExistenceType::APPEND: {
|
880
880
|
// APPEND to PK/UNIQUE table, but node/key already exists in PK/UNIQUE table
|
881
881
|
string type = IsPrimary() ? "primary key" : "unique";
|
882
|
-
return StringUtil::Format(
|
882
|
+
return StringUtil::Format(
|
883
|
+
"Duplicate key \"%s\" violates %s constraint. "
|
884
|
+
"If this is an unexpected constraint violation please double "
|
885
|
+
"check with the known index limitations section in our documentation (docs - sql - indexes).",
|
886
|
+
key_name, type);
|
883
887
|
}
|
884
888
|
case VerifyExistenceType::APPEND_FK: {
|
885
889
|
// APPEND_FK to FK table, node/key does not exist in PK/UNIQUE table
|
@@ -171,7 +171,7 @@ bool DistinctAggregateCollectionInfo::AnyDistinct() const {
|
|
171
171
|
return !indices.empty();
|
172
172
|
}
|
173
173
|
|
174
|
-
const
|
174
|
+
const unsafe_vector<idx_t> &DistinctAggregateCollectionInfo::Indices() const {
|
175
175
|
return this->indices;
|
176
176
|
}
|
177
177
|
|
@@ -12,7 +12,7 @@ const vector<vector<idx_t>> &GroupedAggregateData::GetGroupingFunctions() const
|
|
12
12
|
|
13
13
|
void GroupedAggregateData::InitializeGroupby(vector<unique_ptr<Expression>> groups,
|
14
14
|
vector<unique_ptr<Expression>> expressions,
|
15
|
-
vector<
|
15
|
+
vector<unsafe_vector<idx_t>> grouping_functions) {
|
16
16
|
InitializeGroupbyGroups(std::move(groups));
|
17
17
|
vector<LogicalType> payload_types_filters;
|
18
18
|
|
@@ -86,7 +86,7 @@ void GroupedAggregateData::InitializeGroupbyGroups(vector<unique_ptr<Expression>
|
|
86
86
|
this->groups = std::move(groups);
|
87
87
|
}
|
88
88
|
|
89
|
-
void GroupedAggregateData::SetGroupingFunctions(vector<
|
89
|
+
void GroupedAggregateData::SetGroupingFunctions(vector<unsafe_vector<idx_t>> &functions) {
|
90
90
|
grouping_functions.reserve(functions.size());
|
91
91
|
for (idx_t i = 0; i < functions.size(); i++) {
|
92
92
|
grouping_functions.push_back(std::move(functions[i]));
|
@@ -4,6 +4,7 @@
|
|
4
4
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
5
5
|
#include "duckdb/execution/aggregate_hashtable.hpp"
|
6
6
|
#include "duckdb/main/client_context.hpp"
|
7
|
+
#include "duckdb/parallel/interrupt.hpp"
|
7
8
|
#include "duckdb/parallel/pipeline.hpp"
|
8
9
|
#include "duckdb/parallel/task_scheduler.hpp"
|
9
10
|
#include "duckdb/parallel/thread_context.hpp"
|
@@ -116,7 +117,8 @@ PhysicalHashAggregate::PhysicalHashAggregate(ClientContext &context, vector<Logi
|
|
116
117
|
vector<unique_ptr<Expression>> expressions,
|
117
118
|
vector<unique_ptr<Expression>> groups_p,
|
118
119
|
vector<GroupingSet> grouping_sets_p,
|
119
|
-
vector<
|
120
|
+
vector<unsafe_vector<idx_t>> grouping_functions_p,
|
121
|
+
idx_t estimated_cardinality)
|
120
122
|
: PhysicalOperator(PhysicalOperatorType::HASH_GROUP_BY, std::move(types), estimated_cardinality),
|
121
123
|
grouping_sets(std::move(grouping_sets_p)) {
|
122
124
|
// get a list of all aggregates to be computed
|
@@ -250,10 +252,10 @@ unique_ptr<LocalSinkState> PhysicalHashAggregate::GetLocalSinkState(ExecutionCon
|
|
250
252
|
return make_uniq<HashAggregateLocalState>(*this, context);
|
251
253
|
}
|
252
254
|
|
253
|
-
void PhysicalHashAggregate::SinkDistinctGrouping(ExecutionContext &context,
|
254
|
-
|
255
|
-
auto &sink =
|
256
|
-
auto &global_sink =
|
255
|
+
void PhysicalHashAggregate::SinkDistinctGrouping(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input,
|
256
|
+
idx_t grouping_idx) const {
|
257
|
+
auto &sink = input.local_state.Cast<HashAggregateLocalState>();
|
258
|
+
auto &global_sink = input.global_state.Cast<HashAggregateGlobalState>();
|
257
259
|
|
258
260
|
auto &grouping_gstate = global_sink.grouping_states[grouping_idx];
|
259
261
|
auto &grouping_lstate = sink.grouping_states[grouping_idx];
|
@@ -265,7 +267,7 @@ void PhysicalHashAggregate::SinkDistinctGrouping(ExecutionContext &context, Glob
|
|
265
267
|
DataChunk empty_chunk;
|
266
268
|
|
267
269
|
// Create an empty filter for Sink, since we don't need to update any aggregate states here
|
268
|
-
|
270
|
+
unsafe_vector<idx_t> empty_filter;
|
269
271
|
|
270
272
|
for (idx_t &idx : distinct_info.indices) {
|
271
273
|
auto &aggregate = grouped_aggregate_data.aggregates[idx]->Cast<BoundAggregateExpression>();
|
@@ -280,6 +282,9 @@ void PhysicalHashAggregate::SinkDistinctGrouping(ExecutionContext &context, Glob
|
|
280
282
|
auto &radix_global_sink = *distinct_state->radix_states[table_idx];
|
281
283
|
auto &radix_local_sink = *grouping_lstate.distinct_states[table_idx];
|
282
284
|
|
285
|
+
InterruptState interrupt_state;
|
286
|
+
OperatorSinkInput sink_input {radix_global_sink, radix_local_sink, interrupt_state};
|
287
|
+
|
283
288
|
if (aggregate.filter) {
|
284
289
|
DataChunk filter_chunk;
|
285
290
|
auto &filtered_data = sink.filter_set.GetFilterData(idx);
|
@@ -288,10 +293,10 @@ void PhysicalHashAggregate::SinkDistinctGrouping(ExecutionContext &context, Glob
|
|
288
293
|
// Add the filter Vector (BOOL)
|
289
294
|
auto it = filter_indexes.find(aggregate.filter.get());
|
290
295
|
D_ASSERT(it != filter_indexes.end());
|
291
|
-
D_ASSERT(it->second <
|
296
|
+
D_ASSERT(it->second < chunk.data.size());
|
292
297
|
auto &filter_bound_ref = aggregate.filter->Cast<BoundReferenceExpression>();
|
293
|
-
filter_chunk.data[filter_bound_ref.index].Reference(
|
294
|
-
filter_chunk.SetCardinality(
|
298
|
+
filter_chunk.data[filter_bound_ref.index].Reference(chunk.data[it->second]);
|
299
|
+
filter_chunk.SetCardinality(chunk.size());
|
295
300
|
|
296
301
|
// We cant use the AggregateFilterData::ApplyFilter method, because the chunk we need to
|
297
302
|
// apply the filter to also has the groups, and the filtered_data.filtered_payload does not have those.
|
@@ -305,43 +310,42 @@ void PhysicalHashAggregate::SinkDistinctGrouping(ExecutionContext &context, Glob
|
|
305
310
|
// Because the 'input' chunk needs to be re-used after this, we need to create
|
306
311
|
// a duplicate of it, that we can apply the filter to
|
307
312
|
DataChunk filtered_input;
|
308
|
-
filtered_input.InitializeEmpty(
|
313
|
+
filtered_input.InitializeEmpty(chunk.GetTypes());
|
309
314
|
|
310
315
|
for (idx_t group_idx = 0; group_idx < grouped_aggregate_data.groups.size(); group_idx++) {
|
311
316
|
auto &group = grouped_aggregate_data.groups[group_idx];
|
312
317
|
auto &bound_ref = group->Cast<BoundReferenceExpression>();
|
313
|
-
filtered_input.data[bound_ref.index].Reference(
|
318
|
+
filtered_input.data[bound_ref.index].Reference(chunk.data[bound_ref.index]);
|
314
319
|
}
|
315
320
|
for (idx_t child_idx = 0; child_idx < aggregate.children.size(); child_idx++) {
|
316
321
|
auto &child = aggregate.children[child_idx];
|
317
322
|
auto &bound_ref = child->Cast<BoundReferenceExpression>();
|
318
323
|
|
319
|
-
filtered_input.data[bound_ref.index].Reference(
|
324
|
+
filtered_input.data[bound_ref.index].Reference(chunk.data[bound_ref.index]);
|
320
325
|
}
|
321
326
|
filtered_input.Slice(sel_vec, count);
|
322
327
|
filtered_input.SetCardinality(count);
|
323
328
|
|
324
|
-
radix_table.Sink(context,
|
329
|
+
radix_table.Sink(context, filtered_input, sink_input, empty_chunk, empty_filter);
|
325
330
|
} else {
|
326
|
-
radix_table.Sink(context,
|
331
|
+
radix_table.Sink(context, chunk, sink_input, empty_chunk, empty_filter);
|
327
332
|
}
|
328
333
|
}
|
329
334
|
}
|
330
335
|
|
331
|
-
void PhysicalHashAggregate::SinkDistinct(ExecutionContext &context,
|
332
|
-
DataChunk &input) const {
|
336
|
+
void PhysicalHashAggregate::SinkDistinct(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const {
|
333
337
|
for (idx_t i = 0; i < groupings.size(); i++) {
|
334
|
-
SinkDistinctGrouping(context,
|
338
|
+
SinkDistinctGrouping(context, chunk, input, i);
|
335
339
|
}
|
336
340
|
}
|
337
341
|
|
338
|
-
SinkResultType PhysicalHashAggregate::Sink(ExecutionContext &context,
|
339
|
-
|
340
|
-
auto &llstate =
|
341
|
-
auto &gstate =
|
342
|
+
SinkResultType PhysicalHashAggregate::Sink(ExecutionContext &context, DataChunk &chunk,
|
343
|
+
OperatorSinkInput &input) const {
|
344
|
+
auto &llstate = input.local_state.Cast<HashAggregateLocalState>();
|
345
|
+
auto &gstate = input.global_state.Cast<HashAggregateGlobalState>();
|
342
346
|
|
343
347
|
if (distinct_collection_info) {
|
344
|
-
SinkDistinct(context,
|
348
|
+
SinkDistinct(context, chunk, input);
|
345
349
|
}
|
346
350
|
|
347
351
|
if (CanSkipRegularSink()) {
|
@@ -359,8 +363,8 @@ SinkResultType PhysicalHashAggregate::Sink(ExecutionContext &context, GlobalSink
|
|
359
363
|
for (auto &child_expr : aggr.children) {
|
360
364
|
D_ASSERT(child_expr->type == ExpressionType::BOUND_REF);
|
361
365
|
auto &bound_ref_expr = child_expr->Cast<BoundReferenceExpression>();
|
362
|
-
D_ASSERT(bound_ref_expr.index <
|
363
|
-
aggregate_input_chunk.data[aggregate_input_idx++].Reference(
|
366
|
+
D_ASSERT(bound_ref_expr.index < chunk.data.size());
|
367
|
+
aggregate_input_chunk.data[aggregate_input_idx++].Reference(chunk.data[bound_ref_expr.index]);
|
364
368
|
}
|
365
369
|
}
|
366
370
|
// Populate the filter vectors
|
@@ -369,23 +373,24 @@ SinkResultType PhysicalHashAggregate::Sink(ExecutionContext &context, GlobalSink
|
|
369
373
|
if (aggr.filter) {
|
370
374
|
auto it = filter_indexes.find(aggr.filter.get());
|
371
375
|
D_ASSERT(it != filter_indexes.end());
|
372
|
-
D_ASSERT(it->second <
|
373
|
-
aggregate_input_chunk.data[aggregate_input_idx++].Reference(
|
376
|
+
D_ASSERT(it->second < chunk.data.size());
|
377
|
+
aggregate_input_chunk.data[aggregate_input_idx++].Reference(chunk.data[it->second]);
|
374
378
|
}
|
375
379
|
}
|
376
380
|
|
377
|
-
aggregate_input_chunk.SetCardinality(
|
381
|
+
aggregate_input_chunk.SetCardinality(chunk.size());
|
378
382
|
aggregate_input_chunk.Verify();
|
379
383
|
|
380
384
|
// For every grouping set there is one radix_table
|
381
385
|
for (idx_t i = 0; i < groupings.size(); i++) {
|
382
386
|
auto &grouping_gstate = gstate.grouping_states[i];
|
383
387
|
auto &grouping_lstate = llstate.grouping_states[i];
|
388
|
+
InterruptState interrupt_state;
|
389
|
+
OperatorSinkInput sink_input {*grouping_gstate.table_state, *grouping_lstate.table_state, interrupt_state};
|
384
390
|
|
385
391
|
auto &grouping = groupings[i];
|
386
392
|
auto &table = grouping.table_data;
|
387
|
-
table.Sink(context,
|
388
|
-
non_distinct_filter);
|
393
|
+
table.Sink(context, chunk, sink_input, aggregate_input_chunk, non_distinct_filter);
|
389
394
|
}
|
390
395
|
|
391
396
|
return SinkResultType::NEED_MORE_INPUT;
|
@@ -452,7 +457,7 @@ public:
|
|
452
457
|
|
453
458
|
public:
|
454
459
|
void Schedule() override {
|
455
|
-
vector<
|
460
|
+
vector<shared_ptr<Task>> tasks;
|
456
461
|
for (idx_t i = 0; i < op.groupings.size(); i++) {
|
457
462
|
auto &grouping_gstate = gstate.grouping_states[i];
|
458
463
|
|
@@ -504,7 +509,7 @@ public:
|
|
504
509
|
|
505
510
|
public:
|
506
511
|
void Schedule() override {
|
507
|
-
vector<
|
512
|
+
vector<shared_ptr<Task>> tasks;
|
508
513
|
tasks.push_back(make_uniq<HashAggregateFinalizeTask>(*pipeline, shared_from_this(), gstate, context, op));
|
509
514
|
D_ASSERT(!tasks.empty());
|
510
515
|
SetTasks(std::move(tasks));
|
@@ -579,11 +584,18 @@ public:
|
|
579
584
|
output_chunk.Reset();
|
580
585
|
group_chunk.Reset();
|
581
586
|
aggregate_input_chunk.Reset();
|
582
|
-
radix_table_p->GetData(temp_exec_context, output_chunk, *state.radix_states[table_idx], *global_source,
|
583
|
-
*local_source);
|
584
587
|
|
585
|
-
|
588
|
+
InterruptState interrupt_state;
|
589
|
+
OperatorSourceInput source_input {*global_source, *local_source, interrupt_state};
|
590
|
+
auto res = radix_table_p->GetData(temp_exec_context, output_chunk, *state.radix_states[table_idx],
|
591
|
+
source_input);
|
592
|
+
|
593
|
+
if (res == SourceResultType::FINISHED) {
|
594
|
+
D_ASSERT(output_chunk.size() == 0);
|
586
595
|
break;
|
596
|
+
} else if (res == SourceResultType::BLOCKED) {
|
597
|
+
throw InternalException(
|
598
|
+
"Unexpected interrupt from radix table GetData in HashDistinctAggregateFinalizeTask");
|
587
599
|
}
|
588
600
|
|
589
601
|
auto &grouped_aggregate_data = *data.grouped_aggregate_data[table_idx];
|
@@ -603,8 +615,8 @@ public:
|
|
603
615
|
aggregate_input_chunk.SetCardinality(output_chunk);
|
604
616
|
|
605
617
|
// Sink it into the main ht
|
606
|
-
|
607
|
-
|
618
|
+
OperatorSinkInput sink_input {table_state, *temp_local_state, interrupt_state};
|
619
|
+
grouping_data.table_data.Sink(temp_exec_context, group_chunk, sink_input, aggregate_input_chunk, {i});
|
608
620
|
}
|
609
621
|
}
|
610
622
|
grouping_data.table_data.Combine(temp_exec_context, table_state, *temp_local_state);
|
@@ -650,7 +662,7 @@ public:
|
|
650
662
|
void Schedule() override {
|
651
663
|
global_sources = CreateGlobalSources();
|
652
664
|
|
653
|
-
vector<
|
665
|
+
vector<shared_ptr<Task>> tasks;
|
654
666
|
auto &scheduler = TaskScheduler::GetScheduler(context);
|
655
667
|
auto number_of_threads = scheduler.NumberOfThreads();
|
656
668
|
tasks.reserve(number_of_threads);
|
@@ -714,7 +726,7 @@ public:
|
|
714
726
|
|
715
727
|
public:
|
716
728
|
void Schedule() override {
|
717
|
-
vector<
|
729
|
+
vector<shared_ptr<Task>> tasks;
|
718
730
|
for (idx_t i = 0; i < op.groupings.size(); i++) {
|
719
731
|
auto &grouping = op.groupings[i];
|
720
732
|
auto &distinct_data = *grouping.distinct_data;
|
@@ -868,11 +880,11 @@ unique_ptr<LocalSourceState> PhysicalHashAggregate::GetLocalSourceState(Executio
|
|
868
880
|
return make_uniq<PhysicalHashAggregateLocalSourceState>(context, *this);
|
869
881
|
}
|
870
882
|
|
871
|
-
|
872
|
-
|
883
|
+
SourceResultType PhysicalHashAggregate::GetData(ExecutionContext &context, DataChunk &chunk,
|
884
|
+
OperatorSourceInput &input) const {
|
873
885
|
auto &sink_gstate = sink_state->Cast<HashAggregateGlobalState>();
|
874
|
-
auto &gstate =
|
875
|
-
auto &lstate =
|
886
|
+
auto &gstate = input.global_state.Cast<PhysicalHashAggregateGlobalSourceState>();
|
887
|
+
auto &lstate = input.local_state.Cast<PhysicalHashAggregateLocalSourceState>();
|
876
888
|
while (true) {
|
877
889
|
idx_t radix_idx = gstate.state_index;
|
878
890
|
if (radix_idx >= groupings.size()) {
|
@@ -881,11 +893,17 @@ void PhysicalHashAggregate::GetData(ExecutionContext &context, DataChunk &chunk,
|
|
881
893
|
auto &grouping = groupings[radix_idx];
|
882
894
|
auto &radix_table = grouping.table_data;
|
883
895
|
auto &grouping_gstate = sink_gstate.grouping_states[radix_idx];
|
884
|
-
|
885
|
-
|
896
|
+
|
897
|
+
InterruptState interrupt_state;
|
898
|
+
OperatorSourceInput source_input {*gstate.radix_states[radix_idx], *lstate.radix_states[radix_idx],
|
899
|
+
interrupt_state};
|
900
|
+
auto res = radix_table.GetData(context, chunk, *grouping_gstate.table_state, source_input);
|
886
901
|
if (chunk.size() != 0) {
|
887
|
-
return;
|
902
|
+
return SourceResultType::HAVE_MORE_OUTPUT;
|
903
|
+
} else if (res == SourceResultType::BLOCKED) {
|
904
|
+
throw InternalException("Unexpectedly Blocked from radix_table");
|
888
905
|
}
|
906
|
+
|
889
907
|
// move to the next table
|
890
908
|
lock_guard<mutex> l(gstate.lock);
|
891
909
|
radix_idx++;
|
@@ -895,6 +913,8 @@ void PhysicalHashAggregate::GetData(ExecutionContext &context, DataChunk &chunk,
|
|
895
913
|
gstate.state_index = radix_idx;
|
896
914
|
}
|
897
915
|
}
|
916
|
+
|
917
|
+
return chunk.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
898
918
|
}
|
899
919
|
|
900
920
|
string PhysicalHashAggregate::ParamsToString() const {
|
@@ -114,9 +114,9 @@ unique_ptr<LocalSinkState> PhysicalPerfectHashAggregate::GetLocalSinkState(Execu
|
|
114
114
|
return make_uniq<PerfectHashAggregateLocalState>(*this, context);
|
115
115
|
}
|
116
116
|
|
117
|
-
SinkResultType PhysicalPerfectHashAggregate::Sink(ExecutionContext &context,
|
118
|
-
|
119
|
-
auto &lstate =
|
117
|
+
SinkResultType PhysicalPerfectHashAggregate::Sink(ExecutionContext &context, DataChunk &chunk,
|
118
|
+
OperatorSinkInput &input) const {
|
119
|
+
auto &lstate = input.local_state.Cast<PerfectHashAggregateLocalState>();
|
120
120
|
DataChunk &group_chunk = lstate.group_chunk;
|
121
121
|
DataChunk &aggregate_input_chunk = lstate.aggregate_input_chunk;
|
122
122
|
|
@@ -124,7 +124,7 @@ SinkResultType PhysicalPerfectHashAggregate::Sink(ExecutionContext &context, Glo
|
|
124
124
|
auto &group = groups[group_idx];
|
125
125
|
D_ASSERT(group->type == ExpressionType::BOUND_REF);
|
126
126
|
auto &bound_ref_expr = group->Cast<BoundReferenceExpression>();
|
127
|
-
group_chunk.data[group_idx].Reference(
|
127
|
+
group_chunk.data[group_idx].Reference(chunk.data[bound_ref_expr.index]);
|
128
128
|
}
|
129
129
|
idx_t aggregate_input_idx = 0;
|
130
130
|
for (auto &aggregate : aggregates) {
|
@@ -132,7 +132,7 @@ SinkResultType PhysicalPerfectHashAggregate::Sink(ExecutionContext &context, Glo
|
|
132
132
|
for (auto &child_expr : aggr.children) {
|
133
133
|
D_ASSERT(child_expr->type == ExpressionType::BOUND_REF);
|
134
134
|
auto &bound_ref_expr = child_expr->Cast<BoundReferenceExpression>();
|
135
|
-
aggregate_input_chunk.data[aggregate_input_idx++].Reference(
|
135
|
+
aggregate_input_chunk.data[aggregate_input_idx++].Reference(chunk.data[bound_ref_expr.index]);
|
136
136
|
}
|
137
137
|
}
|
138
138
|
for (auto &aggregate : aggregates) {
|
@@ -140,13 +140,13 @@ SinkResultType PhysicalPerfectHashAggregate::Sink(ExecutionContext &context, Glo
|
|
140
140
|
if (aggr.filter) {
|
141
141
|
auto it = filter_indexes.find(aggr.filter.get());
|
142
142
|
D_ASSERT(it != filter_indexes.end());
|
143
|
-
aggregate_input_chunk.data[aggregate_input_idx++].Reference(
|
143
|
+
aggregate_input_chunk.data[aggregate_input_idx++].Reference(chunk.data[it->second]);
|
144
144
|
}
|
145
145
|
}
|
146
146
|
|
147
|
-
group_chunk.SetCardinality(
|
147
|
+
group_chunk.SetCardinality(chunk.size());
|
148
148
|
|
149
|
-
aggregate_input_chunk.SetCardinality(
|
149
|
+
aggregate_input_chunk.SetCardinality(chunk.size());
|
150
150
|
|
151
151
|
group_chunk.Verify();
|
152
152
|
aggregate_input_chunk.Verify();
|
@@ -184,12 +184,18 @@ unique_ptr<GlobalSourceState> PhysicalPerfectHashAggregate::GetGlobalSourceState
|
|
184
184
|
return make_uniq<PerfectHashAggregateState>();
|
185
185
|
}
|
186
186
|
|
187
|
-
|
188
|
-
|
189
|
-
auto &state = (PerfectHashAggregateState &)
|
187
|
+
SourceResultType PhysicalPerfectHashAggregate::GetData(ExecutionContext &context, DataChunk &chunk,
|
188
|
+
OperatorSourceInput &input) const {
|
189
|
+
auto &state = (PerfectHashAggregateState &)input.global_state;
|
190
190
|
auto &gstate = sink_state->Cast<PerfectHashAggregateGlobalState>();
|
191
191
|
|
192
192
|
gstate.ht->Scan(state.ht_scan_position, chunk);
|
193
|
+
|
194
|
+
if (chunk.size() > 0) {
|
195
|
+
return SourceResultType::HAVE_MORE_OUTPUT;
|
196
|
+
} else {
|
197
|
+
return SourceResultType::FINISHED;
|
198
|
+
}
|
193
199
|
}
|
194
200
|
|
195
201
|
string PhysicalPerfectHashAggregate::ParamsToString() const {
|