WinkerDu commented on a change in pull request #3073:
URL: https://github.com/apache/iceberg/pull/3073#discussion_r703695049
##########
File path: core/src/main/java/org/apache/iceberg/util/BinPacking.java
##########
@@ -169,19 +179,21 @@ public boolean hasNext() {
private static class Bin<T> {
private final long targetWeight;
+ private final int itemsPerBin;
private final List<T> items = Lists.newArrayList();
private long binWeight = 0L;
- Bin(long targetWeight) {
+ Bin(long targetWeight, int itemsPerBin) {
this.targetWeight = targetWeight;
+ this.itemsPerBin = itemsPerBin;
}
List<T> items() {
return items;
}
boolean canAdd(long weight) {
- return binWeight + weight <= targetWeight;
+ return binWeight + weight <= targetWeight && items.size() <= itemsPerBin;
Review comment:
OK, I will push a new commit to do this with UT case
--
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]