-
Notifications
You must be signed in to change notification settings - Fork 346
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
feat: support some IP related functions #5614
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ruihang Xia <[email protected]>
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
PR Overview
This PR introduces IP-related functions to support IPv4 and IPv6 address conversions, including string and numeric representations as well as range and CIDR conversions.
- Added new IPv4 functions: converting UInt32 to string, string to UInt32, and CIDR and range checks.
- Added new IPv6 functions: converting hexadecimal strings to formatted IPv6 strings, string to binary conversion, and CIDR and range checks.
- Updated the function registry to include IP functions.
Reviewed Changes
File | Description |
---|---|
src/common/function/src/scalars/ip.rs | New module to register the IP functions |
src/common/function/src/scalars/ip/ipv4.rs | Implementation and tests for IPv4 conversion functions |
src/common/function/src/scalars/ip/ipv6.rs | Implementation and tests for IPv6 conversion functions |
src/common/function/src/function_registry.rs | Updated to add registration of the IP functions |
src/common/function/src/scalars.rs | Added module export for IP functions |
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/common/function/src/scalars/ip/ipv6.rs:36
- [nitpick] The name 'ipv6_num_to_string' may be misleading because, unlike its IPv4 counterpart that works with a numeric type, this function expects a hexadecimal string representation as input. Consider renaming it to 'ipv6_hex_to_string' for improved clarity.
pub struct Ipv6NumToString;
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
What's changed and what's your intention?
New functions:
ipv4_string_to_num
ipv4_num_to_string
ipv4_to_cidr
ipv4_in_range
ipv6_num_to_string
ipv6_string_to_num
ipv6_to_cidr
ipv6_in_range
PR Checklist
Please convert it to a draft if some of the following conditions are not met.