You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/10/08 07:41:55 UTC

[GitHub] [iotdb] HTHou commented on a diff in pull request #7527: [IOTDB-3656] mpp load supports tsfile with non-standard name

HTHou commented on code in PR #7527:
URL: https://github.com/apache/iotdb/pull/7527#discussion_r990606211


##########
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java:
##########
@@ -963,6 +963,20 @@ public static int compareFileName(TsFileResource o1, TsFileResource o2) {
     }
   }
 
+  public static int compareFileName(String fileName1, String fileName2) throws IOException {
+    TsFileNameGenerator.TsFileName tsFileName1 = TsFileNameGenerator.getTsFileName(fileName1);
+    TsFileNameGenerator.TsFileName tsFileName2 = TsFileNameGenerator.getTsFileName(fileName2);
+    long timeDiff = tsFileName1.getTime() - tsFileName2.getTime();
+    if (timeDiff != 0) {
+      return timeDiff < 0 ? -1 : 1;
+    }
+    long versionDiff = tsFileName1.getVersion() - tsFileName2.getVersion();
+    if (versionDiff != 0) {
+      return versionDiff < 0 ? -1 : 1;
+    }
+    return 0;
+  }
+

Review Comment:
   Add some annotations. 
   It is hard to understand the differences of `compareFileName(TsFileResource o1, TsFileResource o2)` method.



-- 
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: reviews-unsubscribe@iotdb.apache.org

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