From b26c7d09ef640d80c2c37342a558717676290a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= <benjamin.antal@memgraph.io> Date: Mon, 6 Feb 2023 16:39:42 +0100 Subject: [PATCH] Ignore not value equality property filters for `ScanByPrimaryKey` --- src/query/v2/plan/operator.cpp | 1 - src/query/v2/plan/rewrite/index_lookup.hpp | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/query/v2/plan/operator.cpp b/src/query/v2/plan/operator.cpp index c908abb59..2ad88cfa9 100644 --- a/src/query/v2/plan/operator.cpp +++ b/src/query/v2/plan/operator.cpp @@ -904,7 +904,6 @@ ScanByPrimaryKey::ScanByPrimaryKey(const std::shared_ptr<LogicalOperator> &input storage::v3::LabelId label, std::vector<query::v2::Expression *> primary_key, storage::v3::View view) : ScanAll(input, output_symbol, view), label_(label), primary_key_(primary_key) { - // TODO(antaljanosbenjamin): MATCH (p:Permission) WHERE p.uuid <999 RETURN p; MG_ASSERT(primary_key.front()); } diff --git a/src/query/v2/plan/rewrite/index_lookup.hpp b/src/query/v2/plan/rewrite/index_lookup.hpp index 17996d952..0b9b9cb97 100644 --- a/src/query/v2/plan/rewrite/index_lookup.hpp +++ b/src/query/v2/plan/rewrite/index_lookup.hpp @@ -597,6 +597,9 @@ class IndexLookupRewriter final : public HierarchicalLogicalOperatorVisitor { [](const auto &schema_elem) { return schema_elem.property_id; }); for (const auto &property_filter : property_filters) { + if (property_filter.property_filter->type_ != PropertyFilter::Type::EQUAL) { + continue; + } const auto &property_id = db_->NameToProperty(property_filter.property_filter->property_.name); if (std::find(schema_properties.begin(), schema_properties.end(), property_id) != schema_properties.end()) { pk_temp.emplace_back(std::make_pair(property_filter.expression, property_filter));