You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2021/06/09 03:04:11 UTC

[iotdb] branch add-java-doc updated: add java docs for cache, queryContext, PartialPath, SeriesReader

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

jackietien pushed a commit to branch add-java-doc
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/add-java-doc by this push:
     new f70b5e4  add java docs for cache, queryContext, PartialPath, SeriesReader
f70b5e4 is described below

commit f70b5e4e5fa0591a8e054f9162bf1e8878e2e624
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Wed Jun 9 11:02:04 2021 +0800

    add java docs for cache, queryContext, PartialPath, SeriesReader
---
 .../apache/iotdb/db/engine/cache/ChunkCache.java   |  5 +++++
 .../db/engine/cache/TimeSeriesMetadataCache.java   | 13 ++++++++++++
 .../db/engine/querycontext/QueryDataSource.java    |  5 +++++
 .../db/engine/querycontext/ReadOnlyMemChunk.java   |  4 ++++
 .../iotdb/db/metadata/VectorPartialPath.java       |  6 ++++++
 .../iotdb/db/query/reader/series/SeriesReader.java | 24 ++++++++++++++++++++++
 6 files changed, 57 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/cache/ChunkCache.java b/server/src/main/java/org/apache/iotdb/db/engine/cache/ChunkCache.java
index 556075f..6a126cf 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/cache/ChunkCache.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/cache/ChunkCache.java
@@ -63,6 +63,11 @@ public class ChunkCache {
     lruCache =
         new LRULinkedHashMap<ChunkMetadata, Chunk>(MEMORY_THRESHOLD_IN_CHUNK_CACHE) {
 
+          /**
+           * The calculation is time consuming, so we won't calculate each entry' size each time.
+           * Every 100,000 entry, we will calculate the average size of the first 10 entries, and
+           * use that to represent the next 99,990 entries' size.
+           */
           @Override
           protected long calEntrySize(ChunkMetadata key, Chunk value) {
             long currentSize;
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
index 123fe97..66e3974 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
@@ -81,6 +81,11 @@ public class TimeSeriesMetadataCache {
         new LRULinkedHashMap<TimeSeriesMetadataCacheKey, TimeseriesMetadata>(
             MEMORY_THRESHOLD_IN_TIME_SERIES_METADATA_CACHE) {
 
+          /**
+           * The calculation is time consuming, so we won't calculate each entry' size each time.
+           * Every 100,000 entry, we will calculate the average size of the first 10 entries, and
+           * use that to represent the next 99,990 entries' size.
+           */
           @Override
           protected long calEntrySize(TimeSeriesMetadataCacheKey key, TimeseriesMetadata value) {
             long currentSize;
@@ -226,6 +231,14 @@ public class TimeSeriesMetadataCache {
     }
   }
 
+  /**
+   * Support for vector
+   *
+   * @param key vector's own fullPath, e.g. root.sg1.d1.vector
+   * @param subSensorList all subSensors of this vector in one query, e.g. [s1, s2, s3]
+   * @param allSensors all sensors of the device in one device, to vector, this should contain both
+   *     vector name and subSensors' name, e.g. [vector, s1, s2, s3]
+   */
   // Suppress synchronize warning
   // Suppress high Cognitive Complexity warning
   @SuppressWarnings({"squid:S1860", "squid:S3776"})
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/querycontext/QueryDataSource.java b/server/src/main/java/org/apache/iotdb/db/engine/querycontext/QueryDataSource.java
index 60a6de5..dea19eb 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/querycontext/QueryDataSource.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/querycontext/QueryDataSource.java
@@ -26,7 +26,12 @@ import org.apache.iotdb.tsfile.read.filter.operator.AndFilter;
 
 import java.util.List;
 
+/**
+ * The QueryDataSource contains all the seq and unseq TsFileResources for one timeseries in one
+ * query
+ */
 public class QueryDataSource {
+
   private List<TsFileResource> seqResources;
   private List<TsFileResource> unseqResources;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/querycontext/ReadOnlyMemChunk.java b/server/src/main/java/org/apache/iotdb/db/engine/querycontext/ReadOnlyMemChunk.java
index d3b5029..e7e83db 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/querycontext/ReadOnlyMemChunk.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/querycontext/ReadOnlyMemChunk.java
@@ -42,6 +42,10 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+/**
+ * ReadOnlyMemChunk is a snapshot of the working MemTable and flushing memtable in the memory used
+ * for querying
+ */
 public class ReadOnlyMemChunk {
 
   // deletion list for this chunk
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/VectorPartialPath.java b/server/src/main/java/org/apache/iotdb/db/metadata/VectorPartialPath.java
index b4cdcc4..65ef534 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/VectorPartialPath.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/VectorPartialPath.java
@@ -24,6 +24,12 @@ import org.apache.iotdb.db.exception.metadata.IllegalPathException;
 import java.util.List;
 import java.util.Objects;
 
+/**
+ * VectorPartialPath represents a vector's fullPath. It not only contains the full path of vector's
+ * own name, but also has subSensorsPathList which contain all the fullPath of vector's sub sensors.
+ * e.g. VectorPartialPath1(root.sg1.d1.vector1, [root.sg1.d1.vector1.s1, root.sg1.d1.vector1.s2])
+ * VectorPartialPath2(root.sg1.d1.vector2, [root.sg1.d1.vector2.s1, root.sg1.d1.vector2.s2])
+ */
 public class VectorPartialPath extends PartialPath {
 
   private List<PartialPath> subSensorsPathList;
diff --git a/server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesReader.java b/server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesReader.java
index e4e0894..8589b95 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesReader.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesReader.java
@@ -112,6 +112,30 @@ public class SeriesReader {
   protected boolean hasCachedNextOverlappedPage;
   protected BatchData cachedBatchData;
 
+  /**
+   * @param seriesPath For querying vector, the seriesPath should be VectorPartialPath. If the query
+   *     is raw query without value filter, all sensors belonging to one vector should be all in
+   *     this one VectorPartialPath's subSensorsPathList, VectorPartialPath's own fullPath
+   *     represents the name of vector itself. Other queries, each sensor in one vector will have
+   *     its own SeriesReader, seriesPath's subSensorsPathList contains only one sensor.
+   * @param allSensors For querying vector, allSensors contains vector name and all subSensors'
+   *     names in the seriesPath
+   *     <p>e.g. we have two vectors: root.sg1.d1.vector1(s1, s2) and root.sg1.d1.vector2(s1, s2),
+   *     If the sql is select * from root, we will construct two SeriesReader, The first one's
+   *     seriesPath is VectorPartialPath(root.sg1.d1.vector1, [root.sg1.d1.vector1.s1,
+   *     root.sg1.d1.vector1.s2]) The first one's allSensors is [vector1, s1, s2] The second one's
+   *     seriesPath is VectorPartialPath(root.sg1.d1.vector2, [root.sg1.d1.vector2.s1,
+   *     root.sg1.d1.vector2.s2]) The second one's allSensors is [vector2, s1, s2]
+   *     <p>If the sql is not RawQueryWithoutValueFilter, like select count(*) from root group by
+   *     ([1, 100), 5ms), we will construct four SeriesReader The first one's seriesPath is
+   *     VectorPartialPath(root.sg1.d1.vector1, [root.sg1.d1.vector1.s1]) The first one's allSensors
+   *     is [vector1, s1] The second one's seriesPath is VectorPartialPath(root.sg1.d1.vector1,
+   *     [root.sg1.d1.vector1.s2]) The second one's allSensors is [vector1, s2] The third one's
+   *     seriesPath is VectorPartialPath(root.sg1.d1.vector2, [root.sg1.d1.vector2.s1]) The third
+   *     one's allSensors is [vector2, s1] The fourth one's seriesPath is
+   *     VectorPartialPath(root.sg1.d1.vector2, [root.sg1.d1.vector2.s2]) The fourth one's
+   *     allSensors is [vector2, s2]
+   */
   public SeriesReader(
       PartialPath seriesPath,
       Set<String> allSensors,