huaxingao commented on code in PR #15064:
URL: https://github.com/apache/iceberg/pull/15064#discussion_r2710855065


##########
api/src/main/java/org/apache/iceberg/expressions/ManifestEvaluator.java:
##########
@@ -400,6 +416,40 @@ public <T> Boolean notStartsWith(BoundReference<T> ref, 
Literal<T> lit) {
       return ROWS_MIGHT_MATCH;
     }
 
+    /**
+     * Returns the partition field's single value if all partitions contain 
the same value. Defined
+     * as a partition field with no nulls, no NaNs, and lower bound equals 
upper bound. Returns null
+     * otherwise.
+     */
+    private <T> T uniqueValue(BoundReference<T> ref) {
+      int pos = Accessors.toPosition(ref.accessor());
+      PartitionFieldSummary fieldStats = stats.get(pos);
+
+      if (fieldStats.containsNull()) {
+        return null;
+      }
+
+      if (fieldStats.containsNaN() != null && fieldStats.containsNaN()) {

Review Comment:
    I think we should only gate on containsNaN for FLOAT/DOUBLE. For 
FLOAT/DOUBLE, treat containsNaN == null as unknown and skip pruning; for other 
types, ignore containsNaN entirely so null doesn’t block the single-value 
optimization.



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

Reply via email to