diff --git a/src/query/frame_change.hpp b/src/query/frame_change.hpp index 535d5ddb9..1d9ebc70c 100644 --- a/src/query/frame_change.hpp +++ b/src/query/frame_change.hpp @@ -43,23 +43,6 @@ struct CachedValue { return cache_.get_allocator().GetMemoryResource(); } - // Func to check if cache_ contains value - bool CacheValue(TypedValue &&maybe_list) { - if (!maybe_list.IsList()) { - return false; - } - auto &list = maybe_list.ValueList(); - TypedValue::Hash hash{}; - for (auto &element : list) { - const auto key = hash(element); - auto &vector_values = cache_[key]; - if (!IsValueInVec(vector_values, element)) { - vector_values.emplace_back(std::move(element)); - } - } - return true; - } - bool CacheValue(const TypedValue &maybe_list) { if (!maybe_list.IsList()) { return false; diff --git a/src/query/interpret/eval.hpp b/src/query/interpret/eval.hpp index f9ebf5467..333a7b1fa 100644 --- a/src/query/interpret/eval.hpp +++ b/src/query/interpret/eval.hpp @@ -315,8 +315,8 @@ class ExpressionEvaluator : public ExpressionVisitor { return std::move(*preoperational_checks); } auto &cached_value = frame_change_collector_->GetCachedValue(*cached_id); - cached_value.CacheValue(std::move(list)); - spdlog::trace("Value cached {}", *cached_id); + // Don't move here because we don't want to remove the element from the frame + cached_value.CacheValue(list); } const auto &cached_value = frame_change_collector_->GetCachedValue(*cached_id); @@ -338,7 +338,6 @@ class ExpressionEvaluator : public ExpressionVisitor { } const auto &list_value = list.ValueList(); - spdlog::trace("Not using cache on IN LIST operator"); auto has_null = false; for (const auto &element : list_value) { auto result = literal == element; diff --git a/src/query/interpreter.cpp b/src/query/interpreter.cpp index 2e5bba2ff..30bb4eca2 100644 --- a/src/query/interpreter.cpp +++ b/src/query/interpreter.cpp @@ -1535,7 +1535,6 @@ inline static void TryCaching(const AstStorage &ast_storage, FrameChangeCollecto continue; } frame_change_collector->AddTrackingKey(*cached_id); - spdlog::trace("Tracking {} operator, by id: {}", InListOperator::kType.name, *cached_id); } } diff --git a/tests/gql_behave/tests/memgraph_V1/features/list_operations.feature b/tests/gql_behave/tests/memgraph_V1/features/list_operations.feature index eed738446..bfe6b6225 100644 --- a/tests/gql_behave/tests/memgraph_V1/features/list_operations.feature +++ b/tests/gql_behave/tests/memgraph_V1/features/list_operations.feature @@ -263,3 +263,19 @@ Feature: List operators | id | | 1 | | 2 | + + Scenario: InList 01 + Given an empty graph + And having executed + """ + CREATE (o:Node) SET o.Status = 'This is the status'; + """ + When executing query: + """ + match (o:Node) + where o.Status IN ['This is not the status', 'This is the status'] + return o; + """ + Then the result should be: + | o | + | (:Node {Status: 'This is the status'}) |