You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2019/04/01 15:58:32 UTC

[incubator-iotdb] branch aggregate updated: rename some fields for better understanding

This is an automated email from the ASF dual-hosted git repository.

hxd pushed a commit to branch aggregate
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/aggregate by this push:
     new ffdb83b  rename some fields for better understanding
ffdb83b is described below

commit ffdb83bfba9ef041672b516784ad4c65b78162d3
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Sun Mar 31 21:37:52 2019 +0800

    rename some fields for better understanding
---
 .../query/reader/sequence/SealedTsFilesReader.java | 24 +++++++++++-----------
 .../java/org/apache/iotdb/db/utils/QueryUtils.java |  3 +++
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/iotdb/src/main/java/org/apache/iotdb/db/query/reader/sequence/SealedTsFilesReader.java b/iotdb/src/main/java/org/apache/iotdb/db/query/reader/sequence/SealedTsFilesReader.java
index 9d60a76..075fa08 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/query/reader/sequence/SealedTsFilesReader.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/query/reader/sequence/SealedTsFilesReader.java
@@ -47,7 +47,7 @@ public class SealedTsFilesReader implements IBatchReader, IAggregateReader {
 
   private Path seriesPath;
   private List<TsFileResource> sealedTsFiles;
-  private int usedIntervalFileIndex;
+  private int indexOfNextTsFileResource;
   private FileSeriesReader seriesReader;
   private Filter filter;
   private QueryContext context;
@@ -78,7 +78,7 @@ public class SealedTsFilesReader implements IBatchReader, IAggregateReader {
     }
     this.seriesPath = seriesPath;
     this.sealedTsFiles = sealedTsFiles;
-    this.usedIntervalFileIndex = 0;
+    this.indexOfNextTsFileResource = 0;
     this.seriesReader = null;
     this.context = context;
     this.isReverse = isReverse;
@@ -102,11 +102,11 @@ public class SealedTsFilesReader implements IBatchReader, IAggregateReader {
     }
 
     // init until reach a satisfied reader
-    while (usedIntervalFileIndex < sealedTsFiles.size()) {
+    while (indexOfNextTsFileResource < sealedTsFiles.size()) {
       // try to get next batch data from next reader
-      TsFileResource fileNode = sealedTsFiles.get(usedIntervalFileIndex++);
-      if (singleTsFileSatisfied(fileNode)) {
-        initSingleTsFileReader(fileNode, context);
+      TsFileResource tsfile = sealedTsFiles.get(indexOfNextTsFileResource++);
+      if (singleTsFileSatisfied(tsfile)) {
+        initSingleTsFileReader(tsfile, context);
       } else {
         continue;
       }
@@ -119,28 +119,28 @@ public class SealedTsFilesReader implements IBatchReader, IAggregateReader {
     return false;
   }
 
-  private boolean singleTsFileSatisfied(TsFileResource fileNode) {
+  private boolean singleTsFileSatisfied(TsFileResource tsfile) {
 
     if (filter == null) {
       return true;
     }
 
-    long startTime = fileNode.getStartTime(seriesPath.getDevice());
-    long endTime = fileNode.getEndTime(seriesPath.getDevice());
+    long startTime = tsfile.getStartTime(seriesPath.getDevice());
+    long endTime = tsfile.getEndTime(seriesPath.getDevice());
     return filter.satisfyStartEndTime(startTime, endTime);
   }
 
-  private void initSingleTsFileReader(TsFileResource fileNode, QueryContext context)
+  private void initSingleTsFileReader(TsFileResource tsfile, QueryContext context)
       throws IOException {
 
     // to avoid too many opened files
     TsFileSequenceReader tsFileReader = FileReaderManager.getInstance()
-        .get(fileNode.getFilePath(), true);
+        .get(tsfile.getFilePath(), true);
 
     MetadataQuerierByFileImpl metadataQuerier = new MetadataQuerierByFileImpl(tsFileReader);
     List<ChunkMetaData> metaDataList = metadataQuerier.getChunkMetaDataList(seriesPath);
 
-    List<Modification> pathModifications = context.getPathModifications(fileNode.getModFile(),
+    List<Modification> pathModifications = context.getPathModifications(tsfile.getModFile(),
         seriesPath.getFullPath());
     if (!pathModifications.isEmpty()) {
       QueryUtils.modifyChunkMetaData(metaDataList, pathModifications);
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/utils/QueryUtils.java b/iotdb/src/main/java/org/apache/iotdb/db/utils/QueryUtils.java
index 784abc0..8f6fe21 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/utils/QueryUtils.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/utils/QueryUtils.java
@@ -33,6 +33,9 @@ public class QueryUtils {
   /**
    * modifyChunkMetaData iterates the chunkMetaData and applies all available modifications on it to
    * generate a ModifiedChunkMetadata.
+   * <br/>
+   * the caller should guarantee that chunkMetaData and modifications refer to the same time series
+   * paths.
    * @param chunkMetaData the original chunkMetaData.
    * @param modifications all possible modifications.
    */