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.
|
/// @c EdgeAtom during plan generation.
|
||||||
EdgeAtom::Direction direction = EdgeAtom::Direction::BOTH;
|
EdgeAtom::Direction direction = EdgeAtom::Direction::BOTH;
|
||||||
/// Set of symbols found inside the range expressions of a variable path edge.
|
/// 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
|
/// Optional node at the other end of an edge. If the expansion
|
||||||
/// contains an edge, then this node is required.
|
/// contains an edge, then this node is required.
|
||||||
NodeAtom *node2 = nullptr;
|
NodeAtom *node2 = nullptr;
|
||||||
@ -40,8 +40,8 @@ class Filters {
|
|||||||
/// Expression which when evaluated produces the value a property must
|
/// Expression which when evaluated produces the value a property must
|
||||||
/// equal.
|
/// equal.
|
||||||
Expression *expression = nullptr;
|
Expression *expression = nullptr;
|
||||||
std::experimental::optional<Bound> lower_bound;
|
std::experimental::optional<Bound> lower_bound{};
|
||||||
std::experimental::optional<Bound> upper_bound;
|
std::experimental::optional<Bound> upper_bound{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// All filter expressions that should be generated.
|
/// All filter expressions that should be generated.
|
||||||
@ -122,7 +122,7 @@ struct QueryPart {
|
|||||||
/// @brief All `MATCH` clauses merged into one @c Matching.
|
/// @brief All `MATCH` clauses merged into one @c Matching.
|
||||||
Matching matching;
|
Matching matching;
|
||||||
/// @brief Each `OPTIONAL MATCH` converted to @c 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.
|
/// @brief @c Matching for each `MERGE` clause.
|
||||||
///
|
///
|
||||||
/// Storing the normalized pattern of a @c Merge does not preclude storing the
|
/// 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
|
/// Since @c Merge is contained in `remaining_clauses`, this vector contains
|
||||||
/// matching in the same order as @c Merge appears.
|
/// 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).
|
/// @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.
|
/// @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
|
/// 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
|
/// write) the first `n`, but the latter `n` would only read the already
|
||||||
/// written information.
|
/// written information.
|
||||||
std::unordered_set<Symbol> bound_symbols;
|
std::unordered_set<Symbol> bound_symbols{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Planner which uses hardcoded rules to produce operators.
|
/// @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.
|
// Determines whether the match should see the new graph state or not.
|
||||||
GraphView graph_view = GraphView::OLD;
|
GraphView graph_view = GraphView::OLD;
|
||||||
// All the newly established symbols in match.
|
// All the newly established symbols in match.
|
||||||
std::vector<Symbol> new_symbols;
|
std::vector<Symbol> new_symbols{};
|
||||||
};
|
};
|
||||||
|
|
||||||
auto GenFilters(LogicalOperator *last_op,
|
auto GenFilters(LogicalOperator *last_op,
|
||||||
@ -639,7 +639,7 @@ LogicalOperator *HandleWriteClause(Clause *clause, LogicalOperator *input_op,
|
|||||||
std::vector<Expansion> NormalizePatterns(
|
std::vector<Expansion> NormalizePatterns(
|
||||||
const SymbolTable &symbol_table, const std::vector<Pattern *> &patterns) {
|
const SymbolTable &symbol_table, const std::vector<Pattern *> &patterns) {
|
||||||
std::vector<Expansion> expansions;
|
std::vector<Expansion> expansions;
|
||||||
auto ignore_node = [&](auto *node) {};
|
auto ignore_node = [&](auto *) {};
|
||||||
auto collect_expansion = [&](auto *prev_node, auto *edge,
|
auto collect_expansion = [&](auto *prev_node, auto *edge,
|
||||||
auto *current_node) {
|
auto *current_node) {
|
||||||
UsedSymbolsCollector collector(symbol_table);
|
UsedSymbolsCollector collector(symbol_table);
|
||||||
@ -739,13 +739,14 @@ bool FindBestLabelPropertyIndex(
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
bool found = false;
|
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 &label : labels) {
|
||||||
for (const auto &prop_pair : property_filters) {
|
for (const auto &prop_pair : property_filters) {
|
||||||
const auto &property = prop_pair.first;
|
const auto &property = prop_pair.first;
|
||||||
if (db.LabelPropertyIndexExists(label, property)) {
|
if (db.LabelPropertyIndexExists(label, property)) {
|
||||||
auto VerticesCount = db.VerticesCount(label, property);
|
auto vertices_count = db.VerticesCount(label, property);
|
||||||
if (VerticesCount < min_count) {
|
if (vertices_count < min_count) {
|
||||||
for (const auto &prop_filter : prop_pair.second) {
|
for (const auto &prop_filter : prop_pair.second) {
|
||||||
if (prop_filter.used_symbols.find(symbol) !=
|
if (prop_filter.used_symbols.find(symbol) !=
|
||||||
prop_filter.used_symbols.end()) {
|
prop_filter.used_symbols.end()) {
|
||||||
@ -759,7 +760,7 @@ bool FindBestLabelPropertyIndex(
|
|||||||
// Take the first property filter which uses bound symbols.
|
// Take the first property filter which uses bound symbols.
|
||||||
best_label = label;
|
best_label = label;
|
||||||
best_property = {property, prop_filter};
|
best_property = {property, prop_filter};
|
||||||
min_count = VerticesCount;
|
min_count = vertices_count;
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1081,8 +1082,7 @@ void Filters::CollectPatternFilters(Pattern &pattern, SymbolTable &symbol_table,
|
|||||||
}
|
}
|
||||||
add_properties_filter(node);
|
add_properties_filter(node);
|
||||||
};
|
};
|
||||||
auto add_expand_filter = [&](NodeAtom *prev_node, EdgeAtom *edge,
|
auto add_expand_filter = [&](NodeAtom *, EdgeAtom *edge, NodeAtom *node) {
|
||||||
NodeAtom *node) {
|
|
||||||
const auto &edge_symbol = symbol_table.at(*edge->identifier_);
|
const auto &edge_symbol = symbol_table.at(*edge->identifier_);
|
||||||
if (!edge->edge_types_.empty()) {
|
if (!edge->edge_types_.empty()) {
|
||||||
if (edge->has_range_) {
|
if (edge->has_range_) {
|
||||||
|
Loading…
Reference in New Issue
Block a user