You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "JingsongLi (via GitHub)" <gi...@apache.org> on 2024/04/29 12:30:36 UTC

Re: [PR] [compaction] Filter out invalid splits to improve flink database compaction efficiency [paimon]

JingsongLi commented on code in PR #3233:
URL: https://github.com/apache/paimon/pull/3233#discussion_r1583013682


##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/operator/MultiTablesBatchCompactorSourceFunction.java:
##########
@@ -81,8 +83,19 @@ public void run(SourceContext<Tuple2<Split, String>> ctx) throws Exception {
                     for (Map.Entry<Identifier, StreamTableScan> entry : scansMap.entrySet()) {
                         Identifier identifier = entry.getKey();
                         StreamTableScan scan = entry.getValue();
+                        int maxLevel = ((InnerStreamTableScanImpl) scan).options().numLevels() - 1;
                         splits.addAll(
                                 scan.plan().splits().stream()
+                                        .filter(
+                                                split -> {
+                                                    DataSplit dataSplit = (DataSplit) split;
+                                                    if (dataSplit.dataFiles().isEmpty()) {
+                                                        return false;
+                                                    }
+                                                    return dataSplit.dataFiles().stream()
+                                                            .map(DataFileMeta::level)
+                                                            .anyMatch(level -> level != maxLevel);

Review Comment:
   Why filter maxLevel?



-- 
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-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org