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
@@ -9,6 +9,7 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/common/types/data_chunk.hpp"
|
12
|
+
#include "duckdb/parallel/interrupt.hpp"
|
12
13
|
#include "duckdb/parallel/pipeline.hpp"
|
13
14
|
#include "duckdb/execution/physical_operator.hpp"
|
14
15
|
#include "duckdb/parallel/thread_context.hpp"
|
@@ -20,16 +21,27 @@
|
|
20
21
|
namespace duckdb {
|
21
22
|
class Executor;
|
22
23
|
|
24
|
+
//! The result of executing a PipelineExecutor
|
25
|
+
enum class PipelineExecuteResult {
|
26
|
+
//! PipelineExecutor is fully executed: the source is completely exhausted
|
27
|
+
FINISHED,
|
28
|
+
//! PipelineExecutor is not yet fully executed and can be called again immediately
|
29
|
+
NOT_FINISHED,
|
30
|
+
//! The PipelineExecutor was interrupted and should not be called again until the interrupt is handled as specified
|
31
|
+
//! in the InterruptMode
|
32
|
+
INTERRUPTED
|
33
|
+
};
|
34
|
+
|
23
35
|
//! The Pipeline class represents an execution pipeline
|
24
36
|
class PipelineExecutor {
|
25
37
|
public:
|
26
38
|
PipelineExecutor(ClientContext &context, Pipeline &pipeline);
|
27
39
|
|
28
40
|
//! Fully execute a pipeline with a source and a sink until the source is completely exhausted
|
29
|
-
|
30
|
-
//! Execute a pipeline with a source and a sink until finished, or until max_chunks
|
41
|
+
PipelineExecuteResult Execute();
|
42
|
+
//! Execute a pipeline with a source and a sink until finished, or until max_chunks were processed from the source
|
31
43
|
//! Returns true if execution is finished, false if Execute should be called again
|
32
|
-
|
44
|
+
PipelineExecuteResult Execute(idx_t max_chunks);
|
33
45
|
|
34
46
|
//! Push a single input DataChunk into the pipeline.
|
35
47
|
//! Returns either OperatorResultType::NEED_MORE_INPUT or OperatorResultType::FINISHED
|
@@ -48,6 +60,9 @@ public:
|
|
48
60
|
//! This flushes profiler states
|
49
61
|
void PullFinalize();
|
50
62
|
|
63
|
+
//! Registers the task in the interrupt_state to allow Source/Sink operators to block the task
|
64
|
+
void SetTaskForInterrupts(weak_ptr<Task> current_task);
|
65
|
+
|
51
66
|
private:
|
52
67
|
//! The pipeline to process
|
53
68
|
Pipeline &pipeline;
|
@@ -65,6 +80,8 @@ private:
|
|
65
80
|
unique_ptr<LocalSourceState> local_source_state;
|
66
81
|
//! The local sink state (if any)
|
67
82
|
unique_ptr<LocalSinkState> local_sink_state;
|
83
|
+
//! The interrupt state, holding required information for sink/source operators to block
|
84
|
+
InterruptState interrupt_state;
|
68
85
|
|
69
86
|
//! The final chunk used for moving data into the sink
|
70
87
|
DataChunk final_chunk;
|
@@ -79,28 +96,55 @@ private:
|
|
79
96
|
//! Whether or not this pipeline requires keeping track of the batch index of the source
|
80
97
|
bool requires_batch_index = false;
|
81
98
|
|
99
|
+
//! Source has indicated it is exhausted
|
100
|
+
bool exhausted_source = false;
|
101
|
+
//! Flushing of intermediate operators has started
|
102
|
+
bool started_flushing = false;
|
103
|
+
//! Flushing of caching operators is done
|
104
|
+
bool done_flushing = false;
|
105
|
+
|
106
|
+
//! This flag is set when the pipeline gets interrupted by the Sink -> the final_chunk should be re-sink-ed.
|
107
|
+
bool remaining_sink_chunk = false;
|
108
|
+
|
109
|
+
//! Current operator being flushed
|
110
|
+
idx_t flushing_idx;
|
111
|
+
//! Whether the current flushing_idx should be flushed: this needs to be stored to make flushing code re-entrant
|
112
|
+
bool should_flush_current_idx = true;
|
113
|
+
|
82
114
|
private:
|
83
115
|
void StartOperator(PhysicalOperator &op);
|
84
116
|
void EndOperator(PhysicalOperator &op, optional_ptr<DataChunk> chunk);
|
85
117
|
|
86
118
|
//! Reset the operator index to the first operator
|
87
119
|
void GoToSource(idx_t ¤t_idx, idx_t initial_idx);
|
88
|
-
|
120
|
+
SourceResultType FetchFromSource(DataChunk &result);
|
89
121
|
|
90
122
|
void FinishProcessing(int32_t operator_idx = -1);
|
91
123
|
bool IsFinished();
|
92
124
|
|
125
|
+
//! Wrappers for sink/source calls to respective operators
|
126
|
+
SourceResultType GetData(DataChunk &chunk, OperatorSourceInput &input);
|
127
|
+
SinkResultType Sink(DataChunk &chunk, OperatorSinkInput &input);
|
128
|
+
|
93
129
|
OperatorResultType ExecutePushInternal(DataChunk &input, idx_t initial_idx = 0);
|
94
130
|
//! Pushes a chunk through the pipeline and returns a single result chunk
|
95
131
|
//! Returns whether or not a new input chunk is needed, or whether or not we are finished
|
96
132
|
OperatorResultType Execute(DataChunk &input, DataChunk &result, idx_t initial_index = 0);
|
97
133
|
|
98
|
-
//!
|
99
|
-
|
100
|
-
|
134
|
+
//! Tries to flush all state from intermediate operators. Will return true if all state is flushed, false in the
|
135
|
+
//! case of a blocked sink.
|
136
|
+
bool TryFlushCachingOperators();
|
101
137
|
|
102
138
|
static bool CanCacheType(const LogicalType &type);
|
103
139
|
void CacheChunk(DataChunk &input, idx_t operator_idx);
|
140
|
+
|
141
|
+
#ifdef DUCKDB_DEBUG_ASYNC_SINK_SOURCE
|
142
|
+
//! Debugging state: number of times blocked
|
143
|
+
int debug_blocked_sink_count = 0;
|
144
|
+
int debug_blocked_source_count = 0;
|
145
|
+
//! Number of times the Sink/Source will block before actually returning data
|
146
|
+
int debug_blocked_target_count = 1;
|
147
|
+
#endif
|
104
148
|
};
|
105
149
|
|
106
150
|
} // namespace duckdb
|
@@ -13,13 +13,16 @@
|
|
13
13
|
namespace duckdb {
|
14
14
|
class ClientContext;
|
15
15
|
class Executor;
|
16
|
+
class Task;
|
17
|
+
class DatabaseInstance;
|
18
|
+
struct ProducerToken;
|
16
19
|
|
17
20
|
enum class TaskExecutionMode : uint8_t { PROCESS_ALL, PROCESS_PARTIAL };
|
18
21
|
|
19
|
-
enum class TaskExecutionResult : uint8_t { TASK_FINISHED, TASK_NOT_FINISHED, TASK_ERROR };
|
22
|
+
enum class TaskExecutionResult : uint8_t { TASK_FINISHED, TASK_NOT_FINISHED, TASK_ERROR, TASK_BLOCKED };
|
20
23
|
|
21
24
|
//! Generic parallel task
|
22
|
-
class Task {
|
25
|
+
class Task : public std::enable_shared_from_this<Task> {
|
23
26
|
public:
|
24
27
|
virtual ~Task() {
|
25
28
|
}
|
@@ -28,7 +31,20 @@ public:
|
|
28
31
|
//! If mode is PROCESS_ALL, Execute should always finish processing and return TASK_FINISHED
|
29
32
|
//! If mode is PROCESS_PARTIAL, Execute can return TASK_NOT_FINISHED, in which case Execute will be called again
|
30
33
|
//! In case of an error, TASK_ERROR is returned
|
34
|
+
//! In case the task has interrupted, BLOCKED is returned.
|
31
35
|
virtual TaskExecutionResult Execute(TaskExecutionMode mode) = 0;
|
36
|
+
|
37
|
+
//! Descheduling a task ensures the task is not executed, but remains available for rescheduling as long as
|
38
|
+
//! required, generally until some code in an operator calls the InterruptState::Callback() method of a state of the
|
39
|
+
//! InterruptMode::TASK mode.
|
40
|
+
virtual void Deschedule() {
|
41
|
+
throw InternalException("Cannot deschedule task of base Task class");
|
42
|
+
};
|
43
|
+
|
44
|
+
//! Ensures a task is rescheduled to the correct queue
|
45
|
+
virtual void Reschedule() {
|
46
|
+
throw InternalException("Cannot reschedule task of base Task class");
|
47
|
+
}
|
32
48
|
};
|
33
49
|
|
34
50
|
//! Execute a task within an executor, including exception handling
|
@@ -39,6 +55,9 @@ public:
|
|
39
55
|
ExecutorTask(ClientContext &context);
|
40
56
|
virtual ~ExecutorTask();
|
41
57
|
|
58
|
+
void Deschedule() override;
|
59
|
+
void Reschedule() override;
|
60
|
+
|
42
61
|
Executor &executor;
|
43
62
|
|
44
63
|
public:
|
@@ -18,7 +18,7 @@ public:
|
|
18
18
|
: scheduler(scheduler_p), token(scheduler_p.CreateProducer()), task_count(0), tasks_completed(0) {
|
19
19
|
}
|
20
20
|
|
21
|
-
virtual void AddTask(
|
21
|
+
virtual void AddTask(shared_ptr<Task> task) {
|
22
22
|
++task_count;
|
23
23
|
scheduler.ScheduleTask(*token, std::move(task));
|
24
24
|
}
|
@@ -29,7 +29,7 @@ public:
|
|
29
29
|
|
30
30
|
virtual void Finish() {
|
31
31
|
while (tasks_completed < task_count) {
|
32
|
-
|
32
|
+
shared_ptr<Task> task;
|
33
33
|
if (scheduler.GetTaskFromProducer(*token, task)) {
|
34
34
|
task->Execute();
|
35
35
|
task.reset();
|
@@ -47,9 +47,9 @@ public:
|
|
47
47
|
|
48
48
|
unique_ptr<ProducerToken> CreateProducer();
|
49
49
|
//! Schedule a task to be executed by the task scheduler
|
50
|
-
void ScheduleTask(ProducerToken &producer,
|
50
|
+
void ScheduleTask(ProducerToken &producer, shared_ptr<Task> task);
|
51
51
|
//! Fetches a task from a specific producer, returns true if successful or false if no tasks were available
|
52
|
-
bool GetTaskFromProducer(ProducerToken &token,
|
52
|
+
bool GetTaskFromProducer(ProducerToken &token, shared_ptr<Task> &task);
|
53
53
|
//! Run tasks forever until "marker" is set to false, "marker" must remain valid until the thread is joined
|
54
54
|
void ExecuteForever(atomic<bool> *marker);
|
55
55
|
//! Run tasks until `marker` is set to false, `max_tasks` have been completed, or until there are no more tasks
|
@@ -9,6 +9,7 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/parser/tableref.hpp"
|
12
|
+
#include "duckdb/parser/query_node/select_node.hpp"
|
12
13
|
|
13
14
|
namespace duckdb {
|
14
15
|
|
@@ -43,6 +44,8 @@ struct PivotColumn {
|
|
43
44
|
vector<PivotColumnEntry> entries;
|
44
45
|
//! The enum to read pivot values from (if any)
|
45
46
|
string pivot_enum;
|
47
|
+
//! Subquery (if any) - used during transform only
|
48
|
+
unique_ptr<QueryNode> subquery;
|
46
49
|
|
47
50
|
string ToString() const;
|
48
51
|
bool Equals(const PivotColumn &other) const;
|
@@ -45,6 +45,7 @@ class Transformer {
|
|
45
45
|
string enum_name;
|
46
46
|
unique_ptr<SelectNode> base;
|
47
47
|
unique_ptr<ParsedExpression> column;
|
48
|
+
unique_ptr<QueryNode> subquery;
|
48
49
|
};
|
49
50
|
|
50
51
|
public:
|
@@ -85,10 +86,13 @@ private:
|
|
85
86
|
bool GetNamedParam(const string &name, int32_t &index);
|
86
87
|
bool HasNamedParameters() const;
|
87
88
|
|
88
|
-
void AddPivotEntry(string enum_name, unique_ptr<SelectNode> source, unique_ptr<ParsedExpression> column
|
89
|
+
void AddPivotEntry(string enum_name, unique_ptr<SelectNode> source, unique_ptr<ParsedExpression> column,
|
90
|
+
unique_ptr<QueryNode> subquery);
|
89
91
|
unique_ptr<SQLStatement> GenerateCreateEnumStmt(unique_ptr<CreatePivotEntry> entry);
|
90
92
|
bool HasPivotEntries();
|
91
93
|
idx_t PivotEntryCount();
|
94
|
+
vector<unique_ptr<CreatePivotEntry>> &GetPivotEntries();
|
95
|
+
void PivotEntryCheck(const string &type);
|
92
96
|
void ExtractCTEsRecursive(CommonTableExpressionMap &cte_map);
|
93
97
|
|
94
98
|
private:
|
@@ -9,6 +9,8 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/common/common.hpp"
|
12
|
+
#include "duckdb/common/to_string.hpp"
|
13
|
+
|
12
14
|
#include <functional>
|
13
15
|
|
14
16
|
namespace duckdb {
|
@@ -23,6 +25,10 @@ struct ColumnBinding {
|
|
23
25
|
ColumnBinding(idx_t table, idx_t column) : table_index(table), column_index(column) {
|
24
26
|
}
|
25
27
|
|
28
|
+
string ToString() const {
|
29
|
+
return "#[" + to_string(table_index) + "." + to_string(column_index) + "]";
|
30
|
+
}
|
31
|
+
|
26
32
|
bool operator==(const ColumnBinding &rhs) const {
|
27
33
|
return table_index == rhs.table_index && column_index == rhs.column_index;
|
28
34
|
}
|
@@ -47,6 +47,7 @@ public:
|
|
47
47
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
48
48
|
idx_t EstimateCardinality(ClientContext &context) override;
|
49
49
|
vector<idx_t> GetTableIndex() const override;
|
50
|
+
string GetName() const override;
|
50
51
|
|
51
52
|
protected:
|
52
53
|
void ResolveTypes() override;
|
@@ -34,6 +34,7 @@ public:
|
|
34
34
|
void Serialize(FieldWriter &writer) const override;
|
35
35
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
36
36
|
vector<idx_t> GetTableIndex() const override;
|
37
|
+
string GetName() const override;
|
37
38
|
|
38
39
|
protected:
|
39
40
|
void ResolveTypes() override {
|
@@ -41,6 +41,7 @@ public:
|
|
41
41
|
void Serialize(FieldWriter &writer) const override;
|
42
42
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
43
43
|
vector<idx_t> GetTableIndex() const override;
|
44
|
+
string GetName() const override;
|
44
45
|
|
45
46
|
protected:
|
46
47
|
void ResolveTypes() override {
|
@@ -29,6 +29,7 @@ public:
|
|
29
29
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
30
30
|
idx_t EstimateCardinality(ClientContext &context) override;
|
31
31
|
vector<idx_t> GetTableIndex() const override;
|
32
|
+
string GetName() const override;
|
32
33
|
|
33
34
|
protected:
|
34
35
|
vector<ColumnBinding> GetColumnBindings() override;
|
@@ -36,6 +36,7 @@ public:
|
|
36
36
|
void Serialize(FieldWriter &writer) const override;
|
37
37
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
38
38
|
vector<idx_t> GetTableIndex() const override;
|
39
|
+
string GetName() const override;
|
39
40
|
|
40
41
|
protected:
|
41
42
|
void ResolveTypes() override {
|
@@ -35,6 +35,7 @@ public:
|
|
35
35
|
void Serialize(FieldWriter &writer) const override;
|
36
36
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
37
37
|
vector<idx_t> GetTableIndex() const override;
|
38
|
+
string GetName() const override;
|
38
39
|
|
39
40
|
protected:
|
40
41
|
void ResolveTypes() override {
|
@@ -29,6 +29,7 @@ public:
|
|
29
29
|
void Serialize(FieldWriter &writer) const override;
|
30
30
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
31
31
|
vector<idx_t> GetTableIndex() const override;
|
32
|
+
string GetName() const override;
|
32
33
|
|
33
34
|
protected:
|
34
35
|
void ResolveTypes() override;
|
@@ -27,6 +27,7 @@ public:
|
|
27
27
|
void Serialize(FieldWriter &writer) const override;
|
28
28
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
29
29
|
vector<idx_t> GetTableIndex() const override;
|
30
|
+
string GetName() const override;
|
30
31
|
|
31
32
|
protected:
|
32
33
|
void ResolveTypes() override;
|
@@ -41,6 +41,7 @@ public:
|
|
41
41
|
void Serialize(FieldWriter &writer) const override;
|
42
42
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
43
43
|
vector<idx_t> GetTableIndex() const override;
|
44
|
+
string GetName() const override;
|
44
45
|
|
45
46
|
protected:
|
46
47
|
void ResolveTypes() override {
|
@@ -41,6 +41,7 @@ public:
|
|
41
41
|
void Serialize(FieldWriter &writer) const override;
|
42
42
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
43
43
|
vector<idx_t> GetTableIndex() const override;
|
44
|
+
string GetName() const override;
|
44
45
|
|
45
46
|
protected:
|
46
47
|
void ResolveTypes() override {
|
@@ -29,6 +29,7 @@ public:
|
|
29
29
|
void Serialize(FieldWriter &writer) const override;
|
30
30
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
31
31
|
vector<idx_t> GetTableIndex() const override;
|
32
|
+
string GetName() const override;
|
32
33
|
|
33
34
|
protected:
|
34
35
|
void ResolveTypes() override;
|
@@ -34,6 +34,7 @@ public:
|
|
34
34
|
void Serialize(FieldWriter &writer) const override;
|
35
35
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
36
36
|
idx_t EstimateCardinality(ClientContext &context) override;
|
37
|
+
string GetName() const override;
|
37
38
|
|
38
39
|
protected:
|
39
40
|
vector<ColumnBinding> GetColumnBindings() override;
|
@@ -30,6 +30,7 @@ public:
|
|
30
30
|
void Serialize(FieldWriter &writer) const override;
|
31
31
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
32
32
|
vector<idx_t> GetTableIndex() const override;
|
33
|
+
string GetName() const override;
|
33
34
|
|
34
35
|
protected:
|
35
36
|
void ResolveTypes() override;
|
@@ -106,6 +106,7 @@ public:
|
|
106
106
|
void LocalMerge(ClientContext &context, RowGroupCollection &collection);
|
107
107
|
//! Creates an optimistic writer for this table - used for optimistically writing parallel appends
|
108
108
|
OptimisticDataWriter &CreateOptimisticWriter(ClientContext &context);
|
109
|
+
void FinalizeOptimisticWriter(ClientContext &context, OptimisticDataWriter &writer);
|
109
110
|
|
110
111
|
//! Delete the entries with the specified row identifier from the table
|
111
112
|
idx_t Delete(TableCatalogEntry &table, ClientContext &context, Vector &row_ids, idx_t count);
|
@@ -0,0 +1,46 @@
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
2
|
+
// DuckDB
|
3
|
+
//
|
4
|
+
// duckdb/storage/optimistic_data_writer.hpp
|
5
|
+
//
|
6
|
+
//
|
7
|
+
//===----------------------------------------------------------------------===//
|
8
|
+
|
9
|
+
#pragma once
|
10
|
+
|
11
|
+
#include "duckdb/storage/table/row_group_collection.hpp"
|
12
|
+
|
13
|
+
namespace duckdb {
|
14
|
+
class PartialBlockManager;
|
15
|
+
|
16
|
+
class OptimisticDataWriter {
|
17
|
+
public:
|
18
|
+
OptimisticDataWriter(DataTable &table);
|
19
|
+
OptimisticDataWriter(DataTable &table, OptimisticDataWriter &parent);
|
20
|
+
~OptimisticDataWriter();
|
21
|
+
|
22
|
+
//! Write a new row group to disk (if possible)
|
23
|
+
void WriteNewRowGroup(RowGroupCollection &row_groups);
|
24
|
+
//! Write the last row group of a collection to disk
|
25
|
+
void WriteLastRowGroup(RowGroupCollection &row_groups);
|
26
|
+
//! Final flush of the optimistic writer - fully flushes the partial block manager
|
27
|
+
void FinalFlush();
|
28
|
+
//! Flushes a specific row group to disk
|
29
|
+
void FlushToDisk(RowGroup *row_group);
|
30
|
+
//! Merge the partially written blocks from one optimistic writer into another
|
31
|
+
void Merge(OptimisticDataWriter &other);
|
32
|
+
//! Rollback
|
33
|
+
void Rollback();
|
34
|
+
|
35
|
+
private:
|
36
|
+
//! Prepare a write to disk
|
37
|
+
bool PrepareWrite();
|
38
|
+
|
39
|
+
private:
|
40
|
+
//! The table
|
41
|
+
DataTable &table;
|
42
|
+
//! The partial block manager (if we created one yet)
|
43
|
+
unique_ptr<PartialBlockManager> partial_manager;
|
44
|
+
};
|
45
|
+
|
46
|
+
} // namespace duckdb
|
@@ -48,6 +48,14 @@ public:
|
|
48
48
|
virtual void Flush(idx_t free_space_left) = 0;
|
49
49
|
virtual void Clear() {
|
50
50
|
}
|
51
|
+
virtual void Merge(PartialBlock &other, idx_t offset, idx_t other_size);
|
52
|
+
|
53
|
+
public:
|
54
|
+
template <class TARGET>
|
55
|
+
TARGET &Cast() {
|
56
|
+
D_ASSERT(dynamic_cast<TARGET *>(this));
|
57
|
+
return (TARGET &)*this;
|
58
|
+
}
|
51
59
|
};
|
52
60
|
|
53
61
|
struct PartialBlockAllocation {
|
@@ -61,6 +69,8 @@ struct PartialBlockAllocation {
|
|
61
69
|
unique_ptr<PartialBlock> partial_block;
|
62
70
|
};
|
63
71
|
|
72
|
+
enum class CheckpointType { FULL_CHECKPOINT, APPEND_TO_TABLE };
|
73
|
+
|
64
74
|
//! Enables sharing blocks across some scope. Scope is whatever we want to share
|
65
75
|
//! blocks across. It may be an entire checkpoint or just a single row group.
|
66
76
|
//! In any case, they must share a block manager.
|
@@ -75,7 +85,8 @@ public:
|
|
75
85
|
static constexpr const idx_t MAX_BLOCK_MAP_SIZE = 1u << 31;
|
76
86
|
|
77
87
|
public:
|
78
|
-
PartialBlockManager(BlockManager &block_manager,
|
88
|
+
PartialBlockManager(BlockManager &block_manager, CheckpointType checkpoint_type,
|
89
|
+
uint32_t max_partial_block_size = DEFAULT_MAX_PARTIAL_BLOCK_SIZE,
|
79
90
|
uint32_t max_use_count = DEFAULT_MAX_USE_COUNT);
|
80
91
|
virtual ~PartialBlockManager();
|
81
92
|
|
@@ -87,18 +98,25 @@ public:
|
|
87
98
|
|
88
99
|
virtual void AllocateBlock(PartialBlockState &state, uint32_t segment_size);
|
89
100
|
|
101
|
+
void Merge(PartialBlockManager &other);
|
90
102
|
//! Register a partially filled block that is filled with "segment_size" entries
|
91
103
|
void RegisterPartialBlock(PartialBlockAllocation &&allocation);
|
92
104
|
|
93
|
-
//!
|
94
|
-
void
|
105
|
+
//! Clear remaining blocks without writing them to disk
|
106
|
+
void ClearBlocks();
|
107
|
+
|
108
|
+
//! Rollback all data written by this partial block manager
|
109
|
+
void Rollback();
|
95
110
|
|
96
111
|
protected:
|
97
112
|
BlockManager &block_manager;
|
113
|
+
CheckpointType checkpoint_type;
|
98
114
|
//! A map of (available space -> PartialBlock) for partially filled blocks
|
99
115
|
//! This is a multimap because there might be outstanding partial blocks with
|
100
116
|
//! the same amount of left-over space
|
101
117
|
multimap<idx_t, unique_ptr<PartialBlock>> partially_filled_blocks;
|
118
|
+
//! The set of written blocks
|
119
|
+
unordered_set<block_id_t> written_blocks;
|
102
120
|
|
103
121
|
//! The maximum size (in bytes) at which a partial block will be considered a partial block
|
104
122
|
uint32_t max_partial_block_size;
|
@@ -109,6 +127,9 @@ protected:
|
|
109
127
|
//! If successful, returns true and returns the block_id and offset_in_block to write to
|
110
128
|
//! Otherwise, returns false
|
111
129
|
bool GetPartialBlock(idx_t segment_size, unique_ptr<PartialBlock> &state);
|
130
|
+
|
131
|
+
bool HasBlockAllocation(uint32_t segment_size);
|
132
|
+
void AddWrittenBlock(block_id_t block);
|
112
133
|
};
|
113
134
|
|
114
135
|
} // namespace duckdb
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#include "duckdb/storage/table/column_segment.hpp"
|
16
16
|
#include "duckdb/storage/table/column_data.hpp"
|
17
17
|
#include "duckdb/common/unordered_set.hpp"
|
18
|
+
#include "duckdb/storage/partial_block_manager.hpp"
|
18
19
|
|
19
20
|
namespace duckdb {
|
20
21
|
class ColumnData;
|
@@ -41,7 +42,51 @@ public:
|
|
41
42
|
|
42
43
|
virtual void FlushSegment(unique_ptr<ColumnSegment> segment, idx_t segment_size);
|
43
44
|
virtual void WriteDataPointers(RowGroupWriter &writer);
|
44
|
-
|
45
|
+
};
|
46
|
+
|
47
|
+
struct PartialBlockForCheckpoint : public PartialBlock {
|
48
|
+
struct PartialColumnSegment {
|
49
|
+
PartialColumnSegment(ColumnData &data, ColumnSegment &segment, uint32_t offset_in_block)
|
50
|
+
: data(data), segment(segment), offset_in_block(offset_in_block) {
|
51
|
+
}
|
52
|
+
|
53
|
+
ColumnData &data;
|
54
|
+
ColumnSegment &segment;
|
55
|
+
uint32_t offset_in_block;
|
56
|
+
};
|
57
|
+
|
58
|
+
public:
|
59
|
+
PartialBlockForCheckpoint(ColumnData &data, ColumnSegment &segment, BlockManager &block_manager,
|
60
|
+
PartialBlockState state);
|
61
|
+
~PartialBlockForCheckpoint() override;
|
62
|
+
|
63
|
+
// We will copy all segment data into the memory of the shared block.
|
64
|
+
// Once the block is full (or checkpoint is complete) we'll invoke Flush().
|
65
|
+
// This will cause the block to get written to storage (via BlockManger::ConvertToPersistent),
|
66
|
+
// and all segments to have their references updated (via ColumnSegment::ConvertToPersistent)
|
67
|
+
BlockManager &block_manager;
|
68
|
+
shared_ptr<BlockHandle> block;
|
69
|
+
vector<PartialColumnSegment> segments;
|
70
|
+
|
71
|
+
private:
|
72
|
+
struct UninitializedRegion {
|
73
|
+
idx_t start;
|
74
|
+
idx_t end;
|
75
|
+
};
|
76
|
+
vector<UninitializedRegion> uninitialized_regions;
|
77
|
+
|
78
|
+
public:
|
79
|
+
bool IsFlushed();
|
80
|
+
|
81
|
+
void AddUninitializedRegion(idx_t start, idx_t end) override;
|
82
|
+
|
83
|
+
void Flush(idx_t free_space_left) override;
|
84
|
+
|
85
|
+
void Clear() override;
|
86
|
+
|
87
|
+
void Merge(PartialBlock &other, idx_t offset, idx_t other_size) override;
|
88
|
+
|
89
|
+
void AddSegmentToTail(ColumnData &data, ColumnSegment &segment, uint32_t offset_in_block);
|
45
90
|
};
|
46
91
|
|
47
92
|
} // namespace duckdb
|
@@ -39,12 +39,11 @@ class ColumnData {
|
|
39
39
|
|
40
40
|
public:
|
41
41
|
ColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index, idx_t start_row, LogicalType type,
|
42
|
-
ColumnData
|
43
|
-
ColumnData(ColumnData &other, idx_t start, ColumnData *parent);
|
42
|
+
optional_ptr<ColumnData> parent);
|
44
43
|
virtual ~ColumnData();
|
45
44
|
|
46
45
|
//! The start row
|
47
|
-
|
46
|
+
idx_t start;
|
48
47
|
//! The count of the column data
|
49
48
|
idx_t count;
|
50
49
|
//! The block manager
|
@@ -56,7 +55,7 @@ public:
|
|
56
55
|
//! The type of the column
|
57
56
|
LogicalType type;
|
58
57
|
//! The parent column (if any)
|
59
|
-
ColumnData
|
58
|
+
optional_ptr<ColumnData> parent;
|
60
59
|
|
61
60
|
public:
|
62
61
|
virtual bool CheckZonemap(ColumnScanState &state, TableFilter &filter) = 0;
|
@@ -70,6 +69,7 @@ public:
|
|
70
69
|
|
71
70
|
void IncrementVersion();
|
72
71
|
|
72
|
+
virtual void SetStart(idx_t new_start);
|
73
73
|
//! The root type of the column
|
74
74
|
const LogicalType &RootType() const;
|
75
75
|
|
@@ -122,13 +122,13 @@ public:
|
|
122
122
|
virtual unique_ptr<ColumnCheckpointState>
|
123
123
|
Checkpoint(RowGroup &row_group, PartialBlockManager &partial_block_manager, ColumnCheckpointInfo &checkpoint_info);
|
124
124
|
|
125
|
-
virtual void CheckpointScan(ColumnSegment
|
125
|
+
virtual void CheckpointScan(ColumnSegment &segment, ColumnScanState &state, idx_t row_group_start, idx_t count,
|
126
126
|
Vector &scan_vector);
|
127
127
|
|
128
128
|
virtual void DeserializeColumn(Deserializer &source);
|
129
129
|
static shared_ptr<ColumnData> Deserialize(BlockManager &block_manager, DataTableInfo &info, idx_t column_index,
|
130
130
|
idx_t start_row, Deserializer &source, const LogicalType &type,
|
131
|
-
ColumnData
|
131
|
+
optional_ptr<ColumnData> parent);
|
132
132
|
|
133
133
|
virtual void GetStorageInfo(idx_t row_group_index, vector<idx_t> col_path, TableStorageInfo &result);
|
134
134
|
virtual void Verify(RowGroup &parent);
|
@@ -136,12 +136,11 @@ public:
|
|
136
136
|
bool CheckZonemap(TableFilter &filter);
|
137
137
|
|
138
138
|
static shared_ptr<ColumnData> CreateColumn(BlockManager &block_manager, DataTableInfo &info, idx_t column_index,
|
139
|
-
idx_t start_row, const LogicalType &type,
|
140
|
-
|
139
|
+
idx_t start_row, const LogicalType &type,
|
140
|
+
optional_ptr<ColumnData> parent = nullptr);
|
141
141
|
static unique_ptr<ColumnData> CreateColumnUnique(BlockManager &block_manager, DataTableInfo &info,
|
142
142
|
idx_t column_index, idx_t start_row, const LogicalType &type,
|
143
|
-
ColumnData
|
144
|
-
static unique_ptr<ColumnData> CreateColumnUnique(ColumnData &other, idx_t start_row, ColumnData *parent = nullptr);
|
143
|
+
optional_ptr<ColumnData> parent = nullptr);
|
145
144
|
|
146
145
|
void MergeStatistics(const BaseStatistics &other);
|
147
146
|
void MergeIntoStatistics(BaseStatistics &other);
|