danielhumanmod commented on code in PR #1508:
URL: https://github.com/apache/polaris/pull/1508#discussion_r2072276023


##########
service/common/src/main/java/org/apache/polaris/service/task/TableCleanupTaskHandler.java:
##########
@@ -243,12 +243,13 @@ private Stream<TaskEntity> getMetadataTaskStream(
   private List<List<String>> getMetadataFileBatches(TableMetadata 
tableMetadata, int batchSize) {
     List<List<String>> result = new ArrayList<>();
     List<String> metadataFiles =
-        Stream.concat(
-                Stream.concat(
-                    tableMetadata.previousFiles().stream()
-                        .map(TableMetadata.MetadataLogEntry::file),
-                    
tableMetadata.snapshots().stream().map(Snapshot::manifestListLocation)),
-                
tableMetadata.statisticsFiles().stream().map(StatisticsFile::path))
+        Stream.of(
+                
tableMetadata.previousFiles().stream().map(TableMetadata.MetadataLogEntry::file),
+                
tableMetadata.snapshots().stream().map(Snapshot::manifestListLocation),
+                
tableMetadata.statisticsFiles().stream().map(StatisticsFile::path),
+                tableMetadata.partitionStatisticsFiles().stream()
+                    .map(PartitionStatisticsFile::path))
+            .flatMap(s -> s)

Review Comment:
   Good question. 
   1. what `tableMetadata.partitionStatisticsFiles()` return is `List<String>`
   2. The reason of is line is: Each call to `.stream().map(...)` is producing 
a `Stream<String>`, so by doing `Stream.of(...)`, we end up with a 
`Stream<Stream<String>>`. The `.flatMap(s -> s)` is there to flatten it all 
into one Stream<String> before filtering.



-- 
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]

Reply via email to