Skip to content

Commit

Permalink
Reformatting and reviewing.
Browse files Browse the repository at this point in the history
  • Loading branch information
joka921 committed Jun 13, 2024
1 parent d75a29d commit 3f30f05
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 54 deletions.
7 changes: 4 additions & 3 deletions benchmark/JoinAlgorithmBenchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ static size_t createOverlapRandomly(IdTableAndJoinColumn* const smallerTable,
}

/*
The columns of the automatically generated benchmark tables contain the following
information:
The columns of the automatically generated benchmark tables contain the
following information:
- The parameter, that changes with every row.
- Time needed for sorting `IdTable`s.
- Time needed for merge/galloping join.
Expand Down Expand Up @@ -1931,7 +1931,8 @@ class BmSampleSizeRatio final : public GeneralInterfaceImplementation {
generation of all other row entries.
- The join column entries of the bigger table have a uniform distribution,
are made up out of only the elements of the bigger tables and the generation
of one row entry is independent from the generation of all other row entries.
of one row entry is independent from the generation of all other row
entries.
- The generation of join column entries in the smaller table is independent
from the generation in the bigger table.
Expand Down
6 changes: 3 additions & 3 deletions src/engine/LocalVocab.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#include "global/Id.h"
#include "parser/LiteralOrIri.h"

// A class for maintaining a local vocabulary with contiguous (local) IDs. This is
// meant for words that are not part of the normal vocabulary (constructed from
// the input data at indexing time).
// A class for maintaining a local vocabulary with contiguous (local) IDs. This
// is meant for words that are not part of the normal vocabulary (constructed
// from the input data at indexing time).
//
class LocalVocab {
private:
Expand Down
4 changes: 2 additions & 2 deletions src/engine/TransitivePathBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ class TransitivePathBase : public Operation {

// Return a set of subtrees that can be used alternatively when the left or
// right side is bound. This is used by the `TransitivePathBinSearch` class,
// which keeps both possible sorting of the predicate of which transitivity
// is computed.
// which has to store both ways to sort the subtree until it knows which side
// becomes bound.
virtual std::span<const std::shared_ptr<QueryExecutionTree>>
alternativeSubtrees() const {
return {};
Expand Down
3 changes: 2 additions & 1 deletion src/engine/TransitivePathImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ class TransitivePathImpl : public TransitivePathBase {
if (minDist_ == 0 && !isBoundOrId() && lhs_.isVariable() &&
rhs_.isVariable()) {
AD_THROW(
"This query might have to evaluate the empty path, which is currently "
"This query might have to evaluate the empty path, which is "
"currently "
"not supported");
}
auto [startSide, targetSide] = decideDirection();
Expand Down
2 changes: 1 addition & 1 deletion src/engine/idTable/CompressedExternalIdTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ struct BlockSorter {
#endif
}
};
// Deduction guide for the implicit aggregate initialization (its "constructor")
// Deduction guide for the implicit aggregate initialization (its "constructor")
// in the aggregate above. Is actually not needed in C++20, but GCC 11 requires
// it.
template <typename Comparator>
Expand Down
4 changes: 2 additions & 2 deletions src/engine/sparqlExpressions/LangExpression.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class LangExpression : public SparqlExpression {

// The following methods are required for the virtual interface of
// `SparqlExpression`, but they will always fail at runtime when executed. All
// occurrences of `LanguageExpression` should be detected and dealt with by the
// parser before any of these methods is ever called.
// occurrences of `LanguageExpression` should be detected and dealt with by
// the parser before any of these methods is ever called.
ExpressionResult evaluate(EvaluationContext*) const override { AD_FAIL(); }

std::string getCacheKey(const VariableToColumnMap&) const override {
Expand Down
4 changes: 2 additions & 2 deletions src/engine/sparqlExpressions/RegexExpression.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class RegexExpression : public SparqlExpression {
namespace detail {
// Check if `regex` is a prefix regex which means that it starts with `^` and
// contains no other "special" regex characters like `*` or `.`. If this check
// succeeds, the prefix is returned without the leading `^` and with all escaping
// undone. Else, `std::nullopt` is returned.
// succeeds, the prefix is returned without the leading `^` and with all
// escaping undone. Else, `std::nullopt` is returned.
std::optional<std::string> getPrefixRegex(std::string regex);
} // namespace detail
} // namespace sparqlExpression
4 changes: 2 additions & 2 deletions src/index/Index.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ class Index {

[[nodiscard]] const CompactVectorOfStrings<Id>& getPatterns() const;
/**
* @return The multiplicity of the entities column (0) of the full has-relation
* relation after unrolling the patterns.
* @return The multiplicity of the entities column (0) of the full
* has-relation relation after unrolling the patterns.
*/
[[nodiscard]] double getAvgNumDistinctPredicatesPerSubject() const;

