Do not pull vertices one by one

This commit is contained in:
Josipmrden 2023-02-14 14:11:01 +01:00
parent fe14a8674c
commit 6f730f9a91
2 changed files with 5 additions and 11 deletions

View File

@ -3087,25 +3087,18 @@ class DistributedExpandCursor : public Cursor {
MG_ASSERT(direction != EdgeAtom::Direction::BOTH);
const auto &edge = frame[self_.common_.edge_symbol].ValueEdge();
static constexpr auto get_dst_vertex = [](const EdgeAccessor &edge,
const EdgeAtom::Direction direction) -> msgs::VertexId {
const EdgeAtom::Direction direction) -> accessors::VertexAccessor {
switch (direction) {
case EdgeAtom::Direction::IN:
return edge.From().Id();
return edge.From();
case EdgeAtom::Direction::OUT:
return edge.To().Id();
return edge.To();
case EdgeAtom::Direction::BOTH:
throw std::runtime_error("EdgeDirection Both not implemented");
}
};
msgs::GetPropertiesRequest request;
// to not fetch any properties of the edges
request.vertex_ids.push_back(get_dst_vertex(edge, direction));
auto result_rows = context.request_router->GetProperties(std::move(request));
MG_ASSERT(result_rows.size() == 1);
auto &result_row = result_rows.front();
frame[self_.common_.node_symbol] =
accessors::VertexAccessor(msgs::Vertex{result_row.vertex}, result_row.props, context.request_router);
frame[self_.common_.node_symbol] = get_dst_vertex(edge, direction);
}
bool InitEdges(Frame &frame, ExecutionContext &context) {

View File

@ -66,4 +66,5 @@ add_manual_test(ssl_server.cpp)
target_link_libraries(${test_prefix}ssl_server mg-communication)
add_manual_test(query_performance.cpp)
target_sources(${test_prefix}query_performance PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/query_performance_run.cpp)
target_link_libraries(${test_prefix}query_performance mg-communication mg-utils mg-io mg-io-simulator mg-coordinator mg-query-v2 mg-storage-v3 mg-query mg-storage-v2)