holdenk commented on a change in pull request #2048:
URL: https://github.com/apache/iceberg/pull/2048#discussion_r560428712



##########
File path: core/src/main/java/org/apache/iceberg/PropertiesUpdate.java
##########
@@ -89,6 +89,11 @@ public UpdateProperties defaultFormat(FileFormat format) {
 
     newProperties.putAll(updates);
 
+    // Validate the metrics
+    if (base != null && base.schema() != null) {
+      
MetricsConfig.fromProperties(newProperties).validateReferencedColumns(base.schema());

Review comment:
       This is covered in the same test as the other one (the exception is on a 
different line though):
   
   ```
   org.apache.iceberg.TestSchemaAndMappingUpdate > 
testModificationWithMetricsMetrics[formatVersion = 1] FAILED
       java.lang.AssertionError: No exception was thrown (Creating metrics for 
non-existent column fails), expected: 
org.apache.iceberg.exceptions.ValidationException
           at org.junit.Assert.fail(Assert.java:88)
           at 
org.apache.iceberg.AssertHelpers.assertThrows(AssertHelpers.java:65)
           at 
org.apache.iceberg.TestSchemaAndMappingUpdate.testModificationWithMetricsMetrics(TestSchemaAndMappingUpdate.java:169)
   
   org.apache.iceberg.TestSchemaAndMappingUpdate > 
testModificationWithMetricsMetrics[formatVersion = 2] FAILED
       java.lang.AssertionError: No exception was thrown (Creating metrics for 
non-existent column fails), expected: 
org.apache.iceberg.exceptions.ValidationException
           at org.junit.Assert.fail(Assert.java:88)
           at 
org.apache.iceberg.AssertHelpers.assertThrows(AssertHelpers.java:65)
           at 
org.apache.iceberg.TestSchemaAndMappingUpdate.testModificationWithMetricsMetrics(TestSchemaAndMappingUpdate.java:169)
   
   ```




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

Reply via email to