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 2019/11/12 07:44:38 UTC

[incubator-iotdb] branch master updated: fix bug about count nodes (#545)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7a65b37  fix bug about count nodes (#545)
7a65b37 is described below

commit 7a65b371e50902c2c3e05383745ee459c9da8c23
Author: Lei Rui <33...@users.noreply.github.com>
AuthorDate: Tue Nov 12 15:44:00 2019 +0800

    fix bug about count nodes (#545)
---
 .../UserGuide/5-Operation Manual/4-SQL Reference.md     |  2 +-
 .../UserGuide/5-Operation Manual/4-SQL Reference.md     |  4 ++--
 .../main/java/org/apache/iotdb/jdbc/IoTDBStatement.java | 17 +++++++++++------
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/docs/Documentation-CHN/UserGuide/5-Operation Manual/4-SQL Reference.md b/docs/Documentation-CHN/UserGuide/5-Operation Manual/4-SQL Reference.md
index 42d7dd5..5865308 100644
--- a/docs/Documentation-CHN/UserGuide/5-Operation Manual/4-SQL Reference.md	
+++ b/docs/Documentation-CHN/UserGuide/5-Operation Manual/4-SQL Reference.md	
@@ -142,7 +142,7 @@ Note: This statement can be used in IoTDB Client and JDBC.
 
 * 显示设备语句
 ```
-SHOW DEVICE
+SHOW DEVICES
 Eg: IoTDB > SHOW DEVICES
 Note: This statement can be used in IoTDB Client and JDBC.
 ```
diff --git a/docs/Documentation/UserGuide/5-Operation Manual/4-SQL Reference.md b/docs/Documentation/UserGuide/5-Operation Manual/4-SQL Reference.md
index b6c30cd..4008819 100644
--- a/docs/Documentation/UserGuide/5-Operation Manual/4-SQL Reference.md	
+++ b/docs/Documentation/UserGuide/5-Operation Manual/4-SQL Reference.md	
@@ -151,14 +151,14 @@ Note: This statement can be used in IoTDB Client and JDBC.
 
 * Show Devices Statement
 ```
-SHOW DEVICE
+SHOW DEVICES
 Eg: IoTDB > SHOW DEVICES
 Note: This statement can be used in IoTDB Client and JDBC.
 ```
 
 * Show Child Paths of Root Statement
 ```
-SHOW CHILD PATH
+SHOW CHILD PATHS
 Eg: IoTDB > SHOW CHILD PATHS
 Note: This statement can be used in IoTDB Client and JDBC.
 ```
diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
index 1a5c7cd..481bcaf 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
@@ -19,17 +19,22 @@
 
 package org.apache.iotdb.jdbc;
 
+import java.sql.BatchUpdateException;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.List;
 import org.apache.iotdb.rpc.IoTDBRPCException;
 import org.apache.iotdb.rpc.RpcUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
 import org.apache.iotdb.service.rpc.thrift.*;
 import org.apache.thrift.TException;
 
-import java.sql.*;
-import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.List;
-
 public class IoTDBStatement implements Statement {
 
   private static final String SHOW_TIMESERIES_COMMAND_LOWERCASE = "show timeseries";
@@ -293,7 +298,7 @@ public class IoTDBStatement implements Statement {
       }
     } else if (sqlToLowerCase.startsWith(COUNT_NODES_COMMAND_LOWERCASE)) {
       String[] cmdSplit = sql.split("\\s+", 4);
-      if (cmdSplit.length != 4 && !(cmdSplit[3].startsWith("level"))) {
+      if (!(cmdSplit.length == 4 && cmdSplit[3].startsWith("level"))) {
         throw new SQLException("Error format of \'COUNT NODES <PATH> LEVEL=<INTEGER>\'");
       } else {
         String path = cmdSplit[2];