duckdb 0.7.2-dev2867.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 +5 -1
- 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/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 +9 -26
- package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +3 -19
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +9 -8
- package/src/duckdb/src/execution/operator/set/physical_union.cpp +1 -1
- package/src/duckdb/src/execution/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/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/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 +2 -5
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/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/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/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/client_verify.cpp +4 -0
- package/src/duckdb/src/main/config.cpp +4 -0
- package/src/duckdb/src/main/database.cpp +11 -11
- package/src/duckdb/src/main/extension/extension_load.cpp +19 -15
- 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/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/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
@@ -43,16 +43,15 @@ unique_ptr<GlobalSinkState> PhysicalVacuum::GetGlobalSinkState(ClientContext &co
|
|
43
43
|
return make_uniq<VacuumGlobalSinkState>(*info);
|
44
44
|
}
|
45
45
|
|
46
|
-
SinkResultType PhysicalVacuum::Sink(ExecutionContext &context,
|
47
|
-
|
48
|
-
auto &lstate = lstate_p.Cast<VacuumLocalSinkState>();
|
46
|
+
SinkResultType PhysicalVacuum::Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const {
|
47
|
+
auto &lstate = input.local_state.Cast<VacuumLocalSinkState>();
|
49
48
|
D_ASSERT(lstate.column_distinct_stats.size() == info->column_id_map.size());
|
50
49
|
|
51
|
-
for (idx_t col_idx = 0; col_idx <
|
52
|
-
if (!DistinctStatistics::TypeIsSupported(
|
50
|
+
for (idx_t col_idx = 0; col_idx < chunk.data.size(); col_idx++) {
|
51
|
+
if (!DistinctStatistics::TypeIsSupported(chunk.data[col_idx].GetType())) {
|
53
52
|
continue;
|
54
53
|
}
|
55
|
-
lstate.column_distinct_stats[col_idx]->Update(
|
54
|
+
lstate.column_distinct_stats[col_idx]->Update(chunk.data[col_idx], chunk.size(), false);
|
56
55
|
}
|
57
56
|
|
58
57
|
return SinkResultType::NEED_MORE_INPUT;
|
@@ -82,9 +81,10 @@ SinkFinalizeType PhysicalVacuum::Finalize(Pipeline &pipeline, Event &event, Clie
|
|
82
81
|
return SinkFinalizeType::READY;
|
83
82
|
}
|
84
83
|
|
85
|
-
|
86
|
-
|
84
|
+
SourceResultType PhysicalVacuum::GetData(ExecutionContext &context, DataChunk &chunk,
|
85
|
+
OperatorSourceInput &input) const {
|
87
86
|
// NOP
|
87
|
+
return SourceResultType::FINISHED;
|
88
88
|
}
|
89
89
|
|
90
90
|
} // namespace duckdb
|
@@ -111,11 +111,10 @@ unique_ptr<LocalSinkState> PhysicalAsOfJoin::GetLocalSinkState(ExecutionContext
|
|
111
111
|
return make_uniq<AsOfLocalSinkState>(context.client, gsink.global_partition);
|
112
112
|
}
|
113
113
|
|
114
|
-
SinkResultType PhysicalAsOfJoin::Sink(ExecutionContext &context,
|
115
|
-
|
116
|
-
auto &lstate = lstate_p.Cast<AsOfLocalSinkState>();
|
114
|
+
SinkResultType PhysicalAsOfJoin::Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const {
|
115
|
+
auto &lstate = input.local_state.Cast<AsOfLocalSinkState>();
|
117
116
|
|
118
|
-
lstate.Sink(
|
117
|
+
lstate.Sink(chunk);
|
119
118
|
|
120
119
|
return SinkResultType::NEED_MORE_INPUT;
|
121
120
|
}
|
@@ -629,12 +628,12 @@ unique_ptr<LocalSourceState> PhysicalAsOfJoin::GetLocalSourceState(ExecutionCont
|
|
629
628
|
return make_uniq<AsOfLocalSourceState>(gsink);
|
630
629
|
}
|
631
630
|
|
632
|
-
|
633
|
-
|
631
|
+
SourceResultType PhysicalAsOfJoin::GetData(ExecutionContext &context, DataChunk &chunk,
|
632
|
+
OperatorSourceInput &input) const {
|
634
633
|
D_ASSERT(IsRightOuterJoin(join_type));
|
635
634
|
|
636
|
-
auto &gsource =
|
637
|
-
auto &lsource =
|
635
|
+
auto &gsource = input.global_state.Cast<AsOfGlobalSourceState>();
|
636
|
+
auto &lsource = input.local_state.Cast<AsOfLocalSourceState>();
|
638
637
|
auto &gsink = gsource.gsink;
|
639
638
|
|
640
639
|
auto &hash_groups = gsink.hash_groups;
|
@@ -644,14 +643,14 @@ void PhysicalAsOfJoin::GetData(ExecutionContext &context, DataChunk &result, Glo
|
|
644
643
|
rhs_chunk.Initialize(Allocator::Get(context.client), gsink.payload_types);
|
645
644
|
SelectionVector rsel(STANDARD_VECTOR_SIZE);
|
646
645
|
|
647
|
-
while (
|
646
|
+
while (chunk.size() == 0) {
|
648
647
|
// Move to the next bin if we are done.
|
649
648
|
while (!lsource.scanner || !lsource.scanner->Remaining()) {
|
650
649
|
lsource.scanner.reset();
|
651
650
|
lsource.hash_group.reset();
|
652
651
|
auto hash_bin = gsource.next_bin++;
|
653
652
|
if (hash_bin >= bin_count) {
|
654
|
-
return;
|
653
|
+
return SourceResultType::FINISHED;
|
655
654
|
}
|
656
655
|
|
657
656
|
for (; hash_bin < hash_groups.size(); hash_bin = gsource.next_bin++) {
|
@@ -666,7 +665,7 @@ void PhysicalAsOfJoin::GetData(ExecutionContext &context, DataChunk &result, Glo
|
|
666
665
|
|
667
666
|
const auto count = rhs_chunk.size();
|
668
667
|
if (count == 0) {
|
669
|
-
return;
|
668
|
+
return SourceResultType::FINISHED;
|
670
669
|
}
|
671
670
|
|
672
671
|
// figure out which tuples didn't find a match in the RHS
|
@@ -682,17 +681,19 @@ void PhysicalAsOfJoin::GetData(ExecutionContext &context, DataChunk &result, Glo
|
|
682
681
|
// if there were any tuples that didn't find a match, output them
|
683
682
|
const idx_t left_column_count = children[0]->types.size();
|
684
683
|
for (idx_t col_idx = 0; col_idx < left_column_count; ++col_idx) {
|
685
|
-
|
686
|
-
ConstantVector::SetNull(
|
684
|
+
chunk.data[col_idx].SetVectorType(VectorType::CONSTANT_VECTOR);
|
685
|
+
ConstantVector::SetNull(chunk.data[col_idx], true);
|
687
686
|
}
|
688
687
|
for (idx_t col_idx = 0; col_idx < right_projection_map.size(); ++col_idx) {
|
689
688
|
const auto rhs_idx = right_projection_map[col_idx];
|
690
|
-
|
689
|
+
chunk.data[left_column_count + col_idx].Slice(rhs_chunk.data[rhs_idx], rsel, result_count);
|
691
690
|
}
|
692
|
-
|
693
|
-
|
691
|
+
chunk.SetCardinality(result_count);
|
692
|
+
break;
|
694
693
|
}
|
695
694
|
}
|
695
|
+
|
696
|
+
return chunk.size() > 0 ? SourceResultType::HAVE_MORE_OUTPUT : SourceResultType::FINISHED;
|
696
697
|
}
|
697
698
|
|
698
699
|
} // namespace duckdb
|
@@ -49,11 +49,11 @@ unique_ptr<LocalSinkState> PhysicalBlockwiseNLJoin::GetLocalSinkState(ExecutionC
|
|
49
49
|
return make_uniq<BlockwiseNLJoinLocalState>();
|
50
50
|
}
|
51
51
|
|
52
|
-
SinkResultType PhysicalBlockwiseNLJoin::Sink(ExecutionContext &context,
|
53
|
-
|
54
|
-
auto &gstate =
|
52
|
+
SinkResultType PhysicalBlockwiseNLJoin::Sink(ExecutionContext &context, DataChunk &chunk,
|
53
|
+
OperatorSinkInput &input) const {
|
54
|
+
auto &gstate = input.global_state.Cast<BlockwiseNLJoinGlobalState>();
|
55
55
|
lock_guard<mutex> nl_lock(gstate.lock);
|
56
|
-
gstate.right_chunks.Append(
|
56
|
+
gstate.right_chunks.Append(chunk);
|
57
57
|
return SinkResultType::NEED_MORE_INPUT;
|
58
58
|
}
|
59
59
|
|
@@ -246,16 +246,18 @@ unique_ptr<LocalSourceState> PhysicalBlockwiseNLJoin::GetLocalSourceState(Execut
|
|
246
246
|
return make_uniq<BlockwiseNLJoinLocalScanState>(*this, (BlockwiseNLJoinGlobalScanState &)gstate);
|
247
247
|
}
|
248
248
|
|
249
|
-
|
250
|
-
|
249
|
+
SourceResultType PhysicalBlockwiseNLJoin::GetData(ExecutionContext &context, DataChunk &chunk,
|
250
|
+
OperatorSourceInput &input) const {
|
251
251
|
D_ASSERT(IsRightOuterJoin(join_type));
|
252
252
|
// check if we need to scan any unmatched tuples from the RHS for the full/right outer join
|
253
253
|
auto &sink = sink_state->Cast<BlockwiseNLJoinGlobalState>();
|
254
|
-
auto &gstate = (BlockwiseNLJoinGlobalScanState &)
|
255
|
-
auto &lstate = (BlockwiseNLJoinLocalScanState &)
|
254
|
+
auto &gstate = (BlockwiseNLJoinGlobalScanState &)input.global_state;
|
255
|
+
auto &lstate = (BlockwiseNLJoinLocalScanState &)input.local_state;
|
256
256
|
|
257
257
|
// if the LHS is exhausted in a FULL/RIGHT OUTER JOIN, we scan chunks we still need to output
|
258
258
|
sink.right_outer.Scan(gstate.scan_state, lstate.scan_state, chunk);
|
259
|
+
|
260
|
+
return chunk.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
259
261
|
}
|
260
262
|
|
261
263
|
} // namespace duckdb
|
@@ -32,11 +32,10 @@ unique_ptr<GlobalSinkState> PhysicalCrossProduct::GetGlobalSinkState(ClientConte
|
|
32
32
|
return make_uniq<CrossProductGlobalState>(context, *this);
|
33
33
|
}
|
34
34
|
|
35
|
-
SinkResultType PhysicalCrossProduct::Sink(ExecutionContext &context,
|
36
|
-
|
37
|
-
auto &sink = state.Cast<CrossProductGlobalState>();
|
35
|
+
SinkResultType PhysicalCrossProduct::Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const {
|
36
|
+
auto &sink = input.global_state.Cast<CrossProductGlobalState>();
|
38
37
|
lock_guard<mutex> client_guard(sink.rhs_lock);
|
39
|
-
sink.rhs_materialized.Append(sink.append_state,
|
38
|
+
sink.rhs_materialized.Append(sink.append_state, chunk);
|
40
39
|
return SinkResultType::NEED_MORE_INPUT;
|
41
40
|
}
|
42
41
|
|
@@ -90,11 +90,11 @@ unique_ptr<LocalSinkState> PhysicalDelimJoin::GetLocalSinkState(ExecutionContext
|
|
90
90
|
return std::move(state);
|
91
91
|
}
|
92
92
|
|
93
|
-
SinkResultType PhysicalDelimJoin::Sink(ExecutionContext &context,
|
94
|
-
|
95
|
-
|
96
|
-
lstate.
|
97
|
-
distinct->Sink(context,
|
93
|
+
SinkResultType PhysicalDelimJoin::Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const {
|
94
|
+
auto &lstate = input.local_state.Cast<DelimJoinLocalState>();
|
95
|
+
lstate.lhs_data.Append(lstate.append_state, chunk);
|
96
|
+
OperatorSinkInput distinct_sink_input {*distinct->sink_state, *lstate.distinct_state, input.interrupt_state};
|
97
|
+
distinct->Sink(context, chunk, distinct_sink_input);
|
98
98
|
return SinkResultType::NEED_MORE_INPUT;
|
99
99
|
}
|
100
100
|
|
@@ -181,30 +181,29 @@ unique_ptr<LocalSinkState> PhysicalHashJoin::GetLocalSinkState(ExecutionContext
|
|
181
181
|
return make_uniq<HashJoinLocalSinkState>(*this, context.client);
|
182
182
|
}
|
183
183
|
|
184
|
-
SinkResultType PhysicalHashJoin::Sink(ExecutionContext &context,
|
185
|
-
|
186
|
-
auto &lstate = lstate_p.Cast<HashJoinLocalSinkState>();
|
184
|
+
SinkResultType PhysicalHashJoin::Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const {
|
185
|
+
auto &lstate = input.local_state.Cast<HashJoinLocalSinkState>();
|
187
186
|
|
188
187
|
// resolve the join keys for the right chunk
|
189
188
|
lstate.join_keys.Reset();
|
190
|
-
lstate.build_executor.Execute(
|
189
|
+
lstate.build_executor.Execute(chunk, lstate.join_keys);
|
191
190
|
|
192
191
|
// build the HT
|
193
192
|
auto &ht = *lstate.hash_table;
|
194
193
|
if (!right_projection_map.empty()) {
|
195
194
|
// there is a projection map: fill the build chunk with the projected columns
|
196
195
|
lstate.build_chunk.Reset();
|
197
|
-
lstate.build_chunk.SetCardinality(
|
196
|
+
lstate.build_chunk.SetCardinality(chunk);
|
198
197
|
for (idx_t i = 0; i < right_projection_map.size(); i++) {
|
199
|
-
lstate.build_chunk.data[i].Reference(
|
198
|
+
lstate.build_chunk.data[i].Reference(chunk.data[right_projection_map[i]]);
|
200
199
|
}
|
201
200
|
ht.Build(lstate.append_state, lstate.join_keys, lstate.build_chunk);
|
202
201
|
} else if (!build_types.empty()) {
|
203
202
|
// there is not a projected map: place the entire right chunk in the HT
|
204
|
-
ht.Build(lstate.append_state, lstate.join_keys,
|
203
|
+
ht.Build(lstate.append_state, lstate.join_keys, chunk);
|
205
204
|
} else {
|
206
205
|
// there are only keys: place an empty chunk in the payload
|
207
|
-
lstate.build_chunk.SetCardinality(
|
206
|
+
lstate.build_chunk.SetCardinality(chunk.size());
|
208
207
|
ht.Build(lstate.append_state, lstate.join_keys, lstate.build_chunk);
|
209
208
|
}
|
210
209
|
|
@@ -261,7 +260,7 @@ public:
|
|
261
260
|
void Schedule() override {
|
262
261
|
auto &context = pipeline->GetClientContext();
|
263
262
|
|
264
|
-
vector<
|
263
|
+
vector<shared_ptr<Task>> finalize_tasks;
|
265
264
|
auto &ht = *sink.hash_table;
|
266
265
|
const auto chunk_count = ht.GetDataCollection().ChunkCount();
|
267
266
|
const idx_t num_threads = TaskScheduler::GetScheduler(context).NumberOfThreads();
|
@@ -346,7 +345,7 @@ public:
|
|
346
345
|
public:
|
347
346
|
void Schedule() override {
|
348
347
|
auto &context = pipeline->GetClientContext();
|
349
|
-
vector<
|
348
|
+
vector<shared_ptr<Task>> partition_tasks;
|
350
349
|
partition_tasks.reserve(local_hts.size());
|
351
350
|
for (auto &local_ht : local_hts) {
|
352
351
|
partition_tasks.push_back(
|
@@ -880,15 +879,15 @@ void HashJoinLocalSourceState::ExternalScanHT(HashJoinGlobalSinkState &sink, Has
|
|
880
879
|
}
|
881
880
|
}
|
882
881
|
|
883
|
-
|
884
|
-
|
882
|
+
SourceResultType PhysicalHashJoin::GetData(ExecutionContext &context, DataChunk &chunk,
|
883
|
+
OperatorSourceInput &input) const {
|
885
884
|
auto &sink = sink_state->Cast<HashJoinGlobalSinkState>();
|
886
|
-
auto &gstate =
|
887
|
-
auto &lstate =
|
885
|
+
auto &gstate = input.global_state.Cast<HashJoinGlobalSourceState>();
|
886
|
+
auto &lstate = input.local_state.Cast<HashJoinLocalSourceState>();
|
888
887
|
sink.scanned_data = true;
|
889
888
|
|
890
889
|
if (!sink.external && !IsRightOuterJoin(join_type)) {
|
891
|
-
return;
|
890
|
+
return SourceResultType::FINISHED;
|
892
891
|
}
|
893
892
|
|
894
893
|
if (gstate.global_stage == HashJoinSourceStage::INIT) {
|
@@ -905,6 +904,8 @@ void PhysicalHashJoin::GetData(ExecutionContext &context, DataChunk &chunk, Glob
|
|
905
904
|
gstate.TryPrepareNextStage(sink);
|
906
905
|
}
|
907
906
|
}
|
907
|
+
|
908
|
+
return chunk.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
908
909
|
}
|
909
910
|
|
910
911
|
} // namespace duckdb
|
@@ -134,12 +134,11 @@ unique_ptr<LocalSinkState> PhysicalIEJoin::GetLocalSinkState(ExecutionContext &c
|
|
134
134
|
return make_uniq<IEJoinLocalState>(context.client, *this, sink_child);
|
135
135
|
}
|
136
136
|
|
137
|
-
SinkResultType PhysicalIEJoin::Sink(ExecutionContext &context,
|
138
|
-
|
139
|
-
auto &
|
140
|
-
auto &lstate = lstate_p.Cast<IEJoinLocalState>();
|
137
|
+
SinkResultType PhysicalIEJoin::Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const {
|
138
|
+
auto &gstate = input.global_state.Cast<IEJoinGlobalState>();
|
139
|
+
auto &lstate = input.local_state.Cast<IEJoinLocalState>();
|
141
140
|
|
142
|
-
gstate.Sink(
|
141
|
+
gstate.Sink(chunk, lstate);
|
143
142
|
|
144
143
|
return SinkResultType::NEED_MORE_INPUT;
|
145
144
|
}
|
@@ -931,11 +930,11 @@ unique_ptr<LocalSourceState> PhysicalIEJoin::GetLocalSourceState(ExecutionContex
|
|
931
930
|
return make_uniq<IEJoinLocalSourceState>(context.client, *this);
|
932
931
|
}
|
933
932
|
|
934
|
-
|
935
|
-
|
933
|
+
SourceResultType PhysicalIEJoin::GetData(ExecutionContext &context, DataChunk &result,
|
934
|
+
OperatorSourceInput &input) const {
|
936
935
|
auto &ie_sink = sink_state->Cast<IEJoinGlobalState>();
|
937
|
-
auto &ie_gstate =
|
938
|
-
auto &ie_lstate =
|
936
|
+
auto &ie_gstate = input.global_state.Cast<IEJoinGlobalSourceState>();
|
937
|
+
auto &ie_lstate = input.local_state.Cast<IEJoinLocalSourceState>();
|
939
938
|
|
940
939
|
ie_gstate.Initialize(ie_sink);
|
941
940
|
|
@@ -948,7 +947,7 @@ void PhysicalIEJoin::GetData(ExecutionContext &context, DataChunk &result, Globa
|
|
948
947
|
ResolveComplexJoin(context, result, ie_lstate);
|
949
948
|
|
950
949
|
if (result.size()) {
|
951
|
-
return;
|
950
|
+
return SourceResultType::HAVE_MORE_OUTPUT;
|
952
951
|
}
|
953
952
|
|
954
953
|
ie_gstate.PairCompleted(context.client, ie_sink, ie_lstate);
|
@@ -974,7 +973,7 @@ void PhysicalIEJoin::GetData(ExecutionContext &context, DataChunk &result, Globa
|
|
974
973
|
result.SetCardinality(count);
|
975
974
|
result.Verify();
|
976
975
|
|
977
|
-
return;
|
976
|
+
return result.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
978
977
|
}
|
979
978
|
|
980
979
|
// Process RIGHT OUTER results
|
@@ -997,8 +996,10 @@ void PhysicalIEJoin::GetData(ExecutionContext &context, DataChunk &result, Globa
|
|
997
996
|
result.SetCardinality(count);
|
998
997
|
result.Verify();
|
999
998
|
|
1000
|
-
|
999
|
+
break;
|
1001
1000
|
}
|
1001
|
+
|
1002
|
+
return result.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
1002
1003
|
}
|
1003
1004
|
|
1004
1005
|
//===--------------------------------------------------------------------===//
|
@@ -167,14 +167,14 @@ vector<LogicalType> PhysicalNestedLoopJoin::GetJoinTypes() const {
|
|
167
167
|
return result;
|
168
168
|
}
|
169
169
|
|
170
|
-
SinkResultType PhysicalNestedLoopJoin::Sink(ExecutionContext &context,
|
171
|
-
|
172
|
-
auto &gstate =
|
173
|
-
auto &nlj_state =
|
170
|
+
SinkResultType PhysicalNestedLoopJoin::Sink(ExecutionContext &context, DataChunk &chunk,
|
171
|
+
OperatorSinkInput &input) const {
|
172
|
+
auto &gstate = input.global_state.Cast<NestedLoopJoinGlobalState>();
|
173
|
+
auto &nlj_state = input.local_state.Cast<NestedLoopJoinLocalState>();
|
174
174
|
|
175
175
|
// resolve the join expression of the right side
|
176
176
|
nlj_state.right_condition.Reset();
|
177
|
-
nlj_state.rhs_executor.Execute(
|
177
|
+
nlj_state.rhs_executor.Execute(chunk, nlj_state.right_condition);
|
178
178
|
|
179
179
|
// if we have not seen any NULL values yet, and we are performing a MARK join, check if there are NULL values in
|
180
180
|
// this chunk
|
@@ -186,7 +186,7 @@ SinkResultType PhysicalNestedLoopJoin::Sink(ExecutionContext &context, GlobalSin
|
|
186
186
|
|
187
187
|
// append the payload data and the conditions
|
188
188
|
lock_guard<mutex> nj_guard(gstate.nj_lock);
|
189
|
-
gstate.right_payload_data.Append(
|
189
|
+
gstate.right_payload_data.Append(chunk);
|
190
190
|
gstate.right_condition_data.Append(nlj_state.right_condition);
|
191
191
|
return SinkResultType::NEED_MORE_INPUT;
|
192
192
|
}
|
@@ -446,16 +446,18 @@ unique_ptr<LocalSourceState> PhysicalNestedLoopJoin::GetLocalSourceState(Executi
|
|
446
446
|
return make_uniq<NestedLoopJoinLocalScanState>(*this, (NestedLoopJoinGlobalScanState &)gstate);
|
447
447
|
}
|
448
448
|
|
449
|
-
|
450
|
-
|
449
|
+
SourceResultType PhysicalNestedLoopJoin::GetData(ExecutionContext &context, DataChunk &chunk,
|
450
|
+
OperatorSourceInput &input) const {
|
451
451
|
D_ASSERT(IsRightOuterJoin(join_type));
|
452
452
|
// check if we need to scan any unmatched tuples from the RHS for the full/right outer join
|
453
453
|
auto &sink = sink_state->Cast<NestedLoopJoinGlobalState>();
|
454
|
-
auto &gstate = (NestedLoopJoinGlobalScanState &)
|
455
|
-
auto &lstate = (NestedLoopJoinLocalScanState &)
|
454
|
+
auto &gstate = (NestedLoopJoinGlobalScanState &)input.global_state;
|
455
|
+
auto &lstate = (NestedLoopJoinLocalScanState &)input.local_state;
|
456
456
|
|
457
457
|
// if the LHS is exhausted in a FULL/RIGHT OUTER JOIN, we scan chunks we still need to output
|
458
458
|
sink.right_outer.Scan(gstate.scan_state, lstate.scan_state, chunk);
|
459
|
+
|
460
|
+
return chunk.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
459
461
|
}
|
460
462
|
|
461
463
|
} // namespace duckdb
|
@@ -108,12 +108,12 @@ unique_ptr<LocalSinkState> PhysicalPiecewiseMergeJoin::GetLocalSinkState(Executi
|
|
108
108
|
return make_uniq<MergeJoinLocalState>(context.client, *this, 1);
|
109
109
|
}
|
110
110
|
|
111
|
-
SinkResultType PhysicalPiecewiseMergeJoin::Sink(ExecutionContext &context,
|
112
|
-
|
113
|
-
auto &gstate =
|
114
|
-
auto &lstate =
|
111
|
+
SinkResultType PhysicalPiecewiseMergeJoin::Sink(ExecutionContext &context, DataChunk &chunk,
|
112
|
+
OperatorSinkInput &input) const {
|
113
|
+
auto &gstate = input.global_state.Cast<MergeJoinGlobalState>();
|
114
|
+
auto &lstate = input.local_state.Cast<MergeJoinLocalState>();
|
115
115
|
|
116
|
-
gstate.Sink(
|
116
|
+
gstate.Sink(chunk, lstate);
|
117
117
|
|
118
118
|
return SinkResultType::NEED_MORE_INPUT;
|
119
119
|
}
|
@@ -677,19 +677,19 @@ unique_ptr<GlobalSourceState> PhysicalPiecewiseMergeJoin::GetGlobalSourceState(C
|
|
677
677
|
return make_uniq<PiecewiseJoinScanState>(*this);
|
678
678
|
}
|
679
679
|
|
680
|
-
|
681
|
-
|
680
|
+
SourceResultType PhysicalPiecewiseMergeJoin::GetData(ExecutionContext &context, DataChunk &result,
|
681
|
+
OperatorSourceInput &input) const {
|
682
682
|
D_ASSERT(IsRightOuterJoin(join_type));
|
683
683
|
// check if we need to scan any unmatched tuples from the RHS for the full/right outer join
|
684
684
|
auto &sink = sink_state->Cast<MergeJoinGlobalState>();
|
685
|
-
auto &state = (PiecewiseJoinScanState &)
|
685
|
+
auto &state = (PiecewiseJoinScanState &)input.global_state;
|
686
686
|
|
687
687
|
lock_guard<mutex> l(state.lock);
|
688
688
|
if (!state.scanner) {
|
689
689
|
// Initialize scanner (if not yet initialized)
|
690
690
|
auto &sort_state = sink.table->global_sort_state;
|
691
691
|
if (sort_state.sorted_blocks.empty()) {
|
692
|
-
return;
|
692
|
+
return SourceResultType::FINISHED;
|
693
693
|
}
|
694
694
|
state.scanner = make_uniq<PayloadScanner>(*sort_state.sorted_blocks[0]->payload_data, sort_state);
|
695
695
|
}
|
@@ -707,7 +707,7 @@ void PhysicalPiecewiseMergeJoin::GetData(ExecutionContext &context, DataChunk &r
|
|
707
707
|
|
708
708
|
const auto count = rhs_chunk.size();
|
709
709
|
if (count == 0) {
|
710
|
-
return;
|
710
|
+
return result.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
711
711
|
}
|
712
712
|
|
713
713
|
idx_t result_count = 0;
|
@@ -732,9 +732,11 @@ void PhysicalPiecewiseMergeJoin::GetData(ExecutionContext &context, DataChunk &r
|
|
732
732
|
result.data[left_column_count + col_idx].Slice(rhs_chunk.data[col_idx], rsel, result_count);
|
733
733
|
}
|
734
734
|
result.SetCardinality(result_count);
|
735
|
-
|
735
|
+
break;
|
736
736
|
}
|
737
737
|
}
|
738
|
+
|
739
|
+
return result.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
738
740
|
}
|
739
741
|
|
740
742
|
} // namespace duckdb
|
@@ -43,11 +43,11 @@ unique_ptr<GlobalSinkState> PhysicalPositionalJoin::GetGlobalSinkState(ClientCon
|
|
43
43
|
return make_uniq<PositionalJoinGlobalState>(context, *this);
|
44
44
|
}
|
45
45
|
|
46
|
-
SinkResultType PhysicalPositionalJoin::Sink(ExecutionContext &context,
|
47
|
-
|
48
|
-
auto &sink =
|
46
|
+
SinkResultType PhysicalPositionalJoin::Sink(ExecutionContext &context, DataChunk &chunk,
|
47
|
+
OperatorSinkInput &input) const {
|
48
|
+
auto &sink = input.global_state.Cast<PositionalJoinGlobalState>();
|
49
49
|
lock_guard<mutex> client_guard(sink.rhs_lock);
|
50
|
-
sink.rhs.Append(sink.append_state,
|
50
|
+
sink.rhs.Append(sink.append_state, chunk);
|
51
51
|
return SinkResultType::NEED_MORE_INPUT;
|
52
52
|
}
|
53
53
|
|
@@ -170,10 +170,12 @@ void PositionalJoinGlobalState::GetData(DataChunk &output) {
|
|
170
170
|
output.SetCardinality(count);
|
171
171
|
}
|
172
172
|
|
173
|
-
|
174
|
-
|
173
|
+
SourceResultType PhysicalPositionalJoin::GetData(ExecutionContext &context, DataChunk &result,
|
174
|
+
OperatorSourceInput &input) const {
|
175
175
|
auto &sink = sink_state->Cast<PositionalJoinGlobalState>();
|
176
176
|
sink.GetData(result);
|
177
|
+
|
178
|
+
return result.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
177
179
|
}
|
178
180
|
|
179
181
|
//===--------------------------------------------------------------------===//
|
@@ -124,7 +124,7 @@ public:
|
|
124
124
|
auto &ts = TaskScheduler::GetScheduler(context);
|
125
125
|
idx_t num_threads = ts.NumberOfThreads();
|
126
126
|
|
127
|
-
vector<
|
127
|
+
vector<shared_ptr<Task>> iejoin_tasks;
|
128
128
|
for (idx_t tnum = 0; tnum < num_threads; tnum++) {
|
129
129
|
iejoin_tasks.push_back(make_uniq<RangeJoinMergeTask>(shared_from_this(), context, table));
|
130
130
|
}
|
@@ -69,10 +69,9 @@ unique_ptr<LocalSinkState> PhysicalOrder::GetLocalSinkState(ExecutionContext &co
|
|
69
69
|
return make_uniq<OrderLocalSinkState>(context.client, *this);
|
70
70
|
}
|
71
71
|
|
72
|
-
SinkResultType PhysicalOrder::Sink(ExecutionContext &context,
|
73
|
-
|
74
|
-
auto &
|
75
|
-
auto &lstate = lstate_p.Cast<OrderLocalSinkState>();
|
72
|
+
SinkResultType PhysicalOrder::Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const {
|
73
|
+
auto &gstate = input.global_state.Cast<OrderGlobalSinkState>();
|
74
|
+
auto &lstate = input.local_state.Cast<OrderLocalSinkState>();
|
76
75
|
|
77
76
|
auto &global_sort_state = gstate.global_sort_state;
|
78
77
|
auto &local_sort_state = lstate.local_sort_state;
|
@@ -85,14 +84,14 @@ SinkResultType PhysicalOrder::Sink(ExecutionContext &context, GlobalSinkState &g
|
|
85
84
|
// Obtain sorting columns
|
86
85
|
auto &keys = lstate.keys;
|
87
86
|
keys.Reset();
|
88
|
-
lstate.key_executor.Execute(
|
87
|
+
lstate.key_executor.Execute(chunk, keys);
|
89
88
|
|
90
89
|
auto &payload = lstate.payload;
|
91
|
-
payload.ReferenceColumns(
|
90
|
+
payload.ReferenceColumns(chunk, projections);
|
92
91
|
|
93
92
|
// Sink the data into the local sort state
|
94
93
|
keys.Verify();
|
95
|
-
|
94
|
+
chunk.Verify();
|
96
95
|
local_sort_state.SinkChunk(keys, payload);
|
97
96
|
|
98
97
|
// When sorting data reaches a certain size, we sort it
|
@@ -145,7 +144,7 @@ public:
|
|
145
144
|
auto &ts = TaskScheduler::GetScheduler(context);
|
146
145
|
idx_t num_threads = ts.NumberOfThreads();
|
147
146
|
|
148
|
-
vector<
|
147
|
+
vector<shared_ptr<Task>> merge_tasks;
|
149
148
|
for (idx_t tnum = 0; tnum < num_threads; tnum++) {
|
150
149
|
merge_tasks.push_back(make_uniq<PhysicalOrderMergeTask>(shared_from_this(), context, gstate));
|
151
150
|
}
|
@@ -236,10 +235,9 @@ unique_ptr<LocalSourceState> PhysicalOrder::GetLocalSourceState(ExecutionContext
|
|
236
235
|
return make_uniq<PhysicalOrderLocalSourceState>(gstate);
|
237
236
|
}
|
238
237
|
|
239
|
-
|
240
|
-
|
241
|
-
auto &
|
242
|
-
auto &lstate = lstate_p.Cast<PhysicalOrderLocalSourceState>();
|
238
|
+
SourceResultType PhysicalOrder::GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const {
|
239
|
+
auto &gstate = input.global_state.Cast<PhysicalOrderGlobalSourceState>();
|
240
|
+
auto &lstate = input.local_state.Cast<PhysicalOrderLocalSourceState>();
|
243
241
|
|
244
242
|
if (lstate.scanner && lstate.scanner->Remaining() == 0) {
|
245
243
|
lstate.batch_index = gstate.next_batch_index++;
|
@@ -247,7 +245,7 @@ void PhysicalOrder::GetData(ExecutionContext &context, DataChunk &chunk, GlobalS
|
|
247
245
|
}
|
248
246
|
|
249
247
|
if (lstate.batch_index >= gstate.total_batches) {
|
250
|
-
return;
|
248
|
+
return SourceResultType::FINISHED;
|
251
249
|
}
|
252
250
|
|
253
251
|
if (!lstate.scanner) {
|
@@ -257,6 +255,8 @@ void PhysicalOrder::GetData(ExecutionContext &context, DataChunk &chunk, GlobalS
|
|
257
255
|
}
|
258
256
|
|
259
257
|
lstate.scanner->Scan(chunk);
|
258
|
+
|
259
|
+
return chunk.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
260
260
|
}
|
261
261
|
|
262
262
|
idx_t PhysicalOrder::GetBatchIndex(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate_p,
|
@@ -435,11 +435,10 @@ unique_ptr<GlobalSinkState> PhysicalTopN::GetGlobalSinkState(ClientContext &cont
|
|
435
435
|
//===--------------------------------------------------------------------===//
|
436
436
|
// Sink
|
437
437
|
//===--------------------------------------------------------------------===//
|
438
|
-
SinkResultType PhysicalTopN::Sink(ExecutionContext &context,
|
439
|
-
DataChunk &input) const {
|
438
|
+
SinkResultType PhysicalTopN::Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const {
|
440
439
|
// append to the local sink state
|
441
|
-
auto &sink =
|
442
|
-
sink.heap.Sink(
|
440
|
+
auto &sink = input.local_state.Cast<TopNLocalState>();
|
441
|
+
sink.heap.Sink(chunk);
|
443
442
|
sink.heap.Reduce();
|
444
443
|
return SinkResultType::NEED_MORE_INPUT;
|
445
444
|
}
|
@@ -480,12 +479,11 @@ unique_ptr<GlobalSourceState> PhysicalTopN::GetGlobalSourceState(ClientContext &
|
|
480
479
|
return make_uniq<TopNOperatorState>();
|
481
480
|
}
|
482
481
|
|
483
|
-
|
484
|
-
LocalSourceState &lstate) const {
|
482
|
+
SourceResultType PhysicalTopN::GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const {
|
485
483
|
if (limit == 0) {
|
486
|
-
return;
|
484
|
+
return SourceResultType::FINISHED;
|
487
485
|
}
|
488
|
-
auto &state =
|
486
|
+
auto &state = input.global_state.Cast<TopNOperatorState>();
|
489
487
|
auto &gstate = sink_state->Cast<TopNGlobalState>();
|
490
488
|
|
491
489
|
if (!state.initialized) {
|
@@ -493,6 +491,8 @@ void PhysicalTopN::GetData(ExecutionContext &context, DataChunk &chunk, GlobalSo
|
|
493
491
|
state.initialized = true;
|
494
492
|
}
|
495
493
|
gstate.heap.Scan(state.state, chunk);
|
494
|
+
|
495
|
+
return chunk.size() == 0 ? SourceResultType::FINISHED : SourceResultType::HAVE_MORE_OUTPUT;
|
496
496
|
}
|
497
497
|
|
498
498
|
string PhysicalTopN::ParamsToString() const {
|