Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,14 @@ public static ImmutableSetMultimap<PrimitiveType, PrimitiveType> getImplicitCast
builder.put(VARIANT, STRING);
builder.put(VARIANT, JSONB);

// ipv4
builder.put(IPV4, VARCHAR);
builder.put(IPV4, STRING);

// ipv6
builder.put(IPV6, VARCHAR);
builder.put(IPV6, STRING);

// HLL
builder.put(HLL, HLL);

Expand Down
16 changes: 16 additions & 0 deletions regression-test/suites/nereids_syntax_p0/cast.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,20 @@ suite("cast") {
sql """select cast(k11 as time) ct from test order by ct;"""
exception "cannot cast"
}

// ip

sql """drop table if exists ip_test"""
sql """
create table if not exists ip_test (a ipv6, b ipv4) properties ("replication_num" = "1");
"""
sql """
insert into ip_test values('d916:b163:3ce8:e0f3:b953:fa0c:ab21:1ff9', "172.20.48.119");
"""

sql """sync"""

sql """select ipv6_string_to_num(a), ipv4_string_to_num(b) from ip_test"""
sql """drop table if exists ip_test"""
}