| 755 | } |
| 756 | |
| 757 | static void executeTask(const UUID & unique_query_id, const DistributedQueryTaskDescription & task, ContextPtr context, std::shared_ptr<std::atomic<bool>> is_cancelled) |
| 758 | { |
| 759 | auto [object_storage, object_storage_path] = getObjectStorageForTemporaryFiles(toString(unique_query_id), context); |
| 760 | |
| 761 | /// Run each task as an independent query fragment with its own query context and thread group, |
| 762 | /// matching the worker path. Attaching the task context to this thread (instead of sharing the |
| 763 | /// initiator's) gives the task its own per-query state, such as the runtime filter lookup. |
| 764 | auto task_context = Context::createCopy(context); |
| 765 | task_context->makeQueryContext(); |
| 766 | auto query_scope = QueryScope::create(task_context); |
| 767 | setThreadName(ThreadName::DISTRIBUTED_QUERY_TASK); |
| 768 | |
| 769 | doExecuteTask(task, object_storage, object_storage_path, toString(unique_query_id), std::move(task_context), [is_cancelled]() -> bool { return *is_cancelled; }); |
| 770 | } |
| 771 | |
| 772 | /// Runs tasks in local threads. Useful for testing and debugging. |
| 773 | class DistributedQueryPlanExecutorLocal final : public DistributedQueryPlanExecutor |
no test coverage detected