1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

func json_arrayagg test adjustments

This commit is contained in:
mariadb-AndreyPiskunov
2022-11-02 16:06:05 +02:00
parent c2ae123020
commit 8b4be1b7f9
2 changed files with 37 additions and 30 deletions

View File

@ -76,9 +76,9 @@ JSON_ARRAYAGG(a) JSON_ARRAYAGG(b)
[1,1,2,2,2,2,3,1,1,2,2,2,2,3] ["Hello","World","This","Will","Work","!","Hello","World","This","Will","Work","!"]
SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY a;
JSON_ARRAYAGG(a) JSON_ARRAYAGG(b)
[3,3] NULL
[1,1,1,1] ["Hello","World","Hello","World"]
[2,2,2,2,2,2,2,2] ["This","Will","Work","!","This","Will","Work","!"]
[3,3] NULL
#
# DISTINCT and LIMIT
#
@ -125,9 +125,9 @@ JSON_ARRAYAGG(JSON_ARRAY(a, b))
[[1, "Hello"],[1, "World"],[2, "This"],[2, "Will"],[2, "Work"],[2, "!"],[3, null],[1, "Hello"],[1, "World"],[2, "This"],[2, "Will"],[2, "Work"],[2, "!"],[3, null]]
SELECT JSON_ARRAYAGG(JSON_ARRAY(a, b)) FROM t1 GROUP BY a;
JSON_ARRAYAGG(JSON_ARRAY(a, b))
[[3, null],[3, null]]
[[1, "Hello"],[1, "World"],[1, "Hello"],[1, "World"]]
[[2, "This"],[2, "Will"],[2, "Work"],[2, "!"],[2, "This"],[2, "Will"],[2, "Work"],[2, "!"]]
[[3, null],[3, null]]
SELECT JSON_VALID(JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b))) FROM t1;
JSON_VALID(JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b)))
1
@ -136,9 +136,9 @@ JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b))
[{"a": 1, "b": "Hello"},{"a": 1, "b": "World"},{"a": 2, "b": "This"},{"a": 2, "b": "Will"},{"a": 2, "b": "Work"},{"a": 2, "b": "!"},{"a": 3, "b": null},{"a": 1, "b": "Hello"},{"a": 1, "b": "World"},{"a": 2, "b": "This"},{"a": 2, "b": "Will"},{"a": 2, "b": "Work"},{"a": 2, "b": "!"},{"a": 3, "b": null}]
SELECT JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b)) FROM t1 GROUP BY a;
JSON_ARRAYAGG(JSON_OBJECT('a', a, 'b', b))
[{"a": 3, "b": null},{"a": 3, "b": null}]
[{"a": 1, "b": "Hello"},{"a": 1, "b": "World"},{"a": 1, "b": "Hello"},{"a": 1, "b": "World"}]
[{"a": 2, "b": "This"},{"a": 2, "b": "Will"},{"a": 2, "b": "Work"},{"a": 2, "b": "!"},{"a": 2, "b": "This"},{"a": 2, "b": "Will"},{"a": 2, "b": "Work"},{"a": 2, "b": "!"}]
[{"a": 3, "b": null},{"a": 3, "b": null}]
#
# Error checks
#
@ -149,14 +149,9 @@ ERROR 42000: Incorrect parameter count in the call to native function 'JSON_ARRA
SELECT JSON_ARRAYAGG(JSON_ARRAYAGG(a)) FROM t1;
ERROR HY000: Invalid use of group function
#
# MDEV-16620 JSON_OBJECTAGG
#
DROP TABLE t1;
#
# End of 10.4 tests
#
#
# MDEV-16620 JSON_ARRAYAGG
#
CREATE TABLE t1 (a INT)ENGINE=COLUMNSTORE;
SELECT JSON_ARRAYAGG(a) FROM t1;
@ -164,8 +159,6 @@ JSON_ARRAYAGG(a)
NULL
DROP TABLE t1;
#
# MDEV-21915 Server crashes in copy_fields,Item_func_group_concat::add
while using json_arrayagg() as a window function
#
select json_arrayagg(a) over () from (select 1 a) t;
ERROR 42000: This version of MariaDB doesn't yet support 'JSON_ARRAYAGG() aggregate as window function'
@ -189,7 +182,6 @@ select json_object('x', json_arrayagg(json_object('a', 1)));
json_object('x', json_arrayagg(json_object('a', 1)))
{"x": [{"a": 1}]}
#
# MDEV-22011: DISTINCT with JSON_ARRAYAGG gives wrong results
#
CREATE TABLE t1(a INT, b INT)ENGINE=COLUMNSTORE;
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
@ -226,7 +218,6 @@ JSON_ARRAYAGG(DISTINCT a)
[3,2,1]
DROP TABLE t1;
#
# MDEV-22840: JSON_ARRAYAGG gives wrong results with NULL values and ORDER by clause
#
CREATE TABLE t1(a VARCHAR(255))ENGINE=COLUMNSTORE;
INSERT INTO t1 VALUES ('red'),('blue');
@ -274,7 +265,6 @@ id materials
DROP TABLE t1;
DROP TABLE t2;
#
# MDEV-27018 IF and COALESCE lose "json" property
#
SELECT json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f')));
json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f')))
@ -283,7 +273,6 @@ SELECT json_object('a', coalesce(json_object('b', 'c')));
json_object('a', coalesce(json_object('b', 'c')))
{"a": {"b": "c"}}
#
# MDEV-26054 Server crashes in Item_func_json_arrayagg::get_str_from_field
#
CREATE TABLE t (a VARCHAR(8))ENGINE=COLUMNSTORE;
CREATE VIEW v AS SELECT * FROM t;