rdblue commented on a change in pull request #1747:
URL: https://github.com/apache/iceberg/pull/1747#discussion_r521656540



##########
File path: 
api/src/main/java/org/apache/iceberg/expressions/InclusiveMetricsEvaluator.java
##########
@@ -150,6 +152,53 @@ public Boolean or(Boolean leftResult, Boolean rightResult) 
{
       return ROWS_MIGHT_MATCH;
     }
 
+    @Override
+    public <T> Boolean isNaN(BoundReference<T> ref) {
+      Integer id = ref.fieldId();
+
+      if (nanCounts != null && nanCounts.containsKey(id) && nanCounts.get(id) 
== 0) {
+        return ROWS_CANNOT_MATCH;
+      }
+
+      // when there's no nanCounts information, but we already know the column 
only contains null,
+      // it's guaranteed that there's no NaN value
+      if (containsNullsOnly(id)) {
+        return ROWS_CANNOT_MATCH;
+      }
+
+      return ROWS_MIGHT_MATCH;
+    }
+
+    @Override
+    @SuppressWarnings("checkstyle:CyclomaticComplexity")
+    public <T> Boolean notNaN(BoundReference<T> ref) {
+      Integer id = ref.fieldId();
+
+      if (nanCounts != null && nanCounts.containsKey(id) &&
+          valueCounts != null && valueCounts.containsKey(id)) {
+        if (nanCounts.get(id).equals(valueCounts.get(id))) {
+          return ROWS_CANNOT_MATCH;
+        }
+
+        return ROWS_MIGHT_MATCH;
+      }
+
+      // for v1 table, when NaN could still be upper/lower bound,
+      // if upper == lower == NaN and null count == 0, the column will only 
contain NaN

Review comment:
       I don't think this is true. [This 
test](https://github.com/apache/iceberg/pull/1641/files#diff-2900068c4638e4fbfb78474ff10b6bb05ec51dd86b858e2a6a172444f639aa2eR355)
 shows an ORC case where upper and lower are NaN, but there are non-NaN values 
in the column.




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