Merge remote-tracking branch 'origin/T1189-MG-implement-create-node-cursor-mf' into T1190-MG-Implement-ScanAll-and-ScanAllByLabel-with-MultiFrame_2
This commit is contained in:
commit
586999475b
@ -218,9 +218,7 @@ class DistributedCreateNodeCursor : public Cursor {
|
||||
msgs::NewVertex rqst;
|
||||
MG_ASSERT(!node_info_.labels.empty(), "Cannot determine primary label");
|
||||
const auto primary_label = node_info_.labels[0];
|
||||
// TODO(jbajic) Fix properties not send,
|
||||
// suggestion: ignore distinction between properties and primary keys
|
||||
// since schema validation is done on storage side
|
||||
// TODO(jbajic) Send also the properties that are not part of primary key
|
||||
ExpressionEvaluator evaluator(&frame, context.symbol_table, context.evaluation_context, nullptr,
|
||||
storage::v3::View::NEW);
|
||||
if (const auto *node_info_properties = std::get_if<PropertiesMapList>(&node_info_.properties)) {
|
||||
@ -273,9 +271,7 @@ class DistributedCreateNodeCursor : public Cursor {
|
||||
MG_ASSERT(!node_info_.labels.empty(), "Cannot determine primary label");
|
||||
const auto primary_label = node_info_.labels[0];
|
||||
MG_ASSERT(context.request_router->IsPrimaryLabel(primary_label), "First label has to be a primary label!");
|
||||
// TODO(jbajic) Fix properties not send,
|
||||
// suggestion: ignore distinction between properties and primary keys
|
||||
// since schema validation is done on storage side
|
||||
// TODO(jbajic) Send also the properties that are not part of primary key
|
||||
ExpressionEvaluator evaluator(&frame, context.symbol_table, context.evaluation_context, nullptr,
|
||||
storage::v3::View::NEW);
|
||||
if (const auto *node_info_properties = std::get_if<PropertiesMapList>(&node_info_.properties)) {
|
||||
@ -2612,8 +2608,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));
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "storage/v3/shard.hpp"
|
||||
#include "utils/memory.hpp"
|
||||
|
||||
namespace memgraph::query::v2 {
|
||||
namespace memgraph::query::v2::tests {
|
||||
MultiFrame CreateMultiFrame(const size_t max_pos) {
|
||||
static constexpr size_t frame_size = 100;
|
||||
MultiFrame multi_frame(max_pos, frame_size, utils::NewDeleteResource());
|
||||
@ -79,4 +79,4 @@ TEST(CreateNodeTest, CreateNodeCursor) {
|
||||
auto number_of_invalid_frames = std::distance(invalid_frames.begin(), invalid_frames.end());
|
||||
EXPECT_EQ(number_of_invalid_frames, 99);
|
||||
}
|
||||
} // namespace memgraph::query::v2
|
||||
} // namespace memgraph::query::v2::tests
|
||||
|
Loading…
Reference in New Issue
Block a user