diff --git a/src/storage/exec/GetPropNode.h b/src/storage/exec/GetPropNode.h index d5560f8f361..ec274e8a2c8 100644 --- a/src/storage/exec/GetPropNode.h +++ b/src/storage/exec/GetPropNode.h @@ -47,8 +47,8 @@ class GetTagPropNode : public QueryNode { if (!std::any_of(tagNodes_.begin(), tagNodes_.end(), [](const auto& tagNode) { return tagNode->valid(); })) { + auto kvstore = context_->env()->kvstore_; if (FLAGS_use_vertex_key) { - auto kvstore = context_->env()->kvstore_; auto vertexKey = NebulaKeyUtils::vertexKey(context_->vIdLen(), partId, vId); std::string value; ret = kvstore->get(context_->spaceId(), partId, vertexKey, &value); @@ -58,7 +58,16 @@ class GetTagPropNode : public QueryNode { return ret; } } else { - return nebula::cpp2::ErrorCode::SUCCEEDED; + // check if vId has any valid tag by prefix scan + std::unique_ptr iter; + auto tagPrefix = NebulaKeyUtils::tagPrefix(context_->vIdLen(), partId, vId); + ret = context_->env()->kvstore_->prefix(context_->spaceId(), partId, tagPrefix, &iter); + if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { + return ret; + } else if (!iter->valid()) { + return nebula::cpp2::ErrorCode::SUCCEEDED; + } + // if has any tag, will emplace a row with vId } } diff --git a/tests/tck/features/delete/DeleteTag.IntVid.feature b/tests/tck/features/delete/DeleteTag.IntVid.feature index af279dd4701..1bf23a2d956 100644 --- a/tests/tck/features/delete/DeleteTag.IntVid.feature +++ b/tests/tck/features/delete/DeleteTag.IntVid.feature @@ -41,6 +41,7 @@ Feature: Delete int vid of tag """ Then the result should be, in any order: | player.name | player.age | + | EMPTY | EMPTY | When executing query: """ FETCH PROP ON bachelor hash("Tim Duncan") YIELD bachelor.name, bachelor.speciality @@ -205,6 +206,7 @@ Feature: Delete int vid of tag """ Then the result should be, in any order: | player.name | player.age | + | EMPTY | EMPTY | When executing query: """ FETCH PROP ON player hash("Tony Parker") YIELD player.name, player.age diff --git a/tests/tck/features/delete/DeleteTag.feature b/tests/tck/features/delete/DeleteTag.feature index 4e01b0cdeff..7a4fe136e94 100644 --- a/tests/tck/features/delete/DeleteTag.feature +++ b/tests/tck/features/delete/DeleteTag.feature @@ -41,6 +41,7 @@ Feature: Delete string vid of tag """ Then the result should be, in any order: | player.name | player.age | + | EMPTY | EMPTY | When executing query: """ FETCH PROP ON bachelor "Tim Duncan" YIELD bachelor.name, bachelor.speciality @@ -205,6 +206,7 @@ Feature: Delete string vid of tag """ Then the result should be, in any order: | player.name | player.age | + | EMPTY | EMPTY | When executing query: """ FETCH PROP ON player "Tony Parker" YIELD player.name, player.age diff --git a/tests/tck/features/go/GO.IntVid.feature b/tests/tck/features/go/GO.IntVid.feature index 27eb032b59d..757b31efc45 100644 --- a/tests/tck/features/go/GO.IntVid.feature +++ b/tests/tck/features/go/GO.IntVid.feature @@ -1383,14 +1383,14 @@ Feature: IntegerVid Go Sentence """ Then the result should be, in any order, with relax comparison, and the columns 0,1 should be hashed: | serve._dst | like._dst | serve.start_year | like.likeness | $$.player.name | - | "Thunders" | EMPTY | 2008 | EMPTY | NULL | + | "Thunders" | EMPTY | 2008 | EMPTY | EMPTY | | EMPTY | "Paul George" | EMPTY | 90 | "Paul George" | | EMPTY | "James Harden" | EMPTY | 90 | "James Harden" | - | "Pacers" | EMPTY | 2010 | EMPTY | NULL | - | "Thunders" | EMPTY | 2017 | EMPTY | NULL | + | "Pacers" | EMPTY | 2010 | EMPTY | EMPTY | + | "Thunders" | EMPTY | 2017 | EMPTY | EMPTY | | EMPTY | "Russell Westbrook" | EMPTY | 95 | "Russell Westbrook" | - | "Thunders" | EMPTY | 2009 | EMPTY | NULL | - | "Rockets" | EMPTY | 2012 | EMPTY | NULL | + | "Thunders" | EMPTY | 2009 | EMPTY | EMPTY | + | "Rockets" | EMPTY | 2012 | EMPTY | EMPTY | | EMPTY | "Russell Westbrook" | EMPTY | 80 | "Russell Westbrook" | When executing query: """ @@ -1399,14 +1399,14 @@ Feature: IntegerVid Go Sentence """ Then the result should be, in any order, with relax comparison, and the columns 0,1 should be hashed: | serve._dst | like._dst | serve.start_year | like.likeness | $$.player.name | - | "Thunders" | EMPTY | 2008 | EMPTY | NULL | + | "Thunders" | EMPTY | 2008 | EMPTY | EMPTY | | EMPTY | "Paul George" | EMPTY | 90 | "Paul George" | | EMPTY | "James Harden" | EMPTY | 90 | "James Harden" | - | "Pacers" | EMPTY | 2010 | EMPTY | NULL | - | "Thunders" | EMPTY | 2017 | EMPTY | NULL | + | "Pacers" | EMPTY | 2010 | EMPTY | EMPTY | + | "Thunders" | EMPTY | 2017 | EMPTY | EMPTY | | EMPTY | "Russell Westbrook" | EMPTY | 95 | "Russell Westbrook" | - | "Thunders" | EMPTY | 2009 | EMPTY | NULL | - | "Rockets" | EMPTY | 2012 | EMPTY | NULL | + | "Thunders" | EMPTY | 2009 | EMPTY | EMPTY | + | "Rockets" | EMPTY | 2012 | EMPTY | EMPTY | | EMPTY | "Russell Westbrook" | EMPTY | 80 | "Russell Westbrook" | When executing query: """ @@ -1480,8 +1480,8 @@ Feature: IntegerVid Go Sentence GO FROM hash('Tim Duncan') OVER serve YIELD $$.player.name as name """ Then the result should be, in any order, with relax comparison: - | name | - | NULL | + | name | + | EMPTY | Scenario: Integer Vid zero step When executing query: diff --git a/tests/tck/features/go/GO.feature b/tests/tck/features/go/GO.feature index 9d9374f41a6..c76057d5bbe 100644 --- a/tests/tck/features/go/GO.feature +++ b/tests/tck/features/go/GO.feature @@ -346,11 +346,6 @@ Feature: Go Sentence | like._dst | | "Kobe Bryant" | | "Marc Gasol" | - | EMPTY | - | EMPTY | - | EMPTY | - | EMPTY | - | EMPTY | When executing query: """ GO FROM "Paul Gasol" OVER * @@ -359,6 +354,11 @@ Feature: Go Sentence """ Then the result should be, in any order, with relax comparison: | like._dst | + | EMPTY | + | EMPTY | + | EMPTY | + | EMPTY | + | EMPTY | When executing query: """ GO FROM "Manu Ginobili" OVER * REVERSELY YIELD like.likeness, teammate.start_year, serve.start_year, $$.player.name @@ -1467,14 +1467,14 @@ Feature: Go Sentence """ Then the result should be, in any order, with relax comparison: | serve._dst | like._dst | serve.start_year | like.likeness | $$.player.name | - | "Thunders" | EMPTY | 2008 | EMPTY | NULL | + | "Thunders" | EMPTY | 2008 | EMPTY | EMPTY | | EMPTY | "Paul George" | EMPTY | 90 | "Paul George" | | EMPTY | "James Harden" | EMPTY | 90 | "James Harden" | - | "Pacers" | EMPTY | 2010 | EMPTY | NULL | - | "Thunders" | EMPTY | 2017 | EMPTY | NULL | + | "Pacers" | EMPTY | 2010 | EMPTY | EMPTY | + | "Thunders" | EMPTY | 2017 | EMPTY | EMPTY | | EMPTY | "Russell Westbrook" | EMPTY | 95 | "Russell Westbrook" | - | "Thunders" | EMPTY | 2009 | EMPTY | NULL | - | "Rockets" | EMPTY | 2012 | EMPTY | NULL | + | "Thunders" | EMPTY | 2009 | EMPTY | EMPTY | + | "Rockets" | EMPTY | 2012 | EMPTY | EMPTY | | EMPTY | "Russell Westbrook" | EMPTY | 80 | "Russell Westbrook" | When executing query: """ @@ -1483,14 +1483,14 @@ Feature: Go Sentence """ Then the result should be, in any order, with relax comparison: | serve._dst | like._dst | serve.start_year | like.likeness | $$.player.name | - | "Thunders" | EMPTY | 2008 | EMPTY | NULL | + | "Thunders" | EMPTY | 2008 | EMPTY | EMPTY | | EMPTY | "Paul George" | EMPTY | 90 | "Paul George" | | EMPTY | "James Harden" | EMPTY | 90 | "James Harden" | - | "Pacers" | EMPTY | 2010 | EMPTY | NULL | - | "Thunders" | EMPTY | 2017 | EMPTY | NULL | + | "Pacers" | EMPTY | 2010 | EMPTY | EMPTY | + | "Thunders" | EMPTY | 2017 | EMPTY | EMPTY | | EMPTY | "Russell Westbrook" | EMPTY | 95 | "Russell Westbrook" | - | "Thunders" | EMPTY | 2009 | EMPTY | NULL | - | "Rockets" | EMPTY | 2012 | EMPTY | NULL | + | "Thunders" | EMPTY | 2009 | EMPTY | EMPTY | + | "Rockets" | EMPTY | 2012 | EMPTY | EMPTY | | EMPTY | "Russell Westbrook" | EMPTY | 80 | "Russell Westbrook" | When executing query: """ @@ -1564,8 +1564,8 @@ Feature: Go Sentence GO FROM 'Tim Duncan' OVER serve YIELD $$.player.name as name """ Then the result should be, in any order, with relax comparison: - | name | - | NULL | + | name | + | EMPTY | Scenario: zero step When executing query: diff --git a/tests/tck/features/go/GoYieldVertexEdge.feature b/tests/tck/features/go/GoYieldVertexEdge.feature index cb649926fd4..5fbba5aec71 100644 --- a/tests/tck/features/go/GoYieldVertexEdge.feature +++ b/tests/tck/features/go/GoYieldVertexEdge.feature @@ -352,11 +352,6 @@ Feature: Go Yield Vertex And Edge Sentence | e | | [:like "Paul Gasol"->"Kobe Bryant" @0 {likeness: 90}] | | [:like "Paul Gasol"->"Marc Gasol" @0 {likeness: 99}] | - | [:serve "Paul Gasol"->"Bucks"@0{end_year:2020,start_year:2019}]| - | [:serve "Paul Gasol"->"Bulls"@0{end_year:2016,start_year:2014}]| - | [:serve "Paul Gasol"->"Grizzlies"@0{end_year:2008,start_year:2001}]| - | [:serve "Paul Gasol"->"Lakers"@0{end_year:2014,start_year:2008}]| - | [:serve "Paul Gasol"->"Spurs"@0{end_year:2019,start_year:2016}]| When executing query: """ GO FROM "Paul Gasol" OVER * @@ -365,6 +360,11 @@ Feature: Go Yield Vertex And Edge Sentence """ Then the result should be, in any order, with relax comparison: | type | + | "serve" | + | "serve" | + | "serve" | + | "serve" | + | "serve" | When executing query: """ GO FROM "Manu Ginobili" OVER * REVERSELY YIELD like.likeness, teammate.start_year, serve.start_year, $$.player.name, type(edge) as type @@ -1383,13 +1383,13 @@ Feature: Go Yield Vertex And Edge Sentence | dst | serve.start_year | like.likeness | $$.player.name | | "James Harden" | EMPTY | 90 | "James Harden" | | "Paul George" | EMPTY | 90 | "Paul George" | - | "Thunders" | 2008 | EMPTY | NULL | + | "Thunders" | 2008 | EMPTY | EMPTY | | "Russell Westbrook" | EMPTY | 80 | "Russell Westbrook" | - | "Rockets" | 2012 | EMPTY | NULL | - | "Thunders" | 2009 | EMPTY | NULL | + | "Rockets" | 2012 | EMPTY | EMPTY | + | "Thunders" | 2009 | EMPTY | EMPTY | | "Russell Westbrook" | EMPTY | 95 | "Russell Westbrook" | - | "Pacers" | 2010 | EMPTY | NULL | - | "Thunders" | 2017 | EMPTY | NULL | + | "Pacers" | 2010 | EMPTY | EMPTY | + | "Thunders" | 2017 | EMPTY | EMPTY | When executing query: """ GO 1 TO 2 STEPS FROM 'Russell Westbrook' OVER * REVERSELY YIELD edge as e diff --git a/tests/tck/features/insert/insertVertexOnly.feature b/tests/tck/features/insert/insertVertexOnly.feature index 12b31572f2a..9419e29e54b 100644 --- a/tests/tck/features/insert/insertVertexOnly.feature +++ b/tests/tck/features/insert/insertVertexOnly.feature @@ -38,5 +38,5 @@ Feature: insert vertex without tag FETCH PROP ON * 1,2 yield vertex AS v; """ Then the result should be, in any order, with relax comparison: - | v | + | v | Then drop the used space diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index 222da2a9cc1..1d0c826ee7d 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -494,7 +494,6 @@ Feature: Basic match """ Then a SemanticError should be raised at runtime: Match clause is not supported to be followed by other cypher clauses - @wtf Scenario: exists When executing query: """ diff --git a/tests/tck/features/ttl/TTL.feature b/tests/tck/features/ttl/TTL.feature index 016be0a2707..f3f74c6c618 100644 --- a/tests/tck/features/ttl/TTL.feature +++ b/tests/tck/features/ttl/TTL.feature @@ -394,30 +394,35 @@ Feature: TTLTest """ Then the result should be, in any order, with relax comparison: | node | + | ("1") | When executing query: """ FETCH PROP ON person "1" YIELD person.id as id """ Then the result should be, in any order: | id | + | EMPTY | When executing query: """ FETCH PROP ON * "1" YIELD person.id, career.id """ Then the result should be, in any order: | person.id | career.id | + | EMPTY | EMPTY | When executing query: """ FETCH PROP ON person "2" YIELD person.id """ Then the result should be, in any order: | person.id | + | EMPTY | When executing query: """ FETCH PROP ON person "2" YIELD person.id as id """ Then the result should be, in any order: | id | + | EMPTY | When executing query: """ FETCH PROP ON career "2" YIELD career.id; @@ -487,4 +492,5 @@ Feature: TTLTest """ Then the result should be, in any order: | age | + | EMPTY | And drop the used space