diff --git a/src/query/v2/plan/operator.cpp b/src/query/v2/plan/operator.cpp index a7a3efe3b..a410d31a7 100644 --- a/src/query/v2/plan/operator.cpp +++ b/src/query/v2/plan/operator.cpp @@ -519,6 +519,8 @@ class DistributedScanAllByPrimaryKeyCursor : public Cursor { // Original // current_batch_ = request_router.ScanVertices(request_label, pk); + auto asd_debug = request_router.ScanVertices(request_label, pk); + // VertexAccessor(Vertex v, std::vector> props, // const RequestRouterInterface *request_router); @@ -536,21 +538,17 @@ class DistributedScanAllByPrimaryKeyCursor : public Cursor { msgs::GetPropertiesRequest req = {.vertex_ids = {std::make_pair(label, pk)}}; auto get_prop_result = request_router.GetProperties(req); - MG_ASSERT(get_prop_result.size() == 1); + MG_ASSERT(get_prop_result.size() <= 1); - // std::vector> props - std::map transformed_properties; - auto properties = get_prop_result[0].props; - std::transform(properties.begin(), properties.end(), - std::inserter(transformed_properties, transformed_properties.end()), [](const auto &prop) { - return std::make_pair(msgs::PropertyId::FromUint(prop.first.AsUint()), prop.second); - }); + if (get_prop_result.empty()) { + current_batch_ = std::vector{}; + } else { + auto properties = get_prop_result[0].props; + // TODO (gvolfing) figure out labels when relevant. + msgs::Vertex vertex = {.id = get_prop_result[0].vertex, .labels = {}}; - msgs::Vertex vertex = {.id = get_prop_result[0].vertex, .labels = {label}}; - // auto va = VertexAccessor(vertex, std::move(transformed_properties), &request_router); - auto va = VertexAccessor(vertex, properties, &request_router); - - current_batch_ = {va}; + current_batch_ = {VertexAccessor(vertex, properties, &request_router)}; + } } current_vertex_it_ = current_batch_.begin(); request_state_ = State::COMPLETED; diff --git a/src/query/v2/request_router.hpp b/src/query/v2/request_router.hpp index d4223e880..d83dd6928 100644 --- a/src/query/v2/request_router.hpp +++ b/src/query/v2/request_router.hpp @@ -372,6 +372,8 @@ class RequestRouter : public RequestRouterInterface { } std::vector GetProperties(msgs::GetPropertiesRequest requests) override { + // Add HLC to GetProperties request + requests.transaction_id = transaction_id_; // create requests std::vector> requests_to_be_sent = RequestsForGetProperties(std::move(requests)); diff --git a/src/storage/v3/shard_rsm.cpp b/src/storage/v3/shard_rsm.cpp index b919d217c..c23d31ebc 100644 --- a/src/storage/v3/shard_rsm.cpp +++ b/src/storage/v3/shard_rsm.cpp @@ -1,4 +1,4 @@ -// Copyright 2022 Memgraph Ltd. +// Copyright 2023 Memgraph Ltd. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source @@ -535,13 +535,17 @@ msgs::ReadResponses ShardRsm::HandleRead(msgs::GetPropertiesRequest &&req) { return result; }; - auto collect_props = [&req](const VertexAccessor &v_acc, - const std::optional &e_acc) -> ShardResult> { + auto collect_props = [this, &req]( + const VertexAccessor &v_acc, + const std::optional &e_acc) -> ShardResult> { if (!req.property_ids) { + const auto *schema = shard_->GetSchema(shard_->PrimaryLabel()); + MG_ASSERT(schema); + if (e_acc) { return CollectAllPropertiesFromAccessor(*e_acc, view); } - return CollectAllPropertiesFromAccessor(v_acc, view); + return CollectAllPropertiesFromAccessor(v_acc, view, *schema); } if (e_acc) {