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?
---