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 2022/11/15 09:34:14 UTC
[iotdb] 01/01: Remove more todo
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch remove_todo
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 4e6089b863918e255ef2c7a967caf76e8dbd3aef
Author: HTHou <hh...@outlook.com>
AuthorDate: Tue Nov 15 17:33:51 2022 +0800
Remove more todo
---
.../org/apache/iotdb/cli/StartClientScriptIT.java | 3 -
.../org/apache/iotdb/db/it/IoTDBDeletionIT.java | 20 +-
.../org/apache/iotdb/db/it/IoTDBFilterNullIT.java | 5 +-
.../org/apache/iotdb/db/it/IoTDBMultiDeviceIT.java | 96 ++++----
.../db/it/IoTDBSyntaxConventionIdentifierIT.java | 262 ++++++++++-----------
.../db/it/aggregation/IoTDBAggregationIT.java | 55 ++---
.../db/it/aligned/IoTDBAlignedDataDeletionIT.java | 26 +-
.../db/it/aligned/IoTDBInsertAlignedValues2IT.java | 6 +-
.../db/it/aligned/IoTDBInsertAlignedValues3IT.java | 6 +-
.../db/it/aligned/IoTDBInsertAlignedValuesIT.java | 26 +-
.../db/it/udf/IoTDBUDTFBuiltinFunctionIT.java | 7 +-
.../apache/iotdb/db/it/utils/AlignedWriteUtil.java | 4 +-
.../org/apache/iotdb/db/it/utils/TestUtils.java | 4 +-
.../java/org/apache/iotdb/db/conf/IoTDBConfig.java | 4 +-
.../iotdb/db/engine/storagegroup/DataRegion.java | 8 -
.../db/engine/storagegroup/TsFileProcessor.java | 3 +-
.../mpp/plan/statement/crud/InsertStatement.java | 1 -
.../apache/iotdb/db/utils/EnvironmentUtils.java | 7 +-
18 files changed, 239 insertions(+), 304 deletions(-)
diff --git a/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java b/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java
index 2709c6e38d..6d8809568e 100644
--- a/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java
+++ b/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java
@@ -22,14 +22,11 @@ import org.apache.iotdb.db.utils.EnvironmentUtils;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
-// TODO remember to add it back after new standalone iotdb is finished
-@Ignore
public class StartClientScriptIT extends AbstractScript {
@Before
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java
index 0d71aa97ee..faa3f90318 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java
@@ -345,19 +345,19 @@ public class IoTDBDeletionIT {
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
- // todo improve to executeBatch
for (int i = 1; i <= 1000; i++) {
- statement.execute(
+ statement.addBatch(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
+ statement.executeBatch();
statement.execute("DELETE FROM root.vehicle.d0.s0 WHERE time > 150 and time <= 300");
statement.execute("DELETE FROM root.vehicle.d0.s0 WHERE time > 300 and time <= 400");
- // todo improve to executeBatch
for (int i = 1001; i <= 2000; i++) {
- statement.execute(
+ statement.addBatch(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
+ statement.executeBatch();
statement.execute("DELETE FROM root.vehicle.d0.s0 WHERE time > 500 and time <= 800");
statement.execute("DELETE FROM root.vehicle.d0.s0 WHERE time > 900 and time <= 1100");
statement.execute("DELETE FROM root.vehicle.d0.s0 WHERE time > 1500 and time <= 1650");
@@ -468,8 +468,9 @@ public class IoTDBDeletionIT {
Statement statement = connection.createStatement()) {
for (String sql : creationSqls) {
- statement.execute(sql);
+ statement.addBatch(sql);
}
+ statement.executeBatch();
} catch (Exception e) {
e.printStackTrace();
}
@@ -481,26 +482,27 @@ public class IoTDBDeletionIT {
// prepare BufferWrite file
for (int i = 201; i <= 300; i++) {
- statement.execute(
+ statement.addBatch(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
// statement.execute("merge");
// prepare Unseq-File
for (int i = 1; i <= 100; i++) {
- statement.execute(
+ statement.addBatch(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
// statement.execute("merge");
// prepare BufferWrite cache
for (int i = 301; i <= 400; i++) {
- statement.execute(
+ statement.addBatch(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
// prepare Overflow cache
for (int i = 101; i <= 200; i++) {
- statement.execute(
+ statement.addBatch(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
+ statement.executeBatch();
}
}
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterNullIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterNullIT.java
index 286bf5c53d..acc1586ca1 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterNullIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterNullIT.java
@@ -65,10 +65,9 @@ public class IoTDBFilterNullIT {
}
for (String insertSql : insertSqls) {
- // TODO statement.addBatch(insertSql);
- statement.execute(insertSql);
+ statement.addBatch(insertSql);
}
- // TODO statement.executeBatch();
+ statement.executeBatch();
} catch (Exception e) {
e.printStackTrace();
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBMultiDeviceIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBMultiDeviceIT.java
index b9461229f8..6058cd03b6 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBMultiDeviceIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBMultiDeviceIT.java
@@ -94,125 +94,121 @@ public class IoTDBMultiDeviceIT {
Statement statement = connection.createStatement()) {
for (String sql : TestConstant.createSql) {
- statement.execute(sql);
+ statement.addBatch(sql);
}
- statement.execute("CREATE DATABASE root.fans");
- statement.execute("CREATE TIMESERIES root.fans.d0.s0 WITH DATATYPE=INT32, ENCODING=RLE");
- statement.execute("CREATE TIMESERIES root.fans.d1.s0 WITH DATATYPE=INT32, ENCODING=RLE");
- statement.execute("CREATE TIMESERIES root.fans.d2.s0 WITH DATATYPE=INT32, ENCODING=RLE");
- statement.execute("CREATE TIMESERIES root.fans.d3.s0 WITH DATATYPE=INT32, ENCODING=RLE");
- statement.execute("CREATE TIMESERIES root.car.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE");
- statement.execute("CREATE TIMESERIES root.car.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE");
- statement.execute("CREATE TIMESERIES root.car.d2.s1 WITH DATATYPE=INT64, ENCODING=RLE");
+ statement.addBatch("CREATE DATABASE root.fans");
+ statement.addBatch("CREATE TIMESERIES root.fans.d0.s0 WITH DATATYPE=INT32, ENCODING=RLE");
+ statement.addBatch("CREATE TIMESERIES root.fans.d1.s0 WITH DATATYPE=INT32, ENCODING=RLE");
+ statement.addBatch("CREATE TIMESERIES root.fans.d2.s0 WITH DATATYPE=INT32, ENCODING=RLE");
+ statement.addBatch("CREATE TIMESERIES root.fans.d3.s0 WITH DATATYPE=INT32, ENCODING=RLE");
+ statement.addBatch("CREATE TIMESERIES root.car.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE");
+ statement.addBatch("CREATE TIMESERIES root.car.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE");
+ statement.addBatch("CREATE TIMESERIES root.car.d2.s1 WITH DATATYPE=INT64, ENCODING=RLE");
// insert of data time range :0-100 into fans
- // todo improve to executeBatch
for (int time = 0; time < 100; time++) {
String sql =
String.format("insert into root.fans.d0(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d1(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d2(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d3(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d0(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d1(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d2(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
}
// insert large amount of data time range : 1370 ~ 2400
- // todo improve to executeBatch
for (int time = 1370; time < 2400; time++) {
String sql =
String.format("insert into root.fans.d0(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d1(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d2(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d3(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d0(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d1(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d2(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
}
// insert large amount of data time range : 300 ~ 1360
- // todo improve to executeBatch
for (int time = 300; time < 1360; time++) {
// System.out.println("===" + time);
String sql =
String.format("insert into root.fans.d0(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d1(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d2(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d3(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d0(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d1(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d2(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
}
- statement.execute("flush");
+ statement.addBatch("flush");
// statement.execute("merge");
// unsequential data, memory data
- // todo improve to executeBatch
for (int time = 1000; time < 1100; time++) {
String sql =
String.format("insert into root.fans.d0(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d1(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d2(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d3(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d0(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d1(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d2(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
}
// sequential data, memory data
- // todo improve to executeBatch
for (int time = 20000; time < 20100; time++) {
String sql =
String.format("insert into root.fans.d0(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d1(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d2(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.fans.d3(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d0(timestamp,s0) values(%s,%s)", time, time % 7);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d1(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
sql = String.format("insert into root.car.d2(timestamp,s0) values(%s,%s)", time, time % 4);
- statement.execute(sql);
+ statement.addBatch(sql);
}
+ statement.executeBatch();
} catch (Exception e) {
e.printStackTrace();
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java
index 64d6e4f35c..affcfe0565 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java
@@ -928,149 +928,127 @@ public class IoTDBSyntaxConventionIdentifierIT {
// }
// }
- // todo: add these back when support sync in new cluster
+ @Test
+ public void testPipeSinkNameIllegal() {
+ try (Connection connection = EnvFactory.getEnv().getConnection();
+ Statement statement = connection.createStatement()) {
+ try {
+ statement.execute("CREATE PIPESINK test` AS IoTDB (`ip` = '127.0.0.1')");
+ fail();
+ } catch (Exception ignored) {
+ }
- // @Test
- // public void testPipeSinkNameIllegal() {
- // try (Connection connection = EnvFactory.getEnv().getConnection();
- // Statement statement = connection.createStatement()) {
- // try {
- // statement.execute("CREATE PIPESINK test` AS IoTDB (`ip` = '127.0.0.1')");
- // fail();
- // } catch (Exception ignored) {
- // }
- //
- // try {
- // statement.execute("CREATE PIPESINK ``test` AS IoTDB (`ip` = '127.0.0.1')");
- // fail();
- // } catch (Exception ignored) {
- // }
- //
- // try {
- // statement.execute("CREATE PIPESINK test.1 AS IoTDB (`ip` = '127.0.0.1')");
- // fail();
- // } catch (Exception ignored) {
- // }
- //
- // try {
- // statement.execute("CREATE PIPESINK 12345 AS IoTDB (`ip` = '127.0.0.1')");
- // fail();
- // } catch (Exception ignored) {
- // }
- //
- // try {
- // statement.execute("CREATE PIPESINK a!@cb AS IoTDB (`ip` = '127.0.0.1')");
- // fail();
- // } catch (Exception ignored) {
- // }
- //
- // } catch (SQLException e) {
- // e.printStackTrace();
- // fail();
- // }
- // }
+ try {
+ statement.execute("CREATE PIPESINK ``test` AS IoTDB (`ip` = '127.0.0.1')");
+ fail();
+ } catch (Exception ignored) {
+ }
- // todo: add this back when support template in new cluster
+ try {
+ statement.execute("CREATE PIPESINK test.1 AS IoTDB (`ip` = '127.0.0.1')");
+ fail();
+ } catch (Exception ignored) {
+ }
- // @Test
- // public void testTemplateName() {
- // String[] templateNames = {
- // "id",
- // "ID",
- // "id0",
- // "_id",
- // "0id",
- // "`233`",
- // "`ab!`",
- // "`\"ab\"`",
- // "`\\\"ac\\\"`",
- // "`'ab'`",
- // "`a.b`",
- // "`a``b`"
- // };
- //
- // String[] resultNames = {
- // "id", "ID", "id0", "_id", "0id", "233", "ab!", "\"ab\"", "\\\"ac\\\"", "'ab'", "a.b",
- // "a`b"
- // };
- //
- // try (Connection connection = EnvFactory.getEnv().getConnection();
- // Statement statement = connection.createStatement()) {
- // for (String templateName : templateNames) {
- // String createTemplateSql =
- // String.format(
- // "create schema template %s (temperature FLOAT encoding=RLE, status BOOLEAN
- // encoding=PLAIN compression=SNAPPY)",
- // templateName);
- // statement.execute(createTemplateSql);
- // }
- //
- // try (ResultSet resultSet = statement.executeQuery("SHOW TEMPLATES")) {
- // Set<String> expectedResult = new HashSet<>(Arrays.asList(resultNames));
- // while (resultSet.next()) {
- // Assert.assertTrue(expectedResult.contains(resultSet.getString("TemplateName")));
- // expectedResult.remove(resultSet.getString("TemplateName"));
- // }
- // Assert.assertEquals(0, expectedResult.size());
- // }
- // } catch (SQLException e) {
- // e.printStackTrace();
- // fail();
- // }
- // }
- //
- // @Test
- // public void testTemplateNameIllegal() {
- // try (Connection connection = EnvFactory.getEnv().getConnection();
- // Statement statement = connection.createStatement()) {
- // try {
- // statement.execute(
- // "create schema template `a`` "
- // + "(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN
- // compression=SNAPPY)");
- // fail();
- // } catch (Exception ignored) {
- // }
- //
- // try {
- // statement.execute(
- // "create schema template 111 "
- // + "(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN
- // compression=SNAPPY)");
- // fail();
- // } catch (Exception ignored) {
- // }
- //
- // try {
- // statement.execute(
- // "create schema template `a "
- // + "(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN
- // compression=SNAPPY)");
- // fail();
- // } catch (Exception ignored) {
- // }
- //
- // try {
- // statement.execute(
- // "create schema template 'a' "
- // + "(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN
- // compression=SNAPPY)");
- // fail();
- // } catch (Exception ignored) {
- // }
- //
- // try {
- // statement.execute(
- // "create schema template \"a\" "
- // + "(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN
- // compression=SNAPPY)");
- // fail();
- // } catch (Exception ignored) {
- // }
- //
- // } catch (SQLException e) {
- // e.printStackTrace();
- // fail();
- // }
- // }
+ try {
+ statement.execute("CREATE PIPESINK 12345 AS IoTDB (`ip` = '127.0.0.1')");
+ fail();
+ } catch (Exception ignored) {
+ }
+
+ try {
+ statement.execute("CREATE PIPESINK a!@cb AS IoTDB (`ip` = '127.0.0.1')");
+ fail();
+ } catch (Exception ignored) {
+ }
+
+ } catch (SQLException e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void testTemplateName() {
+ String[] templateNames = {
+ "id", "ID", "id0", "_id", "0id", "`233`",
+ };
+
+ String[] resultNames = {
+ "id", "ID", "id0", "_id", "0id", "233",
+ };
+
+ try (Connection connection = EnvFactory.getEnv().getConnection();
+ Statement statement = connection.createStatement()) {
+ for (String templateName : templateNames) {
+ String createTemplateSql =
+ String.format(
+ "create schema template %s (temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)",
+ templateName);
+ statement.execute(createTemplateSql);
+ }
+
+ try (ResultSet resultSet = statement.executeQuery("SHOW TEMPLATES")) {
+ Set<String> expectedResult = new HashSet<>(Arrays.asList(resultNames));
+ while (resultSet.next()) {
+ Assert.assertTrue(expectedResult.contains(resultSet.getString("TemplateName")));
+ expectedResult.remove(resultSet.getString("TemplateName"));
+ }
+ Assert.assertEquals(0, expectedResult.size());
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void testTemplateNameIllegal() {
+ try (Connection connection = EnvFactory.getEnv().getConnection();
+ Statement statement = connection.createStatement()) {
+ try {
+ statement.execute(
+ "create schema template `a`` "
+ + "(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)");
+ fail();
+ } catch (Exception ignored) {
+ }
+
+ try {
+ statement.execute(
+ "create schema template 111 "
+ + "(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)");
+ fail();
+ } catch (Exception ignored) {
+ }
+
+ try {
+ statement.execute(
+ "create schema template `a "
+ + "(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)");
+ fail();
+ } catch (Exception ignored) {
+ }
+
+ try {
+ statement.execute(
+ "create schema template 'a' "
+ + "(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)");
+ fail();
+ } catch (Exception ignored) {
+ }
+
+ try {
+ statement.execute(
+ "create schema template \"a\" "
+ + "(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)");
+ fail();
+ } catch (Exception ignored) {
+ }
+
+ } catch (SQLException e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
}
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java
index 6d0c0a4b82..b7ff3957f8 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java
@@ -898,76 +898,51 @@ public class IoTDBAggregationIT {
statement.execute(sql);
}
- // TODO: change insert to batch insert
// prepare BufferWrite file
for (int i = 5000; i < 7000; i++) {
- // statement.addBatch(
- // String.format(
- // Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'",
- // "true"));
- statement.execute(
+ statement.addBatch(
String.format(
Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'", "true"));
}
- // statement.executeBatch();
+ statement.executeBatch();
statement.execute("flush");
for (int i = 7500; i < 8500; i++) {
- statement.execute(
+ statement.addBatch(
String.format(
- Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'", "true"));
- // statement.addBatch(
- // String.format(
- // Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'",
- // "false"));
+ Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'", "false"));
}
- // statement.executeBatch();
+ statement.executeBatch();
statement.execute("flush");
// prepare Unseq-File
for (int i = 500; i < 1500; i++) {
- // statement.addBatch(
- // String.format(
- // Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'",
- // "true"));
- statement.execute(
+ statement.addBatch(
String.format(
Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'", "true"));
}
- // statement.executeBatch();
+ statement.executeBatch();
statement.execute("flush");
for (int i = 3000; i < 6500; i++) {
- // statement.addBatch(
- // String.format(
- // Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'",
- // "false"));
- statement.execute(
+ statement.addBatch(
String.format(
- Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'", "true"));
+ Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'", "false"));
}
- // statement.executeBatch();
+ statement.executeBatch();
// prepare BufferWrite cache
for (int i = 9000; i < 10000; i++) {
- // statement.addBatch(
- // String.format(
- // Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'",
- // "true"));
- statement.execute(
+ statement.addBatch(
String.format(
Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'", "true"));
}
- // statement.executeBatch();
+ statement.executeBatch();
// prepare Overflow cache
for (int i = 2000; i < 2500; i++) {
- // statement.addBatch(
- // String.format(
- // Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'",
- // "false"));
- statement.execute(
+ statement.addBatch(
String.format(
- Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'", "true"));
+ Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "'" + i + "'", "false"));
}
- // statement.executeBatch();
+ statement.executeBatch();
for (String sql : dataSet3) {
statement.execute(sql);
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedDataDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedDataDeletionIT.java
index 054e575715..483b4d072b 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedDataDeletionIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedDataDeletionIT.java
@@ -316,11 +316,11 @@ public class IoTDBAlignedDataDeletionIT {
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
- // todo improve to executeBatch
for (int i = 1; i <= 10000; i++) {
- statement.execute(
+ statement.addBatch(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
+ statement.executeBatch();
statement.execute("DELETE FROM root.vehicle.d0.s0 WHERE time > 1500 and time <= 9000");
try (ResultSet set = statement.executeQuery("SELECT s0 FROM root.vehicle.d0")) {
int cnt = 0;
@@ -338,18 +338,18 @@ public class IoTDBAlignedDataDeletionIT {
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
- // todo improve to executeBatch
for (int i = 1; i <= 1000; i++) {
- statement.execute(
+ statement.addBatch(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
+ statement.executeBatch();
statement.execute("DELETE FROM root.vehicle.d0.s0 WHERE time > 150 and time <= 300");
statement.execute("DELETE FROM root.vehicle.d0.s0 WHERE time > 300 and time <= 400");
- // todo improve to executeBatch
for (int i = 1001; i <= 2000; i++) {
- statement.execute(
+ statement.addBatch(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
+ statement.executeBatch();
statement.execute("DELETE FROM root.vehicle.d0.s0 WHERE time > 500 and time <= 800");
statement.execute("DELETE FROM root.vehicle.d0.s0 WHERE time > 900 and time <= 1100");
statement.execute("DELETE FROM root.vehicle.d0.s0 WHERE time > 1500 and time <= 1650");
@@ -490,15 +490,13 @@ public class IoTDBAlignedDataDeletionIT {
statement.execute(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
- // TODO: merge
- // statement.execute("merge");
+ statement.execute("merge");
// prepare Unseq-File
for (int i = 1; i <= 100; i++) {
statement.execute(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
- // TODO: merge
- // statement.execute("merge");
+ statement.execute("merge");
// prepare BufferWrite cache
for (int i = 301; i <= 400; i++) {
statement.execute(
@@ -524,17 +522,17 @@ public class IoTDBAlignedDataDeletionIT {
Statement statement = connection.createStatement()) {
// prepare BufferWrite data
- // todo improve to executeBatch
for (int i = 10001; i <= 20000; i++) {
- statement.execute(
+ statement.addBatch(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
+ statement.executeBatch();
// prepare Overflow data
- // todo improve to executeBatch
for (int i = 1; i <= 10000; i++) {
- statement.execute(
+ statement.addBatch(
String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", i % 2 == 0));
}
+ statement.executeBatch();
}
}
}
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues2IT.java
index 9b85b34e37..7e2a0a4fb4 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues2IT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues2IT.java
@@ -63,12 +63,11 @@ public class IoTDBInsertAlignedValues2IT {
public void testInsertAlignedWithEmptyPage() throws SQLException {
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
- // TODO change it to executeBatch way when it's supported in new cluster
statement.execute(
"CREATE ALIGNED TIMESERIES root.lz.dev.GPS(S1 INT32 encoding=PLAIN compressor=SNAPPY, S2 INT32 encoding=PLAIN compressor=SNAPPY, S3 INT32 encoding=PLAIN compressor=SNAPPY) ");
for (int i = 0; i < 100; i++) {
if (i == 99) {
- statement.execute(
+ statement.addBatch(
"insert into root.lz.dev.GPS(time,S1,S3) aligned values("
+ i
+ ","
@@ -77,7 +76,7 @@ public class IoTDBInsertAlignedValues2IT {
+ i
+ ")");
} else {
- statement.execute(
+ statement.addBatch(
"insert into root.lz.dev.GPS(time,S1,S2) aligned values("
+ i
+ ","
@@ -87,6 +86,7 @@ public class IoTDBInsertAlignedValues2IT {
+ ")");
}
}
+ statement.executeBatch();
statement.execute("flush");
int rowCount = 0;
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues3IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues3IT.java
index 1cc17a7b98..3d49a998ae 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues3IT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues3IT.java
@@ -63,12 +63,11 @@ public class IoTDBInsertAlignedValues3IT {
public void testInsertAlignedWithEmptyPage2() throws SQLException {
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
- // TODO change it to executeBatch way when it's supported in new cluster
statement.execute(
"CREATE ALIGNED TIMESERIES root.lz.dev.GPS(S1 INT32 encoding=PLAIN compressor=SNAPPY, S2 INT32 encoding=PLAIN compressor=SNAPPY, S3 INT32 encoding=PLAIN compressor=SNAPPY) ");
for (int i = 0; i < 100; i++) {
if (i >= 49) {
- statement.execute(
+ statement.addBatch(
"insert into root.lz.dev.GPS(time,S1,S2,S3) aligned values("
+ i
+ ","
@@ -79,7 +78,7 @@ public class IoTDBInsertAlignedValues3IT {
+ i
+ ")");
} else {
- statement.execute(
+ statement.addBatch(
"insert into root.lz.dev.GPS(time,S1,S2) aligned values("
+ i
+ ","
@@ -89,6 +88,7 @@ public class IoTDBInsertAlignedValues3IT {
+ ")");
}
}
+ statement.executeBatch();
statement.execute("flush");
int rowCount = 0;
try (ResultSet resultSet = statement.executeQuery("select S3 from root.lz.dev.GPS")) {
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java
index f12e6bae7f..7b4b5eab56 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java
@@ -64,13 +64,13 @@ public class IoTDBInsertAlignedValuesIT {
public void testInsertAlignedValues() throws SQLException {
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
- // TODO change it to executeBatch way when it's supported in new cluster
- statement.execute(
+ statement.addBatch(
"insert into root.t1.wf01.wt01(time, status, temperature) aligned values (4000, true, 17.1)");
- statement.execute(
+ statement.addBatch(
"insert into root.t1.wf01.wt01(time, status, temperature) aligned values (5000, true, 20.1)");
- statement.execute(
+ statement.addBatch(
"insert into root.t1.wf01.wt01(time, status, temperature) aligned values (6000, true, 22)");
+ statement.executeBatch();
try (ResultSet resultSet = statement.executeQuery("select status from root.t1.wf01.wt01")) {
assertTrue(resultSet.next());
@@ -109,12 +109,12 @@ public class IoTDBInsertAlignedValuesIT {
public void testInsertAlignedNullableValues() throws SQLException {
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
- // TODO change it to executeBatch way when it's supported in new cluster
- statement.execute(
+ statement.addBatch(
"insert into root.t1.wf01.wt01(time, status, temperature) aligned values (4000, true, 17.1)");
- statement.execute("insert into root.t1.wf01.wt01(time, status) aligned values (5000, true)");
- statement.execute(
+ statement.addBatch("insert into root.t1.wf01.wt01(time, status) aligned values (5000, true)");
+ statement.addBatch(
"insert into root.t1.wf01.wt01(time, temperature) aligned values (6000, 22)");
+ statement.executeBatch();
try (ResultSet resultSet = statement.executeQuery("select status from root.t1.wf01.wt01")) {
assertTrue(resultSet.next());
@@ -151,14 +151,14 @@ public class IoTDBInsertAlignedValuesIT {
public void testUpdatingAlignedValues() throws SQLException {
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
- // TODO change it to executeBatch way when it's supported in new cluster
- statement.execute(
+ statement.addBatch(
"insert into root.t1.wf01.wt01(time, status, temperature) aligned values (4000, true, 17.1)");
- statement.execute("insert into root.t1.wf01.wt01(time, status) aligned values (5000, true)");
- statement.execute(
+ statement.addBatch("insert into root.t1.wf01.wt01(time, status) aligned values (5000, true)");
+ statement.addBatch(
"insert into root.t1.wf01.wt01(time, temperature) aligned values (5000, 20.1)");
- statement.execute(
+ statement.addBatch(
"insert into root.t1.wf01.wt01(time, temperature) aligned values (6000, 22)");
+ statement.executeBatch();
try (ResultSet resultSet = statement.executeQuery("select status from root.t1.wf01.wt01")) {
assertTrue(resultSet.next());
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java
index af4d4a758e..104fba187e 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java
@@ -1060,14 +1060,13 @@ public class IoTDBUDTFBuiltinFunctionIT {
Statement statement = connection.createStatement()) {
for (String createSQL : createSQLs) {
- statement.execute(createSQL);
+ statement.addBatch(createSQL);
}
for (String insertSQL : insertSQLs) {
- // TODO statement.addBatch(insertSQL);
- statement.execute(insertSQL);
+ statement.addBatch(insertSQL);
}
- // TODO statement.executeBatch();
+ statement.executeBatch();
testStrLength(statement);
testStrLocate(statement);
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/AlignedWriteUtil.java b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/AlignedWriteUtil.java
index 3bf3659a66..1671ddf76e 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/AlignedWriteUtil.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/AlignedWriteUtil.java
@@ -136,10 +136,10 @@ public class AlignedWriteUtil {
Statement statement = connection.createStatement()) {
// create aligned and non-aligned time series
- // TODO change it to executeBatch way when it's supported in new cluster
for (String sql : sqls) {
- statement.execute(sql);
+ statement.addBatch(sql);
}
+ statement.executeBatch();
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java
index 1eb1e467a7..7aa09b3c52 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java
@@ -45,10 +45,10 @@ public class TestUtils {
public static void prepareData(String[] sqls) {
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
- // TODO replace with prepareBatchData
for (String sql : sqls) {
- statement.execute(sql);
+ statement.addBatch(sql);
}
+ statement.executeBatch();
} catch (SQLException e) {
e.printStackTrace();
fail(e.getMessage());
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index fe144761ef..cbd45c0459 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -32,8 +32,8 @@ import org.apache.iotdb.db.engine.compaction.constant.InnerUnsequenceCompactionS
import org.apache.iotdb.db.engine.storagegroup.timeindex.TimeIndexLevel;
import org.apache.iotdb.db.exception.LoadConfigurationException;
import org.apache.iotdb.db.metadata.LocalSchemaProcessor;
+import org.apache.iotdb.db.service.thrift.impl.ClientRPCServiceImpl;
import org.apache.iotdb.db.service.thrift.impl.NewInfluxDBServiceImpl;
-import org.apache.iotdb.db.service.thrift.impl.TSServiceImpl;
import org.apache.iotdb.db.utils.datastructure.TVListSortAlgorithm;
import org.apache.iotdb.db.wal.utils.WALMode;
import org.apache.iotdb.rpc.RpcTransportFactory;
@@ -554,7 +554,7 @@ public class IoTDBConfig {
private int sessionTimeoutThreshold = 0;
/** Replace implementation class of JDBC service */
- private String rpcImplClassName = TSServiceImpl.class.getName();
+ private String rpcImplClassName = ClientRPCServiceImpl.class.getName();
/** indicate whether current mode is cluster */
private boolean isClusterMode = false;
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
index 3bcf0a916e..52223fb0d0 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
@@ -963,11 +963,6 @@ public class DataRegion {
insertTabletNode.getTimes()[insertTabletNode.getTimes().length - 1],
(DateTimeUtils.currentTime() - dataTTL));
}
-
- // TODO(Trigger)// fire trigger before insertion
- // final int firePosition = loc;
- // TriggerEngine.fire(TriggerEvent.BEFORE_INSERT, insertTabletPlan, firePosition);
-
// before is first start point
int before = loc;
// before time partition
@@ -1027,9 +1022,6 @@ public class DataRegion {
if (!noFailure) {
throw new BatchProcessException(results);
}
-
- // TODO: trigger // fire trigger after insertion
- // TriggerEngine.fire(TriggerEvent.AFTER_INSERT, insertTabletPlan, firePosition);
} finally {
writeUnlock();
}
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
index 853484d51b..4f2a6f684f 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
@@ -367,8 +367,7 @@ public class TsFileProcessor {
insertTabletNode.getDeviceID().toStringID(), insertTabletNode.getTimes()[end - 1]);
}
// TODO: PlanIndex
- tsFileResource.updatePlanIndexes(0);
- // tsFileResource.updatePlanIndexes(insertTabletPlan.getIndex());
+ // tsFileResource.updatePlanIndexes(insertTabletPlan.getIndex());
}
@SuppressWarnings("squid:S3776") // high Cognitive Complexity
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertStatement.java
index 464e5ff7c2..f8a11aa278 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertStatement.java
@@ -39,7 +39,6 @@ public class InsertStatement extends Statement {
private long[] times;
private String[] measurementList;
- // TODO: unify SQL and RPC requests
private List<String[]> valuesList;
private boolean isAligned;
diff --git a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
index f840265c2f..e729a1f888 100644
--- a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
+++ b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
@@ -48,6 +48,7 @@ import org.apache.iotdb.db.rescon.PrimitiveArrayManager;
import org.apache.iotdb.db.rescon.SystemInfo;
import org.apache.iotdb.db.rescon.TsFileResourceManager;
import org.apache.iotdb.db.service.IoTDB;
+import org.apache.iotdb.db.service.NewIoTDB;
import org.apache.iotdb.db.sync.common.LocalSyncInfoFetcher;
import org.apache.iotdb.db.wal.WALManager;
import org.apache.iotdb.db.wal.recover.WALRecoverManager;
@@ -93,7 +94,7 @@ public class EnvironmentUtils {
private static final long oldGroupSizeInByte = config.getMemtableSizeThreshold();
- private static IoTDB daemon;
+ private static NewIoTDB daemon;
private static TConfiguration tConfiguration = TConfigurationConst.defaultTConfiguration;
@@ -295,7 +296,7 @@ public class EnvironmentUtils {
// use async wal mode in test
config.setAvgSeriesPointNumberThreshold(Integer.MAX_VALUE);
if (daemon == null) {
- daemon = new IoTDB();
+ daemon = new NewIoTDB();
}
try {
EnvironmentUtils.daemon.active();
@@ -336,7 +337,7 @@ public class EnvironmentUtils {
public static void reactiveDaemon() {
if (daemon == null) {
- daemon = new IoTDB();
+ daemon = new NewIoTDB();
daemon.active();
} else {
activeDaemon();