Skip to content

Commit

Permalink
Pass aliases from unwind to project (with *). (#5045)
Browse files Browse the repository at this point in the history
  • Loading branch information
xtcyclist committed Dec 12, 2022
1 parent cc0ce34 commit 573f7f4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/graph/validator/MatchValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ Status MatchValidator::buildColumnsForAllNamedAliases(const std::vector<QueryPar
case CypherClauseKind::kUnwind: {
auto unwindCtx = static_cast<const UnwindClauseContext *>(boundary.get());
columns->addColumn(makeColumn(unwindCtx->alias), true);
for (auto &passAlias : prevQueryPart.aliasesAvailable) {
columns->addColumn(makeColumn(passAlias.first), true);
}
for (auto &passAlias : prevQueryPart.aliasesGenerated) {
columns->addColumn(makeColumn(passAlias.first), true);
}
break;
}
case CypherClauseKind::kWith: {
Expand Down
31 changes: 31 additions & 0 deletions tests/tck/features/match/With.feature
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,34 @@ Feature: With clause
return count (p)
"""
Then a SemanticError should be raised at runtime: Alias used but not defined: `p'

Scenario: with wildcard after unwind before argument
When executing query:
"""
match (v:player)--(t:team)
where id(v) == "Tim Duncan"
unwind [1] as digit
with *
match (t:team)<--(v1)
return v1.player.name
"""
Then the result should be, in any order:
| v1.player.name |
| "Cory Joseph" |
| "Kyle Anderson" |
| "Danny Green" |
| "David West" |
| "Jonathon Simmons" |
| "LaMarcus Aldridge" |
| "Rudy Gay" |
| "Tony Parker" |
| "Marco Belinelli" |
| "Marco Belinelli" |
| "Tiago Splitter" |
| "Tim Duncan" |
| "Manu Ginobili" |
| "Tracy McGrady" |
| "Boris Diaw" |
| "Aron Baynes" |
| "Paul Gasol" |
| "Dejounte Murray" |

0 comments on commit 573f7f4

Please sign in to comment.