diff --git a/src/engine/QueryPlanner.cpp b/src/engine/QueryPlanner.cpp index f142af0295..d1516428f1 100644 --- a/src/engine/QueryPlanner.cpp +++ b/src/engine/QueryPlanner.cpp @@ -952,7 +952,7 @@ ParsedQuery::GraphPattern QueryPlanner::seedFromIri( } ParsedQuery::GraphPattern QueryPlanner::uniteGraphPatterns( - std::vector&& patterns) const { + std::vector&& patterns) { using GraphPattern = ParsedQuery::GraphPattern; // Build a tree of union operations auto p = GraphPattern{}; diff --git a/src/engine/QueryPlanner.h b/src/engine/QueryPlanner.h index c32421b5b6..d3801cba88 100644 --- a/src/engine/QueryPlanner.h +++ b/src/engine/QueryPlanner.h @@ -209,7 +209,7 @@ class QueryPlanner { std::vector dfsForAllNodes(); }; - [[nodiscard]] TripleGraph createTripleGraph( + TripleGraph createTripleGraph( const parsedQuery::BasicGraphPattern* pattern) const; void addNodeToTripleGraph(const TripleGraph::Node&, TripleGraph&) const; @@ -223,8 +223,8 @@ class QueryPlanner { // result. This is relevant for subqueries, which are currently optimized // independently of the rest of the query, but where it depends on the rest // of the query, which ordering of the result is best. - [[nodiscard]] std::vector createExecutionTrees( - ParsedQuery& pq, bool isSubquery = false); + std::vector createExecutionTrees(ParsedQuery& pq, + bool isSubquery = false); private: QueryExecutionContext* _qec; @@ -244,7 +244,7 @@ class QueryPlanner { // be reported as part of the query result if desired. std::vector warnings_; - [[nodiscard]] std::vector optimize( + std::vector optimize( ParsedQuery::GraphPattern* rootPattern); // Add all the possible index scans for the triple represented by the node. @@ -281,7 +281,7 @@ class QueryPlanner { std::vector filters_; }; - [[nodiscard]] PlansAndFilters seedWithScansAndText( + PlansAndFilters seedWithScansAndText( const TripleGraph& tg, const vector>& children, TextLimitMap& textLimits); @@ -289,31 +289,31 @@ class QueryPlanner { /** * @brief Returns a parsed query for the property path. */ - [[nodiscard]] ParsedQuery::GraphPattern seedFromPropertyPath( - const TripleComponent& left, const PropertyPath& path, - const TripleComponent& right); - - [[nodiscard]] ParsedQuery::GraphPattern seedFromSequence( - const TripleComponent& left, const PropertyPath& path, - const TripleComponent& right); - [[nodiscard]] ParsedQuery::GraphPattern seedFromAlternative( - const TripleComponent& left, const PropertyPath& path, - const TripleComponent& right); - [[nodiscard]] ParsedQuery::GraphPattern seedFromTransitive( - const TripleComponent& left, const PropertyPath& path, - const TripleComponent& right, size_t min, size_t max); - [[nodiscard]] ParsedQuery::GraphPattern seedFromInverse( - const TripleComponent& left, const PropertyPath& path, - const TripleComponent& right); - [[nodiscard]] ParsedQuery::GraphPattern seedFromIri( - const TripleComponent& left, const PropertyPath& path, - const TripleComponent& right); - - [[nodiscard]] Variable generateUniqueVarName(); + ParsedQuery::GraphPattern seedFromPropertyPath(const TripleComponent& left, + const PropertyPath& path, + const TripleComponent& right); + ParsedQuery::GraphPattern seedFromSequence(const TripleComponent& left, + const PropertyPath& path, + const TripleComponent& right); + ParsedQuery::GraphPattern seedFromAlternative(const TripleComponent& left, + const PropertyPath& path, + const TripleComponent& right); + ParsedQuery::GraphPattern seedFromTransitive(const TripleComponent& left, + const PropertyPath& path, + const TripleComponent& right, + size_t min, size_t max); + ParsedQuery::GraphPattern seedFromInverse(const TripleComponent& left, + const PropertyPath& path, + const TripleComponent& right); + static ParsedQuery::GraphPattern seedFromIri(const TripleComponent& left, + const PropertyPath& path, + const TripleComponent& right); + + Variable generateUniqueVarName(); // Creates a tree of unions with the given patterns as the trees leaves - [[nodiscard]] ParsedQuery::GraphPattern uniteGraphPatterns( - std::vector&& patterns) const; + static ParsedQuery::GraphPattern uniteGraphPatterns( + std::vector&& patterns); /** * @brief Merges two rows of the dp optimization table using various types of @@ -321,11 +321,11 @@ class QueryPlanner { * @return A new row for the dp table that contains plans created by joining * the result of a plan in a and a plan in b. */ - [[nodiscard]] vector merge(const vector& a, - const vector& b, - const TripleGraph& tg) const; + vector merge(const vector& a, + const vector& b, + const TripleGraph& tg) const; - [[nodiscard]] std::vector createJoinCandidates( + std::vector createJoinCandidates( const SubtreePlan& a, const SubtreePlan& b, boost::optional tg) const; @@ -333,7 +333,7 @@ class QueryPlanner { // path operation and the other input can be bound to this transitive path // (see `TransitivePath.cpp` for details), then returns that bound transitive // path. Else returns `std::nullopt` - [[nodiscard]] static std::optional createJoinWithTransitivePath( + static std::optional createJoinWithTransitivePath( SubtreePlan a, SubtreePlan b, const std::vector>& jcs); @@ -342,57 +342,55 @@ class QueryPlanner { // `) and `a` and `b` can be joined on that subject variable, // then returns a `HasPredicateScan` that takes the other input as a subtree. // Else returns `std::nullopt`. - [[nodiscard]] static std::optional - createJoinWithHasPredicateScan( + static std::optional createJoinWithHasPredicateScan( SubtreePlan a, SubtreePlan b, const std::vector>& jcs); - [[nodiscard]] static std::optional createJoinWithPathSearch( + static std::optional createJoinWithPathSearch( const SubtreePlan& a, const SubtreePlan& b, const std::vector>& jcs); // Helper that returns `true` for each of the subtree plans `a` and `b` iff // the subtree plan is a spatial join and it is not yet fully constructed // (it does not have both children set) - [[nodiscard]] static std::pair checkSpatialJoin( - const SubtreePlan& a, const SubtreePlan& b); + static std::pair checkSpatialJoin(const SubtreePlan& a, + const SubtreePlan& b); // if one of the inputs is a spatial join which is compatible with the other // input, then add that other input to the spatial join as a child instead of // creating a normal join. - [[nodiscard]] static std::optional createSpatialJoin( + static std::optional createSpatialJoin( const SubtreePlan& a, const SubtreePlan& b, const std::vector>& jcs); - [[nodiscard]] vector getOrderByRow( + vector getOrderByRow( const ParsedQuery& pq, const std::vector>& dpTab) const; - [[nodiscard]] vector getGroupByRow( + vector getGroupByRow( const ParsedQuery& pq, const std::vector>& dpTab) const; - [[nodiscard]] vector getDistinctRow( + vector getDistinctRow( const parsedQuery::SelectClause& selectClause, const vector>& dpTab) const; - [[nodiscard]] vector getPatternTrickRow( + vector getPatternTrickRow( const parsedQuery::SelectClause& selectClause, const vector>& dpTab, const checkUsePatternTrick::PatternTrickTuple& patternTrickTuple); - [[nodiscard]] vector getHavingRow( + vector getHavingRow( const ParsedQuery& pq, const vector>& dpTab) const; - [[nodiscard]] bool connected(const SubtreePlan& a, const SubtreePlan& b, - const TripleGraph& graph) const; + bool connected(const SubtreePlan& a, const SubtreePlan& b, + const TripleGraph& graph) const; static std::vector> getJoinColumns( const SubtreePlan& a, const SubtreePlan& b); - [[nodiscard]] string getPruningKey( - const SubtreePlan& plan, - const vector& orderedOnColumns) const; + string getPruningKey(const SubtreePlan& plan, + const vector& orderedOnColumns) const; template void applyFiltersIfPossible(std::vector& row, @@ -463,7 +461,7 @@ class QueryPlanner { * Cycles have to be avoided (by previously removing a triple and using * it as a filter later on). */ - [[nodiscard]] vector> fillDpTab( + vector> fillDpTab( const TripleGraph& graph, std::vector fs, TextLimitMap& textLimits, const vector>& children); @@ -497,8 +495,8 @@ class QueryPlanner { // Creates a SubtreePlan for the given text leaf node in the triple graph. // While doing this the TextLimitMetaObjects are created and updated according // to the text leaf node. - [[nodiscard]] SubtreePlan getTextLeafPlan(const TripleGraph::Node& node, - TextLimitMap& textLimits) const; + SubtreePlan getTextLeafPlan(const TripleGraph::Node& node, + TextLimitMap& textLimits) const; // An internal helper class that encapsulates the functionality to optimize // a single graph pattern. It tightly interacts with the outer `QueryPlanner` @@ -590,7 +588,7 @@ class QueryPlanner { /// if this Planner is not associated with a queryExecutionContext we are only /// in the unit test mode - [[nodiscard]] bool isInTestMode() const { return _qec == nullptr; } + bool isInTestMode() const { return _qec == nullptr; } /// Helper function to check if the assigned `cancellationHandle_` has /// been cancelled yet and throw an exception if this is the case. diff --git a/src/parser/PropertyPath.h b/src/parser/PropertyPath.h index e881a1c44f..44a8a0492d 100644 --- a/src/parser/PropertyPath.h +++ b/src/parser/PropertyPath.h @@ -3,6 +3,7 @@ // Author: Florian Kramer (florian.kramer@mail.uni-freiburg.de) #pragma once +#include #include #include #include @@ -11,7 +12,7 @@ class PropertyPath { public: - enum class Operation { + enum class Operation : std::uint8_t { SEQUENCE, ALTERNATIVE, INVERSE, @@ -36,15 +37,15 @@ class PropertyPath { return p; } - static PropertyPath fromVariable(Variable var) { + static PropertyPath fromVariable(const Variable& var) { PropertyPath p(Operation::IRI); - p.iri_ = std::move(var.name()); + p.iri_ = var.name(); return p; } static PropertyPath makeWithChildren(std::vector children, - Operation op) { - PropertyPath p(std::move(op)); + const Operation op) { + PropertyPath p(op); p.children_ = std::move(children); return p; }