Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass aliases from unwind to project. #5045

Merged
merged 1 commit into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" |