-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add IPAddress Presto type #10596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IPAddress Presto type #10596
Changes from all commits
16d69ff
5df77ca
0541476
a8dd6fb
f56b527
b7e4836
fadf329
6aaf937
44845a8
6c39388
f31614a
a941c93
e8897a2
0519e94
afc20ab
3bbc2fa
7ad4fcd
63d9ad2
2047cca
af963ee
5eea4c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,6 +136,7 @@ HYPERLOGLOG VARBINARY | |
| JSON VARCHAR | ||
| TIMESTAMP WITH TIME ZONE BIGINT | ||
| UUID HUGEINT | ||
| IPADDRESS HUGEINT | ||
| ======================== ===================== | ||
|
|
||
| TIMESTAMP WITH TIME ZONE represents a time point in milliseconds precision | ||
|
|
@@ -146,6 +147,14 @@ Supported range of milliseconds is [0xFFF8000000000000L, 0x7FFFFFFFFFFFF] | |
| store timezone ID. Supported range of timezone ID is [1, 1680]. | ||
| The definition of timezone IDs can be found in ``TimeZoneDatabase.cpp``. | ||
|
|
||
| IPADDRESS represents an IPV6 or IPV4 formatted IPV6 address. Its physical | ||
| type is HUGEINT. The format that the address is stored in is defined as part of `(RFC 4291#section-2.5.5.2) <https://datatracker.ietf.org/doc/html/rfc4291.html#section-2.5.5.2>`_ | ||
| As Velox is run on Little Endian systems and the standard is network byte(Big Endian) | ||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this an orderable type? If so, does OrderBy produce correct results if it treats values of this type the same as values of BIGINT type? If not, we may have a problem similar to #10338
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mbasmanova I believe that the reason for this is due to the 1 to 1 mapping of IPADDRESS to BIGINT and how they are stored. For example the ipaddress
Similar with IPV6. That being said that does point out two issues. One that I don't think presto even takes care of.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for looking into this. I'll need more time to understand. I see that compare in Presto for IPADDRESS is not the same as for BIGINT (or maybe they just look different). This suggest that IPADDRESS type is affected by #10338 and therefore we won't be able to use it (without causing correctness issues) until that issue is resolved or we find a way to block code paths that may be affected.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem. Simplest fix would be to switch to varbinary but that is not very efficient. Other option would be to override the operator similar to how we override cast? Not sure if this is possible.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Not yet. @bikramSingh91 has been looking into this as part of #10338
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mohsaka One option might be to proceed to land this change and continue landing functions that use that type, but document that it is not "ready to be used" and add a plan validator to Presto to reject plans with that type when running native engine (we have that for TS_w_TS type).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mohsaka We should add the plan validator with a config like it was done for timestamp with timezone in Presto coordiantor first before merging this change in velox.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @amitkdutta Thank you for the pointers. Will work on adding the plan changes before merging in these changes. |
||
| create IPPREFIX networks as well as to check IPADDRESS validity within | ||
| IPPREFIX networks. | ||
|
|
||
| Spark Types | ||
| ~~~~~~~~~~~~ | ||
| The `data types <https://spark.apache.org/docs/latest/sql-ref-datatypes.html>`_ in Spark have some semantic differences compared to those in | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.