From b6a89a820dc28dddb7feb1acb1b5e778658373a4 Mon Sep 17 00:00:00 2001 From: jimingquan Date: Mon, 18 Oct 2021 18:09:07 +0800 Subject: [PATCH] fix fetch vertex properties(vertex) bug --- src/graph/validator/FetchVerticesValidator.cpp | 8 ++++++++ tests/tck/features/fetch/FetchVertices.intVid.feature | 7 +++++++ tests/tck/features/fetch/FetchVertices.strVid.feature | 7 +++++++ 3 files changed, 22 insertions(+) diff --git a/src/graph/validator/FetchVerticesValidator.cpp b/src/graph/validator/FetchVerticesValidator.cpp index 114c983a281..0ae3e4f8649 100644 --- a/src/graph/validator/FetchVerticesValidator.cpp +++ b/src/graph/validator/FetchVerticesValidator.cpp @@ -94,6 +94,14 @@ Status FetchVerticesValidator::validateYield(YieldClause *yield) { extractVertexProp(exprProps); break; } + auto *expr = ExpressionUtils::findAny(col->expr(), {Expression::Kind::kFunctionCall}); + if (expr != nullptr) { + const auto &name = static_cast(expr)->name(); + if (name == "properties") { + extractVertexProp(exprProps); + break; + } + } } for (auto col : yield->columns()) { diff --git a/tests/tck/features/fetch/FetchVertices.intVid.feature b/tests/tck/features/fetch/FetchVertices.intVid.feature index aac6a8eac58..f07fe4fe3f6 100644 --- a/tests/tck/features/fetch/FetchVertices.intVid.feature +++ b/tests/tck/features/fetch/FetchVertices.intVid.feature @@ -402,3 +402,10 @@ Feature: Fetch Int Vid Vertices Then the result should be, in any order, and the columns 0, 2 should be hashed: | VertexID | player.name | id(VERTEX) | | "Boris Diaw" | "Boris Diaw" | "Boris Diaw" | + When executing query: + """ + FETCH PROP ON player hash('Tim Duncan') YIELD id(vertex), properties(vertex).name as name, properties(vertex) + """ + Then the result should be, in any order, and the columns 0, 1 should be hashed: + | VertexID | id(VERTEX) | name | properties(VERTEX) | + | "Tim Duncan" | "Tim Duncan" | "Tim Duncan" | {age: 42, name: "Tim Duncan"} | diff --git a/tests/tck/features/fetch/FetchVertices.strVid.feature b/tests/tck/features/fetch/FetchVertices.strVid.feature index 8d89694e0a0..d9479df7c5a 100644 --- a/tests/tck/features/fetch/FetchVertices.strVid.feature +++ b/tests/tck/features/fetch/FetchVertices.strVid.feature @@ -513,3 +513,10 @@ Feature: Fetch String Vertices Then the result should be, in any order: | VertexID | player.name | id(VERTEX) | | "Boris Diaw" | "Boris Diaw" | "Boris Diaw" | + When executing query: + """ + FETCH PROP ON player 'Tim Duncan' YIELD id(vertex), properties(vertex).name as name, properties(vertex) + """ + Then the result should be, in any order: + | VertexID | id(VERTEX) | name | properties(VERTEX) | + | "Tim Duncan" | "Tim Duncan" | "Tim Duncan" | {age: 42, name: "Tim Duncan"} |