aokolnychyi commented on code in PR #2276: URL: https://github.com/apache/iceberg/pull/2276#discussion_r1016121148
########## core/src/main/java/org/apache/iceberg/util/TableScanUtil.java: ########## @@ -128,6 +137,66 @@ public static <T extends ScanTask> CloseableIterable<ScanTaskGroup<T>> planTaskG combinedTasks -> new BaseScanTaskGroup<>(mergeTasks(combinedTasks))); } + @SuppressWarnings("unchecked") + public static <T extends PartitionScanTask> List<ScanTaskGroup<T>> planTaskGroups( + List<T> tasks, + long splitSize, + int lookback, + long openFileCost, + Types.StructType projectedPartitionType) { + + Preconditions.checkArgument(splitSize > 0, "Invalid split size (negative or 0): %s", splitSize); + Preconditions.checkArgument( + lookback > 0, "Invalid split planning lookback (negative or 0): %s", lookback); + Preconditions.checkArgument( + openFileCost >= 0, "Invalid file open cost (negative): %s", openFileCost); + + List<T> splitTasks = Lists.newArrayList(); Review Comment: What about skipping this temporary list and simply checking if a task is splittable in the for loop below? All of this will be held in the driver memory and I am a bit paranoid about using extra space. ``` if (task instanceof SplittableScanTask<?>) { SplittableScanTask<? extends T> splittableTask = (SplittableScanTask<? extends T>) task; Iterables.addAll(sameKeyTasks, splittableTask.split(splitSize)); } else { sameKeyTasks.add(task); } ``` -- 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