IPv4¶
This data type isn't supported at ingest. It is only supported at query time and to create Copy Data Sources or Materialized View Data Sources.
IPv4 addresses. Stored in 4 bytes as UInt32.
WITH (SELECT [('https://wikipedia.org', '185.15.58.224'),('https://tinybird.co','66.33.60.67'),('https://vercel.com','64.239.109.193')]) AS ips SELECT arrayJoin(ips).1 as url, (arrayJoin(ips).2)::IPv4 as ipv4
------------------------------------------ | url | ipv4 | ------------------------------------------ | https://wikipedia.org | 185.15.58.224 | | https://tinybird.co | 66.33.60.67 | | https://vercel.com | 64.239.109.193 | ------------------------------------------
Values are stored in compact binary form:
WITH (SELECT [('https://wikipedia.org', '185.15.58.224'),('https://tinybird.co','66.33.60.67'),('https://vercel.com','64.239.109.193')]) AS ips SELECT (arrayJoin(ips).2)::IPv4 as ipv4, toTypeName(ipv4), hex(ipv4)
------------------------------------------------- | ipv4 | toTypeName(ipv4) | hex(ipv4) | ------------------------------------------------- | 185.15.58.224 | IPv4 | B90F3AE0 | | 66.33.60.67 | IPv4 | 42213C43 | | 64.239.109.193 | IPv4 | 40EF6DC1 | -------------------------------------------------
IPv4 addresses can be directly compared to IPv6 addresses:
SELECT toIPv4('127.0.0.1') = toIPv6('::ffff:127.0.0.1')
----------------------------------------------------------- | equals(toIPv4('127.0.0.1'), toIPv6('::ffff:127.0.0.1')) | ----------------------------------------------------------- | 1 | -----------------------------------------------------------