From 3f30f05f20e5307a9f45e3b24c7359471cf1f394 Mon Sep 17 00:00:00 2001 From: Johannes Kalmbach Date: Thu, 13 Jun 2024 16:12:40 +0200 Subject: [PATCH] Reformatting and reviewing. --- benchmark/JoinAlgorithmBenchmark.cpp | 7 ++++--- src/engine/LocalVocab.h | 6 +++--- src/engine/TransitivePathBase.h | 4 ++-- src/engine/TransitivePathImpl.h | 3 ++- .../idTable/CompressedExternalIdTable.h | 2 +- src/engine/sparqlExpressions/LangExpression.h | 4 ++-- .../sparqlExpressions/RegexExpression.h | 4 ++-- src/index/Index.h | 4 ++-- src/index/IndexImpl.Text.cpp | 4 ++-- src/index/IndexImpl.cpp | 8 ++++---- src/index/IndexImpl.h | 4 ++-- src/index/IndexMetaData.h | 4 ++-- src/index/PatternCreator.h | 4 ++-- src/index/PrefixHeuristic.cpp | 4 ++-- src/parser/TurtleParser.cpp | 2 +- src/util/AsyncStream.h | 4 ++-- src/util/MmapVector.h | 4 ++-- test/ConfigManagerTest.cpp | 20 +++++++++---------- test/SynchronizedTest.cpp | 10 ++++++---- test/TransitivePathTest.cpp | 6 +++--- test/VocabularyTestHelpers.h | 4 ++-- 21 files changed, 58 insertions(+), 54 deletions(-) diff --git a/benchmark/JoinAlgorithmBenchmark.cpp b/benchmark/JoinAlgorithmBenchmark.cpp index 4506055a63..18945aa41c 100644 --- a/benchmark/JoinAlgorithmBenchmark.cpp +++ b/benchmark/JoinAlgorithmBenchmark.cpp @@ -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. @@ -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. diff --git a/src/engine/LocalVocab.h b/src/engine/LocalVocab.h index 1c3b52f011..b8d167def4 100644 --- a/src/engine/LocalVocab.h +++ b/src/engine/LocalVocab.h @@ -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: diff --git a/src/engine/TransitivePathBase.h b/src/engine/TransitivePathBase.h index c61df9892e..ce7c32ac3e 100644 --- a/src/engine/TransitivePathBase.h +++ b/src/engine/TransitivePathBase.h @@ -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> alternativeSubtrees() const { return {}; diff --git a/src/engine/TransitivePathImpl.h b/src/engine/TransitivePathImpl.h index 0ec64ed41a..ea4a7a8560 100644 --- a/src/engine/TransitivePathImpl.h +++ b/src/engine/TransitivePathImpl.h @@ -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(); diff --git a/src/engine/idTable/CompressedExternalIdTable.h b/src/engine/idTable/CompressedExternalIdTable.h index 535f235d61..27b78c6121 100644 --- a/src/engine/idTable/CompressedExternalIdTable.h +++ b/src/engine/idTable/CompressedExternalIdTable.h @@ -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 diff --git a/src/engine/sparqlExpressions/LangExpression.h b/src/engine/sparqlExpressions/LangExpression.h index 49430e8f60..bad553f8db 100644 --- a/src/engine/sparqlExpressions/LangExpression.h +++ b/src/engine/sparqlExpressions/LangExpression.h @@ -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 { diff --git a/src/engine/sparqlExpressions/RegexExpression.h b/src/engine/sparqlExpressions/RegexExpression.h index 54e788211b..783acc22db 100644 --- a/src/engine/sparqlExpressions/RegexExpression.h +++ b/src/engine/sparqlExpressions/RegexExpression.h @@ -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 getPrefixRegex(std::string regex); } // namespace detail } // namespace sparqlExpression diff --git a/src/index/Index.h b/src/index/Index.h index 0af58070dc..48c2717687 100644 --- a/src/index/Index.h +++ b/src/index/Index.h @@ -134,8 +134,8 @@ class Index { [[nodiscard]] const CompactVectorOfStrings& 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; diff --git a/src/index/IndexImpl.Text.cpp b/src/index/IndexImpl.Text.cpp index eb829d730d..68d1ab87d0 100644 --- a/src/index/IndexImpl.Text.cpp +++ b/src/index/IndexImpl.Text.cpp @@ -56,8 +56,8 @@ cppcoro::generator 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()) { diff --git a/src/index/IndexImpl.cpp b/src/index/IndexImpl.cpp index e74ed7a805..49b55cb763 100644 --- a/src/index/IndexImpl.cpp +++ b/src/index/IndexImpl.cpp @@ -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; // _____________________________________________________________________________ diff --git a/src/index/IndexImpl.h b/src/index/IndexImpl.h index 38aef16220..10c6ff0c79 100644 --- a/src/index/IndexImpl.h +++ b/src/index/IndexImpl.h @@ -272,8 +272,8 @@ class IndexImpl { const CompactVectorOfStrings& 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; diff --git a/src/index/IndexMetaData.h b/src/index/IndexMetaData.h index 018fb56613..a3b4cdccd6 100644 --- a/src/index/IndexMetaData.h +++ b/src/index/IndexMetaData.h @@ -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 void add(AddType addedValue); diff --git a/src/index/PatternCreator.h b/src/index/PatternCreator.h index 066b643748..7a044c5e34 100644 --- a/src/index/PatternCreator.h +++ b/src/index/PatternCreator.h @@ -111,8 +111,8 @@ class PatternCreator { ad_utility::BufferedVector 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 distinctPredicates_; // The number of distinct subjects and distinct subject-predicate pairs. diff --git a/src/index/PrefixHeuristic.cpp b/src/index/PrefixHeuristic.cpp index a2531921f2..2353362f9c 100644 --- a/src/index/PrefixHeuristic.cpp +++ b/src/index/PrefixHeuristic.cpp @@ -84,7 +84,7 @@ TreeNode* TreeNode::insert(string_view value) { // ___________________________________________________________________________ std::pair 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 @@ -118,7 +118,7 @@ std::pair 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) { diff --git a/src/parser/TurtleParser.cpp b/src/parser/TurtleParser.cpp index 596bf92a6f..c2496070bb 100644 --- a/src/parser/TurtleParser.cpp +++ b/src/parser/TurtleParser.cpp @@ -734,7 +734,7 @@ bool TurtleStreamParser::getLine(TurtleTriple* triple) { !isParserExhausted_) { bool parsedStatement; std::optional 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 { diff --git a/src/util/AsyncStream.h b/src/util/AsyncStream.h index 8dae4343a8..b5d664d926 100644 --- a/src/util/AsyncStream.h +++ b/src/util/AsyncStream.h @@ -45,8 +45,8 @@ cppcoro::generator 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(); diff --git a/src/util/MmapVector.h b/src/util/MmapVector.h index 74fe4d6b4f..447f219834 100644 --- a/src/util/MmapVector.h +++ b/src/util/MmapVector.h @@ -342,8 +342,8 @@ class MmapVectorView : private MmapVector { 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 diff --git a/test/ConfigManagerTest.cpp b/test/ConfigManagerTest.cpp index f01d1570e4..0d90283201 100644 --- a/test/ConfigManagerTest.cpp +++ b/test/ConfigManagerTest.cpp @@ -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, "", ¬Used, 42); @@ -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}, "", ¬Used, 42), @@ -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}), @@ -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}), @@ -1633,8 +1633,8 @@ void doValidatorTest( ConfigManager& managerToAddValidatorTo, ConstConfigOptionProxy 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(variantNumber); diff --git a/test/SynchronizedTest.cpp b/test/SynchronizedTest.cpp index 19c22d64e0..1d1db77d9f 100644 --- a/test/SynchronizedTest.cpp +++ b/test/SynchronizedTest.cpp @@ -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>::value); + // unnecessarily hard. + // static_assert(!AllowsNonConstExclusiveAccessLambda>::value); static_assert(AllowsConstExclusiveAccessLambda< const Synchronized>::value); static_assert(AllowsConstSharedAccessLambda< @@ -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>::value); + // unnecessarily hard. + // static_assert(!AllowsNonConstExclusiveAccessLambda>::value); static_assert(AllowsConstExclusiveAccessLambda< const Synchronized>::value); static_assert(!AllowsConstSharedAccessLambda< diff --git a/test/TransitivePathTest.cpp b/test/TransitivePathTest.cpp index ffed974b57..651faa9442 100644 --- a/test/TransitivePathTest.cpp +++ b/test/TransitivePathTest.cpp @@ -476,9 +476,9 @@ TEST_P(TransitivePathTest, zeroLengthException) { left, right, 0, std::numeric_limits::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, diff --git a/test/VocabularyTestHelpers.h b/test/VocabularyTestHelpers.h index 4c2109469a..33c17fd50f 100644 --- a/test/VocabularyTestHelpers.h +++ b/test/VocabularyTestHelpers.h @@ -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) {