IPV4

SinceVersion dev

IPV4

description

IPv4 type, stored in the form of UInt32 in 4 bytes, used to represent IPv4 addresses. The range of values is [‘0.0.0.0’, ‘255.255.255.255’].

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

example

Create table example:

1. CREATE TABLE ipv4_test (
2. `id` int,
3. `ip_v4` ipv4
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 ipv4_test values(1, '0.0.0.0');
2. insert into ipv4_test values(2, '127.0.0.1');
3. insert into ipv4_test values(3, '59.50.185.152');
4. insert into ipv4_test values(4, '255.255.255.255');
5. insert into ipv4_test values(5, '255.255.255.256'); // invalid data

Select data example:

1. mysql> select * from ipv4_test order by id;
2. +------+-----------------+
3. | id   | ip_v4           |
4. +------+-----------------+
5. |    1 | 0.0.0.0         |
6. |    2 | 127.0.0.1       |
7. |    3 | 59.50.185.152   |
8. |    4 | 255.255.255.255 |
9. |    5 | NULL            |
10. +------+-----------------+

keywords

IPV4