You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by jg...@apache.org on 2021/03/01 19:29:53 UTC

[incubator-age] branch master updated: Add regression tests for WITH clause on auto group by

This is an automated email from the ASF dual-hosted git repository.

jgemignani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-age.git


The following commit(s) were added to refs/heads/master by this push:
     new a4f71e6  Add regression tests for WITH clause on auto group by
a4f71e6 is described below

commit a4f71e65d3562962e8d7536397c879cd57b28b77
Author: John Gemignani <jr...@gmail.com>
AuthorDate: Mon Mar 1 11:28:59 2021 -0800

    Add regression tests for WITH clause on auto group by
    
    Added regression tests for auto group by WITH clause.
---
 regress/expected/expr.out | 26 ++++++++++++++++++++++++++
 regress/sql/expr.sql      |  7 +++++++
 2 files changed, 33 insertions(+)

diff --git a/regress/expected/expr.out b/regress/expected/expr.out
index a0e22a1..5266eeb 100644
--- a/regress/expected/expr.out
+++ b/regress/expected/expr.out
@@ -4897,6 +4897,32 @@ AS (a_b_c agtype,  result agtype);
  6     | 12.0
 (1 row)
 
+-- with WITH clause
+SELECT * FROM cypher('group_by', $$MATCH(x:L) WITH x, count(x) AS c RETURN x.a + x.b + x.c + c$$)
+AS (result agtype);
+ result 
+--------
+ 7.0
+ 7.0
+ 7.0
+(3 rows)
+
+SELECT * FROM cypher('group_by', $$MATCH(x:L) WITH x, count(x) AS c RETURN x.a + x.b + x.c + c + c$$)
+AS (result agtype);
+ result 
+--------
+ 8.0
+ 8.0
+ 8.0
+(3 rows)
+
+SELECT * FROM cypher('group_by', $$MATCH(x:L) WITH x.a + x.b + x.c AS v, count(x) as c RETURN v + c + c $$)
+AS (result agtype);
+ result 
+--------
+ 12.0
+(1 row)
+
 -- should fail
 SELECT * FROM cypher('group_by', $$MATCH (x:L) RETURN x.a, x.a + count(*) + x.b + count(*) + x.c$$)
 AS (a agtype, result agtype);
diff --git a/regress/sql/expr.sql b/regress/sql/expr.sql
index 5688664..dff0702 100644
--- a/regress/sql/expr.sql
+++ b/regress/sql/expr.sql
@@ -2048,6 +2048,13 @@ SELECT * FROM cypher('group_by', $$MATCH (x:L) RETURN x.a, x.b, x.c, x.a + count
 AS (a agtype, b agtype, c agtype, result agtype);
 SELECT * FROM cypher('group_by', $$MATCH (x:L) RETURN x.a + x.b + x.c, x.a + x.b + x.c + count(*) + count(*) $$)
 AS (a_b_c agtype,  result agtype);
+-- with WITH clause
+SELECT * FROM cypher('group_by', $$MATCH(x:L) WITH x, count(x) AS c RETURN x.a + x.b + x.c + c$$)
+AS (result agtype);
+SELECT * FROM cypher('group_by', $$MATCH(x:L) WITH x, count(x) AS c RETURN x.a + x.b + x.c + c + c$$)
+AS (result agtype);
+SELECT * FROM cypher('group_by', $$MATCH(x:L) WITH x.a + x.b + x.c AS v, count(x) as c RETURN v + c + c $$)
+AS (result agtype);
 -- should fail
 SELECT * FROM cypher('group_by', $$MATCH (x:L) RETURN x.a, x.a + count(*) + x.b + count(*) + x.c$$)
 AS (a agtype, result agtype);