[bug](ipv6) the ipv6 type should be uint128_t (#34121)

the ipv6 type should be uint128_t, and max value is ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
if use int128_t type, it's will be min value.
This commit is contained in:
zhangstar333
2024-05-08 10:12:46 +08:00
committed by yiguolei
parent e2fc231b7b
commit 25ae7cd65f
3 changed files with 10 additions and 1 deletions

View File

@ -730,7 +730,7 @@ struct CppTypeTraits<FieldType::OLAP_FIELD_TYPE_IPV4> {
};
template <>
struct CppTypeTraits<FieldType::OLAP_FIELD_TYPE_IPV6> {
using CppType = int128_t;
using CppType = uint128_t;
using UnsignedCppType = uint128_t;
};
template <>

View File

@ -63,6 +63,12 @@ ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
-- !sql8 --
ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
-- !sql8_2 --
ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
-- !sql8_3 --
ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
-- !sql9 --
\N 0
0.0.0.0 1
@ -354,3 +360,4 @@ ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 4
120.239.82.212 2a0c:3240::1
121.25.82.29 2620:44:a000::1
121.25.160.80 2001:418:0:5000::c2d

View File

@ -123,6 +123,8 @@ suite("test_ip_basic") {
qt_sql6 "select ip_v6 from t0 order by ip_v6 limit 1 offset 1"
qt_sql7 "select ip_v4 from t0 order by ip_v4 desc limit 1 offset 1"
qt_sql8 "select ip_v6 from t0 order by ip_v6 desc limit 1 offset 1"
qt_sql8_2 "select ip_v6 from t0 order by ip_v6 desc limit 1 offset 1"
qt_sql8_3 "select ip_v6 from t0 order by ip_v6 desc limit 1 offset 1"
// group by and agg
qt_sql9 "select ip_v4, count(ip_v4) as cnt from t0 group by ip_v4 order by ip_v4"