holdenk commented on a change in pull request #2048:
URL: https://github.com/apache/iceberg/pull/2048#discussion_r558628307
##########
File path: core/src/test/java/org/apache/iceberg/TestSchemaAndMappingUpdate.java
##########
@@ -155,6 +156,42 @@ public void testDeleteColumn() {
validateUnchanged(mapping, updated);
}
+ @Test
+ public void testModificationWithMetricsMetrics() {
+ NameMapping mapping = MappingUtil.create(table.schema());
+ String mappingJson = NameMappingParser.toJson(mapping);
+
+ table.updateProperties()
+ .set(TableProperties.DEFAULT_NAME_MAPPING, mappingJson)
+ .set("write.metadata.metrics.column.id", "full")
+ .commit();
+
+ AssertHelpers.assertThrows(
+ "Creating metrics for non-existent column fails",
+ ValidationException.class,
+ null,
+ () ->
+ table.updateProperties()
+ .set(TableProperties.DEFAULT_NAME_MAPPING, mappingJson)
+ .set("write.metadata.metrics.column.ids", "full")
+ .commit());
+
+ AssertHelpers.assertThrows(
+ "Deleting a column with metrics fails",
+ ValidationException.class,
+ null,
+ () ->
+ table.updateSchema()
+ .deleteColumn("id")
+ .commit());
+
+ String updatedJson =
table.properties().get(TableProperties.DEFAULT_NAME_MAPPING);
+ NameMapping updated = NameMappingParser.fromJson(updatedJson);
+
+ // should not change the mapping
+ validateUnchanged(mapping, updated);
Review comment:
Sure I'll add a new test suite next.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]