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/03/29 01:41:03 UTC

[GitHub] [iotdb] liuminghui233 commented on a change in pull request #5364: Connect the Query Plan stage from SQL to DistributionPlan with UT and mock interfaces

liuminghui233 commented on a change in pull request #5364:
URL: https://github.com/apache/iotdb/pull/5364#discussion_r836981644



##########
File path: server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/SchemaTree.java
##########
@@ -36,12 +39,47 @@
   /**
    * Return all measurement paths for given path pattern and filter the result by slimit and offset.
    *
-   * @param pathPattern can be a pattern or a full path of timeseries.
+   * @param pathPattern   can be a pattern or a full path of timeseries.
    * @param isPrefixMatch if true, the path pattern is used to match prefix path
    * @return Left: all measurement paths; Right: remaining series offset
    */
   public Pair<List<MeasurementPath>, Integer> searchMeasurementPaths(
       PartialPath pathPattern, int slimit, int soffset, boolean isPrefixMatch) {
+    // TODO: (xingtanzjr) we mock some results here to test the whole procedure
+    try {
+      String[] paths = new String[]{
+          "root.sg.d1.s1",
+          "root.sg.d1.s2",
+          "root.sg.d22.s1",
+          "root.sg.d22.s2",
+          "root.sg.d333.s1",
+          "root.sg.d333.s2",
+      };
+
+      List<MeasurementPath> result = new ArrayList<>();
+      String target = pathPattern.getFullPath();
+      StringBuilder noStar = new StringBuilder();
+      boolean lastCharIsStar = false;
+      for(int i = 0 ; i < target.length(); i ++) {
+        char c = target.charAt(i);
+        if (c == '*' || (lastCharIsStar && c == '.')) {
+          lastCharIsStar = c == '*';
+          continue;
+        }
+        lastCharIsStar = false;
+        noStar.append(String.valueOf(c));
+      }
+
+      for (String path : paths) {
+        if (path.contains(noStar)) {
+          result.add(new MeasurementPath(path));

Review comment:
       ```suggestion
             result.add(new MeasurementPath(path, new MeasurementSchema(path.getMeasurement(), TSDataType.DOUBLE)));
   ```
   It is better to mock the data type as well.




-- 
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