Skip to main content
Skip to main content

IPV4

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:

CREATE TABLE ipv4_test (
`id` int,
`ip_v4` ipv4
) ENGINE=OLAP
DISTRIBUTED BY HASH(`id`) BUCKETS 4
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);

Insert data example:

insert into ipv4_test values(1, '0.0.0.0');
insert into ipv4_test values(2, '127.0.0.1');
insert into ipv4_test values(3, '59.50.185.152');
insert into ipv4_test values(4, '255.255.255.255');
insert into ipv4_test values(5, '255.255.255.256'); // invalid data

Select data example:

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

keywords

IPV4