Skip to content

Commit

Permalink
modify case
Browse files Browse the repository at this point in the history
  • Loading branch information
starocean999 committed Dec 4, 2024
1 parent 4769394 commit 038e648
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ suite("test_agg_schema_value_modify","p0") {
expectException({
sql initTable
sql initTableData
sql """ alter table ${tbName1} MODIFY column fan_number BOOLEAN """
sql """ alter table ${tbName1} MODIFY column fan_number BOOLEAN REPLACE_IF_NOT_NULL """
insertSql = "insert into ${tbName1} values(993456689, 'Alice', false, 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
waitForSchemaChangeDone({
sql getTableStatusSql
Expand All @@ -1465,7 +1465,7 @@ suite("test_agg_schema_value_modify","p0") {
expectException({
sql initTable
sql initTableData
sql """ alter table ${tbName1} MODIFY column fan_number TINYINT """
sql """ alter table ${tbName1} MODIFY column fan_number TINYINT REPLACE_IF_NOT_NULL """
insertSql = "insert into ${tbName1} values(993456689, 'Alice', 2, 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
waitForSchemaChangeDone({
sql getTableStatusSql
Expand All @@ -1479,7 +1479,7 @@ suite("test_agg_schema_value_modify","p0") {
expectException({
sql initTable
sql initTableData
sql """ alter table ${tbName1} MODIFY column fan_number SMALLINT """
sql """ alter table ${tbName1} MODIFY column fan_number SMALLINT REPLACE_IF_NOT_NULL """
insertSql = "insert into ${tbName1} values(993456689, 'Alice', 3, 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
waitForSchemaChangeDone({
sql getTableStatusSql
Expand All @@ -1493,7 +1493,7 @@ suite("test_agg_schema_value_modify","p0") {
expectException({
sql initTable
sql initTableData
sql """ alter table ${tbName1} MODIFY column fan_number INT """
sql """ alter table ${tbName1} MODIFY column fan_number INT REPLACE_IF_NOT_NULL """
insertSql = "insert into ${tbName1} values(993456689, 'Alice', 4, 'Yaan', 25, 0, 13812345678, 'No. 123 Street, Beijing', '2022-01-01 10:00:00'); "
waitForSchemaChangeDone({
sql getTableStatusSql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ suite("test_alter_table_drop_column") {
qt_order """ select * from ${uniqueTableName} order by citycode"""

test {
sql """ alter table ${uniqueTableName} drop COLUMN siteid;"""
sql """ alter table ${uniqueTableName} drop COLUMN citycode;"""
// check exception message contains
exception "Can not drop key column in Unique data model table"
exception "Can not drop key column citycode in unique data model table"
}

sql """ alter table ${uniqueTableName} drop COLUMN pv from ${uniqueTableRollupName};"""
Expand Down Expand Up @@ -120,7 +120,7 @@ suite("test_alter_table_drop_column") {
test {
sql """ alter table ${aggTableName} drop COLUMN citycode from ${aggTableRollupName};"""
// check exception message contains
exception "Can not drop key column when rollup has value column with REPLACE aggregation method"
exception "Can not drop key column citycode when rollup has value column with REPLACE aggregation method"
}

sql """ alter table ${aggTableName} drop COLUMN pv from ${aggTableRollupName};"""
Expand All @@ -136,7 +136,7 @@ suite("test_alter_table_drop_column") {
test {
sql """ alter table ${aggTableName} drop COLUMN pv from ${aggTableRollupName};"""
// check exception message contains
exception "Column does not exists"
exception "Column does not exists: pv"
}

// duplicate model table
Expand All @@ -161,7 +161,7 @@ suite("test_alter_table_drop_column") {
test {
sql """alter table ${dupTableName} drop COLUMN siteid;"""
// check exception message contains
exception "Distribution column[siteid] cannot be dropped"
exception "Can not drop partition or distribution column : siteid"
}

sql "DROP TABLE IF EXISTS ${dupTableName} FORCE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ suite("test_alter_table_modify_column") {
qt_order """select * from ${uniqueTableName} order by siteid"""

test {
sql """alter table ${uniqueTableName} modify COLUMN siteid INT SUM DEFAULT '0';"""
sql """alter table ${uniqueTableName} modify COLUMN citycode INT SUM DEFAULT '0';"""
// check exception message contains
exception "Can not assign aggregation method on column in Unique data model table"
exception "Key column citycode can not set aggregation type"
}

sql "DROP TABLE IF EXISTS ${uniqueTableName} FORCE"
Expand Down Expand Up @@ -97,15 +97,15 @@ suite("test_alter_table_modify_column") {
qt_order """select * from ${aggTableName} order by siteid"""

test {
sql """alter table ${aggTableName} modify COLUMN siteid INT key SUM DEFAULT '0';"""
sql """alter table ${aggTableName} modify COLUMN citycode INT key SUM DEFAULT '0';"""
// check exception message contains
exception "Key column siteid can not set aggregation type"
exception "Key column citycode can not set aggregation type"
}

test {
sql """alter table ${aggTableName} modify COLUMN pv BIGINT DEFAULT '0';"""
// check exception message contains
exception "Can not change aggregation typ"
exception "should set aggregation type to non-key column in aggregate key table"
}

sql "DROP TABLE IF EXISTS ${aggTableName} FORCE"
Expand Down Expand Up @@ -142,45 +142,45 @@ suite("test_alter_table_modify_column") {
qt_order """select * from ${dupTableName} order by siteid"""

test {
sql """alter table ${dupTableName} modify COLUMN siteid INT SUM DEFAULT '0';"""
sql """alter table ${dupTableName} modify COLUMN pv INT SUM DEFAULT '0';"""
// check exception message contains
exception "Can not assign aggregation method on column in Duplicate data model table"
exception "Can not modify column[pv]'s aggregation type"
}

test {
sql """alter table ${dupTableName} modify COLUMN siteid BIGINT from not_exist_rollup;"""
// check exception message contains
exception "Index[not_exist_rollup] does not exist in table"
exception "Cannot modify column in rollup not_exist_rollup"
}

test {
sql """alter table ${dupTableName} modify COLUMN not_exist_column BIGINT;"""
// check exception message contains
exception "Column[not_exist_column] does not exists"
exception "Column[not_exist_column] does not exist"
}

test {
sql """alter table ${dupTableName} modify COLUMN not_exist_column BIGINT from ${dupTableRollupName};"""
// check exception message contains
exception "Do not need to specify index name when just modifying column type"
exception "Cannot modify column in rollup test_alter_table_modify_column_dup_rollup"
}

test {
sql """alter table ${dupTableName} modify COLUMN siteid BIGINT after not_exist_column;"""
sql """alter table ${dupTableName} modify COLUMN citycode BIGINT after not_exist_column;"""
// check exception message contains
exception "Column[not_exist_column] does not exists"
exception "Column[not_exist_column] does not exist"
}

test {
sql """alter table ${dupTableName} modify COLUMN citycode BIGINT DEFAULT '10' first;"""
// check exception message contains
exception "Invalid column order. value should be after key"
}
// test {
// sql """alter table ${dupTableName} modify COLUMN citycode BIGINT DEFAULT '10' first;"""
// // check exception message contains
// exception "Invalid column order. value should be after key"
// }

test {
sql """alter table ${dupTableName} modify COLUMN siteid BIGINT key DEFAULT '10' first;"""
// check exception message contains
exception "Can not modify distribution column"
exception "Can not modify partition or distribution column : siteid"
}

sql """alter table ${dupTableName} modify COLUMN username VARCHAR(32) key DEFAULT 'test' first;"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ suite("test_schema_change_agg", "p0") {
// check add column without agg type
test {
sql """ alter table ${tableName3} add column v16 int NOT NULL default "0" after k13 """
exception "Invalid column order. value should be after key. index[${tableName3}]"
exception "can't add key column v16 after value column k13"
}

// del key
test {
sql """ alter table ${tableName3} drop column k1 """
exception "Can not drop key column when table has value column with REPLACE aggregation method"
sql """ alter table ${tableName3} drop column k2 """
exception "Can not drop key column k2 in aggregation key table having REPLACE or REPLACE_IF_NOT_NULL column"
}


Expand Down Expand Up @@ -184,28 +184,28 @@ suite("test_schema_change_agg", "p0") {

test {
sql "alter table ${tableName3} drop column siteid"
exception "Partition column[siteid] cannot be dropped. index[${tableName3}]"
exception "Can not drop partition or distribution column : siteid"
}

//modify col

// without agg type
test {
sql "alter table ${tableName3} modify column pv varchar"
exception "Can not change aggregation type"
exception "should set aggregation type to non-key column in aggregate key table"
}

//partition col
test {
sql "alter table ${tableName3} modify column siteid varchar DEFAULT '10'"
exception "Can not modify partition column[siteid]."
exception "Can not modify partition or distribution column : siteid"
}

//distribution key

test {
sql "alter table ${tableName3} modify column citycode smallint comment 'citycode'"
exception "Can not modify distribution column[citycode]. index[${tableName3}]"
exception "Can not modify partition or distribution column : citycode"
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ suite("test_schema_change_auto_inc") {
// remove auto-increment attribute from a column
test {
sql "alter table ${table1} modify column id BIGINT NOT NULL"
exception "Can't modify the column[id]'s auto-increment attribute."
exception "Can not modify column[id]'s auto-increment attribute"
}

// add auto-increment attribute to a column
test {
sql "alter table ${table1} modify column id2 BIGINT NOT NULL AUTO_INCREMENT"
exception "Can't modify the column[id2]'s auto-increment attribute."
sql """alter table ${table1} modify column id2 BIGINT NOT NULL AUTO_INCREMENT DEFAULT "0" """
exception "Can not modify column[id2]'s auto-increment attribute"
}

sql """ insert into ${table1}(name, value, id2) values("A", 999, 1), ("B", 888, 2), ("C", 777, 3);"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ suite("test_schema_reordering_dup", "p0") {
" (3, 'Mike Johnson', 77.8, 'Chicago', 35, 1, 1112223334, true, 30, 3000000000, '2024-06-13', '2024-06-13', '2024-06-13 11:15:00', '2024-06-13 11:15:00', 'Test String 3', {'a': 300, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99)," +
" (4, 'Emily Brown', 92.0, 'San Francisco', 28, 2, 5556667778, true, 40, 4000000000, '2024-06-14', '2024-06-14', '2024-06-14 13:30:00', '2024-06-14 13:30:00', 'Test String 4', {'a': 400, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99)," +
" (5, 'David Wilson', 88.9, 'Seattle', 32, 1, 9998887776, false, 50, 5000000000, '2024-06-15', '2024-06-15', '2024-06-15 15:45:00', '2024-06-15 15:45:00', 'Test String 5', {'a': 500, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99);"
errorMessage = "errCode = 2, detailMessage = Can not change aggregation type"
errorMessage = "errCode = 2, detailMessage = Can not modify key column score after value column"
expectException({
sql initTable
sql initTableData
Expand Down Expand Up @@ -492,7 +492,7 @@ suite("test_schema_reordering_dup", "p0") {
" (3, 'Mike Johnson', 77.8, 'Chicago', 35, 1, 1112223334, true, 30, 3000000000, '2024-06-13', '2024-06-13', '2024-06-13 11:15:00', '2024-06-13 11:15:00', 'Test String 3', {'a': 300, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99)," +
" (4, 'Emily Brown', 92.0, 'San Francisco', 28, 2, 5556667778, true, 40, 4000000000, '2024-06-14', '2024-06-14', '2024-06-14 13:30:00', '2024-06-14 13:30:00', 'Test String 4', {'a': 400, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99)," +
" (5, 'David Wilson', 88.9, 'Seattle', 32, 1, 9998887776, false, 50, 5000000000, '2024-06-15', '2024-06-15', '2024-06-15 15:45:00', '2024-06-15 15:45:00', 'Test String 5', {'a': 500, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99);"
errorMessage = "errCode = 2, detailMessage = Table regression_test_schema_change_p0.test_schema_reordering_dup check failed"
errorMessage = "errCode = 2, detailMessage = Can not drop partition or distribution column : username"
expectException({
sql initTable
sql initTableData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ suite("test_schema_reordering_unique", "p0") {
" (3, 'Mike Johnson', 77.8, 'Chicago', 35, 1, 1112223334, true, 30, 3000000000, '2024-06-13', '2024-06-13', '2024-06-13 11:15:00', '2024-06-13 11:15:00', 'Test String 3', {'a': 300, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99)," +
" (4, 'Emily Brown', 92.0, 'San Francisco', 28, 2, 5556667778, true, 40, 4000000000, '2024-06-14', '2024-06-14', '2024-06-14 13:30:00', '2024-06-14 13:30:00', 'Test String 4', {'a': 400, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99)," +
" (5, 'David Wilson', 88.9, 'Seattle', 32, 1, 9998887776, false, 50, 5000000000, '2024-06-15', '2024-06-15', '2024-06-15 15:45:00', '2024-06-15 15:45:00', 'Test String 5', {'a': 500, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99);"
errorMessage = "errCode = 2, detailMessage = Can not change aggregation type"
errorMessage = "errCode = 2, detailMessage = Can not modify key column score after value column"
expectException({
sql initTable
sql initTableData
Expand Down Expand Up @@ -454,7 +454,7 @@ suite("test_schema_reordering_unique", "p0") {
" (3, 'Mike Johnson', 77.8, 'Chicago', 35, 1, 1112223334, true, 30, 3000000000, '2024-06-13', '2024-06-13', '2024-06-13 11:15:00', '2024-06-13 11:15:00', 'Test String 3', {'a': 300, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99)," +
" (4, 'Emily Brown', 92.0, 'San Francisco', 28, 2, 5556667778, true, 40, 4000000000, '2024-06-14', '2024-06-14', '2024-06-14 13:30:00', '2024-06-14 13:30:00', 'Test String 4', {'a': 400, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99)," +
" (5, 'David Wilson', 88.9, 'Seattle', 32, 1, 9998887776, false, 50, 5000000000, '2024-06-15', '2024-06-15', '2024-06-15 15:45:00', '2024-06-15 15:45:00', 'Test String 5', {'a': 500, 'b': 200}, '[\"abc\", \"def\"]',95.5, 9.99);"
errorMessage = "errCode = 2, detailMessage = Can not drop key column in Unique data model table"
errorMessage = "errCode = 2, detailMessage = Can not drop key column age in unique data model table"
expectException({
sql initTable
sql initTableData
Expand Down
Loading

0 comments on commit 038e648

Please sign in to comment.