IPV6

SinceVersion dev

IPV6

description

IPv6 type, stored in UInt128 format in 16 bytes, used to represent IPv6 addresses. The range of values is [‘::’, ‘ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff’].

Inputs that exceed the value range or have invalid format will return NULL

example

Create table example:

  1. CREATE TABLE ipv6_test (
  2. `id` int,
  3. `ip_v6` ipv6
  4. ) ENGINE=OLAP
  5. DISTRIBUTED BY HASH(`id`) BUCKETS 4
  6. PROPERTIES (
  7. "replication_allocation" = "tag.location.default: 1"
  8. );

Insert data example:

  1. insert into ipv6_test values(1, '::');
  2. insert into ipv6_test values(2, '2001:16a0:2:200a::2');
  3. insert into ipv6_test values(3, 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff');
  4. insert into ipv6_test values(4, 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffffg'); // invalid data

Select data example:

  1. mysql> select * from ipv6_test order by id;
  2. +------+-----------------------------------------+
  3. | id | ip_v6 |
  4. +------+-----------------------------------------+
  5. | 1 | :: |
  6. | 2 | 2001:16a0:2:200a::2 |
  7. | 3 | ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff |
  8. | 4 | NULL |
  9. +------+-----------------------------------------+

keywords

IPV6