You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2021/02/20 01:45:29 UTC

[iotdb] branch rel/0.11 updated: cherry pick [ISSUE-2598] Throw explicit exception when time series is unknown in where clause (#2699)

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

haonan pushed a commit to branch rel/0.11
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/0.11 by this push:
     new 5418413  cherry pick [ISSUE-2598] Throw explicit exception when time series is unknown in where clause (#2699)
5418413 is described below

commit 541841343f18d1ff5a2ad17ec2d8d8c42c0cba49
Author: Haonan <hh...@outlook.com>
AuthorDate: Sat Feb 20 09:45:11 2021 +0800

    cherry pick [ISSUE-2598] Throw explicit exception when time series is unknown in where clause (#2699)
    
    Co-authored-by: Xiangwei Wei <34...@users.noreply.github.com>
---
 .../apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java | 4 ++++
 .../java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java   | 7 +++----
 2 files changed, 7 insertions(+), 4 deletions(-)

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 eee1974..3b84a5f 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
@@ -255,6 +255,10 @@ public class ConcatPathOptimizer implements ILogicalOptimizer {
     try {
       for (PartialPath path : paths) {
         List<PartialPath> all = removeWildcard(path, 0, 0).left;
+        if (all.size() == 0) {
+          throw new LogicalOptimizeException(
+              String.format("Unknown time series %s in `where clause`", path));
+        }
         for (PartialPath subPath : all) {
           if (!pathSet.contains(subPath)) {
             pathSet.add(subPath);
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java
index 82d0442..9cac952 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java
@@ -420,9 +420,8 @@ public class IoTDBMultiSeriesIT {
       statement.execute("select s0 from root.vehicle.d0 where s10 < 111");
       fail("not throw exception when unknown time series in where clause");
     } catch (SQLException e) {
-      assertEquals(
-          "411: Meet error in query process: Filter has some time series don't correspond to any known time series",
-          e.getMessage());
+      assertTrue(
+          e.getMessage().contains("Unknown time series root.vehicle.d0.s10 in `where clause`"));
     }
   }
 
@@ -476,4 +475,4 @@ public class IoTDBMultiSeriesIT {
       Assert.assertTrue(TSEncoding.GORILLA.name().equalsIgnoreCase(gradeRs.getString(5)));
     }
   }
-}
+}