[
https://issues.apache.org/jira/browse/FLINK-38988?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Liu updated FLINK-38988:
------------------------
Description:
h1. Motivation
IP address conversion between string and numeric formats is a common
requirement in data analysis scenarios, especially for:
- Log analysis and processing
- Network security analysis
- User behavior tracking and analytics
Currently, Flink SQL does not provide built-in functions for IP address
conversion. Users have to implement UDFs to achieve this functionality, which
increases development overhead and reduces portability.
h1. Proposal
Add two built-in scalar functions following MySQL's naming convention:
1. INET_ATON(ip_string)
Converts an IPv4 address string to its numeric representation (BIGINT).
2. INET_NTOA(ip_number)
Converts a numeric IP address representation back to its string format.
h1. Implementation Details
The conversion algorithm follows the standard IPv4 address representation:
- IP address `A.B.C.D` is converted to: `A * 256³ + B * 256² + C * 256 + D`
- The numeric value is converted back by extracting each octet using bit
shifting
h1. Compatibility
These functions follow MySQL's `INET_ATON()` and `INET_NTOA()` naming and
behavior, which provides:
- Familiarity for users migrating from MySQL
- Consistency with industry standards
- Easy adoption for existing SQL queries
h1.
h1. Related Work
|Database|Function Name|Notes|
|----------|---------------|-------|
|MySQL|INET_ATON / INET_NTOA|Standard implementation|
|PostgreSQL|inet type|Uses native inet type|
|Hive|No built-in support|Requires UDF|
|Spark SQL|No built-in support|Requires UDF|
h1. Future Considerations
IPv6 support could be added in a follow-up issue with `INET6_ATON()` and
`INET6_NTOA()` functions.
was:
h1. Motivation
IP address conversion between string and numeric formats is a common
requirement in data analysis scenarios, especially for:
- Log analysis and processing
- Network security analysis
- User behavior tracking and analytics
Currently, Flink SQL does not provide built-in functions for IP address
conversion. Users have to implement UDFs to achieve this functionality, which
increases development overhead and reduces portability.
h1. Proposal
Add two built-in scalar functions following MySQL's naming convention:
1. INET_ATON(ip_string)
Converts an IPv4 address string to its numeric representation (BIGINT).
2. INET_NTOA(ip_number)
Converts a numeric IP address representation back to its string format.
h1. Implementation Details
The conversion algorithm follows the standard IPv4 address representation:
- IP address `A.B.C.D` is converted to: `A * 256³ + B * 256² + C * 256 + D`
- The numeric value is converted back by extracting each octet using bit
shifting
h1. Compatibility
These functions follow MySQL's `INET_ATON()` and `INET_NTOA()` naming and
behavior, which provides:
- Familiarity for users migrating from MySQL
- Consistency with industry standards
- Easy adoption for existing SQL queries
h1. Related Work
| Database | Function Name | Notes |
|----------|---------------|-------|
| MySQL | INET_ATON / INET_NTOA | Standard implementation |
| PostgreSQL | inet type | Uses native inet type |
| Hive | No built-in support | Requires UDF |
| Spark SQL | No built-in support | Requires UDF |
h1. Future Considerations
IPv6 support could be added in a follow-up issue with `INET6_ATON()` and
`INET6_NTOA()` functions.
> Support INET_ATON and INET_NTOA functions for IP address conversion
> -------------------------------------------------------------------
>
> Key: FLINK-38988
> URL: https://issues.apache.org/jira/browse/FLINK-38988
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / API
> Reporter: Liu
> Priority: Major
>
> h1. Motivation
> IP address conversion between string and numeric formats is a common
> requirement in data analysis scenarios, especially for:
> - Log analysis and processing
> - Network security analysis
> - User behavior tracking and analytics
> Currently, Flink SQL does not provide built-in functions for IP address
> conversion. Users have to implement UDFs to achieve this functionality, which
> increases development overhead and reduces portability.
> h1. Proposal
> Add two built-in scalar functions following MySQL's naming convention:
> 1. INET_ATON(ip_string)
> Converts an IPv4 address string to its numeric representation (BIGINT).
> 2. INET_NTOA(ip_number)
> Converts a numeric IP address representation back to its string format.
> h1. Implementation Details
> The conversion algorithm follows the standard IPv4 address representation:
> - IP address `A.B.C.D` is converted to: `A * 256³ + B * 256² + C * 256 + D`
> - The numeric value is converted back by extracting each octet using bit
> shifting
> h1. Compatibility
> These functions follow MySQL's `INET_ATON()` and `INET_NTOA()` naming and
> behavior, which provides:
> - Familiarity for users migrating from MySQL
> - Consistency with industry standards
> - Easy adoption for existing SQL queries
> h1.
> h1. Related Work
> |Database|Function Name|Notes|
> |----------|---------------|-------|
> |MySQL|INET_ATON / INET_NTOA|Standard implementation|
> |PostgreSQL|inet type|Uses native inet type|
> |Hive|No built-in support|Requires UDF|
> |Spark SQL|No built-in support|Requires UDF|
> h1. Future Considerations
> IPv6 support could be added in a follow-up issue with `INET6_ATON()` and
> `INET6_NTOA()` functions.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)