lirui-apache commented on code in PR #13329:
URL: https://github.com/apache/iceberg/pull/13329#discussion_r2158245627


##########
core/src/main/java/org/apache/iceberg/PartitionStatsHandler.java:
##########
@@ -280,6 +273,8 @@ private static Collection<PartitionStats> 
computeAndMergeStatsIncremental(
       oldStats.forEach(
           partitionStats ->
               statsMap.put(partitionStats.specId(), 
partitionStats.partition(), partitionStats));
+    } catch (IllegalArgumentException | IllegalStateException exception) {

Review Comment:
   Maybe we can have a wrapper like this and let the returned Iterable return 
this wrapper?
   ```java
   public static class CatchingWrapper implements 
CloseableIterator<PartitionStats> {
       private final CloseableIterator<PartitionStats> delegate;
   
       public CatchingWrapper(CloseableIterator<PartitionStats> delegate) {
         this.delegate = delegate;
       }
   
       @Override
       public boolean hasNext() {
         try {
           return delegate.hasNext();
         } catch (IllegalArgumentException | IllegalStateException e) {
           if (isInvalidStats(e)) {
             throw new InvalidStatsFileException();
           }
           throw e;
         }
       }
   
       @Override
       public PartitionStats next() {
         try {
           return delegate.next();
         } catch (IllegalArgumentException | IllegalStateException e) {
           if (isInvalidStats(e)) {
             throw new InvalidStatsFileException();
           }
           throw e;
         }
       }
     }
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to