From da59ac91d2a0c941b1de52ccebf147adf3e6100a Mon Sep 17 00:00:00 2001 From: Eduard Tudenhoefner Date: Wed, 29 Jul 2026 16:34:30 +0200 Subject: [PATCH 1/2] API: Fix null counts on a required column in evaluator test The single_value_nulls fixtures in testNotEqWithSingleValue and testNotInWithSingleValue reported 2 nulls for field 3, the "required" column. A required column cannot contain nulls, so no writer produces those metrics. Move both to the optional "some_empty" column, which keeps the case the tests cover: a file whose bounds hold a single value still has to be read when the column also contains nulls, because those nulls match != and NOT IN. The NOT IN fixture also reported a NaN count for a string column, which only float and double columns track. --- .../TestInclusiveMetricsEvaluator.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/api/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluator.java b/api/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluator.java index 8d652df0df03..6166a96380e6 100644 --- a/api/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluator.java +++ b/api/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluator.java @@ -1060,14 +1060,14 @@ public void testNotEqWithSingleValue() { "single_value_nulls.avro", Row.of(), 10, - ImmutableMap.of(3, 10L), - ImmutableMap.of(3, 2L), + ImmutableMap.of(14, 10L), + ImmutableMap.of(14, 2L), null, - ImmutableMap.of(3, toByteBuffer(StringType.get(), "abc")), - ImmutableMap.of(3, toByteBuffer(StringType.get(), "abc"))); + ImmutableMap.of(14, toByteBuffer(StringType.get(), "abc")), + ImmutableMap.of(14, toByteBuffer(StringType.get(), "abc"))); shouldRead = - new InclusiveMetricsEvaluator(SCHEMA, notEqual("required", "abc")) + new InclusiveMetricsEvaluator(SCHEMA, notEqual("some_empty", "abc")) .eval(singleValueWithNulls); assertThat(shouldRead).as("Should read: file has nulls which match != predicate").isTrue(); @@ -1151,14 +1151,14 @@ public void testNotInWithSingleValue() { "single_value_nulls.avro", Row.of(), 10, - ImmutableMap.of(3, 10L), - ImmutableMap.of(3, 2L), - ImmutableMap.of(3, 0L), - ImmutableMap.of(3, toByteBuffer(StringType.get(), "abc")), - ImmutableMap.of(3, toByteBuffer(StringType.get(), "abc"))); + ImmutableMap.of(14, 10L), + ImmutableMap.of(14, 2L), + null, + ImmutableMap.of(14, toByteBuffer(StringType.get(), "abc")), + ImmutableMap.of(14, toByteBuffer(StringType.get(), "abc"))); shouldRead = - new InclusiveMetricsEvaluator(SCHEMA, notIn("required", "abc", "def")) + new InclusiveMetricsEvaluator(SCHEMA, notIn("some_empty", "abc", "def")) .eval(singleValueWithNulls); assertThat(shouldRead).as("Should read: file has nulls which match NOT IN predicate").isTrue(); From 4fe9a5f9e8df1d7a6d302d35046193944fc8e94c Mon Sep 17 00:00:00 2001 From: Eduard Tudenhoefner Date: Wed, 29 Jul 2026 16:51:28 +0200 Subject: [PATCH 2/2] API: Remove NaN counts for a string column in evaluator test The range_of_values and single_value fixtures reported a NaN count for field 3, a string column. Only float and double columns track NaN counts, which is why the single_value fixture in testNotEqWithSingleValue already passed null for them. Generated-by: Cursor --- .../iceberg/expressions/TestInclusiveMetricsEvaluator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluator.java b/api/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluator.java index 6166a96380e6..eb00a1b6fed0 100644 --- a/api/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluator.java +++ b/api/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluator.java @@ -1022,7 +1022,7 @@ public void testNotEqWithSingleValue() { 10, ImmutableMap.of(3, 10L), ImmutableMap.of(3, 0L), - ImmutableMap.of(3, 0L), + null, ImmutableMap.of(3, toByteBuffer(StringType.get(), "aaa")), ImmutableMap.of(3, toByteBuffer(StringType.get(), "zzz"))); @@ -1111,7 +1111,7 @@ public void testNotInWithSingleValue() { 10, ImmutableMap.of(3, 10L), ImmutableMap.of(3, 0L), - ImmutableMap.of(3, 0L), + null, ImmutableMap.of(3, toByteBuffer(StringType.get(), "aaa")), ImmutableMap.of(3, toByteBuffer(StringType.get(), "zzz"))); @@ -1128,7 +1128,7 @@ public void testNotInWithSingleValue() { 10, ImmutableMap.of(3, 10L), ImmutableMap.of(3, 0L), - ImmutableMap.of(3, 0L), + null, ImmutableMap.of(3, toByteBuffer(StringType.get(), "abc")), ImmutableMap.of(3, toByteBuffer(StringType.get(), "abc")));