aokolnychyi commented on code in PR #5077:
URL: https://github.com/apache/iceberg/pull/5077#discussion_r906871197
##########
core/src/main/java/org/apache/iceberg/util/TableScanUtil.java:
##########
@@ -78,4 +83,57 @@ public static CloseableIterable<CombinedScanTask>
planTasks(CloseableIterable<Fi
splitFiles),
BaseCombinedScanTask::new);
}
+
+ public static <T extends SplittableScanTask<T>>
CloseableIterable<ScanTaskGroup<T>> planTaskGroups(
+ CloseableIterable<T> tasks,
+ long splitSize, int lookback, long openFileCost) {
+
+ 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);
+
+ // capture manifests which can be closed after scan planning
+ CloseableIterable<T> splitTasks = CloseableIterable.combine(
+ FluentIterable.from(tasks).transformAndConcat(input ->
input.split(splitSize)),
Review Comment:
This is done.
##########
core/src/main/java/org/apache/iceberg/util/TableScanUtil.java:
##########
@@ -78,4 +83,57 @@ public static CloseableIterable<CombinedScanTask>
planTasks(CloseableIterable<Fi
splitFiles),
BaseCombinedScanTask::new);
}
+
+ public static <T extends SplittableScanTask<T>>
CloseableIterable<ScanTaskGroup<T>> planTaskGroups(
+ CloseableIterable<T> tasks,
+ long splitSize, int lookback, long openFileCost) {
+
+ 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);
+
+ // capture manifests which can be closed after scan planning
+ CloseableIterable<T> splitTasks = CloseableIterable.combine(
+ FluentIterable.from(tasks).transformAndConcat(input ->
input.split(splitSize)),
+ tasks);
+
+ Function<T, Long> weightFunc = task -> Math.max(task.totalSizeBytes(),
task.totalFilesCount() * openFileCost);
Review Comment:
Done.
--
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]