Myracle commented on code in PR #27483:
URL: https://github.com/apache/flink/pull/27483#discussion_r2957751467


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java:
##########
@@ -1419,6 +1421,55 @@ public OutType urlEncode() {
         return toApiSpecificExpression(unresolvedCall(URL_ENCODE, toExpr()));
     }
 
+    /**
+     * Converts an IPv4 address string to its numeric representation. This 
function follows MySQL
+     * INET_ATON behavior.
+     *
+     * <p>The conversion formula is: A * 256^3 + B * 256^2 + C * 256 + D for 
an IP address A.B.C.D
+     *
+     * <p>Supports MySQL-compatible short-form addresses:
+     *
+     * <ul>
+     *   <li>a.b is interpreted as a.0.0.b
+     *   <li>a.b.c is interpreted as a.b.0.c
+     * </ul>
+     *
+     * <p>Leading zeros in octets are parsed as decimal (not octal), 
consistent with MySQL.
+     *
+     * <p>Examples:
+     *
+     * <ul>
+     *   <li>INET_ATON('127.0.0.1') returns 2130706433
+     *   <li>INET_ATON('127.1') returns 2130706433 (short-form)
+     *   <li>INET_ATON('0.0.0.0') returns 0
+     * </ul>
+     *
+     * @return the numeric representation of the IP address, or null if the 
input is null or invalid
+     */
+    public OutType inetAton() {
+        return toApiSpecificExpression(unresolvedCall(INET_ATON, toExpr()));
+    }
+
+    /**
+     * Converts a numeric IPv4 address representation back to its string 
format. This function
+     * follows MySQL INET_NTOA behavior.

Review Comment:
   Good catch — the inetAton() Javadoc in BaseExpressions.java was still using 
the old short-form description. Updated it to match the canonical format in 
InetAtonFunction.java: all four short-form variants (a, a.b, a.b.c, a.b.c.d) 
with em dashes, plus the INET_ATON('1') example.
   
   Also applied the same update to the Python docstring in expression.py.



-- 
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]

Reply via email to