diff options
| author | lambda-delta <[email protected]> | 2025-08-04 19:40:46 +0300 |
|---|---|---|
| committer | lambda-delta <[email protected]> | 2025-08-04 20:05:53 +0300 |
| commit | b5c31e9554edee086eed97d94e7908d6d6ef3ec2 (patch) | |
| tree | 06f2ac35cc4d8aa62f3c64f023e56a0e7256352c /yql/essentials/docs/en | |
| parent | c0bc4e708e27a153b958eed0f42d2a67f245b288 (diff) | |
YQL-19784: Implement Ipv4FromUint32 and Ipv4ToUint32 functions in IP UDF
Implement Ipv4FromUint32 and Ipv4ToUint32 functions in IP UDF
commit_hash:ac21513d59acaf686ad0ab1482753863eb2d9a12
Diffstat (limited to 'yql/essentials/docs/en')
| -rw-r--r-- | yql/essentials/docs/en/changelog/2025.03.md | 4 | ||||
| -rw-r--r-- | yql/essentials/docs/en/udf/list/ip.md | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/yql/essentials/docs/en/changelog/2025.03.md b/yql/essentials/docs/en/changelog/2025.03.md index 361474ae616..19b7d486be8 100644 --- a/yql/essentials/docs/en/changelog/2025.03.md +++ b/yql/essentials/docs/en/changelog/2025.03.md @@ -15,6 +15,10 @@ * Added `Math::SwapBytes` function +## Changes in IP module {#ip-module} + +* Added `Ip::Ipv4FromUint32` and `Ip::Ipv4ToUint32` functions. + ## Changes in SELECT syntax * Added the ability to explicitly specify `DISTINCT` for `UNION`; diff --git a/yql/essentials/docs/en/udf/list/ip.md b/yql/essentials/docs/en/udf/list/ip.md index c635d5009e1..e214aecaa5f 100644 --- a/yql/essentials/docs/en/udf/list/ip.md +++ b/yql/essentials/docs/en/udf/list/ip.md @@ -5,14 +5,16 @@ The `Ip` module supports both the IPv4 and IPv6 addresses. By default, they are ## List of functions * `Ip::FromString(String{Flags:AutoMap}) -> String?` - From a human-readable representation to a binary representation. +* `Ip::Ipv4FromUint32(Uint32{Flags:AutoMap}) -> String` - From a Uint32 to a binary representation. Integer `A << 24 | B << 16 | C << 8 | D` corresponds to address `A.B.C.D`. * `Ip::SubnetFromString(String{Flags:AutoMap}) -> String?` - From a human-readable representation of subnet to a binary representation. * `Ip::ToString(String{Flags:AutoMap}) -> String?` - From a binary representation to a human-readable representation. +* `Ip::Ipv4ToUint32(String{Flags:AutoMap}) -> Uint32?` - From a binary representation of IPv4 to a Uint32. Address `A.B.C.D` corresponds to integer `A << 24 | B << 16 | C << 8 | D`. IPv6 is not supported. * `Ip::SubnetToString(String{Flags:AutoMap}) -> String?` - From a binary representation of subnet to a human-readable representation. * `Ip::IsIPv4(String?) -> Bool` * `Ip::IsIPv6(String?) -> Bool` * `Ip::IsEmbeddedIPv4(String?) -> Bool` -* `Ip::ConvertToIPv6(String{Flags:AutoMap}) -> String`: IPv6 remains unchanged, and IPv4 becomes embedded in IPv6 -* `Ip::GetSubnet(String{Flags:AutoMap}, [Uint8?]) -> String`: The second argument is the subnet size, by default it's 24 for IPv4 and 64 for IPv6 +* `Ip::ConvertToIPv6(String{Flags:AutoMap}) -> String`: IPv6 remains unchanged, and IPv4 becomes embedded in IPv6. +* `Ip::GetSubnet(String{Flags:AutoMap}, [Uint8?]) -> String`: The second argument is the subnet size, by default it's 24 for IPv4 and 64 for IPv6. * `Ip::GetSubnetByMask(String{Flags:AutoMap}, String{Flags:AutoMap}) -> String`: The first argument is the base address, the second argument is the bit mask of a desired subnet. * `Ip::SubnetMatch(String{Flags:AutoMap}, String{Flags:AutoMap}) -> Bool`: The first argument is a subnet, the second argument is a subnet or an address. @@ -24,6 +26,14 @@ SELECT Ip::IsEmbeddedIPv4( Ip::FromString("::ffff:77.75.155.3") ); -- true +SELECT Ip::ToString( + Ip::Ipv4FromUint32(1) +); -- "0.0.0.1" + +SELECT Ip::Ipv4ToUint32( + Ip::FromString("0.0.0.1") +); -- 1 + SELECT Ip::ToString( Ip::GetSubnet( |
