From 0435f5c85111a301795ba3a21cc0fa9e1d8a9967 Mon Sep 17 00:00:00 2001 From: Mislav Bradac Date: Fri, 18 Aug 2017 14:22:36 +0200 Subject: [PATCH] Fix warnings in planner Reviewers: teon.banek Reviewed By: teon.banek Differential Revision: https://phabricator.memgraph.io/D678 --- src/query/plan/planner.hpp | 14 +++++++------- src/query/plan/rule_based_planner.cpp | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/query/plan/planner.hpp b/src/query/plan/planner.hpp index de46cbc5a..e5b8e9b3b 100644 --- a/src/query/plan/planner.hpp +++ b/src/query/plan/planner.hpp @@ -22,7 +22,7 @@ struct Expansion { /// @c EdgeAtom during plan generation. EdgeAtom::Direction direction = EdgeAtom::Direction::BOTH; /// Set of symbols found inside the range expressions of a variable path edge. - std::unordered_set symbols_in_range; + std::unordered_set symbols_in_range{}; /// Optional node at the other end of an edge. If the expansion /// contains an edge, then this node is required. NodeAtom *node2 = nullptr; @@ -40,8 +40,8 @@ class Filters { /// Expression which when evaluated produces the value a property must /// equal. Expression *expression = nullptr; - std::experimental::optional lower_bound; - std::experimental::optional upper_bound; + std::experimental::optional lower_bound{}; + std::experimental::optional upper_bound{}; }; /// All filter expressions that should be generated. @@ -122,7 +122,7 @@ struct QueryPart { /// @brief All `MATCH` clauses merged into one @c Matching. Matching matching; /// @brief Each `OPTIONAL MATCH` converted to @c Matching. - std::vector optional_matching; + std::vector optional_matching{}; /// @brief @c Matching for each `MERGE` clause. /// /// Storing the normalized pattern of a @c Merge does not preclude storing the @@ -132,9 +132,9 @@ struct QueryPart { /// /// Since @c Merge is contained in `remaining_clauses`, this vector contains /// matching in the same order as @c Merge appears. - std::vector merge_matching; + std::vector merge_matching{}; /// @brief All the remaining clauses (without @c Match). - std::vector remaining_clauses; + std::vector remaining_clauses{}; }; /// @brief Context which contains variables commonly used during planning. @@ -158,7 +158,7 @@ struct PlanningContext { /// read a symbol or write it. E.g. `MATCH (n) -[r]- (n)` would bind (and /// write) the first `n`, but the latter `n` would only read the already /// written information. - std::unordered_set bound_symbols; + std::unordered_set bound_symbols{}; }; /// @brief Planner which uses hardcoded rules to produce operators. diff --git a/src/query/plan/rule_based_planner.cpp b/src/query/plan/rule_based_planner.cpp index 636ba6050..33fbe68b8 100644 --- a/src/query/plan/rule_based_planner.cpp +++ b/src/query/plan/rule_based_planner.cpp @@ -184,7 +184,7 @@ struct MatchContext { // Determines whether the match should see the new graph state or not. GraphView graph_view = GraphView::OLD; // All the newly established symbols in match. - std::vector new_symbols; + std::vector new_symbols{}; }; auto GenFilters(LogicalOperator *last_op, @@ -639,7 +639,7 @@ LogicalOperator *HandleWriteClause(Clause *clause, LogicalOperator *input_op, std::vector NormalizePatterns( const SymbolTable &symbol_table, const std::vector &patterns) { std::vector expansions; - auto ignore_node = [&](auto *node) {}; + auto ignore_node = [&](auto *) {}; auto collect_expansion = [&](auto *prev_node, auto *edge, auto *current_node) { UsedSymbolsCollector collector(symbol_table); @@ -739,13 +739,14 @@ bool FindBestLabelPropertyIndex( return true; }; bool found = false; - size_t min_count = std::numeric_limits::max(); + auto min_count = std::numeric_limits::max(); for (const auto &label : labels) { for (const auto &prop_pair : property_filters) { const auto &property = prop_pair.first; if (db.LabelPropertyIndexExists(label, property)) { - auto VerticesCount = db.VerticesCount(label, property); - if (VerticesCount < min_count) { + auto vertices_count = db.VerticesCount(label, property); + if (vertices_count < min_count) { for (const auto &prop_filter : prop_pair.second) { if (prop_filter.used_symbols.find(symbol) != prop_filter.used_symbols.end()) { @@ -759,7 +760,7 @@ bool FindBestLabelPropertyIndex( // Take the first property filter which uses bound symbols. best_label = label; best_property = {property, prop_filter}; - min_count = VerticesCount; + min_count = vertices_count; found = true; break; } @@ -1081,8 +1082,7 @@ void Filters::CollectPatternFilters(Pattern &pattern, SymbolTable &symbol_table, } add_properties_filter(node); }; - auto add_expand_filter = [&](NodeAtom *prev_node, EdgeAtom *edge, - NodeAtom *node) { + auto add_expand_filter = [&](NodeAtom *, EdgeAtom *edge, NodeAtom *node) { const auto &edge_symbol = symbol_table.at(*edge->identifier_); if (!edge->edge_types_.empty()) { if (edge->has_range_) {