メインコンテンツまでスキップ
バージョン: 2.1

IS_IPV4_STRING

デスクリプション

IPv4タイプのアドレスが有効なIPv4アドレスであるかどうかを判定します。

Syntax

IS_IPV4_STRING(<ipv4_str>)

パラメータ

Parameterデスクリプション
<ipv4_str>String型のIPv4アドレス

Return Value

正しくフォーマットされた有効なIPv4アドレスの場合、trueを返します。そうでない場合、falseを返します。

  • 入力がNULLの場合、関数はNULLを返します。

Example

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

insert into test_is_ipv4_string values(0, NULL), (1, '0.0.0.'), (2, ''), (3, '.'), (4, '255.255.255.255');

select id, ip_v4, is_ipv4_string(ip_v4) from test_is_ipv4_string order by id;
+------+-----------------+-----------------------+
| id | ip_v4 | is_ipv4_string(ip_v4) |
+------+-----------------+-----------------------+
| 0 | NULL | NULL |
| 1 | 0.0.0. | 0 |
| 2 | | 0 |
| 3 | . | 0 |
| 4 | 255.255.255.255 | 1 |
+------+-----------------+-----------------------+