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

hui pushed a commit to branch QueryMetrics
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/QueryMetrics by this push:
     new bde550a473 fix PARTITION_FETCHER
bde550a473 is described below

commit bde550a473e8a7b6e8d411654cf73d8f9e562989
Author: Minghui Liu <[email protected]>
AuthorDate: Thu Nov 10 09:16:12 2022 +0800

    fix PARTITION_FETCHER
---
 .../iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java     | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
index 4ffedb91b8..d52b888107 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
@@ -196,13 +196,14 @@ public class AnalyzeVisitor extends 
StatementVisitor<Analysis, MPPQueryContext>
       logger.debug("[StartFetchSchema]");
       ISchemaTree schemaTree;
 
-      long t1 = System.nanoTime();
+      long startTime = System.nanoTime();
       if (queryStatement.isGroupByTag()) {
         schemaTree = schemaFetcher.fetchSchemaWithTags(patternTree);
       } else {
         schemaTree = schemaFetcher.fetchSchema(patternTree);
       }
-      QueryStatistics.getInstance().addCost(QueryStatistics.SCHEMA_FETCHER, 
System.nanoTime() - t1);
+      QueryStatistics.getInstance()
+          .addCost(QueryStatistics.SCHEMA_FETCHER, System.nanoTime() - 
startTime);
 
       logger.debug("[EndFetchSchema]");
       // If there is no leaf node in the schema tree, the query should be 
completed immediately
@@ -281,10 +282,7 @@ public class AnalyzeVisitor extends 
StatementVisitor<Analysis, MPPQueryContext>
       analyzeOutput(analysis, queryStatement, outputExpressions);
 
       // fetch partition information
-      long t2 = System.nanoTime();
       analyzeDataPartition(analysis, queryStatement, schemaTree);
-      QueryStatistics.getInstance()
-          .addCost(QueryStatistics.PARTITION_FETCHER, System.nanoTime() - t2);
 
     } catch (StatementAnalyzeException e) {
       logger.error("Meet error when analyzing the query statement: ", e);
@@ -370,7 +368,11 @@ public class AnalyzeVisitor extends 
StatementVisitor<Analysis, MPPQueryContext>
           .computeIfAbsent(schemaTree.getBelongedStorageGroup(devicePath), key 
-> new ArrayList<>())
           .add(queryParam);
     }
+
+    long startTime = System.nanoTime();
     DataPartition dataPartition = 
partitionFetcher.getDataPartition(sgNameToQueryParamsMap);
+    QueryStatistics.getInstance()
+        .addCost(QueryStatistics.PARTITION_FETCHER, System.nanoTime() - 
startTime);
     analysis.setDataPartitionInfo(dataPartition);
 
     return analysis;
@@ -1116,7 +1118,12 @@ public class AnalyzeVisitor extends 
StatementVisitor<Analysis, MPPQueryContext>
           .computeIfAbsent(schemaTree.getBelongedStorageGroup(devicePath), key 
-> new ArrayList<>())
           .add(queryParam);
     }
-    return partitionFetcher.getDataPartition(sgNameToQueryParamsMap);
+
+    long startTime = System.nanoTime();
+    DataPartition dataPartition = 
partitionFetcher.getDataPartition(sgNameToQueryParamsMap);
+    QueryStatistics.getInstance()
+        .addCost(QueryStatistics.PARTITION_FETCHER, System.nanoTime() - 
startTime);
+    return dataPartition;
   }
 
   private void analyzeInto(

Reply via email to