From b480d7556e9b3ab101f3b52f76fdbf71e363407b Mon Sep 17 00:00:00 2001 From: Aidar Samerkhanov <aidar.samerkhanov@memgraph.io> Date: Thu, 21 Mar 2024 01:42:30 +0400 Subject: [PATCH] Add Reset() for list_aggregation_branch cursor in RollUpApply. This resets state of Once and allow to collect data for new input value. --- src/query/plan/operator.cpp | 3 +++ .../tests/memgraph_V1/features/list_operations.feature | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/query/plan/operator.cpp b/src/query/plan/operator.cpp index eb9953e2f..d39ade99f 100644 --- a/src/query/plan/operator.cpp +++ b/src/query/plan/operator.cpp @@ -5797,6 +5797,9 @@ class RollUpApplyCursor : public Cursor { } clear_frame_change_collector(self_.list_collection_symbols_); frame[self_.result_symbol_] = result; + // After a successful input from the list_collection_cursor_ + // reset state of cursor because it has to a Once at the beginning + list_collection_cursor_->Reset(); } else { return false; } 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 b9c380146..d21a177fc 100644 --- a/tests/gql_behave/tests/memgraph_V1/features/list_operations.feature +++ b/tests/gql_behave/tests/memgraph_V1/features/list_operations.feature @@ -300,9 +300,9 @@ Feature: List operators """ Then the result should be: | years | keanu.name | - | [2003, 2003, 1999, 2021] | "Keanu Reeves" | + | [2003, 2003, 1999, 2021] | 'Keanu Reeves' | - Scenario: List pattern comprehension and property + Scenario: List pattern comprehension with function on selected property Given graph "graph_keanu" When executing query: """ @@ -322,9 +322,9 @@ Feature: List operators """ Then the result should be: | n.name | years | - | "Keanu Reeves" | [2003, 2003, 1999, 2021] | - | "Carrie-Anne Moss" | [2003,1999] | - | "Laurence Fishburne" | [1999] | + | 'Keanu Reeves' | [2003, 2003, 1999, 2021] | + | 'Carrie-Anne Moss' | [1999,2003] | + | 'Laurence Fishburne' | [1999] | Scenario: Multiple list pattern comprehensions in Return Given graph "graph_keanu"