You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ge...@apache.org on 2020/09/03 03:21:25 UTC

[incubator-iotdb] 01/01: Reduce unnecessary initialization

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

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

commit 6fd2f1d6874f777b8276c01c9718c4f936420022
Author: zhutianci <zh...@gmail.com>
AuthorDate: Thu Sep 3 11:21:06 2020 +0800

    Reduce unnecessary initialization
---
 .../iotdb/db/query/dataset/groupby/GroupByFillDataSet.java    | 11 +++--------
 .../org/apache/iotdb/db/query/executor/LastQueryExecutor.java | 11 +++--------
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java
index 9f9297a..6e5418d 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java
@@ -25,7 +25,6 @@ import java.util.List;
 import java.util.Map;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
 import org.apache.iotdb.db.metadata.PartialPath;
 import org.apache.iotdb.db.qp.physical.crud.GroupByTimeFillPlan;
@@ -92,13 +91,9 @@ public class GroupByFillDataSet extends QueryDataSet {
     Arrays.fill(lastTimeArray, Long.MAX_VALUE);
     for (int i = 0; i < paths.size(); i++) {
       TimeValuePair lastTimeValuePair;
-      try {
-        lastTimeValuePair = LastQueryExecutor.calculateLastPairForOneSeriesLocally(
-            new PartialPath(paths.get(i).getFullPath()), dataTypes.get(i), context,
-            groupByFillPlan.getAllMeasurementsInDevice(paths.get(i).getDevice()));
-      } catch (IllegalPathException e) {
-        throw new QueryProcessException(e.getMessage());
-      }
+      lastTimeValuePair = LastQueryExecutor.calculateLastPairForOneSeriesLocally(
+          (PartialPath) paths.get(i), dataTypes.get(i), context,
+          groupByFillPlan.getAllMeasurementsInDevice(paths.get(i).getDevice()));
       if (lastTimeValuePair.getValue() != null) {
         lastTimeArray[i] = lastTimeValuePair.getTimestamp();
       }
diff --git a/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java b/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
index b935536..44edf6f 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
@@ -30,7 +30,6 @@ import java.util.Set;
 import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
 import org.apache.iotdb.db.exception.metadata.MetadataException;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
 import org.apache.iotdb.db.metadata.PartialPath;
@@ -80,13 +79,9 @@ public class LastQueryExecutor {
 
     for (int i = 0; i < selectedSeries.size(); i++) {
       TimeValuePair lastTimeValuePair = null;
-      try {
-        lastTimeValuePair = calculateLastPairForOneSeries(
-                new PartialPath(selectedSeries.get(i).getFullPath()), dataTypes.get(i), context,
-                lastQueryPlan.getAllMeasurementsInDevice(selectedSeries.get(i).getDevice()));
-      } catch (IllegalPathException e) {
-        throw new QueryProcessException(e.getMessage());
-      }
+      lastTimeValuePair = calculateLastPairForOneSeries(
+              selectedSeries.get(i), dataTypes.get(i), context,
+              lastQueryPlan.getAllMeasurementsInDevice(selectedSeries.get(i).getDevice()));
       if (lastTimeValuePair.getValue() != null) {
         RowRecord resultRecord = new RowRecord(lastTimeValuePair.getTimestamp());
         Field pathField = new Field(TSDataType.TEXT);