Skip to content

Commit

Permalink
update1: test
Browse files Browse the repository at this point in the history
Signed-off-by: liuyehcf <[email protected]>
  • Loading branch information
liuyehcf committed Dec 1, 2023
1 parent 8def78e commit b49b50c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 39 deletions.
60 changes: 28 additions & 32 deletions test/sql/test_agg_function/R/test_group_concat
Original file line number Diff line number Diff line change
Expand Up @@ -1651,51 +1651,47 @@ TomEnglish,王武程咬金语文北京上海
张三掩耳盗铃Math数学欧拉方程,张三此地无银三百两英文English
李四大闹天空英语外语美誉
-- !result
set group_concat_max_len = 1024;
-- name: testLegacyGroupConcat
CREATE TABLE t1 (
id tinyint(4) NULL,
value varchar(65533) NULL
) ENGINE=OLAP
DISTRIBUTED BY HASH(id)
PROPERTIES (
"replication_num" = "1"
);
-- result:
-- !result
set sql_mode = 'GROUP_CONCAT_LEGACY';
INSERT INTO t1 VALUES
(1,'fruit'),
(1,'fruit'),
(1,'fruit'),
(2,'fruit'),
(2,'fruit'),
(2,'fruit');
-- result:
-- !result
select group_concat( name ) from ss group by id order by 1;
set group_concat_max_len = 1024;
-- result:
None
May, Ti, 欧阳诸葛方程
Ti
Tom, Tom
Tom, Tom, 王武程咬金
张三此地无银三百两, 张三掩耳盗铃
李四大闹天空
-- !result
select group_concat( name , "-") from ss group by id order by 1;
set sql_mode = 'GROUP_CONCAT_LEGACY';
-- result:
None
May-Ti-欧阳诸葛方程
Ti
Tom-Tom
Tom-Tom-王武程咬金
张三此地无银三百两-张三掩耳盗铃
李四大闹天空
-- !result
select group_concat( subject , "-") from ss group by id order by 1;
select id, group_concat( value ) from t1 group by id order by id;
-- result:
None
English-Math
English-数学大不列颠
English-语文北京上海
物理Phy
英文English-Math数学欧拉方程
英语外语美誉
1 fruit, fruit, fruit
2 fruit, fruit, fruit
-- !result
select group_concat( name ) from ss;
select id, group_concat( value, '-' ) from t1 group by id order by id;
-- result:
May, Ti, 欧阳诸葛方程, Tom, Tom, 王武程咬金, Tom, Tom, 张三此地无银三百两, 张三掩耳盗铃, Ti, 李四大闹天空
1 fruit-fruit-fruit
2 fruit-fruit-fruit
-- !result
select group_concat( name , "-") from ss;
select group_concat( value ) from t1;
-- result:
Tom-Tom-王武程咬金-May-Ti-欧阳诸葛方程-Ti-李四大闹天空-Tom-Tom-张三此地无银三百两-张三掩耳盗铃
fruit, fruit, fruit, fruit, fruit, fruit
-- !result
select group_concat( subject , "-") from ss;
select group_concat( value, '-' ) from t1;
-- result:
English-数学大不列颠-English-Math-英文English-Math数学欧拉方程-English-语文北京上海-物理Phy-英语外语美誉
fruit-fruit-fruit-fruit-fruit-fruit
-- !result
29 changes: 22 additions & 7 deletions test/sql/test_agg_function/T/test_group_concat
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,27 @@ select group_concat(name,subject order by 1,2) from ss group by id order by 1;
set group_concat_max_len = 121;
select group_concat(name,subject order by 1,2) from ss group by id order by 1;

-- legacy mode
-- name: testLegacyGroupConcat
CREATE TABLE t1 (
id tinyint(4) NULL,
value varchar(65533) NULL
) ENGINE=OLAP
DISTRIBUTED BY HASH(id)
PROPERTIES (
"replication_num" = "1"
);

INSERT INTO t1 VALUES
(1,'fruit'),
(1,'fruit'),
(1,'fruit'),
(2,'fruit'),
(2,'fruit'),
(2,'fruit');

set group_concat_max_len = 1024;
set sql_mode = 'GROUP_CONCAT_LEGACY';
select group_concat( name ) from ss group by id order by 1;
select group_concat( name , "-") from ss group by id order by 1;
select group_concat( subject , "-") from ss group by id order by 1;
select group_concat( name ) from ss;
select group_concat( name , "-") from ss;
select group_concat( subject , "-") from ss;
select id, group_concat( value ) from t1 group by id order by id;
select id, group_concat( value, '-' ) from t1 group by id order by id;
select group_concat( value ) from t1;
select group_concat( value, '-' ) from t1;

0 comments on commit b49b50c

Please sign in to comment.