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 2020/03/02 13:35:15 UTC

[GitHub] [incubator-iotdb] wshao08 commented on a change in pull request #821: [IOTDB-298]Last time-value query

wshao08 commented on a change in pull request #821: [IOTDB-298]Last time-value query
URL: https://github.com/apache/incubator-iotdb/pull/821#discussion_r386394817
 
 

 ##########
 File path: server/src/main/java/org/apache/iotdb/db/utils/FileLoaderUtils.java
 ##########
 @@ -64,4 +72,40 @@ public static void updateTsFileResource(TsFileMetaData metaData, TsFileSequenceR
       }
     }
   }
+
+  public static List<ChunkMetaData> loadChunkMetadataFromTsFileResource(
+      TsFileResource resource, Path seriesPath, QueryContext context) throws IOException {
+    List<ChunkMetaData> currentChunkMetaDataList;
+    if (resource == null) {
+      return new ArrayList<>();
+    }
+    if (resource.isClosed()) {
+      currentChunkMetaDataList = DeviceMetaDataCache.getInstance().get(resource, seriesPath);
+    } else {
+      currentChunkMetaDataList = resource.getChunkMetaDataList();
+    }
+    List<Modification> pathModifications =
+        context.getPathModifications(resource.getModFile(), seriesPath.getFullPath());
+
+    if (!pathModifications.isEmpty()) {
+      QueryUtils.modifyChunkMetaData(currentChunkMetaDataList, pathModifications);
+    }
+
+    for (ChunkMetaData data : currentChunkMetaDataList) {
+      if (data.getChunkLoader() == null) {
+        TsFileSequenceReader tsFileSequenceReader =
+            FileReaderManager.getInstance().get(resource, resource.isClosed());
+        data.setChunkLoader(new DiskChunkLoader(tsFileSequenceReader));
+      }
 
 Review comment:
   removed

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services