rdblue commented on code in PR #5450:
URL: https://github.com/apache/iceberg/pull/5450#discussion_r954205777
##########
core/src/test/java/org/apache/iceberg/TestTableMetadata.java:
##########
@@ -1235,6 +1248,47 @@ public void testUpdateSortOrder() {
sortedByX.sortOrder().fields().get(0).nullOrder());
}
+ @Test
+ public void testStatistics() {
+ Schema schema = new Schema(Types.NestedField.required(10, "x",
Types.StringType.get()));
+
+ TableMetadata meta =
+ TableMetadata.newTableMetadata(
+ schema, PartitionSpec.unpartitioned(), null, ImmutableMap.of());
+ Assert.assertEquals(
+ "Should default to no statistics files", ImmutableList.of(),
meta.statisticsFiles());
+ }
+
+ @Test
+ public void testSetStatistics() {
+ Schema schema = new Schema(Types.NestedField.required(10, "x",
Types.StringType.get()));
+
+ TableMetadata meta =
+ TableMetadata.newTableMetadata(
+ schema, PartitionSpec.unpartitioned(), null, ImmutableMap.of());
+
+ Assert.assertSame(
+ "Should detect no statistics to remove",
+ meta,
+ TableMetadata.buildFrom(meta).removeStatistics(42L).build());
Review Comment:
I don't think this really fits in a `testSetStatistics` method since you're
testing the default behavior of `removeStatistics`. I'd probably move this to a
different test method. I also don't see a test to check that `removeStatistics`
works without removing other stats files.
It would also be good to have a test to validate replacement behavior, since
`setStatistics` is idempotent.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]