From 1b0db5289d6ffc75b6f74dc7e327fee0b38eba66 Mon Sep 17 00:00:00 2001 From: jeremy Date: Mon, 21 Nov 2022 10:41:08 +0100 Subject: [PATCH] OrderByVertices only keeps OrderBy expression which corresponds to Vertices --- src/storage/v3/request_helper.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/storage/v3/request_helper.hpp b/src/storage/v3/request_helper.hpp index 94220f214..08094e8ba 100644 --- a/src/storage/v3/request_helper.hpp +++ b/src/storage/v3/request_helper.hpp @@ -121,7 +121,14 @@ template concept VerticesIt = utils::SameAsAnyOf>; template std::vector> OrderByVertices(Shard::Accessor &acc, DbAccessor &dba, TIterable &iterable, - std::vector &order_bys) { + std::vector &original_order_bys) { + auto order_bys = original_order_bys; + auto it_to_remove = std::remove_if(order_bys.begin(), order_bys.end(), [](const auto &order_by) { + // We only want to keep OrderBys not impliying edges-ordering + return std::string::npos != order_by.expression.expression.find(expr::identifier_edge_symbol); + }); + order_bys.erase(it_to_remove, order_bys.end()); + std::vector ordering; ordering.reserve(order_bys.size()); std::transform(order_bys.begin(), order_bys.end(), std::back_inserter(ordering), [](const auto &order_by) {