-
Notifications
You must be signed in to change notification settings - Fork 181
Implement cidrmatch udf with Calcite
#3603
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
Conversation
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
core/src/main/java/org/opensearch/sql/expression/function/udf/ip/CidrMatchFunction.java
Show resolved
Hide resolved
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
| Usage: `cidrmatch(ip, cidr)` checks if `ip` is within the specified `cidr` range. | ||
|
|
||
| Argument type: STRING, STRING | ||
| Argument type: STRING/IP, STRING |
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.
Is the IP argument supported in v2?
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.
Yes. I've tested. It doesn't work in v2.19 but works in v3.1.0 with calcite disabled.
According to the implementation at IPFunctions.java#L36, IP is the only supported argument type. Strings may be cast to IP.
The documentation may be out of date since the IP's PR came later that cidrmatch's PR. cidrmatch is implemented in #3110; IP data type is added in #3145 .
* Implement cidrmatch UDF Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Add class documentation for cidrmatch udf Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> * Update cidrmatch doc: add IP as an acceptable parameter type Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> --------- Signed-off-by: Yuanchun Shen <yuanchu@amazon.com> Signed-off-by: xinyual <xinyual@amazon.com>
Description
Implement
CIDRMATCHon Calcite engine with a UDFIssues Resolved
Resolves #3505
Check List
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.