Poznámka
Na prístup k tejto stránke sa vyžaduje oprávnenie. Môžete sa skúsiť prihlásiť alebo zmeniť adresáre.
Na prístup k tejto stránke sa vyžaduje oprávnenie. Môžete skúsiť zmeniť adresáre.
Applies to:
Databricks Runtime 18.2 and above
IP functions operate on IPv4 and IPv6 addresses and CIDR blocks represented as STRING or BINARY values.
Import Databricks functions to get IP functions (Databricks Runtime)
To import IP functions for Python or Scala in notebooks, use the following commands:
Python
from pyspark.databricks.sql import functions as dbf
Scala
import com.databricks.sql.functions._
List of IP functions
| Function | Description |
|---|---|
| ip_as_binary(ip_or_cidr) | Returns the canonical binary representation of an IP address or CIDR block. |
| ip_as_string(ip_or_cidr) | Returns the canonical string representation of an IP address or CIDR block. |
| ip_cidr(cidr) | Returns the canonical representation of an IPv4 or IPv6 CIDR block. |
| ip_cidr_contains(cidr, needle) | Returns TRUE if an IP address or CIDR block is contained within another CIDR block. |
| ip_host(ip) | Returns the canonical representation of an IPv4 or IPv6 address. |
| ip_network(cidr) | Returns the network portion of a CIDR block in its canonical form. |
| ip_network_first(cidr) | Alias for ip_network. |
| ip_network_last(cidr) | Returns the last address of a CIDR block in its canonical form. |
| ip_prefix_length(cidr) | Returns the prefix length of a CIDR block. |
| ip_version(ip_or_cidr) | Returns the IP version (4 or 6) from an IP address or CIDR block. |
| try_ip_as_binary(ip_or_cidr) | Returns the canonical binary representation of an IP address or CIDR block, or NULL if invalid. |
| try_ip_as_string(ip_or_cidr) | Returns the canonical string representation of an IP address or CIDR block, or NULL if invalid. |
| try_ip_cidr(cidr) | Returns the canonical representation of an IPv4 or IPv6 CIDR block, or NULL if invalid. |
| try_ip_host(ip) | Returns the canonical representation of an IPv4 or IPv6 address, or NULL if invalid. |