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

lta pushed a commit to branch rel/0.9-load
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 2cd481e65297760e113e58ddfc330a61fc5e4206
Author: lta <[email protected]>
AuthorDate: Thu Dec 26 19:52:08 2019 +0800

    fix a bug of load external tsfile
---
 .../org/apache/iotdb/db/sql/parse/TqlLexer.g       |  5 --
 .../org/apache/iotdb/db/sql/parse/TqlParser.g      | 15 ++--
 .../iotdb/db/qp/strategy/LogicalGenerator.java     |  3 +-
 .../integration/IoTDBLoadExternalTsfileTest.java   | 89 ----------------------
 4 files changed, 9 insertions(+), 103 deletions(-)

diff --git a/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlLexer.g 
b/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlLexer.g
index 0217ec5..5fc365f 100644
--- a/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlLexer.g
+++ b/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlLexer.g
@@ -416,11 +416,6 @@ DATETIME
       (('+' | '-') INT ':' INT)?
     ;
 
-BOOLEAN_VALUE
-   : T R U E
-   | F A L S E
-   ;
-
 EXPONENT : INT ('e'|'E') ('+'|'-')? INT ;
 
     
diff --git a/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlParser.g 
b/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlParser.g
index 5944c0b..2d89c57 100644
--- a/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlParser.g
+++ b/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlParser.g
@@ -757,11 +757,11 @@ rootOrId
     ;
 
 /*
-****   ****
-*************  *************
-TTL    Operate file
-*************  *************
-****   ****
+****
+*************
+Operate file
+*************
+****
 */
 operateFileStatement
     : loadFiles
@@ -772,9 +772,8 @@ loadFiles
     ;
 
 autoCreateSchema
-    :
-    | BOOLEAN_VALUE
-    | BOOLEAN_VALUE INT
+    : ID
+    | ID INT
     ;
 /*
 ****
diff --git 
a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java 
b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
index 4e820de..2c0ee1b 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
@@ -290,7 +290,8 @@ public class LogicalGenerator {
   }
 
   private void analyzeLoadFile(AstNode astNode){
-    if (!astNode.getChild(2).getChild(0).getText().equalsIgnoreCase("true") && 
!astNode.getChild(2)
+    if (astNode.getChild(2).getChild(0) != null && 
!astNode.getChild(2).getChild(0).getText()
+        .equalsIgnoreCase("true") && !astNode.getChild(2)
         .getChild(0).getText().equalsIgnoreCase("false")) {
       initializedOperator = new LoadFilesOperator(true,
           "Please check the statement: load [FILE] true/false [storage group 
level]");
diff --git 
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileTest.java
 
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileTest.java
deleted file mode 100644
index 8bb8f6d..0000000
--- 
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.apache.iotdb.db.integration;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.List;
-import org.apache.iotdb.db.engine.StorageEngine;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.service.IoTDB;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.jdbc.Config;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class IoTDBLoadExternalTsfileTest {
-
-  private static IoTDB daemon;
-  private static String[] sqls = new String[]{
-      "SET STORAGE GROUP TO root.vehicle",
-      "SET STORAGE GROUP TO root.test",
-      "CREATE TIMESERIES root.vehicle.d0.s0 WITH DATATYPE=INT32, ENCODING=RLE",
-      "CREATE TIMESERIES root.vehicle.d0.s1 WITH DATATYPE=TEXT, 
ENCODING=PLAIN",
-      "CREATE TIMESERIES root.vehicle.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE",
-      "CREATE TIMESERIES root.vehicle.d1.s3 WITH DATATYPE=BOOLEAN, 
ENCODING=PLAIN",
-      "insert into root.vehicle.d0(timestamp,s0) values(10,100)",
-      "insert into root.vehicle.d0(timestamp,s0,s1) values(12,101,'102')",
-      "insert into root.vehicle.d0(timestamp,s1) values(19,'103')",
-      "insert into root.vehicle.d1(timestamp,s2) values(11,104.0)",
-      "insert into root.vehicle.d1(timestamp,s2,s3) values(15,105.0,true)",
-      "insert into root.vehicle.d1(timestamp,s3) values(17,false)",
-      "insert into root.vehicle.d0(timestamp,s0) values(20,1000)"
-  };
-
-  private static final String TIMESTAMP_STR = "Time";
-  private static final String TEMPERATURE_STR = 
"root.ln.wf01.wt01.temperature";
-  private static final String STATUS_STR = "root.ln.wf01.wt01.status";
-  private static final String HARDWARE_STR = "root.ln.wf01.wt01.hardware";
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.closeStatMonitor();
-    daemon = IoTDB.getInstance();
-    daemon.active();
-    EnvironmentUtils.envSetUp();
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    prepareData();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    daemon.stop();
-    EnvironmentUtils.cleanEnv();
-  }
-
-  @Test
-  public void LoadNewTsfileTest() throws SQLException {
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      statement.execute("flush");
-      List<TsFileResource> resources = 
StorageEngine.getInstance().getProcessor("root.vehicle")
-          .getSequenceFileList();
-      for(TsFileResource resource:resources){
-        System.out.println(resource.getFile().getAbsolutePath());
-      }
-    } catch (StorageEngineException e) {
-      e.printStackTrace();
-    }
-  }
-
-  private void prepareData() throws SQLException {
-    try (Connection connection = DriverManager
-        .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
-            "root");
-        Statement statement = connection.createStatement()) {
-
-
-      for (String sql : sqls) {
-        statement.execute(sql);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-  }
-}
\ No newline at end of file

Reply via email to