Skip to content

Commit

Permalink
Merge remote-tracking branch 'ad-freiburg/master' into refactor-resul…
Browse files Browse the repository at this point in the history
…t-table
  • Loading branch information
RobinTF committed Jun 6, 2024
2 parents 389f3f1 + ccf592e commit 000af28
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/engine/QueryPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ std::vector<QueryPlanner::SubtreePlan> QueryPlanner::createExecutionTrees(
vector<SubtreePlan>& lastRow = plans.back();

for (auto& plan : lastRow) {
if (plan._qet->getRootOperation()->supportsLimit(false) || plan._qet->getRootOperation()->supportsLimit(true)) {
if (plan._qet->getRootOperation()->supportsLimit(false) ||
plan._qet->getRootOperation()->supportsLimit(true)) {
plan._qet->getRootOperation()->setLimit(pq._limitOffset);
}
}
Expand Down
15 changes: 5 additions & 10 deletions src/engine/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,8 @@ boost::asio::awaitable<void> Server::processQuery(
auto [cancellationHandle, cancelTimeoutOnDestruction] =
setupCancellationHandle(messageSender.getQueryId(), timeLimit);

plannedQuery = co_await parseAndPlan(query, qec, cancellationHandle,
timeLimit, maxSend);
plannedQuery =
co_await parseAndPlan(query, qec, cancellationHandle, timeLimit);
AD_CORRECTNESS_CHECK(plannedQuery.has_value());
auto& qet = plannedQuery.value().queryExecutionTree_;
qet.isRoot() = true; // allow pinning of the final result
Expand Down Expand Up @@ -842,8 +842,7 @@ Awaitable<T> Server::computeInNewThread(Function function,
// _____________________________________________________________________________
net::awaitable<std::optional<Server::PlannedQuery>> Server::parseAndPlan(
const std::string& query, QueryExecutionContext& qec,
SharedCancellationHandle handle, TimeLimit timeLimit,
std::optional<uint64_t> maxSend) {
SharedCancellationHandle handle, TimeLimit timeLimit) {
auto handleCopy = handle;

// The usage of an `optional` here is required because of a limitation in
Expand All @@ -853,13 +852,9 @@ net::awaitable<std::optional<Server::PlannedQuery>> Server::parseAndPlan(
// probably related to issues in GCC's coroutine implementation.
return computeInNewThread(
[&query, &qec, enablePatternTrick = enablePatternTrick_,
handle = std::move(handle), timeLimit,
maxSend]() mutable -> std::optional<PlannedQuery> {
handle = std::move(handle),
timeLimit]() mutable -> std::optional<PlannedQuery> {
auto pq = SparqlParser::parseQuery(query);
if (maxSend.has_value()) {
pq._limitOffset._limit =
std::min(maxSend.value(), pq._limitOffset.limitOrDefault());
}
handle->throwIfCancelled();
QueryPlanner qp(&qec, handle);
qp.setEnablePatternTrick(enablePatternTrick);
Expand Down
3 changes: 1 addition & 2 deletions src/engine/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ class Server {
/// technical reasons that are described in the definition of this function.
net::awaitable<std::optional<PlannedQuery>> parseAndPlan(
const std::string& query, QueryExecutionContext& qec,
SharedCancellationHandle handle, TimeLimit timeLimit,
std::optional<uint64_t> maxSend);
SharedCancellationHandle handle, TimeLimit timeLimit);

/// Acquire the `CancellationHandle` for the given `QueryId`, start the
/// watchdog and call `cancelAfterDeadline` to set the timeout after
Expand Down

0 comments on commit 000af28

Please sign in to comment.