aokolnychyi commented on code in PR #7565:
URL: https://github.com/apache/iceberg/pull/7565#discussion_r1194616509
##########
spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/actions/RewritePositionDeleteFilesSparkAction.java:
##########
@@ -319,33 +322,35 @@ private Result doExecuteWithPartialProgress(
.build();
}
- Stream<RewritePositionDeletesGroup> toGroupStream(
+ private Stream<RewritePositionDeletesGroup> toGroupStream(
RewriteExecutionContext ctx,
Map<StructLike, List<List<PositionDeletesScanTask>>> groupsByPartition) {
Stream<RewritePositionDeletesGroup> rewriteFileGroupStream =
groupsByPartition.entrySet().stream()
+ .filter(e -> e.getValue().size() != 0)
.flatMap(
e -> {
StructLike partition = e.getKey();
List<List<PositionDeletesScanTask>> scanGroups =
e.getValue();
- return scanGroups.stream()
- .map(
- tasks -> {
- int globalIndex = ctx.currentGlobalIndex();
- int partitionIndex =
ctx.currentPartitionIndex(partition);
- FileGroupInfo info =
-
ImmutableRewritePositionDeleteFiles.FileGroupInfo.builder()
- .globalIndex(globalIndex)
- .partitionIndex(partitionIndex)
- .partition(partition)
- .build();
- return new RewritePositionDeletesGroup(info,
tasks);
- });
+ return scanGroups.stream().map(tasks -> newRewriteGroup(ctx,
partition, tasks));
});
return
rewriteFileGroupStream.sorted(RewritePositionDeletesGroup.comparator(rewriteJobOrder));
Review Comment:
Optional: What about getting rid of the temp var completely?
```
return groupsByPartition.entrySet().stream()
.filter(...)
.flatMap(...)
.sorted(RewritePositionDeletesGroup.comparator(rewriteJobOrder));
```
--
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]