-
Notifications
You must be signed in to change notification settings - Fork 34
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
PPL cidr
function
#706
PPL cidr
function
#706
Conversation
I pushed the scaffold for the CIDR function. I suggest to add a dependency to https://github.com/seancfoley/IPAddress because this library seems to provide ip validation and in range checking for ipv4 and ipv6 addresses/cidrs. The library is Apache licensed. Other options are the following libraries or code snippets (or of course manual implementation with java standard library which is error prone in my view):
Let me know what you think and what the general process is to discuss new dependencies |
Hi @salyh |
ppl-spark-integration/src/main/java/org/opensearch/sql/ast/expression/Cidr.java
Outdated
Show resolved
Hide resolved
Hi @salyh |
I checked but it does not support cidr checks. https://github.com/seancfoley/IPAddress is also already used in the sql project. |
done |
@salyh plz resolve conflict |
done |
Regarding validation of the CIDR function parameters: The IPAddress library is very lenient regarding validation of ip addresss and cidr blocks. I suggest we at least disallow partial ip address segements and empty or null adresses:
Then the remaining question is wether we should enforce other syntax checks like which the library is not enforcing:
My suggestion is to only
and leave everything else to the library. |
@salyh |
@salyh
In addition plz document the additional validations as future work:
Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the needed documentation in the following locations:
Once we approve we'll also add it onto the other docs:
ppl-spark-integration/src/main/java/org/opensearch/sql/expression/function/SerializableUdf.java
Show resolved
Hide resolved
ppl-spark-integration/src/main/java/org/opensearch/sql/expression/function/SerializableUdf.java
Show resolved
Hide resolved
@dr-lilienthal can u plz resolve the conflicts and also signOff the commits ?( DCO failure ) |
ppl-spark-integration/src/main/java/org/opensearch/sql/expression/function/SerializableUdf.java
Outdated
Show resolved
Hide resolved
@salyh @dr-lilienthal can u plz resolve the conflicts ? |
@YANG-DB done |
Signed-off-by: Hendrik Saly <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
…h exception runtime exception in case of a mixed adress type Signed-off-by: Jens Schmidt <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Signed-off-by: Jens Schmidt <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
* Initial commit for cidr function Signed-off-by: Hendrik Saly <[email protected]> * Add inet.ipaddr library and implement basic cidr check Signed-off-by: Hendrik Saly <[email protected]> * Refactor for using lombok Signed-off-by: Hendrik Saly <[email protected]> * Add unittests Signed-off-by: Hendrik Saly <[email protected]> * add check for mixed ip address types like ipv4 and ipv6; add test with exception runtime exception in case of a mixed adress type Signed-off-by: Jens Schmidt <[email protected]> * Fix antlr Signed-off-by: Hendrik Saly <[email protected]> * rename cird function cirdmatch Signed-off-by: Jens Schmidt <[email protected]> * Fix imports Signed-off-by: Hendrik Saly <[email protected]> * Prepare integ tests Signed-off-by: Hendrik Saly <[email protected]> * Added IT tests Signed-off-by: Hendrik Saly <[email protected]> * Refactor SerializableUdf to be an interface Signed-off-by: Hendrik Saly <[email protected]> * Fix imports Signed-off-by: Hendrik Saly <[email protected]> * Added docs Signed-off-by: Hendrik Saly <[email protected]> --------- Signed-off-by: Hendrik Saly <[email protected]> Signed-off-by: Jens Schmidt <[email protected]> Co-authored-by: Jens Schmidt <[email protected]>
Description
Implement cidr function to check wether an ip address is with a given cidr
Issues Resolved
#671
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.