pvary commented on code in PR #14837:
URL: https://github.com/apache/iceberg/pull/14837#discussion_r2619555243
##########
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 maxSize;
public ListPacker(long targetWeight, int lookback, boolean
largestBinFirst) {
+ this(targetWeight, lookback, largestBinFirst, Long.MAX_VALUE);
+ }
+
+ public ListPacker(long targetWeight, int lookback, boolean
largestBinFirst, long maxSize) {
this.targetWeight = targetWeight;
this.lookback = lookback;
this.largestBinFirst = largestBinFirst;
+ this.maxSize = maxSize;
}
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,
+ maxSize),
Review Comment:
nit: maxItemPerBin
--
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]