Expand Down
4 changes: 2 additions & 2 deletions src/index/IndexImpl.Text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ cppcoro::generator<ContextFileParser::Line> IndexImpl::wordsInTextRecords(
contextId = contextId.incremented();
}
}
// ROUND 2: Optionally, consider each literal from the internal vocabulary as a
// text record.
// ROUND 2: Optionally, consider each literal from the internal vocabulary as
// a text record.
if (addWordsFromLiterals) {
for (VocabIndex index = VocabIndex::make(0); index.get() < vocab_.size();
index = index.incremented()) {
Expand Down
8 changes: 4 additions & 4 deletions src/index/IndexImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
using std::array;
using namespace ad_utility::memory_literals;

// During the index building we typically have two permutation sorting present
// at the same time, as we directly push the triples from the first sorting to
// the second sorting. We therefore have to adjust the amount of memory per
// external sorter.
// During the index building we typically have two permutations present at the
// same time, as we directly push the triples from the first sorting to the
// second sorting. We therefore have to adjust the amount of memory per external
// sorter.
static constexpr size_t NUM_EXTERNAL_SORTERS_AT_SAME_TIME = 2u;

// _____________________________________________________________________________
Expand Down
4 changes: 2 additions & 2 deletions src/index/IndexImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ class IndexImpl {

const CompactVectorOfStrings<Id>& getPatterns() const;
/**
* @return The multiplicity of the Entities column (0) of the full has-relation
* relation after unrolling the patterns.
* @return The multiplicity of the Entities column (0) of the full
* has-relation relation after unrolling the patterns.
*/
double getAvgNumDistinctPredicatesPerSubject() const;

Expand Down
4 changes: 2 additions & 2 deletions src/index/IndexMetaData.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ class IndexMetaData {

// `isPersistentMetaData` is true when we do not need to add relation meta
// data to data_, but assume that it is already contained in data_. This must
// be a compile time parameter because we have to avoid instantiation of member
// function set() when `MapType` is read only (e.g., when based on
// be a compile time parameter because we have to avoid instantiation of
// member function set() when `MapType` is read only (e.g., when based on
// MmapVectorView).
template <bool isPersistentMetaData = false>
void add(AddType addedValue);
Expand Down
4 changes: 2 additions & 2 deletions src/index/PatternCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class PatternCreator {
ad_utility::BufferedVector<TripleAndIsInternal> tripleBuffer_;
TripleSorter tripleSorter_;

// The predicates which have already occurred in one of the patterns. Needed to
// count the number of distinct predicates.
// The predicates which have already occurred in one of the patterns. Needed
// to count the number of distinct predicates.
ad_utility::HashSet<Pattern::value_type> distinctPredicates_;

// The number of distinct subjects and distinct subject-predicate pairs.
Expand Down
4 changes: 2 additions & 2 deletions src/index/PrefixHeuristic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ TreeNode* TreeNode::insert(string_view value) {

// ___________________________________________________________________________
std::pair<size_t, TreeNode*> TreeNode::getMaximum(size_t codelength) {
// _sharedCount = _ownCount + sum over children's _sharedCount
// _sharedCount = _ownCount + sum over childrens' _sharedCount
_sharedCount = _ownCount;

// get Maximum score and node from all the children
Expand Down Expand Up @@ -118,7 +118,7 @@ std::pair<size_t, TreeNode*> TreeNode::getMaximum(size_t codelength) {

_score = _sharedCount * relevantLength;

// Check if our own score is greater than any of the children
// Check if our own score is greater than the score any of the childrens'
// we choose >= so we get a valid pointer when there is only the root with
// score 0 left.
if (_score >= maxScore) {
Expand Down
2 changes: 1 addition & 1 deletion src/parser/TurtleParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ bool TurtleStreamParser<T>::getLine(TurtleTriple* triple) {
!isParserExhausted_) {
bool parsedStatement;
std::optional<ParseException> ex;
// If this buffer reads from an mapped file, then exceptions are
// If this buffer reads from a memory-mapped file, then exceptions are
// immediately rethrown. If we are reading from a stream in chunks of
// bytes, we can try again with a larger buffer.
try {
Expand Down
4 changes: 2 additions & 2 deletions src/util/AsyncStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ cppcoro::generator<typename Range::value_type> runStreamAsync(
queue.finish();
}};

// Only rethrow an exception from the `thread` if no exception occurred in this
// thread to avoid crashes because of multiple active exceptions.
// Only rethrow an exception from the `thread` if no exception occurred in
// this thread to avoid crashes because of multiple active exceptions.
auto cleanup = ad_utility::makeOnDestructionDontThrowDuringStackUnwinding(
[&queue, &thread, &exception] {
queue.finish();
Expand Down
4 changes: 2 additions & 2 deletions src/util/MmapVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ class MmapVectorView : private MmapVector<T> {
open(filename, pattern);
}

// explicitly close the vector to an uninitialized state and free the associated
// resources
// explicitly close the vector to an uninitialized state and free the
// associated resources
void close();

// destructor
Expand Down
20 changes: 10 additions & 10 deletions test/ConfigManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ TEST(ConfigManagerTest, AddConfigurationOptionExceptionTest) {
/*
Trying to add a configuration option, whose entire path is a prefix of the
path of an already added sub manager, should cause an exception. After all,
this would imply, that the sub manager is part of this new option. Which is not
supported at the moment.
this would imply, that the sub manager is part of this new option. Which is
not supported at the moment.
*/
config.addSubManager({"sub"s, "manager"s})
.addOption("someOpt"s, "", &notUsed, 42);
Expand All @@ -139,8 +139,8 @@ TEST(ConfigManagerTest, AddConfigurationOptionExceptionTest) {

/*
Trying to add a configuration option, who contains the entire path of an
already added sub manager as prefix, should cause an exception. After all, such
recursive builds should have been done on `C++` level, not json level.
already added sub manager as prefix, should cause an exception. After all,
such recursive builds should have been done on `C++` level, not json level.
*/
AD_EXPECT_THROW_WITH_MESSAGE(
config.addOption({"sub"s, "manager"s, "someOption"s}, "", &notUsed, 42),
Expand Down Expand Up @@ -261,8 +261,8 @@ TEST(ConfigManagerTest, addSubManagerExceptionTest) {

/*
Trying to add a sub manager, whose entire path is a prefix of the path of an
already added sub manager, should cause an exception. After all, such recursive
builds should have been done on `C++` level, not json level.
already added sub manager, should cause an exception. After all, such
recursive builds should have been done on `C++` level, not json level.
*/
AD_EXPECT_THROW_WITH_MESSAGE(
config.addSubManager({"Shared_part"s, "Unique_part_1"s}),
Expand Down Expand Up @@ -291,8 +291,8 @@ TEST(ConfigManagerTest, addSubManagerExceptionTest) {
/*
Trying to add a sub manager, who contains the entire path of an already added
config option as prefix, should cause an exception.
After all, this would imply, that the sub manager is part of this option. Which
is not supported at the moment.
After all, this would imply, that the sub manager is part of this option.
Which is not supported at the moment.
*/
AD_EXPECT_THROW_WITH_MESSAGE(
config.addSubManager({"some"s, "option"s, "manager"s}),
Expand Down Expand Up @@ -1633,8 +1633,8 @@ void doValidatorTest(
ConfigManager& managerToAddValidatorTo,
ConstConfigOptionProxy<std::string> option,
const nlohmann::json::json_pointer& pathToOption) {
// The value, which causes the automatically generated validator with the
// given variant to fail.
// The value, which causes the automatically generated validator with
// the given variant to fail.
const std::string& failValue =
createDummyValueForValidator<std::string>(variantNumber);

Expand Down
10 changes: 6 additions & 4 deletions test/SynchronizedTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ TEST(Synchronized, SFINAE) {

// Outcommenting this does not compile and cannot be brought to compile
// without making usage of the Synchronized classes "withWriteLock" method
// unnecessarily hard. static_assert(!AllowsNonConstExclusiveAccessLambda<const
// Synchronized<Vec, std::shared_mutex>>::value);
// unnecessarily hard.
// static_assert(!AllowsNonConstExclusiveAccessLambda<const Synchronized<Vec,
// std::shared_mutex>>::value);
static_assert(AllowsConstExclusiveAccessLambda<
const Synchronized<Vec, std::shared_mutex>>::value);
static_assert(AllowsConstSharedAccessLambda<
Expand All @@ -269,8 +270,9 @@ TEST(Synchronized, SFINAE) {

// Outcommenting this does not compile and cannot be brought to compile
// without making usage of the Synchronized classes "withWriteLock" method
// unnecessarily hard. static_assert(!AllowsNonConstExclusiveAccessLambda<const
// Synchronized<Vec, std::mutex>>::value);
// unnecessarily hard.
// static_assert(!AllowsNonConstExclusiveAccessLambda<const Synchronized<Vec,
// std::mutex>>::value);
static_assert(AllowsConstExclusiveAccessLambda<
const Synchronized<Vec, std::mutex>>::value);
static_assert(!AllowsConstSharedAccessLambda<
Expand Down
6 changes: 3 additions & 3 deletions test/TransitivePathTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ TEST_P(TransitivePathTest, zeroLengthException) {
left, right, 0, std::numeric_limits<size_t>::max());
AD_EXPECT_THROW_WITH_MESSAGE(
T->computeResultOnlyForTesting(),
::testing::ContainsRegex(
"This query might have to evaluate the empty path, which is currently "
"not supported"));
::testing::ContainsRegex("This query might have to evaluate the empty "
"path, which is currently "
"not supported"));
}

INSTANTIATE_TEST_SUITE_P(TransitivePathTestSuite, TransitivePathTest,
Expand Down
4 changes: 2 additions & 2 deletions test/VocabularyTestHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ void testUpperAndLowerBoundContiguousIDs(const auto& vocab, auto makeWordLarger,
words, ids);
}

// Same as the previous function, but explicitly state, which IDs are expected in
// the vocabulary.
// Same as the previous function, but explicitly state, which IDs are expected
// in the vocabulary.
void testUpperAndLowerBoundWithStdLessFromWordsAndIds(auto vocabulary,
const auto& words,
const auto& ids) {
Expand Down

0 comments on commit 3f30f05

Please sign in to comment.