orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prasanthj <...@git.apache.org>
Subject [GitHub] orc pull request #252: ORC-345 Create and use a new Decimal64StatisticsImpl ...
Date Thu, 03 May 2018 00:39:14 GMT
Github user prasanthj commented on a diff in the pull request:

    https://github.com/apache/orc/pull/252#discussion_r185676846
  
    --- Diff: java/core/src/test/org/apache/orc/impl/TestColumnStatisticsImpl.java ---
    @@ -85,4 +86,53 @@ public void testOldTimestamps() throws IOException {
         assertEquals("2037-01-01 00:00:00.0", stats.getMaximum().toString());
         TimeZone.setDefault(original);
       }
    +
    +  @Test
    +  public void testDecimal64Overflow() throws IOException {
    +    TypeDescription schema = TypeDescription.fromString("decimal(18,6)");
    +    OrcProto.ColumnStatistics.Builder pb =
    +        OrcProto.ColumnStatistics.newBuilder();
    +    OrcProto.DecimalStatistics.Builder decimalBuilder =
    +        OrcProto.DecimalStatistics.newBuilder();
    +    decimalBuilder.setMaximum("1000.0");
    +    decimalBuilder.setMinimum("1.010");
    +    decimalBuilder.setSum("123456789.123456");
    +    pb.setDecimalStatistics(decimalBuilder);
    +    pb.setHasNull(false);
    +    pb.setNumberOfValues(3);
    +
    +    // the base case doesn't overflow
    +    DecimalColumnStatistics stats1 = (DecimalColumnStatistics)
    --- End diff --
    
    Can you also add a test for merge with opposite signs (adding negative and positive so
that overflow if condition in merge() gets covered) and also one that overflows?


---

Mime
View raw message