orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omalley <...@git.apache.org>
Subject [GitHub] orc pull request #299: ORC-203 - Update StringStatistics to trim long string...
Date Tue, 07 Aug 2018 22:16:56 GMT
Github user omalley commented on a diff in the pull request:

    https://github.com/apache/orc/pull/299#discussion_r208398373
  
    --- Diff: java/core/src/java/org/apache/orc/impl/ColumnStatisticsImpl.java ---
    @@ -683,6 +787,150 @@ public int hashCode() {
           result = 31 * result + (int) (sum ^ (sum >>> 32));
           return result;
         }
    +
    +    /**
    +     * A helper function that truncates the {@link Text} input
    +     * based on {@link #MAX_BYTES_RECORDED} and increments
    +     * the last codepoint by 1.
    +     * @param text
    +     * @return truncated Text value
    +     */
    +    private static Text truncateUpperBound(final Text text) {
    +
    +      if(text.getBytes().length > MAX_BYTES_RECORDED) {
    +        return truncateUpperBound(text.getBytes());
    +      } else {
    +        return text;
    +      }
    +
    +    }
    +
    +    /**
    +     * A helper function that truncates the {@link byte[]} input
    +     * based on {@link #MAX_BYTES_RECORDED} and increments
    +     * the last codepoint by 1.
    +     * @param text
    +     * @return truncated Text value
    +     */
    +    private static Text truncateUpperBound(final byte[] text) {
    --- End diff --
    
    You need the length passed in here.


---

Mime
View raw message