Class ParseIp
addr/prefix form) into a VARIANT OBJECT, matching Snowflake. type is 'INET'
or 'CIDR' (case-insensitive) and is echoed lowercased as ip_type.
For an IPv4 address the keys are, in order: family (4), host (the address without
the prefix), ip_fields (a 4-element array — the 32-bit address then three zeros),
ip_type, ipv4 (the address as a 32-bit integer), ipv4_range_end,
ipv4_range_start (the CIDR range as 32-bit integers), netmask_prefix_length (defaulting to
32 when no prefix is given), and snowflake$type ("ip_address"). Example:
PARSE_IP('192.168.242.188/24','INET') yields ipv4 3232297660 with range
3232297472..3232297727.
IPv6 support is minimal: an address containing ':' yields family 6 with
host, ip_type, netmask_prefix_length (default 128), snowflake$type, and
best-effort hex_ipv6 / hex_ipv6_range_start / hex_ipv6_range_end (a 32-char
lowercase hex rendering of the 128-bit value / range — the exact Snowflake hex format is
undocumented).
A malformed address (or bad type) raises; when permissive is 1 it instead returns
an object with only an error key. NULL address yields NULL.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionComputes the function's result over its already-evaluated argument values.intThe most arguments a call to this function may pass;Integer.MAX_VALUEmarks a variadic function (seeBuiltInFunction.isVariadic()).intThe fewest arguments a call to this function may pass; fewer is an argument-count error.Methods inherited from class dev.frostlake.functions.TextArgumentFunction
semiStructuredRejection, vectorRejectionMethods inherited from class dev.frostlake.functions.BuiltInFunction
approximateRejection, binaryRejection, booleanRejection, evaluate, fileRejection, geoRejection, getName, getReturnType, isVariadic, refusesMissingArgumentsByType, structuredRejection, temporalRejection, temporalRejection, temporalRejection, textRejection, uuidRejection
-
Constructor Details
-
ParseIp
public ParseIp()
-
-
Method Details
-
evaluate
Description copied from class:BuiltInFunctionComputes the function's result over its already-evaluated argument values. A SQL NULL argument arrives as Javanull, and returningnullmakes the SQL result NULL.- Specified by:
evaluatein classBuiltInFunction- Parameters:
args- the argument values, in call order- Returns:
- the function's value for these arguments, or
nullfor SQL NULL
-
getMinArgCount
public int getMinArgCount()Description copied from class:BuiltInFunctionThe fewest arguments a call to this function may pass; fewer is an argument-count error.- Specified by:
getMinArgCountin classBuiltInFunction- Returns:
- the minimum accepted argument count
-
getMaxArgCount
public int getMaxArgCount()Description copied from class:BuiltInFunctionThe most arguments a call to this function may pass;Integer.MAX_VALUEmarks a variadic function (seeBuiltInFunction.isVariadic()).- Specified by:
getMaxArgCountin classBuiltInFunction- Returns:
- the maximum accepted argument count
-