This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 0c4830600d test(grouping sets) add regression test case for grouping sets (#14539) 0c4830600d is described below commit 0c4830600d3544ff4f15c62205b300a09fd8ad90 Author: htyoung <hty551...@hotmail.com> AuthorDate: Thu Nov 24 17:38:12 2022 +0800 test(grouping sets) add regression test case for grouping sets (#14539) Co-authored-by: tongyang.hty <hantongy...@douyu.tv> --- .../query_p0/grouping_sets/test_grouping_sets1.out | 31 ++++++ .../grouping_sets/test_grouping_sets1.groovy | 112 +++++++++++++++++++++ 2 files changed, 143 insertions(+) diff --git a/regression-test/data/query_p0/grouping_sets/test_grouping_sets1.out b/regression-test/data/query_p0/grouping_sets/test_grouping_sets1.out new file mode 100644 index 0000000000..a717f57bf4 --- /dev/null +++ b/regression-test/data/query_p0/grouping_sets/test_grouping_sets1.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select -- +\N all 0 0 1 +a a 0 0 1 +\N all 1 1 2 + +-- !select1 -- +\N 1 all 1 0 0 0 0 0 1 +a \N a -1 0 0 0 0 0 1 +\N \N all -1 0 1 0 1 1 1 +a \N a -1 0 1 0 1 1 1 +\N \N all -1 1 0 1 0 2 1 +\N 1 all 1 1 0 1 0 2 1 +\N \N all -1 1 1 1 1 3 2 + +-- !select2 -- +\N 1 all 1 0 0 0 0 0 1 +a \N a -1 0 0 0 0 0 1 +\N \N all -1 0 1 0 1 1 1 +a \N a -1 0 1 0 1 1 1 +\N \N all -1 1 0 1 0 2 1 +\N 1 all 1 1 0 1 0 2 1 +\N \N all -1 1 1 1 1 3 2 + +-- !select3 -- +\N 1 all 1 0 0 0 0 0 1 +a \N a -1 0 0 0 0 0 1 +\N \N all -1 0 1 0 1 1 1 +a \N a -1 0 1 0 1 1 1 +\N \N all -1 1 1 1 1 3 2 + diff --git a/regression-test/suites/query_p0/grouping_sets/test_grouping_sets1.groovy b/regression-test/suites/query_p0/grouping_sets/test_grouping_sets1.groovy new file mode 100644 index 0000000000..477f607a76 --- /dev/null +++ b/regression-test/suites/query_p0/grouping_sets/test_grouping_sets1.groovy @@ -0,0 +1,112 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("test_grouping_sets1") { + qt_select """ + select + col1 + ,coalesce( col1, "all" ) as coalesce_col1 + ,grouping(col1) as grouping_col1 + ,grouping_id(col1) as grp_id_col1 + ,count(*) as cnt + from + ( select null as col1 union all select "a" as col1 ) t + group by + grouping sets ( ( col1 ),() ) + order by + grouping_col1,col1 + ; + """ + qt_select1 """ + select + col1 + ,col2 + ,coalesce(col1, "all") as coalesce_col1 + ,coalesce(col2, "-1") as coalesc_col2 + ,grouping(col1) as grouping_col1 + ,grouping(col2) as grouping_col2 + ,grouping_id(col1) as grp_id_col1 + ,grouping_id(col2) as grp_id_col2 + ,grouping_id(col1,col2) as grp_id_col1_col2 + ,count(*) as cnt + from + ( + select null as col1 , 1 as col2 + union all + select "a" as col1 , null as col2 + ) t + group by + cube(col1,col2) + order by + grouping_col1,grouping_col2,col1,col2 + ; + """ + qt_select2 """ + select + col1 + ,col2 + ,coalesce(col1, "all") as coalesce_col1 + ,coalesce(col2, "-1") as coalesc_col2 + ,grouping(col1) as grouping_col1 + ,grouping(col2) as grouping_col2 + ,grouping_id(col1) as grp_id_col1 + ,grouping_id(col2) as grp_id_col2 + ,grouping_id(col1,col2) as grp_id_col1_col2 + ,count(*) as cnt + from + ( + select null as col1 , 1 as col2 + union all + select "a" as col1 , null as col2 + ) t + group by + grouping sets + ( + (col1,col2) + ,(col1) + ,(col2) + ,() + ) + order by + grouping_col1,grouping_col2,col1,col2 + ; + """ + qt_select3 """ + select + col1 + ,col2 + ,coalesce(col1, "all") as coalesce_col1 + ,coalesce(col2, "-1") as coalesc_col2 + ,grouping(col1) as grouping_col1 + ,grouping(col2) as grouping_col2 + ,grouping_id(col1) as grp_id_col1 + ,grouping_id(col2) as grp_id_col2 + ,grouping_id(col1,col2) as grp_id_col1_col2 + ,count(*) as cnt + from + ( + select null as col1 , 1 as col2 + union all + select "a" as col1 , null as col2 + ) t + group by + rollup(col1,col2) + order by + grouping_col1,grouping_col2,col1,col2 + ; + """ +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org