Skip to content

Commit

Permalink
[Refactor] fix unstable tests by setting order by (StarRocks#37784)
Browse files Browse the repository at this point in the history
Signed-off-by: Zhuhe Fang <fzhedu@gmail.com>
  • Loading branch information
fzhedu authored Dec 26, 2023
1 parent 48129e2 commit 67cbb53
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 89 deletions.
104 changes: 52 additions & 52 deletions test/sql/test_agg_function/R/test_array_agg
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ select array_agg(distinct subject order by 1, name) from ss group by id order by
["Math数学欧拉方程","英文English"]
["英语外语美誉"]
-- !result
select array_agg(distinct name order by 1), cardinality(array_agg(distinct arr order by score)) from ss group by id order by 1;
select array_agg(distinct name order by 1), cardinality(array_agg(distinct arr order by score)) from ss group by id order by 1,2;
-- result:
[null] 1
[null,"Ti"] 2
Expand All @@ -309,7 +309,7 @@ select array_agg(distinct name order by 1), cardinality(array_agg(distinct arr o
["张三掩耳盗铃","张三此地无银三百两"] 2
["李四大闹天空"] 1
-- !result
select array_agg(name order by 1), array_agg(distinct name order by 1, score) from ss group by id order by 1;
select array_agg(name order by 1), array_agg(distinct name order by 1, score) from ss group by id order by 1,2;
-- result:
[null] [null]
[null,"Ti"] [null,"Ti"]
Expand All @@ -319,7 +319,7 @@ select array_agg(name order by 1), array_agg(distinct name order by 1, score) fr
["张三掩耳盗铃","张三此地无银三百两"] ["张三掩耳盗铃","张三此地无银三百两"]
["李四大闹天空"] ["李四大闹天空"]
-- !result
select array_agg(distinct name order by 1,score), array_agg(distinct score order by 1) from ss group by id order by 1;
select array_agg(distinct name order by 1,score), array_agg(distinct score order by 1) from ss group by id order by 1,2;
-- result:
[null] [null]
[null,"Ti"] [null,99]
Expand Down Expand Up @@ -349,7 +349,7 @@ select cardinality(array_agg(distinct arr order by score, cardinality(arr), arr)
3
3
-- !result
select array_agg(distinct name order by score, 1), count(distinct id), max(score) from ss group by id order by 1;
select array_agg(distinct name order by score, 1), count(distinct id), max(score) from ss group by id order by 1,2;
-- result:
[null] 1 None
[null,"Ti"] 0 99
Expand All @@ -369,15 +369,15 @@ select cardinality(array_agg(distinct mmap order by score,name,subject)) from ss
2
1
-- !result
select array_agg(distinct null order by score,1,4.00),array_agg(null order by score,1,4.00 ) from ss group by id order by 1;
select array_agg(distinct null order by score,1,4.00),array_agg(null order by score,1,4.00 ) from ss group by id order by 1, 2;
-- result:
[null] [null]
[null] [null,null,null]
[null] [null,null,null]
[null] [null]
[null] [null,null]
[null] [null,null]
[null] [null,null]
[null] [null]
[null] [null,null,null]
[null] [null,null,null]
-- !result
select array_agg(distinct subject order by 1, null) from ss group by id order by 1;
-- result:
Expand All @@ -389,7 +389,7 @@ select array_agg(distinct subject order by 1, null) from ss group by id order by
["Math数学欧拉方程","英文English"]
["英语外语美誉"]
-- !result
select cardinality(array_agg(distinct arr order by score,name, subject)), cardinality(array_agg(distinct mmap order by score, name,subject)) from ss group by id order by 1;
select cardinality(array_agg(distinct arr order by score,name, subject)), cardinality(array_agg(distinct mmap order by score, name,subject)) from ss group by id order by 1,2;
-- result:
1 1
1 1
Expand All @@ -399,7 +399,7 @@ select cardinality(array_agg(distinct arr order by score,name, subject)), cardin
3 3
3 3
-- !result
select array_agg(distinct score order by score,4.00),array_agg(subject order by score,4.00, 1),array_agg(subject order by score,4.00, 1) from ss group by id order by 1;
select array_agg(distinct score order by score,4.00),array_agg(subject order by score,4.00, 1),array_agg(subject order by score,4.00, 1) from ss group by id order by 1,2;
-- result:
[null] [null] [null]
[null] ["英语外语美誉"] ["英语外语美誉"]
Expand Down Expand Up @@ -459,7 +459,7 @@ select array_agg(distinct subject order by 1) from ss group by id order by 1;
["Math数学欧拉方程","英文English"]
["英语外语美誉"]
-- !result
select group_concat( name,subject order by 1,2), array_agg(distinct id order by 1), max(score) from ss group by id order by 1;
select group_concat( name,subject order by 1,2), array_agg(distinct id order by 1), max(score) from ss group by id order by 1,2,3;
-- result:
None [4] None
TiEnglish,欧阳诸葛方程数学大不列颠 [3] 98
Expand All @@ -469,7 +469,7 @@ TomEnglish,王武程咬金语文北京上海 [2] 22
张三掩耳盗铃Math数学欧拉方程,张三此地无银三百两英文English [11] 98
李四大闹天空英语外语美誉 [12] None
-- !result
select array_agg( name order by 1,score), count(distinct id), max(score) from ss group by id order by 1;
select array_agg( name order by 1,score), count(distinct id), max(score) from ss group by id order by 1,2,3;
-- result:
[null] 1 None
[null,"Ti"] 0 99
Expand All @@ -479,7 +479,7 @@ select array_agg( name order by 1,score), count(distinct id), max(score) from s
["张三掩耳盗铃","张三此地无银三百两"] 1 98
["李四大闹天空"] 1 None
-- !result
select array_agg( subject order by score,1), count(distinct id), max(score) from ss group by id order by 1;
select array_agg( subject order by score,1), count(distinct id), max(score) from ss group by id order by 1,2,3;
-- result:
[null] 1 None
[null,"English","语文北京上海"] 1 22
Expand All @@ -489,19 +489,19 @@ select array_agg( subject order by score,1), count(distinct id), max(score) fro
["Math数学欧拉方程","英文English"] 1 98
["英语外语美誉"] 1 None
-- !result
select array_agg(name order by score,4,1), count(distinct id), max(score) from ss group by id order by 1;
select array_agg(name order by score,4,1), count(distinct id), max(score) from ss group by id order by 1,2,3;
-- result:
E: (1064, 'Getting syntax error from line 1, column 7 to line 1, column 40. Detail message: ORDER BY position 4 is not in array_agg output list.')
-- !result
select cardinality(array_agg( name order by score,4.00)), cardinality(array_agg(distinct name order by score,4.00)) from ss group by id order by 1;
select cardinality(array_agg( name order by score,4.00)), cardinality(array_agg(distinct name order by score,4.00)) from ss group by id order by 1, 2;
-- result:
1 1
1 1
2 2
2 1
2 2
3 3
2 2
3 2
3 3
-- !result
select array_agg( null order by score,4.00) from ss group by id order by 1;
-- result:
Expand Down Expand Up @@ -674,7 +674,7 @@ select array_agg(distinct subject order by 1, name) from ss group by id order by
["Math数学欧拉方程","英文English"]
["英语外语美誉"]
-- !result
select array_agg(distinct name order by 1), cardinality(array_agg(distinct arr order by score)) from ss group by id order by 1;
select array_agg(distinct name order by 1), cardinality(array_agg(distinct arr order by score)) from ss group by id order by 1,2;
-- result:
[null] 1
[null,"Ti"] 2
Expand All @@ -684,7 +684,7 @@ select array_agg(distinct name order by 1), cardinality(array_agg(distinct arr o
["张三掩耳盗铃","张三此地无银三百两"] 2
["李四大闹天空"] 1
-- !result
select array_agg(name order by 1), array_agg(distinct name order by 1, score) from ss group by id order by 1;
select array_agg(name order by 1), array_agg(distinct name order by 1, score) from ss group by id order by 1,2;
-- result:
[null] [null]
[null,"Ti"] [null,"Ti"]
Expand All @@ -694,7 +694,7 @@ select array_agg(name order by 1), array_agg(distinct name order by 1, score) fr
["张三掩耳盗铃","张三此地无银三百两"] ["张三掩耳盗铃","张三此地无银三百两"]
["李四大闹天空"] ["李四大闹天空"]
-- !result
select array_agg(distinct name order by 1,score), array_agg(distinct score order by 1) from ss group by id order by 1;
select array_agg(distinct name order by 1,score), array_agg(distinct score order by 1) from ss group by id order by 1,2;
-- result:
[null] [null]
[null,"Ti"] [null,99]
Expand Down Expand Up @@ -724,7 +724,7 @@ select cardinality(array_agg(distinct arr order by score, 1)) from ss group by i
3
3
-- !result
select array_agg(distinct name order by score, 1), count(distinct id), max(score) from ss group by id order by 1;
select array_agg(distinct name order by score, 1), count(distinct id), max(score) from ss group by id order by 1,2;
-- result:
[null] 1 None
[null,"Ti"] 0 99
Expand All @@ -744,15 +744,15 @@ select cardinality(array_agg(distinct mmap order by score,name,subject)) from ss
2
1
-- !result
select array_agg(distinct null order by score,1,4.00),array_agg(null order by score,1,4.00 ) from ss group by id order by 1;
select array_agg(distinct null order by score,1,4.00),array_agg(null order by score,1,4.00 ) from ss group by id order by 1, 2;
-- result:
[null] [null]
[null] [null,null,null]
[null] [null,null,null]
[null] [null]
[null] [null,null]
[null] [null,null]
[null] [null,null]
[null] [null]
[null] [null,null,null]
[null] [null,null,null]
-- !result
select array_agg(distinct subject order by 1, null) from ss group by id order by 1;
-- result:
Expand All @@ -764,7 +764,7 @@ select array_agg(distinct subject order by 1, null) from ss group by id order by
["Math数学欧拉方程","英文English"]
["英语外语美誉"]
-- !result
select cardinality(array_agg(distinct arr order by score,name,subject)), cardinality(array_agg(distinct mmap order by score,name,subject)) from ss group by id order by 1;
select cardinality(array_agg(distinct arr order by score,name,subject)), cardinality(array_agg(distinct mmap order by score,name,subject)) from ss group by id order by 1, 2;
-- result:
1 1
1 1
Expand All @@ -774,7 +774,7 @@ select cardinality(array_agg(distinct arr order by score,name,subject)), cardina
3 3
3 3
-- !result
select array_agg(distinct score order by score,4.00),array_agg(subject order by score,4.00, 1),array_agg(subject order by score,4.00, 1) from ss group by id order by 1;
select array_agg(distinct score order by score,4.00),array_agg(subject order by score,4.00, 1),array_agg(subject order by score,4.00, 1) from ss group by id order by 1,2;
-- result:
[null] [null] [null]
[null] ["英语外语美誉"] ["英语外语美誉"]
Expand Down Expand Up @@ -834,7 +834,7 @@ select array_agg(distinct subject order by 1) from ss group by id order by 1;
["Math数学欧拉方程","英文English"]
["英语外语美誉"]
-- !result
select group_concat( name,subject order by 1,2), array_agg(distinct id order by 1), max(score) from ss group by id order by 1;
select group_concat( name,subject order by 1,2), array_agg(distinct id order by 1), max(score) from ss group by id order by 1,2,3;
-- result:
None [4] None
TiEnglish,欧阳诸葛方程数学大不列颠 [3] 98
Expand All @@ -844,7 +844,7 @@ TomEnglish,王武程咬金语文北京上海 [2] 22
张三掩耳盗铃Math数学欧拉方程,张三此地无银三百两英文English [11] 98
李四大闹天空英语外语美誉 [12] None
-- !result
select array_agg( name order by 1,score), count(distinct id), max(score) from ss group by id order by 1;
select array_agg( name order by 1,score), count(distinct id), max(score) from ss group by id order by 1,2,3;
-- result:
[null] 1 None
[null,"Ti"] 0 99
Expand All @@ -854,7 +854,7 @@ select array_agg( name order by 1,score), count(distinct id), max(score) from s
["张三掩耳盗铃","张三此地无银三百两"] 1 98
["李四大闹天空"] 1 None
-- !result
select array_agg( subject order by score,1), count(distinct id), max(score) from ss group by id order by 1;
select array_agg( subject order by score,1), count(distinct id), max(score) from ss group by id order by 1,2,3;
-- result:
[null] 1 None
[null,"English","语文北京上海"] 1 22
Expand All @@ -864,19 +864,19 @@ select array_agg( subject order by score,1), count(distinct id), max(score) fro
["Math数学欧拉方程","英文English"] 1 98
["英语外语美誉"] 1 None
-- !result
select array_agg(name order by score,4,1), count(distinct id), max(score) from ss group by id order by 1;
select array_agg(name order by score,4,1), count(distinct id), max(score) from ss group by id order by 1,2,3;
-- result:
E: (1064, 'Getting syntax error from line 1, column 7 to line 1, column 40. Detail message: ORDER BY position 4 is not in array_agg output list.')
-- !result
select cardinality(array_agg( name order by score,4.00)), cardinality(array_agg(distinct name order by score,4.00)) from ss group by id order by 1;
select cardinality(array_agg( name order by score,4.00)), cardinality(array_agg(distinct name order by score,4.00)) from ss group by id order by 1, 2;
-- result:
1 1
1 1
2 2
2 1
2 2
3 3
2 2
3 2
3 3
-- !result
select array_agg( null order by score,4.00) from ss group by id order by 1;
-- result:
Expand Down Expand Up @@ -1116,7 +1116,7 @@ set new_planner_agg_stage = 0;
set enable_exchange_pass_through = false;
-- result:
-- !result
select array_agg(distinct name order by 1, score), count(distinct id), array_agg(name order by 1) from ss group by id order by 1;
select array_agg(distinct name order by 1, score), count(distinct id), array_agg(name order by 1) from ss group by id order by 1,2;
-- result:
[null] 1 [null]
[null,"Ti"] 0 [null,"Ti"]
Expand All @@ -1136,7 +1136,7 @@ select array_agg(distinct subject order by 1, name) from ss group by id order by
["Math数学欧拉方程","英文English"]
["英语外语美誉"]
-- !result
select array_agg(distinct name order by 1), cardinality(array_agg(distinct arr order by score)) from ss group by id order by 1;
select array_agg(distinct name order by 1), cardinality(array_agg(distinct arr order by score)) from ss group by id order by 1,2;
-- result:
[null] 1
[null,"Ti"] 2
Expand All @@ -1146,7 +1146,7 @@ select array_agg(distinct name order by 1), cardinality(array_agg(distinct arr o
["张三掩耳盗铃","张三此地无银三百两"] 2
["李四大闹天空"] 1
-- !result
select array_agg(name order by 1), array_agg(distinct name order by 1, score) from ss group by id order by 1;
select array_agg(name order by 1), array_agg(distinct name order by 1, score) from ss group by id order by 1,2;
-- result:
[null] [null]
[null,"Ti"] [null,"Ti"]
Expand All @@ -1156,7 +1156,7 @@ select array_agg(name order by 1), array_agg(distinct name order by 1, score) fr
["张三掩耳盗铃","张三此地无银三百两"] ["张三掩耳盗铃","张三此地无银三百两"]
["李四大闹天空"] ["李四大闹天空"]
-- !result
select array_agg(distinct name order by 1,score), array_agg(distinct score order by 1) from ss group by id order by 1;
select array_agg(distinct name order by 1,score), array_agg(distinct score order by 1) from ss group by id order by 1,2;
-- result:
[null] [null]
[null,"Ti"] [null,99]
Expand Down Expand Up @@ -1186,7 +1186,7 @@ select cardinality(array_agg(distinct arr order by score,1)) from ss group by id
3
3
-- !result
select array_agg(distinct name order by score, 1), count(distinct id), max(score) from ss group by id order by 1;
select array_agg(distinct name order by score, 1), count(distinct id), max(score) from ss group by id order by 1,2,3;
-- result:
[null] 1 None
[null,"Ti"] 0 99
Expand All @@ -1206,15 +1206,15 @@ select cardinality(array_agg(distinct mmap order by score, name,subject)) from s
2
1
-- !result
select array_agg(distinct null order by score,1,4.00),array_agg(null order by score,1,4.00 ) from ss group by id order by 1;
select array_agg(distinct null order by score,1,4.00),array_agg(null order by score,1,4.00 ) from ss group by id order by 1, 2;
-- result:
[null] [null]
[null] [null,null,null]
[null] [null,null,null]
[null] [null]
[null] [null,null]
[null] [null,null]
[null] [null,null]
[null] [null]
[null] [null,null,null]
[null] [null,null,null]
-- !result
select array_agg(distinct subject order by 1, null) from ss group by id order by 1;
-- result:
Expand All @@ -1226,7 +1226,7 @@ select array_agg(distinct subject order by 1, null) from ss group by id order by
["Math数学欧拉方程","英文English"]
["英语外语美誉"]
-- !result
select cardinality(array_agg(distinct arr order by score,name,subject)), cardinality(array_agg(distinct mmap order by score,name,subject)) from ss group by id order by 1;
select cardinality(array_agg(distinct arr order by score,name,subject)), cardinality(array_agg(distinct mmap order by score,name,subject)) from ss group by id order by 1, 2;
-- result:
1 1
1 1
Expand All @@ -1236,7 +1236,7 @@ select cardinality(array_agg(distinct arr order by score,name,subject)), cardina
3 3
3 3
-- !result
select array_agg(distinct score order by score,4.00),array_agg(subject order by score,4.00, 1),array_agg(subject order by score,4.00, 1) from ss group by id order by 1;
select array_agg(distinct score order by score,4.00),array_agg(subject order by score,4.00, 1),array_agg(subject order by score,4.00, 1) from ss group by id order by 1, 2;
-- result:
[null] [null] [null]
[null] ["英语外语美誉"] ["英语外语美誉"]
Expand Down Expand Up @@ -1296,7 +1296,7 @@ select array_agg(distinct subject order by 1) from ss group by id order by 1;
["Math数学欧拉方程","英文English"]
["英语外语美誉"]
-- !result
select group_concat( name,subject order by 1,2), array_agg(distinct id order by 1), max(score) from ss group by id order by 1;
select group_concat( name,subject order by 1,2), array_agg(distinct id order by 1), max(score) from ss group by id order by 1, 2, 3;
-- result:
None [4] None
TiEnglish,欧阳诸葛方程数学大不列颠 [3] 98
Expand All @@ -1306,7 +1306,7 @@ TomEnglish,王武程咬金语文北京上海 [2] 22
张三掩耳盗铃Math数学欧拉方程,张三此地无银三百两英文English [11] 98
李四大闹天空英语外语美誉 [12] None
-- !result
select array_agg( name order by 1,score), count(distinct id), max(score) from ss group by id order by 1;
select array_agg( name order by 1,score), count(distinct id), max(score) from ss group by id order by 1, 2, 3;
-- result:
[null] 1 None
[null,"Ti"] 0 99
Expand All @@ -1316,7 +1316,7 @@ select array_agg( name order by 1,score), count(distinct id), max(score) from s
["张三掩耳盗铃","张三此地无银三百两"] 1 98
["李四大闹天空"] 1 None
-- !result
select array_agg( subject order by score,1), count(distinct id), max(score) from ss group by id order by 1;
select array_agg( subject order by score,1), count(distinct id), max(score) from ss group by id order by 1, 2, 3;
-- result:
[null] 1 None
[null,"English","语文北京上海"] 1 22
Expand All @@ -1326,19 +1326,19 @@ select array_agg( subject order by score,1), count(distinct id), max(score) fro
["Math数学欧拉方程","英文English"] 1 98
["英语外语美誉"] 1 None
-- !result
select array_agg(name order by score,4,1), count(distinct id), max(score) from ss group by id order by 1;
select array_agg(name order by score,4,1), count(distinct id), max(score) from ss group by id order by 1, 2,3;
-- result:
E: (1064, 'Getting syntax error from line 1, column 7 to line 1, column 40. Detail message: ORDER BY position 4 is not in array_agg output list.')
-- !result
select cardinality(array_agg( name order by score,4.00)), cardinality(array_agg(distinct name order by score,4.00)) from ss group by id order by 1;
select cardinality(array_agg( name order by score,4.00)), cardinality(array_agg(distinct name order by score,4.00)) from ss group by id order by 1, 2;
-- result:
1 1
1 1
2 2
2 1
2 2
3 3
2 2
3 2
3 3
-- !result
select array_agg( null order by score,4.00) from ss group by id order by 1;
-- result:
Expand Down
Loading

0 comments on commit 67cbb53

Please sign in to comment.