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 @@ -593,6 +593,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
15 changes: 15 additions & 0 deletions regression-test/suites/nereids_syntax_p0/cast.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,19 @@ suite("cast") {
sql "select cast(1 as signed int)"
sql "select cast(1 as unsigned)"
sql "select cast(1 as unsigned integer)"

// 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"""
}