You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/03/13 02:24:45 UTC
[incubator-iotdb] branch rel/0.9 updated: [IOTDB-553] Return Empty
ResultSet when queried series doesn't exist (#904)
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch rel/0.9
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/rel/0.9 by this push:
new 4ecdcb8 [IOTDB-553] Return Empty ResultSet when queried series doesn't exist (#904)
4ecdcb8 is described below
commit 4ecdcb8b8cae2b18c87cdb47ebb2c00d5b6cf2b7
Author: Zesong Sun <sz...@mails.tsinghua.edu.cn>
AuthorDate: Fri Mar 13 10:24:36 2020 +0800
[IOTDB-553] Return Empty ResultSet when queried series doesn't exist (#904)
* [IOTDB-553] Return Empty ResultSet when queried series doesn't exist
---
.../main/java/org/apache/iotdb/client/AbstractClient.java | 2 +-
pom.xml | 6 +++---
.../org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java | 4 ----
.../db/qp/strategy/optimizer/ConcatPathOptimizer.java | 4 ----
.../java/org/apache/iotdb/db/service/TSServiceImpl.java | 12 +++++++-----
.../apache/iotdb/db/integration/IoTDBGroupbyDeviceIT.java | 3 ++-
.../apache/iotdb/db/integration/IoTDBMultiSeriesIT.java | 14 --------------
7 files changed, 13 insertions(+), 32 deletions(-)
diff --git a/client/src/main/java/org/apache/iotdb/client/AbstractClient.java b/client/src/main/java/org/apache/iotdb/client/AbstractClient.java
index 4dac7e3..079db80 100644
--- a/client/src/main/java/org/apache/iotdb/client/AbstractClient.java
+++ b/client/src/main/java/org/apache/iotdb/client/AbstractClient.java
@@ -503,7 +503,7 @@ public abstract class AbstractClient {
} else {
blockLine.append("+");
}
- if (resultSetMetaData.getColumnName(2).equals(GROUPBY_DEVICE_COLUMN_NAME)) {
+ if (resultSetMetaData.getColumnCount() > 1 && resultSetMetaData.getColumnName(2).equals(GROUPBY_DEVICE_COLUMN_NAME)) {
maxValueLength = measurementColumnLength;
} else {
int tmp = Integer.MIN_VALUE;
diff --git a/pom.xml b/pom.xml
index 6410c19..626b2ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -533,7 +533,7 @@
<id>enforce-version-convergence</id>
<configuration>
<rules>
- <dependencyConvergence />
+ <dependencyConvergence/>
</rules>
</configuration>
<goals>
@@ -579,7 +579,7 @@
</requireJavaVersion>
<!-- Disabled for now as it breaks the ability to build single modules -->
<!--reactorModuleConvergence/-->
- <banVulnerable implementation="org.sonatype.ossindex.maven.enforcer.BanVulnerableDependencies" />
+ <banVulnerable implementation="org.sonatype.ossindex.maven.enforcer.BanVulnerableDependencies"/>
</rules>
</configuration>
</execution>
@@ -727,7 +727,7 @@
<instrumentation>
<ignoreTrivial>true</ignoreTrivial>
</instrumentation>
- <check />
+ <check/>
</configuration>
<executions>
<execution>
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();
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBGroupbyDeviceIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBGroupbyDeviceIT.java
index a05d641..9c280dd 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBGroupbyDeviceIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBGroupbyDeviceIT.java
@@ -18,6 +18,7 @@
*/
package org.apache.iotdb.db.integration;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.sql.Connection;
@@ -594,7 +595,7 @@ public class IoTDBGroupbyDeviceIT {
Statement statement = connection.createStatement()) {
boolean hasResultSet = statement.execute(
"select s0 from root.nonexistent.noneixtsent group by device");
- fail("No exception thrown.");
+ assertTrue(hasResultSet);
} catch (Exception e) {
Assert.assertTrue(e.getMessage().contains("do not select any existing series"));
}
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 686816f..4dc146b 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
@@ -374,20 +374,6 @@ public class IoTDBMultiSeriesIT {
}
@Test
- public void selectUnknownTimeSeries() throws ClassNotFoundException {
- Class.forName(Config.JDBC_DRIVER_NAME);
-
- try (Connection connection = DriverManager
- .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
- Statement statement = connection.createStatement()) {
- statement.execute("select s10 from root.vehicle.d0");
- fail("not throw exception when select unknown time series");
- } catch (SQLException e) {
- assertEquals("Statement format is not right: Path: \"root.vehicle.d0.s10\" doesn't correspond to any known time series", e.getMessage());
- }
- }
-
- @Test
public void selectWhereUnknownTimeSeries() throws ClassNotFoundException {
Class.forName(Config.JDBC_DRIVER_NAME);