From 7bbf9246a8e3aab8ef9715dedf75d56c469f765d Mon Sep 17 00:00:00 2001 From: jimingquan Date: Thu, 2 Feb 2023 11:58:51 +0800 Subject: [PATCH] address comment --- src/graph/validator/MatchValidator.cpp | 4 ++-- src/parser/MatchPath.h | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/graph/validator/MatchValidator.cpp b/src/graph/validator/MatchValidator.cpp index b50acfe6ad6..2dd421bd5aa 100644 --- a/src/graph/validator/MatchValidator.cpp +++ b/src/graph/validator/MatchValidator.cpp @@ -1294,13 +1294,13 @@ Status MatchValidator::validatePathInWhere( /*static*/ Status MatchValidator::buildRollUpPathInfo(const MatchPath *path, Path &pathInfo) { for (const auto &node : path->nodes()) { // The inner variable of expression will be replaced by anno variable - if (!node->alias().empty() && node->alias()[0] != '_') { + if (!node->anonymous()) { pathInfo.compareVariables.emplace_back(node->alias()); } } for (const auto &edge : path->edges()) { const auto &edgeAlias = edge->alias(); - if (!edgeAlias.empty() && edgeAlias.front() != '_') { + if (!edge->anonymous()) { if (edge->range()) { return Status::SemanticError( "Variable '%s` 's type is list. not support used in multiple patterns " diff --git a/src/parser/MatchPath.h b/src/parser/MatchPath.h index 487ad0dba8b..2bceb4ff9b9 100644 --- a/src/parser/MatchPath.h +++ b/src/parser/MatchPath.h @@ -115,6 +115,10 @@ class MatchEdge final { return range_.get(); } + bool anonymous() const { + return alias_.empty() || alias_.front() == '_'; + } + std::string toString() const; MatchEdge clone() const { @@ -233,6 +237,10 @@ class MatchNode final { return alias_; } + bool anonymous() const { + return alias_.empty() || alias_.front() == '_'; + } + const auto* labels() const { return labels_.get(); }