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

    https://github.com/apache/spark/pull/16550#discussion_r95871812
  
    --- Diff: 
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java ---
    @@ -835,6 +835,187 @@ public UTF8String translate(Map<Character, Character> 
dict) {
         return fromString(sb.toString());
       }
     
    +  private int getDigit(byte b) {
    +    if (b >= '0' && b <= '9') {
    +      return b - '0';
    +    }
    +    throw new NumberFormatException(toString());
    +  }
    +
    +  /**
    +   * Parses this UTF8String to long.
    +   *
    +   * Note that, in this method we accumulate the result in negative 
format, and convert it to
    +   * positive format at the end, if this string is not started with '-'. 
This is because min value
    +   * is bigger than max value in digits, e.g. Integer.MAX_VALUE is 
'2147483647' and
    +   * Integer.MIN_VALUE is '-2147483648'.
    +   *
    +   * These codes are mostly copied from LazyLong.parseLong in Hive.
    +   */
    +  public long toLong() {
    +    if (numBytes == 0) {
    +      throw new NumberFormatException("Empty string!");
    --- End diff --
    
    Could you remove `!` from the exception?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to