Skip to content
Snippets Groups Projects
Unverified Commit fe823549 authored by Shylock Hg's avatar Shylock Hg Committed by GitHub
Browse files

Add some cases for int vid lookup (#543)


Co-authored-by: default avatarYee <2520865+yixinglu@users.noreply.github.com>
parent 444ac0df
No related branches found
No related tags found
No related merge requests found
......@@ -82,11 +82,11 @@ Status LookupValidator::prepareYield() {
returnCols_->emplace_back(kSrc);
idxScanColNames_.emplace_back(kSrcVID);
colNames_.emplace_back(idxScanColNames_.back());
outputs_.emplace_back(colNames_.back(), Value::Type::STRING);
outputs_.emplace_back(colNames_.back(), vidType_);
returnCols_->emplace_back(kDst);
idxScanColNames_.emplace_back(kDstVID);
colNames_.emplace_back(idxScanColNames_.back());
outputs_.emplace_back(colNames_.back(), Value::Type::STRING);
outputs_.emplace_back(colNames_.back(), vidType_);
returnCols_->emplace_back(kRank);
idxScanColNames_.emplace_back(kRanking);
colNames_.emplace_back(idxScanColNames_.back());
......@@ -95,7 +95,7 @@ Status LookupValidator::prepareYield() {
returnCols_->emplace_back(kVid);
idxScanColNames_.emplace_back(kVertexID);
colNames_.emplace_back(idxScanColNames_.back());
outputs_.emplace_back(colNames_.back(), Value::Type::STRING);
outputs_.emplace_back(colNames_.back(), vidType_);
}
if (sentence->yieldClause() == nullptr) {
return Status::OK();
......
This diff is collapsed.
Feature: Lookup with output in integer vid
Background:
Given a graph with space named "nba_int_vid"
Scenario: [1] tag output
When executing query:
"""
LOOKUP ON player WHERE player.age == 40 |
FETCH PROP ON player $-.VertexID YIELD player.name
"""
Then the result should be, in any order:
| VertexID | player.name |
| hash('Kobe Bryant') | 'Kobe Bryant' |
| hash('Dirk Nowitzki') | 'Dirk Nowitzki' |
Scenario: [1] tag ouput with yield rename
When executing query:
"""
LOOKUP ON player WHERE player.age == 40 YIELD player.name AS name |
FETCH PROP ON player $-.VertexID YIELD player.name AS name
"""
Then the result should be, in any order:
| VertexID | name |
| hash('Kobe Bryant') | 'Kobe Bryant' |
| hash('Dirk Nowitzki') | 'Dirk Nowitzki' |
Scenario: [1] tag output by var
When executing query:
"""
$a = LOOKUP ON player WHERE player.age == 40;
FETCH PROP ON player $a.VertexID YIELD player.name
"""
Then the result should be, in any order:
| VertexID | player.name |
| hash('Kobe Bryant') | 'Kobe Bryant' |
| hash('Dirk Nowitzki') | 'Dirk Nowitzki' |
Scenario: [1] tag ouput with yield rename by var
When executing query:
"""
$a = LOOKUP ON player WHERE player.age == 40 YIELD player.name AS name;
FETCH PROP ON player $a.VertexID YIELD player.name AS name
"""
Then the result should be, in any order:
| VertexID | name |
| hash('Kobe Bryant') | 'Kobe Bryant' |
| hash('Dirk Nowitzki') | 'Dirk Nowitzki' |
Scenario: [2] edge output
When executing query:
"""
LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019
YIELD serve.start_year |
FETCH PROP ON serve $-.SrcVID->$-.DstVID YIELD serve.start_year
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | serve.start_year |
| hash('Russell Westbrook') | hash('Thunders') | 0 | 2008 |
| hash('Marc Gasol') | hash('Grizzlies') | 0 | 2008 |
Scenario: [2] edge output with yield rename
When executing query:
"""
LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019
YIELD serve.start_year AS startYear |
FETCH PROP ON serve $-.SrcVID->$-.DstVID YIELD serve.start_year AS startYear
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | startYear |
| hash('Russell Westbrook') | hash('Thunders') | 0 | 2008 |
| hash('Marc Gasol') | hash('Grizzlies') | 0 | 2008 |
Scenario: [2] edge output by var
When executing query:
"""
$a = LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019
YIELD serve.start_year;
FETCH PROP ON serve $a.SrcVID->$a.DstVID YIELD serve.start_year
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | serve.start_year |
| hash('Russell Westbrook') | hash('Thunders') | 0 | 2008 |
| hash('Marc Gasol') | hash('Grizzlies') | 0 | 2008 |
Scenario: [2] edge output with yield rename by var
When executing query:
"""
$a = LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019
YIELD serve.start_year AS startYear;
FETCH PROP ON serve $a.SrcVID->$a.DstVID YIELD serve.start_year AS startYear
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | startYear |
| hash('Russell Westbrook') | hash('Thunders') | 0 | 2008 |
| hash('Marc Gasol') | hash('Grizzlies') | 0 | 2008 |
Feature: Lookup with yield in integer vid
Background:
Given a graph with space named "nba_int_vid"
Scenario: [1] tag with yield
When executing query:
"""
LOOKUP ON player WHERE player.age == 40 YIELD player.name
"""
Then the result should be, in any order:
| VertexID | player.name |
| hash('Kobe Bryant') | 'Kobe Bryant' |
| hash('Dirk Nowitzki') | 'Dirk Nowitzki' |
Scenario: [1] tag with yield rename
When executing query:
"""
LOOKUP ON player WHERE player.age == 40 YIELD player.name AS name
"""
Then the result should be, in any order:
| VertexID | name |
| hash('Kobe Bryant') | 'Kobe Bryant' |
| hash('Dirk Nowitzki') | 'Dirk Nowitzki' |
Scenario: [2] edge with yield
When executing query:
"""
LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019
YIELD serve.start_year
"""
Then the result should be, in any order:
| SrcVID | DstVID | Ranking | serve.start_year |
| hash('Russell Westbrook') | hash('Thunders') | 0 | 2008 |
| hash('Marc Gasol') | hash('Grizzlies') | 0 | 2008 |
Scenario: [2] edge with yield rename
When executing query:
"""
LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019
YIELD serve.start_year AS startYear
"""
Then the result should be, in any order:
| SrcVID | DstVID | Ranking | startYear |
| hash('Russell Westbrook') | hash('Thunders') | 0 | 2008 |
| hash('Marc Gasol') | hash('Grizzlies') | 0 | 2008 |
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment