Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsaka committed Aug 9, 2024
1 parent 7ad4fcd commit 63d9ad2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion velox/docs/develop/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ As Velox is run on Little Endian systems and the standard is network byte(Big En
order, we reverse the bytes to allow for masking and other bit operations
used in IPADDRESS/IPPREFIX related functions. This type can be used to
create IPPREFIX networks as well as to check IPADDRESS validity within
IPPREFIX netowrks.
IPPREFIX networks.

Spark Types
~~~~~~~~~~~~
Expand Down
3 changes: 2 additions & 1 deletion velox/docs/functions/presto/conversion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ From IPADDRESS
^^^^^^^^^^^^^^

Casting from IPADDRESS to VARCHAR returns a string formatted as x.x.x.x for IPV4 formatted IPV6 addresses.
For all other IPV6 addresses it will be formatted in compressed IPV6 defined in `RFC 4291#section-2.2 <https://datatracker.ietf.org/doc/html/rfc4291.html#section-2.2>`_
For all other IPV6 addresses it will be formatted in compressed alternate form IPV6 defined in `RFC 4291#section-2.2 <https://datatracker.ietf.org/doc/html/rfc4291.html#section-2.2>`_

IPV4:

Expand All @@ -681,6 +681,7 @@ IPV6:
::

SELECT cast(ipaddress '2001:0db8:0000:0000:0000:ff00:0042:8329' as varchar); -- '2001:db8::ff00:42:8329'
SELECT cast(ipaddress '0:0:0:0:0:0:13.1.68.3' as varchar); -- '::13.1.68.3'

IPV4 mapped IPV6:

Expand Down
1 change: 1 addition & 0 deletions velox/functions/prestosql/tests/IPAddressCastTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ int128_t stringToInt128(std::string value) {

TEST_F(IPAddressCastTest, castToVarchar) {
EXPECT_EQ(castToVarchar("::ffff:1.2.3.4"), "1.2.3.4");
EXPECT_EQ(castToVarchar("0:0:0:0:0:0:13.1.68.3"), "::13.1.68.3");
EXPECT_EQ(castToVarchar("1.2.3.4"), "1.2.3.4");
EXPECT_EQ(castToVarchar("192.168.0.0"), "192.168.0.0");
EXPECT_EQ(
Expand Down

0 comments on commit 63d9ad2

Please sign in to comment.