Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
liugddx committed Feb 6, 2024
1 parent fbda6bf commit 331663d
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,58 @@
10006 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0.0 1.11
10007 2 3 8 10 13.2 3.4 9 a b c 2021-10-30 2021-10-30T00:00 1.11 1.21

-- !add_tinyint --
10001 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10002 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10003 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10004 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10005 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 1.1100000143051147
10006 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 1.11
10007 2 3 12 15 19.8 5.1 9 a b c 2021-10-30 2021-10-30T00:00 1 1.21 1.0

-- !tinyint_to_int --
10001 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10002 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10003 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10004 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10005 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 1.1100000143051147
10006 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 1.11
10007 2 3 12 15 19.8 5.1 9 a b c 2021-10-30 2021-10-30T00:00 1 1.21 1.0
10008 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 1 1.21 1.0

-- !int_to_bigint --
10001 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10002 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10003 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10004 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10005 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 1.1100000143051147
10006 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 1.11
10007 2 3 12 15 19.8 5.1 9 a b c 2021-10-30 2021-10-30T00:00 1 1.21 1.0
10008 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 1 1.21 1.0
10009 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 1 1.21 1.0

-- !bigint_to_largeint --
10001 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10002 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10003 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10004 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 0.0
10005 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 1.1100000143051147
10006 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0 0.0 1.11
10007 2 3 12 15 19.8 5.1 9 a b c 2021-10-30 2021-10-30T00:00 1 1.21 1.0
10008 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 1 1.21 1.0
10009 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 1 1.21 1.0
10010 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 1 1.21 1.0

-- !largeint_to_double --
10001 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0.0 0.0 0.0
10002 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0.0 0.0 0.0
10003 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0.0 0.0 0.0
10004 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0.0 0.0 0.0
10005 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0.0 0.0 1.1100000143051147
10006 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 0.0 0.0 1.11
10007 2 3 12 15 19.8 5.1 9 a b c 2021-10-30 2021-10-30T00:00 1.0 1.21 1.0
10008 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 1.0 1.21 1.0
10009 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 1.0 1.21 1.0
10010 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 1.0 1.21 1.0
10011 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00 1.11 1.21 1.0

Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,69 @@ suite("test_schema_change_agg_check_all_types", "p0") {
exception "Can not change FLOAT to DECIMAL32"
}


// add tinyint
sql """ alter table ${tableName3} add column tinyint1 tinyint replace not null default "0" after k13"""
waitForSchemaChangeDone {
sql """ SHOW ALTER TABLE COLUMN WHERE IndexName='${tableName3}' ORDER BY createtime DESC LIMIT 1 """
time 60
}
sql """ insert into ${tableName3} values (10007, 2, 3, 4, 5, 6.6, 1.7, 8.8,
'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00',1.11,1.21,1) """

qt_add_tinyint""" select * from ${tableName3} """

//tinyint to int
sql """ alter table ${tableName3} modify column tinyint1 int replace not null default "0" after k13"""

waitForSchemaChangeDone {
sql """ SHOW ALTER TABLE COLUMN WHERE IndexName='${tableName3}' ORDER BY createtime DESC LIMIT 1 """
time 60
}

sql """ insert into ${tableName3} values (10008, 2, 3, 4, 5, 6.6, 1.7, 8.8,
'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00',1.11,1.21,1) """


qt_tinyint_to_int""" select * from ${tableName3} """

//int to bigint
sql """ alter table ${tableName3} modify column tinyint1 bigint replace not null default "0" after k13"""

waitForSchemaChangeDone {
sql """ SHOW ALTER TABLE COLUMN WHERE IndexName='${tableName3}' ORDER BY createtime DESC LIMIT 1 """
time 60
}

sql """ insert into ${tableName3} values (10009, 2, 3, 4, 5, 6.6, 1.7, 8.8, 'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00',1.11,1.21,1) """

qt_int_to_bigint""" select * from ${tableName3} """

//bigint to largeint
sql """ alter table ${tableName3} modify column tinyint1 largeint replace not null default "0" after k13"""

waitForSchemaChangeDone {
sql """ SHOW ALTER TABLE COLUMN WHERE IndexName='${tableName3}' ORDER BY createtime DESC LIMIT 1 """
time 60
}

sql """ insert into ${tableName3} values (10010, 2, 3, 4, 5, 6.6, 1.7, 8.8, 'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00',1.11,1.21,1) """

qt_bigint_to_largeint""" select * from ${tableName3} """

//largeint to double
sql """ alter table ${tableName3} modify column tinyint1 double replace not null default "0" after k13"""

waitForSchemaChangeDone {
sql """ SHOW ALTER TABLE COLUMN WHERE IndexName='${tableName3}' ORDER BY createtime DESC LIMIT 1 """
time 60
}

sql """ insert into ${tableName3} values (10011, 2, 3, 4, 5, 6.6, 1.7, 8.8, 'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00',1.11,1.21,1) """

qt_largeint_to_double""" select * from ${tableName3} """



}

0 comments on commit 331663d

Please sign in to comment.