Skip to content

Commit

Permalink
Comments and clean up code.
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Kalmbach <[email protected]>
  • Loading branch information
joka921 committed Dec 13, 2024
1 parent 65c70d0 commit e9ea5f0
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 265 deletions.
2 changes: 0 additions & 2 deletions src/engine/GroupBy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ uint64_t GroupBy::getSizeEstimateBeforeLimit() {
return _subtree->getMultiplicity(_subtree->getVariableColumn(var));
};

// TODO<joka921> Once we can use `std::views` this can be solved
// more elegantly.
float minMultiplicity = ql::ranges::min(
_groupByVariables | ql::views::transform(varToMultiplicity));
return _subtree->getSizeEstimate() / minMultiplicity;
Expand Down
18 changes: 4 additions & 14 deletions src/engine/Join.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,10 @@ using LazyInputView =
// Convert a `generator<IdTableVocab>` to a `generator<IdTableAndFirstCol>` for
// more efficient access in the join columns below and apply the given
// permutation to each table.
LazyInputView convertGenerator(Result::Generator gen,
OptionalPermutation permutation = {}) {
for (auto& [table, localVocab] : gen) {
applyPermutation(table, permutation);
// Make sure to actually move the table into the wrapper so that the tables
// live as long as the wrapper.
ad_utility::IdTableAndFirstCol t{std::move(table), std::move(localVocab)};
co_yield t;
}
}
// TODO<joka921> Do we need this duplicate overload, or can we get away with one
// of them/templated
LazyInputView convertGenerator(Result::LazyResult gen,
OptionalPermutation permutation = {}) {
CPP_template(typename Input)(
requires ad_utility::SameAsAny<Input, Result::Generator,
Result::LazyResult>) LazyInputView
convertGenerator(Input gen, OptionalPermutation permutation = {}) {
for (auto& [table, localVocab] : gen) {
applyPermutation(table, permutation);
// Make sure to actually move the table into the wrapper so that the tables
Expand Down
2 changes: 1 addition & 1 deletion src/engine/Result.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Result {
using ActualGenerator = cppcoro::generator<IdTableVocabPair>;
using Generator = cppcoro::generator<IdTableVocabPair>;
using LazyResult =
ad_utility::TypeEraseInputRangeOptionalMixin<IdTableVocabPair>;
ad_utility::TypeErasedInputRangeOptionalMixin<IdTableVocabPair>;

private:
// Needs to be mutable in order to be consumable from a const result.
Expand Down
2 changes: 1 addition & 1 deletion src/parser/ParsedQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void ParsedQuery::GraphPattern::addLanguageFilter(const Variable& variable,
std::vector<SparqlTriple*> matchingTriples;
using BasicPattern = parsedQuery::BasicGraphPattern;
namespace ad = ad_utility;
namespace stdv = std::views;
namespace stdv = ql::views;
for (BasicPattern* basicPattern :
_graphPatterns | stdv::transform(ad::getIf<BasicPattern>) |
stdv::filter(ad::toBool)) {
Expand Down
Loading

0 comments on commit e9ea5f0

Please sign in to comment.