diff --git a/src/database/graph_db_accessor.hpp b/src/database/graph_db_accessor.hpp index 5423f79df..50961deb5 100644 --- a/src/database/graph_db_accessor.hpp +++ b/src/database/graph_db_accessor.hpp @@ -138,9 +138,7 @@ class GraphDbAccessor { auto Vertices(const GraphDbTypes::Label &label, bool current_state) { debug_assert(!commited_ && !aborted_, "Accessor committed or aborted"); return iter::imap( - [this, current_state](auto vlist) { - return VertexAccessor(*vlist, *this); - }, + [this](auto vlist) { return VertexAccessor(*vlist, *this); }, db_.labels_index_.GetVlists(label, *transaction_, current_state)); } @@ -161,11 +159,11 @@ class GraphDbAccessor { debug_assert(db_.label_property_index_.IndexExists( LabelPropertyIndex::Key(label, property)), "Label+property index doesn't exist."); - return iter::imap([this, current_state]( - auto vlist) { return VertexAccessor(*vlist, *this); }, - db_.label_property_index_.GetVlists( - LabelPropertyIndex::Key(label, property), - *transaction_, current_state)); + return iter::imap( + [this](auto vlist) { return VertexAccessor(*vlist, *this); }, + db_.label_property_index_.GetVlists( + LabelPropertyIndex::Key(label, property), *transaction_, + current_state)); } /** @@ -190,11 +188,11 @@ class GraphDbAccessor { "Label+property index doesn't exist."); permanent_assert(value.type() != PropertyValue::Type::Null, "Can't query index for propery value type null."); - return iter::imap([this, current_state]( - auto vlist) { return VertexAccessor(*vlist, *this); }, - db_.label_property_index_.GetVlists( - LabelPropertyIndex::Key(label, property), value, - *transaction_, current_state)); + return iter::imap( + [this](auto vlist) { return VertexAccessor(*vlist, *this); }, + db_.label_property_index_.GetVlists( + LabelPropertyIndex::Key(label, property), value, *transaction_, + current_state)); } /** @@ -233,11 +231,11 @@ class GraphDbAccessor { debug_assert(db_.label_property_index_.IndexExists( LabelPropertyIndex::Key(label, property)), "Label+property index doesn't exist."); - return iter::imap([this, current_state]( - auto vlist) { return VertexAccessor(*vlist, *this); }, - db_.label_property_index_.GetVlists( - LabelPropertyIndex::Key(label, property), lower, - upper, *transaction_, current_state)); + return iter::imap( + [this](auto vlist) { return VertexAccessor(*vlist, *this); }, + db_.label_property_index_.GetVlists( + LabelPropertyIndex::Key(label, property), lower, upper, + *transaction_, current_state)); } /** @@ -307,10 +305,10 @@ class GraphDbAccessor { */ auto Edges(const GraphDbTypes::EdgeType &edge_type, bool current_state) { debug_assert(!commited_ && !aborted_, "Accessor committed or aborted"); - return iter::imap([this, current_state]( - auto vlist) { return EdgeAccessor(*vlist, *this); }, - db_.edge_types_index_.GetVlists(edge_type, *transaction_, - current_state)); + return iter::imap( + [this](auto vlist) { return EdgeAccessor(*vlist, *this); }, + db_.edge_types_index_.GetVlists(edge_type, *transaction_, + current_state)); } /** diff --git a/src/query/plan/operator.cpp b/src/query/plan/operator.cpp index d549631d3..d9117e127 100644 --- a/src/query/plan/operator.cpp +++ b/src/query/plan/operator.cpp @@ -297,26 +297,15 @@ ACCEPT_WITH_INPUT(ScanAllByLabelPropertyRange) std::unique_ptr ScanAllByLabelPropertyRange::MakeCursor( GraphDbAccessor &db) const { - auto is_less = [](const TypedValue &a, const TypedValue &b, - Bound::Type bound_type) { - try { - auto is_below = bound_type == Bound::Type::INCLUSIVE ? a < b : a <= b; - if (is_below.IsNull() || is_below.Value()) return true; - } catch (const TypedValueException &) { - throw QueryRuntimeException( - "Unable to compare values of type '{}' and '{}'", a.type(), b.type()); - } - return false; - }; - auto vertices = [this, &db, is_less](Frame &frame, Context &context) { + auto vertices = [this, &db](Frame &frame, Context &context) { ExpressionEvaluator evaluator(frame, context.parameters_, context.symbol_table_, db, graph_view_); auto convert = [&evaluator](const auto &bound) -> std::experimental::optional> { - if (!bound) return std::experimental::nullopt; - return std::experimental::make_optional(utils::Bound( - bound.value().value()->Accept(evaluator), bound.value().type())); - }; + if (!bound) return std::experimental::nullopt; + return std::experimental::make_optional(utils::Bound( + bound.value().value()->Accept(evaluator), bound.value().type())); + }; return db.Vertices(label_, property_, convert(lower_bound()), convert(upper_bound()), graph_view_ == GraphView::NEW); }; @@ -522,7 +511,7 @@ void SwitchAccessor(TAccessor &accessor, GraphView graph_view) { break; } } -} +} // namespace bool Expand::ExpandCursor::InitEdges(Frame &frame, Context &context) { // Input Vertex could be null if it is created by a failed optional match. In @@ -669,7 +658,7 @@ int64_t EvaluateInt(ExpressionEvaluator &evaluator, Expression *expr, throw QueryRuntimeException(what + " must be an int"); } } -} // annonymous namespace +} // namespace class ExpandVariableCursor : public Cursor { public: @@ -759,7 +748,7 @@ class ExpandVariableCursor : public Cursor { // Evaluate the upper and lower bounds. ExpressionEvaluator evaluator(frame, context.parameters_, context.symbol_table_, db_); - auto calc_bound = [this, &evaluator](auto &bound) { + auto calc_bound = [&evaluator](auto &bound) { auto value = EvaluateInt(evaluator, bound, "Variable expansion bound"); if (value < 0) throw QueryRuntimeException( @@ -1204,7 +1193,8 @@ class ConstructNamedPathCursor : public Cursor { ACCEPT_WITH_INPUT(ConstructNamedPath) -std::unique_ptr ConstructNamedPath::MakeCursor(GraphDbAccessor &db) const { +std::unique_ptr ConstructNamedPath::MakeCursor( + GraphDbAccessor &db) const { return std::make_unique(*this, db); } @@ -1620,7 +1610,7 @@ bool ContainsSame(const TypedValue &a, const TypedValue &b) { return a.Value() == b.Value(); } -} // annonymous namespace +} // namespace template bool ExpandUniquenessFilter::ExpandUniquenessFilterCursor::Pull( @@ -1691,7 +1681,7 @@ void ReconstructTypedValue(TypedValue &value) { break; } } -} +} // namespace Accumulate::Accumulate(const std::shared_ptr &input, const std::vector &symbols, bool advance_command) @@ -1779,7 +1769,7 @@ TypedValue DefaultAggregationOpValue(const Aggregate::Element &element) { return TypedValue(std::map()); } } -} +} // namespace bool Aggregate::AggregateCursor::Pull(Frame &frame, Context &context) { if (!pulled_all_input_) {