Skip to content

Commit

Permalink
fetch-prop tck (#5103)
Browse files Browse the repository at this point in the history
* add tck of fetch-prop

* add error info

Co-authored-by: Sophie <[email protected]>
  • Loading branch information
caton-hpg and Sophie-Xie authored Dec 27, 2022
1 parent 080357d commit ab790b1
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 29 deletions.
16 changes: 11 additions & 5 deletions tests/tck/features/fetch/FetchEdges.intVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -198,35 +198,41 @@ Feature: Fetch Int Vid Edges
| serve.start_year | serve.end_year |

Scenario: Fetch prop Error
# fetch on a not existing edgetype
When executing query:
"""
FETCH PROP ON not_exist_edge hash("Boris Diaw")->hash("Spurs") YIELD edge as e
"""
Then a ExecutionError should be raised at runtime: EdgeNotFound: EdgeName `not_exist_edge`
When executing query:
"""
FETCH PROP ON serve hash("Boris Diaw")->hash("Spurs") YIELD $^.serve.start_year
"""
Then a ExecutionError should be raised at runtime:
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `serve`
When executing query:
"""
FETCH PROP ON serve hash("Boris Diaw")->hash("Spurs") YIELD $$.serve.start_year
"""
Then a ExecutionError should be raised at runtime:
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `serve`
# yield not existing edgetype
When executing query:
"""
FETCH PROP ON serve hash("Boris Diaw")->hash("Spurs") YIELD abc.start_year
"""
Then a ExecutionError should be raised at runtime:
Then a ExecutionError should be raised at runtime: EdgeNotFound: EdgeName `abc`
# Fetch prop returns not existing property
When executing query:
"""
FETCH PROP ON serve hash('Boris Diaw')->hash('Hawks') YIELD serve.start_year1
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: `serve.start_year1', not found the property `start_year1'.
# Fetch prop on illegal input
When executing query:
"""
GO FROM hash('Boris Diaw') OVER serve YIELD serve._src AS src, serve._dst AS src |
FETCH PROP ON serve $-.src->$-.dst YIELD serve.start_year, serve.end_year
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: `$-.dst', not exist prop `dst'

Scenario: Fetch prop on a edge and return duplicate columns
When executing query:
Expand Down
10 changes: 5 additions & 5 deletions tests/tck/features/fetch/FetchEdges.strVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -231,30 +231,30 @@ Feature: Fetch String Vid Edges
"""
FETCH PROP ON serve "Boris Diaw"->"Spurs" YIELD $^.serve.start_year
"""
Then a ExecutionError should be raised at runtime:
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `serve`
When executing query:
"""
FETCH PROP ON serve "Boris Diaw"->"Spurs" YIELD $$.serve.start_year
"""
Then a ExecutionError should be raised at runtime:
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `serve`
When executing query:
"""
FETCH PROP ON serve "Boris Diaw"->"Spurs" YIELD abc.start_year
"""
Then a ExecutionError should be raised at runtime:
Then a ExecutionError should be raised at runtime: EdgeNotFound: EdgeName `abc`
# Fetch prop on illegal input
When executing query:
"""
GO FROM 'Boris Diaw' OVER serve YIELD serve._src AS src, serve._dst AS src |
FETCH PROP ON serve $-.src->$-.dst YIELD serve.start_year, serve.end_year
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: `$-.dst', not exist prop `dst'
# Fetch prop returns not existing property
When executing query:
"""
FETCH PROP ON serve 'Boris Diaw'->'Hawks' YIELD serve.not_exist_prop
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: `serve.not_exist_prop', not found the property `not_exist_prop'.

Scenario: yield edge
When executing query:
Expand Down
14 changes: 7 additions & 7 deletions tests/tck/features/fetch/FetchVertices.intVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -311,44 +311,44 @@ Feature: Fetch Int Vid Vertices
"""
FETCH PROP ON player hash('Boris Diaw') YIELD not_exist_tag.name, player.age
"""
Then a ExecutionError should be raised at runtime:
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `not_exist_tag`
# Fetch prop no not existing tag
When executing query:
"""
FETCH PROP ON not_exist_tag hash('Boris Diaw')
"""
Then a ExecutionError should be raised at runtime:
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `not_exist_tag`
# yield not existing property
When executing query:
"""
FETCH PROP ON player hash('Boris Diaw') YIELD player.not_existing_prop
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: `player.not_existing_prop', not found the property `not_existing_prop'.
# duplicate input
When executing query:
"""
GO FROM hash('Boris Diaw') over like YIELD like._dst as id, like._dst as id | FETCH PROP ON player $-.id YIELD player.name, player.age
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: Duplicate Column Name : `id'
# only constant list or single column of data is allowed in piped FETCH clause
When executing query:
"""
GO FROM 'Boris Diaw' over like YIELD like._src as src, like._dst as dst | FETCH PROP ON player $-.src, $-.dst YIELD vertex as node;
"""
Then a SyntaxError should be raised at runtime:
Then a SyntaxError should be raised at runtime: syntax error near `, $-.dst'
Scenario: Different from v1.x
When executing query:
"""
GO FROM hash('Boris Diaw') over like YIELD like._dst as id | FETCH PROP ON player $-.id YIELD player.name, player.age, $-.*
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: `$-.*', not exist prop `*'
# $- is not supported
When executing query:
"""
GO FROM hash('NON EXIST VERTEX ID') OVER serve YIELD dst(edge) as id | FETCH PROP ON team $- YIELD vertex as node
"""
Then a SyntaxError should be raised at runtime:
Then a SyntaxError should be raised at runtime: syntax error near `YIELD'
Scenario: format yield
When executing query:
Expand Down
24 changes: 12 additions & 12 deletions tests/tck/features/fetch/FetchVertices.strVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -396,70 +396,70 @@ Feature: Fetch String Vertices
"""
FETCH PROP ON player 'Boris Diaw' YIELD $^.player.name, player.age
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: unsupported src/dst property expression in yield.
# Fetch Vertices not support get dst property
When executing query:
"""
FETCH PROP ON player 'Boris Diaw' YIELD $$.player.name, player.age
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: unsupported src/dst property expression in yield.
# Fetch vertex yields not existing tag
When executing query:
"""
FETCH PROP ON player 'Boris Diaw' YIELD not_exist_tag.name, player.age
"""
Then a ExecutionError should be raised at runtime:
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `not_exist_tag`
When executing query:
"""
FETCH PROP ON * "Tim Duncan", "Boris Diaw" YIELD not_exist_tag.name
"""
Then a ExecutionError should be raised at runtime:
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `not_exist_tag`
# Fetch prop no not existing tag
When executing query:
"""
FETCH PROP ON not_exist_tag 'Boris Diaw'
"""
Then a ExecutionError should be raised at runtime:
Then a ExecutionError should be raised at runtime: TagNotFound: TagName `not_exist_tag`
When executing query:
"""
GO FROM 'Boris Diaw' over like YIELD like._dst as id, like._dst as id | FETCH PROP ON player $-.id YIELD player.name, player.age
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: Duplicate Column Name : `id'
When executing query:
"""
GO FROM "11" over like YIELD like._dst as id | FETCH PROP ON player "11" YIELD $-.id
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: unsupported input/variable property expression in yield.
# Fetch on existing vertex, and yield not existing property
When executing query:
"""
FETCH PROP ON player 'Boris Diaw' YIELD player.not_exist_prop
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: `player.not_exist_prop', not found the property `not_exist_prop'.
When executing query:
"""
FETCH PROP ON * "Tim Duncan", "Boris Diaw" YIELD player.not_exist_prop
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: `player.not_exist_prop', not found the property `not_exist_prop'.
# only constant list or single column of data is allowed in piped FETCH clause
When executing query:
"""
GO FROM 'Boris Diaw' over like YIELD like._src as src, like._dst as dst | FETCH PROP ON player $-.src, $-.dst;
"""
Then a SyntaxError should be raised at runtime:
Then a SyntaxError should be raised at runtime: syntax error near `, $-.dst'
Scenario: Different from v1.x
When executing query:
"""
GO FROM 'Boris Diaw' over like YIELD like._dst as id | FETCH PROP ON player $-.id YIELD player.name, player.age, $-.*
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: `$-.*', not exist prop `*'
# Different from 1.x $- is not supported
When executing query:
"""
GO FROM 'NON EXIST VERTEX ID' OVER serve | FETCH PROP ON team $-
"""
Then a SyntaxError should be raised at runtime:
Then a SyntaxError should be raised at runtime: syntax error near `$-'
Scenario: format yield
When executing query:
Expand Down

0 comments on commit ab790b1

Please sign in to comment.