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


##########
api/src/main/java/org/apache/iceberg/expressions/InclusiveMetricsEvaluator.java:
##########
@@ -75,6 +84,25 @@ private class MetricsEvalVisitor extends 
InclusiveEvalVisitor {
     private Map<Integer, ByteBuffer> lowerBounds = null;
     private Map<Integer, ByteBuffer> upperBounds = null;
 
+    private static <V> Map<Integer, V> forPruning(
+        ContentFile<?> file, Function<ContentFile<?>, Map<Integer, V>> stats) {
+      Map<Integer, V> columnStats = stats.apply(file);
+      if (columnStats == null || file.content() != 
FileContent.EQUALITY_DELETES) {
+        return columnStats;
+      }
+
+      List<Integer> equalityFieldIds = file.equalityFieldIds();
+      if (equalityFieldIds == null || equalityFieldIds.isEmpty()) {
+        LOG.warn(
+            "Ignoring stats of equality delete file without equality field 
IDs: {}",
+            file.location());

Review Comment:
   `forPruning` is called once per stats map (lines 118-122), so this warning 
can be logged up to 5 times for the same file, on every scan. Could we check 
`equalityFieldIds` once in `eval` instead? Same in `StrictMetricsEvaluator`.



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