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 2024/02/29 20:26:11 UTC
(doris) 09/14: Test the unique model by modify a value type from BOOLEAN to other type (#31589)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit cb0ab6886bbc454eecb6c2d5da6c3fe6739c9ae2
Author: kkop <45...@users.noreply.github.com>
AuthorDate: Thu Feb 29 23:32:36 2024 +0800
Test the unique model by modify a value type from BOOLEAN to other type (#31589)
---
.../test_unique_model_schema_value_change.groovy | 151 ++++++++++++++++++++-
1 file changed, 147 insertions(+), 4 deletions(-)
diff --git a/regression-test/suites/schema_change_p0/test_unique_model_schema_value_change.groovy b/regression-test/suites/schema_change_p0/test_unique_model_schema_value_change.groovy
index 12f69a3b8b2..a8ef1265ab0 100644
--- a/regression-test/suites/schema_change_p0/test_unique_model_schema_value_change.groovy
+++ b/regression-test/suites/schema_change_p0/test_unique_model_schema_value_change.groovy
@@ -129,7 +129,7 @@ suite("test_unique_model_schema_value_change","p0") {
- //Test the unique model by adding a value column with FLOAT
+ //TODO Test the unique model by adding a value column with FLOAT
//java.sql.SQLException: errCode = 2, detailMessage = Default value will loose precision: 166.68f
/* sql initTable
sql initTableData
@@ -143,7 +143,7 @@ suite("test_unique_model_schema_value_change","p0") {
- //Test the unique model by adding a value column with DOUBLE
+ //TODO Test the unique model by adding a value column with DOUBLE
//java.sql.SQLException: errCode = 2, detailMessage = Default value will loose precision: 166.689
/* sql initTable
sql initTableData
@@ -218,7 +218,7 @@ suite("test_unique_model_schema_value_change","p0") {
time 60
}, insertSql, true,"${tbName}")
- //Test the unique model by adding a value column with HLL
+ //TODO Test the unique model by adding a value column with HLL
//java.sql.SQLException: errCode = 2, detailMessage = Can not assign aggregation method on column in Unique data model table: comment
/* sql initTable
sql initTableData
@@ -229,7 +229,7 @@ suite("test_unique_model_schema_value_change","p0") {
time 60
}, insertSql, true,"${tbName}")*/
- //Test the unique model by adding a value column with bitmap
+ //TODO Test the unique model by adding a value column with bitmap
//java.sql.SQLException: errCode = 2, detailMessage = Can not assign aggregation method on column in Unique data model table: device_id
/*
sql initTable
@@ -268,4 +268,147 @@ suite("test_unique_model_schema_value_change","p0") {
}, insertSql, true,"${tbName}")
+ /**
+ * Test the unique model by modify a value type
+ */
+
+
+ initTable = " CREATE TABLE IF NOT EXISTS ${tbName}\n" +
+ " (\n" +
+ " `user_id` LARGEINT NOT NULL COMMENT \"用户id\",\n" +
+ " `username` VARCHAR(50) NOT NULL COMMENT \"用户昵称\",\n" +
+ " `is_teacher` BOOLEAN COMMENT \"是否是老师\",\n" +
+ " `city` VARCHAR(20) COMMENT \"用户所在城市\",\n" +
+ " `age` SMALLINT COMMENT \"用户年龄\",\n" +
+ " `sex` TINYINT COMMENT \"用户性别\",\n" +
+ " `phone` LARGEINT COMMENT \"用户电话\",\n" +
+ " `address` VARCHAR(500) COMMENT \"用户地址\",\n" +
+ " `register_time` DATETIME COMMENT \"用户注册时间\"\n" +
+ " )\n" +
+ " UNIQUE KEY(`user_id`, `username`)\n" +
+ " DISTRIBUTED BY HASH(`user_id`) BUCKETS 1\n" +
+ " PROPERTIES (\n" +
+ " \"replication_allocation\" = \"tag.location.default: 1\",\n" +
+ " \"enable_unique_key_merge_on_write\" = \"true\"\n" +
+ " );"
+
+ initTableData = "insert into ${tbName} values(123456789, 'Alice', 0, 'Beijing', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00')," +
+ " (234567890, 'Bob', 0, 'Shanghai', 30, 1, 13998765432, 'No. 456 Street, Shanghai', '2022-02-02 12:00:00')," +
+ " (345678901, 'Carol', 1, 'Guangzhou', 28, 0, 13724681357, 'No. 789 Street, Guangzhou', '2022-03-03 14:00:00')," +
+ " (456789012, 'Dave', 0, 'Shenzhen', 35, 1, 13680864279, 'No. 987 Street, Shenzhen', '2022-04-04 16:00:00')," +
+ " (567890123, 'Eve', 0, 'Chengdu', 27, 0, 13572468091, 'No. 654 Street, Chengdu', '2022-05-05 18:00:00')," +
+ " (678901234, 'Frank', 1, 'Hangzhou', 32, 1, 13467985213, 'No. 321 Street, Hangzhou', '2022-06-06 20:00:00')," +
+ " (789012345, 'Grace', 0, 'Xian', 29, 0, 13333333333, 'No. 222 Street, Xian', '2022-07-07 22:00:00');"
+
+ //Test the unique model by modify a value type from BOOLEAN to TINYINT
+ //TODO java.sql.SQLException: errCode = 2, detailMessage = Can not change BOOLEAN to TINYINT
+/* sql initTable
+ sql initTableData
+ sql """ alter table ${tbName} MODIFY column is_teacher TINYINT DEFAULT "0" """
+ insertSql = "insert into ${tbName} values(123456689, 'Alice', 1, 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
+ waitForSchemaChangeDone({
+ sql getTableStatusSql
+ time 60
+ }, insertSql, true,"${tbName}")*/
+
+ //Test the unique model by modify a value type from BOOLEAN to SMALLINT
+ //TODO java.sql.SQLException: errCode = 2, detailMessage = Can not change BOOLEAN to SMALLINT
+/* sql initTable
+ sql initTableData
+ sql """ alter table ${tbName} MODIFY column is_teacher SMALLINT DEFAULT "0" """
+ insertSql = "insert into ${tbName} values(123456689, 'Alice', 1, 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
+ waitForSchemaChangeDone({
+ sql getTableStatusSql
+ time 60
+ }, insertSql, true,"${tbName}")*/
+
+ //Test the unique model by modify a value type from BOOLEAN to INT
+ //TODO java.sql.SQLException: errCode = 2, detailMessage = Can not change BOOLEAN to INT
+/* sql initTable
+ sql initTableData
+ sql """ alter table ${tbName} MODIFY column is_teacher INT DEFAULT "0" """
+ insertSql = "insert into ${tbName} values(123456689, 'Alice', 1, 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
+ waitForSchemaChangeDone({
+ sql getTableStatusSql
+ time 60
+ }, insertSql, true,"${tbName}")*/
+
+
+ //Test the unique model by modify a value type from BOOLEAN to BIGINT
+ //TODO java.sql.SQLException: errCode = 2, detailMessage = Can not change BOOLEAN to BIGINT
+/* sql initTable
+ sql initTableData
+ sql """ alter table ${tbName} MODIFY column is_teacher BIGINT DEFAULT "0" """
+ insertSql = "insert into ${tbName} values(123456689, 'Alice', 1, 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
+ waitForSchemaChangeDone({
+ sql getTableStatusSql
+ time 60
+ }, insertSql, true,"${tbName}")*/
+
+
+ //Test the unique model by modify a value type from BOOLEAN to FLOAT
+ //TODO java.sql.SQLException: errCode = 2, detailMessage = Can not change BOOLEAN to FLOAT
+/* sql initTable
+ sql initTableData
+ sql """ alter table ${tbName} MODIFY column is_teacher FLOAT DEFAULT "0" """
+ insertSql = "insert into ${tbName} values(123456689, 'Alice', 1.0, 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
+ waitForSchemaChangeDone({
+ sql getTableStatusSql
+ time 60
+ }, insertSql, true,"${tbName}")*/
+
+ //Test the unique model by modify a value type from BOOLEAN to DOUBLE
+ //TODO java.sql.SQLException: errCode = 2, detailMessage = Can not change BOOLEAN to DOUBLE
+/* sql initTable
+ sql initTableData
+ sql """ alter table ${tbName} MODIFY column is_teacher DOUBLE DEFAULT "0" """
+ insertSql = "insert into ${tbName} values(123456689, 'Alice', 1.0, 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
+ waitForSchemaChangeDone({
+ sql getTableStatusSql
+ time 60
+ }, insertSql, true,"${tbName}")*/
+
+ //Test the unique model by modify a value type from BOOLEAN to DECIMAL
+ //TODO java.sql.SQLException: errCode = 2, detailMessage = Can not change BOOLEAN to DECIMAL32
+/* sql initTable
+ sql initTableData
+ sql """ alter table ${tbName} MODIFY column is_teacher DECIMAL DEFAULT "0" """
+ insertSql = "insert into ${tbName} values(123456689, 'Alice', 1.0, 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
+ waitForSchemaChangeDone({
+ sql getTableStatusSql
+ time 60
+ }, insertSql, true,"${tbName}")*/
+
+ //Test the unique model by modify a value type from BOOLEAN to CHAR
+ //TODO java.sql.SQLException: errCode = 2, detailMessage = Can not change BOOLEAN to CHAR
+/* sql initTable
+ sql initTableData
+ sql """ alter table ${tbName} MODIFY column is_teacher CHAR DEFAULT "0" """
+ insertSql = "insert into ${tbName} values(123456689, 'Alice', '1', 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
+ waitForSchemaChangeDone({
+ sql getTableStatusSql
+ time 60
+ }, insertSql, true,"${tbName}")*/
+
+ //Test the unique model by modify a value type from BOOLEAN to STRING
+ //TODO java.sql.SQLException: errCode = 2, detailMessage = Can not change BOOLEAN to STRING
+/* sql initTable
+ sql initTableData
+ sql """ alter table ${tbName} MODIFY column is_teacher STRING DEFAULT "0" """
+ insertSql = "insert into ${tbName} values(123456689, 'Alice', '1', 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
+ waitForSchemaChangeDone({
+ sql getTableStatusSql
+ time 60
+ }, insertSql, true,"${tbName}")*/
+
+ //Test the unique model by modify a value type from BOOLEAN to VARCHAR
+ //TODO java.sql.SQLException: errCode = 2, detailMessage = String Type should not be used in key column[is_teacher].
+/* sql initTable
+ sql initTableData
+ sql """ alter table ${tbName} MODIFY column is_teacher VARCHAR(32) DEFAULT "0" """
+ insertSql = "insert into ${tbName} values(123456689, 'Alice', '1', 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
+ waitForSchemaChangeDone({
+ sql getTableStatusSql
+ time 60
+ }, insertSql, true,"${tbName}")*/
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org