From 3bdfc39554235b13018f60f201777bee0c4ceeb3 Mon Sep 17 00:00:00 2001 From: amorynan Date: Wed, 11 Dec 2024 19:05:01 +0800 Subject: [PATCH] add more cases --- .../data/datatype_p0/ip/test_ip_basic.out | 30 +++++++++++++++++++ .../datatype_p0/ip/test_ip_basic.groovy | 18 ++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/regression-test/data/datatype_p0/ip/test_ip_basic.out b/regression-test/data/datatype_p0/ip/test_ip_basic.out index 9f70d29305f41e..785bfc36a74129 100644 --- a/regression-test/data/datatype_p0/ip/test_ip_basic.out +++ b/regression-test/data/datatype_p0/ip/test_ip_basic.out @@ -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 + diff --git a/regression-test/suites/datatype_p0/ip/test_ip_basic.groovy b/regression-test/suites/datatype_p0/ip/test_ip_basic.groovy index 72d10467560d4a..d6ab3724d697e4 100644 --- a/regression-test/suites/datatype_p0/ip/test_ip_basic.groovy +++ b/regression-test/suites/datatype_p0/ip/test_ip_basic.groovy @@ -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 """ }