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 2020/07/07 06:28:26 UTC

[incubator-iotdb] branch TyShowTimeSeries updated (d8b7d78 -> 75b3523)

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

jackietien pushed a change to branch TyShowTimeSeries
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.


    from d8b7d78  Merge pull request #1455 from SailVR/master
     new cc272f9  lack docs
     new f9c64ec  add some docs
     new 75b3523  add english docs

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 docs/SystemDesign/SchemaManager/SchemaManager.md   | 47 +++++++++++++++++++
 .../zh/SystemDesign/SchemaManager/SchemaManager.md | 43 ++++++++++++++++++
 .../java/org/apache/iotdb/db/metadata/MTree.java   | 52 +++++++++++-----------
 .../db/qp/physical/sys/ShowTimeSeriesPlan.java     | 10 +++++
 .../db/query/dataset/ShowTimeseriesDataSet.java    | 13 ++++--
 .../org/apache/iotdb/db/service/TSServiceImpl.java | 35 +++++++++++++--
 .../java/org/apache/iotdb/db/utils/QueryUtils.java |  3 ++
 7 files changed, 170 insertions(+), 33 deletions(-)


[incubator-iotdb] 01/03: lack docs

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit cc272f925f0d02e81bda92fa8ec7026ced4b5c37
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Mon Jul 6 09:33:30 2020 +0800

    lack docs
---
 .../zh/SystemDesign/SchemaManager/SchemaManager.md |  3 ++
 .../java/org/apache/iotdb/db/metadata/MTree.java   | 52 +++++++++++-----------
 .../db/qp/physical/sys/ShowTimeSeriesPlan.java     | 10 +++++
 .../db/query/dataset/ShowTimeseriesDataSet.java    |  4 +-
 .../org/apache/iotdb/db/service/TSServiceImpl.java | 35 +++++++++++++--
 .../java/org/apache/iotdb/db/utils/QueryUtils.java |  3 ++
 6 files changed, 76 insertions(+), 31 deletions(-)

diff --git a/docs/zh/SystemDesign/SchemaManager/SchemaManager.md b/docs/zh/SystemDesign/SchemaManager/SchemaManager.md
index ff948b9..7dd5981 100644
--- a/docs/zh/SystemDesign/SchemaManager/SchemaManager.md
+++ b/docs/zh/SystemDesign/SchemaManager/SchemaManager.md
@@ -280,3 +280,6 @@ IoTDB 的元数据管理采用目录树的形式,倒数第二层为设备层
 
 > tagsSize (tag1=v1, tag2=v2) attributesSize (attr1=v1, attr2=v2)
 
