Merge branch 'T1191-MG-implement-create-expand-with-multiframe' into T1189-MG-implement-create-node-cursor-mf

This commit is contained in:
János Benjamin Antal 2023-01-17 20:29:52 +01:00
commit c04cfc5596
4 changed files with 24 additions and 10 deletions

View File

@ -2563,8 +2563,20 @@ class DistributedCreateExpandCursor : public Cursor {
// Set src and dest vertices
// TODO(jbajic) Currently we are only handling scenario where vertices
// are matched
request.src_vertex = v1.Id();
request.dest_vertex = v2.Id();
switch (edge_info.direction) {
case EdgeAtom::Direction::IN: {
request.src_vertex = v2.Id();
request.dest_vertex = v1.Id();
break;
}
case EdgeAtom::Direction::OUT: {
request.src_vertex = v1.Id();
request.dest_vertex = v2.Id();
break;
}
case EdgeAtom::Direction::BOTH:
LOG_FATAL("Must indicate exact expansion direction here");
}
edge_requests.push_back(std::move(request));
}

View File

@ -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
@ -299,7 +299,8 @@ class RequestRouter : public RequestRouterInterface {
MG_ASSERT(!new_edges.empty());
// create requests
std::vector<ShardRequestState<msgs::CreateExpandRequest>> requests_to_be_sent = RequestsForCreateExpand(new_edges);
std::vector<ShardRequestState<msgs::CreateExpandRequest>> requests_to_be_sent =
RequestsForCreateExpand(std::move(new_edges));
// begin all requests in parallel
RunningRequests<msgs::CreateExpandRequest> running_requests = {};
@ -430,7 +431,7 @@ class RequestRouter : public RequestRouterInterface {
}
std::vector<ShardRequestState<msgs::CreateExpandRequest>> RequestsForCreateExpand(
const std::vector<msgs::NewExpand> &new_expands) {
std::vector<msgs::NewExpand> new_expands) {
std::map<ShardMetadata, msgs::CreateExpandRequest> per_shard_request_table;
auto ensure_shard_exists_in_table = [&per_shard_request_table,
transaction_id = transaction_id_](const ShardMetadata &shard) {

View File

@ -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
@ -13,12 +13,13 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "query/v2/common.hpp"
#include "query/v2/context.hpp"
#include "query/v2/plan/operator.hpp"
#include "query/v2/request_router.hpp"
namespace memgraph::query::v2 {
namespace memgraph::query::v2::tests {
class MockedRequestRouter : public RequestRouterInterface {
public:
MOCK_METHOD(std::vector<VertexAccessor>, ScanVertices, (std::optional<std::string> label));
@ -79,4 +80,4 @@ inline MockedLogicalOperator &BaseToMock(plan::LogicalOperator &op) {
inline MockedCursor &BaseToMock(plan::Cursor &cursor) { return dynamic_cast<MockedCursor &>(cursor); }
} // namespace memgraph::query::v2
} // namespace memgraph::query::v2::tests

View File

@ -23,7 +23,7 @@
#include "utils/logging.hpp"
#include "utils/memory.hpp"
namespace memgraph::query::v2 {
namespace memgraph::query::v2::tests {
MultiFrame CreateMultiFrame(const size_t max_pos, const Symbol &src, const Symbol &dst, MockedRequestRouter *router) {
static constexpr size_t number_of_frames = 100;
@ -90,4 +90,4 @@ TEST(CreateExpandTest, Cursor) {
EXPECT_EQ(number_of_invalid_frames, 99);
}
} // namespace memgraph::query::v2
} // namespace memgraph::query::v2::tests