This is an automated email from the ASF dual-hosted git repository.
amogh-jahagirdar pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/main by this push:
new 9c59be13d9 API: Fix the fields used for null and NaN counts in
evaluator tests (#17419)
9c59be13d9 is described below
commit 9c59be13d9343191b0996ccafbe6b1770c0acd92
Author: Eduard Tudenhoefner <[email protected]>
AuthorDate: Thu Jul 30 14:32:11 2026 +0200
API: Fix the fields used for null and NaN counts in evaluator tests (#17419)
* 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.
* 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
---
.../expressions/TestInclusiveMetricsEvaluator.java | 28 +++++++++++-----------
1 file changed, 14 insertions(+), 14 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 8d652df0df..eb00a1b6fe 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 class TestInclusiveMetricsEvaluator {
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")));
@@ -1060,14 +1060,14 @@ public class TestInclusiveMetricsEvaluator {
"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();
@@ -1111,7 +1111,7 @@ public class TestInclusiveMetricsEvaluator {
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 class TestInclusiveMetricsEvaluator {
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")));
@@ -1151,14 +1151,14 @@ public class TestInclusiveMetricsEvaluator {
"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();