Myracle opened a new pull request, #27483:
URL: https://github.com/apache/flink/pull/27483
## What is the purpose of the change
This pull request adds two new MySQL-compatible built-in SQL functions
INET_ATON and INET_NTOA for IP address conversion. INET_ATON converts an IPv4
address string to its numeric representation, while INET_NTOA performs the
reverse conversion. These functions are commonly used in network data analysis
and are compatible with MySQL's INET_ATON/INET_NTOA functions, including
support for short-form IPv4 addresses (e.g., a.b → a.0.0.b).
## Brief change log
- *Added InetAtonFunction to convert IPv4 address strings to their numeric
(BIGINT) representation*
- *Added InetNtoaFunction to convert numeric values back to IPv4 address
strings*
- *Added function definitions in BuiltInFunctionDefinitions for both
functions*
- *Registered the functions in BuiltInFunctions for Table API and SQL
access*
- *Added inetAton() and inetNtoa() methods to ApiExpressionUtils for Table
API support*
- *Supports MySQL-compatible short-form addresses (a.b, a.b.c) and treats
leading zeros as decimal*
## Verifying this change
This change added tests and can be verified as follows:
- *Added InetFunctionsITCase integration test class covering:*
- *Standard IPv4 address conversion (e.g., 127.0.0.1 ↔ 2130706433)*
- *Short-form IPv4 addresses (e.g., 10.1, 192.168.1)*
- *Leading zeros handling as decimal values*
- *Boundary cases including 0.0.0.0, 255.255.255.255, and max BIGINT
values*
- *NULL input handling*
- *Invalid IP address format handling*
- *INT and BIGINT input types for INET_NTOA*
- *Negative integer boundary test (e.g., -1 as unsigned int)*
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (no)
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: (no)
- The serializers: (no)
- The runtime per-record code paths (performance sensitive): (no)
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
- The S3 file system connector: (no)
## Documentation
- Does this pull request introduce a new feature? (yes)
- If yes, how is the feature documented? (JavaDocs)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]