Address review comments

This commit is contained in:
jbajic 2022-11-04 15:05:55 +01:00
parent 3a8f01af79
commit bab5e1386a

View File

@ -180,8 +180,8 @@ std::vector<TypedValue> EvaluateVertexExpressions(DbAccessor &dba, const VertexA
struct LocalError {};
std::optional<msgs::Vertex> FillUpSourceVertex(const std::optional<VertexAccessor> &v_acc,
const msgs::ExpandOneRequest &req) {
std::optional<msgs::Vertex> FillUpSourceVertexSecondaryLabels(const std::optional<VertexAccessor> &v_acc,
const msgs::ExpandOneRequest &req) {
auto secondary_labels = v_acc->Labels(View::NEW);
if (secondary_labels.HasError()) {
spdlog::debug("Encountered an error while trying to get the secondary labels of a vertex. Transaction id: {}",
@ -191,19 +191,6 @@ std::optional<msgs::Vertex> FillUpSourceVertex(const std::optional<VertexAccesso
auto &sec_labels = secondary_labels.GetValue();
msgs::Vertex source_vertex;
const auto vertex_label = v_acc->PrimaryLabel(View::NEW);
if (vertex_label.HasError()) {
spdlog::debug("Encountered an error while trying to get the primary label of source vertex. Transaction id: {}",
req.transaction_id.logical_id);
return std::nullopt;
}
const auto vertex_pk = v_acc->PrimaryKey(View::NEW);
if (vertex_pk.HasError()) {
spdlog::debug("Encountered an error while trying to get the primary key of source vertex. Transaction id: {}",
req.transaction_id.logical_id);
return std::nullopt;
}
source_vertex.id = msgs::VertexId{msgs::Label{*vertex_label}, conversions::ConvertValueVector(*vertex_pk)};
source_vertex.labels.reserve(sec_labels.size());
std::transform(sec_labels.begin(), sec_labels.end(), std::back_inserter(source_vertex.labels),
@ -334,13 +321,14 @@ std::optional<msgs::ExpandOneResultRow> GetExpandOneResult(
const EdgeUniqunessFunction &maybe_filter_based_on_edge_uniquness, const EdgeFiller &edge_filler,
const Schemas::Schema *schema) {
/// Fill up source vertex
const auto primary_key = ConvertPropertyVector(std::move(src_vertex.second));
const auto primary_key = ConvertPropertyVector(src_vertex.second);
auto v_acc = acc.FindVertex(primary_key, View::NEW);
auto source_vertex = FillUpSourceVertex(v_acc, req);
auto source_vertex = FillUpSourceVertexSecondaryLabels(v_acc, req);
if (!source_vertex) {
return std::nullopt;
}
source_vertex->id = src_vertex;
std::optional<std::map<PropertyId, Value>> src_vertex_properties;
src_vertex_properties = FillUpSourceVertexProperties(v_acc, req, storage::v3::View::NEW, schema);