Changeset: 7b103901c694 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7b103901c694
Removed Files:
        sql/test/group-concat/Tests/groupconcat04.test
        sql/test/group-concat/Tests/groupconcat05.test
Modified Files:
        sql/test/group-concat/Tests/All
        sql/test/group-concat/Tests/groupconcat01.test
        sql/test/group-concat/Tests/groupconcat02.test
        sql/test/group-concat/Tests/groupconcat03.test
Branch: Mar2025
Log Message:

More cleaning up the group_concat tests


diffs (truncated from 732 to 300 lines):

diff --git a/sql/test/group-concat/Tests/All b/sql/test/group-concat/Tests/All
--- a/sql/test/group-concat/Tests/All
+++ b/sql/test/group-concat/Tests/All
@@ -1,5 +1,3 @@
 groupconcat01
 groupconcat02
 groupconcat03
-groupconcat04
-groupconcat05
diff --git a/sql/test/group-concat/Tests/groupconcat01.test 
b/sql/test/group-concat/Tests/groupconcat01.test
--- a/sql/test/group-concat/Tests/groupconcat01.test
+++ b/sql/test/group-concat/Tests/groupconcat01.test
@@ -111,6 +111,14 @@ 3
 even,even
 
 query IT
+SELECT a, GROUP_CONCAT(b ORDER BY b) FROM testme GROUP BY a HAVING COUNT(*) > 
2 ORDER BY a
+----
+1
+another,serious,serious,testing,todo
+2
+get,harder,lets,more,more
+
+query IT
 SELECT a, GROUP_CONCAT(b) WITHIN GROUP (ORDER BY b) FROM testme GROUP BY a 
ORDER BY a
 ----
 1
@@ -338,7 +346,7 @@ create table testme (a int, b clob)
 #statement ok
 #INSERT INTO testme VALUES (1, 'foo'), (1, 'foo'), (1, 'foo'), (2, 'bar'), (2, 
'bar'), (2, 'bar')
 
-statement error 42000!Cannot have both order by clause and within group 
clause... 
+statement error 42000!Cannot have both order by clause and within group 
clause...
 SELECT a, GROUP_CONCAT(b ORDER BY b) WITHIN GROUP (ORDER BY b) FROM testme 
GROUP BY a ORDER BY a
 
 statement ok
diff --git a/sql/test/group-concat/Tests/groupconcat02.test 
b/sql/test/group-concat/Tests/groupconcat02.test
--- a/sql/test/group-concat/Tests/groupconcat02.test
+++ b/sql/test/group-concat/Tests/groupconcat02.test
@@ -2,55 +2,115 @@ statement ok
 start transaction
 
 statement ok
-create table testme (b varchar(16))
+create table testme (a int, b clob, c int)
 
 statement ok
-insert into testme values ('another'), ('testing'), ('all')
+insert into testme values (1, 'another', 1), (5, '', 20), (5, 'if', 20), (2, 
'two', 2), (4, 'a singleton', 10), (5, 'else', 20)
+
+query IT
+select a, group_concat(b order by b) from testme where c > 3 group by a order 
by a
+----
+4
+a singleton
+5
+,else,if
 
-query T rowsort
-select group_concat(b) from testme
+query IT
+select a, group_concat(b, E'XyZ\n' order by b) from testme where c > 3 group 
by a order by a
 ----
-another,testing,all
+4
+a singleton
+5
+XyZ@elseXyZ@if
+
+query T
+select '[' || group_concat(a order by a) || ']' from testme
+----
+[1,2,4,5,5,5]
 
-statement ok
-insert into testme values ('lets'), ('get'), ('harder')
+query T
+select '[' || group_concat(a order by a desc) || ']' from testme
+----
+[5,5,5,4,2,1]
+
+query T
+select '[' || group_concat(a, '' order by a desc) || ']' from testme
+----
+[555421]
+
+query T
+select '[' || group_concat(a, 'XyZ\n' order by a desc) || ']' from testme
+----
+[5XyZ@5XyZ@5XyZ@4XyZ@2XyZ@1]
 
-query T rowsort
-select group_concat(b) from testme
+query T
+select group_concat(a, a order by a) from testme
+----
+12244555555
+
+query T
+select group_concat(a, 8 order by a) from testme
 ----
-another,testing,all,lets,get,harder
+18284858585
 
-statement ok
-insert into testme values ('even'), ('more'), ('serious')
+query TT
+select group_concat(a, NULL order by a),  group_concat(b, NULL order by b) 
from testme
+----
+124555
+a singletonanotherelseiftwo
 
 query T rowsort
