Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/19408#discussion_r142038567
--- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
@@ -981,7 +981,13 @@ private[spark] object Utils extends Logging {
return cached
}
- val indx: Int = hostPort.lastIndexOf(':')
+ val indx: Int =
+ // Interpret hostPort as literal IPv6 address if it contains two ore
more colons
+ // scalastyle:off SingleSpaceBetweenRParenAndLCurlyBrace
+ if (hostPort.matches("(([0-9a-f]*):([0-9a-f]*)){2,}")) -1
--- End diff --
Hex digits can be uppercase right?
Should the pattern it not be more like `[0-9a-f]*(:[0-9a-f]*)+` match a
number, then colon-number colon-number pairs, not number-colon-number
number-colon-number sequences?
It might end up being equivalent because the match is for 0 or more digits.
This allows some strings that it shouldn't like "::::", but, the purpose
isn't to catch every possible case I guess. It would fail name resolution.
I thought Inet6Address would just provide parsing for this but I guess not.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]