Skip to content

Commit

Permalink
Added some comments.
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
  • Loading branch information
joka921 committed Jan 9, 2025
1 parent f29efc6 commit 740d186
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/engine/QueryPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1346,9 +1346,14 @@ size_t QueryPlanner::countSubgraphs(
graph.erase(std::ranges::unique(graph, ql::ranges::equal_to{}, getId).begin(),
graph.end());

// We also have to consider the `filters`. To make life easy, we temporarily
// create simple `SubtreePlans` for them which just have the correct
// variables.
std::vector<QueryPlanner::SubtreePlan> dummyPlansForFilter;
for (const auto& filter : filters) {
const auto& vars = filter.expression_.containedVariables();
// We use a `VALUES` clause as the dummy because this operation is the
// easiest to setup for a number of given variables.
parsedQuery::SparqlValues values;
for (auto* var : vars) {
values._variables.push_back(*var);
Expand Down Expand Up @@ -1381,9 +1386,7 @@ size_t QueryPlanner::countSubgraphs(
g.push_back(v);
}

auto result = countConnectedSubgraphs::countSubgraphs(g, budget);
LOG(INFO) << "number of subgraphs inside a component " << result << std::endl;
return result;
return countConnectedSubgraphs::countSubgraphs(g, budget);
}

// _____________________________________________________________________________
Expand Down
2 changes: 2 additions & 0 deletions src/engine/QueryPlanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ class QueryPlanner {
// if the number of subgraphs is `> budget`. This is used to analyze the
// complexity of the query graph and to choose between the DP and the greedy
// query planner see above.
// Note: We also need the added filters, because they behave like additional
// graph nodes wrt the performance of the DP based query planner.
size_t countSubgraphs(std::vector<const SubtreePlan*> graph,
const std::vector<SparqlFilter>& filters,
size_t budget);
Expand Down

0 comments on commit 740d186

Please sign in to comment.