Skip to content

Commit

Permalink
revert strange return
Browse files Browse the repository at this point in the history
  • Loading branch information
jievince committed Jan 3, 2023
1 parent 7047fb7 commit 743a3e7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 10 deletions.
13 changes: 9 additions & 4 deletions src/parser/parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,14 @@ yield_sentence
s->setWhereClause($4);
$$ = s;
}
| KW_RETURN yield_columns {
auto *s = new YieldSentence($2);
$$ = s;
}
| KW_RETURN KW_DISTINCT yield_columns {
auto *s = new YieldSentence($3, true);
$$ = s;
}
;

unwind_clause
Expand Down Expand Up @@ -1720,10 +1728,7 @@ reading_with_clauses
;

match_sentence
: match_return {
$$ = new MatchSentence(new MatchClauseList(), $1);
}
| reading_clauses match_return {
: reading_clauses match_return {
$$ = new MatchSentence($1, $2);
}
| reading_with_clauses match_return {
Expand Down
23 changes: 18 additions & 5 deletions tests/tck/features/set/Set.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
@jie
Feature: Set Test

Scenario: Basic
Expand Down Expand Up @@ -75,12 +76,21 @@ Feature: Set Test
| a |
| 1 |
| 2 |
# cypher doesn't support intersect
# The standalone return statement is not a cypher statement but a ngql statement in nebula...
# So it can't be mixed with other cypher statements
When executing query:
"""
UNWIND [1,2] AS a RETURN a
INTERSECT
RETURN 2 AS a
RETURN a
"""
Then a SyntaxError should be raised at runtime:
When executing query:
"""
UNWIND [1,2] AS a RETURN a
INTERSECT
WITH 2 AS a
RETURN a
"""
Then the result should be, in any order:
| a |
Expand All @@ -89,7 +99,8 @@ Feature: Set Test
"""
UNWIND [1,2,3] AS a RETURN a, 100
INTERSECT
RETURN 2 AS a, 100
WITH 2 AS a
RETURN a, 100
"""
Then the result should be, in any order:
| a | 100 |
Expand Down Expand Up @@ -291,7 +302,8 @@ Feature: Set Test
"""
UNWIND [1,2,3] AS a RETURN a
MINUS
RETURN 4 AS a
WITH 4 AS a
RETURN a
"""
Then the result should be, in any order, with relax comparison:
| a |
Expand All @@ -302,7 +314,8 @@ Feature: Set Test
"""
UNWIND [1,2,3] AS a RETURN a
MINUS
RETURN 2 AS a
WITH 2 AS a
RETURN a
"""
Then the result should be, in any order, with relax comparison:
| a |
Expand Down
18 changes: 17 additions & 1 deletion tests/tck/features/yield/return.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Return
Feature: Return. A standalone return sentence is actually a yield sentence

Background:
Given a graph with space named "nba"
Expand All @@ -21,6 +21,22 @@ Feature: Return
Then the result should be, in any order:
| (1+1) | "1+1" | (INT)3.14 | (STRING)(1+1) | (STRING)true |
| 2 | "1+1" | 3 | "2" | "true" |
When executing query:
"""
GO FROM "Tony Parker" OVER like YIELD id($$) AS vid | RETURN $-.vid AS dst
"""
Then the result should be, in any order, with relax comparison:
| dst |
| "LaMarcus Aldridge" |
| "Manu Ginobili" |
| "Tim Duncan" |
When executing query:
"""
FETCH PROP ON player "Tony Parker" YIELD player.age as age | RETURN $-.age + 100 AS age
"""
Then the result should be, in any order, with relax comparison:
| age |
| 136 |

Scenario: hash call
When executing query:
Expand Down

0 comments on commit 743a3e7

Please sign in to comment.