Fix warnings in planner
Reviewers: teon.banek Reviewed By: teon.banek Differential Revision: https://phabricator.memgraph.io/D678
This commit is contained in:
parent
22ab0e7553
commit
0435f5c851
@ -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<Symbol> symbols_in_range;
|
||||
std::unordered_set<Symbol> 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<Bound> lower_bound;
|
||||
std::experimental::optional<Bound> upper_bound;
|
||||
std::experimental::optional<Bound> lower_bound{};
|
||||
std::experimental::optional<Bound> 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<Matching> optional_matching;
|
||||
std::vector<Matching> 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<Matching> merge_matching;
|
||||
std::vector<Matching> merge_matching{};
|
||||
/// @brief All the remaining clauses (without @c Match).
|
||||
std::vector<Clause *> remaining_clauses;
|
||||
std::vector<Clause *> 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<Symbol> bound_symbols;
|
||||
std::unordered_set<Symbol> bound_symbols{};
|
||||
};
|
||||
|
||||
/// @brief Planner which uses hardcoded rules to produce operators.
|
||||
|
@ -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<Symbol> new_symbols;
|
||||
std::vector<Symbol> new_symbols{};
|
||||
};
|
||||
|
||||
auto GenFilters(LogicalOperator *last_op,
|
||||
@ -639,7 +639,7 @@ LogicalOperator *HandleWriteClause(Clause *clause, LogicalOperator *input_op,
|
||||
std::vector<Expansion> NormalizePatterns(
|
||||
const SymbolTable &symbol_table, const std::vector<Pattern *> &patterns) {
|
||||
std::vector<Expansion> 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<size_t>::max();
|
||||
auto min_count = std::numeric_limits<decltype(db.VerticesCount(
|
||||
GraphDbTypes::Label{}, GraphDbTypes::Property{}))>::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_) {
|
||||
|
Loading…
Reference in New Issue
Block a user