ipv4(value: string, int64, or variant) -> ipv4

Converts value to the ipv4 type.

If value is already ipv4, it is returned unchanged. An int64 must lie between 0 and 4294967295 inclusive; otherwise the result is null. A string is parsed as dotted IPv4 decimal notation. A variant tries the int64 interpretation first, then the string interpretation, returning the first non-null ipv4. A null input yields null. To obtain structured metadata from addresses, use parse_ip.

Domain

This is a scalar function (calculates a single output value for a single input row).

Categories

Examples

make_col addr:ipv4(dotted_ip)

Casts dotted-decimal IPv4 text into the compact ipv4 representation for IP-specific functions.

make_col addr:ipv4(packed_int)

Interprets an unsigned 32-bit integer bit pattern as an IPv4 address for range checks.