Debian Codegraph @

mysql-test/suite/json_ndb/r/json_group_concat_ndb.result

raw
1 set default_storage_engine=ndb;
2 # ----------------------------------------------------------------------
3 # Test of aggregate function GROUP_CONCAT
4 # ----------------------------------------------------------------------
5 create table t2(j json);
6 Warnings:
7 Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
8 insert into t2 values (json_array(ST_GeomFromText('LineString(0 0, 1 1, 2 2)')));
9 select group_concat(j order by j) from t2;
10 group_concat(j order by j)
11 [{"type": "LineString", "coordinates": [[0.0, 0.0], [1.0, 1.0], [2.0, 2.0]]}]
12 drop table t2;
13 create table t (c varchar(20)) charset utf8mb4;
14 insert into t values ('\\');
15 select char_length(c) from t;
16 char_length(c)
17 1
18 insert into t values (X'0C');
19 select sum(char_length(c)) from t;
20 sum(char_length(c))
21 2
22 insert into t values ('"');
23 select sum(char_length(c)) from t;
24 sum(char_length(c))
25 3
26 insert into t values ('\a');
27 select sum(char_length(c)) from t;
28 sum(char_length(c))
29 4
30 insert into t values ('\b');
31 select sum(char_length(c)) from t;
32 sum(char_length(c))
33 5
34 insert into t values ('\t');
35 select sum(char_length(c)) from t;
36 sum(char_length(c))
37 6
38 insert into t values ('\n');
39 select sum(char_length(c)) from t;
40 sum(char_length(c))
41 7
42 insert into t values ('\r');
43 select sum(char_length(c)) from t;
44 sum(char_length(c))
45 8
46 insert into t values (X'10');
47 select sum(char_length(c)) from t;
48 sum(char_length(c))
49 9
50 # '\b' and X'10' order equal in the default collation, so order on
51 # hex(c) as a tie-breaker to get stable results.
52 select group_concat(c order by c, hex(c)) from t;
53 group_concat(c order by c, hex(c))
54 ,, ,
55 , , ,",\,a
56 select char_length(group_concat(c)) from t;
57 char_length(group_concat(c))
58 17
59 select json_quote(group_concat(c order by c, hex(c))) from t;
60 json_quote(group_concat(c order by c, hex(c)))
61 "\b,\u0010,\t,\n,\f,\r,\",\\,a"
62 select char_length(json_quote(group_concat(c))) from t;
63 char_length(json_quote(group_concat(c)))
64 31
65 select convert(group_concat(c) using utf8mb4) =
66 json_unquote(group_concat(c)) as should_be_equal from t;
67 should_be_equal
68 1
69 delete from t;
70 alter table t add column (j json);
71 Warnings:
72 Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
73 insert into t values (NULL, NULL);
74 select json_quote(c), json_quote(j) from t;
75 json_quote(c) json_quote(j)
76 NULL NULL
77 select json_unquote(c), json_unquote(j) from t;
78 json_unquote(c) json_unquote(j)
79 NULL NULL
80 drop table t;
81 create table t(j json, c varchar(20));
82 Warnings:
83 Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
84 show create table t;
85 Table Create Table
86 t CREATE TABLE `t` (
87 `j` json DEFAULT NULL,
88 `c` varchar(20) DEFAULT NULL
89 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
90 insert into t values (cast('[1,2,3]' as json), '[a,b,c]');
91 insert into t values (cast(7 as json), '7'), (cast(2 as json), '2');
92 insert into t values (cast(7 as json), '7'), (cast(2 as json), '2');
93 select group_concat(j order by j), group_concat(distinct j order by j), group_concat(c order by c) from t;
94 group_concat(j order by j) group_concat(distinct j order by j) group_concat(c order by c)
95 [1, 2, 3],2,2,7,7 [1, 2, 3],2,7 [a,b,c],2,2,7,7
96 insert into t values (NULL, NULL);
97 #
98 # Bug#22992666 NULL VALUE IN JSON COLUMN CORRUPTS GROUP_CONCAT
99 # WITH ORDER BY CLAUSE
100 #
101 SELECT GROUP_CONCAT(j ORDER BY j) AS c1,
102 GROUP_CONCAT(DISTINCT j ORDER BY j) AS c2,
103 GROUP_CONCAT(c ORDER BY c) AS c3
104 FROM t;
105 c1 c2 c3
106 [1, 2, 3],2,2,7,7 [1, 2, 3],2,7 [a,b,c],2,2,7,7
107 drop table t;