-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openCypher expression regression test
- Loading branch information
1 parent
32cac88
commit 20e6f34
Showing
40 changed files
with
4,734 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
test/test_files/tck/expressions/aggregation/Aggregation1.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
-GROUP TCKAggregation1 | ||
-DATASET CSV tck | ||
|
||
-- | ||
|
||
# Count only non-null values | ||
-CASE Scenario1 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, num INT64, PRIMARY KEY(ID)); | ||
---- ok | ||
-STATEMENT CREATE (:A {name: 'a', num: 33}), (:A {name: 'b', num: 42}), ({name: 'a'}); | ||
---- ok | ||
-STATEMENT MATCH (n) RETURN n.name, count(n.num); | ||
## Outcome: the result should be, in any order: | ||
---- 2 | ||
a|1 | ||
b|1 | ||
|
||
# Counting loop relationships | ||
-CASE Scenario2 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
-STATEMENT CREATE REL TABLE R(FROM A TO A); | ||
---- ok | ||
-STATEMENT CREATE (a:A), (a:A)-[:R]->(a:A); | ||
---- ok | ||
-STATEMENT MATCH ()-[r]->() | ||
RETURN count(r); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
1 |
155 changes: 155 additions & 0 deletions
155
test/test_files/tck/expressions/aggregation/Aggregation2.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
-GROUP TCKAggregation2 | ||
-DATASET CSV tck | ||
|
||
-- | ||
|
||
|
||
# `max()` over integers | ||
-CASE Scenario1 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [1,2,0,null,-1] AS x | ||
RETURN max(x); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
2 | ||
|
||
# `min()` over integers | ||
-CASE Scenario2 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [1,2,0,null,-1] AS x | ||
RETURN min(x); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
-1 | ||
|
||
# `max()` over floats | ||
-CASE Scenario3 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [1.0,2.0,0.5,null] AS x | ||
RETURN max(x); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
2.000000 | ||
|
||
# `min()` over floats | ||
-CASE Scenario4 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [1.0,2.0,0.5,null] AS x | ||
RETURN min(x); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
0.500000 | ||
|
||
# `max()` over mixed numeric values | ||
-CASE Scenario5 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [1,2.0,5,null,3.2,0.1] AS x | ||
RETURN max(x); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
5 | ||
|
||
# `min()` over mixed numeric values | ||
-CASE Scenario6 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [1,2.0,5,null,3.2,0.1] AS x | ||
RETURN min(x); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
0.1 | ||
|
||
# `max()` over strings | ||
-CASE Scenario7 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND ['a','b','B',null,'abc','abc1'] AS i | ||
RETURN max(i); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
b | ||
|
||
# `min()` over strings | ||
-CASE Scenario8 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND ['a','b','B',null,'abc','abc1'] AS i | ||
RETURN min(i); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
B | ||
|
||
# `max()` over list values | ||
-CASE Scenario9 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [[1],[2],[2, 1]] AS x | ||
RETURN max(x); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
[2,1] | ||
|
||
# `min()` over list values | ||
-CASE Scenario10 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [[1],[2],[2, 1]] AS x | ||
RETURN min(x); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
[1] | ||
|
||
# `max()` over mixed values | ||
-CASE Scenario11 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [1,'a',null,[1, 2],0.2,'b'] AS x | ||
RETURN max(x); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
1 | ||
|
||
# `min()` over mixed values | ||
-CASE Scenario12 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [1,'a',null,[1, 2],0.2,'b'] AS x | ||
RETURN min(x); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
[1,2] |
32 changes: 32 additions & 0 deletions
32
test/test_files/tck/expressions/aggregation/Aggregation3.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
-GROUP TCKAggregation3 | ||
-DATASET CSV tck | ||
|
||
-- | ||
|
||
|
||
# Sum only non-null values | ||
-CASE Scenario1 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, num INT64, PRIMARY KEY(ID)); | ||
---- ok | ||
-STATEMENT CREATE (:A {name: 'a', num: 33}), (:A {name: 'a'}), (:A {name: 'a', num: 42}); | ||
---- ok | ||
-STATEMENT MATCH (n) | ||
RETURN n.name, sum(n.num); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
a|75 | ||
|
||
# No overflow during summation | ||
-CASE Scenario2 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND range(1000000, 2000000) AS i | ||
WITH i | ||
LIMIT 3000 | ||
RETURN sum(i); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
3004498500 |
36 changes: 36 additions & 0 deletions
36
test/test_files/tck/expressions/aggregation/Aggregation5.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-GROUP TCKAggregation5 | ||
-DATASET CSV tck | ||
|
||
-- | ||
|
||
|
||
# `collect()` filtering nulls | ||
-CASE Scenario1 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
|
||
-STATEMENT CREATE (); | ||
---- ok | ||
-STATEMENT MATCH (n) | ||
OPTIONAL MATCH (n)-[:NOT_EXIST]->(x) | ||
RETURN n, collect(x); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
|[] | ||
|
||
# OPTIONAL MATCH and `collect()` on node property | ||
-CASE Scenario2 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE DoesExist(ID SERIAL, num INT64, PRIMARY KEY(ID)); | ||
---- ok | ||
-STATEMENT CREATE (:DoesExist {num: 42}), (:DoesExist {num: 43}), (:DoesExist {num: 44}); | ||
---- ok | ||
-STATEMENT OPTIONAL MATCH (f:DoesExist) | ||
OPTIONAL MATCH (n:DoesNotExist) | ||
RETURN collect(DISTINCT n.num) AS a, collect(DISTINCT f.num) AS b; | ||
## Outcome: the result should be (ignoring element order for lists): | ||
---- 1 | ||
[]|[42,43,44] |
23 changes: 23 additions & 0 deletions
23
test/test_files/tck/expressions/aggregation/Aggregation6.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
-GROUP TCKAggregation6 | ||
-DATASET CSV tck | ||
|
||
-- | ||
|
||
|
||
# `percentileDisc()` | ||
-CASE Scenario1 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
-STATEMENT CREATE ({price: 10.0}), | ||
({price: 20.0}), | ||
({price: 30.0}); | ||
## Context: parameters are: | ||
#parameters are: | ||
#percentile | 0.0 | ||
-STATEMENT MATCH (n) | ||
RETURN percentileDisc(n.price, $percentile) AS p; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
10.0 |
53 changes: 53 additions & 0 deletions
53
test/test_files/tck/expressions/aggregation/Aggregation8.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
-GROUP TCKAggregation8 | ||
-DATASET CSV tck | ||
|
||
-- | ||
|
||
|
||
# Distinct on unbound node | ||
-CASE Scenario1 | ||
-SKIP | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
-STATEMENT OPTIONAL MATCH (a) | ||
RETURN count(DISTINCT a); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
0 | ||
|
||
# Distinct on null | ||
-CASE Scenario2 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
-STATEMENT CREATE (); | ||
-STATEMENT MATCH (a) | ||
RETURN count(DISTINCT a.name); | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
0 | ||
|
||
# Collect distinct nulls | ||
-CASE Scenario3 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [null, null] AS x | ||
RETURN collect(DISTINCT x) AS c; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
|
||
|
||
# Collect distinct values mixed with nulls | ||
-CASE Scenario4 | ||
## VERIFY | ||
-STATEMENT CREATE NODE TABLE A(ID SERIAL, name STRING, PRIMARY KEY(ID)); | ||
---- ok | ||
## Context: any graph | ||
-STATEMENT UNWIND [null, 1, null] AS x | ||
RETURN collect(DISTINCT x) AS c; | ||
## Outcome: the result should be, in any order: | ||
---- 1 | ||
[1] |
Oops, something went wrong.