You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/06/01 00:09:01 UTC
[incubator-doris] branch master updated: [test] add rollup test for regression-test (#9832)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 7b65995400 [test] add rollup test for regression-test (#9832)
7b65995400 is described below
commit 7b65995400c3f5268111d373e543b24cb9d9cbc3
Author: zy-kkk <81...@qq.com>
AuthorDate: Wed Jun 1 08:08:56 2022 +0800
[test] add rollup test for regression-test (#9832)
---
regression-test/data/rollup/test_rollup_agg.out | 16 ++++++
.../suites/rollup/test_rollup_agg.groovy | 62 ++++++++++++++++++++++
2 files changed, 78 insertions(+)
diff --git a/regression-test/data/rollup/test_rollup_agg.out b/regression-test/data/rollup/test_rollup_agg.out
new file mode 100644
index 0000000000..5b9d3fc811
--- /dev/null
+++ b/regression-test/data/rollup/test_rollup_agg.out
@@ -0,0 +1,16 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+test_rollup_agg AGG_KEYS siteid INT No true \N true
+ citycode SMALLINT No true \N true
+ username VARCHAR(32) No true \N true
+ pv BIGINT No false 0 SUM true
+ uv BIGINT No false 0 SUM true
+ vv BIGINT Yes false 0 SUM true
+
+rollup_city AGG_KEYS citycode SMALLINT No true \N true
+ pv BIGINT No false 0 SUM true
+ vv BIGINT Yes false 0 SUM true
+
+-- !sql --
+1 200
+
diff --git a/regression-test/suites/rollup/test_rollup_agg.groovy b/regression-test/suites/rollup/test_rollup_agg.groovy
new file mode 100644
index 0000000000..6d420602d6
--- /dev/null
+++ b/regression-test/suites/rollup/test_rollup_agg.groovy
@@ -0,0 +1,62 @@
+// 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_rollup_agg", "rollup") {
+ def tbName = "test_rollup_agg"
+ sql "DROP TABLE IF EXISTS ${tbName}"
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tbName}(
+ siteid INT(11) NOT NULL,
+ citycode SMALLINT(6) NOT NULL,
+ username VARCHAR(32) NOT NULL,
+ pv BIGINT(20) SUM NOT NULL DEFAULT '0',
+ uv BIGINT(20) SUM NOT NULL DEFAULT '0'
+ )
+ AGGREGATE KEY (siteid,citycode,username)
+ DISTRIBUTED BY HASH(siteid) BUCKETS 5 properties("replication_num" = "1");
+ """
+ String res = "null"
+ sql "ALTER TABLE ${tbName} ADD ROLLUP rollup_city(citycode, pv);"
+ while (!res.contains("FINISHED")){
+ res = sql "SHOW ALTER TABLE ROLLUP WHERE TableName='${tbName}' ORDER BY CreateTime DESC LIMIT 1;"
+ if(res.contains("CANCELLED")){
+ print("job is cancelled")
+ break
+ }
+ Thread.sleep(1000)
+ }
+ res = "null"
+ sql "ALTER TABLE ${tbName} ADD COLUMN vv BIGINT SUM NULL DEFAULT '0' TO rollup_city;"
+ while (!res.contains("FINISHED")){
+ res = sql "SHOW ALTER TABLE COLUMN WHERE TableName='${tbName}' ORDER BY CreateTime DESC LIMIT 1;"
+ if(res.contains("CANCELLED")){
+ print("job is cancelled")
+ break
+ }
+ Thread.sleep(1000)
+ }
+ sql "SHOW ALTER TABLE ROLLUP WHERE TableName='${tbName}';"
+ qt_sql "DESC ${tbName} ALL;"
+ sql "insert into ${tbName} values(1, 1, 'test1', 100,100,100);"
+ sql "insert into ${tbName} values(2, 1, 'test2', 100,100,100);"
+ explain{
+ sql("SELECT citycode,SUM(pv) FROM ${tbName} GROUP BY citycode")
+ contains("rollup: rollup_city")
+ }
+ qt_sql "SELECT citycode,SUM(pv) FROM ${tbName} GROUP BY citycode"
+ sql "ALTER TABLE ${tbName} DROP ROLLUP rollup_city"
+ sql "DROP TABLE ${tbName}"
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org