Skip to content

Commit

Permalink
add more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
amorynan committed Dec 11, 2024
1 parent 9d1d66d commit 3bdfc39
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
30 changes: 30 additions & 0 deletions regression-test/data/datatype_p0/ip/test_ip_basic.out
Original file line number Diff line number Diff line change
Expand Up @@ -377,3 +377,33 @@ ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 4
1 5be8:dde9:7f0b:d5a7:bd01:b3be:9c69:573b 0.0.0.1
2 :: 127.0.0.1

-- !sql --
table_ip_default CREATE TABLE `table_ip_default` (\n `col0` bigint NOT NULL,\n `col4` ipv6 NULL DEFAULT "::",\n `col24` ipv4 NULL DEFAULT "127.0.0.1"\n) ENGINE=OLAP\nUNIQUE KEY(`col0`)\nDISTRIBUTED BY HASH(`col0`) BUCKETS 4\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"min_load_replica_num" = "-1",\n"is_being_synced" = "false",\n"storage_medium" = "hdd",\n"storage_format" = "V2",\n"inverted_index_storage_format" = "V2",\n"enable_unique_key_merge_on_write" = "true",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "86400",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false",\n"group_commit_interval_ms" = "10000",\n"group_commit_data_bytes" = "134217728",\n"enable_mow_light_delete" = "false"\n);

-- !sql --
col0 bigint No true \N
col4 ipv6 Yes false :: NONE
col24 ipv4 Yes false 127.0.0.1 NONE

-- !sql --
col0 bigint No true \N
col4 ipv6 Yes false :: NONE
col24 ipv4 Yes false 127.0.0.1 NONE

-- !sql --
2

-- !sql --
1 5be8:dde9:7f0b:d5a7:bd01:b3be:9c69:573b 0.0.0.1
2 :: 127.0.0.1

-- !sql --
0

-- !sql --
0

-- !sql --
1 5be8:dde9:7f0b:d5a7:bd01:b3be:9c69:573b 0.0.0.1 :: 127.0.0.1
2 :: 127.0.0.1 :: 127.0.0.1

18 changes: 17 additions & 1 deletion regression-test/suites/datatype_p0/ip/test_ip_basic.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,21 @@ suite("test_ip_basic") {
sql """ CREATE TABLE IF NOT EXISTS `table_ip_default` (`col0` bigint NOT NULL, `col4` ipv6 NULL DEFAULT "::", `col24` ipv4 NULL DEFAULT "127.0.0.1") ENGINE=OLAP UNIQUE KEY(`col0`) DISTRIBUTED BY HASH(`col0`) BUCKETS 4 PROPERTIES ("replication_allocation" = "tag.location.default: 1") """
sql """ insert into table_ip_default values (1, "5be8:dde9:7f0b:d5a7:bd01:b3be:9c69:573b", "0.0.0.1") """
sql """ insert into table_ip_default(col0) values (2); """
qt_sql """ select * from table_ip_default order by col0""";
qt_sql """ select * from table_ip_default order by col0"""
// add cases for default value to make sure in all cases, the default value is not lost.
// show create table
// desc table
// create table like
// insert into table
// alter new ip column with default value
qt_sql """ show create table table_ip_default """
qt_sql """ desc table_ip_default """
sql """ DROP TABLE IF EXISTS table_ip_default_like """
sql """ create table table_ip_default_like like table_ip_default """
qt_sql """ desc table_ip_default_like"""
qt_sql """ insert into table_ip_default_like select * from table_ip_default """
qt_sql """ select * from table_ip_default_like order by col0 """
qt_sql """ alter table table_ip_default_like add column col25 ipv6 NULL DEFAULT "::" """
qt_sql """ alter table table_ip_default_like add column col26 ipv4 NULL DEFAULT "127.0.0.1" """
qt_sql """ select * from table_ip_default_like order by col0 """
}

0 comments on commit 3bdfc39

Please sign in to comment.