github-actions[bot] commented on code in PR #62906:
URL: https://github.com/apache/doris/pull/62906#discussion_r3387753268


##########
fe/fe-catalog/src/main/java/org/apache/doris/analysis/IPv4Literal.java:
##########
@@ -56,10 +56,10 @@ protected IPv4Literal(IPv4Literal other) {
         this.value = other.value;
     }
 
-    private static long parseIPv4toLong(String ipv4) {
+    private static long parseIPv4toLong(String ipv4) throws AnalysisException {
         String[] parts = ipv4.split("\\.");

Review Comment:
   This still lets some invalid IPv4 defaults through. `String.split("\\.")` 
drops trailing empty tokens, so values like `1.2.3.4.` or `1.2.3.4..` are 
parsed as the four octets of `1.2.3.4`; `Short.parseShort` also accepts a 
leading `+`, so `1.2.+3.4` passes the loop. That means 
`ColumnDef.validateDefaultValue(Type.IPV4, ..., null)` can still accept 
malformed defaults at CREATE TABLE time, preserving the late-failure mode this 
PR is trying to close. The existing cast regression suite treats `1.2.+3.4` as 
invalid, and Nereids' IPv4 literal regex rejects these forms. Please make this 
legacy parser strict as well, for example by reusing the Nereids-style IPv4 
regex or by using `split("\\.", -1)` plus digit-only octet validation, and add 
unit coverage for those cases.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to