tomtongue commented on code in PR #10039: URL: https://github.com/apache/iceberg/pull/10039#discussion_r1538832259
########## core/src/test/java/org/apache/iceberg/TestMetrics.java: ########## @@ -766,24 +771,38 @@ protected void assertCounts(int fieldId, Long valueCount, Long nullValueCount, M protected void assertCounts( int fieldId, Long valueCount, Long nullValueCount, Long nanValueCount, Metrics metrics) { - Map<Integer, Long> valueCounts = metrics.valueCounts(); - Map<Integer, Long> nullValueCounts = metrics.nullValueCounts(); - Map<Integer, Long> nanValueCounts = metrics.nanValueCounts(); - Assert.assertEquals(valueCount, valueCounts.get(fieldId)); - Assert.assertEquals(nullValueCount, nullValueCounts.get(fieldId)); - Assert.assertEquals(nanValueCount, nanValueCounts.get(fieldId)); + assertThat(metrics.valueCounts()) + .satisfiesAnyOf( Review Comment: Here, in some cases, `valueCounts`, `nullValueCounts` and `nanValueCount` don't have `fieldId`, this causes an assertion error as below: ``` java.lang.AssertionError: Expecting map: {} to contain entries: [1=null] but could not find the following map entries: [1=null] at org.apache.iceberg.TestMetrics.assertCounts(TestMetrics.java:774) at org.apache.iceberg.TestMetrics.assertCounts(TestMetrics.java:769) at org.apache.iceberg.TestMetrics.testNoneMetricsMode(TestMetrics.java:566) ``` So, I change this part to check if the `fieldId` exists, or the key-value pair. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org