You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by su...@apache.org on 2020/03/12 08:34:50 UTC

[incubator-iotdb] 01/01: [IOTDB-553] Return Empty ResultSet when queried series doesn't exist

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

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

commit 54d0030cd3afeeefe9af1032333f57de3fb594c9
Author: samperson1997 <sz...@mails.tsinghua.edu.cn>
AuthorDate: Thu Mar 12 16:32:14 2020 +0800

    [IOTDB-553] Return Empty ResultSet when queried series doesn't exist
---
 .../org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java   |  4 ----
 .../iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java  |  4 ----
 .../main/java/org/apache/iotdb/db/service/TSServiceImpl.java | 12 +++++++-----
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java b/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
index e6629da..5df2ae0 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
@@ -279,10 +279,6 @@ public class PhysicalGenerator {
         measurementColumnList.addAll(measurementSetOfGivenSuffix);
       }
 
-      if (measurementColumnList.isEmpty()) {
-        throw new QueryProcessException("do not select any existing series");
-      }
-
       // slimit trim on the measurementColumnList
       if (queryOperator.hasSlimit()) {
         int seriesSlimit = queryOperator.getSeriesLimit();
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java b/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
index b188049..910f40e 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
@@ -302,10 +302,6 @@ public class ConcatPathOptimizer implements ILogicalOptimizer {
     for (int i = 0; i < paths.size(); i++) {
       try {
         List<String> actualPaths = executor.getAllPaths(paths.get(i).getFullPath());
-        if (actualPaths.isEmpty()) {
-          throw new LogicalOptimizeException(
-              "Path: \"" + paths.get(i) + "\" doesn't correspond to any known time series");
-        }
         for (String actualPath : actualPaths) {
           retPaths.add(new Path(actualPath));
           if (afterConcatAggregations != null && !afterConcatAggregations.isEmpty()) {
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 64660bd..da61a4f 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
@@ -31,6 +31,7 @@ import java.sql.Statement;
 import java.time.ZoneId;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -823,11 +824,6 @@ public class TSServiceImpl implements TSIService.Iface, ServerContext {
     List<Path> paths = plan.getPaths();
     List<String> respColumns = new ArrayList<>();
 
-    // check seriesPath exists
-    if (paths.isEmpty()) {
-      return getTSExecuteStatementResp(getStatus(TSStatusCode.TIMESERIES_NOT_EXIST_ERROR));
-    }
-
     // check file level set
     try {
       checkFileLevelSet(paths);
@@ -844,6 +840,12 @@ public class TSServiceImpl implements TSIService.Iface, ServerContext {
 
     TSExecuteStatementResp resp = getTSExecuteStatementResp(getStatus(TSStatusCode.SUCCESS_STATUS));
 
+    // check seriesPath exists
+    if (paths.isEmpty()) {
+      resp.setColumns(Collections.emptyList());
+      return resp;
+    }
+
     if (((QueryPlan) plan).isGroupByDevice()) {
       // set columns in TSExecuteStatementResp. Note this is without deduplication.
       List<String> measurementColumns = ((QueryPlan) plan).getMeasurementColumnList();