Alima777 commented on a change in pull request #1204:
URL: https://github.com/apache/incubator-iotdb/pull/1204#discussion_r435820792



##########
File path: server/src/main/java/org/apache/iotdb/db/utils/FilePathUtils.java
##########
@@ -46,4 +54,82 @@ public static String regularizePath(String filePath){
     return resource.getFile().getAbsolutePath().split(PATH_SPLIT_STRING);
   }
 
+  /**
+   * get paths from group by level, like root.sg1.d2.s0, root.sg1.d1.s1
+   * level=1, return [root.sg1, 0] and pathIndex turns to be [[0, root.sg1], 
[1, root.sg1]]
+   * @param rawPaths
+   * @param level
+   * @param pathIndex
+   * @return
+   */
+  public static Map<String, Long> getPathByLevel(List<Path> rawPaths, int 
level, Map<Integer, String> pathIndex) {
+    // pathGroupByLevel -> count
+    Map<String, Long> finalPaths = new TreeMap<>();
+
+    int i = 0;
+    for (Path value : rawPaths) {
+      String[] tmpPath = value.getFullPath().split("\\.");

Review comment:
       Hey, just like @qiaojialin said, you can reuse MetaUtils.getNodesName() 
method here~

##########
File path: 
server/src/main/java/org/apache/iotdb/db/qp/physical/crud/QueryPlan.java
##########
@@ -36,6 +36,8 @@
   private int rowLimit = 0;
   private int rowOffset = 0;
 
+  private int level = -1;

Review comment:
       I think this `level` parameter shouldn't be inserted here in Queryplan 
which is the base class. Maybe groupByTimePlan or AggregationPlan is better.

##########
File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
##########
@@ -549,7 +540,7 @@ private TSExecuteStatementResp 
internalExecuteQueryStatement(String statement,
         if (plan.getOperatorType() == OperatorType.FILL) {
           throw new QueryProcessException("Fill doesn't support disable align 
clause.");
         }
-        if (plan.getOperatorType() == OperatorType.GROUPBY) {
+        if (plan.getOperatorType() == GROUPBYTIME) {

Review comment:
       ```suggestion
           if (plan.getOperatorType() == OperatorType.GROUPBYTIME) {
   ```




----------------------------------------------------------------
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:
[email protected]


Reply via email to