Skip to content

Commit

Permalink
integrate setupPlannedQuery function
Browse files Browse the repository at this point in the history
  • Loading branch information
Qup42 committed Feb 4, 2025
1 parent ca088a3 commit 069d129
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
34 changes: 14 additions & 20 deletions src/engine/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,25 +503,6 @@ auto Server::parseOperation(ad_utility::websocket::MessageSender& messageSender,
}

Check warning on line 503 in src/engine/Server.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/Server.cpp#L500-L503

Added lines #L500 - L503 were not covered by tests

// ____________________________________________________________________________
void Server::setupPlannedQuery(PlannedQuery& plannedOperation,
SharedCancellationHandle handle,
TimeLimit timeLimit,
const ad_utility::Timer& requestTimer) {
plannedOperation.queryExecutionTree_.getRootOperation()
->recursivelySetCancellationHandle(std::move(handle));
plannedOperation.queryExecutionTree_.getRootOperation()
->recursivelySetTimeConstraint(timeLimit);
auto& qet = plannedOperation.queryExecutionTree_;
qet.isRoot() = true; // allow pinning of the final result
auto timeForQueryPlanning = requestTimer.msecs();
auto& runtimeInfoWholeQuery =
qet.getRootOperation()->getRuntimeInfoWholeQuery();
runtimeInfoWholeQuery.timeQueryPlanning = timeForQueryPlanning;
LOG(INFO) << "Query planning done in " << timeForQueryPlanning.count()
<< " ms" << std::endl;
LOG(TRACE) << qet.getCacheKey() << std::endl;
}

Awaitable<Server::PlannedQuery> Server::planQuery(
net::static_thread_pool& threadPool, ParsedQuery&& operation,
const ad_utility::Timer& requestTimer, TimeLimit timeLimit,
Expand All @@ -544,7 +525,20 @@ Awaitable<Server::PlannedQuery> Server::planQuery(
handle);
auto qetOpt = co_await std::move(coroutine);
PlannedQuery plannedQuery{std::move(operation), std::move(qetOpt).value()};

Check warning on line 527 in src/engine/Server.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/Server.cpp#L517-L527

Added lines #L517 - L527 were not covered by tests
setupPlannedQuery(plannedQuery, handle, timeLimit, requestTimer);
// Set some additional attributes on the `PlannedQuery`.
plannedQuery.queryExecutionTree_.getRootOperation()
->recursivelySetCancellationHandle(std::move(handle));
plannedQuery.queryExecutionTree_.getRootOperation()
->recursivelySetTimeConstraint(timeLimit);

Check warning on line 532 in src/engine/Server.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/Server.cpp#L529-L532

Added lines #L529 - L532 were not covered by tests
auto& qet = plannedQuery.queryExecutionTree_;
qet.isRoot() = true; // allow pinning of the final result
auto timeForQueryPlanning = requestTimer.msecs();
auto& runtimeInfoWholeQuery =
qet.getRootOperation()->getRuntimeInfoWholeQuery();
runtimeInfoWholeQuery.timeQueryPlanning = timeForQueryPlanning;
LOG(INFO) << "Query planning done in " << timeForQueryPlanning.count()
<< " ms" << std::endl;
LOG(TRACE) << qet.getCacheKey() << std::endl;
co_return plannedQuery;

Check warning on line 542 in src/engine/Server.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/Server.cpp#L542

Added line #L542 was not covered by tests
}

Expand Down
6 changes: 1 addition & 5 deletions src/engine/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,7 @@ class Server {
auto parseOperation(ad_utility::websocket::MessageSender& messageSender,
const ad_utility::url_parser::ParamValueMap& params,
const Operation& operation, TimeLimit timeLimit);
// Sets up the PlannedQuery s.t. it is ready to be executed.
static void setupPlannedQuery(PlannedQuery& plannedOperation,
SharedCancellationHandle handle,
TimeLimit timeLimit,
const ad_utility::Timer& requestTimer);

// Plan a parsed query.
Awaitable<PlannedQuery> planQuery(net::static_thread_pool& thread_pool,
ParsedQuery&& operation,
Expand Down

0 comments on commit 069d129

Please sign in to comment.