MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / executeTask

Function executeTask

src/QueryPipeline/DistributedPlanExecutor.cpp:757–770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

755}
756
757static 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.
773class DistributedQueryPlanExecutorLocal final : public DistributedQueryPlanExecutor

Callers 1

startTaskMethod · 0.85

Calls 6

doExecuteTaskFunction · 0.85
toStringFunction · 0.50
createFunction · 0.50
setThreadNameFunction · 0.50
makeQueryContextMethod · 0.45

Tested by

no test coverage detected