You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2019/03/18 04:21:29 UTC

[GitHub] [incubator-iceberg] rdsr commented on a change in pull request #117: Sorts bin packing by weights in descending order

rdsr commented on a change in pull request #117: Sorts bin packing by weights in descending order
URL: https://github.com/apache/incubator-iceberg/pull/117#discussion_r266291162
 
 

 ##########
 File path: core/src/main/java/com/netflix/iceberg/util/BinPacking.java
 ##########
 @@ -107,7 +113,22 @@ public boolean hasNext() {
           bins.addLast(bin);
 
           if (bins.size() > lookback) {
-            return ImmutableList.copyOf(bins.removeFirst().items());
+            if (expensiveTaskFirst) {
+              Bin maxBin = null;
+
+              // Iterate through all bins looking for one with maximum weight, taking O(n) time.
+              for (Bin currBin : bins) {
 
 Review comment:
   This can probably be replaced by Collections.max(bins, (b1, b2) -> [compare body])

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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