Skip to content

Commit

Permalink
fix fetch vertex properties(vertex) bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Oct 18, 2021
1 parent e99754b commit b6a89a8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/graph/validator/FetchVerticesValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const FunctionCallExpression *>(expr)->name();
if (name == "properties") {
extractVertexProp(exprProps);
break;
}
}
}

for (auto col : yield->columns()) {
Expand Down
7 changes: 7 additions & 0 deletions tests/tck/features/fetch/FetchVertices.intVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"} |
7 changes: 7 additions & 0 deletions tests/tck/features/fetch/FetchVertices.strVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"} |

0 comments on commit b6a89a8

Please sign in to comment.