1#include "duckdb/parallel/pipeline_initialize_event.hpp"
2
3#include "duckdb/execution/executor.hpp"
4
5namespace duckdb {
6
7PipelineInitializeEvent::PipelineInitializeEvent(shared_ptr<Pipeline> pipeline_p)
8 : BasePipelineEvent(std::move(pipeline_p)) {
9}
10
11class PipelineInitializeTask : public ExecutorTask {
12public:
13 explicit PipelineInitializeTask(Pipeline &pipeline_p, shared_ptr<Event> event_p)
14 : ExecutorTask(pipeline_p.executor), pipeline(pipeline_p), event(std::move(event_p)) {
15 }
16
17 Pipeline &pipeline;
18 shared_ptr<Event> event;
19
20public:
21 TaskExecutionResult ExecuteTask(TaskExecutionMode mode) override {
22 pipeline.ResetSink();
23 event->FinishTask();
24 return TaskExecutionResult::TASK_FINISHED;
25 }
26};
27
28void PipelineInitializeEvent::Schedule() {
29 // needs to spawn a task to get the chain of tasks for the query plan going
30 vector<shared_ptr<Task>> tasks;
31 tasks.push_back(x: make_uniq<PipelineInitializeTask>(args&: *pipeline, args: shared_from_this()));
32 SetTasks(std::move(tasks));
33}
34
35void PipelineInitializeEvent::FinishEvent() {
36}
37
38} // namespace duckdb
39