Skip to content

Commit

Permalink
add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
eldenmoon committed Sep 18, 2024
1 parent bc9c36f commit 12832fc
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 14 deletions.
23 changes: 23 additions & 0 deletions regression-test/data/variant_p0/predefine/load.out
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,26 @@ v1.predefine_col4 text Yes false \N NONE
3 {"array_datetimev2":["2021-01-01 00:00:00","2022-01-01 00:00:00","2023-01-01 00:00:00"],"array_int":[1,2,3],"array_string":["a","b","c"],"boolean_":1,"date_":"2022-01-01","decimal_":"219911111111.011121933","float_":1.1111111640930176,"ipv4_":"127.0.0.1","varchar_":"world hello"}
4 {"array_datetimev2":["2021-01-01 00:00:00","2022-01-01 00:00:00","2023-01-01 00:00:00"],"array_int":[1,2,3],"array_string":["a","b","c"],"ext_1":1.111111,"ext_2":"this is an extra field","ext_3":[1,2,3],"float_":1.1111111640930176,"ipv4_":"127.0.0.1","varchar_":"world hello"}

-- !sql --
101 {"a":1} {"dcm":"1111111"} \N
102 {"a":1} {"dcm":"1111111"} {"dcm":1111111}
103 {"a":1} {"dcm":"1111111"} {"dt":"2021-01-01 11:11:11"}

-- !sql --
id bigint No true \N
v1 variant<PREDEFINE_COL1:text,PREDEFINE_COL2:int,PREDEFINE_COL3:decimalv3(38,9),PREDEFINE_COL4:datetimev2(0)> Yes false \N NONE
v2 variant<dcm:decimalv3(9,0),dt:datetimev2(0)> Yes false \N NONE
v3 variant<dcm:decimalv3(9,0),dt:datetimev2(0),ip:ipv6> Yes false \N NONE
v1.PREDEFINE_COL1 text Yes false \N NONE
v1.PREDEFINE_COL2 int Yes false \N NONE
v1.PREDEFINE_COL3 decimal(38,0) Yes false \N NONE
v1.PREDEFINE_COL4 datetime Yes false \N NONE
v1.a tinyint Yes false \N NONE
v1.predefine_col1 smallint Yes false \N NONE
v1.predefine_col2 double Yes false \N NONE
v1.predefine_col3 text Yes false \N NONE
v1.predefine_col4 text Yes false \N NONE
v2.dcm decimal(9,0) Yes false \N NONE
v3.dcm int Yes false \N NONE
v3.dt datetime Yes false \N NONE

26 changes: 12 additions & 14 deletions regression-test/suites/variant_p0/predefine/load.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -203,19 +203,17 @@ suite("regression_test_variant_predefine_schema", "p0"){

// // schema change
// // 1. add column
// sql "alter table test_predefine1 add column v2 variant default null"
// // sql "alter table test_predefine1 add column v3 variant<dcm:decimal,dt:datetime> default null"
// // 2. drop column
// sql "alter table test_predefine1 drop column v2"
// // 3. alter column type
// // sql "alter table test_predefine1 modify column v3 variant<dcm:decimal,dt:datetime,ip:ipv6>"
// qt_sql "desc test_predefine1"
// // 4. add inverted index
// // 4.1 build inverted index
// // 5. drop inverted index
sql "alter table test_predefine1 add column v2 variant<dcm:decimal,dt:datetime> default null"
sql """insert into test_predefine1 values(101, '{"a" :1}', '{"dcm": 1111111}')"""
sql "alter table test_predefine1 add column v3 variant default null"
sql """insert into test_predefine1 values(102, '{"a" :1}', '{"dcm": 1111111}', '{"dcm": 1111111}');"""
// 2. alter column type
sql "alter table test_predefine1 modify column v3 variant<dcm:decimal,dt:datetime,ip:ipv6>"
sql """insert into test_predefine1 values(103, '{"a" :1}', '{"dcm": 1111111}', '{"dt": "2021-01-01 11:11:11"}');"""
qt_sql """select * from test_predefine1 where id >= 100 order by id"""
// 3. drop column
qt_sql "desc test_predefine1"
sql "alter table test_predefine1 drop column v3"

// // insert into variant<> select from variant
// // insert into variant select from variant<>

// // compaction
sql """insert into test_predefine1 select id, v1, v1 from test_predefine2"""
}

0 comments on commit 12832fc

Please sign in to comment.