MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / execute

Method execute

src/processor/processor.cpp:26–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24#endif
25
26std::unique_ptr<main::QueryResult> QueryProcessor::execute(PhysicalPlan* physicalPlan,
27 ExecutionContext* context) {
28 context->clientContext->registerQueryStart();
29 struct Guard {
30 main::ClientContext* ctx;
31 ~Guard() { ctx->registerQueryEnd(); }
32 } guard{context->clientContext};
33 auto lastOperator = physicalPlan->lastOperator.get();
34 // The root pipeline(task) consists of operators and its prevOperator only, because we
35 // expect to have linear plans. For binary operators, e.g., HashJoin, we keep probe and its
36 // prevOperator in the same pipeline, and decompose build and its prevOperator into another
37 // one.
38 auto sink = lastOperator->ptrCast<Sink>();
39 auto task = std::make_shared<ProcessorTask>(sink, context);
40 for (auto i = (int64_t)sink->getNumChildren() - 1; i >= 0; --i) {
41 decomposePlanIntoTask(sink->getChild(i), task.get(), context);
42 }
43 initTask(task.get());
44 auto progressBar = ProgressBar::Get(*context->clientContext);
45 progressBar->startProgress(context->queryID);
46 taskScheduler->scheduleTaskAndWaitOrError(task, context);
47 progressBar->endProgress(context->queryID);
48 return sink->getQueryResult();
49}
50
51void QueryProcessor::decomposePlanIntoTask(PhysicalOperator* op, Task* task,
52 ExecutionContext* context) {

Callers 6

runMethod · 0.45
executeNoLockMethod · 0.45
import_sql_dumpFunction · 0.45
mainFunction · 0.45
run_ladybug_queryFunction · 0.45

Calls 8

registerQueryStartMethod · 0.80
getNumChildrenMethod · 0.80
startProgressMethod · 0.80
endProgressMethod · 0.80
getMethod · 0.45
getChildMethod · 0.45
getQueryResultMethod · 0.45

Tested by

no test coverage detected