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 fad3ecc3774 [regression test](schema change) add case for
tinyint/smallint/int/bigint/float/double type in agg (#30193)
fad3ecc3774 is described below
commit fad3ecc3774c9f40b6bc5c4be0019e80f163ab1f
Author: Guangdong Liu <[email protected]>
AuthorDate: Wed Jan 24 17:18:35 2024 +0800
[regression test](schema change) add case for
tinyint/smallint/int/bigint/float/double type in agg (#30193)
---
.../test_schema_change_agg_check_all_types.out | 34 ++++
.../test_schema_change_agg_check_all_types.groovy | 215 +++++++++++++++++++++
2 files changed, 249 insertions(+)
diff --git
a/regression-test/data/schema_change_p0/test_schema_change_agg_check_all_types.out
b/regression-test/data/schema_change_p0/test_schema_change_agg_check_all_types.out
new file mode 100644
index 00000000000..3f7a29b7cd5
--- /dev/null
+++
b/regression-test/data/schema_change_p0/test_schema_change_agg_check_all_types.out
@@ -0,0 +1,34 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !tinyint_to_smallint --
+10001 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00
+
+-- !smallint_to_int --
+10001 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00
+10002 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00
+
+-- !int_to_bigint --
+10001 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00
+10002 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00
+10003 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00
+
+-- !bigint_to_largeint --
+10001 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00
+10002 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00
+10003 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00
+10004 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00
+
+-- !largeint_to_float --
+10001 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00 0.0
+10002 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00 0.0
+10003 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00 0.0
+10004 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00 0.0
+10005 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00 1.11
+
+-- !float_to_double --
+10001 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00 0.0
+10002 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00 0.0
+10003 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00 0.0
+10004 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00 0.0
+10005 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00 1.1100000143051147
+10006 2 3 4 5 6.6 1.7 9 a b
c 2021-10-30 2021-10-30T00:00 1.11
+
diff --git
a/regression-test/suites/schema_change_p0/test_schema_change_agg_check_all_types.groovy
b/regression-test/suites/schema_change_p0/test_schema_change_agg_check_all_types.groovy
new file mode 100644
index 00000000000..a23c9094163
--- /dev/null
+++
b/regression-test/suites/schema_change_p0/test_schema_change_agg_check_all_types.groovy
@@ -0,0 +1,215 @@
+// 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_schema_change_agg_check_all_types", "p0") {
+ def tableName3 = "test_schema_change_agg_check_all_types"
+
+ def getJobState = { tableName ->
+ def jobStateResult = sql """ SHOW ALTER TABLE COLUMN WHERE
IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """
+ return jobStateResult[0][9]
+ }
+
+ def getCreateViewState = { tableName ->
+ def createViewStateResult = sql """ SHOW ALTER TABLE MATERIALIZED VIEW
WHERE IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """
+ return createViewStateResult[0][8]
+ }
+
+ sql """ DROP TABLE IF EXISTS ${tableName3} """
+
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tableName3} (
+ `k1` int(11) NULL,
+ `k2` tinyint(4) NULL,
+ `k3` smallint(6) NULL,
+ `k4` int(30) sum NULL,
+ `k5` largeint(40) sum NULL,
+ `k6` float sum NULL,
+ `k7` double sum NULL,
+ `k8` decimal(9, 0) max NULL,
+ `k9` char(10) replace NULL,
+ `k10` varchar(1024) replace NULL,
+ `k11` text replace NULL,
+ `k12` date replace NULL,
+ `k13` datetime replace NULL
+ ) ENGINE=OLAP
+ AGGREGATE KEY(k1, k2, k3)
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+
+ // tinyint to smallint
+ sql """ alter table ${tableName3} modify column k2 smallint key NULL"""
+ sleep(10)
+ max_try_num = 60
+ while (max_try_num--) {
+ String res = getJobState(tableName3)
+ if (res == "FINISHED" || res == "CANCELLED") {
+ assertEquals("FINISHED", res)
+ sleep(3000)
+ break
+ } else {
+ sleep(100)
+ if (max_try_num < 1){
+ assertEquals(1,2)
+ }
+ }
+ }
+
+ sql """ insert into ${tableName3} values (10001, 2, 3, 4, 5, 6.6, 1.7, 8.8,
+ 'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00') """
+
+ qt_tinyint_to_smallint """ select * from ${tableName3} """
+
+
+ // smallint to int
+ sql """ alter table ${tableName3} modify column k2 int key NULL"""
+ sleep(10)
+ max_try_num = 60
+ while (max_try_num--) {
+ String res = getJobState(tableName3)
+ if (res == "FINISHED" || res == "CANCELLED") {
+ assertEquals("FINISHED", res)
+ sleep(3000)
+ break
+ } else {
+ sleep(100)
+ if (max_try_num < 1){
+ assertEquals(1,2)
+ }
+ }
+ }
+
+ sql """ insert into ${tableName3} values (10002, 2, 3, 4, 5, 6.6, 1.7, 8.8,
+ 'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00') """
+
+ qt_smallint_to_int """ select * from ${tableName3} """
+
+ // int to bigint
+ sql """ alter table ${tableName3} modify column k2 bigint key NULL"""
+ sleep(10)
+ max_try_num = 60
+ while (max_try_num--) {
+ String res = getJobState(tableName3)
+ if (res == "FINISHED" || res == "CANCELLED") {
+ assertEquals("FINISHED", res)
+ sleep(3000)
+ break
+ } else {
+ sleep(100)
+ if (max_try_num < 1){
+ assertEquals(1,2)
+ }
+ }
+ }
+
+ sql """ insert into ${tableName3} values (10003, 2, 3, 4, 5, 6.6, 1.7, 8.8,
+ 'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00') """
+
+ qt_int_to_bigint """ select * from ${tableName3} """
+
+ // bigint to largeint
+
+ sql """ alter table ${tableName3} modify column k2 largeint key NULL"""
+ sleep(10)
+ max_try_num = 60
+ while (max_try_num--) {
+ String res = getJobState(tableName3)
+ if (res == "FINISHED" || res == "CANCELLED") {
+ assertEquals("FINISHED", res)
+ sleep(3000)
+ break
+ } else {
+ sleep(100)
+ if (max_try_num < 1){
+ assertEquals(1,2)
+ }
+ }
+ }
+
+ sql """ insert into ${tableName3} values (10004, 2, 3, 4, 5, 6.6, 1.7, 8.8,
+ 'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00') """
+
+ qt_bigint_to_largeint """ select * from ${tableName3} """
+
+ // largeint to float
+ sql """ alter table ${tableName3} add column k14 largeint replace not null
default "0" after k13"""
+
+ sleep(10)
+ max_try_num = 60
+ while (max_try_num--) {
+ String res = getJobState(tableName3)
+ if (res == "FINISHED" || res == "CANCELLED") {
+ assertEquals("FINISHED", res)
+ sleep(3000)
+ break
+ } else {
+ sleep(100)
+ if (max_try_num < 1){
+ assertEquals(1,2)
+ }
+ }
+ }
+
+ sql """ alter table ${tableName3} modify column k14 float replace not null
default "0" after k13"""
+ sleep(10)
+ max_try_num = 60
+ while (max_try_num--) {
+ String res = getJobState(tableName3)
+ if (res == "FINISHED" || res == "CANCELLED") {
+ assertEquals("FINISHED", res)
+ sleep(3000)
+ break
+ } else {
+ sleep(100)
+ if (max_try_num < 1){
+ assertEquals(1,2)
+ }
+ }
+ }
+
+ sql """ insert into ${tableName3} values (10005, 2, 3, 4, 5, 6.6, 1.7, 8.8,
+ 'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00', 1.11) """
+
+ qt_largeint_to_float """ select * from ${tableName3} """
+
+ // float to double
+ sql """ alter table ${tableName3} modify column k14 double replace not
null default "0" after k13"""
+ sleep(10)
+ max_try_num = 60
+ while (max_try_num--) {
+ String res = getJobState(tableName3)
+ if (res == "FINISHED" || res == "CANCELLED") {
+ assertEquals("FINISHED", res)
+ sleep(3000)
+ break
+ } else {
+ sleep(100)
+ if (max_try_num < 1){
+ assertEquals(1,2)
+ }
+ }
+ }
+
+ sql """ insert into ${tableName3} values (10006, 2, 3, 4, 5, 6.6, 1.7, 8.8,
+ 'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00',1.11) """
+
+ qt_float_to_double """ select * from ${tableName3} """
+
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]