+## 元数据查询
+
+### 
\ No newline at end of file
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
index 5136124..d847041 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
@@ -102,12 +102,12 @@ public class MTree implements Serializable {
    * Create a timeseries with a full path from root to leaf node Before creating a timeseries, the
    * storage group should be set first, throw exception otherwise
    *
-   * @param path timeseries path
-   * @param dataType data type
-   * @param encoding encoding
+   * @param path       timeseries path
+   * @param dataType   data type
+   * @param encoding   encoding
    * @param compressor compressor
-   * @param props props
-   * @param alias alias of measurement
+   * @param props      props
+   * @param alias      alias of measurement
    */
   MeasurementMNode createTimeseries(
       String path,
@@ -650,7 +650,7 @@ public class MTree implements Serializable {
     }
     List<String[]> allMatchedNodes = new ArrayList<>();
 
-    findPath(root, nodes, 1, "", allMatchedNodes, false, true);
+    findPath(root, nodes, 1, allMatchedNodes, false, true);
 
     Stream<String[]> sortedStream = allMatchedNodes.stream().sorted(
         Comparator.comparingLong((String[] s) -> Long.parseLong(s[7])).reversed()
@@ -682,10 +682,10 @@ public class MTree implements Serializable {
     count.set(0);
     if (offset.get() != 0 || limit.get() != 0) {
       res = new LinkedList<>();
-      findPath(root, nodes, 1, "", res, true, false);
+      findPath(root, nodes, 1, res, true, false);
     } else {
       res = new LinkedList<>();
-      findPath(root, nodes, 1, "", res, false, false);
+      findPath(root, nodes, 1, res, false, false);
     }
     // avoid memory leaks
     limit.remove();
@@ -698,13 +698,12 @@ public class MTree implements Serializable {
   /**
    * Iterate through MTree to fetch metadata info of all leaf nodes under the given seriesPath
    *
-   * @param needLast if false, lastTimeStamp in timeseriesSchemaList will be null
+   * @param needLast             if false, lastTimeStamp in timeseriesSchemaList will be null
    * @param timeseriesSchemaList List<timeseriesSchema> result: [name, alias, storage group,
-   * dataType, encoding, compression, offset, lastTimeStamp]
+   *                             dataType, encoding, compression, offset, lastTimeStamp]
    */
-  private void findPath(MNode node, String[] nodes, int idx, String parent,
-      List<String[]> timeseriesSchemaList, boolean hasLimit, boolean needLast)
-      throws MetadataException {
+  private void findPath(MNode node, String[] nodes, int idx, List<String[]> timeseriesSchemaList,
+      boolean hasLimit, boolean needLast) throws MetadataException {
     if (node instanceof MeasurementMNode && nodes.length <= idx) {
       if (hasLimit) {
         curOffset.set(curOffset.get() + 1);
@@ -718,7 +717,7 @@ public class MTree implements Serializable {
       } else {
         nodeName = node.getName();
       }
-      String nodePath = parent + nodeName;
+      String nodePath = node.getParent().getFullPath() + nodeName;
       String[] tsRow = new String[8];
       tsRow[0] = nodePath;
       tsRow[1] = ((MeasurementMNode) node).getAlias();
@@ -738,16 +737,19 @@ public class MTree implements Serializable {
     String nodeReg = MetaUtils.getNodeRegByIdx(idx, nodes);
     if (!nodeReg.contains(PATH_WILDCARD)) {
       if (node.hasChild(nodeReg)) {
-        findPath(node.getChild(nodeReg), nodes, idx + 1, parent + node.getName() + PATH_SEPARATOR,
-            timeseriesSchemaList, hasLimit, needLast);
+        findPath(node.getChild(nodeReg), nodes, idx + 1, timeseriesSchemaList, hasLimit, needLast);
       }
     } else {
       for (MNode child : node.getChildren().values()) {
         if (!Pattern.matches(nodeReg.replace("*", ".*"), child.getName())) {
           continue;
         }
-        findPath(child, nodes, idx + 1, parent + node.getName() + PATH_SEPARATOR,
-            timeseriesSchemaList, hasLimit, needLast);
+        findPath(child, nodes, idx + 1, timeseriesSchemaList, hasLimit, needLast);
+        if (hasLimit) {
+          if (count.get().intValue() == limit.get().intValue()) {
+            return;
+          }
+        }
       }
     }
   }
@@ -788,11 +790,11 @@ public class MTree implements Serializable {
   /**
    * Traverse the MTree to match all child node path in next level
    *
-   * @param node the current traversing node
-   * @param nodes split the prefix path with '.'
-   * @param idx the current index of array nodes
+   * @param node   the current traversing node
+   * @param nodes  split the prefix path with '.'
+   * @param idx    the current index of array nodes
    * @param parent store the node string having traversed
-   * @param res store all matched device names
+   * @param res    store all matched device names
    * @param length expected length of path
    */
   private void findChildNodePathInNextLevel(
@@ -848,10 +850,10 @@ public class MTree implements Serializable {
   /**
    * Traverse the MTree to match all devices with prefix path.
    *
-   * @param node the current traversing node
+   * @param node  the current traversing node
    * @param nodes split the prefix path with '.'
-   * @param idx the current index of array nodes
-   * @param res store all matched device names
+   * @param idx   the current index of array nodes
+   * @param res   store all matched device names
    */
   private void findDevices(MNode node, String[] nodes, int idx, Set<String> res) {
     String nodeReg = MetaUtils.getNodeRegByIdx(idx, nodes);
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowTimeSeriesPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowTimeSeriesPlan.java
index 0740870..78bf51c 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowTimeSeriesPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowTimeSeriesPlan.java
@@ -36,6 +36,8 @@ public class ShowTimeSeriesPlan extends ShowPlan {
   // if is true, the result will be sorted according to the inserting frequency of the timeseries
   private boolean orderByHeat;
 
+  private boolean hasLimit;
+
   public ShowTimeSeriesPlan(Path path) {
     super(ShowContentType.TIMESERIES);
     this.path = path;
@@ -97,6 +99,14 @@ public class ShowTimeSeriesPlan extends ShowPlan {
     this.orderByHeat = orderByHeat;
   }
 
+  public boolean hasLimit() {
+    return hasLimit;
+  }
+
+  public void setHasLimit(boolean hasLimit) {
+    this.hasLimit = hasLimit;
+  }
+
   @Override
   public void serialize(DataOutputStream outputStream) throws IOException {
     outputStream.write(PhysicalPlanType.SHOW_TIMESERIES.ordinal());
diff --git a/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowTimeseriesDataSet.java b/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowTimeseriesDataSet.java
index 403a3f7..128f40b 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowTimeseriesDataSet.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowTimeseriesDataSet.java
@@ -32,10 +32,10 @@ import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
 
 public class ShowTimeseriesDataSet extends QueryDataSet {
 
-  private ShowTimeSeriesPlan plan;
+  private final ShowTimeSeriesPlan plan;
   private List<RowRecord> result = new ArrayList<>();
   private int index = 0;
-  public static boolean hasLimit;
+  public boolean hasLimit;
 
   public ShowTimeseriesDataSet(List<Path> paths,
       List<TSDataType> dataTypes, ShowTimeSeriesPlan showTimeSeriesPlan) {
diff --git a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index 19f668b..5fa8ea4 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -81,7 +81,6 @@ import org.apache.iotdb.db.query.control.TracingManager;
 import org.apache.iotdb.db.query.dataset.AlignByDeviceDataSet;
 import org.apache.iotdb.db.query.dataset.NonAlignEngineDataSet;
 import org.apache.iotdb.db.query.dataset.RawQueryDataSetWithoutValueFilter;
-import org.apache.iotdb.db.query.dataset.ShowTimeseriesDataSet;
 import org.apache.iotdb.db.tools.watermark.GroupedLSBWatermarkEncoder;
 import org.apache.iotdb.db.tools.watermark.WatermarkEncoder;
 import org.apache.iotdb.db.utils.FilePathUtils;
@@ -89,7 +88,35 @@ import org.apache.iotdb.db.utils.QueryDataSetUtils;
 import org.apache.iotdb.db.utils.SchemaUtils;
 import org.apache.iotdb.rpc.RpcUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
-import org.apache.iotdb.service.rpc.thrift.*;
+import org.apache.iotdb.service.rpc.thrift.ServerProperties;
+import org.apache.iotdb.service.rpc.thrift.TSCancelOperationReq;
+import org.apache.iotdb.service.rpc.thrift.TSCloseOperationReq;
+import org.apache.iotdb.service.rpc.thrift.TSCloseSessionReq;
+import org.apache.iotdb.service.rpc.thrift.TSCreateMultiTimeseriesReq;
+import org.apache.iotdb.service.rpc.thrift.TSCreateTimeseriesReq;
+import org.apache.iotdb.service.rpc.thrift.TSDeleteDataReq;
+import org.apache.iotdb.service.rpc.thrift.TSExecuteBatchStatementReq;
+import org.apache.iotdb.service.rpc.thrift.TSExecuteStatementReq;
+import org.apache.iotdb.service.rpc.thrift.TSExecuteStatementResp;
+import org.apache.iotdb.service.rpc.thrift.TSFetchMetadataReq;
+import org.apache.iotdb.service.rpc.thrift.TSFetchMetadataResp;
+import org.apache.iotdb.service.rpc.thrift.TSFetchResultsReq;
+import org.apache.iotdb.service.rpc.thrift.TSFetchResultsResp;
+import org.apache.iotdb.service.rpc.thrift.TSGetTimeZoneResp;
+import org.apache.iotdb.service.rpc.thrift.TSIService;
+import org.apache.iotdb.service.rpc.thrift.TSInsertRecordReq;
+import org.apache.iotdb.service.rpc.thrift.TSInsertRecordsReq;
+import org.apache.iotdb.service.rpc.thrift.TSInsertStringRecordReq;
+import org.apache.iotdb.service.rpc.thrift.TSInsertStringRecordsReq;
+import org.apache.iotdb.service.rpc.thrift.TSInsertTabletReq;
+import org.apache.iotdb.service.rpc.thrift.TSInsertTabletsReq;
+import org.apache.iotdb.service.rpc.thrift.TSOpenSessionReq;
+import org.apache.iotdb.service.rpc.thrift.TSOpenSessionResp;
+import org.apache.iotdb.service.rpc.thrift.TSProtocolVersion;
+import org.apache.iotdb.service.rpc.thrift.TSQueryDataSet;
+import org.apache.iotdb.service.rpc.thrift.TSQueryNonAlignDataSet;
+import org.apache.iotdb.service.rpc.thrift.TSSetTimeZoneReq;
+import org.apache.iotdb.service.rpc.thrift.TSStatus;
 import org.apache.iotdb.tsfile.exception.filter.QueryFilterOptimizationException;
 import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
@@ -530,9 +557,9 @@ public class TSServiceImpl implements TSIService.Iface, ServerContext {
         //If the user does not pass the limit, then set limit = fetchSize and haslimit=false,else set haslimit = true
         if (((ShowTimeSeriesPlan) plan).getLimit() == 0) {
           ((ShowTimeSeriesPlan) plan).setLimit(fetchSize);
-          ShowTimeseriesDataSet.hasLimit = false;
+          ((ShowTimeSeriesPlan) plan).setHasLimit(false);
         } else {
-          ShowTimeseriesDataSet.hasLimit = true;
+          ((ShowTimeSeriesPlan) plan).setHasLimit(true);
         }
       }
       if (plan instanceof QueryPlan && !((QueryPlan) plan).isAlignByTime()) {
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/QueryUtils.java b/server/src/main/java/org/apache/iotdb/db/utils/QueryUtils.java
index ca74ea3..d3c38c7 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/QueryUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/QueryUtils.java
@@ -150,6 +150,9 @@ public class QueryUtils {
     constructPathAndDataTypes(paths, dataTypes, timeseriesList);
     ShowTimeseriesDataSet showTimeseriesDataSet = new ShowTimeseriesDataSet(paths, dataTypes,
         showTimeSeriesPlan);
+
+    showTimeseriesDataSet.hasLimit = showTimeSeriesPlan.hasLimit();
+
     for (ShowTimeSeriesResult result : timeseriesList) {
       RowRecord record = new RowRecord(0);
       updateRecord(record, result.getName());


[incubator-iotdb] 03/03: add english docs

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 75b3523ba2c2b4b3cbc748d4fdb835f3a88dd6a3
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Tue Jul 7 14:28:10 2020 +0800

    add english docs
---
 docs/SystemDesign/SchemaManager/SchemaManager.md   | 47 ++++++++++++++++++++++
 .../zh/SystemDesign/SchemaManager/SchemaManager.md | 32 +++++++++++++--
 .../db/query/dataset/ShowTimeseriesDataSet.java    |  9 ++++-
 3 files changed, 83 insertions(+), 5 deletions(-)

diff --git a/docs/SystemDesign/SchemaManager/SchemaManager.md b/docs/SystemDesign/SchemaManager/SchemaManager.md
index 78812c1..b7125e2 100644
--- a/docs/SystemDesign/SchemaManager/SchemaManager.md
+++ b/docs/SystemDesign/SchemaManager/SchemaManager.md
@@ -282,3 +282,50 @@ All timeseries tag/attribute information will be saved in the tag file, which de
 
 > tagsSize (tag1=v1, tag2=v2) attributesSize (attr1=v1, attr2=v2)
 
+## Metadata Query
+
+### show timeseries without index
+
+The main logic of query is in the `showTimeseries(ShowTimeSeriesPlan plan)` function of `MManager`
+
+First of all, we should judge whether we need to order by heat, if so, call the `getAllMeasurementSchemaByHeatOrder` function of `MTree`. Otherwise, call the `getAllMeasurementSchema` function.
+
+#### getAllMeasurementSchemaByHeatOrder
+
+The heat here is represented by the `lastTimeStamp` of each time series, so we need to fetch all the satisfied time series, and then order them by `lastTimeStamp`, cut them by `offset` and `limit`.
+
+#### getAllMeasurementSchema
+
+In this case, we need to pass the limit(if not exists, set fetch size as limit) and offset to the function `findPath` to reduce the memory footprint.
+
+#### findPath
+
+It's a recursive function to get all the statisfied MNode in MTree from root until the number of timeseris list has reached limit or all the MTree has been traversed.
+
+### show timeseries with index
+
+The filter condition here can only be tag attribute, or it will throw an exception.
+
+We can fetch all the satisfied `MeasurementMNode` through the inverted tag index in MTree fast without traversing the whole tree.
+
+If the result needs to be ordered by heat, we should sort them by the order of `lastTimeStamp` or by the natural order, and then we will trim the result by limit and offset.
+
+### ShowTimeseries Dataset
+
+If there is too much metadata , one whole `show timeseris` processing will cause OOM, so we need to add a `fetch size` parameter.
+
+While the client interacting with the server, it will get at most `fetch_size` records once.
+
+And the intermediate state will be saved in the `ShowTimeseriesDataSet`. The `queryId -> ShowTimeseriesDataSet` key-value pair will be saved in `TsServieImpl`.
+
+In `ShowTimeseriesDataSet`, we saved the `ShowTimeSeriesPlan`, current cursor `index` and cached result list `List<RowRecord> result`.
+
+* judge whether the cursor `index`is equal to the size of `List<RowRecord> result`
+    * if so, call the corresponding method in MManager to fetch result and put them into cache.
+        * if it is a query without index, call the method `showTimeseries`
+        * if it is a query with index, call the method `getAllTimeseriesSchema`
+        * we need to update the offset in plan each time we call the method in MManger to fetch result, we should add it with `fetch size`.
+        * if`hasLimit` is `false`,the reset `index` to zero.
+    * if not
+        * if `index < result.size()`,return true
+        * if `index > result.size()`,return false 
\ No newline at end of file
diff --git a/docs/zh/SystemDesign/SchemaManager/SchemaManager.md b/docs/zh/SystemDesign/SchemaManager/SchemaManager.md
index 832f831..17f944f 100644
--- a/docs/zh/SystemDesign/SchemaManager/SchemaManager.md
+++ b/docs/zh/SystemDesign/SchemaManager/SchemaManager.md
@@ -286,7 +286,7 @@ IoTDB 的元数据管理采用目录树的形式,倒数第二层为设备层
 
 主要查询逻辑封装在`MManager`的`showTimeseries(ShowTimeSeriesPlan plan)`方法中
 
-* 首先判断需不需要根据热度排序,如果需要,则调用`MTree`的`getAllMeasurementSchemaByHeatOrder`方法,否则调用`getAllMeasurementSchema`方法
+首先判断需不需要根据热度排序,如果需要,则调用`MTree`的`getAllMeasurementSchemaByHeatOrder`方法,否则调用`getAllMeasurementSchema`方法
 
 #### getAllMeasurementSchemaByHeatOrder
 
@@ -294,6 +294,32 @@ IoTDB 的元数据管理采用目录树的形式,倒数第二层为设备层
 
 #### getAllMeasurementSchema
 
-这里需要
+这里需要在findPath的时候就将limit(如果没有limit,则将请求的fetchSize当成limit)和offset参数传递下去,减少内存占用。
 
-### 带过滤条件的元数据查询
\ No newline at end of file
+#### findPath
+
+这个方法封装了在MTree中遍历得到满足条件的时间序列的逻辑,是个递归方法,由根节点往下递归寻找,直到当前时间序列数量达到limit或者已经遍历完整个MTree。
+
+### 带过滤条件的元数据查询
+
+这里的过滤条件只能是tag属性,否则抛异常。
+
+通过在MManager中维护的tag的倒排索引,获得所有满足索引条件的`MeasurementMNode`。
+
+若需要根据热度排序,则根据`lastTimeStamp`进行排序,否则根据序列名的字母序排序,然后再做`offset`和`limit`的截断。
+
+### ShowTimeseries结果集
+
+如果元数据量过多,一次show timeseries的结果可能导致OOM,所以增加fetch size参数,客户端跟服务器端交互时,服务器端一次最多只会取fetch size个时间序列。
+
+多次交互的状态信息就存在`ShowTimeseriesDataSet`中。`ShowTimeseriesDataSet`中保存了此次的`ShowTimeSeriesPlan`,当前的游标`index`以及缓存的结果行列表`List<RowRecord> result`。
+
+* 判断游标`index`是否等于缓存的结果行`List<RowRecord> result`的size
+    * 若相等,则调用MManager中的相应的方法取结果,放入缓存
+        * 若是带过滤条件的元数据查询,则调用`getAllTimeseriesSchema`方法
+        * 若是不带过滤条件的元数据查询,则调用`showTimeseries`方法
+        * 需要相应的修改plan中的offset,将offset向前推fetch size大小
+        * 若`hasLimit`为`false`,则将index重新置为0
+    * 若不相等
+        * `index < result.size()`,返回true
+        * `index > result.size()`,返回false        
diff --git a/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowTimeseriesDataSet.java b/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowTimeseriesDataSet.java
index 128f40b..1b763cb 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowTimeseriesDataSet.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowTimeseriesDataSet.java
@@ -48,8 +48,13 @@ public class ShowTimeseriesDataSet extends QueryDataSet {
     if (index == result.size()) {
       plan.setOffset(plan.getOffset() + plan.getLimit());
       try {
-        List<ShowTimeSeriesResult> showTimeSeriesResults = MManager.getInstance()
-            .showTimeseries(plan);
+        List<ShowTimeSeriesResult> showTimeSeriesResults;
+        // show timeseries with index
+        if (plan.getKey() != null && plan.getValue() != null) {
+          showTimeSeriesResults = MManager.getInstance().getAllTimeseriesSchema(plan);
+        } else {
+          showTimeSeriesResults = MManager.getInstance().showTimeseries(plan);
+        }
         result = transferShowTimeSeriesResultToRecordList(showTimeSeriesResults);
         if (!hasLimit) {
           index = 0;


[incubator-iotdb] 02/03: add some docs

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f9c64ec9039ec09ebc2837d348b079670f3df4fc
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Tue Jul 7 09:46:04 2020 +0800

    add some docs
---
 docs/zh/SystemDesign/SchemaManager/SchemaManager.md | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/docs/zh/SystemDesign/SchemaManager/SchemaManager.md b/docs/zh/SystemDesign/SchemaManager/SchemaManager.md
index 7dd5981..832f831 100644
--- a/docs/zh/SystemDesign/SchemaManager/SchemaManager.md
+++ b/docs/zh/SystemDesign/SchemaManager/SchemaManager.md
@@ -282,4 +282,18 @@ IoTDB 的元数据管理采用目录树的形式,倒数第二层为设备层
 
 ## 元数据查询
 
-### 
\ No newline at end of file
+### 不带过滤条件的元数据查询
+
+主要查询逻辑封装在`MManager`的`showTimeseries(ShowTimeSeriesPlan plan)`方法中
+
+* 首先判断需不需要根据热度排序,如果需要,则调用`MTree`的`getAllMeasurementSchemaByHeatOrder`方法,否则调用`getAllMeasurementSchema`方法
+
+#### getAllMeasurementSchemaByHeatOrder
+
+这里的热度是用每个时间序列的`lastTimeStamp`来表征的,所以需要先取出所有满足条件的序列,然后根据`lastTimeStamp`进行排序,然后再做`offset`和`limit`的截断
+
+#### getAllMeasurementSchema
+
+这里需要
+
+### 带过滤条件的元数据查询
\ No newline at end of file