From 0804c3380362eb875ce7c7a16881c635728c8e84 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Tue, 28 Mar 2023 15:14:59 +0800 Subject: [PATCH] fix. --- src/graph/validator/MatchValidator.cpp | 8 ++++++-- tests/tck/features/match/Path.feature | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/graph/validator/MatchValidator.cpp b/src/graph/validator/MatchValidator.cpp index ca31474d6d2..e9d4add6c75 100644 --- a/src/graph/validator/MatchValidator.cpp +++ b/src/graph/validator/MatchValidator.cpp @@ -231,8 +231,12 @@ Status MatchValidator::buildNodeInfo(const MatchPath *path, } else { // an node alias generated here can be repeated. // but it cannot be the same with any previously defined ones. - if (aliases.find(alias.c_str()) != aliases.end()) { - return Status::SemanticError("`%s`: alias redefined", alias.c_str()); + auto iter = aliases.find(alias.c_str()); + if (iter != aliases.end()) { + if (iter->second != AliasType::kNode) { + return Status::SemanticError("`%s`: alias redefined with a different type", + alias.c_str()); + } } nodeAliases.emplace(alias, AliasType::kNode); } diff --git a/tests/tck/features/match/Path.feature b/tests/tck/features/match/Path.feature index e8a05af6b78..a44718fcfac 100644 --- a/tests/tck/features/match/Path.feature +++ b/tests/tck/features/match/Path.feature @@ -229,7 +229,7 @@ Feature: Matching paths where id(v) in [100] and id(v3) in [80] return count(p), count(p2) """ - Then a SemanticError should be raised at runtime: `p': alias redefined + Then a SemanticError should be raised at runtime: `p': alias redefined with a different type Scenario: use of defined vertices # edges cannot be redefined, tested in Scenario: distinct edges and paths