timothyw553 commented on code in PR #19161:
URL: https://github.com/apache/iceberg/pull/19161#discussion_r4728676297
##########
core/src/test/java/org/apache/iceberg/TestInclusiveStatsEvaluator.java:
##########
@@ -283,6 +287,35 @@ void nullsForFieldsInFullyPresentStruct() {
.isTrue();
}
+ @Test
+ void notNaNForFieldsUnderOptionalStruct() {
+ // All observed child values are NaN, but rows with an absent parent match
notNaN.
+ TrackedFile partial =
+ trackedFile(
+ "partially_present.avro",
+ 5,
+ contentStats(
+ LOCATION_STATS_TYPE,
+ fieldStats(LOCATION_STATS_TYPE, 2, null, null, 3L, null, 3L),
Review Comment:
we cover 3/5 and 5/5 present parents here, what about 0/5 (`valueCount = 0`,
`nanCount = 0`)? a broken implementation that skips all-null parents would
still pass all tests. could we add a test for that?
```diff
+ @Test
+ void notNaNForFieldsUnderAbsentStruct() {
+ TrackedFile file =
+ trackedFile(
+ "absent_parent.avro",
+ 5,
+ contentStats(
+ LOCATION_STATS_TYPE,
+ fieldStats(LOCATION_STATS_TYPE, 2, null, null, 0L, null,
0L),
+ fieldStats(LOCATION_STATS_TYPE, 3, null, null, 0L, 0L,
0L)));
+
+ assertThat(shouldRead(LOCATION_SCHEMA, notNaN("location.lat"),
file)).isTrue();
+ assertThat(shouldRead(LOCATION_SCHEMA, notNaN("location.lon"),
file)).isTrue();
+ assertThat(shouldRead(LOCATION_SCHEMA, isNaN("location.lat"),
file)).isFalse();
+ assertThat(shouldRead(LOCATION_SCHEMA, equal("location.lat", 1.0F),
file)).isFalse();
+ }
```
--
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]