-select group_concat(b) from testme
+select group_concat(c order by c desc) from testme where c < 3
 ----
-another,testing,all,lets,get,harder,even,more,serious
+2,1
 
 statement ok
-insert into testme values (NULL)
+insert into testme values (6, '', 12), (7, '', 323), (4, 'not a singleton 
anymore', 7), (7, NULL, 323)
 
-query T rowsort
-select group_concat(b) from testme
+query IT
+select a, group_concat(b order by b) from testme where c > 3 group by a order 
by a
 ----
-another,testing,all,lets,get,harder,even,more,serious
+4
+a singleton,not a singleton anymore
+5
+,else,if
+6
+(empty)
+7
+(empty)
+
+statement ok
+create table othertest (a int, b clob)
 
 statement ok
-delete from testme where b is null
+insert into othertest values (1, E'\\t a\t'), (1, E'\n\\n,'), (1, ',,,')
+
+query IT
+select a, group_concat(b order by b) from othertest group by a
+----
+1
+@\n,,,,,,\t a@
+
+query T
+select group_concat(b order by b) from othertest
+----
+@\n,,,,,,\t a@
+
+statement ok
+insert into othertest values (2, E'\n'), (2, E'\n'), (1, '')
+
+query IT rowsort
+select a, group_concat(b order by b) from othertest group by a order by a
+----
+1
+,@\n,,,,,,\t a@
+2
+@,@
 
 query T rowsort
-select group_concat(b) from testme
+select group_concat(b order by b) from othertest
 ----
-another,testing,all,lets,get,harder,even,more,serious
-
-statement ok
-insert into testme values (''), ('stress'), ('')
-
-query T rowsort
-select group_concat(b) from testme
-----
-another,testing,all,lets,get,harder,even,more,serious,,stress,
+,@,@,@\n,,,,,,\t a@
 
 statement ok
 rollback
diff --git a/sql/test/group-concat/Tests/groupconcat03.test 
b/sql/test/group-concat/Tests/groupconcat03.test
--- a/sql/test/group-concat/Tests/groupconcat03.test
+++ b/sql/test/group-concat/Tests/groupconcat03.test
@@ -2,77 +2,144 @@ statement ok
 start transaction
 
 statement ok
-create table testme (b char(8))
+create table testmore (a int, b clob)
+
+statement ok
+insert into testmore values (1, 'another'), (1, 'testing'), (1, 'todo')
+
+statement ok
+insert into testmore values (2, 'lets'), (3, 'get'), (2, 'harder')
+
+statement ok
+insert into testmore values (3, 'even'), (2, 'more'), (1, '')
 
 statement ok
-insert into testme values ('')
+insert into testmore values (3, 'even'), (2, NULL), (1, '')
+
+query T
+select group_concat('😀', '😁') as "😃" from (values (1),(2),(3), (NULL)) v
+----
+😀😁😀😁😀😁😀
 
 query T rowsort
-select group_concat(b) from testme
+select group_concat('😀', '😁') over () as "😃" from (values (1),(2),(3), (NULL)) 
v
+----
+😀😁😀😁😀😁😀
+😀😁😀😁😀😁😀
+😀😁😀😁😀😁😀
+😀😁😀😁😀😁😀
+
+query T
+select group_concat(null) || 'a'
+----
+NULL
+
+query T
+select group_concat(null) || 'a' from testmore
+----
+NULL
+
+query T
+select group_concat(null) over () || 'a'
+----
+NULL
+
+query T
+select group_concat(null) over () || 'a' from testmore
+----
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+query T
+select group_concat('') || 'a' where false
+----
+NULL
+
+query T
+select group_concat('') over () || 'a' where false
+----
+
+query T
+select group_concat('')
 ----
 (empty)
 
-statement ok
-insert into testme values ('one'), ('two'), ('three')
+query T
+select group_concat('') from testmore
+----
+,,,,,,,,,,,
 
-query T rowsort
-select group_concat(b) from testme
+query T
+select group_concat('') over () from testmore
 ----
-,one,two,three
+,,,,,,,,,,,
+,,,,,,,,,,,
+,,,,,,,,,,,
+,,,,,,,,,,,
+,,,,,,,,,,,
+,,,,,,,,,,,
+,,,,,,,,,,,
+,,,,,,,,,,,
+,,,,,,,,,,,
+,,,,,,,,,,,
+,,,,,,,,,,,
+,,,,,,,,,,,
 
-statement ok
-insert into testme values ('')
+query T
+select group_concat('', '') over () from testmore
+----
+(empty)
+(empty)
+(empty)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to