From 668f7857b1fb84eaebbfa626554c799a2dbc0541 Mon Sep 17 00:00:00 2001
From: gvolfing <gabor.volfinger@memgraph.io>
Date: Fri, 13 Jan 2023 12:38:50 +0100
Subject: [PATCH] Pass the correct expression to the operator

---
 src/query/v2/plan/operator.cpp             | 4 ++--
 src/query/v2/plan/rewrite/index_lookup.hpp | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/query/v2/plan/operator.cpp b/src/query/v2/plan/operator.cpp
index e9c8652a2..a5ca9d061 100644
--- a/src/query/v2/plan/operator.cpp
+++ b/src/query/v2/plan/operator.cpp
@@ -508,7 +508,7 @@ class DistributedScanAllByPrimaryKeyCursor : public Cursor {
 
       // Evaluate the expressions that hold the PrimaryKey.
       ExpressionEvaluator evaluator(&frame, context.symbol_table, context.evaluation_context, context.request_router,
-                                    storage::v3::View::OLD);
+                                    storage::v3::View::NEW);
 
       std::vector<msgs::Value> pk;
       MG_ASSERT(primary_key_);
@@ -539,7 +539,7 @@ class DistributedScanAllByPrimaryKeyCursor : public Cursor {
       }
 
       if (current_vertex_it_ == current_batch_.end() &&
-          (request_state_ == State::COMPLETED || !MakeRequest(request_router, context))) {
+          (request_state_ == State::COMPLETED || !MakeRequestSingleFrame(frame, request_router, context))) {
         ResetExecutionState();
         continue;
       }
diff --git a/src/query/v2/plan/rewrite/index_lookup.hpp b/src/query/v2/plan/rewrite/index_lookup.hpp
index e134dd49b..f2a0f1bc6 100644
--- a/src/query/v2/plan/rewrite/index_lookup.hpp
+++ b/src/query/v2/plan/rewrite/index_lookup.hpp
@@ -600,7 +600,7 @@ class IndexLookupRewriter final : public HierarchicalLogicalOperatorVisitor {
         EraseLabelFilters(node_symbol, prim_label);
         std::vector<query::v2::Expression *> pk_expressions;
         std::transform(primary_key.begin(), primary_key.end(), std::back_inserter(pk_expressions),
-                       [](const auto &exp) { return exp.first; });
+                       [](const auto &exp) { return exp.second.property_filter->value_; });
         return std::make_unique<ScanAllByPrimaryKey>(input, node_symbol, GetLabel(prim_label), pk_expressions);
       }
     }