Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5574#discussion_r28901683
  
    --- Diff: 
network/common/src/main/java/org/apache/spark/network/util/JavaUtils.java ---
    @@ -186,5 +199,84 @@ public static long timeStringAsMs(String str) {
       public static long timeStringAsSec(String str) {
         return parseTimeString(str, TimeUnit.SECONDS);
       }
    +  
    +  /**
    +   * Convert a passed byte string (e.g. 50b, 100kb, or 250mb) to a 
ByteUnit for
    +   * internal use. If no suffix is provided a direct conversion of the 
provided default is 
    +   * attempted.
    +   */
    +  private static long parseByteString(String str, ByteUnit unit) {
    +    String lower = str.toLowerCase().trim();
    +
    +    try {
    +      Matcher m = Pattern.compile("([0-9]+)([a-z]+)?").matcher(lower);
    +      Matcher fractionMatcher = 
Pattern.compile("([0-9]*\\.[0-9]*)([a-z]+)?").matcher(lower);
    +      
    +      if(m.matches()) {
    --- End diff --
    
    nit: `if (`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to