pvary commented on code in PR #14837:
URL: https://github.com/apache/iceberg/pull/14837#discussion_r2619060357


##########
core/src/main/java/org/apache/iceberg/util/BinPacking.java:
##########
@@ -36,38 +36,51 @@ public static class ListPacker<T> {
     private final long targetWeight;
     private final int lookback;
     private final boolean largestBinFirst;
+    private final long targetSize;
 
     public ListPacker(long targetWeight, int lookback, boolean 
largestBinFirst) {
+      this(targetWeight, lookback, largestBinFirst, Long.MAX_VALUE);
+    }
+
+    public ListPacker(long targetWeight, int lookback, boolean 
largestBinFirst, long targetSize) {
       this.targetWeight = targetWeight;
       this.lookback = lookback;
       this.largestBinFirst = largestBinFirst;
+      this.targetSize = targetSize;
     }
 
     public List<List<T>> packEnd(List<T> items, Function<T, Long> weightFunc) {
       return Lists.reverse(
           ImmutableList.copyOf(
               Iterables.transform(
                   new PackingIterable<>(
-                      Lists.reverse(items), targetWeight, lookback, 
weightFunc, largestBinFirst),
+                      Lists.reverse(items),
+                      targetWeight,
+                      lookback,
+                      weightFunc,
+                      largestBinFirst,
+                      targetSize),
                   Lists::reverse)));
     }
 
     public List<List<T>> pack(Iterable<T> items, Function<T, Long> weightFunc) 
{
       return ImmutableList.copyOf(
-          new PackingIterable<>(items, targetWeight, lookback, weightFunc, 
largestBinFirst));
+          new PackingIterable<>(
+              items, targetWeight, lookback, weightFunc, largestBinFirst, 
targetSize));
     }
   }
 
   public static class PackingIterable<T> implements Iterable<List<T>> {
     private final Iterable<T> iterable;
     private final long targetWeight;
     private final int lookback;
+    private final long targetSize;

Review Comment:
   nit: This is `maxSize`



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