You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/02/03 03:11:37 UTC
[GitHub] [incubator-iceberg] edgarRd commented on a change in pull request
#768: Metrics javadoc fixes #767
edgarRd commented on a change in pull request #768: Metrics javadoc fixes #767
URL: https://github.com/apache/incubator-iceberg/pull/768#discussion_r373907688
##########
File path: core/src/test/java/org/apache/iceberg/TestMetrics.java
##########
@@ -114,6 +114,56 @@ public abstract File writeRecords(Schema schema, Map<String, String> properties,
public abstract int splitCount(File parquetFile) throws IOException;
+ @Test
+ public void testMetricsForRepeatedValues() throws IOException {
+ Record firstRecord = new Record(AvroSchemaUtil.convert(SIMPLE_SCHEMA.asStruct()));
+ firstRecord.put("booleanCol", true);
+ firstRecord.put("intCol", 3);
+ firstRecord.put("longCol", null);
+ firstRecord.put("floatCol", 2.0F);
+ firstRecord.put("doubleCol", 2.0D);
+ firstRecord.put("decimalCol", new BigDecimal("3.50"));
+ firstRecord.put("stringCol", "AAA");
+ firstRecord.put("dateCol", 1500);
+ firstRecord.put("timeCol", 2000L);
+ firstRecord.put("timestampCol", 0L);
+ firstRecord.put("uuidCol", uuid);
+ firstRecord.put("fixedCol", fixed);
+ firstRecord.put("binaryCol", "S".getBytes());
+ Record secondRecord = new Record(AvroSchemaUtil.convert(SIMPLE_SCHEMA.asStruct()));
+ secondRecord.put("booleanCol", true);
+ secondRecord.put("intCol", 3);
+ secondRecord.put("longCol", null);
+ secondRecord.put("floatCol", 2.0F);
+ secondRecord.put("doubleCol", 2.0D);
+ secondRecord.put("decimalCol", new BigDecimal("3.50"));
+ secondRecord.put("stringCol", "AAA");
+ secondRecord.put("dateCol", 1500);
+ secondRecord.put("timeCol", 2000L);
+ secondRecord.put("timestampCol", 0L);
+ secondRecord.put("uuidCol", uuid);
+ secondRecord.put("fixedCol", fixed);
+ secondRecord.put("binaryCol", "S".getBytes());
+
+ File recordsFile = writeRecords(SIMPLE_SCHEMA, firstRecord, secondRecord);
+
+ Metrics metrics = getMetrics(Files.localInput(recordsFile));
+ Assert.assertEquals(2L, (long) metrics.recordCount());
+ assertCounts(1, 2L, 0L, metrics);
+ assertCounts(2, 2L, 0L, metrics);
+ assertCounts(3, 2L, 2L, metrics);
Review comment:
Note that in this case `valueCounts == nullValueCounts` and the count is the same as `recordCount`.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org