Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
amorynan committed Nov 27, 2024
1 parent 3113e28 commit c01b79b
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 9 deletions.
19 changes: 10 additions & 9 deletions be/src/vec/functions/function_ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -923,13 +923,14 @@ class FunctionIPv6CIDRToRange : public IFunction {
auto& vec_res_upper_range = col_res_upper_range->get_data();

static constexpr UInt8 max_cidr_mask = IPV6_BINARY_LENGTH * 8;
std::vector<unsigned char> ipv6_address_data[IPV6_BINARY_LENGTH];
unsigned char ipv6_address_data[IPV6_BINARY_LENGTH];

if (is_addr_const) {
StringRef str_ref = from_column.get_data_at(0);
const char* value = str_ref.data;
size_t value_size = str_ref.size;
if (value_size > IPV6_BINARY_LENGTH || value == nullptr || value_size == 0) {
if (value_size > IPV6_BINARY_LENGTH || value == nullptr || value_size == 0 ||
!IPv6Value::is_valid_string(value, value_size)) {
throw Exception(ErrorCode::INVALID_ARGUMENT, "Illegal ipv6 address '{}'",
std::string(value, value_size));
}
Expand All @@ -945,7 +946,7 @@ class FunctionIPv6CIDRToRange : public IFunction {
// 16 bytes ipv6 string is stored in big-endian byte order
// so transfer to little-endian firstly
std::reverse(ipv6_address_data, ipv6_address_data + IPV6_BINARY_LENGTH);
apply_cidr_mask(reinterpret_cast<const char*>(ipv6_address_data->data()),
apply_cidr_mask(reinterpret_cast<const char*>(&ipv6_address_data),
reinterpret_cast<char*>(&vec_res_lower_range[i]),
reinterpret_cast<char*>(&vec_res_upper_range[i]),
cast_set<UInt8>(cidr));
Expand All @@ -969,15 +970,15 @@ class FunctionIPv6CIDRToRange : public IFunction {
StringRef str_ref = from_column.get_data_at(i);
const char* value = str_ref.data;
size_t value_size = str_ref.size;
if (value_size > IPV6_BINARY_LENGTH || value == nullptr || value_size == 0) {
if (value_size > IPV6_BINARY_LENGTH || value == nullptr || value_size == 0 ||
!IPv6Value::is_valid_string(value, value_size)) {
throw Exception(ErrorCode::INVALID_ARGUMENT, "Illegal ipv6 address '{}'",
std::string(value, value_size));
}
ipv6_address_data->clear();
memcpy(ipv6_address_data, value, value_size);
memset(ipv6_address_data + value_size, 0, IPV6_BINARY_LENGTH - value_size);
std::reverse(ipv6_address_data, ipv6_address_data + IPV6_BINARY_LENGTH);
apply_cidr_mask(reinterpret_cast<const char*>(ipv6_address_data->data()),
apply_cidr_mask(reinterpret_cast<const char*>(&ipv6_address_data),
reinterpret_cast<char*>(&vec_res_lower_range[i]),
reinterpret_cast<char*>(&vec_res_upper_range[i]),
cast_set<UInt8>(cidr));
Expand All @@ -1001,15 +1002,15 @@ class FunctionIPv6CIDRToRange : public IFunction {
StringRef str_ref = from_column.get_data_at(i);
const char* value = str_ref.data;
size_t value_size = str_ref.size;
if (value_size > IPV6_BINARY_LENGTH || value == nullptr || value_size == 0) {
if (value_size > IPV6_BINARY_LENGTH || value == nullptr || value_size == 0 ||
!IPv6Value::is_valid_string(value, value_size)) {
throw Exception(ErrorCode::INVALID_ARGUMENT, "Illegal ipv6 address '{}'",
std::string(value, value_size));
}
ipv6_address_data->clear();
memcpy(ipv6_address_data, value, value_size);
memset(ipv6_address_data + value_size, 0, IPV6_BINARY_LENGTH - value_size);
std::reverse(ipv6_address_data, ipv6_address_data + IPV6_BINARY_LENGTH);
apply_cidr_mask(reinterpret_cast<const char*>(ipv6_address_data->data()),
apply_cidr_mask(reinterpret_cast<const char*>(&ipv6_address_data),
reinterpret_cast<char*>(&vec_res_lower_range[i]),
reinterpret_cast<char*>(&vec_res_upper_range[i]),
cast_set<UInt8>(cidr));
Expand Down
204 changes: 204 additions & 0 deletions regression-test/data/nereids_function_p0/scalar_function/IP.out
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,108 @@
99 {"min":"224.0.0.0", "max":"224.0.255.255"}
100 {"min":"224.0.0.0", "max":"224.0.255.255"}

-- !sql_cidr_ipv6_nullable_ --
1 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
2 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
3 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
4 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
5 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
6 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
7 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
8 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
9 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
10 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
11 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
12 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
13 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
14 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
15 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
16 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
17 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
18 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
19 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
20 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
21 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
22 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
23 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
24 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
25 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
26 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
27 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
28 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
29 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
30 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
31 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
32 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
33 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
34 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
35 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
36 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
37 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
38 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
39 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
40 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
41 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
42 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
43 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
44 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
45 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
46 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
47 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
48 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
49 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
50 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
51 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
52 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
53 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
54 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
55 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
56 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
57 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
58 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
59 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
60 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
61 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
62 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
63 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
64 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
65 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
66 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
67 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
68 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
69 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
70 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
71 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
72 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
73 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
74 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
75 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
76 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
77 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
78 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
79 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
80 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
81 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
82 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
83 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
84 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
85 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
86 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
87 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
88 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
89 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
90 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
91 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
92 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
93 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
94 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
95 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
96 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
97 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
98 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
99 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
100 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}

-- !sql_num2string_ipv6 --
1 ::1
2 fc00::
Expand Down Expand Up @@ -6121,6 +6223,108 @@
99 {"min":"224.0.0.0", "max":"224.0.255.255"}
100 {"min":"224.0.0.0", "max":"224.0.255.255"}

-- !sql_not_null_cidr_ipv6_nullable_ --
1 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
2 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
3 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
4 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
5 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
6 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
7 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
8 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
9 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
10 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
11 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
12 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
13 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
14 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
15 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
16 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
17 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
18 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
19 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
20 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
21 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
22 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
23 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
24 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
25 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
26 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
27 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
28 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
29 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
30 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
31 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
32 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
33 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
34 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
35 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
36 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
37 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
38 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
39 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
40 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
41 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
42 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
43 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
44 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
45 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
46 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
47 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
48 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
49 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
50 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
51 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
52 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
53 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
54 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
55 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
56 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
57 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
58 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
59 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
60 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
61 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
62 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
63 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
64 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
65 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
66 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
67 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
68 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
69 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
70 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
71 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
72 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
73 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
74 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
75 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
76 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
77 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
78 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
79 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
80 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
81 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
82 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
83 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
84 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
85 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
86 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
87 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
88 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
89 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
90 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
91 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
92 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
93 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
94 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
95 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
96 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
97 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
98 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
99 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}
100 {"min":"::", "max":"::ffff:ffff:ffff:ffff:ffff:ffff"}

-- !sql_not_null_ipv6_string_to_num --
1 00000000000000000000000000000001
2 FC000000000000000000000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ suite("nereids_scalar_fn_IP") {
qt_sql_cidr_ipv4_all """ select id, ipv4_cidr_to_range(ip4, 16) from fn_test_ip_nullable order by id; """

// test nullable param
qt_sql_cidr_ipv6_nullable_ "select id, ipv6_cidr_to_range(to_ipv6('::'), 32) from fn_test_ip_nullable order by id;"
test {
sql "select id, ipv6_cidr_to_range(nullable(''), 32) from fn_test_ip_nullable order by id"
exception "Illegal ipv6 address"
Expand Down Expand Up @@ -158,6 +159,7 @@ suite("nereids_scalar_fn_IP") {
qt_sql_not_null_cidr_ipv4_all """ select id, ipv4_cidr_to_range(ip4, 16) from fn_test_ip_not_nullable order by id; """

// test nullable param
qt_sql_not_null_cidr_ipv6_nullable_ "select id, ipv6_cidr_to_range(to_ipv6('::'), 32) from fn_test_ip_nullable order by id;"
test {
sql "select id, ipv6_cidr_to_range(nullable(''), 32) from fn_test_ip_not_nullable order by id"
exception "Illegal ipv6 address"
Expand Down

0 comments on commit c01b79b

Please sign in to comment.