manishmalhotrawork commented on a change in pull request #365: test cases for
parquetMetrics with multiple rowgroup
URL: https://github.com/apache/incubator-iceberg/pull/365#discussion_r313506183
##########
File path: core/src/test/java/org/apache/iceberg/TestMetrics.java
##########
@@ -270,6 +289,97 @@ public void testMetricsForNullColumns() throws
IOException {
assertBounds(1, IntegerType.get(), null, null, metrics);
}
+ @Test
+ public void testMetricsForTopLevelWithMultipleRG() throws Exception {
+ Schema schema = getSimpleSchema();
+ int minimumRowGroupRecordCount = 100;
+ List<GenericData.Record> records = new ArrayList<>(201);
+
+ for (int i = 0; i < 201; i++) {
+ GenericData.Record newRecord = new
GenericData.Record(AvroSchemaUtil.convert(schema.asStruct()));
+ newRecord.put("booleanCol", i == 0 ? false : true);
+ newRecord.put("intCol", i + 1);
+ newRecord.put("longCol", i == 0 ? null : i + 1L);
+ newRecord.put("floatCol", i + 1.0F);
+ newRecord.put("doubleCol", i == 0 ? null : i + 1.0D);
+ newRecord.put("decimalCol", i == 0 ? null : new BigDecimal(i +
"").add(new BigDecimal("1.00")));
+ newRecord.put("stringCol", "AAA");
+ newRecord.put("dateCol", i + 1);
+ newRecord.put("timeCol", i + 1L);
+ newRecord.put("timestampCol", i + 1L);
+ newRecord.put("uuidCol", uuid);
+ newRecord.put("fixedCol", fixed);
+ newRecord.put("binaryCol", "S".getBytes());
+ records.add(newRecord);
+ }
+
+ // create parquet file with multiple row groups. by using smaller number
of bytes
+ File parquetFile = writeRecords(
+ schema,
+ ImmutableMap.of(PARQUET_ROW_GROUP_SIZE_BYTES,
Integer.toString(ROW_GROUP_SIZE)),
+ records.toArray(new GenericData.Record[] {}));
+
+ Assert.assertNotNull(parquetFile);
+ // rowgroup size should be > 1
+ Assert.assertEquals(3, splitCount(parquetFile));
+
+ Metrics metrics = getMetrics(localInput(parquetFile));
+ Assert.assertEquals(201L, (long) metrics.recordCount());
+ assertCounts(1, 201L, 0L, metrics);
+ assertBounds(1, Types.BooleanType.get(), false, true, metrics);
+ assertBounds(2, Types.IntegerType.get(), 1, 201, metrics);
+ assertCounts(3, 201L, 1L, metrics);
+ assertBounds(3, Types.LongType.get(), 2L, 201L, metrics);
+ assertCounts(4, 201L, 0L, metrics);
+ assertBounds(4, Types.FloatType.get(), 1.0F, 201.0F, metrics);
+ assertCounts(5, 201L, 1L, metrics);
+ assertBounds(5, Types.DoubleType.get(), 2.0D, 201.0D, metrics);
+ assertCounts(6, 201L, 1L, metrics);
+ assertBounds(6, Types.DecimalType.of(10, 2), new BigDecimal("2.00"),
+ new BigDecimal("201.00"), metrics);
+ }
+
+ @Test
+ public void testMetricsForNestedStructFieldsWithMultipleRG() throws
IOException {
+ int minimumRowGroupRecordCount = 101;
Review comment:
updated.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]