duckdb 0.7.2-dev2820.0 → 0.7.2-dev2995.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 +1 -0
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-datepart.cpp +55 -1
- package/src/duckdb/extension/parquet/parquet-extension.cpp +5 -4
- 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/local_file_system.cpp +1 -3
- package/src/duckdb/src/common/multi_file_reader.cpp +11 -8
- 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/core_functions/function_list.cpp +2 -0
- package/src/duckdb/src/core_functions/scalar/string/format_bytes.cpp +29 -0
- package/src/duckdb/src/execution/index/art/art.cpp +5 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +62 -43
- 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_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 +10 -8
- 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_insert.cpp +160 -145
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +10 -25
- 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 +4 -18
- 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 +20 -28
- 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/physical_operator.cpp +11 -5
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +16 -16
- package/src/duckdb/src/function/table/arrow_conversion.cpp +3 -3
- package/src/duckdb/src/function/table/read_csv.cpp +7 -4
- 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/enums/operator_result_type.hpp +16 -4
- package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +5 -4
- package/src/duckdb/src/include/duckdb/common/optional_idx.hpp +45 -0
- package/src/duckdb/src/include/duckdb/common/set.hpp +2 -1
- package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +15 -0
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +10 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +5 -8
- 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_insert.hpp +3 -5
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +2 -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 +6 -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/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 +5 -5
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +2 -1
- 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 +2 -0
- package/src/duckdb/src/include/duckdb/main/database.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +0 -2
- 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/tableref/pivotref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +5 -1
- 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/operator/logical_aggregate.hpp +1 -0
- 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/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/no_operator_caching_verifier.hpp +25 -0
- package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +5 -0
- package/src/duckdb/src/main/attached_database.cpp +5 -3
- package/src/duckdb/src/main/client_verify.cpp +4 -0
- package/src/duckdb/src/main/config.cpp +4 -0
- package/src/duckdb/src/main/database.cpp +45 -48
- package/src/duckdb/src/main/extension/extension_load.cpp +32 -49
- 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/transform/statement/transform_create_function.cpp +1 -4
- package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +2 -4
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +43 -24
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +3 -0
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +17 -28
- 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/operator/logical_aggregate.cpp +13 -1
- package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +11 -0
- 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/no_operator_caching_verifier.cpp +13 -0
- package/src/duckdb/src/verification/statement_verifier.cpp +4 -0
- package/src/duckdb/third_party/fmt/format.cc +0 -5
- package/src/duckdb/third_party/fmt/include/fmt/core.h +10 -12
- package/src/duckdb/third_party/fmt/include/fmt/format-inl.h +2 -33
- package/src/duckdb/third_party/fmt/include/fmt/format.h +61 -24
- package/src/duckdb/third_party/fmt/include/fmt/printf.h +15 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +1 -0
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +10735 -10674
- package/src/duckdb/ub_src_core_functions_scalar_string.cpp +2 -0
- package/src/duckdb/ub_src_parallel.cpp +2 -0
- package/src/duckdb/ub_src_storage.cpp +2 -0
@@ -38,8 +38,7 @@ public:
|
|
38
38
|
public:
|
39
39
|
// Source interface
|
40
40
|
unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
|
41
|
-
|
42
|
-
LocalSourceState &lstate) const override;
|
41
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
43
42
|
|
44
43
|
bool IsSource() const override {
|
45
44
|
return true;
|
@@ -47,8 +46,7 @@ public:
|
|
47
46
|
|
48
47
|
public:
|
49
48
|
// Sink interface
|
50
|
-
SinkResultType Sink(ExecutionContext &context,
|
51
|
-
DataChunk &input) const override;
|
49
|
+
SinkResultType Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override;
|
52
50
|
|
53
51
|
bool ParallelSink() const override {
|
54
52
|
return true;
|
@@ -77,8 +77,7 @@ public:
|
|
77
77
|
public:
|
78
78
|
// Source interface
|
79
79
|
unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
|
80
|
-
|
81
|
-
LocalSourceState &lstate) const override;
|
80
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
82
81
|
|
83
82
|
bool IsSource() const override {
|
84
83
|
return true;
|
@@ -88,8 +87,7 @@ public:
|
|
88
87
|
// Sink interface
|
89
88
|
unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
|
90
89
|
unique_ptr<LocalSinkState> GetLocalSinkState(ExecutionContext &context) const override;
|
91
|
-
SinkResultType Sink(ExecutionContext &context,
|
92
|
-
DataChunk &input) const override;
|
90
|
+
SinkResultType Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override;
|
93
91
|
void Combine(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate) const override;
|
94
92
|
SinkFinalizeType Finalize(Pipeline &pipeline, Event &event, ClientContext &context,
|
95
93
|
GlobalSinkState &gstate) const override;
|
@@ -36,8 +36,7 @@ public:
|
|
36
36
|
public:
|
37
37
|
// Source interface
|
38
38
|
unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
|
39
|
-
|
40
|
-
LocalSourceState &lstate) const override;
|
39
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
41
40
|
|
42
41
|
bool IsSource() const override {
|
43
42
|
return true;
|
@@ -47,8 +46,7 @@ public:
|
|
47
46
|
// Sink interface
|
48
47
|
unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
|
49
48
|
unique_ptr<LocalSinkState> GetLocalSinkState(ExecutionContext &context) const override;
|
50
|
-
SinkResultType Sink(ExecutionContext &context,
|
51
|
-
DataChunk &input) const override;
|
49
|
+
SinkResultType Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override;
|
52
50
|
void Combine(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate) const override;
|
53
51
|
|
54
52
|
bool IsSink() const override {
|
@@ -29,8 +29,7 @@ public:
|
|
29
29
|
|
30
30
|
public:
|
31
31
|
unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
|
32
|
-
|
33
|
-
LocalSourceState &lstate) const override;
|
32
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
34
33
|
|
35
34
|
bool IsSource() const override {
|
36
35
|
return true;
|
@@ -22,9 +22,7 @@ public:
|
|
22
22
|
}
|
23
23
|
|
24
24
|
public:
|
25
|
-
|
26
|
-
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
27
|
-
LocalSourceState &lstate) const override;
|
25
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
28
26
|
|
29
27
|
bool IsSource() const override {
|
30
28
|
return true;
|
@@ -22,8 +22,7 @@ public:
|
|
22
22
|
}
|
23
23
|
|
24
24
|
public:
|
25
|
-
|
26
|
-
LocalSourceState &lstate) const override;
|
25
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
27
26
|
|
28
27
|
bool IsSource() const override {
|
29
28
|
return true;
|
@@ -35,8 +35,7 @@ public:
|
|
35
35
|
unique_ptr<LocalSourceState> GetLocalSourceState(ExecutionContext &context,
|
36
36
|
GlobalSourceState &gstate) const override;
|
37
37
|
unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
|
38
|
-
|
39
|
-
LocalSourceState &lstate) const override;
|
38
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
40
39
|
|
41
40
|
double GetProgress(ClientContext &context, GlobalSourceState &gstate) const override;
|
42
41
|
|
@@ -55,8 +55,7 @@ public:
|
|
55
55
|
unique_ptr<LocalSourceState> GetLocalSourceState(ExecutionContext &context,
|
56
56
|
GlobalSourceState &gstate) const override;
|
57
57
|
unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
|
58
|
-
|
59
|
-
LocalSourceState &lstate) const override;
|
58
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
60
59
|
idx_t GetBatchIndex(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
61
60
|
LocalSourceState &lstate) const override;
|
62
61
|
|
@@ -28,9 +28,7 @@ public:
|
|
28
28
|
|
29
29
|
public:
|
30
30
|
// Source interface
|
31
|
-
|
32
|
-
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
33
|
-
LocalSourceState &lstate) const override;
|
31
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
34
32
|
|
35
33
|
bool IsSource() const override {
|
36
34
|
return true;
|
@@ -28,9 +28,7 @@ public:
|
|
28
28
|
|
29
29
|
public:
|
30
30
|
// Source interface
|
31
|
-
|
32
|
-
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
33
|
-
LocalSourceState &lstate) const override;
|
31
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
34
32
|
|
35
33
|
bool IsSource() const override {
|
36
34
|
return true;
|
package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp
CHANGED
@@ -28,9 +28,7 @@ public:
|
|
28
28
|
|
29
29
|
public:
|
30
30
|
// Source interface
|
31
|
-
|
32
|
-
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
33
|
-
LocalSourceState &lstate) const override;
|
31
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
34
32
|
|
35
33
|
bool IsSource() const override {
|
36
34
|
return true;
|
@@ -40,8 +40,7 @@ public:
|
|
40
40
|
|
41
41
|
public:
|
42
42
|
//! Source interface, NOP for this operator
|
43
|
-
|
44
|
-
LocalSourceState &lstate) const override;
|
43
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
45
44
|
|
46
45
|
bool IsSource() const override {
|
47
46
|
return true;
|
@@ -53,8 +52,7 @@ public:
|
|
53
52
|
//! Sink interface, global sink state
|
54
53
|
unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
|
55
54
|
|
56
|
-
SinkResultType Sink(ExecutionContext &context,
|
57
|
-
DataChunk &input) const override;
|
55
|
+
SinkResultType Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override;
|
58
56
|
void Combine(ExecutionContext &context, GlobalSinkState &gstate_p, LocalSinkState &lstate_p) const override;
|
59
57
|
SinkFinalizeType Finalize(Pipeline &pipeline, Event &event, ClientContext &context,
|
60
58
|
GlobalSinkState &gstate) const override;
|
@@ -28,9 +28,7 @@ public:
|
|
28
28
|
|
29
29
|
public:
|
30
30
|
// Source interface
|
31
|
-
|
32
|
-
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
33
|
-
LocalSourceState &lstate) const override;
|
31
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
34
32
|
|
35
33
|
bool IsSource() const override {
|
36
34
|
return true;
|
package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp
CHANGED
@@ -28,9 +28,7 @@ public:
|
|
28
28
|
|
29
29
|
public:
|
30
30
|
// Source interface
|
31
|
-
|
32
|
-
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
33
|
-
LocalSourceState &lstate) const override;
|
31
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
34
32
|
|
35
33
|
bool IsSource() const override {
|
36
34
|
return true;
|
@@ -29,9 +29,7 @@ public:
|
|
29
29
|
|
30
30
|
public:
|
31
31
|
// Source interface
|
32
|
-
|
33
|
-
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
34
|
-
LocalSourceState &lstate) const override;
|
32
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
35
33
|
|
36
34
|
bool IsSource() const override {
|
37
35
|
return true;
|
@@ -25,9 +25,7 @@ public:
|
|
25
25
|
|
26
26
|
public:
|
27
27
|
// Source interface
|
28
|
-
|
29
|
-
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
30
|
-
LocalSourceState &lstate) const override;
|
28
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
31
29
|
|
32
30
|
bool IsSource() const override {
|
33
31
|
return true;
|
@@ -37,8 +35,7 @@ public:
|
|
37
35
|
// Sink interface
|
38
36
|
unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
|
39
37
|
|
40
|
-
SinkResultType Sink(ExecutionContext &context,
|
41
|
-
DataChunk &input) const override;
|
38
|
+
SinkResultType Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override;
|
42
39
|
|
43
40
|
bool IsSink() const override {
|
44
41
|
return info->query != nullptr;
|
@@ -47,6 +44,10 @@ public:
|
|
47
44
|
bool ParallelSink() const override {
|
48
45
|
return false;
|
49
46
|
}
|
47
|
+
|
48
|
+
bool SinkOrderDependent() const override {
|
49
|
+
return true;
|
50
|
+
}
|
50
51
|
};
|
51
52
|
|
52
53
|
} // namespace duckdb
|
@@ -28,9 +28,7 @@ public:
|
|
28
28
|
|
29
29
|
public:
|
30
30
|
// Source interface
|
31
|
-
|
32
|
-
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
33
|
-
LocalSourceState &lstate) const override;
|
31
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
34
32
|
|
35
33
|
bool IsSource() const override {
|
36
34
|
return true;
|
@@ -27,9 +27,7 @@ public:
|
|
27
27
|
|
28
28
|
public:
|
29
29
|
// Source interface
|
30
|
-
|
31
|
-
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
32
|
-
LocalSourceState &lstate) const override;
|
30
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
33
31
|
|
34
32
|
bool IsSource() const override {
|
35
33
|
return true;
|
@@ -28,9 +28,7 @@ public:
|
|
28
28
|
|
29
29
|
public:
|
30
30
|
// Source interface
|
31
|
-
|
32
|
-
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
33
|
-
LocalSourceState &lstate) const override;
|
31
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
34
32
|
|
35
33
|
bool IsSource() const override {
|
36
34
|
return true;
|
@@ -30,8 +30,7 @@ public:
|
|
30
30
|
|
31
31
|
public:
|
32
32
|
// Source interface
|
33
|
-
|
34
|
-
LocalSourceState &lstate) const override;
|
33
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
|
35
34
|
|
36
35
|
bool IsSource() const override {
|
37
36
|
return true;
|
@@ -39,8 +38,7 @@ public:
|
|
39
38
|
|
40
39
|
public:
|
41
40
|
// Sink interface
|
42
|
-
SinkResultType Sink(ExecutionContext &context,
|
43
|
-
DataChunk &input) const override;
|
41
|
+
SinkResultType Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override;
|
44
42
|
|
45
43
|
unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
|
46
44
|
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#include "duckdb/common/types/data_chunk.hpp"
|
16
16
|
#include "duckdb/execution/execution_context.hpp"
|
17
17
|
#include "duckdb/optimizer/join_order/join_node.hpp"
|
18
|
+
#include "duckdb/common/optional_idx.hpp"
|
18
19
|
#include "duckdb/execution/physical_operator_states.hpp"
|
19
20
|
#include "duckdb/common/enums/order_preservation_type.hpp"
|
20
21
|
|
@@ -102,8 +103,8 @@ public:
|
|
102
103
|
virtual unique_ptr<LocalSourceState> GetLocalSourceState(ExecutionContext &context,
|
103
104
|
GlobalSourceState &gstate) const;
|
104
105
|
virtual unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const;
|
105
|
-
virtual
|
106
|
-
|
106
|
+
virtual SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const;
|
107
|
+
|
107
108
|
virtual idx_t GetBatchIndex(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
108
109
|
LocalSourceState &lstate) const;
|
109
110
|
|
@@ -132,8 +133,7 @@ public:
|
|
132
133
|
|
133
134
|
//! The sink method is called constantly with new input, as long as new input is available. Note that this method
|
134
135
|
//! CAN be called in parallel, proper locking is needed when accessing data inside the GlobalSinkState.
|
135
|
-
virtual SinkResultType Sink(ExecutionContext &context,
|
136
|
-
DataChunk &input) const;
|
136
|
+
virtual SinkResultType Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const;
|
137
137
|
// The combine is called when a single thread has completed execution of its part of the pipeline, it is the final
|
138
138
|
// time that a specific LocalSinkState is accessible. This method can be called in parallel while other Sink() or
|
139
139
|
// Combine() calls are active on the same GlobalSinkState.
|
@@ -143,6 +143,9 @@ public:
|
|
143
143
|
//! If Finalize returns SinkResultType::FINISHED, the sink is marked as finished
|
144
144
|
virtual SinkFinalizeType Finalize(Pipeline &pipeline, Event &event, ClientContext &context,
|
145
145
|
GlobalSinkState &gstate) const;
|
146
|
+
//! For sinks with RequiresBatchIndex set to true, when a new batch starts being processed this method is called
|
147
|
+
//! This allows flushing of the current batch (e.g. to disk)
|
148
|
+
virtual void NextBatch(ExecutionContext &context, GlobalSinkState &state, LocalSinkState &lstate_p) const;
|
146
149
|
|
147
150
|
virtual unique_ptr<LocalSinkState> GetLocalSinkState(ExecutionContext &context) const;
|
148
151
|
virtual unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const;
|
@@ -23,6 +23,18 @@ class PhysicalOperator;
|
|
23
23
|
class Pipeline;
|
24
24
|
class PipelineBuildState;
|
25
25
|
class MetaPipeline;
|
26
|
+
class InterruptState;
|
27
|
+
|
28
|
+
struct SourcePartitionInfo {
|
29
|
+
//! The current batch index
|
30
|
+
//! This is only set in case RequiresBatchIndex() is true, and the source has support for it (SupportsBatchIndex())
|
31
|
+
//! Otherwise this is left on INVALID_INDEX
|
32
|
+
//! The batch index is a globally unique, increasing index that should be used to maintain insertion order
|
33
|
+
//! //! in conjunction with parallelism
|
34
|
+
optional_idx batch_index;
|
35
|
+
//! The minimum batch index that any thread is currently actively reading
|
36
|
+
optional_idx min_batch_index;
|
37
|
+
};
|
26
38
|
|
27
39
|
// LCOV_EXCL_START
|
28
40
|
class OperatorState {
|
@@ -88,12 +100,8 @@ public:
|
|
88
100
|
virtual ~LocalSinkState() {
|
89
101
|
}
|
90
102
|
|
91
|
-
//!
|
92
|
-
|
93
|
-
//! Otherwise this is left on INVALID_INDEX
|
94
|
-
//! The batch index is a globally unique, increasing index that should be used to maintain insertion order
|
95
|
-
//! //! in conjunction with parallelism
|
96
|
-
idx_t batch_index = DConstants::INVALID_INDEX;
|
103
|
+
//! Source partition info
|
104
|
+
SourcePartitionInfo partition_info;
|
97
105
|
|
98
106
|
template <class TARGET>
|
99
107
|
TARGET &Cast() {
|
@@ -145,6 +153,18 @@ public:
|
|
145
153
|
}
|
146
154
|
};
|
147
155
|
|
156
|
+
struct OperatorSinkInput {
|
157
|
+
GlobalSinkState &global_state;
|
158
|
+
LocalSinkState &local_state;
|
159
|
+
InterruptState &interrupt_state;
|
160
|
+
};
|
161
|
+
|
162
|
+
struct OperatorSourceInput {
|
163
|
+
GlobalSourceState &global_state;
|
164
|
+
LocalSourceState &local_state;
|
165
|
+
InterruptState &interrupt_state;
|
166
|
+
};
|
167
|
+
|
148
168
|
// LCOV_EXCL_STOP
|
149
169
|
|
150
170
|
} // namespace duckdb
|
@@ -41,20 +41,20 @@ public:
|
|
41
41
|
unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const;
|
42
42
|
unique_ptr<LocalSinkState> GetLocalSinkState(ExecutionContext &context) const;
|
43
43
|
|
44
|
-
void Sink(ExecutionContext &context,
|
45
|
-
|
44
|
+
void Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input, DataChunk &aggregate_input_chunk,
|
45
|
+
const vector<idx_t> &filter) const;
|
46
46
|
void Combine(ExecutionContext &context, GlobalSinkState &state, LocalSinkState &lstate) const;
|
47
47
|
bool Finalize(ClientContext &context, GlobalSinkState &gstate_p) const;
|
48
48
|
|
49
49
|
void ScheduleTasks(Executor &executor, const shared_ptr<Event> &event, GlobalSinkState &state,
|
50
|
-
vector<
|
50
|
+
vector<shared_ptr<Task>> &tasks) const;
|
51
51
|
|
52
52
|
//! Source interface
|
53
53
|
idx_t Size(GlobalSinkState &sink_state) const;
|
54
54
|
unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const;
|
55
55
|
unique_ptr<LocalSourceState> GetLocalSourceState(ExecutionContext &context) const;
|
56
|
-
|
57
|
-
|
56
|
+
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, GlobalSinkState &sink_state,
|
57
|
+
OperatorSourceInput &input) const;
|
58
58
|
|
59
59
|
static void SetMultiScan(GlobalSinkState &state);
|
60
60
|
bool ForceSingleHT(GlobalSinkState &state) const;
|
@@ -25,7 +25,8 @@ class BoundAggregateExpression;
|
|
25
25
|
|
26
26
|
struct AggregateInputData {
|
27
27
|
AggregateInputData(FunctionData *bind_data_p, Allocator &allocator_p)
|
28
|
-
: bind_data(bind_data_p), allocator(allocator_p) {
|
28
|
+
: bind_data(bind_data_p), allocator(allocator_p) {
|
29
|
+
}
|
29
30
|
FunctionData *bind_data;
|
30
31
|
Allocator &allocator;
|
31
32
|
};
|
@@ -182,7 +182,6 @@ typedef unique_ptr<LocalTableFunctionState> (*table_function_init_local_t)(Execu
|
|
182
182
|
typedef unique_ptr<BaseStatistics> (*table_statistics_t)(ClientContext &context, const FunctionData *bind_data,
|
183
183
|
column_t column_index);
|
184
184
|
typedef void (*table_function_t)(ClientContext &context, TableFunctionInput &data, DataChunk &output);
|
185
|
-
|
186
185
|
typedef OperatorResultType (*table_in_out_function_t)(ExecutionContext &context, TableFunctionInput &data,
|
187
186
|
DataChunk &input, DataChunk &output);
|
188
187
|
typedef OperatorFinalizeResultType (*table_in_out_function_final_t)(ExecutionContext &context, TableFunctionInput &data,
|
@@ -63,6 +63,8 @@ struct ClientConfig {
|
|
63
63
|
bool verify_serializer = false;
|
64
64
|
//! Enable the running of optimizers
|
65
65
|
bool enable_optimizer = true;
|
66
|
+
//! Enable caching operators
|
67
|
+
bool enable_caching_operators = true;
|
66
68
|
//! Force parallelism of small tables, used for testing
|
67
69
|
bool verify_parallelism = false;
|
68
70
|
//! Force index join independent of table cardinality, used for testing
|
@@ -149,6 +149,8 @@ struct DBConfigOptions {
|
|
149
149
|
DebugInitialize debug_initialize = DebugInitialize::NO_INITIALIZE;
|
150
150
|
//! The set of unrecognized (other) options
|
151
151
|
unordered_map<string, Value> unrecognized_options;
|
152
|
+
//! Whether to print bindings when printing the plan (debug mode only)
|
153
|
+
static bool debug_print_bindings;
|
152
154
|
|
153
155
|
bool operator==(const DBConfigOptions &other) const;
|
154
156
|
};
|
@@ -56,8 +56,6 @@ public:
|
|
56
56
|
|
57
57
|
static const vector<string> GetPublicKeys();
|
58
58
|
|
59
|
-
static void StorageInit(string &extension, DBConfig &config);
|
60
|
-
|
61
59
|
// Returns extension name, or empty string if not a replacement open path
|
62
60
|
static string ExtractExtensionPrefixFromPath(const string &path);
|
63
61
|
|
@@ -0,0 +1,63 @@
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
2
|
+
// DuckDB
|
3
|
+
//
|
4
|
+
// src/include/duckdb/parallel/interrupt.hpp
|
5
|
+
//
|
6
|
+
//
|
7
|
+
//===----------------------------------------------------------------------===//
|
8
|
+
|
9
|
+
#pragma once
|
10
|
+
|
11
|
+
#include "duckdb/common/atomic.hpp"
|
12
|
+
#include "duckdb/common/mutex.hpp"
|
13
|
+
#include "duckdb/parallel/task.hpp"
|
14
|
+
#include <condition_variable>
|
15
|
+
#include <memory>
|
16
|
+
|
17
|
+
namespace duckdb {
|
18
|
+
|
19
|
+
//! InterruptMode specifies how operators should block/unblock, note that this will happen transparently to the
|
20
|
+
//! operator, as the operator only needs to return a BLOCKED result and call the callback using the InterruptState.
|
21
|
+
//! NO_INTERRUPTS: No blocking mode is specified, an error will be thrown when the operator blocks. Should only be used
|
22
|
+
//! when manually calling operators of which is known they will never block.
|
23
|
+
//! TASK: A weak pointer to a task is provided. On the callback, this task will be signalled. If the Task has
|
24
|
+
//! been deleted, this callback becomes a NOP. This is the preferred way to await blocked pipelines.
|
25
|
+
//! BLOCKING: The caller has blocked awaiting some synchronization primitive to wait for the callback.
|
26
|
+
enum class InterruptMode : uint8_t { NO_INTERRUPTS, TASK, BLOCKING };
|
27
|
+
|
28
|
+
//! Synchronization primitive used to await a callback in InterruptMode::BLOCKING.
|
29
|
+
struct InterruptDoneSignalState {
|
30
|
+
//! Called by the callback to signal the interrupt is over
|
31
|
+
void Signal();
|
32
|
+
//! Await the callback signalling the interrupt is over
|
33
|
+
void Await();
|
34
|
+
|
35
|
+
protected:
|
36
|
+
mutex lock;
|
37
|
+
std::condition_variable cv;
|
38
|
+
bool done = false;
|
39
|
+
};
|
40
|
+
|
41
|
+
//! State required to make the callback after some asynchronous operation within an operator source / sink.
|
42
|
+
class InterruptState {
|
43
|
+
public:
|
44
|
+
//! Default interrupt state will be set to InterruptMode::NO_INTERRUPTS and throw an error on use of Callback()
|
45
|
+
InterruptState();
|
46
|
+
//! Register the task to be interrupted and set mode to InterruptMode::TASK, the preferred way to handle interrupts
|
47
|
+
InterruptState(weak_ptr<Task> task);
|
48
|
+
//! Register signal state and set mode to InterruptMode::BLOCKING, used for code paths without Task.
|
49
|
+
InterruptState(weak_ptr<InterruptDoneSignalState> done_signal);
|
50
|
+
|
51
|
+
//! Perform the callback to indicate the Interrupt is over
|
52
|
+
DUCKDB_API void Callback() const;
|
53
|
+
|
54
|
+
protected:
|
55
|
+
//! Current interrupt mode
|
56
|
+
InterruptMode mode;
|
57
|
+
//! Task ptr for InterruptMode::TASK
|
58
|
+
weak_ptr<Task> current_task;
|
59
|
+
//! Signal state for InterruptMode::BLOCKING
|
60
|
+
weak_ptr<InterruptDoneSignalState> signal_state;
|
61
|
+
};
|
62
|
+
|
63
|
+
} // namespace duckdb
|
@@ -9,6 +9,8 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/common/atomic.hpp"
|
12
|
+
#include "duckdb/common/unordered_set.hpp"
|
13
|
+
#include "duckdb/common/set.hpp"
|
12
14
|
#include "duckdb/execution/physical_operator.hpp"
|
13
15
|
#include "duckdb/function/table_function.hpp"
|
14
16
|
#include "duckdb/parallel/task_scheduler.hpp"
|
@@ -64,9 +66,7 @@ public:
|
|
64
66
|
void Reset();
|
65
67
|
void ResetSink();
|
66
68
|
void ResetSource(bool force);
|
67
|
-
void ClearSource()
|
68
|
-
source_state.reset();
|
69
|
-
}
|
69
|
+
void ClearSource();
|
70
70
|
void Schedule(shared_ptr<Event> &event);
|
71
71
|
|
72
72
|
//! Finalize this pipeline
|
@@ -94,6 +94,12 @@ public:
|
|
94
94
|
//! Returns whether any of the operators in the pipeline care about preserving order
|
95
95
|
bool IsOrderDependent() const;
|
96
96
|
|
97
|
+
//! Registers a new batch index for a pipeline executor - returns the current minimum batch index
|
98
|
+
idx_t RegisterNewBatchIndex();
|
99
|
+
|
100
|
+
//! Updates the batch index of a pipeline (and returns the new minimum batch index)
|
101
|
+
idx_t UpdateBatchIndex(idx_t old_index, idx_t new_index);
|
102
|
+
|
97
103
|
private:
|
98
104
|
//! Whether or not the pipeline has been readied
|
99
105
|
bool ready;
|
@@ -116,6 +122,13 @@ private:
|
|
116
122
|
|
117
123
|
//! The base batch index of this pipeline
|
118
124
|
idx_t base_batch_index = 0;
|
125
|
+
//! Lock for accessing the set of batch indexes
|
126
|
+
mutex batch_lock;
|
127
|
+
//! The set of batch indexes that are currently being processed
|
128
|
+
//! Despite batch indexes being unique - this is a multiset
|
129
|
+
//! The reason is that when we start a new pipeline we insert the current minimum batch index as a placeholder
|
130
|
+
//! Which leads to duplicate entries in the set of active batch indexes
|
131
|
+
multiset<idx_t> batch_indexes;
|
119
132
|
|
120
133
|
private:
|
121
134
|
void ScheduleSequentialTask(shared_ptr<Event> &event);
|