You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/05/22 03:28:36 UTC

[GitHub] [flink-table-store] JingsongLi commented on a diff in pull request #132: [FLINK-27705] Prevent num-sorted-run.compaction-trigger from interfering num-levels

JingsongLi commented on code in PR #132:
URL: https://github.com/apache/flink-table-store/pull/132#discussion_r878787396


##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/mergetree/Levels.java:
##########
@@ -43,6 +43,16 @@ public class Levels {
 
     public Levels(Comparator<RowData> keyComparator, List<DataFileMeta> inputFiles, int numLevels) {
         this.keyComparator = keyComparator;
+
+        // in case the num of levels is not specified explicitly
+        numLevels =
+                Math.max(
+                        numLevels,
+                        inputFiles.stream()

Review Comment:
   NIT: We can extract a field here: `int restoreMaxLevel = ...`. The format of the java stream in the method parameters doesn't look very good.



##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/mergetree/Levels.java:
##########
@@ -43,6 +43,16 @@ public class Levels {
 
     public Levels(Comparator<RowData> keyComparator, List<DataFileMeta> inputFiles, int numLevels) {
         this.keyComparator = keyComparator;
+
+        // in case the num of levels is not specified explicitly
+        numLevels =
+                Math.max(
+                        numLevels,
+                        inputFiles.stream()
+                                        .map(DataFileMeta::level)

Review Comment:
   NIT: `.mapToInt().max()`



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

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