Skip to content

Commit

Permalink
lookup with dedup (#4651)
Browse files Browse the repository at this point in the history
* lookup with dedup

* fix tck
  • Loading branch information
caton-hpg authored Sep 19, 2022
1 parent 9c745d5 commit c4cd891
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/graph/planner/ngql/LookupPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ StatusOr<SubPlan> LookupPlanner::transform(AstContext* astCtx) {
if (lookupCtx->filter) {
plan.root = Filter::make(qctx, plan.root, lookupCtx->filter);
}

plan.root = Project::make(qctx, plan.root, lookupCtx->yieldExpr);
if (lookupCtx->dedup) {
plan.root = Dedup::make(qctx, plan.root);
}

return plan;
}

Expand Down
27 changes: 27 additions & 0 deletions tests/tck/features/lookup/LookUp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,33 @@ Feature: LookUpTest_Vid_String
| '105' |
| '106' |
| '121' |
When executing query:
"""
LOOKUP ON player where player.age < 100 YIELD player.age as age
"""
Then the result should be, in any order:
| age |
| 42 |
| 36 |
| 33 |
| 35 |
| 28 |
| 21 |
| 21 |
| 20 |
When executing query:
"""
LOOKUP ON player where player.age < 100 YIELD distinct player.age as age
"""
Then the result should be, in any order:
| age |
| 42 |
| 36 |
| 33 |
| 35 |
| 28 |
| 21 |
| 20 |
When executing query:
"""
LOOKUP ON player where player.name == "Useless" YIELD id(vertex) as id
Expand Down

0 comments on commit c4cd891

Please sign in to comment.