diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index cd00fcd6e48ba..683816fcb887e 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1200,7 +1200,7 @@ Import-CSV supports specify data type and no need quotation for text value * [GITHUB-3339] Try to fix sg dead lock * [GITHUB-3329] Fix upgrade NPE and DeadLock * [GITHUB-3319] Fix upgrade tool cannot close file reader -* [IOTDB-1212] Fix The given error message is not right when executing select sin(non_existence) from root.sg1.d1 +* [IOTDB-1212] Fix The given error message is not right when executing select sin(non_existence) from root.db1.d1 * [IOTDB-1219] Fix a potential NPE issue in UDF module * [IOTDB-1286] Fix 4 C++ mem-leak points * [IOTDB-1294] Fix delete operation become invalid after compaction diff --git a/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp b/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp index 2cc04ab3b3946..77010951ccf4e 100644 --- a/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp +++ b/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp @@ -26,9 +26,9 @@ Session *session; #define DEFAULT_ROW_NUMBER 1000000 void createAlignedTimeseries() { - string alignedDeviceId = "root.sg1.d1"; + string alignedDeviceId = "root.db1.d1"; vector measurements = {"s1", "s2", "s3"}; - vector alignedTimeseries = {"root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3"}; + vector alignedTimeseries = {"root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3"}; vector dataTypes = {TSDataType::INT32, TSDataType::DOUBLE, TSDataType::BOOLEAN}; vector encodings = {TSEncoding::PLAIN, TSEncoding::GORILLA, TSEncoding::RLE}; vector compressors = { @@ -60,12 +60,12 @@ void createSchemaTemplate() { temp.addToTemplate(mNodeS2); session->createSchemaTemplate(temp); - session->setSchemaTemplate("template1", "root.sg3.d1"); + session->setSchemaTemplate("template1", "root.db3.d1"); } } void ActivateTemplate() { - session->executeNonQueryStatement("insert into root.sg3.d1(timestamp,s1, s2) values(200, 1, 1);"); + session->executeNonQueryStatement("insert into root.db3.d1(timestamp,s1, s2) values(200, 1, 1);"); } void showDevices() { @@ -101,7 +101,7 @@ void showTimeseries() { } void insertAlignedRecord() { - string deviceId = "root.sg1.d1"; + string deviceId = "root.db1.d1"; vector measurements; measurements.emplace_back("s1"); measurements.emplace_back("s2"); @@ -117,7 +117,7 @@ void insertAlignedRecord() { } void insertAlignedRecords() { - string deviceId = "root.sg1.d1"; + string deviceId = "root.db1.d1"; vector measurements; measurements.emplace_back("s1"); measurements.emplace_back("s2"); @@ -159,7 +159,7 @@ void insertAlignedTablet() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet("root.sg2.d2", schemas, 100000); + Tablet tablet("root.db2.d2", schemas, 100000); tablet.setAligned(true); for (int64_t time = 0; time < DEFAULT_ROW_NUMBER; time++) { @@ -192,14 +192,14 @@ void insertAlignedTablets() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet1("root.sg1.d1", schemas, 100); - Tablet tablet2("root.sg1.d2", schemas, 100); - Tablet tablet3("root.sg1.d3", schemas, 100); + Tablet tablet1("root.db1.d1", schemas, 100); + Tablet tablet2("root.db1.d2", schemas, 100); + Tablet tablet3("root.db1.d3", schemas, 100); unordered_map tabletMap; - tabletMap["root.sg1.d1"] = &tablet1; - tabletMap["root.sg1.d2"] = &tablet2; - tabletMap["root.sg1.d3"] = &tablet3; + tabletMap["root.db1.d1"] = &tablet1; + tabletMap["root.db1.d2"] = &tablet2; + tabletMap["root.db1.d3"] = &tablet3; for (int64_t time = 0; time < 20; time++) { size_t row1 = tablet1.rowSize++; @@ -256,7 +256,7 @@ void insertNullableTabletWithAlignedTimeseries() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet("root.sg1.d4", schemas, 20); + Tablet tablet("root.db1.d4", schemas, 20); tablet.setAligned(true); for (int64_t time = 0; time < 20; time++) { @@ -291,7 +291,7 @@ void insertNullableTabletWithAlignedTimeseries() { } void query() { - unique_ptr dataSet = session->executeQueryStatement("select * from root.sg1.**"); + unique_ptr dataSet = session->executeQueryStatement("select * from root.db1.**"); cout << "timestamp" << " "; for (const string &name: dataSet->getColumnNames()) { cout << name << " "; @@ -315,11 +315,11 @@ void deleteData() { void deleteTimeseries() { vector paths; - vector alignedTimeseries = {"root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", - "root.sg1.d2.s1", "root.sg1.d2.s2", "root.sg1.d2.s3", - "root.sg1.d3.s1", "root.sg1.d3.s2", "root.sg1.d3.s3", - "root.sg1.d4.s1", "root.sg1.d4.s2", "root.sg1.d4.s3", - "root.sg2.d2.s1", "root.sg2.d2.s2", "root.sg2.d2.s3", }; + vector alignedTimeseries = {"root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", + "root.db1.d2.s1", "root.db1.d2.s2", "root.db1.d2.s3", + "root.db1.d3.s1", "root.db1.d3.s2", "root.db1.d3.s3", + "root.db1.d4.s1", "root.db1.d4.s2", "root.db1.d4.s3", + "root.db2.d2.s1", "root.db2.d2.s2", "root.db2.d2.s3", }; for (const string ×eries: alignedTimeseries) { if (session->checkTimeseriesExists(timeseries)) { paths.push_back(timeseries); @@ -330,8 +330,8 @@ void deleteTimeseries() { void deleteStorageGroups() { vector storageGroups; - storageGroups.emplace_back("root.sg1"); - storageGroups.emplace_back("root.sg2"); + storageGroups.emplace_back("root.db1"); + storageGroups.emplace_back("root.db2"); session->deleteStorageGroups(storageGroups); } @@ -346,7 +346,7 @@ int main() { cout << "setStorageGroup\n" << endl; try { - session->setStorageGroup("root.sg1"); + session->setStorageGroup("root.db1"); } catch (IoTDBException &e) { string errorMessage(e.what()); diff --git a/example/client-cpp-example/src/SessionExample.cpp b/example/client-cpp-example/src/SessionExample.cpp index 2803d18976cbf..e941d2b30cbb3 100644 --- a/example/client-cpp-example/src/SessionExample.cpp +++ b/example/client-cpp-example/src/SessionExample.cpp @@ -24,35 +24,35 @@ using namespace std; Session *session; void createTimeseries() { - if (!session->checkTimeseriesExists("root.sg1.d1.s1")) { - session->createTimeseries("root.sg1.d1.s1", TSDataType::BOOLEAN, TSEncoding::RLE, + if (!session->checkTimeseriesExists("root.db1.d1.s1")) { + session->createTimeseries("root.db1.d1.s1", TSDataType::BOOLEAN, TSEncoding::RLE, CompressionType::SNAPPY); } - if (!session->checkTimeseriesExists("root.sg1.d1.s2")) { - session->createTimeseries("root.sg1.d1.s2", TSDataType::INT32, TSEncoding::RLE, + if (!session->checkTimeseriesExists("root.db1.d1.s2")) { + session->createTimeseries("root.db1.d1.s2", TSDataType::INT32, TSEncoding::RLE, CompressionType::SNAPPY); } - if (!session->checkTimeseriesExists("root.sg1.d1.s3")) { - session->createTimeseries("root.sg1.d1.s3", TSDataType::FLOAT, TSEncoding::RLE, + if (!session->checkTimeseriesExists("root.db1.d1.s3")) { + session->createTimeseries("root.db1.d1.s3", TSDataType::FLOAT, TSEncoding::RLE, CompressionType::SNAPPY); } // create timeseries with tags and attributes - if (!session->checkTimeseriesExists("root.sg1.d1.s4")) { + if (!session->checkTimeseriesExists("root.db1.d1.s4")) { map tags; tags["tag1"] = "v1"; map attributes; attributes["description"] = "v1"; - session->createTimeseries("root.sg1.d1.s4", TSDataType::INT64, TSEncoding::RLE, + session->createTimeseries("root.db1.d1.s4", TSDataType::INT64, TSEncoding::RLE, CompressionType::SNAPPY, nullptr, &tags, &attributes, "temperature"); } } void createMultiTimeseries() { - if (!session->checkTimeseriesExists("root.sg1.d2.s1") && !session->checkTimeseriesExists("root.sg1.d2.s2")) { + if (!session->checkTimeseriesExists("root.db1.d2.s1") && !session->checkTimeseriesExists("root.db1.d2.s2")) { vector paths; - paths.emplace_back("root.sg1.d2.s1"); - paths.emplace_back("root.sg1.d2.s2"); + paths.emplace_back("root.db1.d2.s1"); + paths.emplace_back("root.db1.d2.s2"); vector tsDataTypes; tsDataTypes.push_back(TSDataType::INT64); tsDataTypes.push_back(TSDataType::DOUBLE); @@ -104,12 +104,12 @@ void createSchemaTemplate() { temp.addToTemplate(mNodeS2); session->createSchemaTemplate(temp); - session->setSchemaTemplate("template1", "root.sg3.d1"); + session->setSchemaTemplate("template1", "root.db3.d1"); } } void ActivateTemplate() { - session->executeNonQueryStatement("insert into root.sg3.d1(timestamp,s1, s2) values(200, 1, 1);"); + session->executeNonQueryStatement("insert into root.db3.d1(timestamp,s1, s2) values(200, 1, 1);"); } void showTimeseries() { @@ -129,7 +129,7 @@ void showTimeseries() { } void insertRecord() { - string deviceId = "root.sg2.d1"; + string deviceId = "root.db2.d1"; vector measurements; measurements.emplace_back("s1"); measurements.emplace_back("s2"); @@ -152,7 +152,7 @@ void insertTablet() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet("root.sg1.d1", schemas, 100); + Tablet tablet("root.db1.d1", schemas, 100); for (int64_t time = 0; time < 30; time++) { size_t row = tablet.rowSize++; @@ -180,7 +180,7 @@ void insertTablet() { } void insertRecords() { - string deviceId = "root.sg2.d1"; + string deviceId = "root.db2.d1"; vector measurements; measurements.emplace_back("s1"); measurements.emplace_back("s2"); @@ -222,12 +222,12 @@ void insertTablets() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet1("root.sg1.d2", schemas, 100); - Tablet tablet2("root.sg1.d3", schemas, 100); + Tablet tablet1("root.db1.d2", schemas, 100); + Tablet tablet2("root.db1.d3", schemas, 100); unordered_map tabletMap; - tabletMap["root.sg1.d2"] = &tablet1; - tabletMap["root.sg1.d3"] = &tablet2; + tabletMap["root.db1.d2"] = &tablet1; + tabletMap["root.db1.d3"] = &tablet2; for (int64_t time = 0; time < 30; time++) { size_t row1 = tablet1.rowSize++; @@ -285,7 +285,7 @@ void insertTabletWithNullValues() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet("root.sg1.d4", schemas, 30); + Tablet tablet("root.db1.d4", schemas, 30); for (int64_t time = 0; time < 30; time++) { size_t row = tablet.rowSize++; @@ -311,7 +311,7 @@ void insertTabletWithNullValues() { } void nonQuery() { - session->executeNonQueryStatement("insert into root.sg1.d1(timestamp,s1) values(100, 1);"); + session->executeNonQueryStatement("insert into root.db1.d1(timestamp,s1) values(100, 1);"); } void query() { @@ -331,18 +331,18 @@ void query() { } void deleteData() { - string path = "root.sg1.d1.s1"; + string path = "root.db1.d1.s1"; int64_t deleteTime = 99; session->deleteData(path, deleteTime); } void deleteTimeseries() { vector paths; - vector timeseriesGrp = { "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", - "root.sg1.d2.s1", "root.sg1.d2.s2", "root.sg1.d2.s3", - "root.sg1.d3.s1", "root.sg1.d3.s2", "root.sg1.d3.s3", - "root.sg1.d4.s1", "root.sg1.d4.s2", "root.sg1.d4.s3", - "root.sg2.d1.s1", "root.sg2.d1.s2", "root.sg2.d1.s3" }; + vector timeseriesGrp = { "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", + "root.db1.d2.s1", "root.db1.d2.s2", "root.db1.d2.s3", + "root.db1.d3.s1", "root.db1.d3.s2", "root.db1.d3.s3", + "root.db1.d4.s1", "root.db1.d4.s2", "root.db1.d4.s3", + "root.db2.d1.s1", "root.db2.d1.s2", "root.db2.d1.s3" }; for (const string& timeseries : timeseriesGrp) { if (session->checkTimeseriesExists(timeseries)) { paths.push_back(timeseries); @@ -353,8 +353,8 @@ void deleteTimeseries() { void deleteStorageGroups() { vector storageGroups; - storageGroups.emplace_back("root.sg1"); - storageGroups.emplace_back("root.sg2"); + storageGroups.emplace_back("root.db1"); + storageGroups.emplace_back("root.db2"); session->deleteStorageGroups(storageGroups); } @@ -379,9 +379,9 @@ int main() { session = new Session("127.0.0.1", 6667, "root", "root"); session->open(false); - cout << "setStorageGroup: root.sg1\n" << endl; + cout << "setStorageGroup: root.db1\n" << endl; try { - session->setStorageGroup("root.sg1"); + session->setStorageGroup("root.db1"); } catch (IoTDBException &e) { string errorMessage(e.what()); @@ -391,9 +391,9 @@ int main() { //throw e; } - cout << "setStorageGroup: root.sg2\n" << endl; + cout << "setStorageGroup: root.db2\n" << endl; try { - session->setStorageGroup("root.sg2"); + session->setStorageGroup("root.db2"); } catch (IoTDBException &e) { string errorMessage(e.what()); diff --git a/example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java b/example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java index efd9449079758..50dfd781d823e 100644 --- a/example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java +++ b/example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java @@ -45,21 +45,21 @@ public static void main(String[] args) throws ClassNotFoundException, SQLExcepti // set JDBC fetchSize statement.setFetchSize(10000); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s3 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s3 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); for (int i = 0; i <= 100; i++) { statement.addBatch(prepareInsertStatement(i)); @@ -107,7 +107,7 @@ private static void outputResult(ResultSet resultSet) throws SQLException { private static String prepareInsertStatement(int time) { return String.format( - "insert into root.sg1.d1(timestamp, s1, s2, s3, s4, s5, s6, s7) values(%d, %d, %d, %d, \"%s\", %d, %s, \"%s\")", + "insert into root.db1.d1(timestamp, s1, s2, s3, s4, s5, s6, s7) values(%d, %d, %d, %d, \"%s\", %d, %s, \"%s\")", time, 1, 1, 1, LocalDate.of(2024, 5, time % 31 + 1), time, "X'cafebabe'", time); } } diff --git a/example/jdbc/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java b/example/jdbc/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java index 98d75a398845b..4d1ea498ef008 100644 --- a/example/jdbc/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java +++ b/example/jdbc/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java @@ -32,38 +32,38 @@ public class SyntaxConventionRelatedExample { /** - * if you want to create a time series named root.sg1.select, a possible SQL statement would be - * like: create timeseries root.sg1.select with datatype=FLOAT, encoding=RLE As described before, + * if you want to create a time series named root.db1.select, a possible SQL statement would be + * like: create timeseries root.db1.select with datatype=FLOAT, encoding=RLE As described before, * when using session API, path is represented using String. The path should be written as - * "root.sg1.select". + * "root.db1.select". */ - private static final String ROOT_SG1_KEYWORD_EXAMPLE = "root.sg1.select"; + private static final String ROOT_DB1_KEYWORD_EXAMPLE = "root.db1.select"; /** - * if you want to create a time series named root.sg1.111, a possible SQL statement would be like: - * create timeseries root.sg1.`111` with datatype=FLOAT, encoding=RLE The path should be written - * as "root.sg1.`111`". + * if you want to create a time series named root.db1.111, a possible SQL statement would be like: + * create timeseries root.db1.`111` with datatype=FLOAT, encoding=RLE The path should be written + * as "root.db1.`111`". */ - private static final String ROOT_SG1_DIGITS_EXAMPLE = "root.sg1.`111`"; + private static final String ROOT_DB1_DIGITS_EXAMPLE = "root.db1.`111`"; /** - * if you want to create a time series named root.sg1.`a"b'c``, a possible SQL statement would be - * like: create timeseries root.sg1.`a"b'c``` with datatype=FLOAT, encoding=RLE The path should be - * written as "root.sg1.`a"b`c```". + * if you want to create a time series named root.db1.`a"b'c``, a possible SQL statement would be + * like: create timeseries root.db1.`a"b'c``` with datatype=FLOAT, encoding=RLE The path should be + * written as "root.db1.`a"b`c```". */ - private static final String ROOT_SG1_SPECIAL_CHARACTER_EXAMPLE = "root.sg1.`a\"b'c```"; + private static final String ROOT_DB1_SPECIAL_CHARACTER_EXAMPLE = "root.db1.`a\"b'c```"; /** - * if you want to create a time series named root.sg1.a, a possible SQL statement would be like: - * create timeseries root.sg1.a with datatype=FLOAT, encoding=RLE The path should be written as - * "root.sg1.a". + * if you want to create a time series named root.db1.a, a possible SQL statement would be like: + * create timeseries root.db1.a with datatype=FLOAT, encoding=RLE The path should be written as + * "root.db1.a". */ - private static final String ROOT_SG1_NORMAL_NODE_EXAMPLE = "root.sg1.a"; + private static final String ROOT_DB1_NORMAL_NODE_EXAMPLE = "root.db1.a"; public static final String CREATE = "CREATE TIMESERIES %s WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"; - private static final String DEVICE = "root.sg1"; + private static final String DEVICE = "root.db1"; public static void main(String[] args) throws ClassNotFoundException, SQLException { Class.forName("org.apache.iotdb.jdbc.IoTDBDriver"); @@ -78,13 +78,13 @@ public static void main(String[] args) throws ClassNotFoundException, SQLExcepti // create time series statement.execute(String.format("CREATE DATABASE %s", DEVICE)); - statement.execute(String.format(CREATE, ROOT_SG1_DIGITS_EXAMPLE)); - statement.execute(String.format(CREATE, ROOT_SG1_KEYWORD_EXAMPLE)); - statement.execute(String.format(CREATE, ROOT_SG1_NORMAL_NODE_EXAMPLE)); - statement.execute(String.format(CREATE, ROOT_SG1_SPECIAL_CHARACTER_EXAMPLE)); + statement.execute(String.format(CREATE, ROOT_DB1_DIGITS_EXAMPLE)); + statement.execute(String.format(CREATE, ROOT_DB1_KEYWORD_EXAMPLE)); + statement.execute(String.format(CREATE, ROOT_DB1_NORMAL_NODE_EXAMPLE)); + statement.execute(String.format(CREATE, ROOT_DB1_SPECIAL_CHARACTER_EXAMPLE)); // show timeseries - ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.*"); + ResultSet resultSet = statement.executeQuery("show timeseries root.db1.*"); List timeseriesList = new ArrayList<>(); while (resultSet.next()) { timeseriesList.add(resultSet.getString("Timeseries")); @@ -97,15 +97,15 @@ public static void main(String[] args) throws ClassNotFoundException, SQLExcepti statement.executeBatch(); statement.clearBatch(); - resultSet = statement.executeQuery("select ** from root.sg1 where time <= 10"); + resultSet = statement.executeQuery("select ** from root.db1 where time <= 10"); outputResult(resultSet); for (String path : timeseriesList) { - // For example, for timeseires root.sg1.`111`, sensor is 111, as described in syntax + // For example, for timeseires root.db1.`111`, sensor is 111, as described in syntax // convention, it should be written as `111` in SQL - // in resultSet of "show timeseries", result is root.sg1.`111`, which means you need not to + // in resultSet of "show timeseries", result is root.db1.`111`, which means you need not to // worry about dealing with backquotes yourself. resultSet = - statement.executeQuery(String.format("select %s from root.sg1", removeDevice(path))); + statement.executeQuery(String.format("select %s from root.db1", removeDevice(path))); outputResult(resultSet); } } catch (IoTDBSQLException e) { @@ -139,9 +139,9 @@ private static void outputResult(ResultSet resultSet) throws SQLException { } private static String prepareInsertStatement(int time, String path) { - // remove device root.sg1 + // remove device root.db1 path = removeDevice(path); - return String.format("insert into root.sg1(timestamp, %s) values( %d ,1)", path, time); + return String.format("insert into root.db1(timestamp, %s) values( %d ,1)", path, time); } private static String removeDevice(String path) { diff --git a/example/mqtt/README.md b/example/mqtt/README.md index 421dcd8b7263d..5f0427527266e 100644 --- a/example/mqtt/README.md +++ b/example/mqtt/README.md @@ -29,5 +29,5 @@ The example is to show how to send data to IoTDB from a mqtt client. * Update configuration to enable MQTT service. (`enable_mqtt_service=true` in iotdb-datanode.properties) * Launch the IoTDB server. -* Setup database `CREATE DATABASE root.sg` and create time timeseries `CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=DOUBLE, ENCODING=PLAIN`. +* Setup database `CREATE DATABASE root.db` and create time timeseries `CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=DOUBLE, ENCODING=PLAIN`. * Run `org.apache.iotdb.mqtt.MQTTClient` to run the mqtt client and send events to server. diff --git a/example/mqtt/src/main/java/org/apache/iotdb/mqtt/MQTTClient.java b/example/mqtt/src/main/java/org/apache/iotdb/mqtt/MQTTClient.java index ec15ad23567a3..c84ead139bedc 100644 --- a/example/mqtt/src/main/java/org/apache/iotdb/mqtt/MQTTClient.java +++ b/example/mqtt/src/main/java/org/apache/iotdb/mqtt/MQTTClient.java @@ -52,7 +52,7 @@ private static void jsonPayloadFormatter(BlockingConnection connection) throws E String payload = String.format( "{\n" - + "\"device\":\"root.sg.d1\",\n" + + "\"device\":\"root.db.d1\",\n" + "\"timestamp\":%d,\n" + "\"measurements\":[\"s1\"],\n" + "\"values\":[%f]\n" @@ -62,12 +62,12 @@ private static void jsonPayloadFormatter(BlockingConnection connection) throws E // publish a json object Thread.sleep(1); - connection.publish("root.sg.d1.s1", payload.getBytes(), QoS.AT_LEAST_ONCE, false); + connection.publish("root.db.d1.s1", payload.getBytes(), QoS.AT_LEAST_ONCE, false); } // publish a json array sb.insert(0, "["); sb.replace(sb.lastIndexOf(","), sb.length(), "]"); - connection.publish("root.sg.d1.s1", sb.toString().getBytes(), QoS.AT_LEAST_ONCE, false); + connection.publish("root.db.d1.s1", sb.toString().getBytes(), QoS.AT_LEAST_ONCE, false); } // The database must be created in advance diff --git a/example/rest-client-c-example/main.c b/example/rest-client-c-example/main.c index 2bd5efdd9daae..3c397e69058ad 100644 --- a/example/rest-client-c-example/main.c +++ b/example/rest-client-c-example/main.c @@ -86,7 +86,7 @@ void nonQuery(char* sql_str) { } void insertTablet(char * sql_str) { - // curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"timestamps":[1635232143960,1635232153960],"measurements":["s3","s4"],"dataTypes":["INT32","BOOLEAN"],"values":[[11,null],[false,true]],"isAligned":false,"deviceId":"root.sg27"}' http://127.0.0.1:18080/rest/v1/insertTablet + // curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"timestamps":[1635232143960,1635232153960],"measurements":["s3","s4"],"dataTypes":["INT32","BOOLEAN"],"values":[[11,null],[false,true]],"isAligned":false,"deviceId":"root.db27"}' http://127.0.0.1:18080/rest/v1/insertTablet CURL *curl_handle = curl_easy_init(); if (curl_handle == NULL) { fprintf(stderr, "curl_handle == NULL\n"); diff --git a/example/rest-java-example/src/main/java/org/apache/iotdb/HttpExample.java b/example/rest-java-example/src/main/java/org/apache/iotdb/HttpExample.java index bccc2fd254949..53893da866eec 100644 --- a/example/rest-java-example/src/main/java/org/apache/iotdb/HttpExample.java +++ b/example/rest-java-example/src/main/java/org/apache/iotdb/HttpExample.java @@ -94,7 +94,7 @@ public void insertTablet() { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:18080/rest/v1/insertTablet"); String json = - "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.sg25\"}"; + "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.db25\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -119,7 +119,7 @@ public void query() { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:18080/rest/v1/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); diff --git a/example/rest-java-example/src/main/java/org/apache/iotdb/HttpsExample.java b/example/rest-java-example/src/main/java/org/apache/iotdb/HttpsExample.java index a3dbbceafc7fe..2a543d8d62a1e 100644 --- a/example/rest-java-example/src/main/java/org/apache/iotdb/HttpsExample.java +++ b/example/rest-java-example/src/main/java/org/apache/iotdb/HttpsExample.java @@ -94,7 +94,7 @@ public void insertTablet() { try { HttpPost httpPost = getHttpPost("https://127.0.0.1:18080/rest/v1/insertTablet"); String json = - "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.sg25\"}"; + "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.db25\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -119,7 +119,7 @@ public void query() { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("https://127.0.0.1:18080/rest/v1/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); diff --git a/example/rest-java-example/src/main/java/org/apache/iotdb/TableHttpExample.java b/example/rest-java-example/src/main/java/org/apache/iotdb/TableHttpExample.java index b9651245d0206..0765dc8ada4aa 100644 --- a/example/rest-java-example/src/main/java/org/apache/iotdb/TableHttpExample.java +++ b/example/rest-java-example/src/main/java/org/apache/iotdb/TableHttpExample.java @@ -93,7 +93,7 @@ public void insertTablet() { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:18080/rest/table/v1/insertTablet"); String json = - "{\"database\":\"test\",\"column_categories\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"id1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11333],[\"a11\",\"false\",22333],[\"a13\",\"false1\",23333],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; + "{\"database\":\"test\",\"column_categories\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"id1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11333],[\"a11\",\"false\",22333],[\"a13\",\"false1\",23333],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"db211\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -121,7 +121,7 @@ public void nonQuery() { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:18080/rest/table/v1/nonQuery"); String sql = - "{\"database\":\"test\",\"sql\":\"INSERT INTO sg211(time, id1, s1) values(100, 'd1', 0)\"}"; + "{\"database\":\"test\",\"sql\":\"INSERT INTO db211(time, id1, s1) values(100, 'd1', 0)\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -174,7 +174,7 @@ public void createTable() { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:18080/rest/table/v1/nonQuery"); String sql = - "{\"database\":\"test\",\"sql\":\"create table sg211 (id1 string TAG,t1 STRING ATTRIBUTE, s1 FLOAT FIELD)\"}"; + "{\"database\":\"test\",\"sql\":\"create table db211 (id1 string TAG,t1 STRING ATTRIBUTE, s1 FLOAT FIELD)\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -200,7 +200,7 @@ public void query() { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:18080/rest/table/v1/query"); - String sql = "{\"database\":\"test\",\"sql\":\"select * from sg211\"}"; + String sql = "{\"database\":\"test\",\"sql\":\"select * from db211\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); diff --git a/example/rest-java-example/src/main/java/org/apache/iotdb/TableHttpsExample.java b/example/rest-java-example/src/main/java/org/apache/iotdb/TableHttpsExample.java index 200dbf66fdbcb..ddd67a75c0bbb 100644 --- a/example/rest-java-example/src/main/java/org/apache/iotdb/TableHttpsExample.java +++ b/example/rest-java-example/src/main/java/org/apache/iotdb/TableHttpsExample.java @@ -93,7 +93,7 @@ public void insertTablet() { try { HttpPost httpPost = getHttpPost("https://127.0.0.1:18080/rest/table/v1/insertTablet"); String json = - "{\"database\":\"test\",\"column_categories\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"id1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11333],[\"a11\",\"false\",22333],[\"a13\",\"false1\",23333],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; + "{\"database\":\"test\",\"column_categories\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"id1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11333],[\"a11\",\"false\",22333],[\"a13\",\"false1\",23333],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"db211\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -121,7 +121,7 @@ public void nonQuery() { try { HttpPost httpPost = getHttpPost("https://127.0.0.1:18080/rest/table/v1/nonQuery"); String sql = - "{\"database\":\"test\",\"sql\":\"INSERT INTO sg211(time, id1, s1) values(100, 'd1', 0)\"}"; + "{\"database\":\"test\",\"sql\":\"INSERT INTO db211(time, id1, s1) values(100, 'd1', 0)\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -174,7 +174,7 @@ public void createTable() { try { HttpPost httpPost = getHttpPost("https://127.0.0.1:18080/rest/table/v1/nonQuery"); String sql = - "{\"database\":\"test\",\"sql\":\"create table sg211 (id1 string TAG,t1 STRING ATTRIBUTE, s1 FLOAT FIELD)\"}"; + "{\"database\":\"test\",\"sql\":\"create table db211 (id1 string TAG,t1 STRING ATTRIBUTE, s1 FLOAT FIELD)\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -200,7 +200,7 @@ public void query() { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("https://127.0.0.1:18080/rest/table/v1/query"); - String sql = "{\"database\":\"test\",\"sql\":\"select * from sg211\"}"; + String sql = "{\"database\":\"test\",\"sql\":\"select * from db211\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); diff --git a/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java b/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java index 288bd65ddcb41..529212cf14c34 100644 --- a/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java +++ b/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java @@ -45,14 +45,14 @@ public class AlignedTimeseriesSessionExample { private static Session session; - private static final String ROOT_SG1_D1 = "root.sg_1.d1"; - private static final String ROOT_SG1_D1_VECTOR2 = "root.sg_1.d1.vector2"; - private static final String ROOT_SG1_D1_VECTOR3 = "root.sg_1.d1.vector3"; - private static final String ROOT_SG2_D1_VECTOR4 = "root.sg_2.d1.vector4"; - private static final String ROOT_SG2_D1_VECTOR5 = "root.sg_2.d1.vector5"; - private static final String ROOT_SG2_D1_VECTOR6 = "root.sg_2.d1.vector6"; - private static final String ROOT_SG2_D1_VECTOR7 = "root.sg_2.d1.vector7"; - private static final String ROOT_SG2_D1_VECTOR8 = "root.sg_2.d1.vector8"; + private static final String ROOT_DB1_D1 = "root.db_1.d1"; + private static final String ROOT_DB1_D1_VECTOR2 = "root.db_1.d1.vector2"; + private static final String ROOT_DB1_D1_VECTOR3 = "root.db_1.d1.vector3"; + private static final String ROOT_DB2_D1_VECTOR4 = "root.db_2.d1.vector4"; + private static final String ROOT_DB2_D1_VECTOR5 = "root.db_2.d1.vector5"; + private static final String ROOT_DB2_D1_VECTOR6 = "root.db_2.d1.vector6"; + private static final String ROOT_DB2_D1_VECTOR7 = "root.db_2.d1.vector7"; + private static final String ROOT_DB2_D1_VECTOR8 = "root.db_2.d1.vector8"; public static final String FLUSH = "flush"; public static void main(String[] args) @@ -83,21 +83,21 @@ public static void main(String[] args) selectWithValueFilterTest(); selectWithLastTest(); selectWithLastTestWithoutValueFilter(); - session.executeNonQueryStatement("delete from root.sg_1.d1.s1 where time <= 5"); - System.out.println("execute sql delete from root.sg_1.d1.s1 where time <= 5"); + session.executeNonQueryStatement("delete from root.db_1.d1.s1 where time <= 5"); + System.out.println("execute sql delete from root.db_1.d1.s1 where time <= 5"); selectTest(); selectWithValueFilterTest(); selectWithLastTest(); selectWithLastTestWithoutValueFilter(); - session.executeNonQueryStatement("delete from root.sg_1.d1.s2 where time <= 3"); - System.out.println("execute sql delete from root.sg_1.d1.s2 where time <= 3"); + session.executeNonQueryStatement("delete from root.db_1.d1.s2 where time <= 3"); + System.out.println("execute sql delete from root.db_1.d1.s2 where time <= 3"); selectTest(); selectWithValueFilterTest(); selectWithLastTest(); selectWithLastTestWithoutValueFilter(); - session.executeNonQueryStatement("delete from root.sg_1.d1.s1 where time <= 10"); - System.out.println("execute sql delete from root.sg_1.d1.s1 where time <= 10"); + session.executeNonQueryStatement("delete from root.db_1.d1.s1 where time <= 10"); + System.out.println("execute sql delete from root.db_1.d1.s1 where time <= 10"); selectTest(); selectWithValueFilterTest(); selectWithLastTest(); @@ -115,14 +115,14 @@ public static void main(String[] args) } private static void selectTest() throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select s1 from root.sg_1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select s1 from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); } dataSet.closeOperationHandle(); - dataSet = session.executeQueryStatement("select * from root.sg_1.d1"); + dataSet = session.executeQueryStatement("select * from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -134,7 +134,7 @@ private static void selectTest() throws StatementExecutionException, IoTDBConnec private static void selectWithAlignByDeviceTest() throws StatementExecutionException, IoTDBConnectionException { SessionDataSet dataSet = - session.executeQueryStatement("select * from root.sg_1 align by device"); + session.executeQueryStatement("select * from root.db_1 align by device"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -146,7 +146,7 @@ private static void selectWithAlignByDeviceTest() private static void selectWithValueFilterTest() throws StatementExecutionException, IoTDBConnectionException { SessionDataSet dataSet = - session.executeQueryStatement("select s1 from root.sg_1.d1 where s1 > 3 and time < 9"); + session.executeQueryStatement("select s1 from root.db_1.d1 where s1 > 3 and time < 9"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -155,7 +155,7 @@ private static void selectWithValueFilterTest() dataSet.closeOperationHandle(); dataSet = session.executeQueryStatement( - "select * from root.sg_1.d1 where time < 8 and s1 > 3 and s2 > 5"); + "select * from root.db_1.d1 where time < 8 and s1 > 3 and s2 > 5"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -166,14 +166,14 @@ private static void selectWithValueFilterTest() private static void selectWithAggregationTest() throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select count(s1) from root.sg_1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select count(s1) from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); } dataSet.closeOperationHandle(); - dataSet = session.executeQueryStatement("select count(*) from root.sg_1.d1"); + dataSet = session.executeQueryStatement("select count(*) from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -182,7 +182,7 @@ private static void selectWithAggregationTest() dataSet.closeOperationHandle(); dataSet = session.executeQueryStatement( - "select sum(*) from root.sg_1.d1.vector where time > 50 and s1 > 0 and s2 > 10000"); + "select sum(*) from root.db_1.d1.vector where time > 50 and s1 > 0 and s2 > 10000"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -195,7 +195,7 @@ private static void selectWithGroupByTest() throws StatementExecutionException, IoTDBConnectionException { SessionDataSet dataSet = session.executeQueryStatement( - "select count(s1) from root.sg_1.d1.vector GROUP BY ([1, 100), 20ms)"); + "select count(s1) from root.db_1.d1.vector GROUP BY ([1, 100), 20ms)"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -204,7 +204,7 @@ private static void selectWithGroupByTest() dataSet.closeOperationHandle(); dataSet = session.executeQueryStatement( - "select count(*) from root.sg_1.d1.vector where time > 50 and s1 > 0 and s2 > 10000" + "select count(*) from root.db_1.d1.vector where time > 50 and s1 > 0 and s2 > 10000" + " GROUP BY ([50, 100), 10ms)"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { @@ -216,14 +216,14 @@ private static void selectWithGroupByTest() private static void selectWithLastTest() throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select last s1 from root.sg_1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select last s1 from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); } dataSet.closeOperationHandle(); - dataSet = session.executeQueryStatement("select last * from root.sg_1.d1"); + dataSet = session.executeQueryStatement("select last * from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -235,7 +235,7 @@ private static void selectWithLastTest() private static void selectWithLastTestWithoutValueFilter() throws StatementExecutionException, IoTDBConnectionException { SessionDataSet dataSet = - session.executeQueryStatement("select last s1 from root.sg_1.d1 where time >= 5"); + session.executeQueryStatement("select last s1 from root.db_1.d1 where time >= 5"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -243,14 +243,14 @@ private static void selectWithLastTestWithoutValueFilter() dataSet.closeOperationHandle(); - dataSet = session.executeQueryStatement("select last * from root.sg_1.d1 where time >= 5"); + dataSet = session.executeQueryStatement("select last * from root.db_1.d1 where time >= 5"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); } dataSet.closeOperationHandle(); - dataSet = session.executeQueryStatement("select last * from root.sg_1.d1 where time >= 20"); + dataSet = session.executeQueryStatement("select last * from root.db_1.d1 where time >= 20"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -274,7 +274,7 @@ private static void createAlignedTimeseries() compressors.add(CompressionType.SNAPPY); } session.createAlignedTimeseries( - ROOT_SG1_D1, measurements, dataTypes, encodings, compressors, null, null, null); + ROOT_DB1_D1, measurements, dataTypes, encodings, compressors, null, null, null); } private static void createAlignedTimeseriesWithNullPartical() @@ -311,7 +311,7 @@ private static void createAlignedTimeseriesWithNullPartical() alias.add(null); session.createAlignedTimeseries( - ROOT_SG1_D1, + ROOT_DB1_D1, measurements, dataTypes, encodings, @@ -337,7 +337,7 @@ private static void createTemplate() template.addToTemplate(iNodeVector); session.createSchemaTemplate(template); - session.setSchemaTemplate("template1", "root.sg_1"); + session.setSchemaTemplate("template1", "root.db_1"); } /** Method 1 for insert tablet with aligned timeseries */ @@ -349,7 +349,7 @@ private static void insertTabletWithAlignedTimeseriesMethod1() schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT32)); - Tablet tablet = new Tablet(ROOT_SG1_D1, schemaList); + Tablet tablet = new Tablet(ROOT_DB1_D1, schemaList); long timestamp = 1; for (long row = 1; row < 100; row++) { @@ -384,7 +384,7 @@ private static void insertTabletWithAlignedTimeseriesMethod2() schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT32)); - Tablet tablet = new Tablet(ROOT_SG1_D1_VECTOR2, schemaList); + Tablet tablet = new Tablet(ROOT_DB1_D1_VECTOR2, schemaList); for (long time = 100; time < 200; time++) { int row = tablet.getRowSize(); @@ -416,7 +416,7 @@ private static void insertNullableTabletWithAlignedTimeseries() schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT32)); - Tablet tablet = new Tablet(ROOT_SG1_D1_VECTOR3, schemaList); + Tablet tablet = new Tablet(ROOT_DB1_D1_VECTOR3, schemaList); for (long time = 200; time < 300; time++) { int row = tablet.getRowSize(); @@ -456,7 +456,7 @@ private static void insertAlignedRecord() List values = new ArrayList<>(); values.add(time); values.add((int) time); - session.insertAlignedRecord(ROOT_SG1_D1, time, measurements, types, values); + session.insertAlignedRecord(ROOT_DB1_D1, time, measurements, types, values); } session.executeNonQueryStatement(FLUSH); // second file we only have s1's data @@ -467,7 +467,7 @@ private static void insertAlignedRecord() for (long time = 10; time < 20; time++) { List values = new ArrayList<>(); values.add(time); - session.insertAlignedRecord(ROOT_SG1_D1, time, measurements, types, values); + session.insertAlignedRecord(ROOT_DB1_D1, time, measurements, types, values); } } @@ -481,7 +481,7 @@ private static void insertAlignedStringRecord() List values = new ArrayList<>(); values.add("3"); values.add("4"); - session.insertAlignedRecord(ROOT_SG2_D1_VECTOR5, time, measurements, values); + session.insertAlignedRecord(ROOT_DB2_D1_VECTOR5, time, measurements, values); } } @@ -506,7 +506,7 @@ private static void insertAlignedRecords() values.add(1L); values.add(2); - deviceIds.add(ROOT_SG2_D1_VECTOR4); + deviceIds.add(ROOT_DB2_D1_VECTOR4); times.add(time); measurementsList.add(measurements); typeList.add(types); @@ -531,7 +531,7 @@ private static void insertAlignedStringRecords() values.add("3"); values.add("4"); - deviceIds.add(ROOT_SG2_D1_VECTOR5); + deviceIds.add(ROOT_DB2_D1_VECTOR5); times.add(time); measurementsList.add(measurements); valueList.add(values); @@ -565,7 +565,7 @@ private static void insertAlignedRecordsOfOneDevice() valueList.add(values); } session.insertAlignedRecordsOfOneDevice( - ROOT_SG2_D1_VECTOR4, times, measurementsList, typeList, valueList); + ROOT_DB2_D1_VECTOR4, times, measurementsList, typeList, valueList); } private static void insertTabletsWithAlignedTimeseries() @@ -583,14 +583,14 @@ private static void insertTabletsWithAlignedTimeseries() schemaList3.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList3.add(new MeasurementSchema("s2", TSDataType.INT64)); - Tablet tablet1 = new Tablet(ROOT_SG2_D1_VECTOR6, schemaList1, 100); - Tablet tablet2 = new Tablet(ROOT_SG2_D1_VECTOR7, schemaList2, 100); - Tablet tablet3 = new Tablet(ROOT_SG2_D1_VECTOR8, schemaList3, 100); + Tablet tablet1 = new Tablet(ROOT_DB2_D1_VECTOR6, schemaList1, 100); + Tablet tablet2 = new Tablet(ROOT_DB2_D1_VECTOR7, schemaList2, 100); + Tablet tablet3 = new Tablet(ROOT_DB2_D1_VECTOR8, schemaList3, 100); Map tabletMap = new HashMap<>(); - tabletMap.put(ROOT_SG2_D1_VECTOR6, tablet1); - tabletMap.put(ROOT_SG2_D1_VECTOR7, tablet2); - tabletMap.put(ROOT_SG2_D1_VECTOR8, tablet3); + tabletMap.put(ROOT_DB2_D1_VECTOR6, tablet1); + tabletMap.put(ROOT_DB2_D1_VECTOR7, tablet2); + tabletMap.put(ROOT_DB2_D1_VECTOR8, tablet3); // Method 1 to add tablet data long timestamp = System.currentTimeMillis(); @@ -639,14 +639,14 @@ private static void insertTabletsWithAlignedTimeseriesWithNullValue() schemaList3.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList3.add(new MeasurementSchema("s2", TSDataType.INT64)); - Tablet tablet1 = new Tablet(ROOT_SG2_D1_VECTOR6, schemaList1, 100); - Tablet tablet2 = new Tablet(ROOT_SG2_D1_VECTOR7, schemaList2, 100); - Tablet tablet3 = new Tablet(ROOT_SG2_D1_VECTOR8, schemaList3, 100); + Tablet tablet1 = new Tablet(ROOT_DB2_D1_VECTOR6, schemaList1, 100); + Tablet tablet2 = new Tablet(ROOT_DB2_D1_VECTOR7, schemaList2, 100); + Tablet tablet3 = new Tablet(ROOT_DB2_D1_VECTOR8, schemaList3, 100); Map tabletMap = new HashMap<>(); - tabletMap.put(ROOT_SG2_D1_VECTOR6, tablet1); - tabletMap.put(ROOT_SG2_D1_VECTOR7, tablet2); - tabletMap.put(ROOT_SG2_D1_VECTOR8, tablet3); + tabletMap.put(ROOT_DB2_D1_VECTOR6, tablet1); + tabletMap.put(ROOT_DB2_D1_VECTOR7, tablet2); + tabletMap.put(ROOT_DB2_D1_VECTOR8, tablet3); // Method 1 to add tablet data long timestamp = System.currentTimeMillis(); diff --git a/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java b/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java index 34f529d257dbb..2e4d052e9314a 100644 --- a/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java +++ b/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java @@ -44,9 +44,9 @@ public class HybridTimeseriesSessionExample { LoggerFactory.getLogger(HybridTimeseriesSessionExample.class); private static Session session; - private static final String ROOT_SG1_ALIGNEDDEVICE = "root.sg_1.aligned_device"; - private static final String ROOT_SG1_D1 = "root.sg_1.d1"; - private static final String ROOT_SG1_D2 = "root.sg_1.d2"; + private static final String ROOT_DB1_ALIGNEDDEVICE = "root.db_1.aligned_device"; + private static final String ROOT_DB1_D1 = "root.db_1.d1"; + private static final String ROOT_DB1_D2 = "root.db_1.d2"; public static void main(String[] args) throws IoTDBConnectionException, StatementExecutionException { @@ -56,9 +56,9 @@ public static void main(String[] args) // set session fetchSize session.setFetchSize(10000); - insertRecord(ROOT_SG1_D2, 0, 100); + insertRecord(ROOT_DB1_D2, 0, 100); insertTabletWithAlignedTimeseriesMethod(0, 100); - insertRecord(ROOT_SG1_D1, 0, 100); + insertRecord(ROOT_DB1_D1, 0, 100); session.executeNonQueryStatement("flush"); selectTest(); @@ -66,7 +66,7 @@ public static void main(String[] args) } private static void selectTest() throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select ** from root.sg_1"); + SessionDataSet dataSet = session.executeQueryStatement("select ** from root.db_1"); LOGGER.info("columnNames = {}", dataSet.getColumnNames()); while (dataSet.hasNext()) { LOGGER.info("data = {}", dataSet.next()); @@ -84,7 +84,7 @@ private static void insertTabletWithAlignedTimeseriesMethod(int minTime, int max schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT32)); - Tablet tablet = new Tablet(ROOT_SG1_ALIGNEDDEVICE, schemaList); + Tablet tablet = new Tablet(ROOT_DB1_ALIGNEDDEVICE, schemaList); long timestamp = minTime; for (long row = minTime; row < maxTime; row++) { diff --git a/example/session/src/main/java/org/apache/iotdb/SessionConcurrentExample.java b/example/session/src/main/java/org/apache/iotdb/SessionConcurrentExample.java index 40d3ed12e8094..077f49d6c629f 100644 --- a/example/session/src/main/java/org/apache/iotdb/SessionConcurrentExample.java +++ b/example/session/src/main/java/org/apache/iotdb/SessionConcurrentExample.java @@ -91,7 +91,7 @@ private static void concurrentOperation(CountDownLatch latch, int currentIndex) try { insertTablet( session, - String.format("root.sg_%d.d_%d", currentIndex / PARALLEL_DEGREE_FOR_ONE_SG, j)); + String.format("root.db_%d.d_%d", currentIndex / PARALLEL_DEGREE_FOR_ONE_SG, j)); } catch (IoTDBConnectionException | StatementExecutionException e) { LOGGER.error("Insert tablet error", e); } @@ -123,7 +123,7 @@ private static void createTemplate(Session session) session.createSchemaTemplate(template); for (int i = 0; i < SG_NUM; i++) { - session.setSchemaTemplate("template1", "root.sg_" + i); + session.setSchemaTemplate("template1", "root.db_" + i); } } diff --git a/example/session/src/main/java/org/apache/iotdb/SessionExample.java b/example/session/src/main/java/org/apache/iotdb/SessionExample.java index c9e8d42aacf59..64796c2dd8194 100644 --- a/example/session/src/main/java/org/apache/iotdb/SessionExample.java +++ b/example/session/src/main/java/org/apache/iotdb/SessionExample.java @@ -54,15 +54,15 @@ public class SessionExample { private static Session session; private static Session sessionEnableRedirect; - private static final String ROOT_SG1_D1_S1 = "root.sg1.d1.s1"; - private static final String ROOT_SG1_D1_S2 = "root.sg1.d1.s2"; - private static final String ROOT_SG1_D1_S3 = "root.sg1.d1.s3"; - private static final String ROOT_SG1_D1_S4 = "root.sg1.d1.s4"; - private static final String ROOT_SG1_D1_S5 = "root.sg1.d1.s5"; - private static final String ROOT_SG1_D1 = "root.sg1.d1"; - private static final String ROOT_SG1 = "root.sg1"; + private static final String ROOT_DB1_D1_S1 = "root.db1.d1.s1"; + private static final String ROOT_DB1_D1_S2 = "root.db1.d1.s2"; + private static final String ROOT_DB1_D1_S3 = "root.db1.d1.s3"; + private static final String ROOT_DB1_D1_S4 = "root.db1.d1.s4"; + private static final String ROOT_DB1_D1_S5 = "root.db1.d1.s5"; + private static final String ROOT_DB1_D1 = "root.db1.d1"; + private static final String ROOT_DB1 = "root.db1"; private static final String LOCAL_HOST = "127.0.0.1"; - public static final String SELECT_D1 = "select * from root.sg1.d1"; + public static final String SELECT_D1 = "select * from root.db1.d1"; private static final Random RANDOM = new Random(); @@ -82,7 +82,7 @@ public static void main(String[] args) session.setFetchSize(10000); try { - session.createDatabase("root.sg1"); + session.createDatabase("root.db1"); } catch (StatementExecutionException e) { if (e.getStatusCode() != TSStatusCode.DATABASE_ALREADY_EXISTS.getStatusCode()) { throw e; @@ -131,16 +131,16 @@ private static void createAndDropContinuousQueries() throws StatementExecutionException, IoTDBConnectionException { session.executeNonQueryStatement( "CREATE CONTINUOUS QUERY cq1 " - + "BEGIN SELECT max_value(s1) INTO temperature_max FROM root.sg1.* " + + "BEGIN SELECT max_value(s1) INTO temperature_max FROM root.db1.* " + "GROUP BY time(10s) END"); session.executeNonQueryStatement( "CREATE CONTINUOUS QUERY cq2 " - + "BEGIN SELECT count(s2) INTO temperature_cnt FROM root.sg1.* " + + "BEGIN SELECT count(s2) INTO temperature_cnt FROM root.db1.* " + "GROUP BY time(10s), level=1 END"); session.executeNonQueryStatement( "CREATE CONTINUOUS QUERY cq3 " + "RESAMPLE EVERY 20s FOR 20s " - + "BEGIN SELECT avg(s3) INTO temperature_avg FROM root.sg1.* " + + "BEGIN SELECT avg(s3) INTO temperature_avg FROM root.db1.* " + "GROUP BY time(10s), level=1 END"); session.executeNonQueryStatement("DROP CONTINUOUS QUERY cq1"); session.executeNonQueryStatement("DROP CONTINUOUS QUERY cq2"); @@ -150,27 +150,27 @@ private static void createAndDropContinuousQueries() private static void createTimeseries() throws IoTDBConnectionException, StatementExecutionException { - if (!session.checkTimeseriesExists(ROOT_SG1_D1_S1)) { + if (!session.checkTimeseriesExists(ROOT_DB1_D1_S1)) { session.createTimeseries( - ROOT_SG1_D1_S1, TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + ROOT_DB1_D1_S1, TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists(ROOT_SG1_D1_S2)) { + if (!session.checkTimeseriesExists(ROOT_DB1_D1_S2)) { session.createTimeseries( - ROOT_SG1_D1_S2, TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + ROOT_DB1_D1_S2, TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists(ROOT_SG1_D1_S3)) { + if (!session.checkTimeseriesExists(ROOT_DB1_D1_S3)) { session.createTimeseries( - ROOT_SG1_D1_S3, TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + ROOT_DB1_D1_S3, TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } // create timeseries with tags and attributes - if (!session.checkTimeseriesExists(ROOT_SG1_D1_S4)) { + if (!session.checkTimeseriesExists(ROOT_DB1_D1_S4)) { Map tags = new HashMap<>(); tags.put("tag1", "v1"); Map attributes = new HashMap<>(); attributes.put("description", "v1"); session.createTimeseries( - ROOT_SG1_D1_S4, + ROOT_DB1_D1_S4, TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY, @@ -181,7 +181,7 @@ private static void createTimeseries() } // create timeseries with SDT property, SDT will take place when flushing - if (!session.checkTimeseriesExists(ROOT_SG1_D1_S5)) { + if (!session.checkTimeseriesExists(ROOT_DB1_D1_S5)) { // COMPDEV is required // COMPMAXTIME and COMPMINTIME are optional and their unit is ms Map props = new HashMap<>(); @@ -190,7 +190,7 @@ private static void createTimeseries() props.put("COMPMINTIME", "2"); props.put("COMPMAXTIME", "10"); session.createTimeseries( - ROOT_SG1_D1_S5, + ROOT_DB1_D1_S5, TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY, @@ -204,11 +204,11 @@ private static void createTimeseries() private static void createMultiTimeseries() throws IoTDBConnectionException, StatementExecutionException { - if (!session.checkTimeseriesExists("root.sg1.d2.s1") - && !session.checkTimeseriesExists("root.sg1.d2.s2")) { + if (!session.checkTimeseriesExists("root.db1.d2.s1") + && !session.checkTimeseriesExists("root.db1.d2.s2")) { List paths = new ArrayList<>(); - paths.add("root.sg1.d2.s1"); - paths.add("root.sg1.d2.s2"); + paths.add("root.db1.d2.s1"); + paths.add("root.db1.d2.s2"); List tsDataTypes = new ArrayList<>(); tsDataTypes.add(TSDataType.INT64); tsDataTypes.add(TSDataType.INT64); @@ -244,12 +244,12 @@ private static void createMultiTimeseries() private static void createMultiTimeseriesWithNullPartical() throws IoTDBConnectionException, StatementExecutionException { - if (!session.checkTimeseriesExists("root.sg1.d2.s16") - && !session.checkTimeseriesExists("root.sg1.d2.s17")) { + if (!session.checkTimeseriesExists("root.db1.d2.s16") + && !session.checkTimeseriesExists("root.db1.d2.s17")) { List paths = new ArrayList<>(); - paths.add("root.sg1.d2.s16"); - paths.add("root.sg1.d2.s17"); - paths.add("root.sg1.d2.s18"); + paths.add("root.db1.d2.s16"); + paths.add("root.db1.d2.s17"); + paths.add("root.db1.d2.s18"); List tsDataTypes = new ArrayList<>(); tsDataTypes.add(TSDataType.INT64); tsDataTypes.add(TSDataType.INT64); @@ -304,11 +304,11 @@ private static void createTemplate() template.addToTemplate(mNodeS3); session.createSchemaTemplate(template); - session.setSchemaTemplate("template1", "root.sg1"); + session.setSchemaTemplate("template1", "root.db1"); } private static void insertRecord() throws IoTDBConnectionException, StatementExecutionException { - String deviceId = ROOT_SG1_D1; + String deviceId = ROOT_DB1_D1; List measurements = new ArrayList<>(); List types = new ArrayList<>(); measurements.add("s1"); @@ -354,7 +354,7 @@ private static void insertRecord4Redirect() private static void insertStrRecord() throws IoTDBConnectionException, StatementExecutionException { - String deviceId = ROOT_SG1_D1; + String deviceId = ROOT_DB1_D1; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -371,7 +371,7 @@ private static void insertStrRecord() private static void insertRecordInObject() throws IoTDBConnectionException, StatementExecutionException { - String deviceId = ROOT_SG1_D1; + String deviceId = ROOT_DB1_D1; List measurements = new ArrayList<>(); List types = new ArrayList<>(); measurements.add("s1"); @@ -387,7 +387,7 @@ private static void insertRecordInObject() } private static void insertRecords() throws IoTDBConnectionException, StatementExecutionException { - String deviceId = ROOT_SG1_D1; + String deviceId = ROOT_DB1_D1; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -447,7 +447,7 @@ private static void insertTablet() throws IoTDBConnectionException, StatementExe schemaList.add(new MeasurementSchema("s2", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s3", TSDataType.INT64)); - Tablet tablet = new Tablet(ROOT_SG1_D1, schemaList, 100); + Tablet tablet = new Tablet(ROOT_DB1_D1, schemaList, 100); long timestamp = System.currentTimeMillis(); @@ -488,7 +488,7 @@ private static void insertTabletWithNullValue() schemaList.add(new MeasurementSchema("s2", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s3", TSDataType.INT64)); - Tablet tablet = new Tablet(ROOT_SG1_D1, schemaList, 100); + Tablet tablet = new Tablet(ROOT_DB1_D1, schemaList, 100); long timestamp = System.currentTimeMillis(); @@ -543,7 +543,7 @@ private static void insertTabletWithNullValues() schemaList.add(new MeasurementSchema("s2", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s3", TSDataType.INT64)); - Tablet tablet = new Tablet(ROOT_SG1_D1, schemaList, 100); + Tablet tablet = new Tablet(ROOT_DB1_D1, schemaList, 100); insertTablet1(schemaList, tablet); } @@ -583,14 +583,14 @@ private static void insertTablets() throws IoTDBConnectionException, StatementEx schemaList.add(new MeasurementSchema("s2", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s3", TSDataType.INT64)); - Tablet tablet1 = new Tablet(ROOT_SG1_D1, schemaList, 100); - Tablet tablet2 = new Tablet("root.sg1.d2", schemaList, 100); - Tablet tablet3 = new Tablet("root.sg1.d3", schemaList, 100); + Tablet tablet1 = new Tablet(ROOT_DB1_D1, schemaList, 100); + Tablet tablet2 = new Tablet("root.db1.d2", schemaList, 100); + Tablet tablet3 = new Tablet("root.db1.d3", schemaList, 100); Map tabletMap = new HashMap<>(); - tabletMap.put(ROOT_SG1_D1, tablet1); - tabletMap.put("root.sg1.d2", tablet2); - tabletMap.put("root.sg1.d3", tablet3); + tabletMap.put(ROOT_DB1_D1, tablet1); + tabletMap.put("root.db1.d2", tablet2); + tabletMap.put("root.db1.d3", tablet3); long timestamp = System.currentTimeMillis(); for (long row = 0; row < 100; row++) { @@ -628,7 +628,7 @@ private static void insertTablets() throws IoTDBConnectionException, StatementEx * write data of String type or Binary type. */ private static void insertText() throws IoTDBConnectionException, StatementExecutionException { - String device = "root.sg1.text"; + String device = "root.db1.text"; // the first data is String type and the second data is Binary type List datas = Arrays.asList("String", new Binary("Binary", TSFileConfig.STRING_CHARSET)); // insertRecord example @@ -663,10 +663,10 @@ private static void insertText() throws IoTDBConnectionException, StatementExecu private static void selectInto() throws IoTDBConnectionException, StatementExecutionException { session.executeNonQueryStatement( - "select s1, s2, s3 into into_s1, into_s2, into_s3 from root.sg1.d1"); + "select s1, s2, s3 into into_s1, into_s2, into_s3 from root.db1.d1"); try (SessionDataSet dataSet = - session.executeQueryStatement("select into_s1, into_s2, into_s3 from root.sg1.d1")) { + session.executeQueryStatement("select into_s1, into_s2, into_s3 from root.db1.d1")) { System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -675,7 +675,7 @@ private static void selectInto() throws IoTDBConnectionException, StatementExecu } private static void deleteData() throws IoTDBConnectionException, StatementExecutionException { - String path = ROOT_SG1_D1_S1; + String path = ROOT_DB1_D1_S1; long deleteTime = 99; session.deleteData(path, deleteTime); } @@ -683,9 +683,9 @@ private static void deleteData() throws IoTDBConnectionException, StatementExecu private static void deleteTimeseries() throws IoTDBConnectionException, StatementExecutionException { List paths = new ArrayList<>(); - paths.add(ROOT_SG1_D1_S1); - paths.add(ROOT_SG1_D1_S2); - paths.add(ROOT_SG1_D1_S3); + paths.add(ROOT_DB1_D1_S1); + paths.add(ROOT_DB1_D1_S2); + paths.add(ROOT_DB1_D1_S3); session.deleteTimeseries(paths); } @@ -740,9 +740,9 @@ private static void queryWithTimeout() private static void rawDataQuery() throws IoTDBConnectionException, StatementExecutionException { List paths = new ArrayList<>(); - paths.add(ROOT_SG1_D1_S1); - paths.add(ROOT_SG1_D1_S2); - paths.add(ROOT_SG1_D1_S3); + paths.add(ROOT_DB1_D1_S1); + paths.add(ROOT_DB1_D1_S2); + paths.add(ROOT_DB1_D1_S3); long startTime = 10L; long endTime = 200L; long timeOut = 60000; @@ -754,9 +754,9 @@ private static void rawDataQuery() throws IoTDBConnectionException, StatementExe private static void lastDataQuery() throws IoTDBConnectionException, StatementExecutionException { List paths = new ArrayList<>(); - paths.add(ROOT_SG1_D1_S1); - paths.add(ROOT_SG1_D1_S2); - paths.add(ROOT_SG1_D1_S3); + paths.add(ROOT_DB1_D1_S1); + paths.add(ROOT_DB1_D1_S2); + paths.add(ROOT_DB1_D1_S3); try (SessionDataSet dataSet = session.executeLastDataQuery(paths, 3, 60000)) { printDataSet(dataSet); } @@ -771,7 +771,7 @@ private static void fastLastDataQueryForOneDevice() paths.add("s3"); try (SessionDataSet dataSet = sessionEnableRedirect.executeLastDataQueryForOneDevice( - ROOT_SG1, ROOT_SG1_D1, paths, true)) { + ROOT_DB1, ROOT_DB1_D1, paths, true)) { printDataSet(dataSet); } } @@ -781,7 +781,7 @@ private static void fastLastDataQueryForOnePrefix() System.out.println("-------fastLastQueryForOnePrefix------"); try (SessionDataSet dataSet = sessionEnableRedirect.executeFastLastDataQueryForOnePrefixPath( - Arrays.asList("root", "sg1"))) { + Arrays.asList("root", "db1"))) { printDataSet(dataSet); } } @@ -789,9 +789,9 @@ private static void fastLastDataQueryForOnePrefix() private static void aggregationQuery() throws IoTDBConnectionException, StatementExecutionException { List paths = new ArrayList<>(); - paths.add(ROOT_SG1_D1_S1); - paths.add(ROOT_SG1_D1_S2); - paths.add(ROOT_SG1_D1_S3); + paths.add(ROOT_DB1_D1_S1); + paths.add(ROOT_DB1_D1_S2); + paths.add(ROOT_DB1_D1_S3); List aggregations = new ArrayList<>(); aggregations.add(TAggregationType.COUNT); @@ -804,9 +804,9 @@ private static void aggregationQuery() private static void groupByQuery() throws IoTDBConnectionException, StatementExecutionException { List paths = new ArrayList<>(); - paths.add(ROOT_SG1_D1_S1); - paths.add(ROOT_SG1_D1_S2); - paths.add(ROOT_SG1_D1_S3); + paths.add(ROOT_DB1_D1_S1); + paths.add(ROOT_DB1_D1_S2); + paths.add(ROOT_DB1_D1_S3); List aggregations = new ArrayList<>(); aggregations.add(TAggregationType.COUNT); @@ -855,8 +855,8 @@ private static void queryByIterator() } // get third column - if (!iterator.isNull(ROOT_SG1_D1_S2)) { - builder.append(iterator.getLong(ROOT_SG1_D1_S2)).append(","); + if (!iterator.isNull(ROOT_DB1_D1_S2)) { + builder.append(iterator.getLong(ROOT_DB1_D1_S2)).append(","); } else { builder.append("null").append(","); } @@ -869,8 +869,8 @@ private static void queryByIterator() } // get fifth column - if (!iterator.isNull(ROOT_SG1_D1_S4)) { - builder.append(iterator.getObject(ROOT_SG1_D1_S4)); + if (!iterator.isNull(ROOT_DB1_D1_S4)) { + builder.append(iterator.getObject(ROOT_DB1_D1_S4)); } else { builder.append("null"); } @@ -881,7 +881,7 @@ private static void queryByIterator() } private static void nonQuery() throws IoTDBConnectionException, StatementExecutionException { - session.executeNonQueryStatement("insert into root.sg1.d1(timestamp,s1) values(200, 1)"); + session.executeNonQueryStatement("insert into root.db1.d1(timestamp,s1) values(200, 1)"); } private static void setTimeout() throws IoTDBConnectionException { diff --git a/example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java b/example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java index ea5cdccb59701..d04ef2a8042d4 100644 --- a/example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java +++ b/example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java @@ -82,7 +82,7 @@ public static void main(String[] args) // more insert example, see SessionExample.java private static void insertRecord() throws StatementExecutionException, IoTDBConnectionException { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); List types = new ArrayList<>(); measurements.add("s1"); @@ -107,7 +107,7 @@ private static void queryByIterator() { () -> { SessionDataSetWrapper wrapper = null; try { - wrapper = sessionPool.executeQueryStatement("select * from root.sg1.d1"); + wrapper = sessionPool.executeQueryStatement("select * from root.db1.d1"); // get DataIterator like JDBC DataIterator dataIterator = wrapper.iterator(); System.out.println(wrapper.getColumnNames()); diff --git a/example/session/src/main/java/org/apache/iotdb/SubscriptionSessionExample.java b/example/session/src/main/java/org/apache/iotdb/SubscriptionSessionExample.java index 6f4d503bce0f2..960b1614da80b 100644 --- a/example/session/src/main/java/org/apache/iotdb/SubscriptionSessionExample.java +++ b/example/session/src/main/java/org/apache/iotdb/SubscriptionSessionExample.java @@ -87,7 +87,7 @@ private static void prepareData() throws Exception { String.format( "insert into root.db.d2(time, s1, s2) values (%s, 3, 4)", CURRENT_TIME + i)); session.executeNonQueryStatement( - String.format("insert into root.sg.d3(time, s1) values (%s, 5)", CURRENT_TIME + 2 * i)); + String.format("insert into root.db.d3(time, s1) values (%s, 5)", CURRENT_TIME + 2 * i)); } session.executeNonQueryStatement("flush"); @@ -216,7 +216,7 @@ private static void dataSubscription2() throws Exception { QueryExpression.create( Arrays.asList( new Path("root.db.d2", "s2", true), - new Path("root.sg.d3", "s1", true)), + new Path("root.db.d3", "s1", true)), null)); while (dataSet.hasNext()) { System.out.println(dataSet.next()); diff --git a/example/session/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java b/example/session/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java index ada3646fcceaf..248f2916f836a 100644 --- a/example/session/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java +++ b/example/session/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java @@ -49,33 +49,33 @@ public class SyntaxConventionRelatedExample { private static final String LOCAL_HOST = "127.0.0.1"; /** - * if you want to create a time series named root.sg1.select, a possible SQL statement would be - * like: create timeseries root.sg1.select with datatype=FLOAT, encoding=RLE As described before, + * if you want to create a time series named root.db1.select, a possible SQL statement would be + * like: create timeseries root.db1.select with datatype=FLOAT, encoding=RLE As described before, * when using session API, path is represented using String. The path should be written as - * "root.sg1.select". + * "root.db1.select". */ - private static final String ROOT_SG1_KEYWORD_EXAMPLE = "root.sg1.select"; + private static final String ROOT_DB1_KEYWORD_EXAMPLE = "root.db1.select"; /** - * if you want to create a time series named root.sg1.111, a possible SQL statement would be like: - * create timeseries root.sg1.`111` with datatype=FLOAT, encoding=RLE The path should be written - * as "root.sg1.`111`". + * if you want to create a time series named root.db1.111, a possible SQL statement would be like: + * create timeseries root.db1.`111` with datatype=FLOAT, encoding=RLE The path should be written + * as "root.db1.`111`". */ - private static final String ROOT_SG1_DIGITS_EXAMPLE = "root.sg1.`111`"; + private static final String ROOT_DB1_DIGITS_EXAMPLE = "root.db1.`111`"; /** - * if you want to create a time series named root.sg1.`a"b'c``, a possible SQL statement would be - * like: create timeseries root.sg1.`a"b'c``` with datatype=FLOAT, encoding=RLE The path should be - * written as "root.sg1.`a"b`c```". + * if you want to create a time series named root.db1.`a"b'c``, a possible SQL statement would be + * like: create timeseries root.db1.`a"b'c``` with datatype=FLOAT, encoding=RLE The path should be + * written as "root.db1.`a"b`c```". */ - private static final String ROOT_SG1_SPECIAL_CHARACTER_EXAMPLE = "root.sg1.`a\"b'c```"; + private static final String ROOT_DB1_SPECIAL_CHARACTER_EXAMPLE = "root.db1.`a\"b'c```"; /** - * if you want to create a time series named root.sg1.a, a possible SQL statement would be like: - * create timeseries root.sg1.a with datatype=FLOAT, encoding=RLE The path should be written as - * "root.sg1.a". + * if you want to create a time series named root.db1.a, a possible SQL statement would be like: + * create timeseries root.db1.a with datatype=FLOAT, encoding=RLE The path should be written as + * "root.db1.a". */ - private static final String ROOT_SG1_NORMAL_NODE_EXAMPLE = "root.sg1.a"; + private static final String ROOT_DB1_NORMAL_NODE_EXAMPLE = "root.db1.a"; public static void main(String[] args) throws IoTDBConnectionException, StatementExecutionException { @@ -93,7 +93,7 @@ public static void main(String[] args) session.setFetchSize(10000); try { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); } catch (StatementExecutionException e) { if (e.getStatusCode() != TSStatusCode.PATH_ALREADY_EXIST.getStatusCode()) { throw e; @@ -102,9 +102,9 @@ public static void main(String[] args) // createTimeSeries createTimeSeries(); - SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.sg1.*"); + SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.db1.*"); // the expected paths would be: - // [root.sg1.select, root.sg1.`111`, root.sg1.`a"b'c```, root.sg1.a] + // [root.db1.select, root.db1.`111`, root.db1.`a"b'c```, root.db1.a] // You could see that time series in dataSet are exactly the same as // the initial String you used as path. Node names consist of digits or contain special // characters are quoted with ``, both in SQL statement and in header of result dataset. @@ -133,24 +133,24 @@ public static void main(String[] args) private static void createTimeSeries() throws IoTDBConnectionException, StatementExecutionException { - if (!session.checkTimeseriesExists(ROOT_SG1_KEYWORD_EXAMPLE)) { + if (!session.checkTimeseriesExists(ROOT_DB1_KEYWORD_EXAMPLE)) { session.createTimeseries( - ROOT_SG1_KEYWORD_EXAMPLE, TSDataType.FLOAT, TSEncoding.RLE, CompressionType.SNAPPY); + ROOT_DB1_KEYWORD_EXAMPLE, TSDataType.FLOAT, TSEncoding.RLE, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists(ROOT_SG1_DIGITS_EXAMPLE)) { + if (!session.checkTimeseriesExists(ROOT_DB1_DIGITS_EXAMPLE)) { session.createTimeseries( - ROOT_SG1_DIGITS_EXAMPLE, TSDataType.FLOAT, TSEncoding.RLE, CompressionType.SNAPPY); + ROOT_DB1_DIGITS_EXAMPLE, TSDataType.FLOAT, TSEncoding.RLE, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists(ROOT_SG1_SPECIAL_CHARACTER_EXAMPLE)) { + if (!session.checkTimeseriesExists(ROOT_DB1_SPECIAL_CHARACTER_EXAMPLE)) { session.createTimeseries( - ROOT_SG1_SPECIAL_CHARACTER_EXAMPLE, + ROOT_DB1_SPECIAL_CHARACTER_EXAMPLE, TSDataType.FLOAT, TSEncoding.RLE, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists(ROOT_SG1_NORMAL_NODE_EXAMPLE)) { + if (!session.checkTimeseriesExists(ROOT_DB1_NORMAL_NODE_EXAMPLE)) { session.createTimeseries( - ROOT_SG1_NORMAL_NODE_EXAMPLE, TSDataType.FLOAT, TSEncoding.RLE, CompressionType.SNAPPY); + ROOT_DB1_NORMAL_NODE_EXAMPLE, TSDataType.FLOAT, TSEncoding.RLE, CompressionType.SNAPPY); } } } diff --git a/example/session/src/main/java/org/apache/iotdb/TabletExample.java b/example/session/src/main/java/org/apache/iotdb/TabletExample.java index f85dba2215b77..691717a593af6 100644 --- a/example/session/src/main/java/org/apache/iotdb/TabletExample.java +++ b/example/session/src/main/java/org/apache/iotdb/TabletExample.java @@ -169,7 +169,7 @@ public static void main(String[] args) throws Exception { long insertCost = 0; for (int i = 0; i < colSize; i++) { - String deviceId = "root.sg" + i % 8 + "." + i; + String deviceId = "root.db" + i % 8 + "." + i; Tablet ta = new Tablet(deviceId, schemas, rowSize); for (int t = 0; t < rowSize; t++) { diff --git a/example/udf/src/main/java/org/apache/iotdb/udf/UDAFExample.java b/example/udf/src/main/java/org/apache/iotdb/udf/UDAFExample.java index 540f6bcef5cce..3216b35651a18 100644 --- a/example/udf/src/main/java/org/apache/iotdb/udf/UDAFExample.java +++ b/example/udf/src/main/java/org/apache/iotdb/udf/UDAFExample.java @@ -37,11 +37,11 @@ /** This is an internal example of the UDAF implementation. */ public class UDAFExample implements UDAF { /** - * CREATE DATABASE root.sg; CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN; - * INSERT INTO root.sg(time, s1) VALUES (0, 1), (1, 3), (2, 5); + * CREATE DATABASE root.db; CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN; + * INSERT INTO root.db(time, s1) VALUES (0, 1), (1, 3), (2, 5); * *

CREATE FUNCTION avg_udaf AS 'org.apache.iotdb.udf.UDAFExample'; SHOW FUNCTIONS; SELECT s1 - * FROM root.sg; SELECT avg_udaf(s1) FROM root.sg; + * FROM root.db; SELECT avg_udaf(s1) FROM root.db; */ static class AvgState implements State { double sum; diff --git a/example/udf/src/main/java/org/apache/iotdb/udf/UDTFExample.java b/example/udf/src/main/java/org/apache/iotdb/udf/UDTFExample.java index 6d910284e4bbe..def7c689946af 100644 --- a/example/udf/src/main/java/org/apache/iotdb/udf/UDTFExample.java +++ b/example/udf/src/main/java/org/apache/iotdb/udf/UDTFExample.java @@ -34,13 +34,13 @@ /** This is an internal example of the UDTF implementation. */ public class UDTFExample implements UDTF { /** - * CREATE DATABASE root.sg1; CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN; - * CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN; INSERT INTO - * root.sg1.d1(timestamp, s1, s2) VALUES (0, -1, 1); INSERT INTO root.sg1.d1(timestamp, s1, s2) - * VALUES (1, -2, 2); INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (2, -3, 3); + * CREATE DATABASE root.db1; CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN; + * CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN; INSERT INTO + * root.db1.d1(timestamp, s1, s2) VALUES (0, -1, 1); INSERT INTO root.db1.d1(timestamp, s1, s2) + * VALUES (1, -2, 2); INSERT INTO root.db1.d1(timestamp, s1, s2) VALUES (2, -3, 3); * *

CREATE FUNCTION example AS 'org.apache.iotdb.udf.UDTFExample'; SHOW FUNCTIONS; SELECT s1, - * example(s1), s2, example(s2) FROM root.sg1.d1; + * example(s1), s2, example(s2) FROM root.db1.d1; */ @Override public void validate(UDFParameterValidator validator) throws Exception { diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeConsensusEfficiencyIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeConsensusEfficiencyIT.java index b6176ffdde9a2..7330d476e90c9 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeConsensusEfficiencyIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeConsensusEfficiencyIT.java @@ -67,7 +67,7 @@ public class IoTDBConfigNodeConsensusEfficiencyIT { private static final int approximateDataPartitionSizeInBytes = 4 + 8 + 8; /* Don't modify any of the following default configuration */ - private static final String sg = "root.db"; + private static final String db = "root.db"; private static final String defaultSchemaRegionGroupExtensionPolicy = "CUSTOM"; private static final int defaultSchemaRegionGroupNumPerDatabase = 1; private static final String defaultDataRegionGroupExtensionPolicy = "CUSTOM"; @@ -108,7 +108,7 @@ public static void setUp() throws SQLException { Statement statement = connection.createStatement()) { // Create a Database, a SchemaRegionGroup and a DataRegionGroup // in order to initialize test environment - String initSql = String.format("INSERT INTO %s.d(timestamp, s) values(0, 0.0)", sg); + String initSql = String.format("INSERT INTO %s.d(timestamp, s) values(0, 0.0)", db); statement.execute(initSql); } } @@ -134,7 +134,7 @@ public void consensusEfficiencyIT() throws InterruptedException { // Prepare PartitionSlotsMap Map> partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - sg, + db, sid, sid + testSeriesPartitionBatchSize, tid, @@ -165,7 +165,7 @@ public void consensusEfficiencyIT() throws InterruptedException { dataPartitionTableResp.getStatus().getCode()); Assert.assertNotNull(dataPartitionTableResp.getDataPartitionTable()); ConfigNodeTestUtils.checkDataPartitionTable( - sg, + db, sid, sid + testSeriesPartitionBatchSize, tid, diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java index a5c757d8dd361..7bda2a9b7b020 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java @@ -105,7 +105,7 @@ public void tearDown() { @Test public void testPartitionInfoSnapshot() throws Exception { - final String sg = "root.sg"; + final String db = "root.db"; final int databaseNum = 10; final int seriesPartitionSlotsNum = 10; final int timePartitionSlotsNum = 10; @@ -119,7 +119,7 @@ public void testPartitionInfoSnapshot() throws Exception { Set expectedCQEntries = createCQs(client); for (int i = 0; i < databaseNum; i++) { - String database = sg + i; + String database = db + i; TDatabaseSchema databaseSchema = new TDatabaseSchema(database); TSStatus status = client.setDatabase(databaseSchema); assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); @@ -327,8 +327,8 @@ private void assertUDFInformation(List req, TGetUDFTableResp } private Set createCQs(SyncConfigNodeIServiceClient client) throws TException { - String sql1 = "create cq testCq1 BEGIN select s1 into root.backup.d1(s1) from root.sg.d1 END"; - String sql2 = "create cq testCq2 BEGIN select s1 into root.backup.d2(s1) from root.sg.d2 END"; + String sql1 = "create cq testCq1 BEGIN select s1 into root.backup.d1(s1) from root.db.d1 END"; + String sql2 = "create cq testCq2 BEGIN select s1 into root.backup.d2(s1) from root.db.d2 END"; TCreateCQReq req1 = new TCreateCQReq( "testCq1", @@ -337,7 +337,7 @@ private Set createCQs(SyncConfigNodeIServiceClient client) throws TExc 1000, 0, (byte) 0, - "select s1 into root.backup.d1(s1) from root.sg.d1", + "select s1 into root.backup.d1(s1) from root.db.d1", sql1, "UTC", "root"); @@ -349,7 +349,7 @@ private Set createCQs(SyncConfigNodeIServiceClient client) throws TExc 1000, 0, (byte) 1, - "select s1 into root.backup.d2(s1) from root.sg.d2", + "select s1 into root.backup.d2(s1) from root.db.d2", sql2, "UTC", "root"); diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/database/IoTDBDatabaseSetAndDeleteIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/database/IoTDBDatabaseSetAndDeleteIT.java index 959f37d594d51..c2a85b379f4f8 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/database/IoTDBDatabaseSetAndDeleteIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/database/IoTDBDatabaseSetAndDeleteIT.java @@ -68,19 +68,19 @@ public void tearDown() { @Test public void testSetAndQueryDatabase() throws Exception { TSStatus status; - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String db0 = "root.db0"; + final String db1 = "root.db1"; try (SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { // set Database0 by default values - TDatabaseSchema databaseSchema0 = new TDatabaseSchema(sg0); + TDatabaseSchema databaseSchema0 = new TDatabaseSchema(db0); status = client.setDatabase(databaseSchema0); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); // set Database1 by specific values TDatabaseSchema databaseSchema1 = - new TDatabaseSchema(sg1) + new TDatabaseSchema(db1) .setSchemaReplicationFactor(5) .setDataReplicationFactor(5) .setTimePartitionInterval(2048L); @@ -90,7 +90,7 @@ public void testSetAndQueryDatabase() throws Exception { // test count all Databases TCountDatabaseResp countResp = client.countMatchedDatabases( - new TGetDatabaseReq(Arrays.asList("root", "sg*"), ALL_MATCH_SCOPE_BINARY)); + new TGetDatabaseReq(Arrays.asList("root", "db*"), ALL_MATCH_SCOPE_BINARY)); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), countResp.getStatus().getCode()); Assert.assertEquals(2, countResp.getCount()); @@ -98,7 +98,7 @@ public void testSetAndQueryDatabase() throws Exception { // test count one Database countResp = client.countMatchedDatabases( - new TGetDatabaseReq(Arrays.asList("root", "sg0"), ALL_MATCH_SCOPE_BINARY)); + new TGetDatabaseReq(Arrays.asList("root", "db0"), ALL_MATCH_SCOPE_BINARY)); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), countResp.getStatus().getCode()); Assert.assertEquals(1, countResp.getCount()); @@ -106,20 +106,20 @@ public void testSetAndQueryDatabase() throws Exception { // test query all DatabaseSchemas TDatabaseSchemaResp getResp = client.getMatchedDatabaseSchemas( - new TGetDatabaseReq(Arrays.asList("root", "sg*"), ALL_MATCH_SCOPE_BINARY)); + new TGetDatabaseReq(Arrays.asList("root", "db*"), ALL_MATCH_SCOPE_BINARY)); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), getResp.getStatus().getCode()); Map schemaMap = getResp.getDatabaseSchemaMap(); Assert.assertEquals(2, schemaMap.size()); - TDatabaseSchema databaseSchema = schemaMap.get(sg0); + TDatabaseSchema databaseSchema = schemaMap.get(db0); Assert.assertNotNull(databaseSchema); - Assert.assertEquals(sg0, databaseSchema.getName()); + Assert.assertEquals(db0, databaseSchema.getName()); Assert.assertEquals(1, databaseSchema.getSchemaReplicationFactor()); Assert.assertEquals(1, databaseSchema.getDataReplicationFactor()); Assert.assertEquals(604800000, databaseSchema.getTimePartitionInterval()); - databaseSchema = schemaMap.get(sg1); + databaseSchema = schemaMap.get(db1); Assert.assertNotNull(databaseSchema); - Assert.assertEquals(sg1, databaseSchema.getName()); + Assert.assertEquals(db1, databaseSchema.getName()); Assert.assertEquals(5, databaseSchema.getSchemaReplicationFactor()); Assert.assertEquals(5, databaseSchema.getDataReplicationFactor()); Assert.assertEquals(2048L, databaseSchema.getTimePartitionInterval()); @@ -129,29 +129,29 @@ public void testSetAndQueryDatabase() throws Exception { Assert.assertEquals(TSStatusCode.DATABASE_ALREADY_EXISTS.getStatusCode(), status.getCode()); // test Database setter interfaces - PartialPath patternPath = new PartialPath(sg1); + PartialPath patternPath = new PartialPath(db1); status = client.setTTL( new TSetTTLReq(Arrays.asList(patternPath.getNodes()), Long.MAX_VALUE, false)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); - status = client.setSchemaReplicationFactor(new TSetSchemaReplicationFactorReq(sg1, 1)); + status = client.setSchemaReplicationFactor(new TSetSchemaReplicationFactorReq(db1, 1)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); - status = client.setDataReplicationFactor(new TSetDataReplicationFactorReq(sg1, 1)); + status = client.setDataReplicationFactor(new TSetDataReplicationFactorReq(db1, 1)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); - status = client.setTimePartitionInterval(new TSetTimePartitionIntervalReq(sg1, 604800L)); + status = client.setTimePartitionInterval(new TSetTimePartitionIntervalReq(db1, 604800L)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); // test setter results getResp = client.getMatchedDatabaseSchemas( - new TGetDatabaseReq(Arrays.asList("root", "sg1"), ALL_MATCH_SCOPE_BINARY)); + new TGetDatabaseReq(Arrays.asList("root", "db1"), ALL_MATCH_SCOPE_BINARY)); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), getResp.getStatus().getCode()); schemaMap = getResp.getDatabaseSchemaMap(); Assert.assertEquals(1, schemaMap.size()); - databaseSchema = schemaMap.get(sg1); + databaseSchema = schemaMap.get(db1); Assert.assertNotNull(databaseSchema); - Assert.assertEquals(sg1, databaseSchema.getName()); + Assert.assertEquals(db1, databaseSchema.getName()); Assert.assertEquals(1, databaseSchema.getSchemaReplicationFactor()); Assert.assertEquals(1, databaseSchema.getDataReplicationFactor()); Assert.assertEquals(604800, databaseSchema.getTimePartitionInterval()); @@ -161,28 +161,28 @@ public void testSetAndQueryDatabase() throws Exception { @Test public void testDeleteDatabase() throws Exception { TSStatus status; - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String db0 = "root.db0"; + final String db1 = "root.db1"; try (SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { - TDatabaseSchema databaseSchema0 = new TDatabaseSchema(sg0); + TDatabaseSchema databaseSchema0 = new TDatabaseSchema(db0); // set Database0 by default values status = client.setDatabase(databaseSchema0); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); // set Database1 by specific values - TDatabaseSchema databaseSchema1 = new TDatabaseSchema(sg1); + TDatabaseSchema databaseSchema1 = new TDatabaseSchema(db1); status = client.setDatabase(databaseSchema1); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); TDeleteDatabasesReq deleteDatabasesReq = new TDeleteDatabasesReq(); - List sgs = Arrays.asList(sg0, sg1); - deleteDatabasesReq.setPrefixPathList(sgs); - TSStatus deleteSgStatus = client.deleteDatabases(deleteDatabasesReq); + List dbs = Arrays.asList(db0, db1); + deleteDatabasesReq.setPrefixPathList(dbs); + TSStatus deleteDbStatus = client.deleteDatabases(deleteDatabasesReq); TDatabaseSchemaResp root = client.getMatchedDatabaseSchemas( - new TGetDatabaseReq(Arrays.asList("root", "sg*"), ALL_MATCH_SCOPE_BINARY)); + new TGetDatabaseReq(Arrays.asList("root", "db*"), ALL_MATCH_SCOPE_BINARY)); Assert.assertTrue(root.getDatabaseSchemaMap().isEmpty()); - Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), deleteSgStatus.getCode()); + Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), deleteDbStatus.getCode()); } } } diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBConfigNodeSwitchLeaderIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBConfigNodeSwitchLeaderIT.java index 2246ce4314a6b..95a1ac1807fc2 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBConfigNodeSwitchLeaderIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBConfigNodeSwitchLeaderIT.java @@ -88,12 +88,12 @@ private void switchLeader() throws IOException, InterruptedException { @Test public void basicDataInheritIT() throws Exception { - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; - final String d00 = sg0 + ".d0.s"; - final String d01 = sg0 + ".d1.s"; - final String d10 = sg1 + ".d0.s"; - final String d11 = sg1 + ".d1.s"; + final String db0 = "root.db0"; + final String db1 = "root.db1"; + final String d00 = db0 + ".d0.s"; + final String d01 = db0 + ".d1.s"; + final String d10 = db1 + ".d0.s"; + final String d11 = db1 + ".d1.s"; TSStatus status; TSchemaPartitionTableResp schemaPartitionTableResp0; @@ -102,9 +102,9 @@ public void basicDataInheritIT() throws Exception { try (SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { // Set Databases - status = client.setDatabase((new TDatabaseSchema(sg0))); + status = client.setDatabase((new TDatabaseSchema(db0))); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); - status = client.setDatabase((new TDatabaseSchema(sg1))); + status = client.setDatabase((new TDatabaseSchema(db1))); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); // Create SchemaRegionGroups through getOrCreateSchemaPartition and record @@ -124,11 +124,11 @@ public void basicDataInheritIT() throws Exception { new TSeriesPartitionSlot(1), new TTimeSlotList() .setTimePartitionSlots(Collections.singletonList(new TTimePartitionSlot(100)))); - Map> sgSlotsMap = new HashMap<>(); - sgSlotsMap.put(sg0, seriesSlotMap); - sgSlotsMap.put(sg1, seriesSlotMap); + Map> dbSlotsMap = new HashMap<>(); + dbSlotsMap.put(db0, seriesSlotMap); + dbSlotsMap.put(db1, seriesSlotMap); dataPartitionTableResp0 = - client.getOrCreateDataPartitionTable(new TDataPartitionReq(sgSlotsMap)); + client.getOrCreateDataPartitionTable(new TDataPartitionReq(dbSlotsMap)); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), dataPartitionTableResp0.getStatus().getCode()); @@ -152,11 +152,11 @@ public void basicDataInheritIT() throws Exception { new TSeriesPartitionSlot(1), new TTimeSlotList() .setTimePartitionSlots(Collections.singletonList(new TTimePartitionSlot(100)))); - Map> sgSlotsMap = new HashMap<>(); - sgSlotsMap.put(sg0, seriesSlotMap); - sgSlotsMap.put(sg1, seriesSlotMap); + Map> dbSlotsMap = new HashMap<>(); + dbSlotsMap.put(db0, seriesSlotMap); + dbSlotsMap.put(db1, seriesSlotMap); Assert.assertEquals( - dataPartitionTableResp0, client.getDataPartitionTable(new TDataPartitionReq(sgSlotsMap))); + dataPartitionTableResp0, client.getDataPartitionTable(new TDataPartitionReq(dbSlotsMap))); } } } diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBRegionGroupLeaderDistributionIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBRegionGroupLeaderDistributionIT.java index 5be59962be574..9bbf3c7c2ec36 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBRegionGroupLeaderDistributionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBRegionGroupLeaderDistributionIT.java @@ -105,10 +105,10 @@ public void testBasicLeaderDistribution() throws Exception { new TSeriesPartitionSlot(1), new TTimeSlotList() .setTimePartitionSlots(Collections.singletonList(new TTimePartitionSlot(100)))); - Map> sgSlotsMap = new HashMap<>(); - sgSlotsMap.put(DATABASE + i, seriesSlotMap); + Map> dbSlotsMap = new HashMap<>(); + dbSlotsMap.put(DATABASE + i, seriesSlotMap); TDataPartitionTableResp dataPartitionTableResp = - client.getOrCreateDataPartitionTable(new TDataPartitionReq(sgSlotsMap)); + client.getOrCreateDataPartitionTable(new TDataPartitionReq(dbSlotsMap)); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), dataPartitionTableResp.getStatus().getCode()); @@ -155,10 +155,10 @@ public void testCFDWithUnknownStatus() throws Exception { new TSeriesPartitionSlot(1), new TTimeSlotList() .setTimePartitionSlots(Collections.singletonList(new TTimePartitionSlot(100)))); - Map> sgSlotsMap = new HashMap<>(); - sgSlotsMap.put(DATABASE + i, seriesSlotMap); + Map> dbSlotsMap = new HashMap<>(); + dbSlotsMap.put(DATABASE + i, seriesSlotMap); TDataPartitionTableResp dataPartitionTableResp = - client.getOrCreateDataPartitionTable(new TDataPartitionReq(sgSlotsMap)); + client.getOrCreateDataPartitionTable(new TDataPartitionReq(dbSlotsMap)); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), dataPartitionTableResp.getStatus().getCode()); @@ -271,10 +271,10 @@ public void testCFDWithReadOnlyStatus() throws Exception { new TSeriesPartitionSlot(1), new TTimeSlotList() .setTimePartitionSlots(Collections.singletonList(new TTimePartitionSlot(100)))); - Map> sgSlotsMap = new HashMap<>(); - sgSlotsMap.put(DATABASE + i, seriesSlotMap); + Map> dbSlotsMap = new HashMap<>(); + dbSlotsMap.put(DATABASE + i, seriesSlotMap); TDataPartitionTableResp dataPartitionTableResp = - client.getOrCreateDataPartitionTable(new TDataPartitionReq(sgSlotsMap)); + client.getOrCreateDataPartitionTable(new TDataPartitionReq(dbSlotsMap)); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), dataPartitionTableResp.getStatus().getCode()); diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBAutoRegionGroupExtensionIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBAutoRegionGroupExtensionIT.java index 33481d9faae37..268b6fe95d97b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBAutoRegionGroupExtensionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBAutoRegionGroupExtensionIT.java @@ -104,8 +104,8 @@ public void testAutoRegionGroupExtensionPolicy() throws Exception { // Delete all Databases for (int i = 0; i < TEST_DATABASE_NUM; i++) { - String curSg = DATABASE + i; - client.deleteDatabase(new TDeleteDatabaseReq(curSg)); + String curDb = DATABASE + i; + client.deleteDatabase(new TDeleteDatabaseReq(curDb)); } boolean isAllRegionGroupDeleted = false; for (int retry = 0; retry < retryNum; retry++) { @@ -134,19 +134,19 @@ private void setDatabaseAndCheckRegionGroupDistribution(SyncConfigNodeIServiceCl throws TException, IllegalPathException, IOException { for (int i = 0; i < TEST_DATABASE_NUM; i++) { - String curSg = DATABASE + i; + String curDb = DATABASE + i; TSStatus status = client.setDatabase( - new TDatabaseSchema(curSg) + new TDatabaseSchema(curDb) .setMinSchemaRegionGroupNum(TEST_MIN_SCHEMA_REGION_GROUP_NUM) .setMinDataRegionGroupNum(TEST_MIN_DATA_REGION_GROUP_NUM)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); // Insert SchemaPartitions to create SchemaRegionGroups - String d0 = curSg + ".d0.s"; - String d1 = curSg + ".d1.s"; - String d2 = curSg + ".d2.s"; - String d3 = curSg + ".d3.s"; + String d0 = curDb + ".d0.s"; + String d1 = curDb + ".d1.s"; + String d2 = curDb + ".d2.s"; + String d3 = curDb + ".d3.s"; TSchemaPartitionReq schemaPartitionReq = new TSchemaPartitionReq(); TSchemaPartitionTableResp schemaPartitionTableResp; ByteBuffer buffer = generatePatternTreeBuffer(new String[] {d0, d1, d2, d3}); @@ -159,7 +159,7 @@ private void setDatabaseAndCheckRegionGroupDistribution(SyncConfigNodeIServiceCl // Insert DataPartitions to create DataRegionGroups Map> partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - curSg, 0, 10, 0, 10, TEST_TIME_PARTITION_INTERVAL); + curDb, 0, 10, 0, 10, TEST_TIME_PARTITION_INTERVAL); TDataPartitionTableResp dataPartitionTableResp = client.getOrCreateDataPartitionTable(new TDataPartitionReq(partitionSlotsMap)); Assert.assertEquals( diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBCustomRegionGroupExtensionIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBCustomRegionGroupExtensionIT.java index 64b35875a203b..e20e0aaa3a734 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBCustomRegionGroupExtensionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBCustomRegionGroupExtensionIT.java @@ -62,8 +62,8 @@ public class IoTDBCustomRegionGroupExtensionIT { private static final int testReplicationFactor = 3; private static final long testTimePartitionInterval = 604800000; - private static final String sg = "root.sg"; - private static final int testSgNum = 2; + private static final String db = "root.db"; + private static final int testDbNum = 2; @Before public void setUp() throws Exception { @@ -95,8 +95,8 @@ public void testCustomRegionGroupExtensionPolicy() throws Exception { try (SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { - for (int i = 0; i < testSgNum; i++) { - String curSg = sg + i; + for (int i = 0; i < testDbNum; i++) { + String curSg = db + i; /* Set Database */ TSStatus status = client.setDatabase(new TDatabaseSchema(curSg)); diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionCreationIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionCreationIT.java index 954f54e01bd02..ce00c24025bda 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionCreationIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionCreationIT.java @@ -66,7 +66,7 @@ public class IoTDBPartitionCreationIT { private static final String IoTConsensusProtocolClass = ConsensusFactory.IOT_CONSENSUS; private static final int testReplicationFactor = 3; private static final long testTimePartitionInterval = 604800000; - private static final String sg = "root.sg"; + private static final String db = "root.db"; private static final int testSeriesPartitionBatchSize = 1; private static final int testTimePartitionBatchSize = 1; private static final int testDataRegionGroupPerDatabase = 4; @@ -102,7 +102,7 @@ public void setUp() throws Exception { private void setDatabase() throws Exception { try (SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { - TSStatus status = client.setDatabase(new TDatabaseSchema(sg)); + TSStatus status = client.setDatabase(new TDatabaseSchema(db)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); } } @@ -122,7 +122,7 @@ public void testPartitionAllocation() throws Exception { // Region distribution: [0], [0], [0] Map> partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - sg, + db, 0, testSeriesPartitionBatchSize, 0, @@ -152,7 +152,7 @@ public void testPartitionAllocation() throws Exception { dataPartitionTableResp.getStatus().getCode()); Assert.assertNotNull(dataPartitionTableResp.getDataPartitionTable()); ConfigNodeTestUtils.checkDataPartitionTable( - sg, + db, 0, testSeriesPartitionBatchSize, 0, @@ -201,7 +201,7 @@ public void testPartitionAllocation() throws Exception { EnvFactory.getEnv().registerNewDataNode(true); partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - sg, + db, 1, 1 + testSeriesPartitionBatchSize, 1, @@ -230,7 +230,7 @@ public void testPartitionAllocation() throws Exception { dataPartitionTableResp.getStatus().getCode()); Assert.assertNotNull(dataPartitionTableResp.getDataPartitionTable()); ConfigNodeTestUtils.checkDataPartitionTable( - sg, + db, 1, 1 + testSeriesPartitionBatchSize, 1, @@ -279,7 +279,7 @@ public void testPartitionAllocation() throws Exception { EnvFactory.getEnv().registerNewDataNode(true); partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - sg, + db, 2, 2 + testSeriesPartitionBatchSize, 2, @@ -308,7 +308,7 @@ public void testPartitionAllocation() throws Exception { dataPartitionTableResp.getStatus().getCode()); Assert.assertNotNull(dataPartitionTableResp.getDataPartitionTable()); ConfigNodeTestUtils.checkDataPartitionTable( - sg, + db, 2, 2 + testSeriesPartitionBatchSize, 2, @@ -352,7 +352,7 @@ public void testPartitionAllocation() throws Exception { TimeUnit.SECONDS.sleep(25); partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - sg, + db, 3, 3 + testSeriesPartitionBatchSize, 3, @@ -381,7 +381,7 @@ public void testPartitionAllocation() throws Exception { dataPartitionTableResp.getStatus().getCode()); Assert.assertNotNull(dataPartitionTableResp.getDataPartitionTable()); ConfigNodeTestUtils.checkDataPartitionTable( - sg, + db, 3, 3 + testSeriesPartitionBatchSize, 3, diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionDurableIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionDurableIT.java index 8d6e4a5f83113..717bb6dc0c6a6 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionDurableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionDurableIT.java @@ -72,9 +72,9 @@ public class IoTDBPartitionDurableIT { private static final int testReplicationFactor = 3; private static final long testTimePartitionInterval = 604800000; private static final int testDataNodeId = 0; - private static final String sg = "root.sg"; - final String d0 = sg + ".d0.s"; - final String d1 = sg + ".d1.s"; + private static final String db = "root.db"; + final String d0 = db + ".d0.s"; + final String d1 = db + ".d1.s"; private static final int testSeriesPartitionBatchSize = 1; private static final int testTimePartitionBatchSize = 1; @@ -110,7 +110,7 @@ public void setUp() throws Exception { private void setDatabase() throws Exception { try (SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { - TSStatus status = client.setDatabase(new TDatabaseSchema(sg)); + TSStatus status = client.setDatabase(new TDatabaseSchema(db)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); } } @@ -129,7 +129,7 @@ public void testReadOnlyDataNode() throws Exception { /* Test getOrCreateDataPartition, ConfigNode should create DataPartition and return */ Map> partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - sg, + db, 0, testSeriesPartitionBatchSize, 0, @@ -142,7 +142,7 @@ public void testReadOnlyDataNode() throws Exception { TSStatusCode.SUCCESS_STATUS.getStatusCode(), dataPartitionTableResp.getStatus().getCode()); ConfigNodeTestUtils.checkDataPartitionTable( - sg, + db, 0, testSeriesPartitionBatchSize, 0, @@ -202,7 +202,7 @@ public void testReadOnlyDataNode() throws Exception { /* Test getOrCreateDataPartition, the result should be NO_ENOUGH_DATANODE */ partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - sg, + db, 1, 1 + testSeriesPartitionBatchSize, 1, @@ -220,7 +220,7 @@ public void testReadOnlyDataNode() throws Exception { /* Test getOrCreateDataPartition, ConfigNode should create DataPartition and return */ partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - sg, + db, 1, 1 + testSeriesPartitionBatchSize, 1, @@ -232,7 +232,7 @@ public void testReadOnlyDataNode() throws Exception { TSStatusCode.SUCCESS_STATUS.getStatusCode(), dataPartitionTableResp.getStatus().getCode()); ConfigNodeTestUtils.checkDataPartitionTable( - sg, + db, 1, 1 + testSeriesPartitionBatchSize, 1, @@ -331,7 +331,7 @@ public void testUnknownDataNode() throws Exception { // Test getOrCreateDataPartition, ConfigNode should create DataPartition and return Map> partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - sg, + db, 0, testSeriesPartitionBatchSize, 0, @@ -359,7 +359,7 @@ public void testUnknownDataNode() throws Exception { dataPartitionTableResp.getStatus().getCode()); Assert.assertNotNull(dataPartitionTableResp.getDataPartitionTable()); ConfigNodeTestUtils.checkDataPartitionTable( - sg, + db, 0, testSeriesPartitionBatchSize, 0, @@ -393,7 +393,7 @@ public void testUnknownDataNode() throws Exception { // Test getOrCreateDataPartition, ConfigNode should create DataPartition and return partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - sg, + db, 1, 1 + testSeriesPartitionBatchSize, 1, @@ -420,7 +420,7 @@ public void testUnknownDataNode() throws Exception { dataPartitionTableResp.getStatus().getCode()); Assert.assertNotNull(dataPartitionTableResp.getDataPartitionTable()); ConfigNodeTestUtils.checkDataPartitionTable( - sg, + db, 1, 1 + testSeriesPartitionBatchSize, 1, diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java index f110d4a8d28f0..da63156b5a45e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java @@ -83,7 +83,7 @@ public class IoTDBPartitionGetterIT { private static final long testTimePartitionInterval = 604800000; private static final int testDataRegionGroupPerDatabase = 5; - private static final String sg = "root.sg"; + private static final String db = "root.db"; private static final int databaseNum = 2; private static final int testSeriesPartitionSlotNum = 1000; private static final int seriesPartitionBatchSize = 10; @@ -118,18 +118,18 @@ private static void prepareData() throws Exception { (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { /* Set Databases */ for (int i = 0; i < databaseNum; i++) { - TSStatus status = client.setDatabase(new TDatabaseSchema(sg + i)); + TSStatus status = client.setDatabase(new TDatabaseSchema(db + i)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); } /* Create SchemaPartitions */ - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String db0 = "root.db0"; + final String db1 = "root.db1"; - final String d00 = sg0 + ".d0.s"; - final String d01 = sg0 + ".d1.s"; - final String d10 = sg1 + ".d0.s"; - final String d11 = sg1 + ".d1.s"; + final String d00 = db0 + ".d0.s"; + final String d01 = db0 + ".d1.s"; + final String d10 = db1 + ".d0.s"; + final String d11 = db1 + ".d1.s"; TSchemaPartitionReq schemaPartitionReq = new TSchemaPartitionReq(); TSchemaPartitionTableResp schemaPartitionTableResp; @@ -144,13 +144,13 @@ private static void prepareData() throws Exception { Assert.assertEquals(2, schemaPartitionTableResp.getSchemaPartitionTableSize()); schemaPartitionTable = schemaPartitionTableResp.getSchemaPartitionTable(); for (int i = 0; i < 2; i++) { - Assert.assertTrue(schemaPartitionTable.containsKey(sg + i)); - Assert.assertEquals(2, schemaPartitionTable.get(sg + i).size()); + Assert.assertTrue(schemaPartitionTable.containsKey(db + i)); + Assert.assertEquals(2, schemaPartitionTable.get(db + i).size()); } /* Create DataPartitions */ for (int i = 0; i < databaseNum; i++) { - String database = sg + i; + String database = db + i; for (int j = 0; j < testSeriesPartitionSlotNum; j += seriesPartitionBatchSize) { for (long k = 0; k < testTimePartitionSlotsNum; k += timePartitionBatchSize) { Map> partitionSlotsMap = @@ -202,16 +202,16 @@ private static void prepareData() throws Exception { @Test public void testGetSchemaPartition() throws Exception { - final String sg = "root.sg"; - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String db = "root.db"; + final String db0 = "root.db0"; + final String db1 = "root.db1"; - final String d11 = sg1 + ".d1.s"; + final String d11 = db1 + ".d1.s"; - final String allPaths = "root.sg*"; - final String allSg0 = "root.sg0.**"; + final String allPaths = "root.db*"; + final String alldb0 = "root.db0.**"; - final String notExistsSg = "root.sg10.**"; + final String notExistsSg = "root.db10.**"; try (SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { @@ -240,13 +240,13 @@ public void testGetSchemaPartition() throws Exception { Assert.assertEquals(2, schemaPartitionTableResp.getSchemaPartitionTableSize()); schemaPartitionTable = schemaPartitionTableResp.getSchemaPartitionTable(); for (int i = 0; i < 2; i++) { - Assert.assertTrue(schemaPartitionTable.containsKey(sg + i)); - Assert.assertEquals(2, schemaPartitionTable.get(sg + i).size()); + Assert.assertTrue(schemaPartitionTable.containsKey(db + i)); + Assert.assertEquals(2, schemaPartitionTable.get(db + i).size()); } // Test getSchemaPartition, when a device path matches with a Database and end with "*", // ConfigNode will return all the SchemaPartitions in this Database - buffer = generatePatternTreeBuffer(new String[] {allSg0, d11}); + buffer = generatePatternTreeBuffer(new String[] {alldb0, d11}); schemaPartitionReq.setPathPatternTree(buffer); schemaPartitionTableResp = client.getSchemaPartitionTable(schemaPartitionReq); Assert.assertEquals( @@ -254,12 +254,12 @@ public void testGetSchemaPartition() throws Exception { schemaPartitionTableResp.getStatus().getCode()); Assert.assertEquals(2, schemaPartitionTableResp.getSchemaPartitionTableSize()); schemaPartitionTable = schemaPartitionTableResp.getSchemaPartitionTable(); - // Check "root.sg0" - Assert.assertTrue(schemaPartitionTable.containsKey(sg0)); - Assert.assertEquals(2, schemaPartitionTable.get(sg0).size()); - // Check "root.sg1" - Assert.assertTrue(schemaPartitionTable.containsKey(sg1)); - Assert.assertEquals(1, schemaPartitionTable.get(sg1).size()); + // Check "root.db0" + Assert.assertTrue(schemaPartitionTable.containsKey(db0)); + Assert.assertEquals(2, schemaPartitionTable.get(db0).size()); + // Check "root.db1" + Assert.assertTrue(schemaPartitionTable.containsKey(db1)); + Assert.assertEquals(1, schemaPartitionTable.get(db1).size()); } } @@ -276,7 +276,7 @@ public void testGetDataPartition() throws Exception { // Prepare partitionSlotsMap Map> partitionSlotsMap = ConfigNodeTestUtils.constructPartitionSlotsMap( - sg + 10, 0, 10, 0, 10, testTimePartitionInterval); + db + 10, 0, 10, 0, 10, testTimePartitionInterval); // Test getDataPartitionTable, the result should be empty dataPartitionReq = new TDataPartitionReq(partitionSlotsMap); @@ -299,7 +299,7 @@ public void testGetDataPartition() throws Exception { leastDataRegionGroupNum = Math.min(leastDataRegionGroupNum, testDataRegionGroupPerDatabase); for (int i = 0; i < databaseNum; i++) { - String database = sg + i; + String database = db + i; for (int j = 0; j < testSeriesPartitionSlotNum; j += seriesPartitionBatchSize) { for (long k = 0; k < testTimePartitionSlotsNum; k += timePartitionBatchSize) { partitionSlotsMap = @@ -344,13 +344,13 @@ public void testGetDataPartition() throws Exception { @Test public void testGetSlots() throws Exception { - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String db0 = "root.db0"; + final String db1 = "root.db1"; - final IDeviceID d00 = Factory.DEFAULT_FACTORY.create(sg0 + ".d0.s"); - final IDeviceID d01 = Factory.DEFAULT_FACTORY.create(sg0 + ".d1.s"); - final IDeviceID d10 = Factory.DEFAULT_FACTORY.create(sg1 + ".d0.s"); - final IDeviceID d11 = Factory.DEFAULT_FACTORY.create(sg1 + ".d1.s"); + final IDeviceID d00 = Factory.DEFAULT_FACTORY.create(db0 + ".d0.s"); + final IDeviceID d01 = Factory.DEFAULT_FACTORY.create(db0 + ".d1.s"); + final IDeviceID d10 = Factory.DEFAULT_FACTORY.create(db1 + ".d0.s"); + final IDeviceID d11 = Factory.DEFAULT_FACTORY.create(db1 + ".d1.s"); IDeviceID[] devices = new IDeviceID[] {d00, d01, d10, d11}; @@ -363,7 +363,7 @@ public void testGetSlots() throws Exception { // Get RegionIds of specified database and timestamp getRegionIdReq = new TGetRegionIdReq(TConsensusGroupType.DataRegion); - getRegionIdReq.setDatabase(sg0); + getRegionIdReq.setDatabase(db0); getRegionIdReq.setStartTimeSlot(new TTimePartitionSlot(0)); getRegionIdReq.setEndTimeSlot(new TTimePartitionSlot(0)); getRegionIdResp = client.getRegionId(getRegionIdReq); @@ -394,9 +394,9 @@ public void testGetSlots() throws Exception { // Get all RegionIds within database for (int i = 0; i < databaseNum; i++) { - String curSg = sg + i; + String curDb = db + i; getRegionIdReq = new TGetRegionIdReq(TConsensusGroupType.DataRegion); - getRegionIdReq.setDatabase(curSg); + getRegionIdReq.setDatabase(curDb); getRegionIdResp = client.getRegionId(getRegionIdReq); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), getRegionIdResp.status.getCode()); @@ -406,7 +406,7 @@ public void testGetSlots() throws Exception { // Get RegionId with an equivalent query。 for (long j = 0; j < testTimePartitionSlotsNum; j++) { TGetRegionIdReq subReq = new TGetRegionIdReq(TConsensusGroupType.DataRegion); - subReq.setDatabase(curSg); + subReq.setDatabase(curDb); subReq.setStartTimeSlot(new TTimePartitionSlot(j * testTimePartitionInterval)); subReq.setEndTimeSlot(new TTimePartitionSlot(j * testTimePartitionInterval)); TGetRegionIdResp subResp = client.getRegionId(subReq); @@ -418,7 +418,7 @@ public void testGetSlots() throws Exception { // Get RegionId with time range query TGetRegionIdReq rangeReq = new TGetRegionIdReq(TConsensusGroupType.DataRegion); - rangeReq.setDatabase(curSg); + rangeReq.setDatabase(curDb); rangeReq.setStartTimeSlot(new TTimePartitionSlot(0L)); rangeReq.setEndTimeSlot( new TTimePartitionSlot(testTimePartitionSlotsNum * testTimePartitionInterval)); @@ -443,7 +443,7 @@ public void testGetSlots() throws Exception { } // Get RegionId of SchemaPartition - getRegionIdReq.setDatabase(sg0); + getRegionIdReq.setDatabase(db0); getRegionIdReq.setType(TConsensusGroupType.SchemaRegion); getRegionIdResp = client.getRegionId(getRegionIdReq); Assert.assertEquals( @@ -453,7 +453,7 @@ public void testGetSlots() throws Exception { TGetTimeSlotListReq getTimeSlotListReq; TGetTimeSlotListResp getTimeSlotListResp; getTimeSlotListReq = new TGetTimeSlotListReq(); - getTimeSlotListReq.setDatabase(sg0); + getTimeSlotListReq.setDatabase(db0); getTimeSlotListResp = client.getTimeSlotList(getTimeSlotListReq); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), getTimeSlotListResp.status.getCode()); @@ -480,7 +480,7 @@ public void testGetSlots() throws Exception { TCountTimeSlotListReq countTimeSlotListReq; TCountTimeSlotListResp countTimeSlotListResp; countTimeSlotListReq = new TCountTimeSlotListReq(); - countTimeSlotListReq.setDatabase(sg0); + countTimeSlotListReq.setDatabase(db0); countTimeSlotListResp = client.countTimeSlotList(countTimeSlotListReq); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), countTimeSlotListResp.status.getCode()); @@ -504,7 +504,7 @@ public void testGetSlots() throws Exception { TGetSeriesSlotListReq getSeriesSlotListReq; TGetSeriesSlotListResp getSeriesSlotListResp; - getSeriesSlotListReq = new TGetSeriesSlotListReq(sg0, TConsensusGroupType.DataRegion); + getSeriesSlotListReq = new TGetSeriesSlotListReq(db0, TConsensusGroupType.DataRegion); getSeriesSlotListResp = client.getSeriesSlotList(getSeriesSlotListReq); Assert.assertEquals( TSStatusCode.SUCCESS_STATUS.getStatusCode(), getSeriesSlotListResp.status.getCode()); diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBTimePartitionIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBTimePartitionIT.java index 469d6974cb583..ce4e0b97c5ab8 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBTimePartitionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBTimePartitionIT.java @@ -63,15 +63,15 @@ public class IoTDBTimePartitionIT { private static final Logger LOGGER = LoggerFactory.getLogger(IoTDBTimePartitionIT.class); private static final String INSERTION_1 = - "INSERT INTO root.sg1.d1(timestamp,speed,temperature) values(0, 1, 2)"; + "INSERT INTO root.db1.d1(timestamp,speed,temperature) values(0, 1, 2)"; private static final String INSERTION_2 = - "INSERT INTO root.sg1.d1(timestamp,speed,temperature) values(1000, 1, 2)"; + "INSERT INTO root.db1.d1(timestamp,speed,temperature) values(1000, 1, 2)"; private static final String INSERTION_3 = - "INSERT INTO root.sg1.d1(timestamp,speed,temperature) values(3601000, 1, 2)"; + "INSERT INTO root.db1.d1(timestamp,speed,temperature) values(3601000, 1, 2)"; private List timestatmps = Arrays.asList(0L, 1000L, 3601000L); - private static final String SHOW_TIME_PARTITION = "show timePartition where database = root.sg1"; + private static final String SHOW_TIME_PARTITION = "show timePartition where database = root.db1"; private static final TGetDatabaseReq showAllDatabasesReq; diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/IoTDBRegionOperationReliabilityITFramework.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/IoTDBRegionOperationReliabilityITFramework.java index 8e2a954dc91ce..a6b1487cda196 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/IoTDBRegionOperationReliabilityITFramework.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/IoTDBRegionOperationReliabilityITFramework.java @@ -88,13 +88,13 @@ public class IoTDBRegionOperationReliabilityITFramework { private static final Logger LOGGER = LoggerFactory.getLogger(IoTDBRegionOperationReliabilityITFramework.class); public static final String INSERTION1 = - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(100, 1, 2)"; + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(100, 1, 2)"; private static final String INSERTION2 = - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(101, 3, 4)"; + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(101, 3, 4)"; public static final String FLUSH_COMMAND = "flush on cluster"; private static final String SHOW_REGIONS = "show regions"; private static final String SHOW_DATANODES = "show datanodes"; - private static final String COUNT_TIMESERIES = "select count(*) from root.sg.**"; + private static final String COUNT_TIMESERIES = "select count(*) from root.db.**"; private static final String REGION_MIGRATE_COMMAND_FORMAT = "migrate region %d from %d to %d"; ExecutorService executorService = IoTDBThreadPoolFactory.newCachedThreadPool("regionMigrateIT"); diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionReconstructForIoTV1IT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionReconstructForIoTV1IT.java index 3dc4468e52691..af39e9c21dd8a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionReconstructForIoTV1IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionReconstructForIoTV1IT.java @@ -161,7 +161,7 @@ public void normal1C3DTest() throws Exception { // now, the query should throw exception try { - session.executeQueryStatement("select * from root.sg.**"); + session.executeQueryStatement("select * from root.db.**"); } catch (StatementExecutionException e) { break; } @@ -194,7 +194,7 @@ public void normal1C3DTest() throws Exception { while (true) { SessionDataSet resultSet; try { - resultSet = session.executeQueryStatement("select * from root.sg.**"); + resultSet = session.executeQueryStatement("select * from root.db.**"); } catch (StatementExecutionException e) { if (System.currentTimeMillis() - start > 60_000L) { fail("Cannot execute query within 60s"); diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/removeconfignode/IoTDBRemoveConfigNodeITFramework.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/removeconfignode/IoTDBRemoveConfigNodeITFramework.java index 6112fea7f5255..c29547818a565 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/removeconfignode/IoTDBRemoveConfigNodeITFramework.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/removeconfignode/IoTDBRemoveConfigNodeITFramework.java @@ -53,7 +53,7 @@ public class IoTDBRemoveConfigNodeITFramework { private static final Logger LOGGER = LoggerFactory.getLogger(IoTDBRemoveConfigNodeITFramework.class); private static final String TREE_MODEL_INSERTION = - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(100, 1, 2)"; + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(100, 1, 2)"; private static final String SHOW_CONFIGNODES = "show confignodes"; diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/utils/ConfigNodeTestUtils.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/utils/ConfigNodeTestUtils.java index 0697a6c674d24..d125c6aaae145 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/utils/ConfigNodeTestUtils.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/utils/ConfigNodeTestUtils.java @@ -378,7 +378,7 @@ public static void insertTreeModelData(Statement statement) throws SQLException for (int i = 0; i < 1024; i++) { statement.addBatch( String.format( - "INSERT INTO root.sg.d%d(timestamp,speed,temperature) values(%d, %d, %d)", + "INSERT INTO root.db.d%d(timestamp,speed,temperature) values(%d, %d, %d)", i, i, i, i)); } statement.executeBatch(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java index ee0ee073c9642..53679a9aefe89 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java @@ -140,7 +140,7 @@ public void rightInsertTablet(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/insertTablet"); String json = - "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s4\",\"s5\"],\"dataTypes\":[\"INT32\",\"INT32\"],\"values\":[[11,2],[15,13]],\"isAligned\":false,\"deviceId\":\"root.sg25\"}"; + "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s4\",\"s5\"],\"dataTypes\":[\"INT32\",\"INT32\"],\"values\":[[11,2],[15,13]],\"isAligned\":false,\"deviceId\":\"root.db25\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -181,7 +181,7 @@ public void expressionGroupByLevel(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/grafana/v1/query/expression"); String sql = - "{\"expression\":[\"count(s4)\"],\"prefixPath\":[\"root.sg25\"],\"startTime\":1635232143960,\"endTime\":1635232153960,\"control\":\"group by([1635232143960,1635232153960),1s),level=1\"}"; + "{\"expression\":[\"count(s4)\"],\"prefixPath\":[\"root.db25\"],\"startTime\":1635232143960,\"endTime\":1635232153960,\"control\":\"group by([1635232143960,1635232153960),1s),level=1\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -194,7 +194,7 @@ public void expressionGroupByLevel(CloseableHttpClient httpClient) { Assert.assertTrue(map.size() > 0); Assert.assertTrue(timestampsResult.size() == 10); Assert.assertTrue(valuesResult.size() == 1); - Assert.assertTrue("count(root.sg25.s4)".equals(expressionsResult.get(0))); + Assert.assertTrue("count(root.db25.s4)".equals(expressionsResult.get(0))); } catch (IOException e) { e.printStackTrace(); fail(e.getMessage()); @@ -215,7 +215,7 @@ public void expression(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/grafana/v1/query/expression"); String sql = - "{\"expression\":[\"s4\",\"s5\"],\"prefixPath\":[\"root.sg25\"],\"startTime\":1635232133960,\"endTime\":1635232163960}"; + "{\"expression\":[\"s4\",\"s5\"],\"prefixPath\":[\"root.db25\"],\"startTime\":1635232133960,\"endTime\":1635232163960}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -237,7 +237,7 @@ public void expression(CloseableHttpClient httpClient) { String message = EntityUtils.toString(responseEntity, "utf-8"); ObjectMapper mapper = new ObjectMapper(); Map map = mapper.readValue(message, Map.class); - String[] expressionsResult = {"root.sg25.s4", "root.sg25.s5"}; + String[] expressionsResult = {"root.db25.s4", "root.db25.s5"}; Long[] timestamps = {1635232143960L, 1635232153960L}; Object[] values1 = {11, 2}; Object[] values2 = {15, 13}; @@ -268,7 +268,7 @@ public void expressionWithControl(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/grafana/v1/query/expression"); String sql = - "{\"expression\":[\"sum(s4)\",\"avg(s5)\"],\"prefixPath\":[\"root.sg25\"],\"startTime\":1635232133960,\"endTime\":1635232163960,\"control\":\"group by([1635232133960,1635232163960),20s)\"}"; + "{\"expression\":[\"sum(s4)\",\"avg(s5)\"],\"prefixPath\":[\"root.db25\"],\"startTime\":1635232133960,\"endTime\":1635232163960,\"control\":\"group by([1635232133960,1635232163960),20s)\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { @@ -291,7 +291,7 @@ public void expressionWithControl(CloseableHttpClient httpClient) { String message = EntityUtils.toString(responseEntity, "utf-8"); ObjectMapper mapper = new ObjectMapper(); Map map = mapper.readValue(message, Map.class); - String[] expressionsResult = {"sum(root.sg25.s4)", "avg(root.sg25.s5)"}; + String[] expressionsResult = {"sum(root.db25.s4)", "avg(root.db25.s5)"}; Long[] timestamps = {1635232133960L, 1635232153960L}; Object[] values1 = {11.0, 2.0}; Object[] values2 = {15.0, 13.0}; @@ -322,7 +322,7 @@ public void expressionWithConditionControl(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/grafana/v1/query/expression"); String sql = - "{\"expression\":[\"sum(s4)\",\"avg(s5)\"],\"prefixPath\":[\"root.sg25\"],\"condition\":\"timestamp=1635232143960\",\"startTime\":1635232133960,\"endTime\":1635232163960,\"control\":\"group by([1635232133960,1635232163960),20s)\"}"; + "{\"expression\":[\"sum(s4)\",\"avg(s5)\"],\"prefixPath\":[\"root.db25\"],\"condition\":\"timestamp=1635232143960\",\"startTime\":1635232133960,\"endTime\":1635232163960,\"control\":\"group by([1635232133960,1635232163960),20s)\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -343,7 +343,7 @@ public void expressionWithConditionControl(CloseableHttpClient httpClient) { String message = EntityUtils.toString(responseEntity, "utf-8"); ObjectMapper mapper = new ObjectMapper(); Map map = mapper.readValue(message, Map.class); - String[] expressionsResult = {"sum(root.sg25.s4)", "avg(root.sg25.s5)"}; + String[] expressionsResult = {"sum(root.db25.s4)", "avg(root.db25.s5)"}; Long[] timestamps = {1635232133960L, 1635232153960L}; Object[] values1 = {11.0, null}; Object[] values2 = {15.0, null}; @@ -372,7 +372,7 @@ public void variable(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/grafana/v1/variable"); - String sql = "{\"sql\":\"show child paths root.sg25\"}"; + String sql = "{\"sql\":\"show child paths root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDatetimeFormatIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDatetimeFormatIT.java index 620043e6c7b7b..5f26d3d772d2a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDatetimeFormatIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDatetimeFormatIT.java @@ -93,11 +93,11 @@ public void testDatetimeInputFormat() { for (int i = 0; i < datetimeStrings.length; i++) { String insertSql = String.format( - "INSERT INTO root.sg1.d1(time, s1) values (%s, %d)", datetimeStrings[i], i); + "INSERT INTO root.db1.d1(time, s1) values (%s, %d)", datetimeStrings[i], i); statement.execute(insertSql); } - ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg1.d1"); + ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db1.d1"); Assert.assertNotNull(resultSet); int cnt = 0; @@ -117,20 +117,20 @@ public void testBigDateTime() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg"); + statement.execute("CREATE DATABASE root.db"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=DOUBLE, ENCODING=PLAIN;"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=DOUBLE, ENCODING=PLAIN;"); - statement.execute("insert into root.sg.d1(time,s2) values (1618283005586000, 8.76);"); - statement.execute("select * from root.sg.d1;"); - statement.execute("select * from root.sg.d1 where time=53251-05-07T17:06:26.000+08:00"); + statement.execute("insert into root.db.d1(time,s2) values (1618283005586000, 8.76);"); + statement.execute("select * from root.db.d1;"); + statement.execute("select * from root.db.d1 where time=53251-05-07T17:06:26.000+08:00"); } catch (SQLException e) { e.printStackTrace(); fail(); } try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time,s2) values (16182830055860000000, 8.76);"); + statement.execute("insert into root.db.d1(time,s2) values (16182830055860000000, 8.76);"); fail(); } catch (SQLException e) { Assert.assertTrue( 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 17ceb9b696255..fc976d5c95f50 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 @@ -385,10 +385,10 @@ public void testDeleteDataFromEmptySeries() throws SQLException { statement.execute( "INSERT INTO root.ln10.wf01.wt01(Time,status) VALUES (2022-10-11 10:20:50,true),(2022-10-11 10:20:51,true);"); statement.execute( - "create timeseries root.sg10.wf01.wt01.status with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db10.wf01.wt01.status with datatype=BOOLEAN,encoding=PLAIN;"); statement.execute( - "DELETE FROM root.ln10.wf01.wt01.status,root.sg.wf01.wt01.status WHERE time >2022-10-11 10:20:50;"); + "DELETE FROM root.ln10.wf01.wt01.status,root.db.wf01.wt01.status WHERE time >2022-10-11 10:20:50;"); try (ResultSet resultSet = statement.executeQuery("select ** from root.ln10")) { int cnt = 0; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBExampleIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBExampleIT.java index d51a058ec51d3..1afa03a4ec962 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBExampleIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBExampleIT.java @@ -55,11 +55,11 @@ public void exampleTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - try (ResultSet resultSet = statement.executeQuery("show databases root.sg")) { + statement.execute("CREATE DATABASE root.db"); + try (ResultSet resultSet = statement.executeQuery("show databases root.db")) { if (resultSet.next()) { String databasePath = resultSet.getString(ColumnHeaderConstant.DATABASE); - Assert.assertEquals("root.sg", databasePath); + Assert.assertEquals("root.db", databasePath); } else { Assert.fail("This ResultSet is empty."); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterIT.java index b8dd88ea9d715..c5ae6b3f81592 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterIT.java @@ -116,7 +116,7 @@ private static void generateData() { } } statement.execute( - " insert into root.sg1.d1(time, s1, s2) aligned values (1,1, \"1\"), (2,2,\"2\")"); + " insert into root.db1.d1(time, s1, s2) aligned values (1,1, \"1\"), (2,2,\"2\")"); statement.execute( " insert into root.vehicle.testUDTF(time, s1, s2) values (1,\"ss\",0), (2,\"d\",3)"); } catch (SQLException throwable) { @@ -185,7 +185,7 @@ public void testSameConstantWithDifferentType() { Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select s2 from root.sg1.d1 where s1 = 1 and s2 >= \"1\" and s2 <= \"2\";")) { + "select s2 from root.db1.d1 where s1 = 1 and s2 >= \"1\" and s2 <= \"2\";")) { int count = 0; while (resultSet.next()) { ++count; @@ -199,16 +199,16 @@ public void testSameConstantWithDifferentType() { @Test public void testMismatchedDataTypes() { assertTestFail( - "select s1 from root.sg1.d1 where s1;", + "select s1 from root.db1.d1 where s1;", "The output type of the expression in WHERE clause should be BOOLEAN, actual data type: DOUBLE."); assertTestFail( - "select count(s1) from root.sg1.d1 group by ([0, 40), 5ms) having count(s1) + 1;", + "select count(s1) from root.db1.d1 group by ([0, 40), 5ms) having count(s1) + 1;", "The output type of the expression in HAVING clause should be BOOLEAN, actual data type: DOUBLE."); assertTestFail( - "select s1 from root.sg1.d1 where s1 align by device;", + "select s1 from root.db1.d1 where s1 align by device;", "The output type of the expression in WHERE clause should be BOOLEAN, actual data type: DOUBLE."); assertTestFail( - "select count(s1) from root.sg1.d1 group by ([0, 40), 5ms) having count(s1) + 1 align by device;", + "select count(s1) from root.db1.d1 group by ([0, 40), 5ms) having count(s1) + 1 align by device;", "The output type of the expression in HAVING clause should be BOOLEAN, actual data type: DOUBLE."); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFloatPrecisionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFloatPrecisionIT.java index 4fd8c2dee4e36..5f14368a00301 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFloatPrecisionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFloatPrecisionIT.java @@ -177,21 +177,21 @@ public void bigFloatNumberTest2() { float[] floats = new float[] {6.5536403E8F, 3.123456768E20F, Float.NaN}; double[] doubles = new double[] {9.223372036854E18, 9.223372036854E100, Double.NaN}; - statement.execute("create timeseries root.sg.d1.s1 with datatype=float, encoding=rle"); - statement.execute("create timeseries root.sg.d1.s2 with datatype=double, encoding=rle"); + statement.execute("create timeseries root.db.d1.s1 with datatype=float, encoding=rle"); + statement.execute("create timeseries root.db.d1.s2 with datatype=double, encoding=rle"); statement.execute( - "insert into root.sg.d1(time, s1, s2) values (1, 6.5536403E8, 9.223372036854E18)"); + "insert into root.db.d1(time, s1, s2) values (1, 6.5536403E8, 9.223372036854E18)"); statement.execute( - "insert into root.sg.d1(time, s1, s2) values (2, 3.123456768E20, 9.223372036854E100)"); - statement.execute("insert into root.sg.d1(time, s1, s2) values (3, NaN, NaN)"); + "insert into root.db.d1(time, s1, s2) values (2, 3.123456768E20, 9.223372036854E100)"); + statement.execute("insert into root.db.d1(time, s1, s2) values (3, NaN, NaN)"); int cnt; - try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db.d1")) { assertNotNull(resultSet); cnt = 0; while (resultSet.next()) { - assertEquals(floats[cnt], resultSet.getFloat("root.sg.d1.s1"), DELTA_FLOAT); - assertEquals(doubles[cnt], resultSet.getDouble("root.sg.d1.s2"), DELTA_DOUBLE); + assertEquals(floats[cnt], resultSet.getFloat("root.db.d1.s1"), DELTA_FLOAT); + assertEquals(doubles[cnt], resultSet.getDouble("root.db.d1.s2"), DELTA_DOUBLE); cnt++; } assertEquals(3, cnt); @@ -199,12 +199,12 @@ public void bigFloatNumberTest2() { statement.execute("flush"); - try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db.d1")) { assertNotNull(resultSet); cnt = 0; while (resultSet.next()) { - assertEquals(floats[cnt], resultSet.getFloat("root.sg.d1.s1"), DELTA_FLOAT); - assertEquals(doubles[cnt], resultSet.getDouble("root.sg.d1.s2"), DELTA_DOUBLE); + assertEquals(floats[cnt], resultSet.getFloat("root.db.d1.s1"), DELTA_FLOAT); + assertEquals(doubles[cnt], resultSet.getDouble("root.db.d1.s2"), DELTA_DOUBLE); cnt++; } assertEquals(3, cnt); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiPartitionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiPartitionIT.java index fac1175f74e45..e6baf334a62af 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiPartitionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiPartitionIT.java @@ -59,10 +59,10 @@ public void testInsertMultiPartition() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time,s1) values(1,2)"); + statement.execute("insert into root.db.d1(time,s1) values(1,2)"); statement.execute("flush"); - statement.execute("insert into root.sg.d1(time,s1) values(2,2)"); - statement.execute("insert into root.sg.d1(time,s1) values(604800001,2)"); + statement.execute("insert into root.db.d1(time,s1) values(2,2)"); + statement.execute("insert into root.db.d1(time,s1) values(604800001,2)"); statement.execute("flush"); } catch (Exception e) { fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java index 18c00b125dd1c..1e03bbc308e05 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java @@ -176,11 +176,11 @@ public void testInsertMultiRowWithWrongTimestampPrecision() { @Test public void testInsertMultiRowWithMultiTimePartition() throws Exception { try (Statement st1 = connection.createStatement()) { - st1.execute("insert into root.sg1.d1(time,s1) values(604800010,1)"); + st1.execute("insert into root.db1.d1(time,s1) values(604800010,1)"); st1.execute("flush"); - st1.execute("insert into root.sg1.d1(time,s1) values(604799990,1), (604800001,1)"); + st1.execute("insert into root.db1.d1(time,s1) values(604799990,1), (604800001,1)"); st1.execute("flush"); - ResultSet rs1 = st1.executeQuery("select s1 from root.sg1.d1"); + ResultSet rs1 = st1.executeQuery("select s1 from root.db1.d1"); assertTrue(rs1.next()); assertEquals(604799990, rs1.getLong("Time")); assertTrue(rs1.next()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertNullIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertNullIT.java index 47f1e8f67dfe0..bcd842769dcca 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertNullIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertNullIT.java @@ -76,11 +76,11 @@ private static void close() { } private static void initCreateSQLStatement() { - sqls.add("CREATE DATABASE root.sg"); - sqls.add("CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=BOOLEAN"); - sqls.add("CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=FLOAT"); - sqls.add("CREATE TIMESERIES root.sg.d1.s3 WITH DATATYPE=INT32"); - sqls.add("CREATE ALIGNED TIMESERIES root.sg.d2(s1 BOOLEAN,s2 FLOAT,s3 INT32)"); + sqls.add("CREATE DATABASE root.db"); + sqls.add("CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=BOOLEAN"); + sqls.add("CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=FLOAT"); + sqls.add("CREATE TIMESERIES root.db.d1.s3 WITH DATATYPE=INT32"); + sqls.add("CREATE ALIGNED TIMESERIES root.db.d2(s1 BOOLEAN,s2 FLOAT,s3 INT32)"); } private static void insertData() throws SQLException { @@ -103,17 +103,17 @@ public void testInsertNull() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time,s1,s2,s3) values(1,null,1.0,1)"); - statement.execute("insert into root.sg.d1(time,s1,s2,s3) values(2,true,null,2)"); - statement.execute("insert into root.sg.d1(time,s1,s2,s3) values(3,true,3.0,null)"); + statement.execute("insert into root.db.d1(time,s1,s2,s3) values(1,null,1.0,1)"); + statement.execute("insert into root.db.d1(time,s1,s2,s3) values(2,true,null,2)"); + statement.execute("insert into root.db.d1(time,s1,s2,s3) values(3,true,3.0,null)"); - try (ResultSet resultSet = statement.executeQuery("select * from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db.d1")) { assertNotNull(resultSet); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, - "Time,root.sg.d1.s1,root.sg.d1.s2,root.sg.d1.s3", + "Time,root.db.d1.s1,root.db.d1.s2,root.db.d1.s3", new int[] { Types.TIMESTAMP, Types.BOOLEAN, Types.FLOAT, Types.INTEGER, }); @@ -149,17 +149,17 @@ public void testInsertAlignedNull() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d2(time,s1,s2,s3) aligned values(1,null,1.0,1)"); - statement.execute("insert into root.sg.d2(time,s1,s2,s3) aligned values(2,true,null,2)"); - statement.execute("insert into root.sg.d2(time,s1,s2,s3) aligned values(3,true,3.0,null)"); + statement.execute("insert into root.db.d2(time,s1,s2,s3) aligned values(1,null,1.0,1)"); + statement.execute("insert into root.db.d2(time,s1,s2,s3) aligned values(2,true,null,2)"); + statement.execute("insert into root.db.d2(time,s1,s2,s3) aligned values(3,true,3.0,null)"); - try (ResultSet resultSet = statement.executeQuery("select * from root.sg.d2")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db.d2")) { assertNotNull(resultSet); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, - "Time,root.sg.d2.s1,root.sg.d2.s2,root.sg.d2.s3", + "Time,root.db.d2.s1,root.db.d2.s2,root.db.d2.s3", new int[] { Types.TIMESTAMP, Types.BOOLEAN, Types.FLOAT, Types.INTEGER, }); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertWithoutTimeIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertWithoutTimeIT.java index 62d04de083a77..16b36b9e47882 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertWithoutTimeIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertWithoutTimeIT.java @@ -46,10 +46,10 @@ public class IoTDBInsertWithoutTimeIT { private static final List sqls = Arrays.asList( - "CREATE DATABASE root.sg1", - "CREATE TIMESERIES root.sg1.d1.s1 INT64", - "CREATE TIMESERIES root.sg1.d1.s2 FLOAT", - "CREATE TIMESERIES root.sg1.d1.s3 TEXT"); + "CREATE DATABASE root.db1", + "CREATE TIMESERIES root.db1.d1.s1 INT64", + "CREATE TIMESERIES root.db1.d1.s2 FLOAT", + "CREATE TIMESERIES root.db1.d1.s3 TEXT"); @Before public void setUp() throws Exception { @@ -78,50 +78,50 @@ private void createTimeseries() { public void testInsertWithoutTime() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg1.d1(s1, s2, s3) values (1, 1, '1')"); + statement.execute("insert into root.db1.d1(s1, s2, s3) values (1, 1, '1')"); Thread.sleep(1); - statement.execute("insert into root.sg1.d1(s2, s1, s3) values (2, 2, '2')"); + statement.execute("insert into root.db1.d1(s2, s1, s3) values (2, 2, '2')"); Thread.sleep(1); - statement.execute("insert into root.sg1.d1(s3, s2, s1) values ('3', 3, 3)"); + statement.execute("insert into root.db1.d1(s3, s2, s1) values ('3', 3, 3)"); Thread.sleep(1); - statement.execute("insert into root.sg1.d1(s1) values (1)"); - statement.execute("insert into root.sg1.d1(s2) values (2)"); - statement.execute("insert into root.sg1.d1(s3) values ('3')"); + statement.execute("insert into root.db1.d1(s1) values (1)"); + statement.execute("insert into root.db1.d1(s2) values (2)"); + statement.execute("insert into root.db1.d1(s3) values ('3')"); } catch (SQLException | InterruptedException e) { e.printStackTrace(); fail(e.getMessage()); } - String expectedHeader = "count(root.sg1.d1.s1),count(root.sg1.d1.s2),count(root.sg1.d1.s3),"; + String expectedHeader = "count(root.db1.d1.s1),count(root.db1.d1.s2),count(root.db1.d1.s3),"; String[] retArray = new String[] {"4,4,4,"}; resultSetEqualTest( - "select count(s1), count(s2), count(s3) from root.sg1.d1", expectedHeader, retArray); + "select count(s1), count(s2), count(s3) from root.db1.d1", expectedHeader, retArray); } @Test public void testInsertWithoutValueColumns() { assertNonQueryTestFail( - "insert into root.sg1.d1(time) values (1)", + "insert into root.db1.d1(time) values (1)", "InsertStatement should contain at least one measurement"); } @Test public void testInsertMultiRow() { assertNonQueryTestFail( - "insert into root.sg1.d1(s3) values ('1'), ('2')", + "insert into root.db1.d1(s3) values ('1'), ('2')", "need timestamps when insert multi rows"); assertNonQueryTestFail( - "insert into root.sg1.d1(s1, s2) values (1, 1), (2, 2)", + "insert into root.db1.d1(s1, s2) values (1, 1), (2, 2)", "need timestamps when insert multi rows"); } @Test public void testInsertWithMultiTimesColumns() { assertNonQueryTestFail( - "insert into root.sg1.d1(time, time) values (1, 1)", + "insert into root.db1.d1(time, time) values (1, 1)", "One row should only have one time value"); assertNonQueryTestFail( - "insert into root.sg1.d1(time, s1, time) values (1, 1, 1)", + "insert into root.db1.d1(time, s1, time) values (1, 1, 1)", "One row should only have one time value"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBJDBCMetadataIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBJDBCMetadataIT.java index 8e82865f8c220..01c01be0ff6db 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBJDBCMetadataIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBJDBCMetadataIT.java @@ -47,18 +47,18 @@ public class IoTDBJDBCMetadataIT { protected static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg_type;", - "CREATE TIMESERIES root.sg_type.d_0.s_boolean BOOLEAN;", - "CREATE TIMESERIES root.sg_type.d_0.s_int32 INT32;", - "CREATE TIMESERIES root.sg_type.d_0.s_int64 INT64;", - "CREATE TIMESERIES root.sg_type.d_0.s_float FLOAT;", - "CREATE TIMESERIES root.sg_type.d_0.s_double DOUBLE;", - "CREATE TIMESERIES root.sg_type.d_0.s_text TEXT;", - "CREATE TIMESERIES root.sg_type.d_0.s_timestamp TIMESTAMP;", - "CREATE TIMESERIES root.sg_type.d_0.s_date DATE;", - "CREATE TIMESERIES root.sg_type.d_0.s_blob BLOB;", - "CREATE TIMESERIES root.sg_type.d_0.s_string STRING;", - "INSERT INTO root.sg_type.d_0(time, s_int32, s_int64, s_float, s_double, s_text) VALUES (0, 0, 0, 0.000000, 0.000000, 'text0');" + "CREATE DATABASE root.db_type;", + "CREATE TIMESERIES root.db_type.d_0.s_boolean BOOLEAN;", + "CREATE TIMESERIES root.db_type.d_0.s_int32 INT32;", + "CREATE TIMESERIES root.db_type.d_0.s_int64 INT64;", + "CREATE TIMESERIES root.db_type.d_0.s_float FLOAT;", + "CREATE TIMESERIES root.db_type.d_0.s_double DOUBLE;", + "CREATE TIMESERIES root.db_type.d_0.s_text TEXT;", + "CREATE TIMESERIES root.db_type.d_0.s_timestamp TIMESTAMP;", + "CREATE TIMESERIES root.db_type.d_0.s_date DATE;", + "CREATE TIMESERIES root.db_type.d_0.s_blob BLOB;", + "CREATE TIMESERIES root.db_type.d_0.s_string STRING;", + "INSERT INTO root.db_type.d_0(time, s_int32, s_int64, s_float, s_double, s_text) VALUES (0, 0, 0, 0.000000, 0.000000, 'text0');" }; @BeforeClass @@ -113,14 +113,14 @@ public void testMetadata() throws Exception { }; String[] values = new String[] { - "0", "root.sg_type.d_0", null, "0", "0", "0.0", "0.0", "text0", null, null, null, null + "0", "root.db_type.d_0", null, "0", "0", "0.0", "0.0", "text0", null, null, null, null }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s_boolean, s_int32, s_int64, s_float, s_double, s_text, s_timestamp, s_date, s_blob, s_string from root.sg_type.d_0 align by device")) { + "select s_boolean, s_int32, s_int64, s_float, s_double, s_text, s_timestamp, s_date, s_blob, s_string from root.db_type.d_0 align by device")) { ResultSetMetaData metaData = resultSet.getMetaData(); assertEquals(columnNames.length, metaData.getColumnCount()); assertTrue(resultSet.next()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java index 755b3aef75864..b23e9c878aaf5 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java @@ -126,8 +126,8 @@ private void registerSchema() throws SQLException { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE " + SchemaConfig.STORAGE_GROUP_0); - statement.execute("CREATE DATABASE " + SchemaConfig.STORAGE_GROUP_1); + statement.execute("CREATE DATABASE " + SchemaConfig.DATABASE_0); + statement.execute("CREATE DATABASE " + SchemaConfig.DATABASE_1); statement.execute(convert2SQL(SchemaConfig.DEVICE_0, SchemaConfig.MEASUREMENT_00)); statement.execute(convert2SQL(SchemaConfig.DEVICE_0, SchemaConfig.MEASUREMENT_01)); @@ -182,8 +182,8 @@ private void deleteSG() throws SQLException { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute(String.format("delete database %s", SchemaConfig.STORAGE_GROUP_0)); - statement.execute(String.format("delete database %s", SchemaConfig.STORAGE_GROUP_1)); + statement.execute(String.format("delete database %s", SchemaConfig.DATABASE_0)); + statement.execute(String.format("delete database %s", SchemaConfig.DATABASE_1)); } catch (final IoTDBSQLException ignored) { } } @@ -223,7 +223,7 @@ public void testTreeModelLoadWithLastCache() throws Exception { final File file1 = new File(tmpDir, "1-0-0-0.tsfile"); final File file2 = new File(tmpDir, "2-0-0-0.tsfile"); - // device 0, device 1, sg 0 + // device 0, device 1, db 0 try (final TsFileGenerator generator = new TsFileGenerator(file1)) { generator.registerTimeseries( SchemaConfig.DEVICE_0, @@ -251,7 +251,7 @@ public void testTreeModelLoadWithLastCache() throws Exception { generator.generateData(SchemaConfig.DEVICE_1, 10000, PARTITION_INTERVAL / 10_000, true); } - // device 2, device 3, device4, sg 1 + // device 2, device 3, device4, db 1 try (final TsFileGenerator generator = new TsFileGenerator(file2)) { generator.registerTimeseries( SchemaConfig.DEVICE_2, Collections.singletonList(SchemaConfig.MEASUREMENT_20)); @@ -267,7 +267,7 @@ public void testTreeModelLoadWithLastCache() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); + statement.execute(String.format("load \"%s\" dblevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = statement.executeQuery(String.format("select last %s from %s", measurement, device))) { @@ -283,7 +283,7 @@ public void testTreeModelLoadWithLastCache() throws Exception { @Test public void testTableModelLoadWithLastCache() throws Exception { - final String database = SchemaConfig.DATABASE_0; + final String database = SchemaConfig.TABLE_DATABASE; final String table = SchemaConfig.TABLE_0; final String measurement = SchemaConfig.MEASUREMENT_00.getMeasurementName(); @@ -581,13 +581,13 @@ public void testTableLoadPerformance() throws Exception { private static class SchemaConfig { - private static final String DATABASE_0 = "db"; + private static final String TABLE_DATABASE = "db"; private static final String TABLE_0 = "test"; - private static final String STORAGE_GROUP_0 = "root.sg.test_0"; - private static final String STORAGE_GROUP_1 = "root.sg.test_1"; + private static final String DATABASE_0 = "root.db.test_0"; + private static final String DATABASE_1 = "root.db.test_1"; - // device 0, nonaligned, sg 0 - private static final String DEVICE_0 = "root.sg.test_0.d_0"; + // device 0, nonaligned, db 0 + private static final String DEVICE_0 = "root.db.test_0.d_0"; private static final MeasurementSchema MEASUREMENT_00 = new MeasurementSchema("sensor_00", TSDataType.INT32, TSEncoding.RLE); private static final MeasurementSchema MEASUREMENT_01 = @@ -605,8 +605,8 @@ private static class SchemaConfig { private static final MeasurementSchema MEASUREMENT_07 = new MeasurementSchema("sensor_07", TSDataType.STRING, TSEncoding.PLAIN); - // device 1, aligned, sg 0 - private static final String DEVICE_1 = "root.sg.test_0.a_1"; + // device 1, aligned, db 0 + private static final String DEVICE_1 = "root.db.test_0.a_1"; private static final MeasurementSchema MEASUREMENT_10 = new MeasurementSchema("sensor_10", TSDataType.INT32, TSEncoding.RLE); private static final MeasurementSchema MEASUREMENT_11 = @@ -624,18 +624,18 @@ private static class SchemaConfig { private static final MeasurementSchema MEASUREMENT_17 = new MeasurementSchema("sensor_17", TSDataType.STRING, TSEncoding.PLAIN); - // device 2, non aligned, sg 1 - private static final String DEVICE_2 = "root.sg.test_1.d_2"; + // device 2, non aligned, db 1 + private static final String DEVICE_2 = "root.db.test_1.d_2"; private static final MeasurementSchema MEASUREMENT_20 = new MeasurementSchema("sensor_20", TSDataType.INT32, TSEncoding.RLE); - // device 3, non aligned, sg 1 - private static final String DEVICE_3 = "root.sg.test_1.d_3"; + // device 3, non aligned, db 1 + private static final String DEVICE_3 = "root.db.test_1.d_3"; private static final MeasurementSchema MEASUREMENT_30 = new MeasurementSchema("sensor_30", TSDataType.INT32, TSEncoding.RLE); - // device 4, aligned, sg 1 - private static final String DEVICE_4 = "root.sg.test_1.a_4"; + // device 4, aligned, db 1 + private static final String DEVICE_4 = "root.db.test_1.a_4"; private static final MeasurementSchema MEASUREMENT_40 = new MeasurementSchema("sensor_40", TSDataType.INT32, TSEncoding.RLE); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadTsFileIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadTsFileIT.java index c54adb347117e..17506bb8b3223 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadTsFileIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadTsFileIT.java @@ -186,7 +186,7 @@ public void testLoad() throws Exception { registerSchema(); final long writtenPoint1; - // device 0, device 1, sg 0 + // device 0, device 1, db 0 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "1-0-0-0.tsfile"))) { generator.registerTimeseries( @@ -217,7 +217,7 @@ public void testLoad() throws Exception { } final long writtenPoint2; - // device 2, device 3, device4, sg 1 + // device 2, device 3, device4, db 1 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "2-0-0-0.tsfile"))) { generator.registerTimeseries( @@ -238,15 +238,15 @@ public void testLoad() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); + statement.execute(String.format("load \"%s\" dblevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); - Assert.assertEquals(writtenPoint1, sg1Count); - long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); - Assert.assertEquals(writtenPoint2, sg2Count); + long db1Count = resultSet.getLong("count(root.db.test_0.*.*)"); + Assert.assertEquals(writtenPoint1, db1Count); + long db2Count = resultSet.getLong("count(root.db.test_1.*.*)"); + Assert.assertEquals(writtenPoint2, db2Count); } else { Assert.fail("This ResultSet is empty."); } @@ -268,7 +268,7 @@ public void testLoadAcrossMultipleTimePartitions() throws Exception { registerSchema(); final long writtenPoint1; - // device 0, device 1, sg 0 + // device 0, device 1, db 0 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "1-0-0-0.tsfile"))) { generator.registerTimeseries( @@ -303,7 +303,7 @@ public void testLoadAcrossMultipleTimePartitions() throws Exception { } final long writtenPoint2; - // device 2, device 3, device4, sg 1 + // device 2, device 3, device4, db 1 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "2-0-0-0.tsfile"))) { generator.registerTimeseries( @@ -327,15 +327,15 @@ public void testLoadAcrossMultipleTimePartitions() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); + statement.execute(String.format("load \"%s\" dblevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); - Assert.assertEquals(writtenPoint1, sg1Count); - long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); - Assert.assertEquals(writtenPoint2, sg2Count); + long db1Count = resultSet.getLong("count(root.db.test_0.*.*)"); + Assert.assertEquals(writtenPoint1, db1Count); + long db2Count = resultSet.getLong("count(root.db.test_1.*.*)"); + Assert.assertEquals(writtenPoint2, db2Count); } else { Assert.fail("This ResultSet is empty."); } @@ -346,7 +346,7 @@ public void testLoadAcrossMultipleTimePartitions() throws Exception { @Test public void testLoadWithExtendTemplate() throws Exception { final long writtenPoint1; - // device 0, device 1, sg 0 + // device 0, device 1, db 0 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "1-0-0-0.tsfile"))) { generator.registerTimeseries( @@ -378,18 +378,18 @@ public void testLoadWithExtendTemplate() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute("create database root.sg.test_0"); + statement.execute("create database root.db.test_0"); statement.execute( "create device template t1 (lat FLOAT encoding=Gorilla, lon FLOAT encoding=Gorilla)"); - statement.execute(" set device template t1 to root.sg.test_0.d_0"); + statement.execute(" set device template t1 to root.db.test_0.d_0"); - statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); + statement.execute(String.format("load \"%s\" dblevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); - Assert.assertEquals(writtenPoint1, sg1Count); + final long db1Count = resultSet.getLong("count(root.db.test_0.*.*)"); + Assert.assertEquals(writtenPoint1, db1Count); } else { Assert.fail("This ResultSet is empty."); } @@ -424,7 +424,7 @@ public void testLoadWithExtendTemplate() throws Exception { @Test public void testLoadWithAutoCreate() throws Exception { final long writtenPoint1; - // device 0, device 1, sg 0 + // device 0, device 1, db 0 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "1-0-0-0.tsfile"))) { generator.registerTimeseries( @@ -455,7 +455,7 @@ public void testLoadWithAutoCreate() throws Exception { } final long writtenPoint2; - // device 2, device 3, device4, sg 1 + // device 2, device 3, device4, db 1 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "2-0-0-0.tsfile"))) { generator.registerTimeseries( @@ -473,15 +473,15 @@ public void testLoadWithAutoCreate() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); + statement.execute(String.format("load \"%s\" dblevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); - Assert.assertEquals(writtenPoint1, sg1Count); - final long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); - Assert.assertEquals(writtenPoint2, sg2Count); + final long db1Count = resultSet.getLong("count(root.db.test_0.*.*)"); + Assert.assertEquals(writtenPoint1, db1Count); + final long db2Count = resultSet.getLong("count(root.db.test_1.*.*)"); + Assert.assertEquals(writtenPoint2, db2Count); } else { Assert.fail("This ResultSet is empty."); } @@ -493,7 +493,7 @@ public void testLoadWithAutoCreate() throws Exception { isAligned.put(SchemaConfig.DEVICE_2, "false"); isAligned.put(SchemaConfig.DEVICE_3, "false"); isAligned.put(SchemaConfig.DEVICE_4, "true"); - try (final ResultSet resultSet = statement.executeQuery("show devices root.sg.**")) { + try (final ResultSet resultSet = statement.executeQuery("show devices root.db.**")) { int size = 0; while (resultSet.next()) { size += 1; @@ -513,7 +513,7 @@ public void testLoadWithAutoCreate() throws Exception { public void testAuth() throws Exception { createUser("test", "test123123456"); - // device 0, device 1, sg 0 + // device 0, device 1, db 0 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "test1-0-0-0.tsfile"))) { generator.registerTimeseries( @@ -542,7 +542,7 @@ public void testAuth() throws Exception { generator.generateData(SchemaConfig.DEVICE_1, 10000, PARTITION_INTERVAL / 10_000, true); } - // device 2, device 3, device4, sg 1 + // device 2, device 3, device4, db 1 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "test2-0-0-0.tsfile"))) { generator.registerTimeseries( @@ -557,7 +557,7 @@ public void testAuth() throws Exception { } assertNonQueryTestFail( - String.format("load \"%s\" sgLevel=2", tmpDir.getAbsolutePath()), + String.format("load \"%s\" dbLevel=2", tmpDir.getAbsolutePath()), "No permissions for this operation, please add privilege WRITE_DATA", "test", "test123123456"); @@ -565,7 +565,7 @@ public void testAuth() throws Exception { grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.**"); assertNonQueryTestFail( - String.format("load \"%s\" sgLevel=2", tmpDir.getAbsolutePath()), + String.format("load \"%s\" dbLevel=2", tmpDir.getAbsolutePath()), "No permissions for this operation, please add privilege SYSTEM", "test", "test123123456"); @@ -573,7 +573,7 @@ public void testAuth() throws Exception { grantUserSystemPrivileges("test", PrivilegeType.SYSTEM); assertNonQueryTestFail( - String.format("load \"%s\" sgLevel=2", tmpDir.getAbsolutePath()), + String.format("load \"%s\" dbLevel=2", tmpDir.getAbsolutePath()), "Auto create or verify schema error when executing statement LoadTsFileStatement", "test", "test123123456"); @@ -581,7 +581,7 @@ public void testAuth() throws Exception { grantUserSystemPrivileges("test", PrivilegeType.WRITE_SCHEMA); executeNonQuery( - String.format("load \"%s\" sgLevel=2", tmpDir.getAbsolutePath()), "test", "test123123456"); + String.format("load \"%s\" dbLevel=2", tmpDir.getAbsolutePath()), "test", "test123123456"); } @Test @@ -589,7 +589,7 @@ public void testLoadWithOnSuccess() throws Exception { final File file1 = new File(tmpDir, "1-0-0-0.tsfile"); final File file2 = new File(tmpDir, "2-0-0-0.tsfile"); long writtenPoint1 = 0; - // device 0, device 1, sg 0 + // device 0, device 1, db 0 try (final TsFileGenerator generator = new TsFileGenerator(file1)) { generator.registerTimeseries( SchemaConfig.DEVICE_0, @@ -619,7 +619,7 @@ public void testLoadWithOnSuccess() throws Exception { } final long writtenPoint2; - // device 2, device 3, device4, sg 1 + // device 2, device 3, device4, db 1 try (final TsFileGenerator generator = new TsFileGenerator(file2)) { generator.registerTimeseries( SchemaConfig.DEVICE_2, Arrays.asList(SchemaConfig.MEASUREMENT_20)); @@ -642,10 +642,10 @@ public void testLoadWithOnSuccess() throws Exception { file1.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); - Assert.assertEquals(writtenPoint1, sg1Count); + final long db1Count = resultSet.getLong("count(root.db.test_0.*.*)"); + Assert.assertEquals(writtenPoint1, db1Count); } else { Assert.fail("This ResultSet is empty."); } @@ -662,12 +662,12 @@ public void testLoadWithOnSuccess() throws Exception { file2.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); - Assert.assertEquals(writtenPoint1, sg1Count); - long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); - Assert.assertEquals(writtenPoint2, sg2Count); + long db1Count = resultSet.getLong("count(root.db.test_0.*.*)"); + Assert.assertEquals(writtenPoint1, db1Count); + long db2Count = resultSet.getLong("count(root.db.test_1.*.*)"); + Assert.assertEquals(writtenPoint2, db2Count); } else { Assert.fail("This ResultSet is empty."); } @@ -681,7 +681,7 @@ public void testLoadWithOnNonStandardTsFileName() throws Exception { final File file1 = new File(tmpDir, "1-0-0-0.tsfile"); final File file2 = new File(tmpDir, "a-1.tsfile"); final long writtenPoint1; - // device 0, device 1, sg 0 + // device 0, device 1, db 0 try (final TsFileGenerator generator = new TsFileGenerator(file1)) { generator.registerTimeseries( SchemaConfig.DEVICE_0, @@ -711,7 +711,7 @@ public void testLoadWithOnNonStandardTsFileName() throws Exception { } final long writtenPoint2; - // device 2, device 3, device4, sg 1 + // device 2, device 3, device4, db 1 try (final TsFileGenerator generator = new TsFileGenerator(file2)) { generator.registerTimeseries( SchemaConfig.DEVICE_2, Collections.singletonList(SchemaConfig.MEASUREMENT_20)); @@ -728,15 +728,15 @@ public void testLoadWithOnNonStandardTsFileName() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); + statement.execute(String.format("load \"%s\" dblevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); - Assert.assertEquals(writtenPoint1, sg1Count); - final long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); - Assert.assertEquals(writtenPoint2, sg2Count); + final long db1Count = resultSet.getLong("count(root.db.test_0.*.*)"); + Assert.assertEquals(writtenPoint1, db1Count); + final long db2Count = resultSet.getLong("count(root.db.test_1.*.*)"); + Assert.assertEquals(writtenPoint2, db2Count); } else { Assert.fail("This ResultSet is empty."); } @@ -751,7 +751,7 @@ public void testLoadWithRelativePathName() throws Exception { registerSchema(); final long writtenPoint1; - // device 0, device 1, sg 0 + // device 0, device 1, db 0 File relativePathFile = new File(System.getProperty(USER_DIR), "1-0-0-0.tsfile"); try { try (final TsFileGenerator generator = new TsFileGenerator(relativePathFile)) { @@ -765,13 +765,13 @@ public void testLoadWithRelativePathName() throws Exception { EnvFactory.getEnv().getConnectionWithSpecifiedDataNode(dataNodeWrapper); final Statement statement = connection.createStatement()) { - statement.execute(String.format("load \"%s\" sglevel=2", "1-0-0-0.tsfile")); + statement.execute(String.format("load \"%s\" dblevel=2", "1-0-0-0.tsfile")); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); - Assert.assertEquals(writtenPoint1, sg1Count); + final long db1Count = resultSet.getLong("count(root.db.test_0.*.*)"); + Assert.assertEquals(writtenPoint1, db1Count); } else { Assert.fail("This ResultSet is empty."); } @@ -788,7 +788,7 @@ public void testLoadWithRelativePathName() throws Exception { @Test public void testLoadWithMods() throws Exception { final long writtenPoint1; - // device 0, device 1, sg 0 + // device 0, device 1, db 0 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "1-0-0-0.tsfile"))) { generator.registerTimeseries( @@ -820,7 +820,7 @@ public void testLoadWithMods() throws Exception { } final long writtenPoint2; - // device 2, device 3, device4, sg 1 + // device 2, device 3, device4, db 1 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "2-0-0-0.tsfile"))) { generator.resetRandom(1000); @@ -848,22 +848,22 @@ public void testLoadWithMods() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); + statement.execute(String.format("load \"%s\" dblevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); - Assert.assertEquals(writtenPoint1, sg1Count); - final long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); - Assert.assertEquals(writtenPoint2, sg2Count); + final long db1Count = resultSet.getLong("count(root.db.test_0.*.*)"); + Assert.assertEquals(writtenPoint1, db1Count); + final long db2Count = resultSet.getLong("count(root.db.test_1.*.*)"); + Assert.assertEquals(writtenPoint2, db2Count); } else { Assert.fail("This ResultSet is empty."); } } TestUtils.assertSingleResultSetEqual( - TestUtils.executeQueryWithRetry(statement, "count timeSeries root.sg.**"), + TestUtils.executeQueryWithRetry(statement, "count timeSeries root.db.**"), Collections.singletonMap("count(timeseries)", "18")); } } @@ -877,7 +877,7 @@ public void testLoadWithEmptyTsFile() throws Exception { statement.execute(String.format("load \"%s\"", tmpDir.getAbsolutePath())); - try (final ResultSet resultSet = statement.executeQuery("show timeseries root.sg")) { + try (final ResultSet resultSet = statement.executeQuery("show timeseries root.db")) { Assert.assertFalse(resultSet.next()); } } @@ -930,7 +930,7 @@ public void testLoadLocally() throws Exception { registerSchema(); final long writtenPoint1; - // device 0, device 1, sg 0 + // device 0, device 1, db 0 try (final TsFileGenerator generator = new TsFileGenerator(new File(tmpDir, "1-0-0-0.tsfile"))) { generator.registerTimeseries( @@ -942,13 +942,13 @@ public void testLoadLocally() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); + statement.execute(String.format("load \"%s\" dblevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); - Assert.assertEquals(writtenPoint1, sg1Count); + final long db1Count = resultSet.getLong("count(root.db.test_0.*.*)"); + Assert.assertEquals(writtenPoint1, db1Count); } else { Assert.fail("This ResultSet is empty."); } @@ -989,10 +989,10 @@ public void testLoadWithConvertOnTypeMismatchForTreeModel() throws Exception { statement.execute(String.format("load \"%s\" ", file.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sgCount = resultSet.getLong("count(root.sg.test_0.*.*)"); - Assert.assertEquals(writtenPoint, sgCount); + final long dbCount = resultSet.getLong("count(root.db.test_0.*.*)"); + Assert.assertEquals(writtenPoint, dbCount); } else { Assert.fail("This ResultSet is empty."); } @@ -1026,11 +1026,11 @@ public void testLoadWithConvertOnTypeMismatchForTreeModel() throws Exception { } private static class SchemaConfig { - private static final String DATABASE_0 = "root.sg.test_0"; - private static final String DATABASE_1 = "root.sg.test_1"; + private static final String DATABASE_0 = "root.db.test_0"; + private static final String DATABASE_1 = "root.db.test_1"; - // device 0, nonaligned, sg 0 - private static final String DEVICE_0 = "root.sg.test_0.d_0"; + // device 0, nonaligned, db 0 + private static final String DEVICE_0 = "root.db.test_0.d_0"; private static final MeasurementSchema MEASUREMENT_00 = new MeasurementSchema("sensor_00", TSDataType.INT32, TSEncoding.RLE); private static final MeasurementSchema MEASUREMENT_01 = @@ -1048,8 +1048,8 @@ private static class SchemaConfig { private static final MeasurementSchema MEASUREMENT_07 = new MeasurementSchema("sensor_07", TSDataType.STRING, TSEncoding.PLAIN); - // device 1, aligned, sg 0 - private static final String DEVICE_1 = "root.sg.test_0.a_1"; + // device 1, aligned, db 0 + private static final String DEVICE_1 = "root.db.test_0.a_1"; private static final MeasurementSchema MEASUREMENT_10 = new MeasurementSchema("sensor_10", TSDataType.INT32, TSEncoding.RLE); private static final MeasurementSchema MEASUREMENT_11 = @@ -1067,18 +1067,18 @@ private static class SchemaConfig { private static final MeasurementSchema MEASUREMENT_17 = new MeasurementSchema("sensor_17", TSDataType.STRING, TSEncoding.PLAIN); - // device 2, non aligned, sg 1 - private static final String DEVICE_2 = "root.sg.test_1.d_2"; + // device 2, non aligned, db 1 + private static final String DEVICE_2 = "root.db.test_1.d_2"; private static final MeasurementSchema MEASUREMENT_20 = new MeasurementSchema("sensor_20", TSDataType.INT32, TSEncoding.RLE); - // device 3, non aligned, sg 1 - private static final String DEVICE_3 = "root.sg.test_1.d_3"; + // device 3, non aligned, db 1 + private static final String DEVICE_3 = "root.db.test_1.d_3"; private static final MeasurementSchema MEASUREMENT_30 = new MeasurementSchema("sensor_30", TSDataType.INT32, TSEncoding.RLE); - // device 4, aligned, sg 1 - private static final String DEVICE_4 = "root.sg.test_1.a_4"; + // device 4, aligned, db 1 + private static final String DEVICE_4 = "root.db.test_1.a_4"; private static final MeasurementSchema MEASUREMENT_40 = new MeasurementSchema("sensor_40", TSDataType.INT32, TSEncoding.RLE); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBPartialInsertionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBPartialInsertionIT.java index 18f805d1354fd..c608e08b8e71d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBPartialInsertionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBPartialInsertionIT.java @@ -75,13 +75,13 @@ public void testPartialInsertionAllFailed() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); try { - statement.execute("INSERT INTO root.sg1(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1(timestamp, s0) VALUES (1, 1)"); fail(); } catch (SQLException e) { - assertTrue(e.getMessage().contains("Path [root.sg1.s0] does not exist")); + assertTrue(e.getMessage().contains("Path [root.db1.s0] does not exist")); } } } @@ -91,12 +91,12 @@ public void testPartialInsertionRestart() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 datatype=text"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 datatype=double"); + statement.execute("CREATE DATABASE root.db"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 datatype=text"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 datatype=double"); try { - statement.execute("INSERT INTO root.sg.d1(time,s1,s2) VALUES(100,'test','test')"); + statement.execute("INSERT INTO root.db.d1(time,s1,s2) VALUES(100,'test','test')"); } catch (SQLException e) { // ignore } @@ -124,16 +124,16 @@ public void testPartialInsertionRestart() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db.d1")) { assertNotNull(resultSet); int cnt = 0; while (resultSet.next()) { cnt++; - assertEquals("test", resultSet.getString("root.sg.d1.s1")); + assertEquals("test", resultSet.getString("root.db.d1.s1")); } assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("SELECT s2 FROM root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s2 FROM root.db.d1")) { assertNotNull(resultSet); assertFalse(resultSet.next()); } @@ -144,14 +144,14 @@ public void testPartialInsertionRestart() throws SQLException { public void testPartialInsertTablet() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { session.createTimeseries( - "root.sg1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.d1.s2", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.d1.s2", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s3", TSDataType.INT64)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList, 300); + Tablet tablet = new Tablet("root.db1.d1", schemaList, 300); long timestamp = 0; for (long row = 0; row < 100; row++) { int rowIndex = tablet.getRowSize(); @@ -179,11 +179,11 @@ public void testPartialInsertTablet() { fail(e.getMessage()); } } - try (SessionDataSet dataSet = session.executeQueryStatement("SELECT * FROM root.sg1.d1")) { + try (SessionDataSet dataSet = session.executeQueryStatement("SELECT * FROM root.db1.d1")) { assertEquals(dataSet.getColumnNames().size(), 3); assertEquals(dataSet.getColumnNames().get(0), "Time"); - assertEquals(dataSet.getColumnNames().get(1), "root.sg1.d1.s1"); - assertEquals(dataSet.getColumnNames().get(2), "root.sg1.d1.s2"); + assertEquals(dataSet.getColumnNames().get(1), "root.db1.d1.s1"); + assertEquals(dataSet.getColumnNames().get(2), "root.db1.d1.s2"); int cnt = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBQueryWithRecreatedTimeseriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBQueryWithRecreatedTimeseriesIT.java index 5472fabec5e10..d6126135dcb76 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBQueryWithRecreatedTimeseriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBQueryWithRecreatedTimeseriesIT.java @@ -53,23 +53,23 @@ public static void tearDown() throws Exception { public void testQueryDiffTypeTimeseries() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); + statement.execute("CREATE DATABASE root.db"); Thread.sleep(100); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES(11000, 10, 20)"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES(11000, 10, 20)"); Thread.sleep(100); statement.execute("FLUSH"); Thread.sleep(100); - statement.execute("DELETE TIMESERIES root.sg.d1.s1"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("DELETE TIMESERIES root.db.d1.s1"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=INT32,encoding=PLAIN"); try (ResultSet resultSet = - statement.executeQuery("SELECT s1 FROM root.sg.d1 WHERE s1 > 10")) { + statement.executeQuery("SELECT s1 FROM root.db.d1 WHERE s1 > 10")) { Assert.assertFalse(resultSet.next()); } try (ResultSet resultSet = - statement.executeQuery("SELECT s1 FROM root.sg.d1 WHERE s1 <= 10")) { + statement.executeQuery("SELECT s1 FROM root.db.d1 WHERE s1 <= 10")) { Assert.assertFalse(resultSet.next()); } } catch (Exception e) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java index d84a2493cc25e..26f4e6057188f 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java @@ -272,7 +272,7 @@ public void rightInsertTablet(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/insertTablet"); String json = - "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.sg25\"}"; + "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.db25\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -338,7 +338,7 @@ public void errorInsertTablet() { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/insertTablet"); String json = - "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"isAligned\":false,\"deviceId\":\"root.sg25\"}"; + "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"isAligned\":false,\"deviceId\":\"root.db25\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -452,37 +452,37 @@ public void insertAndQuery() { insertTablet_right_json_list.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":\"" + isAligned - + "\",\"deviceId\":\"root.sg21" + + "\",\"deviceId\":\"root.db21" + i + "\"}"); insertTablet_right_json_list.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"`s3`\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":\"" + isAligned - + "\",\"deviceId\":\"root.sg22" + + "\",\"deviceId\":\"root.db22" + i + "\"}"); insertTablet_right_json_list.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":\"" + isAligned - + "\",\"deviceId\":\"root.`sg23" + + "\",\"deviceId\":\"root.`db23" + i + "`\"}"); insertTablet_right_json_list.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"`s3`\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":\"" + isAligned - + "\",\"deviceId\":\"root.`sg24" + + "\",\"deviceId\":\"root.`db24" + i + "`\"}"); insertTablet_error_json_list.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"isAligned\":" + isAligned - + ",\"deviceId\":\"root.sg25" + + ",\"deviceId\":\"root.db25" + i + "\"}"); insertTablet_error_json_list.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"`s3`\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"isAligned\":" + isAligned - + ",\"deviceId\":\"root.sg36" + + ",\"deviceId\":\"root.db36" + i + "\"}"); insertTablet_error_json_list.add( @@ -546,43 +546,43 @@ public void insertAndQuery() { insertTablet_right_json_list_v2.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"data_types\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"is_aligned\":\"" + isAligned - + "\",\"device\":\"root.sg21" + + "\",\"device\":\"root.db21" + i + "\"}"); insertTablet_right_json_list_v2.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"`s3`\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"data_types\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"is_aligned\":" + isAligned - + ",\"device\":\"root.sg22" + + ",\"device\":\"root.db22" + i + "\"}"); insertTablet_right_json_list_v2.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"data_types\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"is_aligned\":" + isAligned - + ",\"device\":\"root.`sg23" + + ",\"device\":\"root.`db23" + i + "`\"}"); insertTablet_right_json_list_v2.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"`s3`\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"data_types\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"is_aligned\":" + isAligned - + ",\"device\":\"root.`sg24" + + ",\"device\":\"root.`db24" + i + "`\"}"); insertTablet_error_json_list_v2.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"data_types\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"is_aligned\":" + isAligned - + ",\"device\":\"root.sg25" + + ",\"device\":\"root.db25" + i + "\"}"); insertTablet_error_json_list_v2.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"`s3`\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"data_types\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"is_aligned\":" + isAligned - + ",\"device\":\"root.sg26" + + ",\"device\":\"root.db26" + i + "\"}"); insertTablet_error_json_list_v2.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"cc123123\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"data_types\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"is_aligned\":" + isAligned - + ",\"device\":\"root.`sg26" + + ",\"device\":\"root.`db26" + i + "`\"}"); insertTablet_error_json_list_v2.add( @@ -734,7 +734,7 @@ public void queryWithUnsetAuthorization() { HttpPost httpPost = new HttpPost("http://127.0.0.1:" + port + "/rest/v1/query"); httpPost.addHeader("Content-type", "application/json; charset=utf-8"); httpPost.setHeader("Accept", "application/json"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -781,7 +781,7 @@ public void queryWithWrongAuthorization() { httpPost.setHeader("Accept", "application/json"); String authorization = getAuthorization("abc", "def"); httpPost.setHeader("Authorization", authorization); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -822,7 +822,7 @@ public void query(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -836,14 +836,14 @@ public void query(CloseableHttpClient httpClient) { List expressions = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); - add("root.sg25.s4 + 1"); - add("root.sg25.s4 + 1"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); + add("root.db25.s4 + 1"); + add("root.db25.s4 + 1"); } }; List timestamps = @@ -925,7 +925,7 @@ public void queryGroupByLevel(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/query"); String sql = - "{\"sql\":\"select count(s4) from root.sg25 group by([1635232143960,1635232153960),1s),level=1\"}"; + "{\"sql\":\"select count(s4) from root.db25 group by([1635232143960,1635232153960),1s),level=1\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -938,7 +938,7 @@ public void queryGroupByLevel(CloseableHttpClient httpClient) { Assert.assertTrue(map.size() > 0); Assert.assertTrue(timestampsResult.size() == 10); Assert.assertTrue(valuesResult.size() == 1); - Assert.assertTrue("count(root.sg25.s4)".equals(expressionsResult.get(0))); + Assert.assertTrue("count(root.db25.s4)".equals(expressionsResult.get(0))); } catch (IOException e) { e.printStackTrace(); fail(e.getMessage()); @@ -958,7 +958,7 @@ public void queryRowLimit(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\",\"rowLimit\":1}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\",\"rowLimit\":1}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -1008,7 +1008,7 @@ public Map queryMetaData(CloseableHttpClient httpClient, String sql) { } public void queryShowChildPaths(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show child paths root.sg25\"}"; + String sql = "{\"sql\":\"show child paths root.db25\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1023,12 +1023,12 @@ public void queryShowChildPaths(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); } }; @@ -1037,7 +1037,7 @@ public void queryShowChildPaths(CloseableHttpClient httpClient) { } public void queryShowNodes(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show child nodes root.sg25\"}"; + String sql = "{\"sql\":\"show child nodes root.db25\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1095,7 +1095,7 @@ public void showAllTTL(CloseableHttpClient httpClient) { } public void showDatabase(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"SHOW DATABASES root.sg25\"}"; + String sql = "{\"sql\":\"SHOW DATABASES root.db25\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1113,7 +1113,7 @@ public void showDatabase(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; Assert.assertEquals(columnNames, columnNamesResult); @@ -1130,7 +1130,7 @@ public void showFunctions(CloseableHttpClient httpClient) { } public void showTimeseries(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show timeseries root.sg25.**\"}"; + String sql = "{\"sql\":\"show timeseries root.db25.**\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1154,12 +1154,12 @@ public void showTimeseries(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); } }; List values2 = @@ -1176,12 +1176,12 @@ public void showTimeseries(CloseableHttpClient httpClient) { List values3 = new ArrayList() { { - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); } }; @@ -1192,7 +1192,7 @@ public void showTimeseries(CloseableHttpClient httpClient) { } public void showLastTimeseries(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"SHOW LATEST TIMESERIES root.sg25.**\"}"; + String sql = "{\"sql\":\"SHOW LATEST TIMESERIES root.db25.**\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1216,12 +1216,12 @@ public void showLastTimeseries(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s7"); - add("root.sg25.s8"); - add("root.sg25.s6"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s7"); + add("root.db25.s8"); + add("root.db25.s6"); } }; List values2 = @@ -1238,12 +1238,12 @@ public void showLastTimeseries(CloseableHttpClient httpClient) { List values3 = new ArrayList() { { - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); } }; @@ -1254,7 +1254,7 @@ public void showLastTimeseries(CloseableHttpClient httpClient) { } public void countTimeseries(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"COUNT TIMESERIES root.sg25.** GROUP BY LEVEL=1\"}"; + String sql = "{\"sql\":\"COUNT TIMESERIES root.db25.** GROUP BY LEVEL=1\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1269,7 +1269,7 @@ public void countTimeseries(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = @@ -1285,7 +1285,7 @@ public void countTimeseries(CloseableHttpClient httpClient) { } public void countNodes(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"count nodes root.sg25.** level=2\"}"; + String sql = "{\"sql\":\"count nodes root.db25.** level=2\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1307,7 +1307,7 @@ public void countNodes(CloseableHttpClient httpClient) { } public void showDevices(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show devices root.sg25\"}"; + String sql = "{\"sql\":\"show devices root.db25\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1324,7 +1324,7 @@ public void showDevices(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = @@ -1362,13 +1362,13 @@ public void showDevicesWithStroage(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values3 = @@ -1414,7 +1414,7 @@ public void listUser(CloseableHttpClient httpClient) { } public void selectCount(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"select count(s3) from root.sg25 group by level = 1\"}"; + String sql = "{\"sql\":\"select count(s3) from root.db25 group by level = 1\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("expressions"); List> valuesResult = (List>) map.get("values"); @@ -1422,7 +1422,7 @@ public void selectCount(CloseableHttpClient httpClient) { List columnNames = new ArrayList() { { - add("count(root.sg25.s3)"); + add("count(root.db25.s3)"); } }; List values1 = @@ -1436,7 +1436,7 @@ public void selectCount(CloseableHttpClient httpClient) { } public void selectLast(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"select last s4 from root.sg25\"}"; + String sql = "{\"sql\":\"select last s4 from root.db25\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("expressions"); List> valuesResult = (List>) map.get("values"); @@ -1459,7 +1459,7 @@ public void selectLast(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s4"); + add("root.db25.s4"); } }; List values2 = @@ -1485,7 +1485,7 @@ public void queryV2(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v2/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -1499,14 +1499,14 @@ public void queryV2(CloseableHttpClient httpClient) { List expressions = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); - add("root.sg25.s4 + 1"); - add("root.sg25.s4 + 1"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); + add("root.db25.s4 + 1"); + add("root.db25.s4 + 1"); } }; List timestamps = @@ -1588,7 +1588,7 @@ public void queryGroupByLevelV2(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v2/query"); String sql = - "{\"sql\":\"select count(s4) from root.sg25 group by([1635232143960,1635232153960),1s),level=1\"}"; + "{\"sql\":\"select count(s4) from root.db25 group by([1635232143960,1635232153960),1s),level=1\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -1601,7 +1601,7 @@ public void queryGroupByLevelV2(CloseableHttpClient httpClient) { Assert.assertTrue(map.size() > 0); Assert.assertTrue(timestampsResult.size() == 10); Assert.assertTrue(valuesResult.size() == 1); - Assert.assertTrue("count(root.sg25.s4)".equals(expressionsResult.get(0))); + Assert.assertTrue("count(root.db25.s4)".equals(expressionsResult.get(0))); } catch (IOException e) { e.printStackTrace(); fail(e.getMessage()); @@ -1621,7 +1621,7 @@ public void queryRowLimitV2(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v2/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\",\"row_limit\":1}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\",\"row_limit\":1}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -1671,7 +1671,7 @@ public Map queryMetaDataV2(CloseableHttpClient httpClient, String sql) { } public void queryShowChildPathsV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show child paths root.sg25\"}"; + String sql = "{\"sql\":\"show child paths root.db25\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1686,12 +1686,12 @@ public void queryShowChildPathsV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); } }; @@ -1700,7 +1700,7 @@ public void queryShowChildPathsV2(CloseableHttpClient httpClient) { } public void queryShowNodesV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show child nodes root.sg25\"}"; + String sql = "{\"sql\":\"show child nodes root.db25\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1758,7 +1758,7 @@ public void showAllTTLV2(CloseableHttpClient httpClient) { } public void showDatabaseV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"SHOW DATABASES root.sg25\"}"; + String sql = "{\"sql\":\"SHOW DATABASES root.db25\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1776,7 +1776,7 @@ public void showDatabaseV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; Assert.assertEquals(columnNames, columnNamesResult); @@ -1817,12 +1817,12 @@ public void showTimeseriesV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); } }; List values2 = @@ -1839,12 +1839,12 @@ public void showTimeseriesV2(CloseableHttpClient httpClient) { List values3 = new ArrayList() { { - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); } }; @@ -1855,7 +1855,7 @@ public void showTimeseriesV2(CloseableHttpClient httpClient) { } public void showLastTimeseriesV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"SHOW LATEST TIMESERIES root.sg25.**\"}"; + String sql = "{\"sql\":\"SHOW LATEST TIMESERIES root.db25.**\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1879,12 +1879,12 @@ public void showLastTimeseriesV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s7"); - add("root.sg25.s8"); - add("root.sg25.s6"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s7"); + add("root.db25.s8"); + add("root.db25.s6"); } }; List values2 = @@ -1901,12 +1901,12 @@ public void showLastTimeseriesV2(CloseableHttpClient httpClient) { List values3 = new ArrayList() { { - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); } }; @@ -1917,7 +1917,7 @@ public void showLastTimeseriesV2(CloseableHttpClient httpClient) { } public void countTimeseriesV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"COUNT TIMESERIES root.sg25.** GROUP BY LEVEL=1\"}"; + String sql = "{\"sql\":\"COUNT TIMESERIES root.db25.** GROUP BY LEVEL=1\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1932,7 +1932,7 @@ public void countTimeseriesV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = @@ -1948,7 +1948,7 @@ public void countTimeseriesV2(CloseableHttpClient httpClient) { } public void countNodesV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"count nodes root.sg25.** level=2\"}"; + String sql = "{\"sql\":\"count nodes root.db25.** level=2\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1970,7 +1970,7 @@ public void countNodesV2(CloseableHttpClient httpClient) { } public void showDevicesV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show devices root.sg25\"}"; + String sql = "{\"sql\":\"show devices root.db25\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1987,7 +1987,7 @@ public void showDevicesV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = @@ -2026,13 +2026,13 @@ public void showDevicesWithStroageV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values3 = @@ -2078,7 +2078,7 @@ public void listUserV2(CloseableHttpClient httpClient) { } public void selectCountV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"select count(s3) from root.sg25 group by level = 1\"}"; + String sql = "{\"sql\":\"select count(s3) from root.db25 group by level = 1\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("expressions"); List> valuesResult = (List>) map.get("values"); @@ -2086,7 +2086,7 @@ public void selectCountV2(CloseableHttpClient httpClient) { List columnNames = new ArrayList() { { - add("count(root.sg25.s3)"); + add("count(root.db25.s3)"); } }; List values1 = @@ -2100,7 +2100,7 @@ public void selectCountV2(CloseableHttpClient httpClient) { } public void selectLastV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"select last s4 from root.sg25\"}"; + String sql = "{\"sql\":\"select last s4 from root.db25\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("expressions"); List> valuesResult = (List>) map.get("values"); @@ -2123,7 +2123,7 @@ public void selectLastV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s4"); + add("root.db25.s4"); } }; List values2 = @@ -2151,15 +2151,15 @@ public void insertDate() { HttpPost httpPostV2 = getHttpPost("http://127.0.0.1:" + port + "/rest/v2/nonQuery"); nonQuery( httpClient, - "{\"sql\":\"CREATE TIMESERIES root.sg1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY\"}", + "{\"sql\":\"CREATE TIMESERIES root.db1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY\"}", httpPost2); nonQuery( httpClient, - "{\"sql\":\"CREATE TIMESERIES root.sg1.d1.s5 WITH DATATYPE=Blob, ENCODING=PLAIN, COMPRESSOR=SNAPPY\"}", + "{\"sql\":\"CREATE TIMESERIES root.db1.d1.s5 WITH DATATYPE=Blob, ENCODING=PLAIN, COMPRESSOR=SNAPPY\"}", httpPost2); String sql = - "{\"sql\":\"insert into root.sg1.d1(time,s4,s5) values(1,'2025-07-14',\\\"X'cafebabe'\\\")\"}"; + "{\"sql\":\"insert into root.db1.d1(time,s4,s5) values(1,'2025-07-14',\\\"X'cafebabe'\\\")\"}"; nonQuery(httpClient, sql, httpPost2); queryDateAndBlob(httpClient); queryDateAndBlobV2(httpClient); @@ -2169,7 +2169,7 @@ public void queryDateAndBlob(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/query"); - String sql = "{\"sql\":\"select s4,s5 from root.sg1.d1\"}"; + String sql = "{\"sql\":\"select s4,s5 from root.db1.d1\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -2183,8 +2183,8 @@ public void queryDateAndBlob(CloseableHttpClient httpClient) { List expressions = new ArrayList() { { - add("root.sg1.d1.s4"); - add("root.sg1.d1.s5"); + add("root.db1.d1.s4"); + add("root.db1.d1.s5"); } }; List timestamps = @@ -2230,7 +2230,7 @@ public void queryDateAndBlobV2(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v2/query"); - String sql = "{\"sql\":\"select s4,s5 from root.sg1.d1\"}"; + String sql = "{\"sql\":\"select s4,s5 from root.db1.d1\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -2244,8 +2244,8 @@ public void queryDateAndBlobV2(CloseableHttpClient httpClient) { List expressions = new ArrayList() { { - add("root.sg1.d1.s4"); - add("root.sg1.d1.s5"); + add("root.db1.d1.s4"); + add("root.db1.d1.s5"); } }; List timestamps = diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java index 571826307c667..e5d5d3cdea9e0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java @@ -383,8 +383,8 @@ public void testRecoverFromFlushMemTableError() throws Exception { public void testInsertLoadAndRecover() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("create timeseries root.sg.d1.s1 with datatype=int32"); - statement.execute("insert into root.sg.d1(time,s1) values(2,2)"); + statement.execute("create timeseries root.db.d1.s1 with datatype=int32"); + statement.execute("insert into root.db.d1(time,s1) values(2,2)"); statement.execute("flush"); } File tmpDir = new File(Files.createTempDirectory("load").toUri()); @@ -392,14 +392,14 @@ public void testInsertLoadAndRecover() throws Exception { try { try (final TsFileGenerator generator = new TsFileGenerator(tsfile)) { generator.registerTimeseries( - "root.sg.d1", Collections.singletonList(new MeasurementSchema("s1", TSDataType.INT32))); - generator.generateData("root.sg.d1", 1, 2, false); + "root.db.d1", Collections.singletonList(new MeasurementSchema("s1", TSDataType.INT32))); + generator.generateData("root.db.d1", 1, 2, false); } try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time,s1) values(1,1)"); + statement.execute("insert into root.db.d1(time,s1) values(1,1)"); statement.execute(String.format("load \"%s\" ", tsfile.getAbsolutePath())); - try (ResultSet resultSet = statement.executeQuery("select s1 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from root.db.d1")) { assertNotNull(resultSet); int cnt = 0; while (resultSet.next()) { @@ -415,7 +415,7 @@ public void testInsertLoadAndRecover() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select s1 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from root.db.d1")) { assertNotNull(resultSet); int cnt = 0; while (resultSet.next()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java index 96ee0bc30c1c3..b9706dc746b5e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java @@ -165,7 +165,7 @@ public void testSetDefaultSGLevel() throws SQLException { statement.execute("INSERT INTO root.fail(timestamp, s1) VALUES (1, 1)"); } catch (SQLException e) { assertEquals( - "509: An error occurred when executing getDeviceToDatabase():root.fail is not a legal path, because it is no longer than default sg level: 3", + "509: An error occurred when executing getDeviceToDatabase():root.fail is not a legal path, because it is no longer than default db level: 3", e.getMessage()); } @@ -204,7 +204,7 @@ public void testSetDefaultSGLevel() throws SQLException { statement.execute("CREATE TIMESERIES root.db1.s3 WITH datatype=INT32"); } catch (SQLException e) { assertEquals( - "509: An error occurred when executing getDeviceToDatabase():root.db1 is not a legal path, because it is no longer than default sg level: 3", + "509: An error occurred when executing getDeviceToDatabase():root.db1 is not a legal path, because it is no longer than default db level: 3", e.getMessage()); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java index c56c0077f29e2..3d57a5ee06b78 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java @@ -72,10 +72,10 @@ public void testCreateTimeseries1() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.d0.s1")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db1.d0.s1")) { if (resultSet.next()) { assertEquals("PLAIN", resultSet.getString(ColumnHeaderConstant.ENCODING).toUpperCase()); } @@ -91,20 +91,20 @@ public void testFailedToCreateTimeseriesSDTProperties() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); try { statement.execute( - "CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,'LOSS'='SDT','COMPDEV'='-2'"); + "CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,'LOSS'='SDT','COMPDEV'='-2'"); fail(); } catch (Exception e) { assertEquals( TSStatusCode.ILLEGAL_PARAMETER.getStatusCode() - + ": SDT compression deviation cannot be negative. Failed to create timeseries for path root.sg1.d0.s1", + + ": SDT compression deviation cannot be negative. Failed to create timeseries for path root.db1.d0.s1", e.getMessage()); } int count = 0; - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db1.**")) { while (resultSet.next()) { count++; } @@ -159,21 +159,21 @@ public void testSDTEncodingSeq() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); int degree = 0; for (int time = 0; time < 100; time++) { // generate data in sine wave pattern double value = 10 * Math.sin(degree++ * 3.141592653589793D / 180.0D); - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + "," + value + ")"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + "," + value + ")"; statement.execute(sql); } // before SDT encoding - ResultSet resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + ResultSet resultSet = statement.executeQuery("select s0 from root.db1.d0"); int count = 0; while (resultSet.next()) { count++; @@ -182,7 +182,7 @@ public void testSDTEncodingSeq() { // after flush and SDT encoding statement.execute("flush"); - resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + resultSet = statement.executeQuery("select s0 from root.db1.d0"); count = 0; while (resultSet.next()) { count++; @@ -200,28 +200,28 @@ public void testSDTEncodingCompDev() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2"); for (int time = 1; time < 8; time++) { - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + ",1)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + ",1)"; statement.execute(sql); } statement.execute("flush"); - String sql = "insert into root.sg1.d0(timestamp,s0) values(15,10)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(15,10)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(16,20)"; + sql = "insert into root.db1.d0(timestamp,s0) values(16,20)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(17,1)"; + sql = "insert into root.db1.d0(timestamp,s0) values(17,1)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(18,30)"; + sql = "insert into root.db1.d0(timestamp,s0) values(18,30)"; statement.execute(sql); statement.execute("flush"); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.**"); + ResultSet resultSet = statement.executeQuery("select * from root.db1.**"); int count = 0; String[] timestamps = {"1", "7", "15", "16", "17", "18"}; @@ -229,7 +229,7 @@ public void testSDTEncodingCompDev() { while (resultSet.next()) { assertEquals(timestamps[count], resultSet.getString("Time")); - assertEquals(values[count], resultSet.getString("root.sg1.d0.s0")); + assertEquals(values[count], resultSet.getString("root.db1.d0.s0")); count++; } } catch (SQLException e) { @@ -243,28 +243,28 @@ public void testSDTEncodingCompMin() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMINTIME=1"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMINTIME=1"); for (int time = 1; time < 8; time++) { - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + ",1)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + ",1)"; statement.execute(sql); } statement.execute("flush"); - String sql = "insert into root.sg1.d0(timestamp,s0) values(15,10)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(15,10)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(16,20)"; + sql = "insert into root.db1.d0(timestamp,s0) values(16,20)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(17,1)"; + sql = "insert into root.db1.d0(timestamp,s0) values(17,1)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(18,30)"; + sql = "insert into root.db1.d0(timestamp,s0) values(18,30)"; statement.execute(sql); statement.execute("flush"); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.**"); + ResultSet resultSet = statement.executeQuery("select * from root.db1.**"); int count = 0; // will not store time = 16 since time distance to last stored time 15 is within compMinTime @@ -273,7 +273,7 @@ public void testSDTEncodingCompMin() { while (resultSet.next()) { assertEquals(timestamps[count], resultSet.getString("Time")); - assertEquals(values[count], resultSet.getString("root.sg1.d0.s0")); + assertEquals(values[count], resultSet.getString("root.db1.d0.s0")); count++; } } catch (SQLException e) { @@ -287,18 +287,18 @@ public void testSDTEncodingCompMax() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMAXTIME=20"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMAXTIME=20"); for (int time = 1; time < 50; time++) { - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + ",1)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + ",1)"; statement.execute(sql); } statement.execute("flush"); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.**"); + ResultSet resultSet = statement.executeQuery("select * from root.db1.**"); int count = 0; String[] timestamps = {"1", "21", "41", "49"}; @@ -306,7 +306,7 @@ public void testSDTEncodingCompMax() { while (resultSet.next()) { assertEquals(timestamps[count], resultSet.getString("Time")); - assertEquals(values[count], resultSet.getString("root.sg1.d0.s0")); + assertEquals(values[count], resultSet.getString("root.db1.d0.s0")); count++; } } catch (SQLException e) { @@ -320,25 +320,25 @@ public void testSDTEncodingUnseq() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); int degree = 0; for (int time = 0; time < 100; time++) { // generate data in sine wave pattern double value = 10 * Math.sin(degree++ * 3.141592653589793D / 180.0D); - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + "," + value + ")"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + "," + value + ")"; statement.execute(sql); } // insert unseq - String sql = "insert into root.sg1.d0(timestamp,s0) values(2,19)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(2,19)"; statement.execute(sql); // before SDT encoding - ResultSet resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + ResultSet resultSet = statement.executeQuery("select s0 from root.db1.d0"); int count = 0; while (resultSet.next()) { count++; @@ -347,7 +347,7 @@ public void testSDTEncodingUnseq() { // after flush and SDT encoding statement.execute("flush"); - resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + resultSet = statement.executeQuery("select s0 from root.db1.d0"); count = 0; while (resultSet.next()) { count++; @@ -365,21 +365,21 @@ public void testSDTEncodingMergeSeq() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); int degree = 0; for (int time = 0; time < 100; time++) { // generate data in sine wave pattern double value = 10 * Math.sin(degree++ * 3.141592653589793D / 180.0D); - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + "," + value + ")"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + "," + value + ")"; statement.execute(sql); } // before SDT encoding - ResultSet resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + ResultSet resultSet = statement.executeQuery("select s0 from root.db1.d0"); int count = 0; while (resultSet.next()) { count++; @@ -388,7 +388,7 @@ public void testSDTEncodingMergeSeq() { // after flush and SDT encoding statement.execute("flush"); - resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + resultSet = statement.executeQuery("select s0 from root.db1.d0"); count = 0; while (resultSet.next()) { count++; @@ -405,25 +405,25 @@ public void testSDTEncodingMergeUnseq() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); int degree = 0; for (int time = 0; time < 100; time++) { // generate data in sine wave pattern double value = 10 * Math.sin(degree++ * 3.141592653589793D / 180.0D); - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + "," + value + ")"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + "," + value + ")"; statement.execute(sql); } // insert unseq - String sql = "insert into root.sg1.d0(timestamp,s0) values(2,19)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(2,19)"; statement.execute(sql); // before SDT encoding - ResultSet resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + ResultSet resultSet = statement.executeQuery("select s0 from root.db1.d0"); int count = 0; while (resultSet.next()) { count++; @@ -432,7 +432,7 @@ public void testSDTEncodingMergeUnseq() { // after flush and SDT encoding statement.execute("flush"); - resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + resultSet = statement.executeQuery("select s0 from root.db1.d0"); count = 0; while (resultSet.next()) { count++; @@ -449,7 +449,7 @@ public void testEmptyDataSet() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - ResultSet resultSet = statement.executeQuery("select * from root.sg1.**"); + ResultSet resultSet = statement.executeQuery("select * from root.db1.**"); // has an empty time column Assert.assertEquals(1, resultSet.getMetaData().getColumnCount()); try { @@ -473,7 +473,7 @@ public void testEmptyDataSet() throws SQLException { fail(); } - resultSet = statement.executeQuery("select * from root.sg1.** align by device"); + resultSet = statement.executeQuery("select * from root.db1.** align by device"); // has time and device columns Assert.assertEquals(1, resultSet.getMetaData().getColumnCount()); while (resultSet.next()) { @@ -509,15 +509,15 @@ public void testOrderByTimeDesc() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (2, 2)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (3, 3)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (4, 4)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (3, 3)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (1, 1)"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (2, 2)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (3, 3)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (4, 4)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (3, 3)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (1, 1)"); statement.execute("flush"); String[] ret = @@ -527,14 +527,14 @@ public void testOrderByTimeDesc() throws Exception { int cur = 0; try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.** order by time desc")) { + statement.executeQuery("select * from root.db1.** order by time desc")) { while (resultSet.next()) { String ans = resultSet.getString(ColumnHeaderConstant.TIME) + "," - + resultSet.getString("root.sg1.d0.s0") + + resultSet.getString("root.db1.d0.s0") + "," - + resultSet.getString("root.sg1.d0.s1"); + + resultSet.getString("root.db1.d0.s1"); assertEquals(ret[cur], ans); cur++; } @@ -547,22 +547,22 @@ public void testShowTimeseriesDataSet1() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); int count = 0; - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db1.**")) { while (resultSet.next()) { count++; } @@ -580,22 +580,22 @@ public void testShowTimeseriesDataSet2() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(10); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); int count = 0; - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db1.**")) { while (resultSet.next()) { count++; } @@ -613,22 +613,22 @@ public void testShowTimeseriesDataSet3() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(15); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); int count = 0; - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db1.**")) { while (resultSet.next()) { count++; } @@ -646,17 +646,17 @@ public void testShowTimeseriesDataSet4() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); @@ -680,12 +680,12 @@ public void testShowTimeseriesWithLimitOffset() throws SQLException { Statement statement = connection.createStatement()) { List exps = - Arrays.asList("root.sg1.d0.s1", "root.sg1.d0.s2", "root.sg1.d0.s3", "root.sg1.d0.s4"); + Arrays.asList("root.db1.d0.s1", "root.db1.d0.s2", "root.db1.d0.s3", "root.db1.d0.s4"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s2) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s3) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s4) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s2) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s3) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s4) VALUES (5, 5)"); int count = 0; try (ResultSet resultSet = statement.executeQuery("show timeseries limit 2 offset 1")) { @@ -703,12 +703,12 @@ public void testShowDevicesWithLimitOffset() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - List exps = Arrays.asList("root.sg1.d1,false", "root.sg1.d2,false"); + List exps = Arrays.asList("root.db1.d1,false", "root.db1.d2,false"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d1(timestamp, s2) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d2(timestamp, s3) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d3(timestamp, s4) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d1(timestamp, s2) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d2(timestamp, s3) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d3(timestamp, s4) VALUES (5, 5)"); int count = 0; try (ResultSet resultSet = statement.executeQuery("show devices limit 2 offset 1")) { @@ -727,12 +727,12 @@ public void testShowDevicesWithLimit() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - List exps = Arrays.asList("root.sg1.d0,false", "root.sg1.d1,false"); + List exps = Arrays.asList("root.db1.d0,false", "root.db1.d1,false"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d1(timestamp, s2) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d2(timestamp, s3) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d3(timestamp, s4) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d1(timestamp, s2) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d2(timestamp, s3) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d3(timestamp, s4) VALUES (5, 5)"); int count = 0; try (ResultSet resultSet = statement.executeQuery("show devices limit 2")) { @@ -750,30 +750,30 @@ public void testShowDevicesWithLimit() throws SQLException { public void testFirstOverlappedPageFiltered() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); // seq chunk : [1,10] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (10, 10)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (10, 10)"); statement.execute("flush"); // seq chunk : [13,20] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (13, 13)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (20, 20)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (13, 13)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (20, 20)"); statement.execute("flush"); // unseq chunk : [5,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 15)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 15)"); statement.execute("flush"); long count = 0; try (ResultSet resultSet = - statement.executeQuery("select s0 from root.sg1.d0 where s0 > 18")) { + statement.executeQuery("select s0 from root.db1.d0 where s0 > 18")) { while (resultSet.next()) { count++; } @@ -787,21 +787,21 @@ public void testFirstOverlappedPageFiltered() throws SQLException { public void testPartialInsertion() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); try { - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0, s1) VALUES (1, 1, 2.2)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0, s1) VALUES (1, 1, 2.2)"); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("s1")); } - try (ResultSet resultSet = statement.executeQuery("select s0, s1 from root.sg1.d0")) { + try (ResultSet resultSet = statement.executeQuery("select s0, s1 from root.db1.d0")) { while (resultSet.next()) { - assertEquals(1, resultSet.getInt("root.sg1.d0.s0")); - assertEquals(null, resultSet.getString("root.sg1.d0.s1")); + assertEquals(1, resultSet.getInt("root.db1.d0.s0")); + assertEquals(null, resultSet.getString("root.db1.d0.s1")); } } } @@ -811,35 +811,35 @@ public void testPartialInsertion() throws SQLException { public void testOverlappedPagesMerge() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); // seq chunk : start-end [1000, 1000] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1000, 0)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1000, 0)"); statement.execute("flush"); // unseq chunk : [1,10] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (10, 10)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (10, 10)"); statement.execute("flush"); // usneq chunk : [5,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 15)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 15)"); statement.execute("flush"); // unseq chunk : [15,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 150)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 150)"); statement.execute("flush"); long count = 0; try (ResultSet resultSet = - statement.executeQuery("select s0 from root.sg1.d0 where s0 < 100")) { + statement.executeQuery("select s0 from root.db1.d0 where s0 < 100")) { while (resultSet.next()) { count++; } @@ -853,16 +853,16 @@ public void testOverlappedPagesMerge() throws SQLException { public void testUnseqUnsealedDeleteQuery() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); // seq data - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1000, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1000, 1)"); statement.execute("flush"); for (int i = 1; i <= 10; i++) { statement.execute( - String.format("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (%d, %d)", i, i)); + String.format("INSERT INTO root.db1.d0(timestamp, s0) VALUES (%d, %d)", i, i)); } statement.execute("flush"); @@ -870,14 +870,14 @@ public void testUnseqUnsealedDeleteQuery() throws SQLException { // unseq data for (int i = 11; i <= 20; i++) { statement.execute( - String.format("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (%d, %d)", i, i)); + String.format("INSERT INTO root.db1.d0(timestamp, s0) VALUES (%d, %d)", i, i)); } - statement.execute("delete from root.sg1.d0.s0 where time <= 15"); + statement.execute("delete from root.db1.d0.s0 where time <= 15"); long count = 0; - try (ResultSet resultSet = statement.executeQuery("select * from root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db1.**")) { while (resultSet.next()) { count++; } @@ -891,16 +891,16 @@ public void testUnseqUnsealedDeleteQuery() throws SQLException { public void testTimeseriesMetadataCache() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); for (int i = 0; i < 10000; i++) { statement.execute( - "CREATE TIMESERIES root.sg1.d0.s" + i + " WITH DATATYPE=INT32,ENCODING=PLAIN"); + "CREATE TIMESERIES root.db1.d0.s" + i + " WITH DATATYPE=INT32,ENCODING=PLAIN"); } for (int i = 1; i < 10000; i++) { - statement.execute("INSERT INTO root.sg1.d0(timestamp, s" + i + ") VALUES (1000, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s" + i + ") VALUES (1000, 1)"); } statement.execute("flush"); - statement.executeQuery("select s0 from root.sg1.d0"); + statement.executeQuery("select s0 from root.db1.d0"); } catch (SQLException e) { fail(); } @@ -910,10 +910,10 @@ public void testTimeseriesMetadataCache() { public void testInvalidSchema() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); try { statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 with datatype=BOOLEAN, encoding=TS_2DIFF"); + "CREATE TIMESERIES root.db1.d1.s1 with datatype=BOOLEAN, encoding=TS_2DIFF"); fail(); } catch (Exception e) { Assert.assertEquals( @@ -924,7 +924,7 @@ public void testInvalidSchema() { try { statement.execute( - "CREATE TIMESERIES root.sg1.d1.s3 with datatype=DOUBLE, encoding=REGULAR"); + "CREATE TIMESERIES root.db1.d1.s3 with datatype=DOUBLE, encoding=REGULAR"); fail(); } catch (Exception e) { Assert.assertEquals( @@ -934,7 +934,7 @@ public void testInvalidSchema() { } try { - statement.execute("CREATE TIMESERIES root.sg1.d1.s4 with datatype=TEXT, encoding=TS_2DIFF"); + statement.execute("CREATE TIMESERIES root.db1.d1.s4 with datatype=TEXT, encoding=TS_2DIFF"); fail(); } catch (Exception e) { Assert.assertEquals( @@ -952,29 +952,29 @@ public void testInvalidSchema() { public void testUseSameStatement() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); - statement.execute("insert into root.sg1.d0(timestamp,s0,s1) values(1,1,1)"); - statement.execute("insert into root.sg1.d1(timestamp,s0,s1) values(1000,1000,1000)"); - statement.execute("insert into root.sg1.d0(timestamp,s0,s1) values(10,10,10)"); + statement.execute("insert into root.db1.d0(timestamp,s0,s1) values(1,1,1)"); + statement.execute("insert into root.db1.d1(timestamp,s0,s1) values(1000,1000,1000)"); + statement.execute("insert into root.db1.d0(timestamp,s0,s1) values(10,10,10)"); List resultSetList = new ArrayList<>(); - ResultSet r1 = statement.executeQuery("select * from root.sg1.d0 where time <= 1"); + ResultSet r1 = statement.executeQuery("select * from root.db1.d0 where time <= 1"); resultSetList.add(r1); - ResultSet r2 = statement.executeQuery("select * from root.sg1.d1 where s0 == 1000"); + ResultSet r2 = statement.executeQuery("select * from root.db1.d1 where s0 == 1000"); resultSetList.add(r2); - ResultSet r3 = statement.executeQuery("select * from root.sg1.d0 where s1 == 10"); + ResultSet r3 = statement.executeQuery("select * from root.db1.d0 where s1 == 10"); resultSetList.add(r3); r1.next(); @@ -998,38 +998,38 @@ public void testUseSameStatement() throws SQLException { public void testInvalidMaxPointNumber() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 with datatype=FLOAT, encoding=TS_2DIFF, " + "CREATE TIMESERIES root.db1.d1.s1 with datatype=FLOAT, encoding=TS_2DIFF, " + "'max_point_number'='4'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s2 with datatype=FLOAT, encoding=TS_2DIFF, " + "CREATE TIMESERIES root.db1.d1.s2 with datatype=FLOAT, encoding=TS_2DIFF, " + "'max_point_number'='2.5'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s3 with datatype=FLOAT, encoding=RLE, " + "CREATE TIMESERIES root.db1.d1.s3 with datatype=FLOAT, encoding=RLE, " + "'max_point_number'='q'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 with datatype=FLOAT, encoding=RLE, " + "CREATE TIMESERIES root.db1.d1.s4 with datatype=FLOAT, encoding=RLE, " + "'max_point_number'='-1'"); statement.execute( - "insert into root.sg1.d1(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); + "insert into root.db1.d1(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); - try (ResultSet r1 = statement.executeQuery("select s1 from root.sg1.d1")) { + try (ResultSet r1 = statement.executeQuery("select s1 from root.db1.d1")) { r1.next(); Assert.assertEquals(1.1234f, r1.getFloat(2), 0); } - try (ResultSet r2 = statement.executeQuery("select s3 from root.sg1.d1")) { + try (ResultSet r2 = statement.executeQuery("select s3 from root.db1.d1")) { r2.next(); Assert.assertEquals(1.12f, r2.getFloat(2), 0); } - try (ResultSet r3 = statement.executeQuery("select s3 from root.sg1.d1")) { + try (ResultSet r3 = statement.executeQuery("select s3 from root.db1.d1")) { r3.next(); Assert.assertEquals(1.12f, r3.getFloat(2), 0); } - try (ResultSet r4 = statement.executeQuery("select s4 from root.sg1.d1")) { + try (ResultSet r4 = statement.executeQuery("select s4 from root.db1.d1")) { r4.next(); Assert.assertEquals(1.12f, r4.getFloat(2), 0); } @@ -1067,9 +1067,9 @@ public void testDatabaseWithHyphenInName() { public void testDisableAlign() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=BOOLEAN"); - ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg1.d1 disable align"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=BOOLEAN"); + ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db1.d1 disable align"); ResultSetMetaData metaData = resultSet.getMetaData(); int[] types = {Types.TIMESTAMP, Types.INTEGER, Types.BIGINT, Types.BOOLEAN}; int columnCount = metaData.getColumnCount(); @@ -1083,9 +1083,9 @@ public void testDisableAlign() throws Exception { public void testEnableAlign() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=BOOLEAN"); - ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg1.d1"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=BOOLEAN"); + ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db1.d1"); ResultSetMetaData metaData = resultSet.getMetaData(); int[] types = {Types.TIMESTAMP, Types.INTEGER, Types.BOOLEAN}; int columnCount = metaData.getColumnCount(); @@ -1099,25 +1099,25 @@ public void testEnableAlign() throws Exception { public void testFromFuzzyMatching() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 with datatype=FLOAT, encoding=TS_2DIFF, " + "CREATE TIMESERIES root.db1.d1.s1 with datatype=FLOAT, encoding=TS_2DIFF, " + "'max_point_number'='4'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s2 with datatype=FLOAT, encoding=TS_2DIFF, " + "CREATE TIMESERIES root.db1.d1.s2 with datatype=FLOAT, encoding=TS_2DIFF, " + "'max_point_number'='2.5'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s3 with datatype=FLOAT, encoding=RLE, " + "CREATE TIMESERIES root.db1.d1.s3 with datatype=FLOAT, encoding=RLE, " + "'max_point_number'='q'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 with datatype=FLOAT, encoding=RLE, " + "CREATE TIMESERIES root.db1.d1.s4 with datatype=FLOAT, encoding=RLE, " + "'max_point_number'='-1'"); statement.execute( - "insert into root.sg1.da1cb(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); + "insert into root.db1.da1cb(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); statement.execute( - "insert into root.sg1.da1ce(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); + "insert into root.db1.da1ce(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); - try (ResultSet r1 = statement.executeQuery("select s1 from root.sg1.*a*")) { + try (ResultSet r1 = statement.executeQuery("select s1 from root.db1.*a*")) { while (r1.next()) { Assert.assertEquals(1.1234f, r1.getDouble(2), 0.001); } @@ -1134,23 +1134,23 @@ public void testNewDataType() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); for (int i = 1; i <= 10; i++) { statement.execute( String.format( - "insert into root.sg1.d1(timestamp, s4, s5, s6, s7) values(%d, \"%s\", %d, %s, \"%s\")", + "insert into root.db1.d1(timestamp, s4, s5, s6, s7) values(%d, \"%s\", %d, %s, \"%s\")", i, LocalDate.of(2024, 5, i % 31 + 1), i, "X'cafebabe'", i)); } - try (ResultSet resultSet = statement.executeQuery("select * from root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db1.**")) { final ResultSetMetaData metaData = resultSet.getMetaData(); final int columnCount = metaData.getColumnCount(); assertEquals(5, columnCount); @@ -1192,13 +1192,13 @@ public void testIllegalDateType() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); try { - statement.execute("insert into root.sg1.d1(timestamp, s4) values(1, '2022-04-31')"); + statement.execute("insert into root.db1.d1(timestamp, s4) values(1, '2022-04-31')"); fail(); } catch (Exception e) { assertEquals( @@ -1210,7 +1210,7 @@ public void testIllegalDateType() { } try { statement.execute( - "insert into root.sg1.d1(timestamp, s5) values(1999-04-31T00:00:00.000+08:00, 1999-04-31T00:00:00.000+08:00)"); + "insert into root.db1.d1(timestamp, s5) values(1999-04-31T00:00:00.000+08:00, 1999-04-31T00:00:00.000+08:00)"); fail(); } catch (Exception e) { assertEquals( 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 c21e4e347c4db..43bdb28501ebf 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 @@ -71,15 +71,15 @@ public void testKeyWord() { }; String[] resultTimeseries = { - "root.sg1.d1.add", - "root.sg1.d1.as", - "root.sg1.d1.select", - "root.sg1.d1.drop_trigger", - "root.sg1.d1.REVOKE_USER_ROLE", - "root.sg1.d1.pipesink", - "root.sg1.d1.boolean", - "root.sg1.d1.datatype", - "root.sg1.d1.device", + "root.db1.d1.add", + "root.db1.d1.as", + "root.db1.d1.select", + "root.db1.d1.drop_trigger", + "root.db1.d1.REVOKE_USER_ROLE", + "root.db1.d1.pipesink", + "root.db1.d1.boolean", + "root.db1.d1.datatype", + "root.db1.d1.device", }; String[] selectNodeNames = { @@ -109,14 +109,14 @@ public void testKeyWord() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (String createNodeName : createNodeNames) { - String createSql = String.format("CREATE TIMESERIES root.sg1.d1.%s INT32", createNodeName); + String createSql = String.format("CREATE TIMESERIES root.db1.d1.%s INT32", createNodeName); String insertSql = - String.format("INSERT INTO root.sg1.d1(time, %s) VALUES(1, 1)", createNodeName); + String.format("INSERT INTO root.db1.d1(time, %s) VALUES(1, 1)", createNodeName); statement.execute(createSql); statement.execute(insertSql); } - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { Set expectedResult = new HashSet<>(Arrays.asList(resultTimeseries)); while (resultSet.next()) { @@ -129,10 +129,10 @@ public void testKeyWord() { for (int i = 0; i < selectNodeNames.length; i++) { String selectSql = - String.format("SELECT %s FROM root.sg1.d1 WHERE time = 1", selectNodeNames[i]); + String.format("SELECT %s FROM root.db1.d1 WHERE time = 1", selectNodeNames[i]); try (ResultSet resultSet = statement.executeQuery(selectSql)) { Assert.assertTrue(resultSet.next()); - Assert.assertEquals(1, resultSet.getInt("root.sg1.d1." + suffixInResultColumns[i])); + Assert.assertEquals(1, resultSet.getInt("root.db1.d1." + suffixInResultColumns[i])); } } @@ -175,33 +175,33 @@ public void testNodeName() { }; String[] resultTimeseries = { - "root.sg1.d1.a_1", - "root.sg1.d1.aaa", - "root.sg1.d1.in", - "root.sg1.d1.between", - "root.sg1.d1.is", - "root.sg1.d1.select", - "root.sg1.d1.`a.b`", - "root.sg1.d1.`111`", - "root.sg1.d1.`a``b`", - "root.sg1.d1.`a.\"b`", - "root.sg1.d1.`a.'b`", - "root.sg1.d1.````", - "root.sg1.d1.`c.d.```", - "root.sg1.d1.abc", - "root.sg1.d1.`+12`", - "root.sg1.d1.`1e3`", - "root.sg1.d1.`001`", - "root.sg1.d1.`-1.0`", - "root.sg1.d1.`01e-3`", - "root.sg1.d1.`+0001`", - "root.sg1.d1.`-0001`", - "root.sg1.d1.`++1`", - "root.sg1.d1.`+-1`", - "root.sg1.d1.`--1`", - "root.sg1.d1.123w", - "root.sg1.d1.123d", - "root.sg1.d1.123h" + "root.db1.d1.a_1", + "root.db1.d1.aaa", + "root.db1.d1.in", + "root.db1.d1.between", + "root.db1.d1.is", + "root.db1.d1.select", + "root.db1.d1.`a.b`", + "root.db1.d1.`111`", + "root.db1.d1.`a``b`", + "root.db1.d1.`a.\"b`", + "root.db1.d1.`a.'b`", + "root.db1.d1.````", + "root.db1.d1.`c.d.```", + "root.db1.d1.abc", + "root.db1.d1.`+12`", + "root.db1.d1.`1e3`", + "root.db1.d1.`001`", + "root.db1.d1.`-1.0`", + "root.db1.d1.`01e-3`", + "root.db1.d1.`+0001`", + "root.db1.d1.`-0001`", + "root.db1.d1.`++1`", + "root.db1.d1.`+-1`", + "root.db1.d1.`--1`", + "root.db1.d1.123w", + "root.db1.d1.123d", + "root.db1.d1.123h" }; String[] selectNodeNames = { @@ -267,14 +267,14 @@ public void testNodeName() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (String createNodeName : createNodeNames) { - String createSql = String.format("CREATE TIMESERIES root.sg1.d1.%s INT32", createNodeName); + String createSql = String.format("CREATE TIMESERIES root.db1.d1.%s INT32", createNodeName); String insertSql = - String.format("INSERT INTO root.sg1.d1(time, %s) VALUES(1, 1)", createNodeName); + String.format("INSERT INTO root.db1.d1(time, %s) VALUES(1, 1)", createNodeName); statement.execute(createSql); statement.execute(insertSql); } - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { Set expectedResult = new HashSet<>(Arrays.asList(resultTimeseries)); while (resultSet.next()) { @@ -287,10 +287,10 @@ public void testNodeName() { for (int i = 0; i < selectNodeNames.length; i++) { String selectSql = - String.format("SELECT %s FROM root.sg1.d1 WHERE time = 1", selectNodeNames[i]); + String.format("SELECT %s FROM root.db1.d1 WHERE time = 1", selectNodeNames[i]); try (ResultSet resultSet = statement.executeQuery(selectSql)) { Assert.assertTrue(resultSet.next()); - Assert.assertEquals(1, resultSet.getInt("root.sg1.d1." + suffixInResultColumns[i])); + Assert.assertEquals(1, resultSet.getInt("root.db1.d1." + suffixInResultColumns[i])); } } @@ -307,76 +307,76 @@ public void testNodeNameIllegal() { // nodeName with special characters should be quoted with '`' try { - statement.execute("create timeseries root.sg1.d1.`a INT32"); + statement.execute("create timeseries root.db1.d1.`a INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.[a INT32"); + statement.execute("create timeseries root.db1.d1.[a INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.a! INT32"); + statement.execute("create timeseries root.db1.d1.a! INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.a\" INT32"); + statement.execute("create timeseries root.db1.d1.a\" INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.a' INT32"); + statement.execute("create timeseries root.db1.d1.a' INT32"); fail(); } catch (Exception ignored) { } // nodeName consists of numbers should be quoted with '`' try { - statement.execute("create timeseries root.sg1.d1.111 INT32"); + statement.execute("create timeseries root.db1.d1.111 INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.012 INT32"); + statement.execute("create timeseries root.db1.d1.012 INT32"); fail(); } catch (Exception ignored) { } // shouled use double '`' in a quoted nodeName try { - statement.execute("create timeseries root.sg1.d1.`a`` INT32"); + statement.execute("create timeseries root.db1.d1.`a`` INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.``a` INT32"); + statement.execute("create timeseries root.db1.d1.``a` INT32"); fail(); } catch (Exception ignored) { } // reserved words can not be identifier try { - statement.execute("create timeseries root.sg1.d1.root INT32"); + statement.execute("create timeseries root.db1.d1.root INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.time INT32"); + statement.execute("create timeseries root.db1.d1.time INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.timestamp INT32"); + statement.execute("create timeseries root.db1.d1.timestamp INT32"); fail(); } catch (Exception ignored) { } @@ -393,7 +393,7 @@ public void testCreateIllegalDatabase() { Statement statement = connection.createStatement()) { try { - statement.execute("create database root.sg1.d1."); + statement.execute("create database root.db1.d1."); fail(); } catch (Exception ignored) { } @@ -408,20 +408,20 @@ public void testCreateIllegalDatabase() { public void testExpression() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.`1` INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.`a.b` INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.`a.``b` INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.text TEXT"); + statement.execute("CREATE TIMESERIES root.db1.d1.`1` INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.`a.b` INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.`a.``b` INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.text TEXT"); int pointCnt = 3; for (int i = 0; i < pointCnt; i++) { statement.execute( String.format( - "insert into root.sg1.d1(time,%s,%s,%s) values(%d,%d,%d,%d)", + "insert into root.db1.d1(time,%s,%s,%s) values(%d,%d,%d,%d)", "`1`", "`a.b`", "`a.``b`", i, i, i, i)); } int cnt = 0; - try (ResultSet resultSet = statement.executeQuery("SELECT `1` + 1 FROM root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT `1` + 1 FROM root.db1.d1")) { while (resultSet.next()) { cnt++; } @@ -430,7 +430,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.sg1.d1 where `1` > 1")) { + statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.db1.d1 where `1` > 1")) { while (resultSet.next()) { cnt++; } @@ -439,7 +439,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.sg1.d1")) { + statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.db1.d1")) { while (resultSet.next()) { cnt++; } @@ -448,7 +448,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.sg1.d1 where `1`>0")) { + statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.db1.d1 where `1`>0")) { while (resultSet.next()) { cnt++; } @@ -456,7 +456,7 @@ public void testExpression() { } cnt = 0; - try (ResultSet resultSet = statement.executeQuery("SELECT avg(`1`)+1 FROM root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT avg(`1`)+1 FROM root.db1.d1")) { while (resultSet.next()) { cnt++; } @@ -465,7 +465,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT count(`1`)+1 FROM root.sg1.d1 where `1`>1")) { + statement.executeQuery("SELECT count(`1`)+1 FROM root.db1.d1 where `1`>1")) { while (resultSet.next()) { Assert.assertEquals(2.0, resultSet.getDouble(1), 1e-7); cnt++; @@ -474,7 +474,7 @@ public void testExpression() { } cnt = 0; - try (ResultSet resultSet = statement.executeQuery("SELECT sin(`1`) + 1 FROM root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT sin(`1`) + 1 FROM root.db1.d1")) { while (resultSet.next()) { cnt++; } @@ -483,7 +483,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT sin(`1`) + 1 FROM root.sg1.d1 where `1`>1")) { + statement.executeQuery("SELECT sin(`1`) + 1 FROM root.db1.d1 where `1`>1")) { while (resultSet.next()) { cnt++; } @@ -492,7 +492,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT text FROM root.sg1.d1 where text = '\'")) { + statement.executeQuery("SELECT text FROM root.db1.d1 where text = '\'")) { while (resultSet.next()) { cnt++; } @@ -502,7 +502,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "SELECT text FROM root.sg1.d1 where text = '\' or text = 'asdf'")) { + "SELECT text FROM root.db1.d1 where text = '\' or text = 'asdf'")) { while (resultSet.next()) { cnt++; } @@ -511,7 +511,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT text FROM root.sg1.d1 where text = '\\'")) { + statement.executeQuery("SELECT text FROM root.db1.d1 where text = '\\'")) { while (resultSet.next()) { cnt++; } @@ -521,7 +521,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "SELECT text FROM root.sg1.d1 where text = '\\' and text = 'asdf'")) { + "SELECT text FROM root.db1.d1 where text = '\\' and text = 'asdf'")) { while (resultSet.next()) { cnt++; } @@ -784,14 +784,14 @@ public void testRoleName() { // Statement statement = connection.createStatement()) { // try { // statement.execute( - // "create trigger trigger` before insert on root.sg1.d1 " + // "create trigger trigger` before insert on root.db1.d1 " // + "as 'org.apache.iotdb.db.storageengine.trigger.example.Accumulator'"); // } catch (Exception ignored) { // } // // try { // statement.execute( - // "create trigger `trigger`` before insert on root.sg1.d1 " + // "create trigger `trigger`` before insert on root.db1.d1 " // + "as 'org.apache.iotdb.db.storageengine.trigger.example.Accumulator'"); // fail(); // } catch (Exception ignored) { @@ -799,7 +799,7 @@ public void testRoleName() { // // try { // statement.execute( - // "create trigger 111 before insert on root.sg1.d1 " + // "create trigger 111 before insert on root.db1.d1 " // + "as 'org.apache.iotdb.db.storageengine.trigger.example.Accumulator'"); // fail(); // } catch (Exception ignored) { @@ -807,7 +807,7 @@ public void testRoleName() { // // try { // statement.execute( - // "create trigger 'tri' before insert on root.sg1.d1 " + // "create trigger 'tri' before insert on root.db1.d1 " // + "as 'org.apache.iotdb.db.storageengine.trigger.example.Accumulator'"); // fail(); // } catch (Exception ignored) { @@ -815,7 +815,7 @@ public void testRoleName() { // // try { // statement.execute( - // "create trigger \"tri\" before insert on root.sg1.d1 " + // "create trigger \"tri\" before insert on root.db1.d1 " // + "as 'org.apache.iotdb.db.storageengine.trigger.example.Accumulator'"); // fail(); // } catch (Exception ignored) { @@ -1013,33 +1013,33 @@ public void testTemplateNameIllegal() { public void testNodeNameWithWildcard() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.device_123.s1 INT32"); + statement.execute("CREATE TIMESERIES root.db.device_123.s1 INT32"); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.device_123")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.device_123")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.device_*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.device_*")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.*_123")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.*_123")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.*123")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.*123")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.*_12*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.*_12*")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.*12*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.*12*")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.*e*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.*e*")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionStringLiteralIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionStringLiteralIT.java index 6da6a3b18030d..3fb703d06bca5 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionStringLiteralIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionStringLiteralIT.java @@ -89,24 +89,24 @@ public void testStringLiteralWithSingleQuote() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 TEXT"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 TEXT"); for (int i = 0; i < insertData.length; i++) { String insertSql = - String.format("INSERT INTO root.sg1.d1(time, s1) values (%d, %s)", i, insertData[i]); + String.format("INSERT INTO root.db1.d1(time, s1) values (%d, %s)", i, insertData[i]); statement.execute(insertSql); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db1.d1")) { int cnt = 0; while (resultSet.next()) { - Assert.assertEquals(resultData[cnt], resultSet.getString("root.sg1.d1.s1")); + Assert.assertEquals(resultData[cnt], resultSet.getString("root.db1.d1.s1")); cnt++; } Assert.assertEquals(insertData.length, cnt); } for (String insertDatum : insertData) { - String querySql = String.format("SELECT s1 FROM root.sg1.d1 WHERE s1 = %s", insertDatum); + String querySql = String.format("SELECT s1 FROM root.db1.d1 WHERE s1 = %s", insertDatum); try (ResultSet resultSet = statement.executeQuery(querySql)) { Assert.assertTrue(resultSet.next()); } @@ -147,24 +147,24 @@ public void testStringLiteralWithDoubleQuote() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 TEXT"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 TEXT"); for (int i = 0; i < insertData.length; i++) { String insertSql = - String.format("INSERT INTO root.sg1.d1(time, s1) values (%d, %s)", i, insertData[i]); + String.format("INSERT INTO root.db1.d1(time, s1) values (%d, %s)", i, insertData[i]); statement.execute(insertSql); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db1.d1")) { int cnt = 0; while (resultSet.next()) { - Assert.assertEquals(resultData[cnt], resultSet.getString("root.sg1.d1.s1")); + Assert.assertEquals(resultData[cnt], resultSet.getString("root.db1.d1.s1")); cnt++; } Assert.assertEquals(insertData.length, cnt); } for (String insertDatum : insertData) { - String querySql = String.format("SELECT s1 FROM root.sg1.d1 WHERE s1 = %s", insertDatum); + String querySql = String.format("SELECT s1 FROM root.db1.d1 WHERE s1 = %s", insertDatum); try (ResultSet resultSet = statement.executeQuery(querySql)) { Assert.assertTrue(resultSet.next()); } @@ -184,43 +184,43 @@ public void testStringLiteralIllegalCase() { + "line 1:45 mismatched input 'string' expecting {FALSE, NAN, NOW, NULL, TRUE, '-', '+', '/', '.', STRING_LITERAL, BINARY_LITERAL, DATETIME_LITERAL, INTEGER_LITERAL, EXPONENT_NUM_PART}"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 TEXT"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 TEXT"); } catch (SQLException e) { fail(e.getMessage()); } // without ' or " try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, string)"); + statement.execute("INSERT INTO root.db1.d1(time, s1) values (1, string)"); fail(); } catch (SQLException e) { Assert.assertEquals(errorMsg, e.getMessage()); } - String errorMsg1 = + String errorMdb1 = TSStatusCode.SQL_PARSE_ERROR.getStatusCode() + ": Error occurred while parsing SQL to physical plan: " + "line 1:45 mismatched input '`string`' expecting {FALSE, NAN, NOW, NULL, TRUE, '-', '+', '/', '.', STRING_LITERAL, BINARY_LITERAL, DATETIME_LITERAL, INTEGER_LITERAL, EXPONENT_NUM_PART}"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // wrap STRING_LITERAL with `` - statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, `string`)"); + statement.execute("INSERT INTO root.db1.d1(time, s1) values (1, `string`)"); fail(); } catch (SQLException e) { - Assert.assertEquals(errorMsg1, e.getMessage()); + Assert.assertEquals(errorMdb1, e.getMessage()); } - String errorMsg2 = + String errorMdb2 = TSStatusCode.SQL_PARSE_ERROR.getStatusCode() + ": Error occurred while parsing SQL to physical plan: " + "line 1:47 extraneous input 'string' expecting {',', ')'}"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // single ' in '' - statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, ''string')"); + statement.execute("INSERT INTO root.db1.d1(time, s1) values (1, ''string')"); fail(); } catch (SQLException e) { - Assert.assertEquals(errorMsg2, e.getMessage()); + Assert.assertEquals(errorMdb2, e.getMessage()); } String errorMsg3 = @@ -230,7 +230,7 @@ public void testStringLiteralIllegalCase() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // single " in "" - statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, \"\"string\")"); + statement.execute("INSERT INTO root.db1.d1(time, s1) values (1, \"\"string\")"); fail(); } catch (SQLException e) { Assert.assertEquals(errorMsg3, e.getMessage()); @@ -255,7 +255,7 @@ public void testIllegalFilePath() { Assert.assertEquals(errorMsg, e.getMessage()); } - String errorMsg1 = + String errorMdb1 = TSStatusCode.SQL_PARSE_ERROR.getStatusCode() + ": Error occurred while parsing SQL to physical plan: line 1:7 no viable alternative at input 'REMOVE path'"; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -263,10 +263,10 @@ public void testIllegalFilePath() { statement.execute("REMOVE path"); fail(); } catch (SQLException e) { - Assert.assertEquals(errorMsg1, e.getMessage()); + Assert.assertEquals(errorMdb1, e.getMessage()); } - String errorMsg2 = + String errorMdb2 = TSStatusCode.SQL_PARSE_ERROR.getStatusCode() + ": Error occurred while parsing SQL to physical plan: " + "line 1:7 mismatched input 'path' expecting {ROOT, STRING_LITERAL}"; @@ -275,7 +275,7 @@ public void testIllegalFilePath() { statement.execute("SETTLE path"); fail(); } catch (SQLException e) { - Assert.assertEquals(errorMsg2, e.getMessage()); + Assert.assertEquals(errorMdb2, e.getMessage()); } } @@ -295,7 +295,7 @@ public void testUserPassword() { Assert.assertEquals(errorMsg, e.getMessage()); } - String errorMsg1 = + String errorMdb1 = TSStatusCode.SQL_PARSE_ERROR.getStatusCode() + ": Error occurred while parsing SQL to physical plan: " + "line 1:17 mismatched input '`test123456789`' expecting STRING_LITERAL"; @@ -306,7 +306,7 @@ public void testUserPassword() { statement.execute("CREATE USER test `test123456789`"); fail(); } catch (SQLException e) { - Assert.assertEquals(errorMsg1, e.getMessage()); + Assert.assertEquals(errorMdb1, e.getMessage()); } } @@ -352,7 +352,7 @@ public void testUDFClassName() { } // Illegal name with back quote - String errorMsg1 = + String errorMdb1 = TSStatusCode.SQL_PARSE_ERROR.getStatusCode() + ": Error occurred while parsing SQL to physical plan: " + "line 1:23 mismatched input '`org.apache.iotdb.db.query.udf.example.Adder`' " @@ -363,7 +363,7 @@ public void testUDFClassName() { statement.execute("create function udf as `org.apache.iotdb.db.query.udf.example.Adder`"); fail(); } catch (SQLException e) { - Assert.assertEquals(errorMsg1, e.getMessage()); + Assert.assertEquals(errorMdb1, e.getMessage()); } } @@ -532,11 +532,11 @@ public void testAliasInResultColumn() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "create timeseries root.sg.a " + "create timeseries root.db.a " + "with datatype=INT64, encoding=PLAIN, compression=SNAPPY "); - statement.execute("insert into root.sg(time, a) values (1,1)"); + statement.execute("insert into root.db(time, a) values (1,1)"); - String selectSql = "select a as %s from root.sg"; + String selectSql = "select a as %s from root.db"; for (int i = 0; i < alias.length; i++) { try (ResultSet resultSet = statement.executeQuery(String.format(selectSql, alias[i]))) { Assert.assertEquals(res[i], resultSet.getMetaData().getColumnName(2)); @@ -544,7 +544,7 @@ public void testAliasInResultColumn() { } try { - statement.execute("select a as test.b from root.sg"); + statement.execute("select a as test.b from root.db"); fail(); } catch (Exception ignored) { } @@ -567,10 +567,10 @@ public void testAliasInAlterClause() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "create timeseries root.sg.a " + "create timeseries root.db.a " + "with datatype=INT64, encoding=PLAIN, compression=SNAPPY "); - String alterSql = "ALTER timeseries root.sg.a UPSERT alias = %s"; + String alterSql = "ALTER timeseries root.db.a UPSERT alias = %s"; for (int i = 0; i < alias.length; i++) { statement.execute(String.format(alterSql, alias[i])); try (ResultSet resultSet = statement.executeQuery("show timeseries")) { @@ -580,7 +580,7 @@ public void testAliasInAlterClause() { } try { - statement.execute("ALTER timeseries root.sg.a UPSERT alias = test.a"); + statement.execute("ALTER timeseries root.db.a UPSERT alias = test.a"); fail(); } catch (Exception ignored) { } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java index a0ad94a99444c..a118c0dc5c094 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java @@ -57,29 +57,29 @@ public void testTTL() throws SQLException, InterruptedException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("SET TTL TO root.TTL_SG1 1000"); + statement.execute("SET TTL TO root.TTL_DB1 1000"); } catch (SQLException e) { assertEquals(TSStatusCode.DATABASE_NOT_EXIST.getStatusCode(), e.getErrorCode()); } try { - statement.execute("UNSET TTL TO root.TTL_SG1"); + statement.execute("UNSET TTL TO root.TTL_DB1"); } catch (SQLException e) { assertEquals(TSStatusCode.DATABASE_NOT_EXIST.getStatusCode(), e.getErrorCode()); } - statement.execute("CREATE DATABASE root.TTL_SG1"); - statement.execute("CREATE TIMESERIES root.TTL_SG1.s1 WITH DATATYPE=INT64,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.TTL_DB1"); + statement.execute("CREATE TIMESERIES root.TTL_DB1.s1 WITH DATATYPE=INT64,ENCODING=PLAIN"); try { - statement.execute("SET TTL TO root.TTL_SG1.s1 1000"); + statement.execute("SET TTL TO root.TTL_DB1.s1 1000"); } catch (SQLException e) { e.printStackTrace(); fail(e.getMessage()); } - statement.execute("CREATE DATABASE root.TTL_SG2"); - statement.execute("CREATE TIMESERIES root.TTL_SG2.s1 WITH DATATYPE=INT64,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.TTL_DB2"); + statement.execute("CREATE TIMESERIES root.TTL_DB2.s1 WITH DATATYPE=INT64,ENCODING=PLAIN"); try { - statement.execute("SET TTL TO root.TTL_SG2.s1 1000"); + statement.execute("SET TTL TO root.TTL_DB2.s1 1000"); } catch (SQLException e) { e.printStackTrace(); fail(e.getMessage()); @@ -102,15 +102,15 @@ public void testTTL() throws SQLException, InterruptedException { for (int i = 0; i < 100; i++) { statement.execute( String.format( - "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", now - 100 + i, i)); + "INSERT INTO root.TTL_DB1(timestamp, s1) VALUES (%d, %d)", now - 100 + i, i)); } for (int i = 0; i < 100; i++) { statement.execute( String.format( - "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", now - 100000 + i, i)); + "INSERT INTO root.TTL_DB1(timestamp, s1) VALUES (%d, %d)", now - 100000 + i, i)); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.TTL_SG1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.TTL_DB1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -118,8 +118,8 @@ public void testTTL() throws SQLException, InterruptedException { assertEquals(200, cnt); } - statement.execute("SET TTL TO root.TTL_SG1 10000"); - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.TTL_SG1")) { + statement.execute("SET TTL TO root.TTL_DB1 10000"); + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.TTL_DB1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -132,14 +132,14 @@ public void testTTL() throws SQLException, InterruptedException { try { statement.execute( String.format( - "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", now - 500000 + i, i)); + "INSERT INTO root.TTL_DB1(timestamp, s1) VALUES (%d, %d)", now - 500000 + i, i)); } catch (SQLException e) { assertEquals(TSStatusCode.OUT_OF_TTL.getStatusCode(), e.getErrorCode()); } } Thread.sleep(1000); - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.TTL_SG1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.TTL_DB1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -147,38 +147,38 @@ public void testTTL() throws SQLException, InterruptedException { assertEquals(100, cnt); } - statement.execute("UNSET TTL TO root.TTL_SG1"); + statement.execute("UNSET TTL TO root.TTL_DB1"); // make sure other nodes have applied UNSET TTL Thread.sleep(1000); for (int i = 0; i < 100; i++) { statement.execute( String.format( - "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", now - 30000 + i, i)); + "INSERT INTO root.TTL_DB1(timestamp, s1) VALUES (%d, %d)", now - 30000 + i, i)); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.TTL_SG1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.TTL_DB1")) { int cnt = 0; while (resultSet.next()) { cnt++; } assertTrue(cnt >= 200); } - statement.execute("CREATE DATABASE root.sg.TTL_SG3"); - statement.execute("CREATE DATABASE root.sg.TTL_SG4"); + statement.execute("CREATE DATABASE root.db.TTL_SG3"); + statement.execute("CREATE DATABASE root.db.TTL_SG4"); // SG3 for (int i = 0; i < 100; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 100 + i, i)); + "INSERT INTO root.db.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 100 + i, i)); } for (int i = 100; i < 200; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)", + "INSERT INTO root.db.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 10000000 + i, i)); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg.TTL_SG3")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db.TTL_SG3")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -189,16 +189,16 @@ public void testTTL() throws SQLException, InterruptedException { for (int i = 200; i < 300; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 100 + i, i)); + "INSERT INTO root.db.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 100 + i, i)); } for (int i = 300; i < 400; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)", + "INSERT INTO root.db.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 10000000 + i, i)); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg.TTL_SG4")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db.TTL_SG4")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -206,8 +206,8 @@ public void testTTL() throws SQLException, InterruptedException { assertEquals(200, cnt); } - statement.execute("SET TTL TO root.sg.** 100000"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg.**")) { + statement.execute("SET TTL TO root.db.** 100000"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db.**")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -219,7 +219,7 @@ public void testTTL() throws SQLException, InterruptedException { try { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)", + "INSERT INTO root.db.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 5000000 + i, i)); } catch (SQLException e) { assertEquals(TSStatusCode.OUT_OF_TTL.getStatusCode(), e.getErrorCode()); @@ -230,14 +230,14 @@ public void testTTL() throws SQLException, InterruptedException { try { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)", + "INSERT INTO root.db.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 5000000 + i, i)); } catch (SQLException e) { assertEquals(TSStatusCode.OUT_OF_TTL.getStatusCode(), e.getErrorCode()); } } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg.**")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db.**")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -245,20 +245,20 @@ public void testTTL() throws SQLException, InterruptedException { assertEquals(200, cnt); } - statement.execute("UNSET TTL TO root.sg.**"); + statement.execute("UNSET TTL TO root.db.**"); // make sure other nodes have applied UNSET TTL Thread.sleep(1000); for (int i = 0; i < 100; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 30000 + i, i)); + "INSERT INTO root.db.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 30000 + i, i)); } for (int i = 100; i < 200; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 30000 + i, i)); + "INSERT INTO root.db.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 30000 + i, i)); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg.**")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db.**")) { int cnt = 0; while (resultSet.next()) { cnt++; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationByLevelIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationByLevelIT.java index 222988de43dca..10397d1f904fb 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationByLevelIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationByLevelIT.java @@ -54,25 +54,25 @@ public class IoTDBAggregationByLevelIT { protected static final String[] dataSet = new String[] { - "CREATE DATABASE root.sg1", - "CREATE DATABASE root.sg2", - "CREATE TIMESERIES root.sg1.d1.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d2.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d1.status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "INSERT INTO root.sg1.d1(timestamp,status) values(150,true)", - "INSERT INTO root.sg1.d1(timestamp,status,temperature) values(200,false,20.71)", - "INSERT INTO root.sg1.d1(timestamp,status,temperature) values(600,false,71.12)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(200,false,42.66)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(300,false,46.77)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(700,true,62.15)", - "INSERT INTO root.sg2.d1(timestamp,status,temperature) values(100,3,88.24)", - "INSERT INTO root.sg2.d1(timestamp,status,temperature) values(500,5,125.5)", - "INSERT INTO root.sg2.d2(timestamp,temperature) values(200,105.5)", - "INSERT INTO root.sg2.d2(timestamp,temperature) values(800,61.22)", + "CREATE DATABASE root.db1", + "CREATE DATABASE root.db2", + "CREATE TIMESERIES root.db1.d1.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d2.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d1.status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "INSERT INTO root.db1.d1(timestamp,status) values(150,true)", + "INSERT INTO root.db1.d1(timestamp,status,temperature) values(200,false,20.71)", + "INSERT INTO root.db1.d1(timestamp,status,temperature) values(600,false,71.12)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(200,false,42.66)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(300,false,46.77)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(700,true,62.15)", + "INSERT INTO root.db2.d1(timestamp,status,temperature) values(100,3,88.24)", + "INSERT INTO root.db2.d1(timestamp,status,temperature) values(500,5,125.5)", + "INSERT INTO root.db2.d2(timestamp,temperature) values(200,105.5)", + "INSERT INTO root.db2.d2(timestamp,temperature) values(800,61.22)", }; private static final double DOUBLE_PRECISION = 0.001d; @@ -99,18 +99,18 @@ public void sumFuncGroupByLevelTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select sum(temperature), sum(temperature) from root.sg1.* GROUP BY level=1")) { + "select sum(temperature), sum(temperature) from root.db1.* GROUP BY level=1")) { while (resultSet.next()) { - String ans = resultSet.getString(sum("root.sg1.*.temperature")); + String ans = resultSet.getString(sum("root.db1.*.temperature")); Assert.assertEquals(retArray[cnt], Double.parseDouble(ans), DOUBLE_PRECISION); cnt++; } } try (ResultSet resultSet = - statement.executeQuery("select sum(temperature) from root.sg2.* GROUP BY level=1")) { + statement.executeQuery("select sum(temperature) from root.db2.* GROUP BY level=1")) { while (resultSet.next()) { - String ans = resultSet.getString(sum("root.sg2.*.temperature")); + String ans = resultSet.getString(sum("root.db2.*.temperature")); Assert.assertEquals(retArray[cnt], Double.parseDouble(ans), DOUBLE_PRECISION); cnt++; } @@ -126,10 +126,10 @@ public void sumFuncGroupByLevelTest() throws Exception { } try (ResultSet resultSet = - statement.executeQuery("select sum(temperature) from root.sg1.* GROUP BY level=1,2")) { + statement.executeQuery("select sum(temperature) from root.db1.* GROUP BY level=1,2")) { while (resultSet.next()) { - String ans1 = resultSet.getString(sum("root.sg1.d1.temperature")); - String ans2 = resultSet.getString(sum("root.sg1.d2.temperature")); + String ans1 = resultSet.getString(sum("root.db1.d1.temperature")); + String ans2 = resultSet.getString(sum("root.db1.d2.temperature")); Assert.assertEquals(retArray[cnt++], Double.parseDouble(ans1), DOUBLE_PRECISION); Assert.assertEquals(retArray[cnt++], Double.parseDouble(ans2), DOUBLE_PRECISION); } @@ -146,18 +146,18 @@ public void avgFuncGroupByLevelTest() throws Exception { int cnt = 0; try (ResultSet resultSet = - statement.executeQuery("select avg(temperature) from root.sg1.* GROUP BY level=1")) { + statement.executeQuery("select avg(temperature) from root.db1.* GROUP BY level=1")) { while (resultSet.next()) { - String ans = resultSet.getString(avg("root.sg1.*.temperature")); + String ans = resultSet.getString(avg("root.db1.*.temperature")); Assert.assertEquals(retArray[cnt], Double.parseDouble(ans), DOUBLE_PRECISION); cnt++; } } try (ResultSet resultSet = - statement.executeQuery("select avg(temperature) from root.sg2.* GROUP BY level=1")) { + statement.executeQuery("select avg(temperature) from root.db2.* GROUP BY level=1")) { while (resultSet.next()) { - String ans = resultSet.getString(avg("root.sg2.*.temperature")); + String ans = resultSet.getString(avg("root.db2.*.temperature")); Assert.assertEquals(retArray[cnt], Double.parseDouble(ans), DOUBLE_PRECISION); cnt++; } @@ -173,10 +173,10 @@ public void avgFuncGroupByLevelTest() throws Exception { } try (ResultSet resultSet = - statement.executeQuery("select avg(temperature) from root.sg1.* GROUP BY level=1, 2")) { + statement.executeQuery("select avg(temperature) from root.db1.* GROUP BY level=1, 2")) { while (resultSet.next()) { - String ans1 = resultSet.getString(avg("root.sg1.d1.temperature")); - String ans2 = resultSet.getString(avg("root.sg1.d2.temperature")); + String ans1 = resultSet.getString(avg("root.db1.d1.temperature")); + String ans2 = resultSet.getString(avg("root.db1.d2.temperature")); Assert.assertEquals(retArray[cnt++], Double.parseDouble(ans1), DOUBLE_PRECISION); Assert.assertEquals(retArray[cnt++], Double.parseDouble(ans2), DOUBLE_PRECISION); } @@ -211,7 +211,7 @@ public void timeFuncGroupByLevelTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( - "select max_time(status), count(temperature) from root.sg1.* GROUP BY level=2")) { + "select max_time(status), count(temperature) from root.db1.* GROUP BY level=2")) { while (resultSet.next()) { String ans = resultSet.getString(maxTime("root.*.d1.status")) @@ -230,11 +230,11 @@ public void timeFuncGroupByLevelTest() throws Exception { statement.executeQuery("select max_time(status) from root.*.* GROUP BY level=1, 2")) { while (resultSet.next()) { String ans = - resultSet.getString(maxTime("root.sg1.d1.status")) + resultSet.getString(maxTime("root.db1.d1.status")) + "," - + resultSet.getString(maxTime("root.sg1.d2.status")) + + resultSet.getString(maxTime("root.db1.d2.status")) + "," - + resultSet.getString(maxTime("root.sg2.d1.status")); + + resultSet.getString(maxTime("root.db2.d1.status")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -268,7 +268,7 @@ public void valueFuncGroupByLevelTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( - "select last_value(temperature), max_value(temperature) from root.sg1.* GROUP BY level=2")) { + "select last_value(temperature), max_value(temperature) from root.db1.* GROUP BY level=2")) { while (resultSet.next()) { String ans = resultSet.getString(lastValue("root.*.d1.temperature")) @@ -323,9 +323,9 @@ public void countStarGroupByLevelTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 1 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 1 * - *

Result is [root.sg.*.temperature] + *

Result is [root.db.*.temperature] */ @Test public void groupByLevelWithAliasTest() throws Exception { @@ -336,7 +336,7 @@ public void groupByLevelWithAliasTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(temperature) as ct from root.sg1.d1, root.sg1.d2 GROUP BY level=1")) { + "select count(temperature) as ct from root.db1.d1, root.db1.d2 GROUP BY level=1")) { while (resultSet.next()) { String ans = resultSet.getString("ct"); Assert.assertEquals(retArray[cnt], ans); @@ -347,7 +347,7 @@ public void groupByLevelWithAliasTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(temperature) as ct from root.sg1.* GROUP BY level=1")) { + "select count(temperature) as ct from root.db1.* GROUP BY level=1")) { while (resultSet.next()) { String ans = resultSet.getString("ct"); Assert.assertEquals(retArray[cnt], ans); @@ -355,9 +355,9 @@ public void groupByLevelWithAliasTest() throws Exception { } } - // root.sg1.d1.* -> [root.sg1.d1.status, root.sg1.d1.temperature] -> root.*.*.* -> ct + // root.db1.d1.* -> [root.db1.d1.status, root.db1.d1.temperature] -> root.*.*.* -> ct try (ResultSet resultSet = - statement.executeQuery("select count(*) as ct from root.sg1.d1 GROUP BY level=0")) { + statement.executeQuery("select count(*) as ct from root.db1.d1 GROUP BY level=0")) { while (resultSet.next()) { String ans = resultSet.getString("ct"); Assert.assertEquals(retArray[cnt], ans); @@ -368,7 +368,7 @@ public void groupByLevelWithAliasTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 2 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 2 * *

Result is [root.*.d1.temperature, root.*.d2.temperature] */ @@ -376,20 +376,20 @@ public void groupByLevelWithAliasTest() throws Exception { public void groupByLevelWithAliasFailTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.executeQuery("select count(temperature) as ct from root.sg1.* GROUP BY level=2"); + statement.executeQuery("select count(temperature) as ct from root.db1.* GROUP BY level=2"); fail("No exception thrown"); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("can only be matched with one")); } } - // Different from above at: root.sg1.*.temperature is just one ResultColumn + // Different from above at: root.db1.*.temperature is just one ResultColumn @Test public void groupByLevelWithAliasFailTest2() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( - "select count(temperature) as ct from root.sg1.d1, root.sg2.d2 GROUP BY level=2"); + "select count(temperature) as ct from root.db1.d1, root.db2.d2 GROUP BY level=2"); fail("No exception thrown"); } catch (Exception e) { System.out.println(e.getMessage()); @@ -403,7 +403,7 @@ public void groupByLevelWithAliasFailTest3() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( - "select count(temperature) as ct, count(temperature) as ct2 from root.sg1.d1 GROUP BY level=2"); + "select count(temperature) as ct, count(temperature) as ct2 from root.db1.d1 GROUP BY level=2"); fail("No exception thrown"); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("more than one alias")); @@ -420,7 +420,7 @@ public void groupByLevelWithAliasWithTimeIntervalTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(temperature) as ct from root.sg1.d1, root.sg1.d2 GROUP BY ([0, 600), 100ms), level=1")) { + "select count(temperature) as ct from root.db1.d1, root.db1.d2 GROUP BY ([0, 600), 100ms), level=1")) { while (resultSet.next()) { String ans = resultSet.getString(ColumnHeaderConstant.TIME) + "," + resultSet.getString("ct"); @@ -432,7 +432,7 @@ public void groupByLevelWithAliasWithTimeIntervalTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(temperature) as ct from root.sg1.* GROUP BY ([0, 600), 100ms), level=1")) { + "select count(temperature) as ct from root.db1.* GROUP BY ([0, 600), 100ms), level=1")) { while (resultSet.next()) { String ans = resultSet.getString(ColumnHeaderConstant.TIME) + "," + resultSet.getString("ct"); @@ -442,10 +442,10 @@ public void groupByLevelWithAliasWithTimeIntervalTest() throws Exception { } cnt = 0; - // root.sg1.d1.* -> [root.sg1.d1.status, root.sg1.d1.temperature] -> root.*.*.* -> ct + // root.db1.d1.* -> [root.db1.d1.status, root.db1.d1.temperature] -> root.*.*.* -> ct try (ResultSet resultSet = statement.executeQuery( - "select count(*) as ct from root.sg1.d1 GROUP BY ([0, 600), 100ms), level=1")) { + "select count(*) as ct from root.db1.d1 GROUP BY ([0, 600), 100ms), level=1")) { while (resultSet.next()) { String ans = resultSet.getString(ColumnHeaderConstant.TIME) + "," + resultSet.getString("ct"); @@ -457,7 +457,7 @@ public void groupByLevelWithAliasWithTimeIntervalTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 2 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 2 * *

Result is [root.*.d1.temperature, root.*.d2.temperature] */ @@ -466,20 +466,20 @@ public void groupByLevelWithAliasWithTimeIntervalFailTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( - "select count(temperature) as ct from root.sg1.* GROUP BY ([0, 600), 100ms), level=2"); + "select count(temperature) as ct from root.db1.* GROUP BY ([0, 600), 100ms), level=2"); fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("can only be matched with one")); } } - // Different from above at: root.sg1.*.temperature is just one ResultColumn + // Different from above at: root.db1.*.temperature is just one ResultColumn @Test public void groupByLevelWithAliasWithTimeIntervalFailTest2() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( - "select count(temperature) as ct from root.sg1.d1, root.sg1.d2 GROUP BY ([0, 600), 100ms), level=2"); + "select count(temperature) as ct from root.db1.d1, root.db1.d2 GROUP BY ([0, 600), 100ms), level=2"); fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("can only be matched with one")); @@ -498,9 +498,9 @@ public void GroupByLevelSLimitTest() throws Exception { "select count(temperature), count(status) from root.*.* GROUP BY level=1 slimit 2")) { while (resultSet.next()) { String ans = - resultSet.getString(count("root.sg1.*.temperature")) + resultSet.getString(count("root.db1.*.temperature")) + "," - + resultSet.getString(count("root.sg2.*.temperature")); + + resultSet.getString(count("root.db2.*.temperature")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -511,9 +511,9 @@ public void GroupByLevelSLimitTest() throws Exception { "select count(temperature), count(status) from root.*.* GROUP BY level=1 slimit 2 soffset 1")) { while (resultSet.next()) { String ans = - resultSet.getString(count("root.sg2.*.temperature")) + resultSet.getString(count("root.db2.*.temperature")) + "," - + resultSet.getString(count("root.sg1.*.status")); + + resultSet.getString(count("root.db1.*.status")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -523,7 +523,7 @@ public void GroupByLevelSLimitTest() throws Exception { statement.executeQuery( "select count(temperature), count(status) from root.*.* GROUP BY level=1,2 slimit 1 soffset 4")) { while (resultSet.next()) { - String ans = resultSet.getString(count("root.sg1.d1.status")); + String ans = resultSet.getString(count("root.db1.d1.status")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -552,9 +552,9 @@ public void groupByLevelWithTimeIntervalTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select sum(temperature) from root.sg2.* GROUP BY ([0, 600), 100ms), level=1")) { + "select sum(temperature) from root.db2.* GROUP BY ([0, 600), 100ms), level=1")) { while (resultSet.next()) { - String ans = "" + resultSet.getString(sum("root.sg2.*.temperature")); + String ans = "" + resultSet.getString(sum("root.db2.*.temperature")); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -566,13 +566,13 @@ public void groupByLevelWithTimeIntervalTest() throws Exception { "select max_time(temperature), avg(temperature) from root.*.* GROUP BY ([0, 600), 100ms), level=1")) { while (resultSet.next()) { String ans = - resultSet.getString(maxTime("root.sg1.*.temperature")) + resultSet.getString(maxTime("root.db1.*.temperature")) + "," - + resultSet.getString(maxTime("root.sg2.*.temperature")) + + resultSet.getString(maxTime("root.db2.*.temperature")) + "," - + resultSet.getString(avg("root.sg1.*.temperature")) + + resultSet.getString(avg("root.db1.*.temperature")) + "," - + resultSet.getString(avg("root.sg2.*.temperature")); + + resultSet.getString(avg("root.db2.*.temperature")); Assert.assertEquals(retArray2[cnt], ans); cnt++; } @@ -592,9 +592,9 @@ public void groupByMultiLevelWithTimeIntervalTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select sum(temperature) from root.sg2.* GROUP BY ([0, 600), 100ms), level=0,1")) { + "select sum(temperature) from root.db2.* GROUP BY ([0, 600), 100ms), level=0,1")) { while (resultSet.next()) { - String ans = "" + resultSet.getString(sum("root.sg2.*.temperature")); + String ans = "" + resultSet.getString(sum("root.db2.*.temperature")); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -621,9 +621,9 @@ public void groupByMultiLevelWithTimeIntervalSLimitTest() throws Exception { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.*.temperature")) + + resultSet.getString(count("root.db1.*.temperature")) + "," - + resultSet.getString(count("root.sg2.*.temperature")); + + resultSet.getString(count("root.db2.*.temperature")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -637,9 +637,9 @@ public void groupByMultiLevelWithTimeIntervalSLimitTest() throws Exception { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg2.*.temperature")) + + resultSet.getString(count("root.db2.*.temperature")) + "," - + resultSet.getString(count("root.sg1.*.status")); + + resultSet.getString(count("root.db1.*.status")); Assert.assertEquals(retArray2[cnt], ans); cnt++; } @@ -668,7 +668,7 @@ public void TestGroupByLevelWithoutAggregationFunc() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.executeQuery("select temperature from root.sg1.* group by level = 2"); + statement.executeQuery("select temperature from root.db1.* group by level = 2"); fail("No expected exception thrown"); } catch (Exception e) { Assert.assertTrue( @@ -685,7 +685,7 @@ public void groupByLevelWithSameColumn() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(status),count(status) from root.sg*.** GROUP BY level=0")) { + "select count(status),count(status) from root.db*.** GROUP BY level=0")) { ResultSetMetaData metaData = resultSet.getMetaData(); Assert.assertEquals(metaData.getColumnName(1), metaData.getColumnName(2)); 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 524d0770a6c07..785771168f223 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 @@ -95,16 +95,16 @@ public class IoTDBAggregationIT { }; private static final String[] dataSet3 = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", - "insert into root.sg.d1(timestamp,s1) values(5,5)", - "insert into root.sg.d1(timestamp,s1) values(12,12)", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", + "insert into root.db.d1(timestamp,s1) values(5,5)", + "insert into root.db.d1(timestamp,s1) values(12,12)", "flush", - "insert into root.sg.d1(timestamp,s1) values(15,15)", - "insert into root.sg.d1(timestamp,s1) values(25,25)", + "insert into root.db.d1(timestamp,s1) values(15,15)", + "insert into root.db.d1(timestamp,s1) values(25,25)", "flush", - "insert into root.sg.d1(timestamp,s1) values(1,111)", - "insert into root.sg.d1(timestamp,s1) values(20,200)", + "insert into root.db.d1(timestamp,s1) values(1,111)", + "insert into root.db.d1(timestamp,s1) values(20,200)", "flush", }; private final String d0s0 = "root.vehicle.d0.s0"; @@ -976,9 +976,9 @@ public void descAggregationWithUnseqData() { int cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT max_time(s1) FROM root.sg.d1 where time < 15")) { + statement.executeQuery("SELECT max_time(s1) FROM root.db.d1 where time < 15")) { while (resultSet.next()) { - String ans = resultSet.getString(maxTime("root.sg.d1.s1")); + String ans = resultSet.getString(maxTime("root.db.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationScanOrderIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationScanOrderIT.java index 23f55af0ffd9f..5cd0feabd525d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationScanOrderIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationScanOrderIT.java @@ -41,31 +41,31 @@ public class IoTDBAggregationScanOrderIT { private static final String[] sqls = new String[] { - "insert into root.sg1.d1(time, s1) values (12, 12);", + "insert into root.db1.d1(time, s1) values (12, 12);", "flush;", - "insert into root.sg1.d1(time, s2) values (30, 30);", + "insert into root.db1.d1(time, s2) values (30, 30);", "flush;", - "insert into root.sg1.d1(time, s1) values (0, 0);", - "insert into root.sg1.d1(time, s1) values (8, 8);", + "insert into root.db1.d1(time, s1) values (0, 0);", + "insert into root.db1.d1(time, s1) values (8, 8);", "flush;", - "insert into root.sg1.d1(time, s1) values (0, 0);", - "insert into root.sg1.d1(time, s1) values (10, 10);", + "insert into root.db1.d1(time, s1) values (0, 0);", + "insert into root.db1.d1(time, s1) values (10, 10);", "flush;", - "insert into root.sg1.d1(time, s1) values (17, 17);", - "insert into root.sg1.d1(time, s1) values (20, 20);", + "insert into root.db1.d1(time, s1) values (17, 17);", + "insert into root.db1.d1(time, s1) values (20, 20);", "flush;", - "insert into root.sg1.d2(time, s1) aligned values (12, 12);", + "insert into root.db1.d2(time, s1) aligned values (12, 12);", "flush;", - "insert into root.sg1.d2(time, s2) aligned values (30, 30);", + "insert into root.db1.d2(time, s2) aligned values (30, 30);", "flush;", - "insert into root.sg1.d2(time, s1) aligned values (0, 0);", - "insert into root.sg1.d2(time, s1) aligned values (8, 8);", + "insert into root.db1.d2(time, s1) aligned values (0, 0);", + "insert into root.db1.d2(time, s1) aligned values (8, 8);", "flush;", - "insert into root.sg1.d2(time, s1) aligned values (0, 0);", - "insert into root.sg1.d2(time, s1) aligned values (10, 10);", + "insert into root.db1.d2(time, s1) aligned values (0, 0);", + "insert into root.db1.d2(time, s1) aligned values (10, 10);", "flush;", - "insert into root.sg1.d2(time, s1) aligned values (17, 17);", - "insert into root.sg1.d2(time, s1) aligned values (20, 20);", + "insert into root.db1.d2(time, s1) aligned values (17, 17);", + "insert into root.db1.d2(time, s1) aligned values (20, 20);", "flush;" }; @@ -88,21 +88,21 @@ public static void tearDown() throws Exception { @Test public void test() { - String d1s1 = "root.sg1.d1.s1"; + String d1s1 = "root.db1.d1.s1"; String[] expectedHeader = new String[] {firstValue(d1s1), lastValue(d1s1)}; String[] retArray = new String[] {"0.0,20.0,"}; resultSetEqualWithDescOrderTest( - "select first_value(s1), last_value(s1) from root.sg1.d1", expectedHeader, retArray); + "select first_value(s1), last_value(s1) from root.db1.d1", expectedHeader, retArray); } @Test public void alignedTest() { - String d2s1 = "root.sg1.d2.s1"; + String d2s1 = "root.db1.d2.s1"; String[] expectedHeader = new String[] {firstValue(d2s1), lastValue(d2s1)}; String[] retArray = new String[] {"0.0,20.0,"}; resultSetEqualWithDescOrderTest( - "select first_value(s1), last_value(s1) from root.sg1.d2", expectedHeader, retArray); + "select first_value(s1), last_value(s1) from root.db1.d2", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java index bb7a2645b0c3b..59ade50f2864b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java @@ -52,33 +52,33 @@ public class IoTDBTagAggregationIT { private final double E = 0.00001D; protected static final String[] DATASET = new String[] { - "CREATE DATABASE root.sg.a;", - "CREATE DATABASE root.sg.b;", - "CREATE DATABASE root.sg2.c;", + "CREATE DATABASE root.db.a;", + "CREATE DATABASE root.db.b;", + "CREATE DATABASE root.db2.c;", "CREATE DATABASE root.case2;", - "create timeseries root.sg.a.d1.t with datatype=FLOAT tags(k1=k1v1, k2=k2v1, k3=k3v1);", - "create timeseries root.sg.b.d2.t with datatype=FLOAT tags(k1=k1v1, k2=k2v2);", - "create timeseries root.sg.a.d3.t with datatype=FLOAT tags(k1=k1v2, k2=k2v1);", - "create timeseries root.sg.b.d4.t with datatype=FLOAT tags(k1=k1v2, k2=k2v2);", - "create timeseries root.sg.a.d5.t with datatype=FLOAT tags(k1=k1v1);", - "create timeseries root.sg.b.d6.t with datatype=FLOAT tags(k2=k2v1);", - "create timeseries root.sg.a.d7.t with datatype=FLOAT;", - "create timeseries root.sg2.c.d8.t with datatype=TEXT tags(k3=k3v1);", - "insert into root.sg.a.d1(time, t) values(1, 1.1);", - "insert into root.sg.b.d2(time, t) values(1, 1.2);", - "insert into root.sg.a.d3(time, t) values(1, 1.3);", - "insert into root.sg.b.d4(time, t) values(1, 1.4);", - "insert into root.sg.a.d5(time, t) values(1, 1.5);", - "insert into root.sg.b.d6(time, t) values(1, 1.6);", - "insert into root.sg.a.d7(time, t) values(1, 1.7);", - "insert into root.sg2.c.d8(time, t) values(1, 'abc');", - "insert into root.sg.a.d1(time, t) values(10, 2.1);", - "insert into root.sg.b.d2(time, t) values(10, 3.2);", - "insert into root.sg.a.d3(time, t) values(10, 4.3);", - "insert into root.sg.b.d4(time, t) values(10, 5.4);", - "insert into root.sg.a.d5(time, t) values(10, 6.5);", - "insert into root.sg.b.d6(time, t) values(10, 7.6);", - "insert into root.sg.a.d7(time, t) values(10, 8.7);", + "create timeseries root.db.a.d1.t with datatype=FLOAT tags(k1=k1v1, k2=k2v1, k3=k3v1);", + "create timeseries root.db.b.d2.t with datatype=FLOAT tags(k1=k1v1, k2=k2v2);", + "create timeseries root.db.a.d3.t with datatype=FLOAT tags(k1=k1v2, k2=k2v1);", + "create timeseries root.db.b.d4.t with datatype=FLOAT tags(k1=k1v2, k2=k2v2);", + "create timeseries root.db.a.d5.t with datatype=FLOAT tags(k1=k1v1);", + "create timeseries root.db.b.d6.t with datatype=FLOAT tags(k2=k2v1);", + "create timeseries root.db.a.d7.t with datatype=FLOAT;", + "create timeseries root.db2.c.d8.t with datatype=TEXT tags(k3=k3v1);", + "insert into root.db.a.d1(time, t) values(1, 1.1);", + "insert into root.db.b.d2(time, t) values(1, 1.2);", + "insert into root.db.a.d3(time, t) values(1, 1.3);", + "insert into root.db.b.d4(time, t) values(1, 1.4);", + "insert into root.db.a.d5(time, t) values(1, 1.5);", + "insert into root.db.b.d6(time, t) values(1, 1.6);", + "insert into root.db.a.d7(time, t) values(1, 1.7);", + "insert into root.db2.c.d8(time, t) values(1, 'abc');", + "insert into root.db.a.d1(time, t) values(10, 2.1);", + "insert into root.db.b.d2(time, t) values(10, 3.2);", + "insert into root.db.a.d3(time, t) values(10, 4.3);", + "insert into root.db.b.d4(time, t) values(10, 5.4);", + "insert into root.db.a.d5(time, t) values(10, 6.5);", + "insert into root.db.b.d6(time, t) values(10, 7.6);", + "insert into root.db.a.d7(time, t) values(10, 8.7);", // test multi value with multi aggregation column "create timeseries root.case2.d1.s1 with datatype=FLOAT tags(k1=v1);", @@ -119,7 +119,7 @@ public static void tearDown() throws Exception { @Test public void testAggregateFunctions() { String query = - "SELECT COUNT(t), AVG(t), MAX_TIME(t), MIN_TIME(t), MAX_VALUE(t), MIN_VALUE(t), EXTREME(t) FROM root.sg.** GROUP BY TAGS(k1)"; + "SELECT COUNT(t), AVG(t), MAX_TIME(t), MIN_TIME(t), MAX_VALUE(t), MIN_VALUE(t), EXTREME(t) FROM root.db.** GROUP BY TAGS(k1)"; // Expected result set: // +----+--------+------------------+-----------+-----------+------------+------------+----------+ // | k1|count(t)| @@ -174,7 +174,7 @@ public void testAggregateFunctions() { @Test @Ignore public void testAggregateFunctionsWithNestedExpression() { - String query = "SELECT COUNT(t + 1), AVG(t + 1) FROM root.sg.** GROUP BY TAGS(k1)"; + String query = "SELECT COUNT(t + 1), AVG(t + 1) FROM root.db.** GROUP BY TAGS(k1)"; // Expected result set: // +----+------------+------------------+ // | k1|count(t + 1)| avg(t + 1)| @@ -226,7 +226,7 @@ public void testAggregateFunctionsWithNestedExpression() { @Ignore // TODO: support having in later commits public void testAggregateFunctionsWithHaving() { String query = - "SELECT COUNT(t), AVG(t), MAX_TIME(t), MIN_TIME(t), MAX_VALUE(t), MIN_VALUE(t), EXTREME(t) FROM root.sg.** GROUP BY TAGS(k1) HAVING avg(t) > 3"; + "SELECT COUNT(t), AVG(t), MAX_TIME(t), MIN_TIME(t), MAX_VALUE(t), MIN_VALUE(t), EXTREME(t) FROM root.db.** GROUP BY TAGS(k1) HAVING avg(t) > 3"; // Expected result set: // +----+--------+------------------+-----------+-----------+------------+------------+----------+ // | k1|count(t)| @@ -269,7 +269,7 @@ public void testAggregateFunctionsWithHaving() { @Test public void testMultipleAggregationKeys() { - String query = "SELECT COUNT(t) FROM root.sg.** GROUP BY TAGS(k1, k2)"; + String query = "SELECT COUNT(t) FROM root.db.** GROUP BY TAGS(k1, k2)"; // Expected result set: // +----+----+--------+ // | k1| k2|count(t)| @@ -306,7 +306,7 @@ public void testMultipleAggregationKeys() { @Test public void testAlongWithTimeAggregation() { - String query = "SELECT COUNT(t) from root.sg.** GROUP BY ([0, 20), 10ms), TAGS(k1)"; + String query = "SELECT COUNT(t) from root.db.** GROUP BY ([0, 20), 10ms), TAGS(k1)"; // Expected result set: // +-----------------------------+----+--------+ // | Time| k1|count(t)| @@ -357,7 +357,7 @@ public void testAlongWithTimeAggregation() { @Test public void testAlongWithSlidingWindow() { - String query = "SELECT COUNT(t) from root.sg.** GROUP BY ([0, 20), 15ms, 5ms), TAGS(k1)"; + String query = "SELECT COUNT(t) from root.db.** GROUP BY ([0, 20), 15ms, 5ms), TAGS(k1)"; // Expected result set: // +-----------------------------+----+--------+ // | Time| k1|count(t)| @@ -411,7 +411,7 @@ public void testAlongWithSlidingWindow() { @Test public void testAlongWithTimeAggregationAndOrdering() { String query = - "SELECT COUNT(t) from root.sg.** GROUP BY ([0, 20), 10ms), TAGS(k1) ORDER BY TIME DESC"; + "SELECT COUNT(t) from root.db.** GROUP BY ([0, 20), 10ms), TAGS(k1) ORDER BY TIME DESC"; // Expected result set: // +-----------------------------+----+--------+ // | Time| k1|count(t)| @@ -462,7 +462,7 @@ public void testAlongWithTimeAggregationAndOrdering() { @Test public void testAlongWithTimeFiltering() { - String query = "SELECT COUNT(t) FROM root.sg.** WHERE time > 1 GROUP BY TAGS(k1)"; + String query = "SELECT COUNT(t) FROM root.db.** WHERE time > 1 GROUP BY TAGS(k1)"; // Expected result set: // +----+--------+ // | k1|count(t)| @@ -519,7 +519,7 @@ public void testIncompatibleMixedDataTypes() { @Test public void testWithValueFilters() { - String query = "SELECT AVG(t) FROM root.sg.** WHERE t > 1.5 GROUP BY TAGS(k1)"; + String query = "SELECT AVG(t) FROM root.db.** WHERE t > 1.5 GROUP BY TAGS(k1)"; // Value filter is not supported yet try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -535,7 +535,7 @@ public void testWithValueFilters() { @Test public void testWithHaving() { String query = - "SELECT COUNT(t) from root.sg.** GROUP BY ([0, 20), 10ms), TAGS(k1) HAVING COUNT(t) > 3"; + "SELECT COUNT(t) from root.db.** GROUP BY ([0, 20), 10ms), TAGS(k1) HAVING COUNT(t) > 3"; // Having is not supported yet try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByAlignedSeriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByAlignedSeriesIT.java index cf3a5d6cea802..f9ec723f4e889 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByAlignedSeriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByAlignedSeriesIT.java @@ -62,7 +62,7 @@ public class IoTDBMaxByAlignedSeriesIT extends IoTDBMaxByIT { "INSERT INTO root.db.d2(timestamp,y1,y2,y3,y4,y5,y6) values(12, 8, 8, 8, 8, false, \"4\")", "INSERT INTO root.db.d2(timestamp,x1,x2,x3,x4,x5,x6) values(13, 4, 4, 4, 4, false, \"4\")", "INSERT INTO root.db.d2(timestamp,y1,y2,y3,y4,y5,y6) values(13, 8, 8, 8, 8, false, \"4\")", - "insert into root.sg.d1(time,s1,s2) values(1,1,1);", + "insert into root.db.d1(time,s1,s2) values(1,1,1);", }; @BeforeClass @@ -76,15 +76,15 @@ public static void setUp() throws Exception { public void maxMinByTimeTest() { String[] expectedHeader = new String[] {"Device", "max_by(Time, s1 + 1)", "min_by(Time, s1 + 1)"}; - String[] retArray = new String[] {"root.sg.d1,1,1,"}; + String[] retArray = new String[] {"root.db.d1,1,1,"}; resultSetEqualTest( - "select max_by(time, s1+1), min_by(time, s1+1) from root.sg.* align by device", + "select max_by(time, s1+1), min_by(time, s1+1) from root.db.* align by device", expectedHeader, retArray); expectedHeader = new String[] {"Device", "max_by(Time, s1)", "min_by(Time, s1)"}; resultSetEqualTest( - "select max_by(time, s1), min_by(time, s1) from root.sg.* where s1>0 align by device", + "select max_by(time, s1), min_by(time, s1) from root.db.* where s1>0 align by device", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java index 540c8bc66719e..6e581f8deb741 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java @@ -111,7 +111,7 @@ public class IoTDBMaxByIT { "INSERT INTO root.db.d2(timestamp,y1,y2,y3,y4,y5,y6) values(12, 9, 9, 9, 9, false, \"1\")", "INSERT INTO root.db.d2(timestamp,x1,x2,x3,x4,x5,x6) values(13, 4, 4, 4, 4, false, \"4\")", "INSERT INTO root.db.d2(timestamp,y1,y2,y3,y4,y5,y6) values(13, 9, 9, 9, 9, false, \"1\")", - "insert into root.sg.d1(time,s1,s2) values(1,1,1);", + "insert into root.db.d1(time,s1,s2) values(1,1,1);", "flush" }; @@ -491,14 +491,14 @@ public void testMaxByWithGroupByLevel() { @Test public void maxMinByTimeTest() { String[] expectedHeader = - new String[] {"max_by(Time, root.sg.d1.s1 + 1)", "min_by(Time, root.sg.d1.s1 + 1)"}; + new String[] {"max_by(Time, root.db.d1.s1 + 1)", "min_by(Time, root.db.d1.s1 + 1)"}; String[] retArray = new String[] {"1,1,"}; resultSetEqualTest( - "select max_by(time, s1+1), min_by(time, s1+1) from root.sg.*", expectedHeader, retArray); + "select max_by(time, s1+1), min_by(time, s1+1) from root.db.*", expectedHeader, retArray); - expectedHeader = new String[] {"max_by(Time, root.sg.d1.s1)", "min_by(Time, root.sg.d1.s1)"}; + expectedHeader = new String[] {"max_by(Time, root.db.d1.s1)", "min_by(Time, root.db.d1.s1)"}; resultSetEqualTest( - "select max_by(time, s1), min_by(time, s1) from root.sg.* where s1>0", + "select max_by(time, s1), min_by(time, s1) from root.db.* where s1>0", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateAggregationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateAggregationIT.java index 38f2a9616464b..a8a02aa10640e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateAggregationIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateAggregationIT.java @@ -41,34 +41,34 @@ public class IoTDBAlignByDeviceWithTemplateAggregationIT { private static final String[] sqls = new String[] { // non-aligned template - "CREATE database root.sg1;", + "CREATE database root.db1;", "CREATE schema template t1 (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t1 to root.sg1;", - "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", - "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", + "SET SCHEMA TEMPLATE t1 to root.db1;", + "INSERT INTO root.db1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", + "INSERT INTO root.db1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", "flush;", - "INSERT INTO root.sg1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", - "INSERT INTO root.sg1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", + "INSERT INTO root.db1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", + "INSERT INTO root.db1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", // aligned template - "CREATE database root.sg2;", + "CREATE database root.db2;", "CREATE schema template t2 aligned (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t2 to root.sg2;", - "INSERT INTO root.sg2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", + "SET SCHEMA TEMPLATE t2 to root.db2;", + "INSERT INTO root.db2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", "flush;", - "INSERT INTO root.sg2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", - "INSERT INTO root.sg2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", + "INSERT INTO root.db2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", + "INSERT INTO root.db2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", // aligned template with delete - "CREATE database root.sg3;", - "SET SCHEMA TEMPLATE t2 to root.sg3;", - "INSERT INTO root.sg3.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", - "INSERT INTO root.sg3.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", + "CREATE database root.db3;", + "SET SCHEMA TEMPLATE t2 to root.db3;", + "INSERT INTO root.db3.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", + "INSERT INTO root.db3.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", "flush;", - "INSERT INTO root.sg3.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", - "INSERT INTO root.sg3.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", - "delete from root.sg3.d1.s1 where time <= 5;" + "INSERT INTO root.db3.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", + "INSERT INTO root.db3.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", + "delete from root.db3.d1.s1 where time <= 5;" }; @BeforeClass @@ -89,26 +89,26 @@ public void aggregationTest() { String[] expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),last_value(s2)"}; String[] retArray = new String[] { - "root.sg1.d1,1314000000000,13.14,true,", - "root.sg1.d2,1314000000001,13.15,false,", - "root.sg1.d3,1314000000002,13.16,false,", - "root.sg1.d4,1314000000003,13.14,true,", + "root.db1.d1,1314000000000,13.14,true,", + "root.db1.d2,1314000000001,13.15,false,", + "root.db1.d3,1314000000002,13.16,false,", + "root.db1.d4,1314000000003,13.14,true,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg1.** align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db1.** align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),last_value(s2)"}; retArray = new String[] { - "root.sg2.d1,1314000000000,13.14,true,", - "root.sg2.d2,1314000000001,13.15,false,", - "root.sg2.d3,1314000000002,13.16,false,", - "root.sg2.d4,1314000000003,13.14,true,", + "root.db2.d1,1314000000000,13.14,true,", + "root.db2.d2,1314000000001,13.15,false,", + "root.db2.d3,1314000000002,13.16,false,", + "root.db2.d4,1314000000003,13.14,true,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** align by device;", expectedHeader, retArray); @@ -123,23 +123,23 @@ public void filterTest() { String[] expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),last_value(s2)"}; String[] retArray = new String[] { - "root.sg1.d2,1314000000001,13.15,false,", - "root.sg1.d3,1314000000002,13.16,false,", - "root.sg1.d4,5,5555.5,false,", + "root.db1.d2,1314000000001,13.15,false,", + "root.db1.d3,1314000000002,13.16,false,", + "root.db1.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1314000000001,13.15,false,", - "root.sg2.d3,1314000000002,13.16,false,", - "root.sg2.d4,5,5555.5,false,", + "root.db2.d2,1314000000001,13.15,false,", + "root.db2.d3,1314000000002,13.16,false,", + "root.db2.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); @@ -147,23 +147,23 @@ public void filterTest() { expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),count(s2),first_value(s3)"}; retArray = new String[] { - "root.sg1.d2,1314000000001,13.15,4,11,", - "root.sg1.d3,1314000000002,13.16,2,4,", - "root.sg1.d4,5,5555.5,1,5555,", + "root.db1.d2,1314000000001,13.15,4,11,", + "root.db1.d3,1314000000002,13.16,2,4,", + "root.db1.d4,5,5555.5,1,5555,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.sg1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.db1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1314000000001,13.15,4,11,", - "root.sg2.d3,1314000000002,13.16,2,4,", - "root.sg2.d4,5,5555.5,1,5555,", + "root.db2.d2,1314000000001,13.15,4,11,", + "root.db2.d3,1314000000002,13.16,2,4,", + "root.db2.d4,5,5555.5,1,5555,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.sg2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.db2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); @@ -174,22 +174,22 @@ public void filterTest() { }; retArray = new String[] { - "root.sg1.d2,1314000000001,13.15,4,11,13.15,", - "root.sg1.d3,1314000000002,13.16,2,4,13.16,", - "root.sg1.d4,5,5555.5,1,5555,5555.5,", + "root.db1.d2,1314000000001,13.15,4,11,13.15,", + "root.db1.d3,1314000000002,13.16,2,4,13.16,", + "root.db1.d4,5,5555.5,1,5555,5555.5,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3), last_value(s1) FROM root.sg1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3), last_value(s1) FROM root.db1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1314000000001,13.15,4,11,13.15,", - "root.sg2.d3,1314000000002,13.16,2,4,13.16,", - "root.sg2.d4,5,5555.5,1,5555,5555.5,", + "root.db2.d2,1314000000001,13.15,4,11,13.15,", + "root.db2.d3,1314000000002,13.16,2,4,13.16,", + "root.db2.d4,5,5555.5,1,5555,5555.5,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3), last_value(s1) FROM root.sg2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3), last_value(s1) FROM root.db2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); @@ -197,18 +197,18 @@ public void filterTest() { expectedHeader = new String[] {"Device,c1,first_value(s3),c2"}; retArray = new String[] { - "root.sg1.d2,4,11,4,", "root.sg1.d3,2,4,2,", "root.sg1.d4,1,5555,1,", + "root.db1.d2,4,11,4,", "root.db1.d3,2,4,2,", "root.db1.d4,1,5555,1,", }; resultSetEqualTest( - "SELECT count(s1) as c1, first_value(s3), count(s1) as c2 FROM root.sg1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT count(s1) as c1, first_value(s3), count(s1) as c2 FROM root.db1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,4,11,4,", "root.sg2.d3,2,4,2,", "root.sg2.d4,1,5555,1,", + "root.db2.d2,4,11,4,", "root.db2.d3,2,4,2,", "root.db2.d4,1,5555,1,", }; resultSetEqualTest( - "SELECT count(s1) as c1, first_value(s3), count(s1) as c2 FROM root.sg2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT count(s1) as c1, first_value(s3), count(s1) as c2 FROM root.db2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); @@ -217,46 +217,46 @@ public void filterTest() { new String[] {"Device,max_time(s1),count(s1),last_value(s2),count(s1) + last_value(s3)"}; retArray = new String[] { - "root.sg1.d2,1314000000001,4,false,1319.0,", - "root.sg1.d3,1314000000002,2,false,1318.0,", - "root.sg1.d4,5,1,false,5556.0,", + "root.db1.d2,1314000000001,4,false,1319.0,", + "root.db1.d3,1314000000002,2,false,1318.0,", + "root.db1.d4,5,1,false,5556.0,", }; resultSetEqualTest( - "SELECT max_time(s1), count(s1), last_value(s2), count(s1)+last_value(s3) FROM root.sg1.** where s3+1=1316 or s2=false having avg(s1)+sum(s3)>5 align by device;", + "SELECT max_time(s1), count(s1), last_value(s2), count(s1)+last_value(s3) FROM root.db1.** where s3+1=1316 or s2=false having avg(s1)+sum(s3)>5 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1314000000001,4,false,1319.0,", - "root.sg2.d3,1314000000002,2,false,1318.0,", - "root.sg2.d4,5,1,false,5556.0,", + "root.db2.d2,1314000000001,4,false,1319.0,", + "root.db2.d3,1314000000002,2,false,1318.0,", + "root.db2.d4,5,1,false,5556.0,", }; resultSetEqualTest( - "SELECT max_time(s1), count(s1), last_value(s2), count(s1)+last_value(s3) FROM root.sg2.** where s3+1=1316 or s2=false having avg(s1)+sum(s3)>5 align by device;", + "SELECT max_time(s1), count(s1), last_value(s2), count(s1)+last_value(s3) FROM root.db2.** where s3+1=1316 or s2=false having avg(s1)+sum(s3)>5 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),count(s2),first_value(s3)"}; retArray = new String[] { - "root.sg1.d1,1314000000000,13.14,3,2,", - "root.sg1.d2,1314000000001,13.15,4,11,", - "root.sg1.d3,1314000000002,13.16,3,44,", - "root.sg1.d4,1314000000003,13.14,4,1111,", + "root.db1.d1,1314000000000,13.14,3,2,", + "root.db1.d2,1314000000001,13.15,4,11,", + "root.db1.d3,1314000000002,13.16,3,44,", + "root.db1.d4,1314000000003,13.14,4,1111,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.sg1.** where s3>1 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.db1.** where s3>1 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,1314000000000,13.14,3,2,", - "root.sg2.d2,1314000000001,13.15,4,11,", - "root.sg2.d3,1314000000002,13.16,3,44,", - "root.sg2.d4,1314000000003,13.14,4,1111,", + "root.db2.d1,1314000000000,13.14,3,2,", + "root.db2.d2,1314000000001,13.15,4,11,", + "root.db2.d3,1314000000002,13.16,3,44,", + "root.db2.d4,1314000000003,13.14,4,1111,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.sg2.** where s3>1 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.db2.** where s3>1 align by device;", expectedHeader, retArray); } @@ -267,33 +267,33 @@ public void countTimeTest() { String[] expectedHeader = new String[] {"Device,count_time(*)"}; String[] retArray = new String[] { - "root.sg1.d1,4,", "root.sg1.d2,4,", "root.sg1.d3,4,", "root.sg1.d4,4,", + "root.db1.d1,4,", "root.db1.d2,4,", "root.db1.d3,4,", "root.db1.d4,4,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg1.** align by device;", expectedHeader, retArray); + "SELECT count_time(*) FROM root.db1.** align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,4,", "root.sg2.d2,4,", "root.sg2.d3,4,", "root.sg2.d4,4,", + "root.db2.d1,4,", "root.db2.d2,4,", "root.db2.d3,4,", "root.db2.d4,4,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg2.** align by device;", expectedHeader, retArray); + "SELECT count_time(*) FROM root.db2.** align by device;", expectedHeader, retArray); // and filter expectedHeader = new String[] {"Device,count_time(*)"}; retArray = new String[] { - "root.sg1.d1,2,", "root.sg1.d2,4,", "root.sg1.d3,2,", "root.sg1.d4,1,", + "root.db1.d1,2,", "root.db1.d2,4,", "root.db1.d3,2,", "root.db1.d4,1,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg1.** where s3>0 and s2=false align by device;", + "SELECT count_time(*) FROM root.db1.** where s3>0 and s2=false align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,2,", "root.sg2.d2,4,", "root.sg2.d3,2,", "root.sg2.d4,1,", + "root.db2.d1,2,", "root.db2.d2,4,", "root.db2.d3,2,", "root.db2.d4,1,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg2.** where s3>0 and s2=false align by device;", + "SELECT count_time(*) FROM root.db2.** where s3>0 and s2=false align by device;", expectedHeader, retArray); @@ -301,18 +301,18 @@ public void countTimeTest() { expectedHeader = new String[] {"Device,count_time(*)"}; retArray = new String[] { - "root.sg1.d1,2,", "root.sg1.d2,4,", "root.sg1.d3,2,", "root.sg1.d4,1,", + "root.db1.d1,2,", "root.db1.d2,4,", "root.db1.d3,2,", "root.db1.d4,1,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg1.** where s3+1=1316 or s2=false align by device;", + "SELECT count_time(*) FROM root.db1.** where s3+1=1316 or s2=false align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,2,", "root.sg2.d2,4,", "root.sg2.d3,2,", "root.sg2.d4,1,", + "root.db2.d1,2,", "root.db2.d2,4,", "root.db2.d3,2,", "root.db2.d4,1,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg2.** where s3+1=1316 or s2=false align by device;", + "SELECT count_time(*) FROM root.db2.** where s3+1=1316 or s2=false align by device;", expectedHeader, retArray); @@ -320,33 +320,33 @@ public void countTimeTest() { expectedHeader = new String[] {"Time,Device,count_time(*)"}; retArray = new String[] { - "1,root.sg1.d1,2,", - "6,root.sg1.d1,0,", - "1,root.sg1.d2,3,", - "6,root.sg1.d2,0,", - "1,root.sg1.d3,0,", - "6,root.sg1.d3,1,", - "1,root.sg1.d4,1,", - "6,root.sg1.d4,0,", + "1,root.db1.d1,2,", + "6,root.db1.d1,0,", + "1,root.db1.d2,3,", + "6,root.db1.d2,0,", + "1,root.db1.d3,0,", + "6,root.db1.d3,1,", + "1,root.db1.d4,1,", + "6,root.db1.d4,0,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg1.** where s3+1=1316 or s2=false group by ([1,10), 5ms) align by device;", + "SELECT count_time(*) FROM root.db1.** where s3+1=1316 or s2=false group by ([1,10), 5ms) align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,count_time(*)"}; retArray = new String[] { - "1,root.sg2.d1,2,", - "6,root.sg2.d1,0,", - "1,root.sg2.d2,3,", - "6,root.sg2.d2,0,", - "1,root.sg2.d3,0,", - "6,root.sg2.d3,1,", - "1,root.sg2.d4,1,", - "6,root.sg2.d4,0,", + "1,root.db2.d1,2,", + "6,root.db2.d1,0,", + "1,root.db2.d2,3,", + "6,root.db2.d2,0,", + "1,root.db2.d3,0,", + "6,root.db2.d3,1,", + "1,root.db2.d4,1,", + "6,root.db2.d4,0,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg2.** where s3+1=1316 or s2=false group by ([1,10), 5ms) align by device;", + "SELECT count_time(*) FROM root.db2.** where s3+1=1316 or s2=false group by ([1,10), 5ms) align by device;", expectedHeader, retArray); } @@ -357,27 +357,27 @@ public void groupByTest() { new String[] {"Time,Device,max_time(s1),last_value(s1),last_value(s2)"}; String[] retArray = new String[] { - "1,root.sg1.d1,2,2.2,false,", - "5,root.sg1.d1,5,5.5,true,", - "1,root.sg1.d2,2,22.2,false,", - "5,root.sg1.d2,5,50.0,false,", - "1,root.sg1.d3,1,111.1,true,", + "1,root.db1.d1,2,2.2,false,", + "5,root.db1.d1,5,5.5,true,", + "1,root.db1.d2,2,22.2,false,", + "5,root.db1.d2,5,50.0,false,", + "1,root.db1.d3,1,111.1,true,", }; resultSetEqualTest( - "select max_time(s1), last_value(s1), last_value(s2) from root.sg1.** group by ([1,10), 2ms) having last_value(s2) is not null limit 5 align by device;", + "select max_time(s1), last_value(s1), last_value(s2) from root.db1.** group by ([1,10), 2ms) having last_value(s2) is not null limit 5 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,max_time(s1),last_value(s1),last_value(s2)"}; retArray = new String[] { - "1,root.sg2.d1,2,2.2,false,", - "5,root.sg2.d1,5,5.5,true,", - "1,root.sg2.d2,2,22.2,false,", - "5,root.sg2.d2,5,50.0,false,", - "1,root.sg2.d3,1,111.1,true,", + "1,root.db2.d1,2,2.2,false,", + "5,root.db2.d1,5,5.5,true,", + "1,root.db2.d2,2,22.2,false,", + "5,root.db2.d2,5,50.0,false,", + "1,root.db2.d3,1,111.1,true,", }; resultSetEqualTest( - "select max_time(s1), last_value(s1), last_value(s2) from root.sg2.** group by ([1,10), 2ms) having last_value(s2) is not null limit 5 align by device;", + "select max_time(s1), last_value(s1), last_value(s2) from root.db2.** group by ([1,10), 2ms) having last_value(s2) is not null limit 5 align by device;", expectedHeader, retArray); @@ -385,31 +385,31 @@ public void groupByTest() { expectedHeader = new String[] {"Time,Device,max_time(s1),last_value(s1),last_value(s2)"}; retArray = new String[] { - "1,root.sg1.d1,2,2.2,false,", - "1,root.sg1.d2,2,22.2,false,", - "3,root.sg1.d2,5,50.0,false,", - "5,root.sg1.d2,5,50.0,false,", - "7,root.sg1.d3,8,8.8,false,", - "3,root.sg1.d4,5,5555.5,false,", - "5,root.sg1.d4,5,5555.5,false,", + "1,root.db1.d1,2,2.2,false,", + "1,root.db1.d2,2,22.2,false,", + "3,root.db1.d2,5,50.0,false,", + "5,root.db1.d2,5,50.0,false,", + "7,root.db1.d3,8,8.8,false,", + "3,root.db1.d4,5,5555.5,false,", + "5,root.db1.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg1.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db1.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,max_time(s1),last_value(s1),last_value(s2)"}; retArray = new String[] { - "1,root.sg2.d1,2,2.2,false,", - "1,root.sg2.d2,2,22.2,false,", - "3,root.sg2.d2,5,50.0,false,", - "5,root.sg2.d2,5,50.0,false,", - "7,root.sg2.d3,8,8.8,false,", - "3,root.sg2.d4,5,5555.5,false,", - "5,root.sg2.d4,5,5555.5,false,", + "1,root.db2.d1,2,2.2,false,", + "1,root.db2.d2,2,22.2,false,", + "3,root.db2.d2,5,50.0,false,", + "5,root.db2.d2,5,50.0,false,", + "7,root.db2.d3,8,8.8,false,", + "3,root.db2.d4,5,5555.5,false,", + "5,root.db2.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 align by device;", expectedHeader, retArray); } @@ -419,54 +419,54 @@ public void havingTest() { String[] expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),last_value(s2)"}; String[] retArray = new String[] { - "root.sg1.d1,2,2.2,false,", - "root.sg1.d2,1314000000001,13.15,false,", - "root.sg1.d3,1314000000002,13.16,false,", - "root.sg1.d4,5,5555.5,false,", + "root.db1.d1,2,2.2,false,", + "root.db1.d2,1314000000001,13.15,false,", + "root.db1.d3,1314000000002,13.16,false,", + "root.db1.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg1.** where s2=false having avg(s3) > 1 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db1.** where s2=false having avg(s3) > 1 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,2,2.2,false,", - "root.sg2.d2,1314000000001,13.15,false,", - "root.sg2.d3,1314000000002,13.16,false,", - "root.sg2.d4,5,5555.5,false,", + "root.db2.d1,2,2.2,false,", + "root.db2.d2,1314000000001,13.15,false,", + "root.db2.d3,1314000000002,13.16,false,", + "root.db2.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** where s2=false having avg(s3) > 1 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** where s2=false having avg(s3) > 1 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg1.d1,2,2.2,false,", - "root.sg1.d2,1314000000001,13.15,false,", - "root.sg1.d3,1314000000002,13.16,false,", + "root.db1.d1,2,2.2,false,", + "root.db1.d2,1314000000001,13.15,false,", + "root.db1.d3,1314000000002,13.16,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg1.** where s2=false having count(s3)+count(s1) > 2 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db1.** where s2=false having count(s3)+count(s1) > 2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,2,2.2,false,", - "root.sg2.d2,1314000000001,13.15,false,", - "root.sg2.d3,1314000000002,13.16,false,", + "root.db2.d1,2,2.2,false,", + "root.db2.d2,1314000000001,13.15,false,", + "root.db2.d3,1314000000002,13.16,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** where s2=false having count(s3)+count(s1) > 2 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** where s2=false having count(s3)+count(s1) > 2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1314000000001,13.15,false,", + "root.db2.d2,1314000000001,13.15,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** where s2=false having count(s3+s1) > 2 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** where s2=false having count(s3+s1) > 2 align by device;", expectedHeader, retArray); } @@ -476,65 +476,65 @@ public void orderByTest() { String[] expectedHeader = new String[] {"Time,Device,sum(s3)"}; String[] retArray = new String[] { - "4,root.sg1.d1,5.0,", - "4,root.sg1.d2,5.0,", - "4,root.sg1.d3,44.0,", - "4,root.sg1.d4,5555.0,", - "2,root.sg1.d1,2.0,", + "4,root.db1.d1,5.0,", + "4,root.db1.d2,5.0,", + "4,root.db1.d3,44.0,", + "4,root.db1.d4,5555.0,", + "2,root.db1.d1,2.0,", }; resultSetEqualTest( - "select sum(s3) from root.sg1.** where s1>1 GROUP BY([0, 10), 2ms) order by time desc offset 8 limit 5 align by device;", + "select sum(s3) from root.db1.** where s1>1 GROUP BY([0, 10), 2ms) order by time desc offset 8 limit 5 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,sum(s3)"}; retArray = new String[] { - "4,root.sg2.d1,5.0,", - "4,root.sg2.d2,5.0,", - "4,root.sg2.d3,44.0,", - "4,root.sg2.d4,5555.0,", - "2,root.sg2.d1,2.0,", + "4,root.db2.d1,5.0,", + "4,root.db2.d2,5.0,", + "4,root.db2.d3,44.0,", + "4,root.db2.d4,5555.0,", + "2,root.db2.d1,2.0,", }; resultSetEqualTest( - "select sum(s3) from root.sg2.** where s1>1 GROUP BY([0, 10), 2ms) order by time desc offset 8 limit 5 align by device;", + "select sum(s3) from root.db2.** where s1>1 GROUP BY([0, 10), 2ms) order by time desc offset 8 limit 5 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,sum(s3)"}; retArray = new String[] { - "0,root.sg1.d1,1.0,", - "2,root.sg1.d1,2.0,", - "4,root.sg1.d1,5.0,", - "0,root.sg1.d2,11.0,", - "2,root.sg1.d2,22.0,", + "0,root.db1.d1,1.0,", + "2,root.db1.d1,2.0,", + "4,root.db1.d1,5.0,", + "0,root.db1.d2,11.0,", + "2,root.db1.d2,22.0,", }; resultSetEqualTest( - "select sum(s3) from root.sg1.** where s1>1 GROUP BY([0, 10), 2ms) order by count(s2) desc limit 5 align by device;", + "select sum(s3) from root.db1.** where s1>1 GROUP BY([0, 10), 2ms) order by count(s2) desc limit 5 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,sum(s3)"}; retArray = new String[] { - "0,root.sg2.d1,1.0,", - "2,root.sg2.d1,2.0,", - "4,root.sg2.d1,5.0,", - "0,root.sg2.d2,11.0,", - "2,root.sg2.d2,22.0,", + "0,root.db2.d1,1.0,", + "2,root.db2.d1,2.0,", + "4,root.db2.d1,5.0,", + "0,root.db2.d2,11.0,", + "2,root.db2.d2,22.0,", }; resultSetEqualTest( - "select sum(s3) from root.sg2.** where s1>1 GROUP BY([0, 10), 2ms) order by count(s2) desc limit 5 align by device;", + "select sum(s3) from root.db2.** where s1>1 GROUP BY([0, 10), 2ms) order by count(s2) desc limit 5 align by device;", expectedHeader, retArray); // order by non-existent measurement assertTestFail( - "select sum(s3) from root.sg1.** where s1>1 order by count(s_null) desc limit 5 align by device;", + "select sum(s3) from root.db1.** where s1>1 order by count(s_null) desc limit 5 align by device;", "count(s_null) in order by clause doesn't exist."); assertTestFail( - "select sum(s3) from root.sg2.** where s1>1 order by count(s_null) desc limit 5 align by device;", + "select sum(s3) from root.db2.** where s1>1 order by count(s_null) desc limit 5 align by device;", "count(s_null) in order by clause doesn't exist."); } @@ -546,24 +546,24 @@ public void wildCardTest() { }; String[] retArray = new String[] { - "root.sg1.d1,1314000000000,1314000000000,1314000000000,13.14,1314,13.14,true,", - "root.sg1.d2,1314000000001,1314000000001,1314000000001,13.15,1315,13.15,false,", - "root.sg1.d3,1314000000002,1314000000002,1314000000002,13.16,1316,13.16,false,", - "root.sg1.d4,1314000000003,1314000000003,1314000000003,13.14,1314,13.14,true,", + "root.db1.d1,1314000000000,1314000000000,1314000000000,13.14,1314,13.14,true,", + "root.db1.d2,1314000000001,1314000000001,1314000000001,13.15,1315,13.15,false,", + "root.db1.d3,1314000000002,1314000000002,1314000000002,13.16,1316,13.16,false,", + "root.db1.d4,1314000000003,1314000000003,1314000000003,13.14,1314,13.14,true,", }; resultSetEqualTest( - "SELECT max_time(*), last_value(s1), last_value(*) FROM root.sg1.** align by device;", + "SELECT max_time(*), last_value(s1), last_value(*) FROM root.db1.** align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,1314000000000,1314000000000,1314000000000,13.14,1314,13.14,true,", - "root.sg2.d2,1314000000001,1314000000001,1314000000001,13.15,1315,13.15,false,", - "root.sg2.d3,1314000000002,1314000000002,1314000000002,13.16,1316,13.16,false,", - "root.sg2.d4,1314000000003,1314000000003,1314000000003,13.14,1314,13.14,true,", + "root.db2.d1,1314000000000,1314000000000,1314000000000,13.14,1314,13.14,true,", + "root.db2.d2,1314000000001,1314000000001,1314000000001,13.15,1315,13.15,false,", + "root.db2.d3,1314000000002,1314000000002,1314000000002,13.16,1316,13.16,false,", + "root.db2.d4,1314000000003,1314000000003,1314000000003,13.14,1314,13.14,true,", }; resultSetEqualTest( - "SELECT max_time(*), last_value(s1), last_value(*) FROM root.sg2.** align by device;", + "SELECT max_time(*), last_value(s1), last_value(*) FROM root.db2.** align by device;", expectedHeader, retArray); @@ -572,24 +572,24 @@ public void wildCardTest() { new String[] {"Device,max_time(s1),last_value(s3),last_value(s1),last_value(s2),count(s2)"}; retArray = new String[] { - "root.sg1.d1,1314000000000,1314,13.14,true,3,", - "root.sg1.d2,1314000000001,1315,13.15,false,4,", - "root.sg1.d3,1314000000002,1316,13.16,false,3,", - "root.sg1.d4,1314000000003,1314,13.14,true,4,", + "root.db1.d1,1314000000000,1314,13.14,true,3,", + "root.db1.d2,1314000000001,1315,13.15,false,4,", + "root.db1.d3,1314000000002,1316,13.16,false,3,", + "root.db1.d4,1314000000003,1314,13.14,true,4,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(*), count(s2) FROM root.sg1.** where s3>1 align by device;", + "SELECT max_time(s1), last_value(*), count(s2) FROM root.db1.** where s3>1 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,1314000000000,1314,13.14,true,3,", - "root.sg2.d2,1314000000001,1315,13.15,false,4,", - "root.sg2.d3,1314000000002,1316,13.16,false,3,", - "root.sg2.d4,1314000000003,1314,13.14,true,4,", + "root.db2.d1,1314000000000,1314,13.14,true,3,", + "root.db2.d2,1314000000001,1315,13.15,false,4,", + "root.db2.d3,1314000000002,1316,13.16,false,3,", + "root.db2.d4,1314000000003,1314,13.14,true,4,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(*), count(s2) FROM root.sg2.** where s3>1 align by device;", + "SELECT max_time(s1), last_value(*), count(s2) FROM root.db2.** where s3>1 align by device;", expectedHeader, retArray); @@ -597,30 +597,30 @@ public void wildCardTest() { expectedHeader = new String[] {"Time,Device,last_value(s1),last_value(s2)"}; retArray = new String[] { - "1,root.sg1.d1,2.2,false,", - "1,root.sg1.d2,22.2,false,", - "3,root.sg1.d2,50.0,false,", - "5,root.sg1.d2,50.0,false,", - "7,root.sg1.d3,8.8,false,", - "3,root.sg1.d4,5555.5,false,", - "5,root.sg1.d4,5555.5,false,", + "1,root.db1.d1,2.2,false,", + "1,root.db1.d2,22.2,false,", + "3,root.db1.d2,50.0,false,", + "5,root.db1.d2,50.0,false,", + "7,root.db1.d3,8.8,false,", + "3,root.db1.d4,5555.5,false,", + "5,root.db1.d4,5555.5,false,", }; resultSetEqualTest( - "SELECT last_value(*) FROM root.sg1.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 soffset 1 slimit 2 align by device;", + "SELECT last_value(*) FROM root.db1.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 soffset 1 slimit 2 align by device;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,2.2,false,", - "1,root.sg2.d2,22.2,false,", - "3,root.sg2.d2,50.0,false,", - "5,root.sg2.d2,50.0,false,", - "7,root.sg2.d3,8.8,false,", - "3,root.sg2.d4,5555.5,false,", - "5,root.sg2.d4,5555.5,false,", + "1,root.db2.d1,2.2,false,", + "1,root.db2.d2,22.2,false,", + "3,root.db2.d2,50.0,false,", + "5,root.db2.d2,50.0,false,", + "7,root.db2.d3,8.8,false,", + "3,root.db2.d4,5555.5,false,", + "5,root.db2.d4,5555.5,false,", }; resultSetEqualTest( - "SELECT last_value(*) FROM root.sg2.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 soffset 1 slimit 2 align by device;", + "SELECT last_value(*) FROM root.db2.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 soffset 1 slimit 2 align by device;", expectedHeader, retArray); @@ -631,18 +631,18 @@ public void wildCardTest() { }; retArray = new String[] { - "root.sg1.d2,1315,13.15,false,11,11.1,false,", + "root.db1.d2,1315,13.15,false,11,11.1,false,", }; resultSetEqualTest( - "SELECT last_value(*), first_value(*) FROM root.sg1.** where s2=false having count(s3+s1) > 2 align by device;", + "SELECT last_value(*), first_value(*) FROM root.db1.** where s2=false having count(s3+s1) > 2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1315,13.15,false,11,11.1,false,", + "root.db2.d2,1315,13.15,false,11,11.1,false,", }; resultSetEqualTest( - "SELECT last_value(*), first_value(*) FROM root.sg2.** where s2=false having count(s3+s1) > 2 align by device;", + "SELECT last_value(*), first_value(*) FROM root.db2.** where s2=false having count(s3+s1) > 2 align by device;", expectedHeader, retArray); @@ -650,18 +650,18 @@ public void wildCardTest() { expectedHeader = new String[] {"Device,count(s3) + 1,count(s1) + 1,count(s2) + 1"}; retArray = new String[] { - "root.sg1.d2,5.0,5.0,5.0,", + "root.db1.d2,5.0,5.0,5.0,", }; resultSetEqualTest( - "SELECT count(*)+1 FROM root.sg1.** where s2=false having count(s3+s1) > 2 align by device;", + "SELECT count(*)+1 FROM root.db1.** where s2=false having count(s3+s1) > 2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,5.0,5.0,5.0,", + "root.db2.d2,5.0,5.0,5.0,", }; resultSetEqualTest( - "SELECT count(*)+1 FROM root.sg2.** where s2=false having count(s3+s1) > 2 align by device;", + "SELECT count(*)+1 FROM root.db2.** where s2=false having count(s3+s1) > 2 align by device;", expectedHeader, retArray); } @@ -671,16 +671,16 @@ public void orderByTimeWithDeleteTest() { String[] expectedHeader = new String[] {"Device,count(s1)"}; String[] retArray = new String[] { - "root.sg3.d1,1,", "root.sg3.d2,4,", "root.sg3.d3,4,", "root.sg3.d4,4,", + "root.db3.d1,1,", "root.db3.d2,4,", "root.db3.d3,4,", "root.db3.d4,4,", }; resultSetEqualTest( - "select count(s1) from root.sg3.** order by device align by device;", + "select count(s1) from root.db3.** order by device align by device;", expectedHeader, retArray); // to test visitSingeDeviceViewNode in AggregationPushDown resultSetEqualTest( - "select count(s1) from root.sg3.** order by time align by device;", + "select count(s1) from root.db3.** order by time align by device;", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateIT.java index 82758290dbbc8..d560debee81bf 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateIT.java @@ -41,22 +41,22 @@ public class IoTDBAlignByDeviceWithTemplateIT { private static final String[] sqls = new String[] { // non-aligned template - "CREATE database root.sg1;", + "CREATE database root.db1;", "CREATE schema template t1 (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t1 to root.sg1;", - "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", - "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", - "INSERT INTO root.sg1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", - "INSERT INTO root.sg1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", + "SET SCHEMA TEMPLATE t1 to root.db1;", + "INSERT INTO root.db1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", + "INSERT INTO root.db1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", + "INSERT INTO root.db1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", + "INSERT INTO root.db1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", // aligned template - "CREATE database root.sg2;", + "CREATE database root.db2;", "CREATE schema template t2 aligned (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t2 to root.sg2;", - "INSERT INTO root.sg2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", - "INSERT INTO root.sg2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", - "INSERT INTO root.sg2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", + "SET SCHEMA TEMPLATE t2 to root.db2;", + "INSERT INTO root.db2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", + "INSERT INTO root.db2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", + "INSERT INTO root.db2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", }; String[] expectedHeader; @@ -78,18 +78,18 @@ public void singleDeviceTest() { expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; retArray = new String[] { - "1,root.sg1.d1,1,1.1,false,", + "1,root.db1.d1,1,1.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.d1 order by time desc offset 1 limit 1 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.d1 order by time desc offset 1 limit 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1,1.1,false,", + "1,root.db2.d1,1,1.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.d1 order by time desc offset 1 limit 1 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.d1 order by time desc offset 1 limit 1 ALIGN BY DEVICE;", expectedHeader, retArray); } @@ -100,76 +100,76 @@ public void selectWildcardNoFilterTest() { expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; retArray = new String[] { - "1,root.sg1.d1,1,1.1,false,", - "2,root.sg1.d1,2,2.2,false,", - "1,root.sg1.d2,11,11.1,false,", - "2,root.sg1.d2,22,22.2,false,", - "1,root.sg1.d3,null,111.1,true,", - "4,root.sg1.d3,44,444.4,true,", - "1,root.sg1.d4,1111,1111.1,true,", - "5,root.sg1.d4,5555,5555.5,false,", + "1,root.db1.d1,1,1.1,false,", + "2,root.db1.d1,2,2.2,false,", + "1,root.db1.d2,11,11.1,false,", + "2,root.db1.d2,22,22.2,false,", + "1,root.db1.d3,null,111.1,true,", + "4,root.db1.d3,44,444.4,true,", + "1,root.db1.d4,1111,1111.1,true,", + "5,root.db1.d4,5555,5555.5,false,", }; - resultSetEqualTest("SELECT * FROM root.sg1.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT * FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1,1.1,false,", - "2,root.sg2.d1,2,2.2,false,", - "1,root.sg2.d2,11,11.1,false,", - "2,root.sg2.d2,22,22.2,false,", - "1,root.sg2.d3,null,111.1,true,", - "4,root.sg2.d3,44,444.4,true,", - "1,root.sg2.d4,1111,1111.1,true,", - "5,root.sg2.d4,5555,5555.5,false,", + "1,root.db2.d1,1,1.1,false,", + "2,root.db2.d1,2,2.2,false,", + "1,root.db2.d2,11,11.1,false,", + "2,root.db2.d2,22,22.2,false,", + "1,root.db2.d3,null,111.1,true,", + "4,root.db2.d3,44,444.4,true,", + "1,root.db2.d4,1111,1111.1,true,", + "5,root.db2.d4,5555,5555.5,false,", }; - resultSetEqualTest("SELECT * FROM root.sg2.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT * FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,s3,s1,s2,s1"}; retArray = new String[] { - "1,root.sg1.d1,1,1.1,false,1.1,", - "2,root.sg1.d1,2,2.2,false,2.2,", - "1,root.sg1.d2,11,11.1,false,11.1,", - "2,root.sg1.d2,22,22.2,false,22.2,", - "1,root.sg1.d3,null,111.1,true,111.1,", - "4,root.sg1.d3,44,444.4,true,444.4,", - "1,root.sg1.d4,1111,1111.1,true,1111.1,", - "5,root.sg1.d4,5555,5555.5,false,5555.5,", + "1,root.db1.d1,1,1.1,false,1.1,", + "2,root.db1.d1,2,2.2,false,2.2,", + "1,root.db1.d2,11,11.1,false,11.1,", + "2,root.db1.d2,22,22.2,false,22.2,", + "1,root.db1.d3,null,111.1,true,111.1,", + "4,root.db1.d3,44,444.4,true,444.4,", + "1,root.db1.d4,1111,1111.1,true,1111.1,", + "5,root.db1.d4,5555,5555.5,false,5555.5,", }; - resultSetEqualTest("SELECT *, s1 FROM root.sg1.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT *, s1 FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1,1.1,false,1.1,", - "2,root.sg2.d1,2,2.2,false,2.2,", - "1,root.sg2.d2,11,11.1,false,11.1,", - "2,root.sg2.d2,22,22.2,false,22.2,", - "1,root.sg2.d3,null,111.1,true,111.1,", - "4,root.sg2.d3,44,444.4,true,444.4,", - "1,root.sg2.d4,1111,1111.1,true,1111.1,", - "5,root.sg2.d4,5555,5555.5,false,5555.5,", + "1,root.db2.d1,1,1.1,false,1.1,", + "2,root.db2.d1,2,2.2,false,2.2,", + "1,root.db2.d2,11,11.1,false,11.1,", + "2,root.db2.d2,22,22.2,false,22.2,", + "1,root.db2.d3,null,111.1,true,111.1,", + "4,root.db2.d3,44,444.4,true,444.4,", + "1,root.db2.d4,1111,1111.1,true,1111.1,", + "5,root.db2.d4,5555,5555.5,false,5555.5,", }; - resultSetEqualTest("SELECT *, s1 FROM root.sg2.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT *, s1 FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; retArray = new String[] { - "1,root.sg1.d1,1,1.1,false,", - "2,root.sg1.d1,2,2.2,false,", - "1,root.sg1.d2,11,11.1,false,", - "2,root.sg1.d2,22,22.2,false,", + "1,root.db1.d1,1,1.1,false,", + "2,root.db1.d1,2,2.2,false,", + "1,root.db1.d2,11,11.1,false,", + "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.d1,root.sg1.d2,root.sg1.d6 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.d1,root.db1.d2,root.db1.d6 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1,1.1,false,", - "2,root.sg2.d1,2,2.2,false,", - "1,root.sg2.d2,11,11.1,false,", - "2,root.sg2.d2,22,22.2,false,", + "1,root.db2.d1,1,1.1,false,", + "2,root.db2.d1,2,2.2,false,", + "1,root.db2.d2,11,11.1,false,", + "2,root.db2.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.d1,root.sg2.d2,root.sg2.d6 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.d1,root.db2.d2,root.db2.d6 ALIGN BY DEVICE;", expectedHeader, retArray); @@ -177,65 +177,65 @@ public void selectWildcardNoFilterTest() { expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; retArray = new String[] { - "2,root.sg1.d1,2,2.2,false,", "1,root.sg1.d2,11,11.1,false,", + "2,root.db1.d1,2,2.2,false,", "1,root.db1.d2,11,11.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db1.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg2.d1,2,2.2,false,", "1,root.sg2.d2,11,11.1,false,", + "2,root.db2.d1,2,2.2,false,", "1,root.db2.d2,11,11.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db2.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); // 3. order by time retArray = new String[] { - "5,root.sg1.d4,5555,5555.5,false,", - "4,root.sg1.d3,44,444.4,true,", - "2,root.sg1.d1,2,2.2,false,", - "2,root.sg1.d2,22,22.2,false,", - "1,root.sg1.d1,1,1.1,false,", - "1,root.sg1.d2,11,11.1,false,", - "1,root.sg1.d3,null,111.1,true,", - "1,root.sg1.d4,1111,1111.1,true,", + "5,root.db1.d4,5555,5555.5,false,", + "4,root.db1.d3,44,444.4,true,", + "2,root.db1.d1,2,2.2,false,", + "2,root.db1.d2,22,22.2,false,", + "1,root.db1.d1,1,1.1,false,", + "1,root.db1.d2,11,11.1,false,", + "1,root.db1.d3,null,111.1,true,", + "1,root.db1.d4,1111,1111.1,true,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db1.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,5555.5,false,", - "4,root.sg2.d3,44,444.4,true,", - "2,root.sg2.d1,2,2.2,false,", - "2,root.sg2.d2,22,22.2,false,", - "1,root.sg2.d1,1,1.1,false,", - "1,root.sg2.d2,11,11.1,false,", - "1,root.sg2.d3,null,111.1,true,", - "1,root.sg2.d4,1111,1111.1,true,", + "5,root.db2.d4,5555,5555.5,false,", + "4,root.db2.d3,44,444.4,true,", + "2,root.db2.d1,2,2.2,false,", + "2,root.db2.d2,22,22.2,false,", + "1,root.db2.d1,1,1.1,false,", + "1,root.db2.d2,11,11.1,false,", + "1,root.db2.d3,null,111.1,true,", + "1,root.db2.d4,1111,1111.1,true,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db2.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); // 4. order by time + limit/offset retArray = new String[] { - "5,root.sg1.d4,5555,5555.5,false,", "4,root.sg1.d3,44,444.4,true,", - "2,root.sg1.d1,2,2.2,false,", "2,root.sg1.d2,22,22.2,false,", + "5,root.db1.d4,5555,5555.5,false,", "4,root.db1.d3,44,444.4,true,", + "2,root.db1.d1,2,2.2,false,", "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,5555.5,false,", "4,root.sg2.d3,44,444.4,true,", - "2,root.sg2.d1,2,2.2,false,", "2,root.sg2.d2,22,22.2,false,", + "5,root.db2.d4,5555,5555.5,false,", "4,root.db2.d3,44,444.4,true,", + "2,root.db2.d1,2,2.2,false,", "2,root.db2.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); } @@ -246,104 +246,104 @@ public void selectMeasurementNoFilterTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s1"}; String[] retArray = new String[] { - "1,root.sg1.d1,1,1.1,", - "2,root.sg1.d1,2,2.2,", - "1,root.sg1.d2,11,11.1,", - "2,root.sg1.d2,22,22.2,", - "1,root.sg1.d3,null,111.1,", - "4,root.sg1.d3,44,444.4,", - "1,root.sg1.d4,1111,1111.1,", - "5,root.sg1.d4,5555,5555.5,", + "1,root.db1.d1,1,1.1,", + "2,root.db1.d1,2,2.2,", + "1,root.db1.d2,11,11.1,", + "2,root.db1.d2,22,22.2,", + "1,root.db1.d3,null,111.1,", + "4,root.db1.d3,44,444.4,", + "1,root.db1.d4,1111,1111.1,", + "5,root.db1.d4,5555,5555.5,", }; - resultSetEqualTest("SELECT s3,s1 FROM root.sg1.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT s3,s1 FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT s3,s1,s_null FROM root.sg1.** ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT s3,s1,s_null FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1,1.1,", - "2,root.sg2.d1,2,2.2,", - "1,root.sg2.d2,11,11.1,", - "2,root.sg2.d2,22,22.2,", - "1,root.sg2.d3,null,111.1,", - "4,root.sg2.d3,44,444.4,", - "1,root.sg2.d4,1111,1111.1,", - "5,root.sg2.d4,5555,5555.5,", + "1,root.db2.d1,1,1.1,", + "2,root.db2.d1,2,2.2,", + "1,root.db2.d2,11,11.1,", + "2,root.db2.d2,22,22.2,", + "1,root.db2.d3,null,111.1,", + "4,root.db2.d3,44,444.4,", + "1,root.db2.d4,1111,1111.1,", + "5,root.db2.d4,5555,5555.5,", }; - resultSetEqualTest("SELECT s3,s1 FROM root.sg2.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT s3,s1 FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT s3,s1,s_null FROM root.sg2.** ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT s3,s1,s_null FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); // 2. order by device + limit/offset retArray = new String[] { - "2,root.sg1.d1,2,2.2,", "1,root.sg1.d2,11,11.1,", + "2,root.db1.d1,2,2.2,", "1,root.db1.d2,11,11.1,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg1.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db1.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg2.d1,2,2.2,", "1,root.sg2.d2,11,11.1,", + "2,root.db2.d1,2,2.2,", "1,root.db2.d2,11,11.1,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg2.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db2.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); // 3. order by time retArray = new String[] { - "5,root.sg1.d4,5555,5555.5,", - "4,root.sg1.d3,44,444.4,", - "2,root.sg1.d1,2,2.2,", - "2,root.sg1.d2,22,22.2,", - "1,root.sg1.d1,1,1.1,", - "1,root.sg1.d2,11,11.1,", - "1,root.sg1.d3,null,111.1,", - "1,root.sg1.d4,1111,1111.1,", + "5,root.db1.d4,5555,5555.5,", + "4,root.db1.d3,44,444.4,", + "2,root.db1.d1,2,2.2,", + "2,root.db1.d2,22,22.2,", + "1,root.db1.d1,1,1.1,", + "1,root.db1.d2,11,11.1,", + "1,root.db1.d3,null,111.1,", + "1,root.db1.d4,1111,1111.1,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg1.** ORDER BY TIME DESC ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db1.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,5555.5,", - "4,root.sg2.d3,44,444.4,", - "2,root.sg2.d1,2,2.2,", - "2,root.sg2.d2,22,22.2,", - "1,root.sg2.d1,1,1.1,", - "1,root.sg2.d2,11,11.1,", - "1,root.sg2.d3,null,111.1,", - "1,root.sg2.d4,1111,1111.1,", + "5,root.db2.d4,5555,5555.5,", + "4,root.db2.d3,44,444.4,", + "2,root.db2.d1,2,2.2,", + "2,root.db2.d2,22,22.2,", + "1,root.db2.d1,1,1.1,", + "1,root.db2.d2,11,11.1,", + "1,root.db2.d3,null,111.1,", + "1,root.db2.d4,1111,1111.1,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg2.** ORDER BY TIME DESC ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db2.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); // 4. order by time + limit/offset retArray = new String[] { - "5,root.sg1.d4,5555,5555.5,", "4,root.sg1.d3,44,444.4,", - "2,root.sg1.d1,2,2.2,", "2,root.sg1.d2,22,22.2,", + "5,root.db1.d4,5555,5555.5,", "4,root.db1.d3,44,444.4,", + "2,root.db1.d1,2,2.2,", "2,root.db1.d2,22,22.2,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg1.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db1.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,5555.5,", "4,root.sg2.d3,44,444.4,", - "2,root.sg2.d1,2,2.2,", "2,root.sg2.d2,22,22.2,", + "5,root.db2.d4,5555,5555.5,", "4,root.db2.d3,44,444.4,", + "2,root.db2.d1,2,2.2,", "2,root.db2.d2,22,22.2,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg2.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db2.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); } @@ -354,45 +354,45 @@ public void selectWildcardWithFilterOrderByTimeTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; String[] retArray = new String[] { - "4,root.sg1.d3,44,444.4,true,", - "2,root.sg1.d1,2,2.2,false,", - "2,root.sg1.d2,22,22.2,false,", - "1,root.sg1.d1,1,1.1,false,", + "4,root.db1.d3,44,444.4,true,", + "2,root.db1.d1,2,2.2,false,", + "2,root.db1.d2,22,22.2,false,", + "1,root.db1.d1,1,1.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,444.4,true,", - "2,root.sg2.d1,2,2.2,false,", - "2,root.sg2.d2,22,22.2,false,", - "1,root.sg2.d1,1,1.1,false,", + "4,root.db2.d3,44,444.4,true,", + "2,root.db2.d1,2,2.2,false,", + "2,root.db2.d2,22,22.2,false,", + "1,root.db2.d1,1,1.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); // 2. order by time + time filter + value filter retArray = new String[] { - "4,root.sg1.d3,44,444.4,true,", "2,root.sg1.d2,22,22.2,false,", + "4,root.db1.d3,44,444.4,true,", "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT * FROM root.db1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,444.4,true,", "2,root.sg2.d2,22,22.2,false,", + "4,root.db2.d3,44,444.4,true,", "2,root.db2.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT * FROM root.db2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); @@ -400,29 +400,29 @@ public void selectWildcardWithFilterOrderByTimeTest() { // 3. order by time + value filter: s_null > 1 retArray = new String[] {}; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg1.d3,44,444.4,true,", "2,root.sg1.d2,22,22.2,false,", + "4,root.db1.d3,44,444.4,true,", "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE s_null > 1 or " + "SELECT * FROM root.db1.** WHERE s_null > 1 or " + "(time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,444.4,true,", "2,root.sg2.d2,22,22.2,false,", + "4,root.db2.d3,44,444.4,true,", "2,root.db2.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE s_null > 1 or " + "SELECT * FROM root.db2.** WHERE s_null > 1 or " + "(time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); @@ -434,45 +434,45 @@ public void selectWildcardWithFilterOrderByDeviceTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; String[] retArray = new String[] { - "1,root.sg1.d4,1111,1111.1,true,", - "1,root.sg1.d3,null,111.1,true,", - "4,root.sg1.d3,44,444.4,true,", - "1,root.sg1.d2,11,11.1,false,", + "1,root.db1.d4,1111,1111.1,true,", + "1,root.db1.d3,null,111.1,true,", + "4,root.db1.d3,44,444.4,true,", + "1,root.db1.d2,11,11.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d4,1111,1111.1,true,", - "1,root.sg2.d3,null,111.1,true,", - "4,root.sg2.d3,44,444.4,true,", - "1,root.sg2.d2,11,11.1,false,", + "1,root.db2.d4,1111,1111.1,true,", + "1,root.db2.d3,null,111.1,true,", + "4,root.db2.d3,44,444.4,true,", + "1,root.db2.d2,11,11.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); // 2. order by device + time filter + value filter retArray = new String[] { - "4,root.sg1.d3,44,444.4,true,", "2,root.sg1.d2,22,22.2,false,", + "4,root.db1.d3,44,444.4,true,", "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT * FROM root.db1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY DEVICE DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg2.d2,22,22.2,false,", "4,root.sg2.d3,44,444.4,true,", + "2,root.db2.d2,22,22.2,false,", "4,root.db2.d3,44,444.4,true,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT * FROM root.db2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY DEVICE ALIGN BY DEVICE;", expectedHeader, retArray); @@ -480,29 +480,29 @@ public void selectWildcardWithFilterOrderByDeviceTest() { // 3. order by device + value filter: s_null > 1 retArray = new String[] {}; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg1.d3,44,444.4,true,", "2,root.sg1.d2,22,22.2,false,", + "4,root.db1.d3,44,444.4,true,", "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE s_null > 1 or " + "SELECT * FROM root.db1.** WHERE s_null > 1 or " + "(time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) ORDER BY DEVICE DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,444.4,true,", "2,root.sg2.d2,22,22.2,false,", + "4,root.db2.d3,44,444.4,true,", "2,root.db2.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE s_null > 1 or " + "SELECT * FROM root.db2.** WHERE s_null > 1 or " + "(time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) ORDER BY DEVICE DESC ALIGN BY DEVICE;", expectedHeader, retArray); @@ -514,45 +514,45 @@ public void selectMeasurementWithFilterOrderByTimeTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s2"}; String[] retArray = new String[] { - "4,root.sg1.d3,44,true,", - "2,root.sg1.d1,2,false,", - "2,root.sg1.d2,22,false,", - "1,root.sg1.d1,1,false,", + "4,root.db1.d3,44,true,", + "2,root.db1.d1,2,false,", + "2,root.db1.d2,22,false,", + "1,root.db1.d1,1,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db1.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,true,", - "2,root.sg2.d1,2,false,", - "2,root.sg2.d2,22,false,", - "1,root.sg2.d1,1,false,", + "4,root.db2.d3,44,true,", + "2,root.db2.d1,2,false,", + "2,root.db2.d2,22,false,", + "1,root.db2.d1,1,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db2.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); // 2. order by time + time filter + value filter retArray = new String[] { - "4,root.sg1.d3,44,true,", "2,root.sg1.d2,22,false,", + "4,root.db1.d3,44,true,", "2,root.db1.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT s3,s2 FROM root.db1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,true,", "2,root.sg2.d2,22,false,", + "4,root.db2.d3,44,true,", "2,root.db2.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT s3,s2 FROM root.db2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); @@ -560,30 +560,30 @@ public void selectMeasurementWithFilterOrderByTimeTest() { // 3. order by time + value filter: s_null > 1 retArray = new String[] {}; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db1.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db2.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg1.d2,22,false,", + "2,root.db1.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "SELECT s3,s2 FROM root.db1.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "ORDER BY TIME DESC OFFSET 1 LIMIT 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg2.d2,22,false,", + "2,root.db2.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "SELECT s3,s2 FROM root.db2.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "ORDER BY TIME DESC OFFSET 1 LIMIT 1 ALIGN BY DEVICE;", expectedHeader, retArray); @@ -595,45 +595,45 @@ public void selectMeasurementWithFilterOrderByDeviceTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s2"}; String[] retArray = new String[] { - "1,root.sg1.d4,1111,true,", - "1,root.sg1.d3,null,true,", - "4,root.sg1.d3,44,true,", - "1,root.sg1.d2,11,false,", + "1,root.db1.d4,1111,true,", + "1,root.db1.d3,null,true,", + "4,root.db1.d3,44,true,", + "1,root.db1.d2,11,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db1.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d4,1111,true,", - "1,root.sg2.d3,null,true,", - "4,root.sg2.d3,44,true,", - "1,root.sg2.d2,11,false,", + "1,root.db2.d4,1111,true,", + "1,root.db2.d3,null,true,", + "4,root.db2.d3,44,true,", + "1,root.db2.d2,11,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db2.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); // 2. order by device + time filter + value filter retArray = new String[] { - "4,root.sg1.d3,44,true,", "2,root.sg1.d2,22,false,", + "4,root.db1.d3,44,true,", "2,root.db1.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT s3,s2 FROM root.db1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY DEVICE DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,true,", "2,root.sg2.d2,22,false,", + "4,root.db2.d3,44,true,", "2,root.db2.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT s3,s2 FROM root.db2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY DEVICE DESC ALIGN BY DEVICE;", expectedHeader, retArray); @@ -641,30 +641,30 @@ public void selectMeasurementWithFilterOrderByDeviceTest() { // 3. order by device + value filter: s_null > 1 retArray = new String[] {}; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db1.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db2.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg1.d2,22,false,", + "2,root.db1.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "SELECT s3,s2 FROM root.db1.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "ORDER BY DEVICE DESC OFFSET 1 LIMIT 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg2.d2,22,false,", + "2,root.db2.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "SELECT s3,s2 FROM root.db2.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "ORDER BY DEVICE DESC OFFSET 1 LIMIT 1 ALIGN BY DEVICE;", expectedHeader, retArray); @@ -675,66 +675,66 @@ public void aliasTest() { String[] expectedHeader = new String[] {"Time,Device,aa,bb,s3,s2"}; String[] retArray = new String[] { - "1,root.sg1.d1,1.1,false,1,false,", - "2,root.sg1.d1,2.2,false,2,false,", - "1,root.sg1.d2,11.1,false,11,false,", - "2,root.sg1.d2,22.2,false,22,false,", - "1,root.sg1.d3,111.1,true,null,true,", - "4,root.sg1.d3,444.4,true,44,true,", - "1,root.sg1.d4,1111.1,true,1111,true,", - "5,root.sg1.d4,5555.5,false,5555,false,", + "1,root.db1.d1,1.1,false,1,false,", + "2,root.db1.d1,2.2,false,2,false,", + "1,root.db1.d2,11.1,false,11,false,", + "2,root.db1.d2,22.2,false,22,false,", + "1,root.db1.d3,111.1,true,null,true,", + "4,root.db1.d3,444.4,true,44,true,", + "1,root.db1.d4,1111.1,true,1111,true,", + "5,root.db1.d4,5555.5,false,5555,false,", }; resultSetEqualTest( - "SELECT s1 as aa, s2 as bb, s3, s2 FROM root.sg1.** ALIGN BY DEVICE;", + "SELECT s1 as aa, s2 as bb, s3, s2 FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,aa,bb,s3,s2"}; retArray = new String[] { - "1,root.sg2.d1,1.1,false,1,false,", - "2,root.sg2.d1,2.2,false,2,false,", - "1,root.sg2.d2,11.1,false,11,false,", - "2,root.sg2.d2,22.2,false,22,false,", - "1,root.sg2.d3,111.1,true,null,true,", - "4,root.sg2.d3,444.4,true,44,true,", - "1,root.sg2.d4,1111.1,true,1111,true,", - "5,root.sg2.d4,5555.5,false,5555,false,", + "1,root.db2.d1,1.1,false,1,false,", + "2,root.db2.d1,2.2,false,2,false,", + "1,root.db2.d2,11.1,false,11,false,", + "2,root.db2.d2,22.2,false,22,false,", + "1,root.db2.d3,111.1,true,null,true,", + "4,root.db2.d3,444.4,true,44,true,", + "1,root.db2.d4,1111.1,true,1111,true,", + "5,root.db2.d4,5555.5,false,5555,false,", }; resultSetEqualTest( - "SELECT s1 as aa, s2 as bb, s3, s2 FROM root.sg2.** ALIGN BY DEVICE;", + "SELECT s1 as aa, s2 as bb, s3, s2 FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,a,b"}; retArray = new String[] { - "1,root.sg1.d1,1.1,1.1,", - "2,root.sg1.d1,2.2,2.2,", - "1,root.sg1.d2,11.1,11.1,", - "2,root.sg1.d2,22.2,22.2,", - "1,root.sg1.d3,111.1,111.1,", - "4,root.sg1.d3,444.4,444.4,", - "1,root.sg1.d4,1111.1,1111.1,", - "5,root.sg1.d4,5555.5,5555.5,", + "1,root.db1.d1,1.1,1.1,", + "2,root.db1.d1,2.2,2.2,", + "1,root.db1.d2,11.1,11.1,", + "2,root.db1.d2,22.2,22.2,", + "1,root.db1.d3,111.1,111.1,", + "4,root.db1.d3,444.4,444.4,", + "1,root.db1.d4,1111.1,1111.1,", + "5,root.db1.d4,5555.5,5555.5,", }; resultSetEqualTest( - "SELECT s1 as a, s1 as b FROM root.sg1.** ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT s1 as a, s1 as b FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,a,b"}; retArray = new String[] { - "1,root.sg2.d1,1.1,1.1,", - "2,root.sg2.d1,2.2,2.2,", - "1,root.sg2.d2,11.1,11.1,", - "2,root.sg2.d2,22.2,22.2,", - "1,root.sg2.d3,111.1,111.1,", - "4,root.sg2.d3,444.4,444.4,", - "1,root.sg2.d4,1111.1,1111.1,", - "5,root.sg2.d4,5555.5,5555.5,", + "1,root.db2.d1,1.1,1.1,", + "2,root.db2.d1,2.2,2.2,", + "1,root.db2.d2,11.1,11.1,", + "2,root.db2.d2,22.2,22.2,", + "1,root.db2.d3,111.1,111.1,", + "4,root.db2.d3,444.4,444.4,", + "1,root.db2.d4,1111.1,1111.1,", + "5,root.db2.d4,5555.5,5555.5,", }; resultSetEqualTest( - "SELECT s1 as a, s1 as b FROM root.sg2.** ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT s1 as a, s1 as b FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); } @Test @@ -744,33 +744,33 @@ public void orderByExpressionTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; String[] retArray = new String[] { - "5,root.sg1.d4,5555,5555.5,false,", - "2,root.sg1.d2,22,22.2,false,", - "1,root.sg1.d2,11,11.1,false,", - "2,root.sg1.d1,2,2.2,false,", - "1,root.sg1.d1,1,1.1,false,", - "1,root.sg1.d4,1111,1111.1,true,", - "4,root.sg1.d3,44,444.4,true,", - "1,root.sg1.d3,null,111.1,true,", + "5,root.db1.d4,5555,5555.5,false,", + "2,root.db1.d2,22,22.2,false,", + "1,root.db1.d2,11,11.1,false,", + "2,root.db1.d1,2,2.2,false,", + "1,root.db1.d1,1,1.1,false,", + "1,root.db1.d4,1111,1111.1,true,", + "4,root.db1.d3,44,444.4,true,", + "1,root.db1.d3,null,111.1,true,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** order by s2 asc, s1 desc ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** order by s2 asc, s1 desc ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,5555.5,false,", - "2,root.sg2.d2,22,22.2,false,", - "1,root.sg2.d2,11,11.1,false,", - "2,root.sg2.d1,2,2.2,false,", - "1,root.sg2.d1,1,1.1,false,", - "1,root.sg2.d4,1111,1111.1,true,", - "4,root.sg2.d3,44,444.4,true,", - "1,root.sg2.d3,null,111.1,true,", + "5,root.db2.d4,5555,5555.5,false,", + "2,root.db2.d2,22,22.2,false,", + "1,root.db2.d2,11,11.1,false,", + "2,root.db2.d1,2,2.2,false,", + "1,root.db2.d1,1,1.1,false,", + "1,root.db2.d4,1111,1111.1,true,", + "4,root.db2.d3,44,444.4,true,", + "1,root.db2.d3,null,111.1,true,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** order by s2 asc, s1 desc ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** order by s2 asc, s1 desc ALIGN BY DEVICE;", expectedHeader, retArray); @@ -778,65 +778,65 @@ public void orderByExpressionTest() { expectedHeader = new String[] {"Time,Device,s3"}; retArray = new String[] { - "5,root.sg1.d4,5555,", - "2,root.sg1.d2,22,", - "1,root.sg1.d2,11,", - "2,root.sg1.d1,2,", - "1,root.sg1.d1,1,", - "1,root.sg1.d4,1111,", - "4,root.sg1.d3,44,", - "1,root.sg1.d3,null,", + "5,root.db1.d4,5555,", + "2,root.db1.d2,22,", + "1,root.db1.d2,11,", + "2,root.db1.d1,2,", + "1,root.db1.d1,1,", + "1,root.db1.d4,1111,", + "4,root.db1.d3,44,", + "1,root.db1.d3,null,", }; resultSetEqualTest( - "SELECT s3 FROM root.sg1.** order by s2 asc, s1 desc ALIGN BY DEVICE;", + "SELECT s3 FROM root.db1.** order by s2 asc, s1 desc ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,", - "2,root.sg2.d2,22,", - "1,root.sg2.d2,11,", - "2,root.sg2.d1,2,", - "1,root.sg2.d1,1,", - "1,root.sg2.d4,1111,", - "4,root.sg2.d3,44,", - "1,root.sg2.d3,null,", + "5,root.db2.d4,5555,", + "2,root.db2.d2,22,", + "1,root.db2.d2,11,", + "2,root.db2.d1,2,", + "1,root.db2.d1,1,", + "1,root.db2.d4,1111,", + "4,root.db2.d3,44,", + "1,root.db2.d3,null,", }; resultSetEqualTest( - "SELECT s3 FROM root.sg2.** order by s2 asc, s1 desc ALIGN BY DEVICE;", + "SELECT s3 FROM root.db2.** order by s2 asc, s1 desc ALIGN BY DEVICE;", expectedHeader, retArray); // 3. order by expression retArray = new String[] { - "5,root.sg1.d4,5555,", - "1,root.sg1.d4,1111,", - "4,root.sg1.d3,44,", - "2,root.sg1.d2,22,", - "1,root.sg1.d2,11,", - "2,root.sg1.d1,2,", - "1,root.sg1.d1,1,", - "1,root.sg1.d3,null,", + "5,root.db1.d4,5555,", + "1,root.db1.d4,1111,", + "4,root.db1.d3,44,", + "2,root.db1.d2,22,", + "1,root.db1.d2,11,", + "2,root.db1.d1,2,", + "1,root.db1.d1,1,", + "1,root.db1.d3,null,", }; resultSetEqualTest( - "SELECT s3 FROM root.sg1.** order by s1+s3 desc ALIGN BY DEVICE;", + "SELECT s3 FROM root.db1.** order by s1+s3 desc ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,", - "1,root.sg2.d4,1111,", - "4,root.sg2.d3,44,", - "2,root.sg2.d2,22,", - "1,root.sg2.d2,11,", - "2,root.sg2.d1,2,", - "1,root.sg2.d1,1,", - "1,root.sg2.d3,null,", + "5,root.db2.d4,5555,", + "1,root.db2.d4,1111,", + "4,root.db2.d3,44,", + "2,root.db2.d2,22,", + "1,root.db2.d2,11,", + "2,root.db2.d1,2,", + "1,root.db2.d1,1,", + "1,root.db2.d3,null,", }; resultSetEqualTest( - "SELECT s3 FROM root.sg2.** order by s1+s3 desc ALIGN BY DEVICE;", + "SELECT s3 FROM root.db2.** order by s1+s3 desc ALIGN BY DEVICE;", expectedHeader, retArray); } @@ -844,42 +844,42 @@ public void orderByExpressionTest() { @Test public void templateInvalidTest() { // 1. non align by device query - String[] expectedHeader = new String[] {"Time,root.sg1.d4.s3,root.sg1.d4.s1,root.sg1.d4.s2"}; + String[] expectedHeader = new String[] {"Time,root.db1.d4.s3,root.db1.d4.s1,root.db1.d4.s2"}; String[] retArray = new String[] { "1,1111,1111.1,true,", "5,5555,5555.5,false,", }; - resultSetEqualTest("SELECT * FROM root.sg1.** slimit 3;", expectedHeader, retArray); + resultSetEqualTest("SELECT * FROM root.db1.** slimit 3;", expectedHeader, retArray); - expectedHeader = new String[] {"Time,root.sg2.d4.s3,root.sg2.d4.s1,root.sg2.d4.s2"}; + expectedHeader = new String[] {"Time,root.db2.d4.s3,root.db2.d4.s1,root.db2.d4.s2"}; retArray = new String[] { "1,1111,1111.1,true,", "5,5555,5555.5,false,", }; - resultSetEqualTest("SELECT * FROM root.sg2.** slimit 3;", expectedHeader, retArray); + resultSetEqualTest("SELECT * FROM root.db2.** slimit 3;", expectedHeader, retArray); // 2. aggregation expectedHeader = new String[] {"Device,count(s1 + 1)"}; retArray = new String[] { - "root.sg1.d1,2,", "root.sg1.d2,2,", "root.sg1.d3,2,", "root.sg1.d4,2,", + "root.db1.d1,2,", "root.db1.d2,2,", "root.db1.d3,2,", "root.db1.d4,2,", }; resultSetEqualTest( - "select count(s1+1) from root.sg1.** align by device;", expectedHeader, retArray); + "select count(s1+1) from root.db1.** align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Device,count(s1 + 1)"}; retArray = new String[] { - "root.sg2.d1,2,", "root.sg2.d2,2,", "root.sg2.d3,2,", "root.sg2.d4,2,", + "root.db2.d1,2,", "root.db2.d2,2,", "root.db2.d3,2,", "root.db2.d4,2,", }; resultSetEqualTest( - "select count(s1+1) from root.sg2.** align by device;", expectedHeader, retArray); + "select count(s1+1) from root.db2.** align by device;", expectedHeader, retArray); assertTestFail( - "select s1 from root.sg1.** where s1 align by device;", + "select s1 from root.db1.** where s1 align by device;", "The output type of the expression in WHERE clause should be BOOLEAN, actual data type: FLOAT."); assertTestFail( - "select s1 from root.sg2.** where s1 align by device;", + "select s1 from root.db2.** where s1 align by device;", "The output type of the expression in WHERE clause should be BOOLEAN, actual data type: FLOAT."); } @@ -889,78 +889,78 @@ public void sLimitOffsetTest() { String[] expectedHeader = new String[] {"Time,Device,s1"}; String[] retArray = new String[] { - "1,root.sg1.d1,1.1,", - "2,root.sg1.d1,2.2,", - "1,root.sg1.d2,11.1,", - "2,root.sg1.d2,22.2,", - "1,root.sg1.d3,111.1,", - "4,root.sg1.d3,444.4,", - "1,root.sg1.d4,1111.1,", - "5,root.sg1.d4,5555.5,", + "1,root.db1.d1,1.1,", + "2,root.db1.d1,2.2,", + "1,root.db1.d2,11.1,", + "2,root.db1.d2,22.2,", + "1,root.db1.d3,111.1,", + "4,root.db1.d3,444.4,", + "1,root.db1.d4,1111.1,", + "5,root.db1.d4,5555.5,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** slimit 1 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db1.** slimit 1 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1.1,", - "2,root.sg2.d1,2.2,", - "1,root.sg2.d2,11.1,", - "2,root.sg2.d2,22.2,", - "1,root.sg2.d3,111.1,", - "4,root.sg2.d3,444.4,", - "1,root.sg2.d4,1111.1,", - "5,root.sg2.d4,5555.5,", + "1,root.db2.d1,1.1,", + "2,root.db2.d1,2.2,", + "1,root.db2.d2,11.1,", + "2,root.db2.d2,22.2,", + "1,root.db2.d3,111.1,", + "4,root.db2.d3,444.4,", + "1,root.db2.d4,1111.1,", + "5,root.db2.d4,5555.5,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** slimit 1 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db2.** slimit 1 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,s1,s2"}; retArray = new String[] { - "1,root.sg1.d1,1.1,false,", - "2,root.sg1.d1,2.2,false,", - "1,root.sg1.d2,11.1,false,", - "2,root.sg1.d2,22.2,false,", - "1,root.sg1.d3,111.1,true,", - "4,root.sg1.d3,444.4,true,", - "1,root.sg1.d4,1111.1,true,", - "5,root.sg1.d4,5555.5,false,", + "1,root.db1.d1,1.1,false,", + "2,root.db1.d1,2.2,false,", + "1,root.db1.d2,11.1,false,", + "2,root.db1.d2,22.2,false,", + "1,root.db1.d3,111.1,true,", + "4,root.db1.d3,444.4,true,", + "1,root.db1.d4,1111.1,true,", + "5,root.db1.d4,5555.5,false,", }; resultSetEqualTest( - "SELECT *, s1 FROM root.sg1.** slimit 2 soffset 1 ALIGN BY DEVICE;", + "SELECT *, s1 FROM root.db1.** slimit 2 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1.1,false,", - "2,root.sg2.d1,2.2,false,", - "1,root.sg2.d2,11.1,false,", - "2,root.sg2.d2,22.2,false,", - "1,root.sg2.d3,111.1,true,", - "4,root.sg2.d3,444.4,true,", - "1,root.sg2.d4,1111.1,true,", - "5,root.sg2.d4,5555.5,false,", + "1,root.db2.d1,1.1,false,", + "2,root.db2.d1,2.2,false,", + "1,root.db2.d2,11.1,false,", + "2,root.db2.d2,22.2,false,", + "1,root.db2.d3,111.1,true,", + "4,root.db2.d3,444.4,true,", + "1,root.db2.d4,1111.1,true,", + "5,root.db2.d4,5555.5,false,", }; resultSetEqualTest( - "SELECT *, s1 FROM root.sg2.** slimit 2 soffset 1 ALIGN BY DEVICE;", + "SELECT *, s1 FROM root.db2.** slimit 2 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,s1"}; retArray = new String[] { - "1,root.sg1.d1,1.1,", "2,root.sg1.d1,2.2,", "1,root.sg1.d2,11.1,", "2,root.sg1.d2,22.2,", + "1,root.db1.d1,1.1,", "2,root.db1.d1,2.2,", "1,root.db1.d2,11.1,", "2,root.db1.d2,22.2,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.d1,root.sg1.d2,root.sg1.d6 soffset 1 slimit 1 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.d1,root.db1.d2,root.db1.d6 soffset 1 slimit 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1.1,", "2,root.sg2.d1,2.2,", "1,root.sg2.d2,11.1,", "2,root.sg2.d2,22.2,", + "1,root.db2.d1,1.1,", "2,root.db2.d1,2.2,", "1,root.db2.d2,11.1,", "2,root.db2.d2,22.2,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.d1,root.sg2.d2,root.sg2.d6 soffset 1 slimit 1 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.d1,root.db2.d2,root.db2.d6 soffset 1 slimit 1 ALIGN BY DEVICE;", expectedHeader, retArray); } @@ -973,12 +973,12 @@ public void emptyResultTest() { // is changed from 'time>=now()-1d' to 'time>=now()-1ms' to reduce memory use because of the // creation of timeslots. resultSetEqualTest( - "SELECT * FROM root.sg1.** where time>=now()-1ms and time<=now() " + "SELECT * FROM root.db1.** where time>=now()-1ms and time<=now() " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT * FROM root.sg2.** where time>=now()-1ms and time<=now() " + "SELECT * FROM root.db2.** where time>=now()-1ms and time<=now() " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink1IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink1IT.java index 095783fdd20bb..7909a44cf5f78 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink1IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink1IT.java @@ -47,11 +47,11 @@ public class IoTDBShuffleSink1IT { // two devices protected static final String[] MULTI_SERIES = new String[] { - "create database root.sg", - "insert into root.sg.d1(time,s1,s2) values (1,2,2)", - "insert into root.sg.d1(time,s1,s2) values (now(),3,3)", - "insert into root.sg.d2(time,s1,s2) values (1,4,4)", - "insert into root.sg.d2(time,s1,s2) values (now(),5,5)" + "create database root.db", + "insert into root.db.d1(time,s1,s2) values (1,2,2)", + "insert into root.db.d1(time,s1,s2) values (now(),3,3)", + "insert into root.db.d2(time,s1,s2) values (1,4,4)", + "insert into root.db.d2(time,s1,s2) values (now(),5,5)" }; @BeforeClass @@ -80,10 +80,10 @@ public void testCountAlignByDeviceOrderByDeviceWithoutValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** align by device", expectedHeader2, retArray2); + "select count(s1),count(s2) from root.db.** align by device", expectedHeader2, retArray2); } @Test @@ -99,10 +99,10 @@ public void testCountAlignByDeviceOrderByDeviceWithValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,1,1,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,1,1,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** where s1 <= 4 align by device", + "select count(s1),count(s2) from root.db.** where s1 <= 4 align by device", expectedHeader2, retArray2); } @@ -120,10 +120,10 @@ public void testCountAlignByDeviceOrderByTimeWithoutValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** order by time align by device", + "select count(s1),count(s2) from root.db.** order by time align by device", expectedHeader2, retArray2); } @@ -141,10 +141,10 @@ public void testCountAlignByDeviceOrderByTimeWithValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,1,1,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,1,1,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** where s1 <= 4 order by time align by device", + "select count(s1),count(s2) from root.db.** where s1 <= 4 order by time align by device", expectedHeader2, retArray2); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink2IT.java index 17368548d8598..63c03d9d3b4eb 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink2IT.java @@ -50,24 +50,24 @@ public class IoTDBShuffleSink2IT { // three devices, three data regions protected static final String[] MULTI_SERIES = new String[] { - "create database root.sg", - "insert into root.sg.d1(time,s1,s2) values (1,1,1)", - "insert into root.sg.d1(time,s1,s2) values (now(),2,2)", - "insert into root.sg.d2(time,s1,s2) values (now(),3,3)", - "insert into root.sg.d2(time,s1,s2) values (1,4,4)", - "insert into root.sg.d3(time,s1,s2) values (now(),5,5)", - "insert into root.sg.d3(time,s1,s2) values (1,6,6)" + "create database root.db", + "insert into root.db.d1(time,s1,s2) values (1,1,1)", + "insert into root.db.d1(time,s1,s2) values (now(),2,2)", + "insert into root.db.d2(time,s1,s2) values (now(),3,3)", + "insert into root.db.d2(time,s1,s2) values (1,4,4)", + "insert into root.db.d3(time,s1,s2) values (now(),5,5)", + "insert into root.db.d3(time,s1,s2) values (1,6,6)" }; // three devices, three data regions, d3 has only one region protected static final String[] SECOND_MULTI_SERIES = new String[] { - "create database root.sg1", - "insert into root.sg1.d1(time,s1,s2) values (1,1,1)", - "insert into root.sg1.d1(time,s1,s2) values (now(),2,2)", - "insert into root.sg1.d2(time,s1,s2) values (now(),3,3)", - "insert into root.sg1.d2(time,s1,s2) values (1,4,4)", - "insert into root.sg1.d3(time,s1,s2) values (1,6,6)" + "create database root.db1", + "insert into root.db1.d1(time,s1,s2) values (1,1,1)", + "insert into root.db1.d1(time,s1,s2) values (now(),2,2)", + "insert into root.db1.d2(time,s1,s2) values (now(),3,3)", + "insert into root.db1.d2(time,s1,s2) values (1,4,4)", + "insert into root.db1.d3(time,s1,s2) values (1,6,6)" }; @BeforeClass @@ -98,17 +98,17 @@ public void testCountAlignByDeviceOrderByDeviceWithoutValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,", "root.sg.d3,2,2,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,", "root.db.d3,2,2,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** align by device", expectedHeader2, retArray2); + "select count(s1),count(s2) from root.db.** align by device", expectedHeader2, retArray2); // result of SECOND_MULTI_SERIES String expectedHeader3 = "Device,count(s1),count(s2),"; - String[] retArray3 = new String[] {"root.sg1.d1,2,2,", "root.sg1.d2,2,2,", "root.sg1.d3,1,1,"}; + String[] retArray3 = new String[] {"root.db1.d1,2,2,", "root.db1.d2,2,2,", "root.db1.d3,1,1,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg1.** align by device", expectedHeader3, retArray3); + "select count(s1),count(s2) from root.db1.** align by device", expectedHeader3, retArray3); } @Test @@ -125,19 +125,19 @@ public void testCountAlignByDeviceOrderByDeviceWithValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,", "root.sg.d3,0,0,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,", "root.db.d3,0,0,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** where s1 <= 4 align by device", + "select count(s1),count(s2) from root.db.** where s1 <= 4 align by device", expectedHeader2, retArray2); // result of SECOND_MULTI_SERIES String expectedHeader3 = "Device,count(s1),count(s2),"; - String[] retArray3 = new String[] {"root.sg1.d1,2,2,", "root.sg1.d2,2,2,", "root.sg1.d3,0,0,"}; + String[] retArray3 = new String[] {"root.db1.d1,2,2,", "root.db1.d2,2,2,", "root.db1.d3,0,0,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg1.** where s1 <= 4 align by device", + "select count(s1),count(s2) from root.db1.** where s1 <= 4 align by device", expectedHeader3, retArray3); } @@ -156,19 +156,19 @@ public void testCountAlignByDeviceOrderByTimeWithoutValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,", "root.sg.d3,2,2,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,", "root.db.d3,2,2,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** order by time align by device", + "select count(s1),count(s2) from root.db.** order by time align by device", expectedHeader2, retArray2); // result of SECOND_MULTI_SERIES String expectedHeader3 = "Device,count(s1),count(s2),"; - String[] retArray3 = new String[] {"root.sg1.d1,2,2,", "root.sg1.d2,2,2,", "root.sg1.d3,1,1,"}; + String[] retArray3 = new String[] {"root.db1.d1,2,2,", "root.db1.d2,2,2,", "root.db1.d3,1,1,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg1.** order by time align by device", + "select count(s1),count(s2) from root.db1.** order by time align by device", expectedHeader3, retArray3); } @@ -187,19 +187,19 @@ public void testCountAlignByDeviceOrderByTimeWithValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,", "root.sg.d3,0,0,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,", "root.db.d3,0,0,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** where s1 <= 4 order by time align by device", + "select count(s1),count(s2) from root.db.** where s1 <= 4 order by time align by device", expectedHeader2, retArray2); // result of MULTI_SERIES String expectedHeader3 = "Device,count(s1),count(s2),"; - String[] retArray3 = new String[] {"root.sg1.d1,2,2,", "root.sg1.d2,2,2,", "root.sg1.d3,0,0,"}; + String[] retArray3 = new String[] {"root.db1.d1,2,2,", "root.db1.d2,2,2,", "root.db1.d3,0,0,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg1.** where s1 <= 4 order by time align by device", + "select count(s1),count(s2) from root.db1.** where s1 <= 4 order by time align by device", expectedHeader3, retArray3); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletion2IT.java index 8d69a09e89725..36f13110e4017 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletion2IT.java @@ -55,8 +55,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 21"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 21"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletionIT.java index d16587ac45354..45b7e4fe8bb92 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletionIT.java @@ -62,8 +62,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 21"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 21"); } catch (Exception e) { fail(e.getMessage()); e.printStackTrace(); @@ -79,15 +79,15 @@ public static void tearDown() throws Exception { public void countAllAlignedWithoutTimeFilterTest() { String[] retArray = new String[] {"1", "28", "19", "20"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -118,20 +118,20 @@ public void countAllAlignedWithoutTimeFilterTest() { public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { String[] retArray = new String[] {"1", "28", "19", "20", "19", "29", "28", "18", "19"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)", - "count(root.sg1.d2.s1)", - "count(root.sg1.d2.s2)", - "count(root.sg1.d2.s3)", - "count(root.sg1.d2.s4)", - "count(root.sg1.d2.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)", + "count(root.db1.d2.s1)", + "count(root.db1.d2.s2)", + "count(root.db1.d2.s3)", + "count(root.db1.d2.s4)", + "count(root.db1.d2.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -162,17 +162,17 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { public void countAllAlignedWithTimeFilterTest() { String[] retArray = new String[] {"1", "22", "13", "6"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 where time >= 9 and time <= 33")) { + "select count(*) from root.db1.d1 where time >= 9 and time <= 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -204,19 +204,19 @@ public void countAllAlignedWithTimeFilterTest() { public void aggregateSomeAlignedWithoutTimeFilterTest() { double[] retArray = new double[] {1, 28, 230000, 390417, 230000, 13943.464285714286}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "sum(root.sg1.d1.s1)", - "sum(root.sg1.d1.s3)", - "avg(root.sg1.d1.s1)", - "avg(root.sg1.d1.s3)", + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "sum(root.db1.d1.s1)", + "sum(root.db1.d1.s3)", + "avg(root.db1.d1.s1)", + "avg(root.db1.d1.s3)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(s1),count (s3),sum(s1),sum(s3),avg(s1),avg(s3) from root.sg1.d1")) { + "select count(s1),count (s3),sum(s1),sum(s3),avg(s1),avg(s3) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -248,19 +248,19 @@ public void aggregateSomeAlignedWithoutTimeFilterTest() { public void aggregateSomeAlignedWithTimeFilterTest() { double[] retArray = new double[] {1, 15, 230000, 230322, 230000, 15354.8}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "sum(root.sg1.d1.s1)", - "sum(root.sg1.d1.s3)", - "avg(root.sg1.d1.s1)", - "avg(root.sg1.d1.s3)", + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "sum(root.db1.d1.s1)", + "sum(root.db1.d1.s3)", + "avg(root.db1.d1.s1)", + "avg(root.db1.d1.s3)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(s1),count (s3),sum(s1),sum(s3),avg(s1),avg(s3) from root.sg1.d1 where time>=16 and time<=34")) { + "select count(s1),count (s3),sum(s1),sum(s3),avg(s1),avg(s3) from root.db1.d1 where time>=16 and time<=34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -290,12 +290,12 @@ public void aggregateSomeAlignedWithTimeFilterTest() { @Test public void countSingleAlignedWithTimeFilterTest() { String[] retArray = new String[] {"0"}; - String[] columnNames = {"count(root.sg1.d1.s1)"}; + String[] columnNames = {"count(root.db1.d1.s1)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(s1) from root.sg1.d1 where time>=16 and time<=20")) { + statement.executeQuery("select count(s1) from root.db1.d1 where time>=16 and time<=20")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -327,12 +327,12 @@ public void countSingleAlignedWithTimeFilterTest() { @Test public void sumSingleAlignedWithTimeFilterTest() { String[] retArray = new String[] {"null"}; - String[] columnNames = {"sum(root.sg1.d1.s1)"}; + String[] columnNames = {"sum(root.db1.d1.s1)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select sum(s1) from root.sg1.d1 where time>=16 and time<=20")) { + statement.executeQuery("select sum(s1) from root.db1.d1 where time>=16 and time<=20")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -364,12 +364,12 @@ public void sumSingleAlignedWithTimeFilterTest() { @Test public void avgSingleAlignedWithTimeFilterTest() { String[] retArray = new String[] {"null"}; - String[] columnNames = {"avg(root.sg1.d1.s1)"}; + String[] columnNames = {"avg(root.db1.d1.s1)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select avg(s1) from root.sg1.d1 where time>=16 and time<=20")) { + statement.executeQuery("select avg(s1) from root.db1.d1 where time>=16 and time<=20")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -402,12 +402,12 @@ public void avgSingleAlignedWithTimeFilterTest() { @Test public void countAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"11"}; - String[] columnNames = {"count(root.sg1.d1.s4)"}; + String[] columnNames = {"count(root.db1.d1.s4)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(s4) from root.sg1.d1 where s4 = true")) { + statement.executeQuery("select count(s4) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -438,16 +438,16 @@ public void countAlignedWithValueFilterTest() throws ClassNotFoundException { public void countAllAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"0", "9", "11", "6"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.d1 where s4 = true")) { + statement.executeQuery("select count(*) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -478,14 +478,14 @@ public void countAllAlignedWithValueFilterTest() throws ClassNotFoundException { public void aggregationAllAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"0", "25", "1"}; String[] columnNames = { - "count(root.sg1.d1.s1)", "max_time(root.sg1.d1.s4)", "min_value(root.sg1.d1.s3)", + "count(root.db1.d1.s1)", "max_time(root.db1.d1.s4)", "min_value(root.db1.d1.s3)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), max_time(s4), min_value(s3) from root.sg1.d1 where s4 = true")) { + "select count(s1), max_time(s4), min_value(s3) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java index 514757ccbaca5..3944132a6f0f4 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java @@ -76,17 +76,17 @@ public void selectAllAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "40,root.sg1.d1.s2,40,INT32", - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "40,root.db1.d1.s2,40,INT32", + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -115,22 +115,22 @@ public void selectAllAlignedAndNonAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "40,root.sg1.d1.s2,40,INT32", - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "20,root.sg1.d2.s1,20.0,FLOAT", - "40,root.sg1.d2.s2,40,INT32", - "30,root.sg1.d2.s3,30,INT64", - "30,root.sg1.d2.s4,false,BOOLEAN", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "40,root.db1.d1.s2,40,INT32", + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT", + "20,root.db1.d2.s1,20.0,FLOAT", + "40,root.db1.d2.s2,40,INT32", + "30,root.db1.d2.s3,30,INT64", + "30,root.db1.d2.s4,false,BOOLEAN", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.* order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.* order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -158,14 +158,14 @@ public void selectAllAlignedLastWithTimeFilterTest() { Set retSet = new HashSet<>( - Arrays.asList("40,root.sg1.d1.s2,40,INT32", "40,root.sg1.d1.s5,aligned_test40,TEXT")); + Arrays.asList("40,root.db1.d1.s2,40,INT32", "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last * from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last * from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -193,16 +193,16 @@ public void selectSomeAlignedLastTest1() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -229,13 +229,13 @@ public void selectSomeAlignedLastTest1() { public void selectSomeAlignedLastTest2() { Set retSet = new HashSet<>( - Arrays.asList("23,root.sg1.d1.s1,230000.0,FLOAT", "30,root.sg1.d1.s4,false,BOOLEAN")); + Arrays.asList("23,root.db1.d1.s1,230000.0,FLOAT", "30,root.db1.d1.s4,false,BOOLEAN")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last s1, s4 from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last s1, s4 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -262,14 +262,14 @@ public void selectSomeAlignedLastTest2() { public void selectSomeAlignedLastWithTimeFilterTest() { Set retSet = - new HashSet<>(Collections.singletonList("40,root.sg1.d1.s5,aligned_test40,TEXT")); + new HashSet<>(Collections.singletonList("40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -298,8 +298,8 @@ public void selectSomeAlignedAndNonAlignedLastWithTimeFilterTest() { Set retSet = new HashSet<>( Arrays.asList( - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "40,root.db1.d1.s5,aligned_test40,TEXT", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -307,7 +307,7 @@ public void selectSomeAlignedAndNonAlignedLastWithTimeFilterTest() { // 1 4 5 try (ResultSet resultSet = statement.executeQuery( - "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time > 30 order by timeseries asc")) { + "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryIT.java index 64ef126853127..0e43f359dc0f3 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryIT.java @@ -127,13 +127,13 @@ public void selectAllAlignedWithoutValueFilterTest() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select * from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -208,22 +208,22 @@ public void selectAllAlignedAndNonAlignedTest() { }; String[] columnNames = { - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5", - "root.sg1.d2.s1", - "root.sg1.d2.s2", - "root.sg1.d2.s3", - "root.sg1.d2.s4", - "root.sg1.d2.s5" + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5", + "root.db1.d2.s1", + "root.db1.d2.s2", + "root.db1.d2.s3", + "root.db1.d2.s4", + "root.db1.d2.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select * from root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -283,14 +283,14 @@ public void selectAllAlignedWithTimeFilterTest() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where time >= 9 and time <= 33")) { + statement.executeQuery("select * from root.db1.d1 where time >= 9 and time <= 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -364,12 +364,12 @@ public void selectSomeAlignedWithoutValueFilterTest1() { "40,null,null,aligned_test40", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select s1,s4,s5 from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1,s4,s5 from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -433,12 +433,12 @@ public void selectSomeAlignedWithoutValueFilterTest2() { "30,null,false", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select s1,s4 from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1,s4 from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -491,14 +491,14 @@ public void selectSomeAlignedWithTimeFilterTest() { "34,null,null,aligned_test34", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where time >= 16 and time <= 34")) { + "select s1,s4,s5 from root.db1.d1 where time >= 16 and time <= 34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -552,12 +552,12 @@ public void selectSomeAlignedAndNonAlignedWithTimeFilterTest() { }; String[] columnNames = { - "root.sg1.d2.s5", - "root.sg1.d1.s4", - "root.sg1.d2.s1", - "root.sg1.d1.s5", - "root.sg1.d2.s4", - "root.sg1.d1.s1" + "root.db1.d2.s5", + "root.db1.d1.s4", + "root.db1.d2.s1", + "root.db1.d1.s5", + "root.db1.d2.s4", + "root.db1.d1.s1" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -565,7 +565,7 @@ public void selectSomeAlignedAndNonAlignedWithTimeFilterTest() { try (ResultSet resultSet = statement.executeQuery( - "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time >= 16 and time <= 34")) { + "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time >= 16 and time <= 34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -612,14 +612,14 @@ public void selectAllAlignedWithValueFilterTest1() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where s4 = true")) { + statement.executeQuery("select * from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -662,14 +662,14 @@ public void selectAllAlignedWithValueFilterTest2() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where s1 > 11 and s2 <= 33")) { + statement.executeQuery("select * from root.db1.d1 where s1 > 11 and s2 <= 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -727,14 +727,14 @@ public void selectAllAlignedWithValueFilterTest3() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where s1 >= 13 or s2 < 33")) { + statement.executeQuery("select * from root.db1.d1 where s1 >= 13 or s2 < 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -774,16 +774,16 @@ public void selectAllAlignedAndNonAlignedTest1() { }; String[] columnNames = { - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5", - "root.sg1.d2.s1", - "root.sg1.d2.s2", - "root.sg1.d2.s3", - "root.sg1.d2.s4", - "root.sg1.d2.s5" + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5", + "root.db1.d2.s1", + "root.db1.d2.s2", + "root.db1.d2.s3", + "root.db1.d2.s4", + "root.db1.d2.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -791,7 +791,7 @@ public void selectAllAlignedAndNonAlignedTest1() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.* where root.sg1.d1.s2 > 16 and root.sg1.d2.s3 <= 36")) { + "select * from root.db1.* where root.db1.d1.s2 > 16 and root.db1.d2.s3 <= 36")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -849,16 +849,16 @@ public void selectAllAlignedAndNonAlignedTest2() { }; String[] columnNames = { - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5", - "root.sg1.d2.s1", - "root.sg1.d2.s2", - "root.sg1.d2.s3", - "root.sg1.d2.s4", - "root.sg1.d2.s5" + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5", + "root.db1.d2.s1", + "root.db1.d2.s2", + "root.db1.d2.s3", + "root.db1.d2.s4", + "root.db1.d2.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -866,7 +866,7 @@ public void selectAllAlignedAndNonAlignedTest2() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.* where root.sg1.d1.s2 > 16 or root.sg1.d2.s4 = false")) { + "select * from root.db1.* where root.db1.d1.s2 > 16 or root.db1.d2.s4 = false")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -909,7 +909,7 @@ public void selectAllAlignedWithTimeAndValueFilterTest1() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -917,7 +917,7 @@ public void selectAllAlignedWithTimeAndValueFilterTest1() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where time >= 9 and time <= 33 and s1 < 19")) { + "select * from root.db1.d1 where time >= 9 and time <= 33 and s1 < 19")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -979,7 +979,7 @@ public void selectAllAlignedWithTimeAndValueFilterTest2() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -987,7 +987,7 @@ public void selectAllAlignedWithTimeAndValueFilterTest2() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where time >= 9 and time <= 33 or s5 = 'aligned_test36' or s5 = 'aligned_test37'")) { + "select * from root.db1.d1 where time >= 9 and time <= 33 or s5 = 'aligned_test36' or s5 = 'aligned_test37'")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1027,7 +1027,7 @@ public void selectAllAlignedWithLimitOffsetTest() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -1035,7 +1035,7 @@ public void selectAllAlignedWithLimitOffsetTest() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where time >= 9 and time <= 33 offset 5 limit 5")) { + "select * from root.db1.d1 where time >= 9 and time <= 33 offset 5 limit 5")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1083,14 +1083,14 @@ public void selectSomeAlignedWithValueFilterTest1() { "34,null,null,aligned_test34", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where s1 < 17 or s5 = 'aligned_test34'")) { + "select s1,s4,s5 from root.db1.d1 where s1 < 17 or s5 = 'aligned_test34'")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1125,13 +1125,13 @@ public void selectSomeAlignedWithValueFilterTest2() { "7,7.0,false", "9,9.0,false", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1,s4 from root.sg1.d1 where s1 < 19 and s4 = false")) { + statement.executeQuery("select s1,s4 from root.db1.d1 where s1 < 19 and s4 = false")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1171,14 +1171,14 @@ public void selectSomeAlignedWithTimeAndValueFilterTest() { "30,null,false,null", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where time >= 16 and time <= 34 and s4=false")) { + "select s1,s4,s5 from root.db1.d1 where time >= 16 and time <= 34 and s4=false")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1221,12 +1221,12 @@ public void selectSomeAlignedAndNonAlignedWithTimeAndValueFilterTest() { }; String[] columnNames = { - "root.sg1.d2.s5", - "root.sg1.d1.s4", - "root.sg1.d2.s1", - "root.sg1.d1.s5", - "root.sg1.d2.s4", - "root.sg1.d1.s1" + "root.db1.d2.s5", + "root.db1.d1.s4", + "root.db1.d2.s1", + "root.db1.d1.s5", + "root.db1.d2.s4", + "root.db1.d1.s1" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -1234,7 +1234,7 @@ public void selectSomeAlignedAndNonAlignedWithTimeAndValueFilterTest() { try (ResultSet resultSet = statement.executeQuery( - "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time >= 16 and time <= 34 and (d1.s1 >= 18 or d2.s4 = true)")) { + "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time >= 16 and time <= 34 and (d1.s1 >= 18 or d2.s4 = true)")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1266,16 +1266,16 @@ public void selectSomeAlignedAndNonAlignedWithTimeAndValueFilterTest() { public void countAllAlignedWithoutTimeFilterTest() { String[] retArray = new String[] {"20", "29", "28", "19", "20"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1306,21 +1306,21 @@ public void countAllAlignedWithoutTimeFilterTest() { public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { String[] retArray = new String[] {"20", "29", "28", "19", "20", "19", "29", "28", "18", "19"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)", - "count(root.sg1.d2.s1)", - "count(root.sg1.d2.s2)", - "count(root.sg1.d2.s3)", - "count(root.sg1.d2.s4)", - "count(root.sg1.d2.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)", + "count(root.db1.d2.s1)", + "count(root.db1.d2.s2)", + "count(root.db1.d2.s3)", + "count(root.db1.d2.s4)", + "count(root.db1.d2.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1351,18 +1351,18 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { public void countAllAlignedWithTimeFilterTest() { String[] retArray = new String[] {"12", "15", "22", "13", "6"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 where time >= 9 and time <= 33")) { + "select count(*) from root.db1.d1 where time >= 9 and time <= 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1397,22 +1397,22 @@ public void aggregateSomeAlignedWithoutTimeFilterTest() { 20, 29, 28, 390184, 130549, 390417, 19509.2, 4501.689655172413, 13943.464285714286 }; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "sum(root.sg1.d1.s1)", - "sum(root.sg1.d1.s2)", - "sum(root.sg1.d1.s3)", - "avg(root.sg1.d1.s1)", - "avg(root.sg1.d1.s2)", - "avg(root.sg1.d1.s3)", + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "sum(root.db1.d1.s1)", + "sum(root.db1.d1.s2)", + "sum(root.db1.d1.s3)", + "avg(root.db1.d1.s1)", + "avg(root.db1.d1.s2)", + "avg(root.db1.d1.s3)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(s1),count(s2),count(s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.sg1.d1")) { + "select count(s1),count(s2),count(s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1447,22 +1447,22 @@ public void aggregateSomeAlignedWithTimeFilterTest() { 6, 9, 15, 230090, 220, 230322, 38348.333333333336, 24.444444444444443, 15354.8 }; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "sum(root.sg1.d1.s1)", - "sum(root.sg1.d1.s2)", - "sum(root.sg1.d1.s3)", - "avg(root.sg1.d1.s1)", - "avg(root.sg1.d1.s2)", - "avg(root.sg1.d1.s3)", + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "sum(root.db1.d1.s1)", + "sum(root.db1.d1.s2)", + "sum(root.db1.d1.s3)", + "avg(root.db1.d1.s1)", + "avg(root.db1.d1.s2)", + "avg(root.db1.d1.s3)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(s1),count (s2),count (s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.sg1.d1 where time>=16 and time<=34")) { + "select count(s1),count (s2),count (s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.db1.d1 where time>=16 and time<=34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1492,12 +1492,12 @@ public void aggregateSomeAlignedWithTimeFilterTest() { @Test public void countSingleAlignedWithTimeFilterTest() { String[] retArray = new String[] {"9"}; - String[] columnNames = {"count(root.sg1.d1.s2)"}; + String[] columnNames = {"count(root.db1.d1.s2)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(s2) from root.sg1.d1 where time>=16 and time<=34")) { + statement.executeQuery("select count(s2) from root.db1.d1 where time>=16 and time<=34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1529,12 +1529,12 @@ public void countSingleAlignedWithTimeFilterTest() { @Test public void sumSingleAlignedWithTimeFilterTest() { String[] retArray = new String[] {"230322.0"}; - String[] columnNames = {"sum(root.sg1.d1.s3)"}; + String[] columnNames = {"sum(root.db1.d1.s3)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select sum(s3) from root.sg1.d1 where time>=16 and time<=34")) { + statement.executeQuery("select sum(s3) from root.db1.d1 where time>=16 and time<=34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1566,12 +1566,12 @@ public void sumSingleAlignedWithTimeFilterTest() { @Test public void avgSingleAlignedWithTimeFilterTest() { double[][] retArray = {{24.444444444444443}}; - String[] columnNames = {"avg(root.sg1.d1.s2)"}; + String[] columnNames = {"avg(root.db1.d1.s2)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select avg(s2) from root.sg1.d1 where time>=16 and time<=34")) { + statement.executeQuery("select avg(s2) from root.db1.d1 where time>=16 and time<=34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1603,12 +1603,12 @@ public void avgSingleAlignedWithTimeFilterTest() { @Test public void countAlignedWithValueFilterTest() { String[] retArray = new String[] {"11"}; - String[] columnNames = {"count(root.sg1.d1.s4)"}; + String[] columnNames = {"count(root.db1.d1.s4)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(s4) from root.sg1.d1 where s4 = true")) { + statement.executeQuery("select count(s4) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1639,15 +1639,15 @@ public void countAlignedWithValueFilterTest() { public void aggregationFuncAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"8", "42.0", "5.25", "1.0", "9.0", "1", "9", "1.0", "9.0"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "sum(root.sg1.d1.s1)", - "avg(root.sg1.d1.s1)", - "first_value(root.sg1.d1.s1)", - "last_value(root.sg1.d1.s1)", - "min_time(root.sg1.d1.s1)", - "max_time(root.sg1.d1.s1)", - "min_value(root.sg1.d1.s1)", - "max_value(root.sg1.d1.s1)", + "count(root.db1.d1.s1)", + "sum(root.db1.d1.s1)", + "avg(root.db1.d1.s1)", + "first_value(root.db1.d1.s1)", + "last_value(root.db1.d1.s1)", + "min_time(root.db1.d1.s1)", + "max_time(root.db1.d1.s1)", + "min_value(root.db1.d1.s1)", + "max_value(root.db1.d1.s1)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -1657,7 +1657,7 @@ public void aggregationFuncAlignedWithValueFilterTest() throws ClassNotFoundExce "select count(s1), sum(s1), avg(s1), " + "first_value(s1), last_value(s1), " + "min_time(s1), max_time(s1)," - + "max_value(s1), min_value(s1) from root.sg1.d1 where s1 < 10")) { + + "max_value(s1), min_value(s1) from root.db1.d1 where s1 < 10")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1688,17 +1688,17 @@ public void aggregationFuncAlignedWithValueFilterTest() throws ClassNotFoundExce public void countAllAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"6", "6", "9", "11", "6"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.d1 where s4 = true")) { + statement.executeQuery("select count(*) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1729,17 +1729,17 @@ public void countAllAlignedWithValueFilterTest() throws ClassNotFoundException { public void aggregationAllAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"160016.0", "11", "1", "13"}; String[] columnNames = { - "sum(root.sg1.d1.s1)", - "count(root.sg1.d1.s4)", - "min_value(root.sg1.d1.s3)", - "max_time(root.sg1.d1.s2)", + "sum(root.db1.d1.s1)", + "count(root.db1.d1.s4)", + "min_value(root.db1.d1.s3)", + "max_time(root.db1.d1.s2)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select sum(s1), count(s4), min_value(s3), max_time(s2) from root.sg1.d1 where s4 = true")) { + "select sum(s1), count(s4), min_value(s3), max_time(s2) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1771,46 +1771,46 @@ public void aggregationAllAlignedWithValueFilterTest() throws ClassNotFoundExcep public void selectAllAlignedWithoutValueFilterAlignByDeviceTest() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,1,1,true,aligned_test1", - "2,root.sg1.d1,2.0,2,2,null,aligned_test2", - "3,root.sg1.d1,30000.0,null,30000,true,aligned_unseq_test3", - "4,root.sg1.d1,4.0,4,null,true,aligned_test4", - "5,root.sg1.d1,5.0,5,null,true,aligned_test5", - "6,root.sg1.d1,6.0,6,6,true,null", - "7,root.sg1.d1,7.0,7,7,false,aligned_test7", - "8,root.sg1.d1,8.0,8,8,null,aligned_test8", - "9,root.sg1.d1,9.0,9,9,false,aligned_test9", - "10,root.sg1.d1,null,10,10,true,aligned_test10", - "11,root.sg1.d1,11.0,11,11,null,null", - "12,root.sg1.d1,12.0,12,12,null,null", - "13,root.sg1.d1,130000.0,130000,130000,true,aligned_unseq_test13", - "14,root.sg1.d1,14.0,14,14,null,null", - "15,root.sg1.d1,15.0,15,15,null,null", - "16,root.sg1.d1,16.0,16,16,null,null", - "17,root.sg1.d1,17.0,17,17,null,null", - "18,root.sg1.d1,18.0,18,18,null,null", - "19,root.sg1.d1,19.0,19,19,null,null", - "20,root.sg1.d1,20.0,20,20,null,null", - "21,root.sg1.d1,null,null,21,true,null", - "22,root.sg1.d1,null,null,22,true,null", - "23,root.sg1.d1,230000.0,null,230000,false,null", - "24,root.sg1.d1,null,null,24,true,null", - "25,root.sg1.d1,null,null,25,true,null", - "26,root.sg1.d1,null,null,26,false,null", - "27,root.sg1.d1,null,null,27,false,null", - "28,root.sg1.d1,null,null,28,false,null", - "29,root.sg1.d1,null,null,29,false,null", - "30,root.sg1.d1,null,null,30,false,null", - "31,root.sg1.d1,null,31,null,null,aligned_test31", - "32,root.sg1.d1,null,32,null,null,aligned_test32", - "33,root.sg1.d1,null,33,null,null,aligned_test33", - "34,root.sg1.d1,null,34,null,null,aligned_test34", - "35,root.sg1.d1,null,35,null,null,aligned_test35", - "36,root.sg1.d1,null,36,null,null,aligned_test36", - "37,root.sg1.d1,null,37,null,null,aligned_test37", - "38,root.sg1.d1,null,38,null,null,aligned_test38", - "39,root.sg1.d1,null,39,null,null,aligned_test39", - "40,root.sg1.d1,null,40,null,null,aligned_test40", + "1,root.db1.d1,1.0,1,1,true,aligned_test1", + "2,root.db1.d1,2.0,2,2,null,aligned_test2", + "3,root.db1.d1,30000.0,null,30000,true,aligned_unseq_test3", + "4,root.db1.d1,4.0,4,null,true,aligned_test4", + "5,root.db1.d1,5.0,5,null,true,aligned_test5", + "6,root.db1.d1,6.0,6,6,true,null", + "7,root.db1.d1,7.0,7,7,false,aligned_test7", + "8,root.db1.d1,8.0,8,8,null,aligned_test8", + "9,root.db1.d1,9.0,9,9,false,aligned_test9", + "10,root.db1.d1,null,10,10,true,aligned_test10", + "11,root.db1.d1,11.0,11,11,null,null", + "12,root.db1.d1,12.0,12,12,null,null", + "13,root.db1.d1,130000.0,130000,130000,true,aligned_unseq_test13", + "14,root.db1.d1,14.0,14,14,null,null", + "15,root.db1.d1,15.0,15,15,null,null", + "16,root.db1.d1,16.0,16,16,null,null", + "17,root.db1.d1,17.0,17,17,null,null", + "18,root.db1.d1,18.0,18,18,null,null", + "19,root.db1.d1,19.0,19,19,null,null", + "20,root.db1.d1,20.0,20,20,null,null", + "21,root.db1.d1,null,null,21,true,null", + "22,root.db1.d1,null,null,22,true,null", + "23,root.db1.d1,230000.0,null,230000,false,null", + "24,root.db1.d1,null,null,24,true,null", + "25,root.db1.d1,null,null,25,true,null", + "26,root.db1.d1,null,null,26,false,null", + "27,root.db1.d1,null,null,27,false,null", + "28,root.db1.d1,null,null,28,false,null", + "29,root.db1.d1,null,null,29,false,null", + "30,root.db1.d1,null,null,30,false,null", + "31,root.db1.d1,null,31,null,null,aligned_test31", + "32,root.db1.d1,null,32,null,null,aligned_test32", + "33,root.db1.d1,null,33,null,null,aligned_test33", + "34,root.db1.d1,null,34,null,null,aligned_test34", + "35,root.db1.d1,null,35,null,null,aligned_test35", + "36,root.db1.d1,null,36,null,null,aligned_test36", + "37,root.db1.d1,null,37,null,null,aligned_test37", + "38,root.db1.d1,null,38,null,null,aligned_test38", + "39,root.db1.d1,null,39,null,null,aligned_test39", + "40,root.db1.d1,null,40,null,null,aligned_test40", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -1819,7 +1819,7 @@ public void selectAllAlignedWithoutValueFilterAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 align by device")) { + statement.executeQuery("select * from root.db1.d1 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1850,86 +1850,86 @@ public void selectAllAlignedWithoutValueFilterAlignByDeviceTest() { public void selectAllAlignedAndNonAlignedAlignByDeviceTest() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,1,1,true,aligned_test1", - "2,root.sg1.d1,2.0,2,2,null,aligned_test2", - "3,root.sg1.d1,30000.0,null,30000,true,aligned_unseq_test3", - "4,root.sg1.d1,4.0,4,null,true,aligned_test4", - "5,root.sg1.d1,5.0,5,null,true,aligned_test5", - "6,root.sg1.d1,6.0,6,6,true,null", - "7,root.sg1.d1,7.0,7,7,false,aligned_test7", - "8,root.sg1.d1,8.0,8,8,null,aligned_test8", - "9,root.sg1.d1,9.0,9,9,false,aligned_test9", - "10,root.sg1.d1,null,10,10,true,aligned_test10", - "11,root.sg1.d1,11.0,11,11,null,null", - "12,root.sg1.d1,12.0,12,12,null,null", - "13,root.sg1.d1,130000.0,130000,130000,true,aligned_unseq_test13", - "14,root.sg1.d1,14.0,14,14,null,null", - "15,root.sg1.d1,15.0,15,15,null,null", - "16,root.sg1.d1,16.0,16,16,null,null", - "17,root.sg1.d1,17.0,17,17,null,null", - "18,root.sg1.d1,18.0,18,18,null,null", - "19,root.sg1.d1,19.0,19,19,null,null", - "20,root.sg1.d1,20.0,20,20,null,null", - "21,root.sg1.d1,null,null,21,true,null", - "22,root.sg1.d1,null,null,22,true,null", - "23,root.sg1.d1,230000.0,null,230000,false,null", - "24,root.sg1.d1,null,null,24,true,null", - "25,root.sg1.d1,null,null,25,true,null", - "26,root.sg1.d1,null,null,26,false,null", - "27,root.sg1.d1,null,null,27,false,null", - "28,root.sg1.d1,null,null,28,false,null", - "29,root.sg1.d1,null,null,29,false,null", - "30,root.sg1.d1,null,null,30,false,null", - "31,root.sg1.d1,null,31,null,null,aligned_test31", - "32,root.sg1.d1,null,32,null,null,aligned_test32", - "33,root.sg1.d1,null,33,null,null,aligned_test33", - "34,root.sg1.d1,null,34,null,null,aligned_test34", - "35,root.sg1.d1,null,35,null,null,aligned_test35", - "36,root.sg1.d1,null,36,null,null,aligned_test36", - "37,root.sg1.d1,null,37,null,null,aligned_test37", - "38,root.sg1.d1,null,38,null,null,aligned_test38", - "39,root.sg1.d1,null,39,null,null,aligned_test39", - "40,root.sg1.d1,null,40,null,null,aligned_test40", - "1,root.sg1.d2,1.0,1,1,true,non_aligned_test1", - "2,root.sg1.d2,2.0,2,2,null,non_aligned_test2", - "3,root.sg1.d2,3.0,null,3,false,non_aligned_test3", - "4,root.sg1.d2,4.0,4,null,true,non_aligned_test4", - "5,root.sg1.d2,5.0,5,null,true,non_aligned_test5", - "6,root.sg1.d2,6.0,6,6,true,null", - "7,root.sg1.d2,7.0,7,7,false,non_aligned_test7", - "8,root.sg1.d2,8.0,8,8,null,non_aligned_test8", - "9,root.sg1.d2,9.0,9,9,false,non_aligned_test9", - "10,root.sg1.d2,null,10,10,true,non_aligned_test10", - "11,root.sg1.d2,11.0,11,11,null,null", - "12,root.sg1.d2,12.0,12,12,null,null", - "13,root.sg1.d2,13.0,13,13,null,null", - "14,root.sg1.d2,14.0,14,14,null,null", - "15,root.sg1.d2,15.0,15,15,null,null", - "16,root.sg1.d2,16.0,16,16,null,null", - "17,root.sg1.d2,17.0,17,17,null,null", - "18,root.sg1.d2,18.0,18,18,null,null", - "19,root.sg1.d2,19.0,19,19,null,null", - "20,root.sg1.d2,20.0,20,20,null,null", - "21,root.sg1.d2,null,null,21,true,null", - "22,root.sg1.d2,null,null,22,true,null", - "23,root.sg1.d2,null,null,23,true,null", - "24,root.sg1.d2,null,null,24,true,null", - "25,root.sg1.d2,null,null,25,true,null", - "26,root.sg1.d2,null,null,26,false,null", - "27,root.sg1.d2,null,null,27,false,null", - "28,root.sg1.d2,null,null,28,false,null", - "29,root.sg1.d2,null,null,29,false,null", - "30,root.sg1.d2,null,null,30,false,null", - "31,root.sg1.d2,null,31,null,null,non_aligned_test31", - "32,root.sg1.d2,null,32,null,null,non_aligned_test32", - "33,root.sg1.d2,null,33,null,null,non_aligned_test33", - "34,root.sg1.d2,null,34,null,null,non_aligned_test34", - "35,root.sg1.d2,null,35,null,null,non_aligned_test35", - "36,root.sg1.d2,null,36,null,null,non_aligned_test36", - "37,root.sg1.d2,null,37,null,null,non_aligned_test37", - "38,root.sg1.d2,null,38,null,null,non_aligned_test38", - "39,root.sg1.d2,null,39,null,null,non_aligned_test39", - "40,root.sg1.d2,null,40,null,null,non_aligned_test40", + "1,root.db1.d1,1.0,1,1,true,aligned_test1", + "2,root.db1.d1,2.0,2,2,null,aligned_test2", + "3,root.db1.d1,30000.0,null,30000,true,aligned_unseq_test3", + "4,root.db1.d1,4.0,4,null,true,aligned_test4", + "5,root.db1.d1,5.0,5,null,true,aligned_test5", + "6,root.db1.d1,6.0,6,6,true,null", + "7,root.db1.d1,7.0,7,7,false,aligned_test7", + "8,root.db1.d1,8.0,8,8,null,aligned_test8", + "9,root.db1.d1,9.0,9,9,false,aligned_test9", + "10,root.db1.d1,null,10,10,true,aligned_test10", + "11,root.db1.d1,11.0,11,11,null,null", + "12,root.db1.d1,12.0,12,12,null,null", + "13,root.db1.d1,130000.0,130000,130000,true,aligned_unseq_test13", + "14,root.db1.d1,14.0,14,14,null,null", + "15,root.db1.d1,15.0,15,15,null,null", + "16,root.db1.d1,16.0,16,16,null,null", + "17,root.db1.d1,17.0,17,17,null,null", + "18,root.db1.d1,18.0,18,18,null,null", + "19,root.db1.d1,19.0,19,19,null,null", + "20,root.db1.d1,20.0,20,20,null,null", + "21,root.db1.d1,null,null,21,true,null", + "22,root.db1.d1,null,null,22,true,null", + "23,root.db1.d1,230000.0,null,230000,false,null", + "24,root.db1.d1,null,null,24,true,null", + "25,root.db1.d1,null,null,25,true,null", + "26,root.db1.d1,null,null,26,false,null", + "27,root.db1.d1,null,null,27,false,null", + "28,root.db1.d1,null,null,28,false,null", + "29,root.db1.d1,null,null,29,false,null", + "30,root.db1.d1,null,null,30,false,null", + "31,root.db1.d1,null,31,null,null,aligned_test31", + "32,root.db1.d1,null,32,null,null,aligned_test32", + "33,root.db1.d1,null,33,null,null,aligned_test33", + "34,root.db1.d1,null,34,null,null,aligned_test34", + "35,root.db1.d1,null,35,null,null,aligned_test35", + "36,root.db1.d1,null,36,null,null,aligned_test36", + "37,root.db1.d1,null,37,null,null,aligned_test37", + "38,root.db1.d1,null,38,null,null,aligned_test38", + "39,root.db1.d1,null,39,null,null,aligned_test39", + "40,root.db1.d1,null,40,null,null,aligned_test40", + "1,root.db1.d2,1.0,1,1,true,non_aligned_test1", + "2,root.db1.d2,2.0,2,2,null,non_aligned_test2", + "3,root.db1.d2,3.0,null,3,false,non_aligned_test3", + "4,root.db1.d2,4.0,4,null,true,non_aligned_test4", + "5,root.db1.d2,5.0,5,null,true,non_aligned_test5", + "6,root.db1.d2,6.0,6,6,true,null", + "7,root.db1.d2,7.0,7,7,false,non_aligned_test7", + "8,root.db1.d2,8.0,8,8,null,non_aligned_test8", + "9,root.db1.d2,9.0,9,9,false,non_aligned_test9", + "10,root.db1.d2,null,10,10,true,non_aligned_test10", + "11,root.db1.d2,11.0,11,11,null,null", + "12,root.db1.d2,12.0,12,12,null,null", + "13,root.db1.d2,13.0,13,13,null,null", + "14,root.db1.d2,14.0,14,14,null,null", + "15,root.db1.d2,15.0,15,15,null,null", + "16,root.db1.d2,16.0,16,16,null,null", + "17,root.db1.d2,17.0,17,17,null,null", + "18,root.db1.d2,18.0,18,18,null,null", + "19,root.db1.d2,19.0,19,19,null,null", + "20,root.db1.d2,20.0,20,20,null,null", + "21,root.db1.d2,null,null,21,true,null", + "22,root.db1.d2,null,null,22,true,null", + "23,root.db1.d2,null,null,23,true,null", + "24,root.db1.d2,null,null,24,true,null", + "25,root.db1.d2,null,null,25,true,null", + "26,root.db1.d2,null,null,26,false,null", + "27,root.db1.d2,null,null,27,false,null", + "28,root.db1.d2,null,null,28,false,null", + "29,root.db1.d2,null,null,29,false,null", + "30,root.db1.d2,null,null,30,false,null", + "31,root.db1.d2,null,31,null,null,non_aligned_test31", + "32,root.db1.d2,null,32,null,null,non_aligned_test32", + "33,root.db1.d2,null,33,null,null,non_aligned_test33", + "34,root.db1.d2,null,34,null,null,non_aligned_test34", + "35,root.db1.d2,null,35,null,null,non_aligned_test35", + "36,root.db1.d2,null,36,null,null,non_aligned_test36", + "37,root.db1.d2,null,37,null,null,non_aligned_test37", + "38,root.db1.d2,null,38,null,null,non_aligned_test38", + "39,root.db1.d2,null,39,null,null,non_aligned_test39", + "40,root.db1.d2,null,40,null,null,non_aligned_test40", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -1938,7 +1938,7 @@ public void selectAllAlignedAndNonAlignedAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.* align by device")) { + statement.executeQuery("select * from root.db1.* align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1969,31 +1969,31 @@ public void selectAllAlignedAndNonAlignedAlignByDeviceTest() { public void selectAllAlignedWithTimeFilterAlignByDeviceTest() { String[] retArray = new String[] { - "9,root.sg1.d1,9.0,9,9,false,aligned_test9", - "10,root.sg1.d1,null,10,10,true,aligned_test10", - "11,root.sg1.d1,11.0,11,11,null,null", - "12,root.sg1.d1,12.0,12,12,null,null", - "13,root.sg1.d1,130000.0,130000,130000,true,aligned_unseq_test13", - "14,root.sg1.d1,14.0,14,14,null,null", - "15,root.sg1.d1,15.0,15,15,null,null", - "16,root.sg1.d1,16.0,16,16,null,null", - "17,root.sg1.d1,17.0,17,17,null,null", - "18,root.sg1.d1,18.0,18,18,null,null", - "19,root.sg1.d1,19.0,19,19,null,null", - "20,root.sg1.d1,20.0,20,20,null,null", - "21,root.sg1.d1,null,null,21,true,null", - "22,root.sg1.d1,null,null,22,true,null", - "23,root.sg1.d1,230000.0,null,230000,false,null", - "24,root.sg1.d1,null,null,24,true,null", - "25,root.sg1.d1,null,null,25,true,null", - "26,root.sg1.d1,null,null,26,false,null", - "27,root.sg1.d1,null,null,27,false,null", - "28,root.sg1.d1,null,null,28,false,null", - "29,root.sg1.d1,null,null,29,false,null", - "30,root.sg1.d1,null,null,30,false,null", - "31,root.sg1.d1,null,31,null,null,aligned_test31", - "32,root.sg1.d1,null,32,null,null,aligned_test32", - "33,root.sg1.d1,null,33,null,null,aligned_test33", + "9,root.db1.d1,9.0,9,9,false,aligned_test9", + "10,root.db1.d1,null,10,10,true,aligned_test10", + "11,root.db1.d1,11.0,11,11,null,null", + "12,root.db1.d1,12.0,12,12,null,null", + "13,root.db1.d1,130000.0,130000,130000,true,aligned_unseq_test13", + "14,root.db1.d1,14.0,14,14,null,null", + "15,root.db1.d1,15.0,15,15,null,null", + "16,root.db1.d1,16.0,16,16,null,null", + "17,root.db1.d1,17.0,17,17,null,null", + "18,root.db1.d1,18.0,18,18,null,null", + "19,root.db1.d1,19.0,19,19,null,null", + "20,root.db1.d1,20.0,20,20,null,null", + "21,root.db1.d1,null,null,21,true,null", + "22,root.db1.d1,null,null,22,true,null", + "23,root.db1.d1,230000.0,null,230000,false,null", + "24,root.db1.d1,null,null,24,true,null", + "25,root.db1.d1,null,null,25,true,null", + "26,root.db1.d1,null,null,26,false,null", + "27,root.db1.d1,null,null,27,false,null", + "28,root.db1.d1,null,null,28,false,null", + "29,root.db1.d1,null,null,29,false,null", + "30,root.db1.d1,null,null,30,false,null", + "31,root.db1.d1,null,31,null,null,aligned_test31", + "32,root.db1.d1,null,32,null,null,aligned_test32", + "33,root.db1.d1,null,33,null,null,aligned_test33", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -2003,7 +2003,7 @@ public void selectAllAlignedWithTimeFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where time >= 9 and time <= 33 align by device")) { + "select * from root.db1.d1 where time >= 9 and time <= 33 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2034,46 +2034,46 @@ public void selectAllAlignedWithTimeFilterAlignByDeviceTest() { public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest1() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,true,aligned_test1", - "2,root.sg1.d1,2.0,null,aligned_test2", - "3,root.sg1.d1,30000.0,true,aligned_unseq_test3", - "4,root.sg1.d1,4.0,true,aligned_test4", - "5,root.sg1.d1,5.0,true,aligned_test5", - "6,root.sg1.d1,6.0,true,null", - "7,root.sg1.d1,7.0,false,aligned_test7", - "8,root.sg1.d1,8.0,null,aligned_test8", - "9,root.sg1.d1,9.0,false,aligned_test9", - "10,root.sg1.d1,null,true,aligned_test10", - "11,root.sg1.d1,11.0,null,null", - "12,root.sg1.d1,12.0,null,null", - "13,root.sg1.d1,130000.0,true,aligned_unseq_test13", - "14,root.sg1.d1,14.0,null,null", - "15,root.sg1.d1,15.0,null,null", - "16,root.sg1.d1,16.0,null,null", - "17,root.sg1.d1,17.0,null,null", - "18,root.sg1.d1,18.0,null,null", - "19,root.sg1.d1,19.0,null,null", - "20,root.sg1.d1,20.0,null,null", - "21,root.sg1.d1,null,true,null", - "22,root.sg1.d1,null,true,null", - "23,root.sg1.d1,230000.0,false,null", - "24,root.sg1.d1,null,true,null", - "25,root.sg1.d1,null,true,null", - "26,root.sg1.d1,null,false,null", - "27,root.sg1.d1,null,false,null", - "28,root.sg1.d1,null,false,null", - "29,root.sg1.d1,null,false,null", - "30,root.sg1.d1,null,false,null", - "31,root.sg1.d1,null,null,aligned_test31", - "32,root.sg1.d1,null,null,aligned_test32", - "33,root.sg1.d1,null,null,aligned_test33", - "34,root.sg1.d1,null,null,aligned_test34", - "35,root.sg1.d1,null,null,aligned_test35", - "36,root.sg1.d1,null,null,aligned_test36", - "37,root.sg1.d1,null,null,aligned_test37", - "38,root.sg1.d1,null,null,aligned_test38", - "39,root.sg1.d1,null,null,aligned_test39", - "40,root.sg1.d1,null,null,aligned_test40", + "1,root.db1.d1,1.0,true,aligned_test1", + "2,root.db1.d1,2.0,null,aligned_test2", + "3,root.db1.d1,30000.0,true,aligned_unseq_test3", + "4,root.db1.d1,4.0,true,aligned_test4", + "5,root.db1.d1,5.0,true,aligned_test5", + "6,root.db1.d1,6.0,true,null", + "7,root.db1.d1,7.0,false,aligned_test7", + "8,root.db1.d1,8.0,null,aligned_test8", + "9,root.db1.d1,9.0,false,aligned_test9", + "10,root.db1.d1,null,true,aligned_test10", + "11,root.db1.d1,11.0,null,null", + "12,root.db1.d1,12.0,null,null", + "13,root.db1.d1,130000.0,true,aligned_unseq_test13", + "14,root.db1.d1,14.0,null,null", + "15,root.db1.d1,15.0,null,null", + "16,root.db1.d1,16.0,null,null", + "17,root.db1.d1,17.0,null,null", + "18,root.db1.d1,18.0,null,null", + "19,root.db1.d1,19.0,null,null", + "20,root.db1.d1,20.0,null,null", + "21,root.db1.d1,null,true,null", + "22,root.db1.d1,null,true,null", + "23,root.db1.d1,230000.0,false,null", + "24,root.db1.d1,null,true,null", + "25,root.db1.d1,null,true,null", + "26,root.db1.d1,null,false,null", + "27,root.db1.d1,null,false,null", + "28,root.db1.d1,null,false,null", + "29,root.db1.d1,null,false,null", + "30,root.db1.d1,null,false,null", + "31,root.db1.d1,null,null,aligned_test31", + "32,root.db1.d1,null,null,aligned_test32", + "33,root.db1.d1,null,null,aligned_test33", + "34,root.db1.d1,null,null,aligned_test34", + "35,root.db1.d1,null,null,aligned_test35", + "36,root.db1.d1,null,null,aligned_test36", + "37,root.db1.d1,null,null,aligned_test37", + "38,root.db1.d1,null,null,aligned_test38", + "39,root.db1.d1,null,null,aligned_test39", + "40,root.db1.d1,null,null,aligned_test40", }; String[] columnNames = {"Device", "s1", "s4", "s5"}; @@ -2082,7 +2082,7 @@ public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest1() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1,s4,s5 from root.sg1.d1 align by device")) { + statement.executeQuery("select s1,s4,s5 from root.db1.d1 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2113,36 +2113,36 @@ public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest1() { public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest2() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,true", - "2,root.sg1.d1,2.0,null", - "3,root.sg1.d1,30000.0,true", - "4,root.sg1.d1,4.0,true", - "5,root.sg1.d1,5.0,true", - "6,root.sg1.d1,6.0,true", - "7,root.sg1.d1,7.0,false", - "8,root.sg1.d1,8.0,null", - "9,root.sg1.d1,9.0,false", - "10,root.sg1.d1,null,true", - "11,root.sg1.d1,11.0,null", - "12,root.sg1.d1,12.0,null", - "13,root.sg1.d1,130000.0,true", - "14,root.sg1.d1,14.0,null", - "15,root.sg1.d1,15.0,null", - "16,root.sg1.d1,16.0,null", - "17,root.sg1.d1,17.0,null", - "18,root.sg1.d1,18.0,null", - "19,root.sg1.d1,19.0,null", - "20,root.sg1.d1,20.0,null", - "21,root.sg1.d1,null,true", - "22,root.sg1.d1,null,true", - "23,root.sg1.d1,230000.0,false", - "24,root.sg1.d1,null,true", - "25,root.sg1.d1,null,true", - "26,root.sg1.d1,null,false", - "27,root.sg1.d1,null,false", - "28,root.sg1.d1,null,false", - "29,root.sg1.d1,null,false", - "30,root.sg1.d1,null,false", + "1,root.db1.d1,1.0,true", + "2,root.db1.d1,2.0,null", + "3,root.db1.d1,30000.0,true", + "4,root.db1.d1,4.0,true", + "5,root.db1.d1,5.0,true", + "6,root.db1.d1,6.0,true", + "7,root.db1.d1,7.0,false", + "8,root.db1.d1,8.0,null", + "9,root.db1.d1,9.0,false", + "10,root.db1.d1,null,true", + "11,root.db1.d1,11.0,null", + "12,root.db1.d1,12.0,null", + "13,root.db1.d1,130000.0,true", + "14,root.db1.d1,14.0,null", + "15,root.db1.d1,15.0,null", + "16,root.db1.d1,16.0,null", + "17,root.db1.d1,17.0,null", + "18,root.db1.d1,18.0,null", + "19,root.db1.d1,19.0,null", + "20,root.db1.d1,20.0,null", + "21,root.db1.d1,null,true", + "22,root.db1.d1,null,true", + "23,root.db1.d1,230000.0,false", + "24,root.db1.d1,null,true", + "25,root.db1.d1,null,true", + "26,root.db1.d1,null,false", + "27,root.db1.d1,null,false", + "28,root.db1.d1,null,false", + "29,root.db1.d1,null,false", + "30,root.db1.d1,null,false", }; String[] columnNames = {"Device", "s1", "s4"}; @@ -2151,7 +2151,7 @@ public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest2() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1,s4 from root.sg1.d1 align by device")) { + statement.executeQuery("select s1,s4 from root.db1.d1 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2182,25 +2182,25 @@ public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest2() { public void selectSomeAlignedWithTimeFilterAlignByDeviceTest() { String[] retArray = new String[] { - "16,root.sg1.d1,16.0,null,null", - "17,root.sg1.d1,17.0,null,null", - "18,root.sg1.d1,18.0,null,null", - "19,root.sg1.d1,19.0,null,null", - "20,root.sg1.d1,20.0,null,null", - "21,root.sg1.d1,null,true,null", - "22,root.sg1.d1,null,true,null", - "23,root.sg1.d1,230000.0,false,null", - "24,root.sg1.d1,null,true,null", - "25,root.sg1.d1,null,true,null", - "26,root.sg1.d1,null,false,null", - "27,root.sg1.d1,null,false,null", - "28,root.sg1.d1,null,false,null", - "29,root.sg1.d1,null,false,null", - "30,root.sg1.d1,null,false,null", - "31,root.sg1.d1,null,null,aligned_test31", - "32,root.sg1.d1,null,null,aligned_test32", - "33,root.sg1.d1,null,null,aligned_test33", - "34,root.sg1.d1,null,null,aligned_test34", + "16,root.db1.d1,16.0,null,null", + "17,root.db1.d1,17.0,null,null", + "18,root.db1.d1,18.0,null,null", + "19,root.db1.d1,19.0,null,null", + "20,root.db1.d1,20.0,null,null", + "21,root.db1.d1,null,true,null", + "22,root.db1.d1,null,true,null", + "23,root.db1.d1,230000.0,false,null", + "24,root.db1.d1,null,true,null", + "25,root.db1.d1,null,true,null", + "26,root.db1.d1,null,false,null", + "27,root.db1.d1,null,false,null", + "28,root.db1.d1,null,false,null", + "29,root.db1.d1,null,false,null", + "30,root.db1.d1,null,false,null", + "31,root.db1.d1,null,null,aligned_test31", + "32,root.db1.d1,null,null,aligned_test32", + "33,root.db1.d1,null,null,aligned_test33", + "34,root.db1.d1,null,null,aligned_test34", }; String[] columnNames = {"Device", "s1", "s4", "s5"}; @@ -2210,7 +2210,7 @@ public void selectSomeAlignedWithTimeFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where time >= 16 and time <= 34 align by device")) { + "select s1,s4,s5 from root.db1.d1 where time >= 16 and time <= 34 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2241,17 +2241,17 @@ public void selectSomeAlignedWithTimeFilterAlignByDeviceTest() { public void selectAllAlignedWithValueFilterAlignByDeviceTest1() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,1,1,true,aligned_test1", - "3,root.sg1.d1,30000.0,null,30000,true,aligned_unseq_test3", - "4,root.sg1.d1,4.0,4,null,true,aligned_test4", - "5,root.sg1.d1,5.0,5,null,true,aligned_test5", - "6,root.sg1.d1,6.0,6,6,true,null", - "10,root.sg1.d1,null,10,10,true,aligned_test10", - "13,root.sg1.d1,130000.0,130000,130000,true,aligned_unseq_test13", - "21,root.sg1.d1,null,null,21,true,null", - "22,root.sg1.d1,null,null,22,true,null", - "24,root.sg1.d1,null,null,24,true,null", - "25,root.sg1.d1,null,null,25,true,null", + "1,root.db1.d1,1.0,1,1,true,aligned_test1", + "3,root.db1.d1,30000.0,null,30000,true,aligned_unseq_test3", + "4,root.db1.d1,4.0,4,null,true,aligned_test4", + "5,root.db1.d1,5.0,5,null,true,aligned_test5", + "6,root.db1.d1,6.0,6,6,true,null", + "10,root.db1.d1,null,10,10,true,aligned_test10", + "13,root.db1.d1,130000.0,130000,130000,true,aligned_unseq_test13", + "21,root.db1.d1,null,null,21,true,null", + "22,root.db1.d1,null,null,22,true,null", + "24,root.db1.d1,null,null,24,true,null", + "25,root.db1.d1,null,null,25,true,null", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -2260,7 +2260,7 @@ public void selectAllAlignedWithValueFilterAlignByDeviceTest1() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where s4 = true align by device")) { + statement.executeQuery("select * from root.db1.d1 where s4 = true align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2291,14 +2291,14 @@ public void selectAllAlignedWithValueFilterAlignByDeviceTest1() { public void selectAllAlignedWithValueFilterAlignByDeviceTest2() { String[] retArray = new String[] { - "12,root.sg1.d1,12.0,12,12,null,null", - "14,root.sg1.d1,14.0,14,14,null,null", - "15,root.sg1.d1,15.0,15,15,null,null", - "16,root.sg1.d1,16.0,16,16,null,null", - "17,root.sg1.d1,17.0,17,17,null,null", - "18,root.sg1.d1,18.0,18,18,null,null", - "19,root.sg1.d1,19.0,19,19,null,null", - "20,root.sg1.d1,20.0,20,20,null,null", + "12,root.db1.d1,12.0,12,12,null,null", + "14,root.db1.d1,14.0,14,14,null,null", + "15,root.db1.d1,15.0,15,15,null,null", + "16,root.db1.d1,16.0,16,16,null,null", + "17,root.db1.d1,17.0,17,17,null,null", + "18,root.db1.d1,18.0,18,18,null,null", + "19,root.db1.d1,19.0,19,19,null,null", + "20,root.db1.d1,20.0,20,20,null,null", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -2308,7 +2308,7 @@ public void selectAllAlignedWithValueFilterAlignByDeviceTest2() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where s1 > 11 and s2 <= 33 align by device")) { + "select * from root.db1.d1 where s1 > 11 and s2 <= 33 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2339,14 +2339,14 @@ public void selectAllAlignedWithValueFilterAlignByDeviceTest2() { public void selectAllAlignedWithTimeAndValueFilterAlignByDeviceTest1() { String[] retArray = new String[] { - "9,root.sg1.d1,9.0,9,9,false,aligned_test9", - "11,root.sg1.d1,11.0,11,11,null,null", - "12,root.sg1.d1,12.0,12,12,null,null", - "14,root.sg1.d1,14.0,14,14,null,null", - "15,root.sg1.d1,15.0,15,15,null,null", - "16,root.sg1.d1,16.0,16,16,null,null", - "17,root.sg1.d1,17.0,17,17,null,null", - "18,root.sg1.d1,18.0,18,18,null,null", + "9,root.db1.d1,9.0,9,9,false,aligned_test9", + "11,root.db1.d1,11.0,11,11,null,null", + "12,root.db1.d1,12.0,12,12,null,null", + "14,root.db1.d1,14.0,14,14,null,null", + "15,root.db1.d1,15.0,15,15,null,null", + "16,root.db1.d1,16.0,16,16,null,null", + "17,root.db1.d1,17.0,17,17,null,null", + "18,root.db1.d1,18.0,18,18,null,null", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -2356,7 +2356,7 @@ public void selectAllAlignedWithTimeAndValueFilterAlignByDeviceTest1() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where time >= 9 and time <= 33 and s1 < 19 align by device")) { + "select * from root.db1.d1 where time >= 9 and time <= 33 and s1 < 19 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2387,20 +2387,20 @@ public void selectAllAlignedWithTimeAndValueFilterAlignByDeviceTest1() { public void selectSomeAlignedWithValueFilterAlignByDeviceTest1() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,true,aligned_test1", - "2,root.sg1.d1,2.0,null,aligned_test2", - "4,root.sg1.d1,4.0,true,aligned_test4", - "5,root.sg1.d1,5.0,true,aligned_test5", - "6,root.sg1.d1,6.0,true,null", - "7,root.sg1.d1,7.0,false,aligned_test7", - "8,root.sg1.d1,8.0,null,aligned_test8", - "9,root.sg1.d1,9.0,false,aligned_test9", - "11,root.sg1.d1,11.0,null,null", - "12,root.sg1.d1,12.0,null,null", - "14,root.sg1.d1,14.0,null,null", - "15,root.sg1.d1,15.0,null,null", - "16,root.sg1.d1,16.0,null,null", - "34,root.sg1.d1,null,null,aligned_test34", + "1,root.db1.d1,1.0,true,aligned_test1", + "2,root.db1.d1,2.0,null,aligned_test2", + "4,root.db1.d1,4.0,true,aligned_test4", + "5,root.db1.d1,5.0,true,aligned_test5", + "6,root.db1.d1,6.0,true,null", + "7,root.db1.d1,7.0,false,aligned_test7", + "8,root.db1.d1,8.0,null,aligned_test8", + "9,root.db1.d1,9.0,false,aligned_test9", + "11,root.db1.d1,11.0,null,null", + "12,root.db1.d1,12.0,null,null", + "14,root.db1.d1,14.0,null,null", + "15,root.db1.d1,15.0,null,null", + "16,root.db1.d1,16.0,null,null", + "34,root.db1.d1,null,null,aligned_test34", }; String[] columnNames = {"Device", "s1", "s4", "s5"}; @@ -2410,7 +2410,7 @@ public void selectSomeAlignedWithValueFilterAlignByDeviceTest1() { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where s1 < 17 or s5 = 'aligned_test34' align by device")) { + "select s1,s4,s5 from root.db1.d1 where s1 < 17 or s5 = 'aligned_test34' align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2441,7 +2441,7 @@ public void selectSomeAlignedWithValueFilterAlignByDeviceTest1() { public void selectSomeAlignedWithValueFilterAlignByDeviceTest2() { String[] retArray = new String[] { - "7,root.sg1.d1,7.0,false", "9,root.sg1.d1,9.0,false", + "7,root.db1.d1,7.0,false", "9,root.db1.d1,9.0,false", }; String[] columnNames = {"Device", "s1", "s4"}; @@ -2451,7 +2451,7 @@ public void selectSomeAlignedWithValueFilterAlignByDeviceTest2() { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4 from root.sg1.d1 where s1 < 19 and s4 = false align by device")) { + "select s1,s4 from root.db1.d1 where s1 < 19 and s4 = false align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2480,7 +2480,7 @@ public void selectSomeAlignedWithValueFilterAlignByDeviceTest2() { @Test public void countAllAlignedWithoutTimeFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1", "20", "29", "28", "19", "20"}; + String[] retArray = new String[] {"root.db1.d1", "20", "29", "28", "19", "20"}; String[] columnNames = { "Device", "count(s1)", "count(s2)", "count(s3)", "count(s4)", "count(s5)" }; @@ -2489,7 +2489,7 @@ public void countAllAlignedWithoutTimeFilterAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.d1 align by device")) { + statement.executeQuery("select count(*) from root.db1.d1 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2518,7 +2518,7 @@ public void countAllAlignedWithoutTimeFilterAlignByDeviceTest() { @Test public void countAllAlignedAndNonAlignedWithoutTimeFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1,20,29,28,19,20,", "root.sg1.d2,19,29,28,18,19,"}; + String[] retArray = new String[] {"root.db1.d1,20,29,28,19,20,", "root.db1.d2,19,29,28,18,19,"}; String[] columnNames = { "Device", "count(s1)", "count(s2)", "count(s3)", "count(s4)", "count(s5)" }; @@ -2527,7 +2527,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.* align by device")) { + statement.executeQuery("select count(*) from root.db1.* align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2554,7 +2554,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterAlignByDeviceTest() { @Test public void countAllAlignedWithTimeFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1", "12", "15", "22", "13", "6"}; + String[] retArray = new String[] {"root.db1.d1", "12", "15", "22", "13", "6"}; String[] columnNames = { "Device", "count(s1)", "count(s2)", "count(s3)", "count(s4)", "count(s5)" }; @@ -2564,7 +2564,7 @@ public void countAllAlignedWithTimeFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 where time >= 9 and time <= 33 align by device")) { + "select count(*) from root.db1.d1 where time >= 9 and time <= 33 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2616,7 +2616,7 @@ public void aggregateSomeAlignedWithoutTimeFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select count(s1),count(s2),count(s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.sg1.d1 align by device")) { + "select count(s1),count(s2),count(s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.db1.d1 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2645,7 +2645,7 @@ public void aggregateSomeAlignedWithoutTimeFilterAlignByDeviceTest() { @Test public void countAlignedWithValueFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1", "11"}; + String[] retArray = new String[] {"root.db1.d1", "11"}; String[] columnNames = {"Device", "count(s4)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -2653,7 +2653,7 @@ public void countAlignedWithValueFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select count(s4) from root.sg1.d1 where s4 = true align by device")) { + "select count(s4) from root.db1.d1 where s4 = true align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2683,7 +2683,7 @@ public void countAlignedWithValueFilterAlignByDeviceTest() { @Test public void aggregationFuncAlignedWithValueFilterAlignByDeviceTest() { String[] retArray = - new String[] {"root.sg1.d1", "8", "42.0", "5.25", "1.0", "9.0", "1", "9", "1.0", "9.0"}; + new String[] {"root.db1.d1", "8", "42.0", "5.25", "1.0", "9.0", "1", "9", "1.0", "9.0"}; String[] columnNames = { "Device", "count(s1)", @@ -2705,7 +2705,7 @@ public void aggregationFuncAlignedWithValueFilterAlignByDeviceTest() { "select count(s1), sum(s1), avg(s1), " + "first_value(s1), last_value(s1), " + "min_time(s1), max_time(s1)," - + "max_value(s1), min_value(s1) from root.sg1.d1 where s1 < 10 " + + "max_value(s1), min_value(s1) from root.db1.d1 where s1 < 10 " + "align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence @@ -2735,7 +2735,7 @@ public void aggregationFuncAlignedWithValueFilterAlignByDeviceTest() { @Test public void countAllAlignedWithValueFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1", "6", "6", "9", "11", "6"}; + String[] retArray = new String[] {"root.db1.d1", "6", "6", "9", "11", "6"}; String[] columnNames = { "Device", "count(s1)", "count(s2)", "count(s3)", "count(s4)", "count(s5)" }; @@ -2745,7 +2745,7 @@ public void countAllAlignedWithValueFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 where s4 = true " + "align by device")) { + "select count(*) from root.db1.d1 where s4 = true " + "align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2774,7 +2774,7 @@ public void countAllAlignedWithValueFilterAlignByDeviceTest() { @Test public void aggregationAllAlignedWithValueFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1", "160016.0", "11", "1", "13"}; + String[] retArray = new String[] {"root.db1.d1", "160016.0", "11", "1", "13"}; String[] columnNames = { "Device", "sum(s1)", "count(s4)", "min_value(s3)", "max_time(s2)", }; @@ -2784,7 +2784,7 @@ public void aggregationAllAlignedWithValueFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select sum(s1), count(s4), min_value(s3), max_time(s2) from root.sg1.d1 where s4 = true " + "select sum(s1), count(s4), min_value(s3), max_time(s2) from root.db1.d1 where s4 = true " + "align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence @@ -2816,17 +2816,17 @@ public void aggregationAllAlignedWithValueFilterAlignByDeviceTest() { public void countSumAvgGroupByTimeAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,4,40.0,7.5", - "11,root.sg1.d1,10,130142.0,13014.2", - "21,root.sg1.d1,1,null,230000.0", - "31,root.sg1.d1,0,355.0,null" + "1,root.db1.d1,4,40.0,7.5", + "11,root.db1.d1,10,130142.0,13014.2", + "21,root.db1.d1,1,null,230000.0", + "31,root.db1.d1,0,355.0,null" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -2852,10 +2852,10 @@ public void countSumAvgGroupByTimeAlignByDeviceTest() throws SQLException { public void maxMinValueGroupByTimeAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,10,6.0,10,6", - "11,root.sg1.d1,130000,11.0,20,11", - "21,root.sg1.d1,230000,230000.0,null,21", - "31,root.sg1.d1,null,null,40,null" + "1,root.db1.d1,10,6.0,10,6", + "11,root.db1.d1,130000,11.0,20,11", + "21,root.db1.d1,230000,230000.0,null,21", + "31,root.db1.d1,null,null,40,null" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -2863,7 +2863,7 @@ public void maxMinValueGroupByTimeAlignByDeviceTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -2891,10 +2891,10 @@ public void maxMinValueGroupByTimeAlignByDeviceTest() throws SQLException { public void firstLastGroupByTimeAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,null,null", "6,root.sg1.d1,true,aligned_test7", - "11,root.sg1.d1,true,aligned_unseq_test13", "16,root.sg1.d1,null,null", - "21,root.sg1.d1,true,null", "26,root.sg1.d1,false,null", - "31,root.sg1.d1,null,aligned_test31", "36,root.sg1.d1,null,aligned_test36" + "1,root.db1.d1,null,null", "6,root.db1.d1,true,aligned_test7", + "11,root.db1.d1,true,aligned_unseq_test13", "16,root.db1.d1,null,null", + "21,root.db1.d1,true,null", "26,root.db1.d1,false,null", + "31,root.db1.d1,null,aligned_test31", "36,root.db1.d1,null,aligned_test36" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -2902,7 +2902,7 @@ public void firstLastGroupByTimeAlignByDeviceTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -2926,10 +2926,10 @@ public void firstLastGroupByTimeAlignByDeviceTest() throws SQLException { public void groupByWithWildcardAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,9,9,8,8,9,9.0,10,10,true,aligned_test10", - "11,root.sg1.d1,10,10,10,1,1,20.0,20,20,true,aligned_unseq_test13", - "21,root.sg1.d1,1,0,10,10,0,230000.0,null,30,false,null", - "31,root.sg1.d1,0,10,0,0,10,null,40,null,null,aligned_test40" + "1,root.db1.d1,9,9,8,8,9,9.0,10,10,true,aligned_test10", + "11,root.db1.d1,10,10,10,1,1,20.0,20,20,true,aligned_unseq_test13", + "21,root.db1.d1,1,0,10,10,0,230000.0,null,30,false,null", + "31,root.db1.d1,0,10,0,0,10,null,40,null,null,aligned_test40" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -2937,7 +2937,7 @@ public void groupByWithWildcardAlignByDeviceTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 GROUP BY ([1, 41), 10ms) align by device")) { + "select count(*), last_value(*) from root.db1.d1 GROUP BY ([1, 41), 10ms) align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -2976,20 +2976,20 @@ public void groupByWithWildcardAlignByDeviceTest() throws SQLException { public void groupByWithNonAlignedTimeseriesAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,0,null,null", - "7,root.sg1.d1,3,34.0,8.0", - "13,root.sg1.d1,4,130045.0,32511.25", - "19,root.sg1.d1,2,39.0,19.5", - "25,root.sg1.d1,0,null,null", - "31,root.sg1.d1,0,130.0,null", - "37,root.sg1.d1,0,154.0,null", - "1,root.sg1.d2,0,null,null", - "7,root.sg1.d2,3,34.0,8.0", - "13,root.sg1.d2,4,58.0,14.5", - "19,root.sg1.d2,2,39.0,19.5", - "25,root.sg1.d2,0,null,null", - "31,root.sg1.d2,0,130.0,null", - "37,root.sg1.d2,0,154.0,null" + "1,root.db1.d1,0,null,null", + "7,root.db1.d1,3,34.0,8.0", + "13,root.db1.d1,4,130045.0,32511.25", + "19,root.db1.d1,2,39.0,19.5", + "25,root.db1.d1,0,null,null", + "31,root.db1.d1,0,130.0,null", + "37,root.db1.d1,0,154.0,null", + "1,root.db1.d2,0,null,null", + "7,root.db1.d2,3,34.0,8.0", + "13,root.db1.d2,4,58.0,14.5", + "19,root.db1.d2,2,39.0,19.5", + "25,root.db1.d2,0,null,null", + "31,root.db1.d2,0,130.0,null", + "37,root.db1.d2,0,154.0,null" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -2997,7 +2997,7 @@ public void groupByWithNonAlignedTimeseriesAlignByDeviceTest() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.* " + "select count(s1), sum(s2), avg(s1) from root.db1.* " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -3023,10 +3023,10 @@ public void groupByWithNonAlignedTimeseriesAlignByDeviceTest() throws SQLExcepti public void countSumAvgPreviousFillAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,4,40.0,7.5", - "11,root.sg1.d1,10,130142.0,13014.2", - "21,root.sg1.d1,1,130142.0,230000.0", - "31,root.sg1.d1,0,355.0,230000.0" + "1,root.db1.d1,4,40.0,7.5", + "11,root.db1.d1,10,130142.0,13014.2", + "21,root.db1.d1,1,130142.0,230000.0", + "31,root.db1.d1,0,355.0,230000.0" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -3034,7 +3034,7 @@ public void countSumAvgPreviousFillAlignByDeviceTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms) FILL (previous) align by device")) { cnt = 0; while (resultSet.next()) { @@ -3060,13 +3060,13 @@ public void countSumAvgPreviousFillAlignByDeviceTest() throws SQLException { public void countSumAvgValueFillAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,1,3.0,30000.0", - "6,root.sg1.d1,4,40.0,7.5", - "11,root.sg1.d1,5,130052.0,26010.4", - "16,root.sg1.d1,5,90.0,18.0", - "21,root.sg1.d1,1,3.0,230000.0", - "26,root.sg1.d1,0,3.0,3.0", - "31,root.sg1.d1,0,3.0,3.0" + "1,root.db1.d1,1,3.0,30000.0", + "6,root.db1.d1,4,40.0,7.5", + "11,root.db1.d1,5,130052.0,26010.4", + "16,root.db1.d1,5,90.0,18.0", + "21,root.db1.d1,1,3.0,230000.0", + "26,root.db1.d1,0,3.0,3.0", + "31,root.db1.d1,0,3.0,3.0" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -3074,7 +3074,7 @@ public void countSumAvgValueFillAlignByDeviceTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 36), 5ms) FILL (3) align by device")) { cnt = 0; while (resultSet.next()) { @@ -3109,18 +3109,18 @@ public void countSumAvgGroupByTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3129,18 +3129,18 @@ public void countSumAvgGroupByTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3161,18 +3161,18 @@ public void countSumAvgGroupByTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3181,18 +3181,18 @@ public void countSumAvgGroupByTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3218,18 +3218,18 @@ public void countSumAvgGroupByWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3238,18 +3238,18 @@ public void countSumAvgGroupByWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3276,23 +3276,23 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3302,23 +3302,23 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3341,20 +3341,20 @@ public void maxMinValueTimeGroupByTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3363,20 +3363,20 @@ public void maxMinValueTimeGroupByTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3404,20 +3404,20 @@ public void maxMinValueTimeGroupByTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3426,20 +3426,20 @@ public void maxMinValueTimeGroupByTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3465,20 +3465,20 @@ public void maxMinValueTimeGroupByWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3487,20 +3487,20 @@ public void maxMinValueTimeGroupByWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3528,27 +3528,27 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3559,27 +3559,27 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3602,16 +3602,16 @@ public void firstLastGroupByTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3620,16 +3620,16 @@ public void firstLastGroupByTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3650,16 +3650,16 @@ public void firstLastGroupByTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3668,16 +3668,16 @@ public void firstLastGroupByTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3704,16 +3704,16 @@ public void firstLastGroupByWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3722,16 +3722,16 @@ public void firstLastGroupByWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3759,19 +3759,19 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3781,20 +3781,20 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 " + + "from root.db1 where time > 5 and time < 38 " + "GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3818,31 +3818,31 @@ public void groupByWithWildcardTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 GROUP BY ([1, 41), 10ms)")) { + "select count(*), last_value(*) from root.db1.d1 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3851,32 +3851,32 @@ public void groupByWithWildcardTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + "GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3906,22 +3906,22 @@ public void groupByWithWildcardTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3930,22 +3930,22 @@ public void groupByWithWildcardTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3975,22 +3975,22 @@ public void groupByWithWildcardTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3999,22 +3999,22 @@ public void groupByWithWildcardTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4028,7 +4028,7 @@ public void groupByWithoutAggregationFuncTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.executeQuery("select s1 from root.sg1.d1 group by ([0, 100), 5ms)"); + statement.executeQuery("select s1 from root.db1.d1 group by ([0, 100), 5ms)"); fail("No expected exception thrown"); } catch (Exception e) { @@ -4046,7 +4046,7 @@ public void negativeOrZeroTimeIntervalTest() { Statement statement = connection.createStatement()) { statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 0ms)"); fail(); } catch (Exception e) { @@ -4070,18 +4070,18 @@ public void countSumAvgWithValueFilterTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4090,18 +4090,18 @@ public void countSumAvgWithValueFilterTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4128,18 +4128,18 @@ public void countSumAvgWithValueFilterTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 36), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4148,18 +4148,18 @@ public void countSumAvgWithValueFilterTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 36), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4186,18 +4186,18 @@ public void countSumAvgWithSlidingStepAndValueFilterTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4206,18 +4206,18 @@ public void countSumAvgWithSlidingStepAndValueFilterTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4243,23 +4243,23 @@ public void countSumAvgWithNonAlignedTimeseriesAndValueFilterTest() throws SQLEx try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 4ms, 6ms)")) { + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4269,24 +4269,24 @@ public void countSumAvgWithNonAlignedTimeseriesAndValueFilterTest() throws SQLEx try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 4ms, 6ms) " + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 4ms, 6ms) " + "order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4310,20 +4310,20 @@ public void maxMinValueTimeWithValueFilterTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4332,20 +4332,20 @@ public void maxMinValueTimeWithValueFilterTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4371,20 +4371,20 @@ public void maxMinValueTimeWithValueFilterTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 31), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4393,20 +4393,20 @@ public void maxMinValueTimeWithValueFilterTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 31), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4433,20 +4433,20 @@ public void maxMinValueTimeWithSlidingStepAndValueFilterTest() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4455,20 +4455,20 @@ public void maxMinValueTimeWithSlidingStepAndValueFilterTest() throws SQLExcepti try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4497,27 +4497,27 @@ public void maxMinValueTimeWithNonAlignedTimeseriesAndValueFilterTest() throws S statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4528,28 +4528,28 @@ public void maxMinValueTimeWithNonAlignedTimeseriesAndValueFilterTest() throws S statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 4ms, 6ms) " + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 4ms, 6ms) " + " order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4570,16 +4570,16 @@ public void firstLastWithValueFilterTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 = true GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4588,16 +4588,16 @@ public void firstLastWithValueFilterTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 = true GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4619,16 +4619,16 @@ public void firstLastWithValueFilterTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 = false GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4637,16 +4637,16 @@ public void firstLastWithValueFilterTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 = false GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4673,16 +4673,16 @@ public void firstLastWithSlidingStepAndValueFilterTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 != false GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4691,16 +4691,16 @@ public void firstLastWithSlidingStepAndValueFilterTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 != false GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4728,20 +4728,20 @@ public void firstLastWithNonAlignedTimeseriesAndValueFilterTest() throws SQLExce try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + + "from root.db1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + "GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4751,20 +4751,20 @@ public void firstLastWithNonAlignedTimeseriesAndValueFilterTest() throws SQLExce try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + + "from root.db1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + "GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4788,32 +4788,32 @@ public void groupByWithWildcardAndValueFilterTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4822,32 +4822,32 @@ public void groupByWithWildcardAndValueFilterTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4877,22 +4877,22 @@ public void groupByWithWildcardAndValueFilterTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + "where s1 > 5 or s2 > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4901,7 +4901,7 @@ public void groupByWithWildcardAndValueFilterTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + " where s1 > 5 or s2 > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) " + " order by time desc")) { cnt = retArray.length; @@ -4909,15 +4909,15 @@ public void groupByWithWildcardAndValueFilterTest2() throws SQLException { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4947,22 +4947,22 @@ public void groupByWithWildcardAndValueFilterTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + "where s1 > 5 or s2 > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4971,22 +4971,22 @@ public void groupByWithWildcardAndValueFilterTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + " where s1 > 5 or s2 > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5015,18 +5015,18 @@ public void countSumAvgSlidingWindowTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5035,18 +5035,18 @@ public void countSumAvgSlidingWindowTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5080,18 +5080,18 @@ public void countSumAvgSlidingWindowTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5100,18 +5100,18 @@ public void countSumAvgSlidingWindowTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5151,18 +5151,18 @@ public void countSumAvgSlidingWindowTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5171,18 +5171,18 @@ public void countSumAvgSlidingWindowTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5223,23 +5223,23 @@ public void countSumAvgSlidingWindowWithNonAlignedTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 5ms, 2ms)")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 5ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5249,23 +5249,23 @@ public void countSumAvgSlidingWindowWithNonAlignedTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 5ms, 2ms) order by time desc")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 5ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5293,20 +5293,20 @@ public void maxMinValueTimeSlidingWindowTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5315,20 +5315,20 @@ public void maxMinValueTimeSlidingWindowTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5362,20 +5362,20 @@ public void maxMinValueTimeSlidingWindowTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5384,20 +5384,20 @@ public void maxMinValueTimeSlidingWindowTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5437,20 +5437,20 @@ public void maxMinValueTimeSlidingWindowTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5459,20 +5459,20 @@ public void maxMinValueTimeSlidingWindowTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5508,27 +5508,27 @@ public void maxMinValueTimeSlidingWindowWithNonAlignedTest() throws SQLException statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5539,27 +5539,27 @@ public void maxMinValueTimeSlidingWindowWithNonAlignedTest() throws SQLException statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5587,16 +5587,16 @@ public void firstLastValueSlidingWindowTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5605,16 +5605,16 @@ public void firstLastValueSlidingWindowTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5648,16 +5648,16 @@ public void firstLastValueSlidingWindowTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5666,16 +5666,16 @@ public void firstLastValueSlidingWindowTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5715,16 +5715,16 @@ public void firstLastValueSlidingWindowTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5733,16 +5733,16 @@ public void firstLastValueSlidingWindowTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5777,19 +5777,19 @@ public void firstLastValueSlidingWindowWithNonAlignedTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5799,20 +5799,20 @@ public void firstLastValueSlidingWindowWithNonAlignedTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 " + + "from root.db1 where time > 5 and time < 38 " + "GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5841,18 +5841,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5861,18 +5861,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5904,18 +5904,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 36), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5924,18 +5924,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 36), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5975,18 +5975,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5995,18 +5995,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6042,23 +6042,23 @@ public void countSumAvgSlidingWindowWithNonAlignedAndValueFilterTest() throws SQ try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 5ms, 2ms)")) { + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 5ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6068,24 +6068,24 @@ public void countSumAvgSlidingWindowWithNonAlignedAndValueFilterTest() throws SQ try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 5ms, 2ms) " + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 5ms, 2ms) " + "order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6113,20 +6113,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest1() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6135,20 +6135,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest1() throws SQLExcepti try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6178,20 +6178,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest2() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 31), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6200,20 +6200,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest2() throws SQLExcepti try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 31), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6253,20 +6253,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest3() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6275,20 +6275,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest3() throws SQLExcepti try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6330,27 +6330,27 @@ public void maxMinValueTimeSlidingWindowWithNonAlignedAndValueFilterTest() throw statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 5ms, 2ms)")) { + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 5ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6361,28 +6361,28 @@ public void maxMinValueTimeSlidingWindowWithNonAlignedAndValueFilterTest() throw statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 5ms, 2ms) " + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 5ms, 2ms) " + " order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6410,16 +6410,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest1() throws SQLExceptio int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 = true GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6428,16 +6428,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest1() throws SQLExceptio try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 = true GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6471,16 +6471,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest2() throws SQLExceptio int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 = false GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6489,16 +6489,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest2() throws SQLExceptio try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 = false GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6538,16 +6538,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest3() throws SQLExceptio int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 != false GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6556,16 +6556,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest3() throws SQLExceptio try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 != false GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6606,20 +6606,20 @@ public void firstLastValueSlidingWindowWithNonAlignedAndValueFilterTest() throws try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + + "from root.db1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + "GROUP BY ([1, 41), 5ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6629,20 +6629,20 @@ public void firstLastValueSlidingWindowWithNonAlignedAndValueFilterTest() throws try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + + "from root.db1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + "GROUP BY ([1, 41), 5ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithDeletionIT.java index 2242398103fbd..acc67bbf529ad 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithDeletionIT.java @@ -61,7 +61,7 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete from root.sg1.d1.* where time <= 2"); + statement.execute("delete from root.db1.d1.* where time <= 2"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -80,12 +80,12 @@ public void selectAllDeletedColumns() { "3,30000.0,null,30000", "4,4.0,4,null", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select s1, s2, s3 from root.sg1.d1 where time <= 4")) { + statement.executeQuery("select s1, s2, s3 from root.db1.d1 where time <= 4")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -116,9 +116,9 @@ public void selectAllDeletedAndNullColumns() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select s1, s4 from root.sg1.d1 where time <= 2")) { + statement.executeQuery("select s1, s4 from root.db1.d1 where time <= 2")) { // data at timestamp [1,2] has been deleted and should not be kept in result - // data of root.sg1.d1.s4 is not deleted at timestamp 2, but it is null + // data of root.db1.d1.s4 is not deleted at timestamp 2, but it is null assertFalse(resultSet.next()); } catch (SQLException e) { @@ -132,19 +132,19 @@ public void selectPartialDeletedColumns() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "insert into root.sg1.factory0.d1.group1(time, s_lat, s_son)" + "insert into root.db1.factory0.d1.group1(time, s_lat, s_son)" + " aligned values (10,3.3,4.4),(20,13.3,14.4),(30,23.3,24.4),(40,43.3,44.4);"); statement.execute( - "insert into root.sg1.factory0.d1.group1(time, s_lat, s_son, s_boolean)" + "insert into root.db1.factory0.d1.group1(time, s_lat, s_son, s_boolean)" + " aligned values (10,3.3,4.4, true),(20,13.3,14.4, false),(30,23.3,24.4, true),(40,43.3,44.4, true);"); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.factory0.d1.group1;"); + ResultSet resultSet = statement.executeQuery("select * from root.db1.factory0.d1.group1;"); int cnt = 0; while (resultSet.next()) { cnt++; } assertEquals(4, cnt); - statement.execute("delete from root.sg1.factory0.d1.group1.* where time < 30;"); - resultSet = statement.executeQuery("select * from root.sg1.factory0.d1.group1;"); + statement.execute("delete from root.db1.factory0.d1.group1.* where time < 30;"); + resultSet = statement.executeQuery("select * from root.db1.factory0.d1.group1;"); cnt = 0; while (resultSet.next()) { cnt++; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithMisMatchIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithMisMatchIT.java index a8fcf713bcda6..a8f1ccfcf1a65 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithMisMatchIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithMisMatchIT.java @@ -59,10 +59,10 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg1.d1(time, s1, s2) aligned values (1, 1, true)"); + statement.execute("insert into root.db1.d1(time, s1, s2) aligned values (1, 1, true)"); statement.execute("flush"); - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("insert into root.sg1.d1(time, s1, s2) aligned values (10, 10, 100)"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("insert into root.db1.d1(time, s1, s2) aligned values (10, 10, 100)"); statement.execute("flush"); } catch (Exception e) { fail(e.getMessage()); @@ -82,11 +82,11 @@ public void selectAllDeletedColumns() { "1,1.0,null", "10,10.0,100.0", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s2"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s2"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg1.d1")) { + ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBCountMultiTimesWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBCountMultiTimesWithDeletionIT.java index f2827a7659025..5a7508550712c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBCountMultiTimesWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBCountMultiTimesWithDeletionIT.java @@ -59,9 +59,9 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg1.d1(time, s1) aligned values (1,1), (2,2)"); + statement.execute("insert into root.db1.d1(time, s1) aligned values (1,1), (2,2)"); statement.execute("flush"); - statement.execute("delete from root.sg1.d1.s1 where time > 1"); + statement.execute("delete from root.db1.d1.s1 where time > 1"); } catch (Exception e) { fail(e.getMessage()); e.printStackTrace(); @@ -77,13 +77,13 @@ public static void tearDown() throws Exception { public void countSingleAlignedWithoutTimeFilterMultiTimesTest() { String[] retArray = new String[] {"1"}; String[] columnNames = { - "count(root.sg1.d1.s1)", + "count(root.db1.d1.s1)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // first time - try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -106,7 +106,7 @@ public void countSingleAlignedWithoutTimeFilterMultiTimesTest() { } // second time - try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByLevelQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByLevelQueryIT.java index 5bcc8e5eb7dea..a1ed00dddacab 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByLevelQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByLevelQueryIT.java @@ -55,30 +55,30 @@ public static void setUp() throws Exception { AlignedWriteUtil.insertData(); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg2"); + statement.execute("CREATE DATABASE root.db2"); statement.execute( - "create aligned timeseries root.sg2.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64)"); + "create aligned timeseries root.db2.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64)"); for (int i = 1; i <= 10; i++) { statement.execute( String.format( Locale.ENGLISH, - "insert into root.sg2.d1(time, s1) aligned values(%d,%f)", + "insert into root.db2.d1(time, s1) aligned values(%d,%f)", i, (double) i)); } for (int i = 11; i <= 20; i++) { statement.execute( - String.format("insert into root.sg2.d1(time, s2) aligned values(%d,%d)", i, i)); + String.format("insert into root.db2.d1(time, s2) aligned values(%d,%d)", i, i)); } for (int i = 21; i <= 30; i++) { statement.execute( - String.format("insert into root.sg2.d1(time, s3) aligned values(%d,%d)", i, i)); + String.format("insert into root.db2.d1(time, s3) aligned values(%d,%d)", i, i)); } for (int i = 31; i <= 40; i++) { statement.execute( String.format( Locale.ENGLISH, - "insert into root.sg2.d1(time, s1, s2, s3) aligned values(%d,%f,%d,%d)", + "insert into root.db2.d1(time, s1, s2, s3) aligned values(%d,%f,%d,%d)", i, (double) i, i, @@ -98,7 +98,7 @@ public static void tearDown() throws Exception { public void countFuncByLevelTest() { // level = 1 double[][] retArray1 = new double[][] {{39, 20}}; - String[] columnNames1 = {"count(root.sg1.*.s1)", "count(root.sg2.*.s1)"}; + String[] columnNames1 = {"count(root.db1.*.s1)", "count(root.db2.*.s1)"}; resultSetEqualTest("select count(s1) from root.*.* group by level=1", retArray1, columnNames1); // level = 2 double[][] retArray2 = new double[][] {{40, 19}}; @@ -111,7 +111,7 @@ public void countFuncByLevelTest() { // multi level = 1,2 double[][] retArray4 = new double[][] {{20, 19, 20}}; String[] columnNames4 = { - "count(root.sg1.d1.s1)", "count(root.sg1.d2.s1)", "count(root.sg2.d1.s1)" + "count(root.db1.d1.s1)", "count(root.db1.d2.s1)", "count(root.db2.d1.s1)" }; resultSetEqualTest( "select count(s1) from root.*.* group by level=1,2", retArray4, columnNames4); @@ -134,7 +134,7 @@ public void countFuncByLevelTest() { public void sumFuncByLevelTest() { // level = 1 double[][] retArray1 = new double[][] {{131111, 510}}; - String[] columnNames1 = {"sum(root.sg1.*.s2)", "sum(root.sg2.*.s2)"}; + String[] columnNames1 = {"sum(root.db1.*.s2)", "sum(root.db2.*.s2)"}; resultSetEqualTest("select sum(s2) from root.*.* group by level=1", retArray1, columnNames1); // level = 2 double[][] retArray2 = new double[][] {{131059, 562}}; @@ -146,7 +146,7 @@ public void sumFuncByLevelTest() { resultSetEqualTest("select sum(s2) from root.*.* group by level=3", retArray3, columnNames3); // multi level = 1,2 double[][] retArray4 = new double[][] {{130549, 562, 510}}; - String[] columnNames4 = {"sum(root.sg1.d1.s2)", "sum(root.sg1.d2.s2)", "sum(root.sg2.d1.s2)"}; + String[] columnNames4 = {"sum(root.db1.d1.s2)", "sum(root.db1.d2.s2)", "sum(root.db2.d1.s2)"}; resultSetEqualTest("select sum(s2) from root.*.* group by level=1,2", retArray4, columnNames4); // level=2 with time filter double[][] retArray5 = @@ -167,7 +167,7 @@ public void sumFuncByLevelTest() { public void avgFuncByLevelTest() { // level = 1 double[][] retArray1 = new double[][] {{2260.53448275862, 25.5}}; - String[] columnNames1 = {"avg(root.sg1.*.s2)", "avg(root.sg2.*.s2)"}; + String[] columnNames1 = {"avg(root.db1.*.s2)", "avg(root.db2.*.s2)"}; resultSetEqualTest("select avg(s2) from root.*.* group by level=1", retArray1, columnNames1); // level = 2 double[][] retArray2 = new double[][] {{2674.6734693877547, 19.379310344827587}}; @@ -179,7 +179,7 @@ public void avgFuncByLevelTest() { resultSetEqualTest("select avg(s2) from root.*.* group by level=3", retArray3, columnNames3); // multi level = 1,2 double[][] retArray4 = new double[][] {{4501.68965517241, 19.379310344827587, 25.5}}; - String[] columnNames4 = {"avg(root.sg1.d1.s2)", "avg(root.sg1.d2.s2)", "avg(root.sg2.d1.s2)"}; + String[] columnNames4 = {"avg(root.db1.d1.s2)", "avg(root.db1.d2.s2)", "avg(root.db2.d1.s2)"}; resultSetEqualTest("select avg(s2) from root.*.* group by level=1,2", retArray4, columnNames4); // level=2 with time filter double[][] retArray5 = @@ -228,7 +228,7 @@ public void valueFuncGroupByLevelTest() { public void nestedQueryTest1() { // level = 1 double[][] retArray1 = new double[][] {{40.0, 21.0}}; - String[] columnNames1 = {"count(root.sg1.*.s1 + 1) + 1", "count(root.sg2.*.s1 + 1) + 1"}; + String[] columnNames1 = {"count(root.db1.*.s1 + 1) + 1", "count(root.db2.*.s1 + 1) + 1"}; resultSetEqualTest( "select count(s1 + 1) + 1 from root.*.* group by level=1", retArray1, columnNames1); @@ -250,10 +250,10 @@ public void nestedQueryTest2() { // level = 1 double[][] retArray1 = new double[][] {{390423.0, 449.0, 390404.0, 430.0}}; String[] columnNames1 = { - "count(root.sg1.*.s1) + sum(root.sg1.*.s1)", - "count(root.sg1.*.s1) + sum(root.sg2.*.s1)", - "count(root.sg2.*.s1) + sum(root.sg1.*.s1)", - "count(root.sg2.*.s1) + sum(root.sg2.*.s1)" + "count(root.db1.*.s1) + sum(root.db1.*.s1)", + "count(root.db1.*.s1) + sum(root.db2.*.s1)", + "count(root.db2.*.s1) + sum(root.db1.*.s1)", + "count(root.db2.*.s1) + sum(root.db2.*.s1)" }; resultSetEqualTest( "select count(s1) + sum(s1) from root.*.* group by level=1", retArray1, columnNames1); @@ -281,12 +281,12 @@ public void caseSensitivityTest() { double[][] retArray = new double[][] {{39, 20, 39, 20, 39, 20}}; String[] columnNames1 = { - "count(root.sg1.*.s1)", - "count(root.sg2.*.s1)", - "COUNT(root.sg1.*.s1)", - "COUNT(root.sg2.*.s1)", - "cOuNt(root.sg1.*.s1)", - "cOuNt(root.sg2.*.s1)" + "count(root.db1.*.s1)", + "count(root.db2.*.s1)", + "COUNT(root.db1.*.s1)", + "COUNT(root.db2.*.s1)", + "cOuNt(root.db1.*.s1)", + "cOuNt(root.db2.*.s1)" }; resultSetEqualTest( "select count(s1), COUNT(s1), cOuNt(s1) from root.*.* group by level=1", @@ -294,12 +294,12 @@ public void caseSensitivityTest() { columnNames1); String[] columnNames2 = { - "Count(root.sg1.*.s1)", - "Count(root.sg2.*.s1)", - "COUNT(root.sg1.*.s1)", - "COUNT(root.sg2.*.s1)", - "cOuNt(root.sg1.*.s1)", - "cOuNt(root.sg2.*.s1)" + "Count(root.db1.*.s1)", + "Count(root.db2.*.s1)", + "COUNT(root.db1.*.s1)", + "COUNT(root.db2.*.s1)", + "cOuNt(root.db1.*.s1)", + "cOuNt(root.db2.*.s1)" }; resultSetEqualTest( "select Count(s1), COUNT(s1), cOuNt(s1) from root.*.* group by level=1", diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletion2IT.java index de074bfe88c73..a8dddc4cd4eff 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletion2IT.java @@ -53,8 +53,8 @@ public static void setUp() throws Exception { AlignedWriteUtil.insertData(); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete from root.sg1.d1.s1 where time <= 15"); - statement.execute("delete timeseries root.sg1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 15"); + statement.execute("delete timeseries root.db1.d1.s2"); } catch (Exception e) { e.printStackTrace(); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletionIT.java index 7b228b700b816..deb58646555c3 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletionIT.java @@ -64,8 +64,8 @@ public static void setUp() throws Exception { AlignedWriteUtil.insertData(); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete from root.sg1.d1.s1 where time <= 15"); - statement.execute("delete timeseries root.sg1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 15"); + statement.execute("delete timeseries root.db1.d1.s2"); } catch (Exception e) { e.printStackTrace(); } @@ -86,16 +86,16 @@ public void countSumAvgTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -104,16 +104,16 @@ public void countSumAvgTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -135,16 +135,16 @@ public void countSumAvgTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -153,16 +153,16 @@ public void countSumAvgTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -189,16 +189,16 @@ public void countSumAvgWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -207,16 +207,16 @@ public void countSumAvgWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -237,18 +237,18 @@ public void maxMinValueTimeTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -257,18 +257,18 @@ public void maxMinValueTimeTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -296,18 +296,18 @@ public void maxMinValueTimeTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -316,18 +316,18 @@ public void maxMinValueTimeTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -354,18 +354,18 @@ public void maxMinValueTimeWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -374,18 +374,18 @@ public void maxMinValueTimeWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -404,16 +404,16 @@ public void firstLastTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -422,16 +422,16 @@ public void firstLastTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -459,16 +459,16 @@ public void firstLastTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -477,16 +477,16 @@ public void firstLastTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -513,16 +513,16 @@ public void firstLastWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -531,16 +531,16 @@ public void firstLastWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -564,28 +564,28 @@ public void groupByWithWildcardTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + " where s3 > 5 or s4 = true GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -594,28 +594,28 @@ public void groupByWithWildcardTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + "where s3 > 5 or s4 = true GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -645,20 +645,20 @@ public void groupByWithWildcardTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + "where s3 > 5 or s5 like 'aligned_test3%' GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -667,20 +667,20 @@ public void groupByWithWildcardTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 where s3 > 5 or s5 like 'aligned_test3%' " + "select count(*) from root.db1.d1 where s3 > 5 or s5 like 'aligned_test3%' " + " GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -710,20 +710,20 @@ public void groupByWithWildcardTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + "where s3 > 5 or s5 like 'aligned_test3%' GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -732,20 +732,20 @@ public void groupByWithWildcardTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 where s3 > 5 or s5 like 'aligned_test3%' " + "select last_value(*) from root.db1.d1 where s3 > 5 or s5 like 'aligned_test3%' " + " GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java index 46b964a78adb2..85988127fa7db 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java @@ -52,9 +52,9 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete from root.sg1.d1.s1 where time <= 15"); - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s3 where time > 25"); + statement.execute("delete from root.db1.d1.s1 where time <= 15"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s3 where time > 25"); } catch (Exception e) { e.printStackTrace(); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java index 3461bbb32b2f1..1144dfcc28c6d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java @@ -64,9 +64,9 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete from root.sg1.d1.s1 where time <= 15"); - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s3 where time > 25"); + statement.execute("delete from root.db1.d1.s1 where time <= 15"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s3 where time > 25"); } catch (Exception e) { e.printStackTrace(); } @@ -86,16 +86,16 @@ public void countSumAvgTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -104,16 +104,16 @@ public void countSumAvgTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -135,16 +135,16 @@ public void countSumAvgTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -153,16 +153,16 @@ public void countSumAvgTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -183,16 +183,16 @@ public void countSumAvgWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -201,16 +201,16 @@ public void countSumAvgWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -231,18 +231,18 @@ public void maxMinValueTimeTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -251,18 +251,18 @@ public void maxMinValueTimeTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -289,18 +289,18 @@ public void maxMinValueTimeTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -309,18 +309,18 @@ public void maxMinValueTimeTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -347,18 +347,18 @@ public void maxMinValueTimeWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -367,18 +367,18 @@ public void maxMinValueTimeWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -395,16 +395,16 @@ public void firstLastTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -413,16 +413,16 @@ public void firstLastTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -450,16 +450,16 @@ public void firstLastTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -468,16 +468,16 @@ public void firstLastTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -504,16 +504,16 @@ public void firstLastWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -522,16 +522,16 @@ public void firstLastWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -554,27 +554,27 @@ public void groupByWithWildcardTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 GROUP BY ([1, 41), 10ms)")) { + "select count(*), last_value(*) from root.db1.d1 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -583,28 +583,28 @@ public void groupByWithWildcardTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + "GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -634,20 +634,20 @@ public void groupByWithWildcardTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -656,20 +656,20 @@ public void groupByWithWildcardTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -699,20 +699,20 @@ public void groupByWithWildcardTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -721,20 +721,20 @@ public void groupByWithWildcardTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } 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 530e0189c52ef..638fc6b1447b6 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 @@ -120,11 +120,11 @@ public void testInsertAlignedWithEmptyPage() throws SQLException { public void testInsertAlignedWithEmptyPage2() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time, s1,s2) aligned values(1,'aa','bb')"); - statement.execute("insert into root.sg.d1(time, s1,s2) aligned values(1,'aa','bb')"); - statement.execute("insert into root.sg.d1(time, s1,s2) aligned values(1,'aa','bb')"); + statement.execute("insert into root.db.d1(time, s1,s2) aligned values(1,'aa','bb')"); + statement.execute("insert into root.db.d1(time, s1,s2) aligned values(1,'aa','bb')"); + statement.execute("insert into root.db.d1(time, s1,s2) aligned values(1,'aa','bb')"); statement.execute("flush"); - statement.execute("insert into root.sg.d1(time, s1,s2) aligned values(1,'aa','bb')"); + statement.execute("insert into root.db.d1(time, s1,s2) aligned values(1,'aa','bb')"); } } @@ -132,19 +132,19 @@ public void testInsertAlignedWithEmptyPage2() throws SQLException { public void testInsertComplexAlignedValues() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.addBatch("create aligned timeseries root.sg.d1(s1 int32, s2 int32, s3 int32)"); - statement.addBatch("insert into root.sg.d1(time,s1) values(3,1)"); - statement.addBatch("insert into root.sg.d1(time,s1) values(1,1)"); - statement.addBatch("insert into root.sg.d1(time,s1) values(2,1)"); - statement.addBatch("insert into root.sg.d1(time,s2) values(2,2)"); - statement.addBatch("insert into root.sg.d1(time,s2) values(1,2)"); - statement.addBatch("insert into root.sg.d1(time,s2) values(3,2)"); - statement.addBatch("insert into root.sg.d1(time,s3) values(1,3)"); - statement.addBatch("insert into root.sg.d1(time,s3) values(3,3)"); + statement.addBatch("create aligned timeseries root.db.d1(s1 int32, s2 int32, s3 int32)"); + statement.addBatch("insert into root.db.d1(time,s1) values(3,1)"); + statement.addBatch("insert into root.db.d1(time,s1) values(1,1)"); + statement.addBatch("insert into root.db.d1(time,s1) values(2,1)"); + statement.addBatch("insert into root.db.d1(time,s2) values(2,2)"); + statement.addBatch("insert into root.db.d1(time,s2) values(1,2)"); + statement.addBatch("insert into root.db.d1(time,s2) values(3,2)"); + statement.addBatch("insert into root.db.d1(time,s3) values(1,3)"); + statement.addBatch("insert into root.db.d1(time,s3) values(3,3)"); statement.executeBatch(); try (ResultSet resultSet = - statement.executeQuery("select count(s1), count(s2), count(s3) from root.sg.d1")) { + statement.executeQuery("select count(s1), count(s2), count(s3) from root.db.d1")) { assertTrue(resultSet.next()); assertEquals(3, resultSet.getInt(1)); @@ -156,7 +156,7 @@ public void testInsertComplexAlignedValues() throws SQLException { statement.execute("flush"); try (ResultSet resultSet = - statement.executeQuery("select count(s1), count(s2), count(s3) from root.sg.d1")) { + statement.executeQuery("select count(s1), count(s2), count(s3) from root.db.d1")) { assertTrue(resultSet.next()); assertEquals(3, resultSet.getInt(1)); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues4IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues4IT.java index 244e86a6d8b06..314c287f83be2 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues4IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues4IT.java @@ -59,14 +59,14 @@ public void testExtendTextColumn() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time,s1,s2) aligned values(1,'test','test')"); - statement.execute("insert into root.sg.d1(time,s1,s2) aligned values(2,'test','test')"); - statement.execute("insert into root.sg.d1(time,s1,s2) aligned values(3,'test','test')"); - statement.execute("insert into root.sg.d1(time,s1,s2) aligned values(4,'test','test')"); - statement.execute("insert into root.sg.d1(time,s1,s3) aligned values(5,'test','test')"); - statement.execute("insert into root.sg.d1(time,s1,s2) aligned values(6,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s2) aligned values(1,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s2) aligned values(2,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s2) aligned values(3,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s2) aligned values(4,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s3) aligned values(5,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s2) aligned values(6,'test','test')"); statement.execute("flush"); - statement.execute("insert into root.sg.d1(time,s1,s3) aligned values(7,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s3) aligned values(7,'test','test')"); } catch (SQLException e) { fail(); } 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 1ac466653f6b0..b23fcc3587249 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 @@ -221,11 +221,11 @@ public void testUpdatingAlignedValues() throws SQLException { public void testInsertAlignedValuesWithSameTimestamp() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.addBatch("insert into root.sg.d1(time,s2) aligned values(1,2)"); - statement.addBatch("insert into root.sg.d1(time,s1) aligned values(1,2)"); + statement.addBatch("insert into root.db.d1(time,s2) aligned values(1,2)"); + statement.addBatch("insert into root.db.d1(time,s1) aligned values(1,2)"); statement.executeBatch(); - try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db.d1")) { assertTrue(resultSet.next()); assertEquals(1, resultSet.getLong(1)); @@ -236,7 +236,7 @@ public void testInsertAlignedValuesWithSameTimestamp() throws SQLException { } statement.execute("flush"); - try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db.d1")) { assertTrue(resultSet.next()); assertEquals(1, resultSet.getLong(1)); @@ -355,9 +355,9 @@ public void testInsertNonAlignedTimeseriesWithAligned() throws SQLException { public void testInsertAlignedValuesWithThreeLevelPath() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg_device(time, status) aligned values (4000, true)"); + statement.execute("insert into root.db_device(time, status) aligned values (4000, true)"); - try (ResultSet resultSet = statement.executeQuery("select ** from root.sg_device")) { + try (ResultSet resultSet = statement.executeQuery("select ** from root.db_device")) { assertTrue(resultSet.next()); assertTrue(resultSet.getBoolean(2)); assertFalse(resultSet.next()); @@ -384,7 +384,7 @@ public void testInsertMultiRows() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "insert into root.sg1.d1(time, s1, s2) aligned values(10, 2, 2), (11, 3, '3'), (12,12.11,false);"); + "insert into root.db1.d1(time, s1, s2) aligned values(10, 2, 2), (11, 3, '3'), (12,12.11,false);"); fail(); } catch (SQLException e) { assertTrue(e.getMessage(), e.getMessage().contains("data type is not consistent")); @@ -396,7 +396,7 @@ public void testInsertLargeNumber() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "insert into root.sg1.d1(time, s98, s99) aligned values(10, 2, 271840880000000000000000)"); + "insert into root.db1.d1(time, s98, s99) aligned values(10, 2, 271840880000000000000000)"); } catch (SQLException e) { fail(); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletion2IT.java index 0810a0abe5953..97ff1ad575773 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletion2IT.java @@ -52,8 +52,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 27"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 27"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletionIT.java index f02e2fd6ec8ae..f19c044bae53c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletionIT.java @@ -64,8 +64,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 27"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 27"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -82,14 +82,14 @@ public void selectAllAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { @@ -118,19 +118,19 @@ public void selectAllAlignedAndNonAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "20,root.sg1.d2.s1,20.0,FLOAT", - "40,root.sg1.d2.s2,40,INT32", - "30,root.sg1.d2.s3,30,INT64", - "30,root.sg1.d2.s4,false,BOOLEAN", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT", + "20,root.db1.d2.s1,20.0,FLOAT", + "40,root.db1.d2.s2,40,INT32", + "30,root.db1.d2.s3,30,INT64", + "30,root.db1.d2.s4,false,BOOLEAN", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.* order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.* order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { @@ -157,13 +157,13 @@ public void selectAllAlignedAndNonAlignedLastTest() { public void selectAllAlignedLastWithTimeFilterTest() { Set retSet = - new HashSet<>(Collections.singletonList("40,root.sg1.d1.s5,aligned_test40,TEXT")); + new HashSet<>(Collections.singletonList("40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select last * from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last * from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -190,13 +190,13 @@ public void selectSomeAlignedLastTest1() { Set retSet = new HashSet<>( Arrays.asList( - "30,root.sg1.d1.s4,false,BOOLEAN", "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "30,root.db1.d1.s4,false,BOOLEAN", "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { @@ -222,12 +222,12 @@ public void selectSomeAlignedLastTest1() { @Test public void selectSomeAlignedLastTest2() { Set retSet = - new HashSet<>(Collections.singletonList("30,root.sg1.d1.s4,false,BOOLEAN")); + new HashSet<>(Collections.singletonList("30,root.db1.d1.s4,false,BOOLEAN")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select last s1, s4 from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last s1, s4 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { @@ -254,13 +254,13 @@ public void selectSomeAlignedLastTest2() { public void selectSomeAlignedLastWithTimeFilterTest() { Set retSet = - new HashSet<>(Collections.singletonList("40,root.sg1.d1.s5,aligned_test40,TEXT")); + new HashSet<>(Collections.singletonList("40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { @@ -289,14 +289,14 @@ public void selectSomeAlignedAndNonAlignedLastWithTimeFilterTest() { Set retSet = new HashSet<>( Arrays.asList( - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "40,root.db1.d1.s5,aligned_test40,TEXT", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time > 30 order by timeseries asc")) { + "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheIT.java index 25b6a2098c9c3..3a209b74d723c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheIT.java @@ -74,17 +74,17 @@ public void selectAllAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "40,root.sg1.d1.s2,40,INT32", - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "40,root.db1.d1.s2,40,INT32", + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -113,22 +113,22 @@ public void selectAllAlignedAndNonAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "40,root.sg1.d1.s2,40,INT32", - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "20,root.sg1.d2.s1,20.0,FLOAT", - "40,root.sg1.d2.s2,40,INT32", - "30,root.sg1.d2.s3,30,INT64", - "30,root.sg1.d2.s4,false,BOOLEAN", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "40,root.db1.d1.s2,40,INT32", + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT", + "20,root.db1.d2.s1,20.0,FLOAT", + "40,root.db1.d2.s2,40,INT32", + "30,root.db1.d2.s3,30,INT64", + "30,root.db1.d2.s4,false,BOOLEAN", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.* order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.* order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -156,14 +156,14 @@ public void selectAllAlignedLastWithTimeFilterTest() { Set retSet = new HashSet<>( - Arrays.asList("40,root.sg1.d1.s2,40,INT32", "40,root.sg1.d1.s5,aligned_test40,TEXT")); + Arrays.asList("40,root.db1.d1.s2,40,INT32", "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last * from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last * from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -191,16 +191,16 @@ public void selectSomeAlignedLastTest1() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -227,13 +227,13 @@ public void selectSomeAlignedLastTest1() { public void selectSomeAlignedLastTest2() { Set retSet = new HashSet<>( - Arrays.asList("23,root.sg1.d1.s1,230000.0,FLOAT", "30,root.sg1.d1.s4,false,BOOLEAN")); + Arrays.asList("23,root.db1.d1.s1,230000.0,FLOAT", "30,root.db1.d1.s4,false,BOOLEAN")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last s1, s4 from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last s1, s4 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -260,14 +260,14 @@ public void selectSomeAlignedLastTest2() { public void selectSomeAlignedLastWithTimeFilterTest() { Set retSet = - new HashSet<>(Collections.singletonList("40,root.sg1.d1.s5,aligned_test40,TEXT")); + new HashSet<>(Collections.singletonList("40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -296,15 +296,15 @@ public void selectSomeAlignedAndNonAlignedLastWithTimeFilterTest() { Set retSet = new HashSet<>( Arrays.asList( - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "40,root.db1.d1.s5,aligned_test40,TEXT", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time > 30 order by timeseries asc")) { + "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletion2IT.java index efc2d65dd9185..65da253986853 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletion2IT.java @@ -55,8 +55,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 27"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 27"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletionIT.java index eaa134759c389..0ad7c3b390984 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletionIT.java @@ -53,8 +53,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 27"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 27"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBPredicatePushDownIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBPredicatePushDownIT.java index f9639d3ea2d2c..0b0ae45deae9f 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBPredicatePushDownIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBPredicatePushDownIT.java @@ -57,7 +57,7 @@ public static void tearDown() throws Exception { @Test public void testAlignedRawDataAlignByTime1() { - String expectedHeader1 = "Time,root.sg1.d1.s2,root.sg1.d1.s3,"; + String expectedHeader1 = "Time,root.db1.d1.s2,root.db1.d1.s3,"; String[] retArray1 = new String[] { "10,10,10,", @@ -72,46 +72,46 @@ public void testAlignedRawDataAlignByTime1() { "20,20,20," }; resultSetEqualTest( - "select s2, s3 from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); + "select s2, s3 from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); resultSetEqualTest( - "select s2, s3 from root.sg1.d1 where 9 <= s2 - 1 and 30 > s2", expectedHeader1, retArray1); + "select s2, s3 from root.db1.d1 where 9 <= s2 - 1 and 30 > s2", expectedHeader1, retArray1); retArray1 = new String[] {"20,20,20,"}; resultSetEqualTest( - "select s2, s3 from root.sg1.d1 where 9 <= s2 - 1 and 30 > s2 and 19 < time", + "select s2, s3 from root.db1.d1 where 9 <= s2 - 1 and 30 > s2 and 19 < time", expectedHeader1, retArray1); - String expectedHeader2 = "Time,root.sg1.d1.s3,"; + String expectedHeader2 = "Time,root.db1.d1.s3,"; String[] retArray2 = new String[] { "10,10,", "11,11,", "12,12,", "14,14,", "15,15,", "16,16,", "17,17,", "18,18,", "19,19,", "20,20," }; resultSetEqualTest( - "select s3 from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); + "select s3 from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); - String expectedHeader3 = "Time,root.sg1.d1.s2,"; + String expectedHeader3 = "Time,root.db1.d1.s2,"; String[] retArray3 = new String[] { "10,10,", "11,11,", "12,12,", "14,14,", "15,15,", "16,16,", "17,17,", "18,18,", "19,19,", "20,20," }; resultSetEqualTest( - "select s2 from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); + "select s2 from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); - String expectedHeader4 = "Time,root.sg1.d1.s2,"; + String expectedHeader4 = "Time,root.db1.d1.s2,"; String[] retArray4 = new String[] {"14,14,", "15,15,"}; resultSetEqualTest( - "select s2 from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30 offset 3 limit 2", + "select s2 from root.db1.d1 where s2 - 1 >= 9 and s2 < 30 offset 3 limit 2", expectedHeader4, retArray4); } @Test public void testAlignedRawDataAlignByTime2() { - String expectedHeader1 = "Time,root.sg1.d1.s2,root.sg1.d1.s3 + 1,"; + String expectedHeader1 = "Time,root.db1.d1.s2,root.db1.d1.s3 + 1,"; String[] retArray1 = new String[] { "3,null,30001.0,", @@ -133,9 +133,9 @@ public void testAlignedRawDataAlignByTime2() { "30,null,31.0,", }; resultSetEqualTest( - "select s2, s3 + 1 from root.sg1.d1 where s3 + 1 > 16", expectedHeader1, retArray1); + "select s2, s3 + 1 from root.db1.d1 where s3 + 1 > 16", expectedHeader1, retArray1); - String expectedHeader2 = "Time,root.sg1.d1.s2,"; + String expectedHeader2 = "Time,root.db1.d1.s2,"; String[] retArray2 = new String[] { "3,null,", @@ -156,9 +156,9 @@ public void testAlignedRawDataAlignByTime2() { "29,null,", "30,null,", }; - resultSetEqualTest("select s2 from root.sg1.d1 where s3 + 1 > 16", expectedHeader2, retArray2); + resultSetEqualTest("select s2 from root.db1.d1 where s3 + 1 > 16", expectedHeader2, retArray2); - String expectedHeader3 = "Time,root.sg1.d1.s3,"; + String expectedHeader3 = "Time,root.db1.d1.s3,"; String[] retArray3 = new String[] { "3,30000,", @@ -179,17 +179,17 @@ public void testAlignedRawDataAlignByTime2() { "29,29,", "30,30,", }; - resultSetEqualTest("select s3 from root.sg1.d1 where s3 + 1 > 16", expectedHeader3, retArray3); + resultSetEqualTest("select s3 from root.db1.d1 where s3 + 1 > 16", expectedHeader3, retArray3); - String expectedHeader4 = "Time,root.sg1.d1.s3,"; + String expectedHeader4 = "Time,root.db1.d1.s3,"; String[] retArray4 = new String[] {"3,30000,", "13,130000,", "16,16,"}; resultSetEqualTest( - "select s3 from root.sg1.d1 where s3 + 1 > 16 limit 3", expectedHeader4, retArray4); + "select s3 from root.db1.d1 where s3 + 1 > 16 limit 3", expectedHeader4, retArray4); } @Test public void testNonAlignedRawDataAlignByTime1() { - String expectedHeader1 = "Time,root.sg1.d2.s2,root.sg1.d2.s3,"; + String expectedHeader1 = "Time,root.db1.d2.s2,root.db1.d2.s3,"; String[] retArray1 = new String[] { "10,10,10,", @@ -205,37 +205,37 @@ public void testNonAlignedRawDataAlignByTime1() { "20,20,20," }; resultSetEqualTest( - "select s2, s3 from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); + "select s2, s3 from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); - String expectedHeader2 = "Time,root.sg1.d2.s3,"; + String expectedHeader2 = "Time,root.db1.d2.s3,"; String[] retArray2 = new String[] { "10,10,", "11,11,", "12,12,", "13,13,", "14,14,", "15,15,", "16,16,", "17,17,", "18,18,", "19,19,", "20,20," }; resultSetEqualTest( - "select s3 from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); + "select s3 from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); - String expectedHeader3 = "Time,root.sg1.d2.s2,"; + String expectedHeader3 = "Time,root.db1.d2.s2,"; String[] retArray3 = new String[] { "10,10,", "11,11,", "12,12,", "13,13,", "14,14,", "15,15,", "16,16,", "17,17,", "18,18,", "19,19,", "20,20," }; resultSetEqualTest( - "select s2 from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); + "select s2 from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); - String expectedHeader4 = "Time,root.sg1.d2.s2,"; + String expectedHeader4 = "Time,root.db1.d2.s2,"; String[] retArray4 = new String[] {"12,12,", "13,13,", "14,14,"}; resultSetEqualTest( - "select s2 from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 limit 3 offset 2", + "select s2 from root.db1.d2 where s2 - 1 >= 9 and s2 < 30 limit 3 offset 2", expectedHeader4, retArray4); } @Test public void testNonAlignedRawDataAlignByTime2() { - String expectedHeader1 = "Time,root.sg1.d2.s2,root.sg1.d2.s3,"; + String expectedHeader1 = "Time,root.db1.d2.s2,root.db1.d2.s3,"; String[] retArray1 = new String[] { "16,16,16,", @@ -255,9 +255,9 @@ public void testNonAlignedRawDataAlignByTime2() { "30,null,30,", }; resultSetEqualTest( - "select s2, s3 from root.sg1.d2 where s3 + 1 > 16", expectedHeader1, retArray1); + "select s2, s3 from root.db1.d2 where s3 + 1 > 16", expectedHeader1, retArray1); - String expectedHeader2 = "Time,root.sg1.d2.s2,"; + String expectedHeader2 = "Time,root.db1.d2.s2,"; String[] retArray2 = new String[] { "16,16,", @@ -276,28 +276,28 @@ public void testNonAlignedRawDataAlignByTime2() { "29,null,", "30,null,", }; - resultSetEqualTest("select s2 from root.sg1.d2 where s3 + 1 > 16", expectedHeader2, retArray2); + resultSetEqualTest("select s2 from root.db1.d2 where s3 + 1 > 16", expectedHeader2, retArray2); - String expectedHeader3 = "Time,root.sg1.d2.s3,"; + String expectedHeader3 = "Time,root.db1.d2.s3,"; String[] retArray3 = new String[] { "16,16,", "17,17,", "18,18,", "19,19,", "20,20,", "21,21,", "22,22,", "23,23,", "24,24,", "25,25,", "26,26,", "27,27,", "28,28,", "29,29,", "30,30,", }; - resultSetEqualTest("select s3 from root.sg1.d2 where s3 + 1 > 16", expectedHeader3, retArray3); + resultSetEqualTest("select s3 from root.db1.d2 where s3 + 1 > 16", expectedHeader3, retArray3); - String expectedHeader4 = "Time,root.sg1.d2.s3,"; + String expectedHeader4 = "Time,root.db1.d2.s3,"; String[] retArray4 = new String[] { "26,26,", "27,27,", "28,28,", "29,29,", "30,30,", }; resultSetEqualTest( - "select s3 from root.sg1.d2 where s3 + 1 > 16 offset 10", expectedHeader4, retArray4); + "select s3 from root.db1.d2 where s3 + 1 > 16 offset 10", expectedHeader4, retArray4); } @Test public void testMixRawDataAlignByTime() { - String expectedHeader1 = "Time,root.sg1.d1.s2,root.sg1.d2.s2,root.sg1.d1.s3,root.sg1.d2.s3,"; + String expectedHeader1 = "Time,root.db1.d1.s2,root.db1.d2.s2,root.db1.d1.s3,root.db1.d2.s3,"; String[] retArray1 = new String[] { "10,10,10,10,10,", @@ -312,174 +312,174 @@ public void testMixRawDataAlignByTime() { "20,20,20,20,20," }; resultSetEqualTest( - "select s2, s3 from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", + "select s2, s3 from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); } @Test public void testAlignedAggregationAlignByTime1() { - String expectedHeader1 = "count(root.sg1.d1.s2),count(root.sg1.d1.s3),"; + String expectedHeader1 = "count(root.db1.d1.s2),count(root.db1.d1.s3),"; String[] retArray1 = new String[] { "10,10,", }; resultSetEqualTest( - "select count(s2), count(s3) from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", + "select count(s2), count(s3) from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); - String expectedHeader2 = "count(root.sg1.d1.s3),"; + String expectedHeader2 = "count(root.db1.d1.s3),"; String[] retArray2 = new String[] {"10,"}; resultSetEqualTest( - "select count(s3) from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", + "select count(s3) from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); - String expectedHeader3 = "count(root.sg1.d1.s2),"; + String expectedHeader3 = "count(root.db1.d1.s2),"; String[] retArray3 = new String[] { "10,", }; resultSetEqualTest( - "select count(s2) from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", + "select count(s2) from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); } @Test public void testAlignedAggregationAlignByTime2() { - String expectedHeader1 = "count(root.sg1.d1.s2),count(root.sg1.d1.s3 + 1),"; + String expectedHeader1 = "count(root.db1.d1.s2),count(root.db1.d1.s3 + 1),"; String[] retArray1 = new String[] { "6,17,", }; resultSetEqualTest( - "select count(s2), count(s3 + 1) from root.sg1.d1 where s3 + 1 > 16", + "select count(s2), count(s3 + 1) from root.db1.d1 where s3 + 1 > 16", expectedHeader1, retArray1); - String expectedHeader2 = "count(root.sg1.d1.s2),"; + String expectedHeader2 = "count(root.db1.d1.s2),"; String[] retArray2 = new String[] { "6,", }; resultSetEqualTest( - "select count(s2) from root.sg1.d1 where s3 + 1 > 16", expectedHeader2, retArray2); + "select count(s2) from root.db1.d1 where s3 + 1 > 16", expectedHeader2, retArray2); - String expectedHeader3 = "count(root.sg1.d1.s3),"; + String expectedHeader3 = "count(root.db1.d1.s3),"; String[] retArray3 = new String[] { "17,", }; resultSetEqualTest( - "select count(s3) from root.sg1.d1 where s3 + 1 > 16", expectedHeader3, retArray3); + "select count(s3) from root.db1.d1 where s3 + 1 > 16", expectedHeader3, retArray3); } @Test public void testNonAlignedAggregationAlignByTime1() { - String expectedHeader1 = "count(root.sg1.d2.s2),count(root.sg1.d2.s3),"; + String expectedHeader1 = "count(root.db1.d2.s2),count(root.db1.d2.s3),"; String[] retArray1 = new String[] {"11,11,"}; resultSetEqualTest( - "select count(s2), count(s3) from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", + "select count(s2), count(s3) from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); - String expectedHeader2 = "count(root.sg1.d2.s3),"; + String expectedHeader2 = "count(root.db1.d2.s3),"; String[] retArray2 = new String[] {"11,"}; resultSetEqualTest( - "select count(s3) from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", + "select count(s3) from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); - String expectedHeader3 = "count(root.sg1.d2.s2),"; + String expectedHeader3 = "count(root.db1.d2.s2),"; String[] retArray3 = new String[] {"11,"}; resultSetEqualTest( - "select count(s2) from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", + "select count(s2) from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); } @Test public void testNonAlignedAggregationAlignByTime2() { - String expectedHeader1 = "count(root.sg1.d2.s2),count(root.sg1.d2.s3),"; + String expectedHeader1 = "count(root.db1.d2.s2),count(root.db1.d2.s3),"; String[] retArray1 = new String[] { "5,15,", }; resultSetEqualTest( - "select count(s2), count(s3) from root.sg1.d2 where s3 + 1 > 16", + "select count(s2), count(s3) from root.db1.d2 where s3 + 1 > 16", expectedHeader1, retArray1); - String expectedHeader2 = "count(root.sg1.d2.s2),"; + String expectedHeader2 = "count(root.db1.d2.s2),"; String[] retArray2 = new String[] { "5,", }; resultSetEqualTest( - "select count(s2) from root.sg1.d2 where s3 + 1 > 16", expectedHeader2, retArray2); + "select count(s2) from root.db1.d2 where s3 + 1 > 16", expectedHeader2, retArray2); - String expectedHeader3 = "count(root.sg1.d2.s3),"; + String expectedHeader3 = "count(root.db1.d2.s3),"; String[] retArray3 = new String[] { "15,", }; resultSetEqualTest( - "select count(s3) from root.sg1.d2 where s3 + 1 > 16", expectedHeader3, retArray3); + "select count(s3) from root.db1.d2 where s3 + 1 > 16", expectedHeader3, retArray3); } @Test public void testMixAggregationAlignByTime() { String expectedHeader1 = - "count(root.sg1.d1.s2),count(root.sg1.d2.s2),count(root.sg1.d1.s3),count(root.sg1.d2.s3),"; + "count(root.db1.d1.s2),count(root.db1.d2.s2),count(root.db1.d1.s3),count(root.db1.d2.s3),"; String[] retArray1 = new String[] { "10,10,10,10,", }; resultSetEqualTest( - "select count(s2), count(s3) from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", + "select count(s2), count(s3) from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); } @Test public void testAlignedGroupByTimeAlignByTime1() { - String expectedHeader = "Time,count(root.sg1.d1.s2),sum(root.sg1.d1.s3),"; + String expectedHeader = "Time,count(root.db1.d1.s2),sum(root.db1.d1.s3),"; String[] retArray = new String[] {"1,1,10.0,", "11,9,142.0,", "21,0,null,", "31,0,null,"}; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", + "select count(s2), sum(s3) from root.db1.d1 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", expectedHeader, retArray); } @Test public void testAlignedGroupByTimeAlignByTime2() { - String expectedHeader = "Time,count(root.sg1.d1.s2),sum(root.sg1.d1.s3),"; + String expectedHeader = "Time,count(root.db1.d1.s2),sum(root.db1.d1.s3),"; String[] retArray = new String[] {"1,0,30000.0,", "11,6,130090.0,", "21,0,230232.0,", "31,0,null,"}; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d1 where s3 + 1 > 16 group by ([1, 41), 10ms)", + "select count(s2), sum(s3) from root.db1.d1 where s3 + 1 > 16 group by ([1, 41), 10ms)", expectedHeader, retArray); } @Test public void testNonAlignedGroupByTimeAlignByTime1() { - String expectedHeader = "Time,count(root.sg1.d2.s2),sum(root.sg1.d2.s3 + 1),"; + String expectedHeader = "Time,count(root.db1.d2.s2),sum(root.db1.d2.s3 + 1),"; String[] retArray = new String[] {"1,1,11.0,", "11,10,165.0,", "21,0,null,", "31,0,null,"}; resultSetEqualTest( - "select count(s2), sum(s3 + 1) from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", + "select count(s2), sum(s3 + 1) from root.db1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", expectedHeader, retArray); } @Test public void testNonAlignedGroupByTimeAlignByTime2() { - String expectedHeader = "Time,count(root.sg1.d2.s2),sum(root.sg1.d2.s3),"; + String expectedHeader = "Time,count(root.db1.d2.s2),sum(root.db1.d2.s3),"; String[] retArray = new String[] {"1,0,null,", "11,5,90.0,", "21,0,255.0,", "31,0,null,"}; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d2 where s3 + 1 > 16 group by ([1, 41), 10ms)", + "select count(s2), sum(s3) from root.db1.d2 where s3 + 1 > 16 group by ([1, 41), 10ms)", expectedHeader, retArray); } @@ -487,13 +487,13 @@ public void testNonAlignedGroupByTimeAlignByTime2() { @Test public void testMixGroupByTimeAlignByTime() { String expectedHeader = - "Time,count(root.sg1.d1.s2),count(root.sg1.d2.s2),sum(root.sg1.d1.s3),sum(root.sg1.d2.s3),"; + "Time,count(root.db1.d1.s2),count(root.db1.d2.s2),sum(root.db1.d1.s3),sum(root.db1.d2.s3),"; String[] retArray = new String[] { "1,1,1,10.0,10.0,", "11,9,9,142.0,142.0,", "21,0,0,null,null,", "31,0,0,null,null," }; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", + "select count(s2), sum(s3) from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", expectedHeader, retArray); } @@ -503,30 +503,30 @@ public void testRawDataAlignByDevice1() { String expectedHeader = "Time,Device,s2,s3,"; String[] retArray = new String[] { - "10,root.sg1.d2,10,10,", - "11,root.sg1.d2,11,11,", - "12,root.sg1.d2,12,12,", - "13,root.sg1.d2,13,13,", - "14,root.sg1.d2,14,14,", - "15,root.sg1.d2,15,15,", - "16,root.sg1.d2,16,16,", - "17,root.sg1.d2,17,17,", - "18,root.sg1.d2,18,18,", - "19,root.sg1.d2,19,19,", - "20,root.sg1.d2,20,20,", - "10,root.sg1.d1,10,10,", - "11,root.sg1.d1,11,11,", - "12,root.sg1.d1,12,12,", - "14,root.sg1.d1,14,14,", - "15,root.sg1.d1,15,15,", - "16,root.sg1.d1,16,16,", - "17,root.sg1.d1,17,17,", - "18,root.sg1.d1,18,18,", - "19,root.sg1.d1,19,19,", - "20,root.sg1.d1,20,20," + "10,root.db1.d2,10,10,", + "11,root.db1.d2,11,11,", + "12,root.db1.d2,12,12,", + "13,root.db1.d2,13,13,", + "14,root.db1.d2,14,14,", + "15,root.db1.d2,15,15,", + "16,root.db1.d2,16,16,", + "17,root.db1.d2,17,17,", + "18,root.db1.d2,18,18,", + "19,root.db1.d2,19,19,", + "20,root.db1.d2,20,20,", + "10,root.db1.d1,10,10,", + "11,root.db1.d1,11,11,", + "12,root.db1.d1,12,12,", + "14,root.db1.d1,14,14,", + "15,root.db1.d1,15,15,", + "16,root.db1.d1,16,16,", + "17,root.db1.d1,17,17,", + "18,root.db1.d1,18,18,", + "19,root.db1.d1,19,19,", + "20,root.db1.d1,20,20," }; resultSetEqualTest( - "select s2, s3 from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 order by device desc align by device", + "select s2, s3 from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30 order by device desc align by device", expectedHeader, retArray); } @@ -536,41 +536,41 @@ public void testRawDataAlignByDevice2() { String expectedHeader = "Time,Device,s2,s3 + 1,"; String[] retArray = new String[] { - "3,root.sg1.d1,null,30001.0,", - "13,root.sg1.d1,130000,130001.0,", - "16,root.sg1.d1,16,17.0,", - "17,root.sg1.d1,17,18.0,", - "18,root.sg1.d1,18,19.0,", - "19,root.sg1.d1,19,20.0,", - "20,root.sg1.d1,20,21.0,", - "21,root.sg1.d1,null,22.0,", - "22,root.sg1.d1,null,23.0,", - "23,root.sg1.d1,null,230001.0,", - "24,root.sg1.d1,null,25.0,", - "25,root.sg1.d1,null,26.0,", - "26,root.sg1.d1,null,27.0,", - "27,root.sg1.d1,null,28.0,", - "28,root.sg1.d1,null,29.0,", - "29,root.sg1.d1,null,30.0,", - "30,root.sg1.d1,null,31.0,", - "16,root.sg1.d2,16,17.0,", - "17,root.sg1.d2,17,18.0,", - "18,root.sg1.d2,18,19.0,", - "19,root.sg1.d2,19,20.0,", - "20,root.sg1.d2,20,21.0,", - "21,root.sg1.d2,null,22.0,", - "22,root.sg1.d2,null,23.0,", - "23,root.sg1.d2,null,24.0,", - "24,root.sg1.d2,null,25.0,", - "25,root.sg1.d2,null,26.0,", - "26,root.sg1.d2,null,27.0,", - "27,root.sg1.d2,null,28.0,", - "28,root.sg1.d2,null,29.0,", - "29,root.sg1.d2,null,30.0,", - "30,root.sg1.d2,null,31.0,", + "3,root.db1.d1,null,30001.0,", + "13,root.db1.d1,130000,130001.0,", + "16,root.db1.d1,16,17.0,", + "17,root.db1.d1,17,18.0,", + "18,root.db1.d1,18,19.0,", + "19,root.db1.d1,19,20.0,", + "20,root.db1.d1,20,21.0,", + "21,root.db1.d1,null,22.0,", + "22,root.db1.d1,null,23.0,", + "23,root.db1.d1,null,230001.0,", + "24,root.db1.d1,null,25.0,", + "25,root.db1.d1,null,26.0,", + "26,root.db1.d1,null,27.0,", + "27,root.db1.d1,null,28.0,", + "28,root.db1.d1,null,29.0,", + "29,root.db1.d1,null,30.0,", + "30,root.db1.d1,null,31.0,", + "16,root.db1.d2,16,17.0,", + "17,root.db1.d2,17,18.0,", + "18,root.db1.d2,18,19.0,", + "19,root.db1.d2,19,20.0,", + "20,root.db1.d2,20,21.0,", + "21,root.db1.d2,null,22.0,", + "22,root.db1.d2,null,23.0,", + "23,root.db1.d2,null,24.0,", + "24,root.db1.d2,null,25.0,", + "25,root.db1.d2,null,26.0,", + "26,root.db1.d2,null,27.0,", + "27,root.db1.d2,null,28.0,", + "28,root.db1.d2,null,29.0,", + "29,root.db1.d2,null,30.0,", + "30,root.db1.d2,null,31.0,", }; resultSetEqualTest( - "select s2, s3 + 1 from root.sg1.d1, root.sg1.d2 where s3 + 1 > 16 align by device", + "select s2, s3 + 1 from root.db1.d1, root.db1.d2 where s3 + 1 > 16 align by device", expectedHeader, retArray); } @@ -578,9 +578,9 @@ public void testRawDataAlignByDevice2() { @Test public void testAggregationAlignByDevice1() { String expectedHeader = "Device,count(s2),sum(s3),"; - String[] retArray = new String[] {"root.sg1.d2,11,165.0,", "root.sg1.d1,10,152.0,"}; + String[] retArray = new String[] {"root.db1.d2,11,165.0,", "root.db1.d1,10,152.0,"}; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 order by device desc align by device", + "select count(s2), sum(s3) from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30 order by device desc align by device", expectedHeader, retArray); } @@ -588,9 +588,9 @@ public void testAggregationAlignByDevice1() { @Test public void testAggregationAlignByDevice2() { String expectedHeader = "Device,count(s2),sum(s3 + 1),"; - String[] retArray = new String[] {"root.sg1.d1,6,390339.0,", "root.sg1.d2,5,360.0,"}; + String[] retArray = new String[] {"root.db1.d1,6,390339.0,", "root.db1.d2,5,360.0,"}; resultSetEqualTest( - "select count(s2), sum(s3 + 1) from root.sg1.d1, root.sg1.d2 where s3 + 1 > 16 align by device", + "select count(s2), sum(s3 + 1) from root.db1.d1, root.db1.d2 where s3 + 1 > 16 align by device", expectedHeader, retArray); } @@ -600,17 +600,17 @@ public void testGroupByTimeAlignByDevice1() { String expectedHeader = "Time,Device,count(s2),sum(s3),"; String[] retArray = new String[] { - "1,root.sg1.d2,1,10.0,", - "11,root.sg1.d2,10,155.0,", - "21,root.sg1.d2,0,null,", - "31,root.sg1.d2,0,null,", - "1,root.sg1.d1,1,10.0,", - "11,root.sg1.d1,9,142.0,", - "21,root.sg1.d1,0,null,", - "31,root.sg1.d1,0,null," + "1,root.db1.d2,1,10.0,", + "11,root.db1.d2,10,155.0,", + "21,root.db1.d2,0,null,", + "31,root.db1.d2,0,null,", + "1,root.db1.d1,1,10.0,", + "11,root.db1.d1,9,142.0,", + "21,root.db1.d1,0,null,", + "31,root.db1.d1,0,null," }; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms) order by device desc align by device", + "select count(s2), sum(s3) from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms) order by device desc align by device", expectedHeader, retArray); } @@ -620,17 +620,17 @@ public void testGroupByTimeAlignByDevice2() { String expectedHeader = "Time,Device,count(s2),sum(s3 + 1),"; String[] retArray = new String[] { - "1,root.sg1.d1,0,30001.0,", - "11,root.sg1.d1,6,130096.0,", - "21,root.sg1.d1,0,230242.0,", - "31,root.sg1.d1,0,null,", - "1,root.sg1.d2,0,null,", - "11,root.sg1.d2,5,95.0,", - "21,root.sg1.d2,0,265.0,", - "31,root.sg1.d2,0,null," + "1,root.db1.d1,0,30001.0,", + "11,root.db1.d1,6,130096.0,", + "21,root.db1.d1,0,230242.0,", + "31,root.db1.d1,0,null,", + "1,root.db1.d2,0,null,", + "11,root.db1.d2,5,95.0,", + "21,root.db1.d2,0,265.0,", + "31,root.db1.d2,0,null," }; resultSetEqualTest( - "select count(s2), sum(s3 + 1) from root.sg1.d1, root.sg1.d2 where s3 + 1 > 16 group by ([1, 41), 10ms) align by device", + "select count(s2), sum(s3 + 1) from root.db1.d1, root.db1.d2 where s3 + 1 > 16 group by ([1, 41), 10ms) align by device", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletion2IT.java index 01e9466fcbab6..dee36b10de1ba 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletion2IT.java @@ -54,10 +54,10 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s2 where time <= 40"); - statement.execute("delete from root.sg1.d1.s1 where time <= 21"); - statement.execute("delete from root.sg1.d1.s5 where time <= 31 and time > 20"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s2 where time <= 40"); + statement.execute("delete from root.db1.d1.s1 where time <= 21"); + statement.execute("delete from root.db1.d1.s5 where time <= 31 and time > 20"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletionIT.java index 5bd02dbacacc8..1b8cba96daa79 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletionIT.java @@ -58,10 +58,10 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s2 where time <= 40"); - statement.execute("delete from root.sg1.d1.s1 where time <= 21"); - statement.execute("delete from root.sg1.d1.s5 where time <= 31 and time > 20"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s2 where time <= 40"); + statement.execute("delete from root.db1.d1.s1 where time <= 21"); + statement.execute("delete from root.db1.d1.s5 where time <= 31 and time > 20"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -119,11 +119,11 @@ public void selectAllAlignedWithoutValueFilterTest() { "40,null,null,null,aligned_test40", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.d1")) { + ResultSet resultSet = statement.executeQuery("select * from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -198,20 +198,20 @@ public void selectAllAlignedAndNonAlignedTest() { }; String[] columnNames = { - "root.sg1.d1.s1", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5", - "root.sg1.d2.s1", - "root.sg1.d2.s2", - "root.sg1.d2.s3", - "root.sg1.d2.s4", - "root.sg1.d2.s5" + "root.db1.d1.s1", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5", + "root.db1.d2.s1", + "root.db1.d2.s2", + "root.db1.d2.s3", + "root.db1.d2.s4", + "root.db1.d2.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.*")) { + ResultSet resultSet = statement.executeQuery("select * from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -269,12 +269,12 @@ public void selectAllAlignedWithTimeFilterTest() { "33,null,null,null,aligned_test33", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where time >= 9 and time <= 33")) { + statement.executeQuery("select * from root.db1.d1 where time >= 9 and time <= 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -338,11 +338,11 @@ public void selectSomeAlignedWithoutValueFilterTest1() { "40,null,null,aligned_test40", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select s1,s4,s5 from root.sg1.d1")) { + ResultSet resultSet = statement.executeQuery("select s1,s4,s5 from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -395,11 +395,11 @@ public void selectSomeAlignedWithoutValueFilterTest2() { "30,null,false", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select s1,s4 from root.sg1.d1")) { + ResultSet resultSet = statement.executeQuery("select s1,s4 from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -446,13 +446,13 @@ public void selectSomeAlignedWithTimeFilterTest() { "34,null,null,aligned_test34", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where time >= 16 and time <= 34")) { + "select s1,s4,s5 from root.db1.d1 where time >= 16 and time <= 34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -506,19 +506,19 @@ public void selectSomeAlignedAndNonAlignedWithTimeFilterTest() { }; String[] columnNames = { - "root.sg1.d2.s5", - "root.sg1.d1.s4", - "root.sg1.d2.s1", - "root.sg1.d1.s5", - "root.sg1.d2.s4", - "root.sg1.d1.s1" + "root.db1.d2.s5", + "root.db1.d1.s4", + "root.db1.d2.s1", + "root.db1.d1.s5", + "root.db1.d2.s4", + "root.db1.d1.s1" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time >= 16 and time <= 34")) { + "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time >= 16 and time <= 34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java index bc77f5d3947dc..3fed444c8741b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java @@ -193,19 +193,19 @@ public void allPrivilegesTest() throws SQLException { public void testSetDeleteSG() throws SQLException { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("CREATE USER sgtest 'sgtest123456'"); + adminStmt.execute("CREATE USER dbtest 'sgtest123456'"); try (Connection userCon = EnvFactory.getEnv().getConnection("sgtest", "sgtest123456"); Statement userStmt = userCon.createStatement()) { Assert.assertThrows( - SQLException.class, () -> userStmt.execute("CREATE DATABASE root.sgtest")); + SQLException.class, () -> userStmt.execute("CREATE DATABASE root.dbtest")); - adminStmt.execute("GRANT SYSTEM ON root.** TO USER sgtest"); + adminStmt.execute("GRANT SYSTEM ON root.** TO USER dbtest"); try { - userStmt.execute("CREATE DATABASE root.sgtest"); - userStmt.execute("DELETE DATABASE root.sgtest"); + userStmt.execute("CREATE DATABASE root.dbtest"); + userStmt.execute("DELETE DATABASE root.dbtest"); } catch (SQLException e) { fail(e.getMessage()); } @@ -355,23 +355,23 @@ public void templateQueryTest() throws SQLException { try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser", "temppw123456"); Statement userStmt = userCon.createStatement()) { adminStmt.execute( - "GRANT READ_DATA ON root.sg.aligned_template.temperature TO USER tempuser"); - adminStmt.execute("CREATE DATABASE root.sg"); + "GRANT READ_DATA ON root.db.aligned_template.temperature TO USER tempuser"); + adminStmt.execute("CREATE DATABASE root.db"); adminStmt.execute( "create device template t1 aligned (temperature FLOAT encoding=Gorilla, status BOOLEAN encoding=PLAIN);"); - adminStmt.execute("set device template t1 to root.sg.aligned_template;"); - adminStmt.execute("create timeseries using device template on root.sg.aligned_template;"); + adminStmt.execute("set device template t1 to root.db.aligned_template;"); + adminStmt.execute("create timeseries using device template on root.db.aligned_template;"); adminStmt.execute( - "insert into root.sg.aligned_template(time,temperature,status) values(1,20,false),(2,22.1,true),(3,18,false);"); + "insert into root.db.aligned_template(time,temperature,status) values(1,20,false),(2,22.1,true),(3,18,false);"); - ResultSet set1 = adminStmt.executeQuery("SELECT * from root.sg.aligned_template"); + ResultSet set1 = adminStmt.executeQuery("SELECT * from root.db.aligned_template"); assertEquals(3, set1.getMetaData().getColumnCount()); - assertEquals("root.sg.aligned_template.temperature", set1.getMetaData().getColumnName(2)); - assertEquals("root.sg.aligned_template.status", set1.getMetaData().getColumnName(3)); + assertEquals("root.db.aligned_template.temperature", set1.getMetaData().getColumnName(2)); + assertEquals("root.db.aligned_template.status", set1.getMetaData().getColumnName(3)); - ResultSet set2 = userStmt.executeQuery("SELECT * from root.sg.aligned_template"); + ResultSet set2 = userStmt.executeQuery("SELECT * from root.db.aligned_template"); assertEquals(2, set2.getMetaData().getColumnCount()); - assertEquals("root.sg.aligned_template.temperature", set2.getMetaData().getColumnName(2)); + assertEquals("root.db.aligned_template.temperature", set2.getMetaData().getColumnName(2)); } } } @@ -882,8 +882,8 @@ public void testExecuteBatchWithPrivilege() throws SQLException { adminStmt.execute("CREATE USER tempuser 'temppw123456'"); try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser", "temppw123456"); Statement userStatement = userCon.createStatement()) { - userStatement.addBatch("CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64"); - userStatement.addBatch("CREATE TIMESERIES root.sg2.d1.s1 WITH DATATYPE=INT64"); + userStatement.addBatch("CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT64"); + userStatement.addBatch("CREATE TIMESERIES root.db2.d1.s1 WITH DATATYPE=INT64"); Assert.assertThrows(BatchUpdateException.class, () -> userStatement.executeBatch()); } } @@ -894,19 +894,19 @@ public void testExecuteBatchWithPrivilege1() throws SQLException { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { adminStmt.execute("CREATE USER tempuser 'temppw123456'"); - adminStmt.execute("GRANT WRITE_DATA on root.sg1.** TO USER tempuser"); - adminStmt.execute("GRANT WRITE_SCHEMA on root.sg1.** TO USER tempuser"); + adminStmt.execute("GRANT WRITE_DATA on root.db1.** TO USER tempuser"); + adminStmt.execute("GRANT WRITE_SCHEMA on root.db1.** TO USER tempuser"); adminStmt.execute("GRANT SYSTEM on root.** TO USER tempuser"); try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser", "temppw123456"); Statement userStatement = userCon.createStatement()) { - userStatement.addBatch("insert into root.sg1.d1(timestamp,s1) values (1,1)"); - userStatement.addBatch("insert into root.sg1.d1(timestamp,s2) values (3,1)"); - userStatement.addBatch("insert into root.sg2.d1(timestamp,s1) values (2,1)"); - userStatement.addBatch("insert into root.sg2.d1(timestamp,s1) values (4,1)"); + userStatement.addBatch("insert into root.db1.d1(timestamp,s1) values (1,1)"); + userStatement.addBatch("insert into root.db1.d1(timestamp,s2) values (3,1)"); + userStatement.addBatch("insert into root.db2.d1(timestamp,s1) values (2,1)"); + userStatement.addBatch("insert into root.db2.d1(timestamp,s1) values (4,1)"); Assert.assertThrows(BatchUpdateException.class, userStatement::executeBatch); } - ResultSet resultSet = adminStmt.executeQuery("select * from root.sg1.**"); + ResultSet resultSet = adminStmt.executeQuery("select * from root.db1.**"); String[] expected = new String[] {"1, 1.0", "1, null", "3, null", "3, 1.0"}; List expectedList = new ArrayList<>(); Collections.addAll(expectedList, expected); @@ -915,11 +915,11 @@ public void testExecuteBatchWithPrivilege1() throws SQLException { result.add( resultSet.getString(ColumnHeaderConstant.TIME) + ", " - + resultSet.getString("root.sg1.d1.s1")); + + resultSet.getString("root.db1.d1.s1")); result.add( resultSet.getString(ColumnHeaderConstant.TIME) + ", " - + resultSet.getString("root.sg1.d1.s2")); + + resultSet.getString("root.db1.d1.s2")); } assertEquals(expected.length, result.size()); assertTrue(expectedList.containsAll(result)); @@ -1155,27 +1155,27 @@ public void testQueryTemplate() throws SQLException { Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement(); adminStmt.execute("CREATE USER user1 'password123456'"); - adminStmt.execute("GRANT READ_DATA ON root.sg.d1.** TO USER user1 with grant option;"); - adminStmt.execute("GRANT READ_DATA ON root.sg.aligned_template.temperature TO USER user1;"); - adminStmt.execute("CREATE DATABASE root.sg;"); + adminStmt.execute("GRANT READ_DATA ON root.db.d1.** TO USER user1 with grant option;"); + adminStmt.execute("GRANT READ_DATA ON root.db.aligned_template.temperature TO USER user1;"); + adminStmt.execute("CREATE DATABASE root.db;"); adminStmt.execute( "create device template t1 aligned (temperature FLOAT encoding=Gorilla, status BOOLEAN encoding=PLAIN);"); - adminStmt.execute("set device template t1 to root.sg.aligned_template;"); - adminStmt.execute("insert into root.sg.d1(time,s1,s2) values(1,1,1)"); - adminStmt.execute("insert into root.sg.d2(time,s1,s2) values(1,1,1)"); + adminStmt.execute("set device template t1 to root.db.aligned_template;"); + adminStmt.execute("insert into root.db.d1(time,s1,s2) values(1,1,1)"); + adminStmt.execute("insert into root.db.d2(time,s1,s2) values(1,1,1)"); adminStmt.execute( - "insert into root.sg.aligned_template(time,temperature,status) values(1,20,true)"); - try (ResultSet resultSet = adminStmt.executeQuery("select * from root.sg.**;")) { + "insert into root.db.aligned_template(time,temperature,status) values(1,20,true)"); + try (ResultSet resultSet = adminStmt.executeQuery("select * from root.db.**;")) { Set standards = new HashSet<>( Arrays.asList( "Time", - "root.sg.aligned_template.temperature", - "root.sg.aligned_template.status", - "root.sg.d2.s1", - "root.sg.d2.s2", - "root.sg.d1.s1", - "root.sg.d1.s2")); + "root.db.aligned_template.temperature", + "root.db.aligned_template.status", + "root.db.d2.s1", + "root.db.d2.s2", + "root.db.d1.s1", + "root.db.d1.s2")); ResultSetMetaData metaData = resultSet.getMetaData(); for (int i = 1; i < metaData.getColumnCount() + 1; i++) { Assert.assertTrue(standards.remove(metaData.getColumnName(i))); @@ -1189,9 +1189,9 @@ public void testQueryTemplate() throws SQLException { new HashSet<>( Arrays.asList( "Time", - "root.sg.aligned_template.temperature", - "root.sg.d1.s1", - "root.sg.d1.s2")); + "root.db.aligned_template.temperature", + "root.db.d1.s1", + "root.db.d1.s2")); ResultSetMetaData metaData = resultSet.getMetaData(); for (int i = 1; i < metaData.getColumnCount() + 1; i++) { Assert.assertTrue(standards.remove(metaData.getColumnName(i))); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSeriesPermissionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSeriesPermissionIT.java index ad34c1cc0b9d4..ee548c6ef0640 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSeriesPermissionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSeriesPermissionIT.java @@ -260,32 +260,32 @@ public void testData() { } private void testWriteData() { - grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_DATA, "root.sg.d1.s1"); + grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_DATA, "root.db.d1.s1"); assertNonQueryTestFail( - "insert into root.sg.d1(time,s1,s2) values(1,1,1)", - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg.d1.s2]", + "insert into root.db.d1(time,s1,s2) values(1,1,1)", + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db.d1.s2]", "test1", "test123123456"); assertNonQueryTestFail( - "delete from root.sg.d1.s1, root.sg.d1.s2", - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg.d1.s2]", + "delete from root.db.d1.s1, root.db.d1.s2", + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db.d1.s2]", "test1", "test123123456"); - grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_DATA, "root.sg.d1.s2"); + grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_DATA, "root.db.d1.s2"); assertNonQueryTestFail( - "insert into root.sg.d1(time,s1,s2) values(1,1,1)", - "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg.d1.s1, root.sg.d1.s2]", + "insert into root.db.d1(time,s1,s2) values(1,1,1)", + "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db.d1.s1, root.db.d1.s2]", "test1", "test123123456"); - executeNonQuery("delete from root.sg.d1.s1, root.sg.d1.s2", "test1", "test123123456"); - grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_SCHEMA, "root.sg.d1.**"); + executeNonQuery("delete from root.db.d1.s1, root.db.d1.s2", "test1", "test123123456"); + grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_SCHEMA, "root.db.d1.**"); assertNonQueryTestFail( - "insert into root.sg.d1(time,s1,s2) values(1,1,1)", + "insert into root.db.d1(time,s1,s2) values(1,1,1)", "803: No permissions for this operation, please add privilege SYSTEM", "test1", "test123123456"); grantUserSystemPrivileges("test1", PrivilegeType.SYSTEM); - executeNonQuery("insert into root.sg.d1(time,s1,s2) values(1,1,1)", "test1", "test123123456"); + executeNonQuery("insert into root.db.d1(time,s1,s2) values(1,1,1)", "test1", "test123123456"); } private void testReadData() { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java index 2ebdd37758fe4..52825f562b362 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java @@ -151,8 +151,8 @@ public void manageCQTest() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END", "803: No permissions for this operation, please add privilege SYSTEM", @@ -177,8 +177,8 @@ public void manageCQTest() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END", "test5", diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplateAuthIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplateAuthIT.java index 4f17b9b3de2aa..bfd3d82b35307 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplateAuthIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplateAuthIT.java @@ -110,22 +110,22 @@ public void manageDataBaseTest() { } } - adminStmt.execute("create database root.sg1"); - adminStmt.execute("create database root.sg2"); - adminStmt.execute("create database root.sg3"); - adminStmt.execute("set device template t1 to root.sg1.d1"); + adminStmt.execute("create database root.db1"); + adminStmt.execute("create database root.db2"); + adminStmt.execute("create database root.db3"); + adminStmt.execute("set device template t1 to root.db1.d1"); - adminStmt.execute("set device template t2 to root.sg2"); + adminStmt.execute("set device template t2 to root.db2"); assertNonQueryTestFail( - "set device template t1 to root.sg3", + "set device template t1 to root.db3", "803: No permissions for this operation, please add privilege SYSTEM", "tytyty1", "tytytytytytytyty"); - adminStmt.execute("set device template t1 to root.sg3"); - adminStmt.execute("create timeseries using device template on root.sg1.d1"); - adminStmt.execute("create timeseries using device template on root.sg3"); + adminStmt.execute("set device template t1 to root.db3"); + adminStmt.execute("create timeseries using device template on root.db1.d1"); + adminStmt.execute("create timeseries using device template on root.db3"); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); @@ -135,7 +135,7 @@ public void manageDataBaseTest() { } } - adminStmt.execute("grant read_schema on root.sg1.d2.** to user tytyty1"); + adminStmt.execute("grant read_schema on root.db1.d2.** to user tytyty1"); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); @@ -145,7 +145,7 @@ public void manageDataBaseTest() { } } - adminStmt.execute("grant read_schema on root.sg1.d1.** to user tytyty1"); + adminStmt.execute("grant read_schema on root.db1.d1.** to user tytyty1"); retSet = Collections.singleton("t1"); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); @@ -159,7 +159,7 @@ public void manageDataBaseTest() { assertEquals(retSet.size(), cnt); } - adminStmt.execute("grant read_schema on root.sg1.** to user tytyty2"); + adminStmt.execute("grant read_schema on root.db1.** to user tytyty2"); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty2", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show device templates")) { @@ -300,7 +300,7 @@ public void manageDataBaseTest() { } // show paths set device template - retSet = new HashSet<>(Arrays.asList("root.sg1.d1", "root.sg3")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1", "root.db3")); try (ResultSet resultSet = adminStmt.executeQuery("show paths set device template t1")) { int cnt = 0; while (resultSet.next()) { @@ -321,7 +321,7 @@ public void manageDataBaseTest() { } assertEquals(retSet.size(), cnt); } - retSet = new HashSet<>(Arrays.asList("root.sg1.d1")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1")); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show paths set device template t1")) { @@ -345,7 +345,7 @@ public void manageDataBaseTest() { assertEquals(retSet.size(), cnt); } - retSet = new HashSet<>(Arrays.asList("root.sg2")); + retSet = new HashSet<>(Arrays.asList("root.db2")); try (ResultSet resultSet = adminStmt.executeQuery("show paths set device template t2")) { int cnt = 0; while (resultSet.next()) { @@ -409,7 +409,7 @@ public void manageDataBaseTest() { } // show paths using device template - retSet = new HashSet<>(Arrays.asList("root.sg1.d1", "root.sg3")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1", "root.db3")); try (ResultSet resultSet = adminStmt.executeQuery("show paths using device template t1")) { int cnt = 0; while (resultSet.next()) { @@ -430,7 +430,7 @@ public void manageDataBaseTest() { } assertEquals(retSet.size(), cnt); } - retSet = new HashSet<>(Arrays.asList("root.sg1.d1")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1")); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show paths using device template t1")) { @@ -515,7 +515,7 @@ public void manageDataBaseTest() { assertEquals(retSet.size(), cnt); } - retSet = new HashSet<>(Arrays.asList("root.sg1.d1", "root.sg3")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1", "root.db3")); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show paths set device template t1")) { @@ -527,7 +527,7 @@ public void manageDataBaseTest() { } assertEquals(retSet.size(), cnt); } - retSet = new HashSet<>(Arrays.asList("root.sg2")); + retSet = new HashSet<>(Arrays.asList("root.db2")); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show paths set device template t2")) { @@ -548,7 +548,7 @@ public void manageDataBaseTest() { } } - retSet = new HashSet<>(Arrays.asList("root.sg1.d1")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1")); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show paths using device template t1")) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplatePermissionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplatePermissionIT.java index b2c02164c31ae..e10f3d9be4067 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplatePermissionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplatePermissionIT.java @@ -85,12 +85,12 @@ public void adminOperationsTest() { "test", "test123123456"); assertNonQueryTestFail( - "set device template t1 to root.sg1", + "set device template t1 to root.db1", "803: No permissions for this operation, please add privilege SYSTEM", "test", "test123123456"); assertNonQueryTestFail( - "unset device template t1 from root.sg1", + "unset device template t1 from root.db1", "803: No permissions for this operation, please add privilege SYSTEM", "test", "test123123456"); @@ -105,56 +105,56 @@ public void adminOperationsTest() { public void otherTest() { executeNonQuery( "create device template t1 (temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)"); - executeNonQuery("create database root.sg1"); - executeNonQuery("set device template t1 to root.sg1.d1"); + executeNonQuery("create database root.db1"); + executeNonQuery("set device template t1 to root.db1.d1"); // active assertNonQueryTestFail( - "create timeseries using device template on root.sg1.d1", - "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg1.d1.temperature, root.sg1.d1.status]", + "create timeseries using device template on root.db1.d1", + "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db1.d1.temperature, root.db1.d1.status]", "test", "test123123456"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); executeNonQuery( - "create timeseries using device template on root.sg1.d1", "test", "test123123456"); + "create timeseries using device template on root.db1.d1", "test", "test123123456"); // insert assertNonQueryTestFail( - "insert into root.sg1.d1(time, s1) values(1,1)", - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg1.d1.s1]", + "insert into root.db1.d1(time, s1) values(1,1)", + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db1.d1.s1]", "test", "test123123456"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.**"); executeNonQuery( - "insert into root.sg1.d1(time, temperature) values(1,1)", "test", "test123123456"); + "insert into root.db1.d1(time, temperature) values(1,1)", "test", "test123123456"); assertNonQueryTestFail( - "insert into root.sg1.d1(time, s1) values(1,1)", + "insert into root.db1.d1(time, s1) values(1,1)", "803: No permissions for this operation, please add privilege SYSTEM", "test", "test123123456"); grantUserSeriesPrivilege("test", PrivilegeType.SYSTEM, "root.**"); - executeNonQuery("insert into root.sg1.d1(time, s1) values(1,1)", "test", "test123123456"); + executeNonQuery("insert into root.db1.d1(time, s1) values(1,1)", "test", "test123123456"); // show - executeNonQuery("create database root.sg2"); - executeNonQuery("set device template t1 to root.sg2.d1"); + executeNonQuery("create database root.db2"); + executeNonQuery("set device template t1 to root.db2.d1"); resultSetEqualTest( "show paths using device template t1", showPathsUsingTemplateHeaders.stream() .map(ColumnHeader::getColumnName) .toArray(String[]::new), - new String[] {"root.sg1.d1,"}, + new String[] {"root.db1.d1,"}, "test", "test123123456"); // deActive - revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); + revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); assertNonQueryTestFail( - "deactivate device template t1 from root.sg1.d1", - "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg1.d1.temperature, root.sg1.d1.s1, root.sg1.d1.status]", + "deactivate device template t1 from root.db1.d1", + "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db1.d1.temperature, root.db1.d1.s1, root.db1.d1.status]", "test", "test123123456"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); - executeNonQuery("deactivate device template t1 from root.sg1.d1", "test", "test123123456"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); + executeNonQuery("deactivate device template t1 from root.db1.d1", "test", "test123123456"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBCastFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBCastFunctionIT.java index fb14be551e096..9cd899b4559f2 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBCastFunctionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBCastFunctionIT.java @@ -45,61 +45,61 @@ public class IoTDBCastFunctionIT { private static final String[] SQLs = new String[] { // normal cases - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", // data for int series - "INSERT INTO root.sg.d1(timestamp,s1) values(0, 0)", - "INSERT INTO root.sg.d1(timestamp,s1) values(1, 1)", - "INSERT INTO root.sg.d1(timestamp,s1) values(2, 2)", - "INSERT INTO root.sg.d1(timestamp,s1) values(3, 3)", + "INSERT INTO root.db.d1(timestamp,s1) values(0, 0)", + "INSERT INTO root.db.d1(timestamp,s1) values(1, 1)", + "INSERT INTO root.db.d1(timestamp,s1) values(2, 2)", + "INSERT INTO root.db.d1(timestamp,s1) values(3, 3)", // data for long series - "INSERT INTO root.sg.d1(timestamp,s2) values(0, 0)", - "INSERT INTO root.sg.d1(timestamp,s2) values(1, 1)", - "INSERT INTO root.sg.d1(timestamp,s2) values(2, 2)", - "INSERT INTO root.sg.d1(timestamp,s2) values(3, 3)", + "INSERT INTO root.db.d1(timestamp,s2) values(0, 0)", + "INSERT INTO root.db.d1(timestamp,s2) values(1, 1)", + "INSERT INTO root.db.d1(timestamp,s2) values(2, 2)", + "INSERT INTO root.db.d1(timestamp,s2) values(3, 3)", // data for float series - "INSERT INTO root.sg.d1(timestamp,s3) values(0, 0)", - "INSERT INTO root.sg.d1(timestamp,s3) values(1, 1)", - "INSERT INTO root.sg.d1(timestamp,s3) values(2, 2.7)", - "INSERT INTO root.sg.d1(timestamp,s3) values(3, 3.33)", + "INSERT INTO root.db.d1(timestamp,s3) values(0, 0)", + "INSERT INTO root.db.d1(timestamp,s3) values(1, 1)", + "INSERT INTO root.db.d1(timestamp,s3) values(2, 2.7)", + "INSERT INTO root.db.d1(timestamp,s3) values(3, 3.33)", // data for double series - "INSERT INTO root.sg.d1(timestamp,s4) values(0, 0)", - "INSERT INTO root.sg.d1(timestamp,s4) values(1, 1.0)", - "INSERT INTO root.sg.d1(timestamp,s4) values(2, 2.7)", - "INSERT INTO root.sg.d1(timestamp,s4) values(3, 3.33)", + "INSERT INTO root.db.d1(timestamp,s4) values(0, 0)", + "INSERT INTO root.db.d1(timestamp,s4) values(1, 1.0)", + "INSERT INTO root.db.d1(timestamp,s4) values(2, 2.7)", + "INSERT INTO root.db.d1(timestamp,s4) values(3, 3.33)", // data for boolean series - "INSERT INTO root.sg.d1(timestamp,s5) values(0, false)", - "INSERT INTO root.sg.d1(timestamp,s5) values(1, false)", - "INSERT INTO root.sg.d1(timestamp,s5) values(2, true)", - "INSERT INTO root.sg.d1(timestamp,s5) values(3, true)", + "INSERT INTO root.db.d1(timestamp,s5) values(0, false)", + "INSERT INTO root.db.d1(timestamp,s5) values(1, false)", + "INSERT INTO root.db.d1(timestamp,s5) values(2, true)", + "INSERT INTO root.db.d1(timestamp,s5) values(3, true)", // data for text series - "INSERT INTO root.sg.d1(timestamp,s6) values(0, \"10000\")", - "INSERT INTO root.sg.d1(timestamp,s6) values(1, \"3\")", - "INSERT INTO root.sg.d1(timestamp,s6) values(2, \"TRue\")", - "INSERT INTO root.sg.d1(timestamp,s6) values(3, \"faLse\")", + "INSERT INTO root.db.d1(timestamp,s6) values(0, \"10000\")", + "INSERT INTO root.db.d1(timestamp,s6) values(1, \"3\")", + "INSERT INTO root.db.d1(timestamp,s6) values(2, \"TRue\")", + "INSERT INTO root.db.d1(timestamp,s6) values(3, \"faLse\")", "flush", // special cases - "create DATABASE root.sg1", - "create timeseries root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "create timeseries root.sg1.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", - "create timeseries root.sg1.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "create timeseries root.sg1.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "create timeseries root.sg1.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "create timeseries root.sg1.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "INSERT INTO root.sg1.d1(timestamp,s2) values(1, 2147483648)", - "INSERT INTO root.sg1.d1(timestamp,s3) values(1, 2147483648.0)", - "INSERT INTO root.sg1.d1(timestamp,s3) values(2, 2e38)", - "INSERT INTO root.sg1.d1(timestamp,s4) values(1, 4e50)", - "INSERT INTO root.sg1.d1(timestamp,s6) values(1, \"test\")", - "INSERT INTO root.sg1.d1(timestamp,s6) values(2, \"1.1\")", - "INSERT INTO root.sg1.d1(timestamp,s6) values(3, \"4e60\")", - "INSERT INTO root.sg1.d1(timestamp,s6) values(4, \"4e60000\")", + "create DATABASE root.db1", + "create timeseries root.db1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "create timeseries root.db1.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", + "create timeseries root.db1.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "create timeseries root.db1.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "create timeseries root.db1.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "create timeseries root.db1.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "INSERT INTO root.db1.d1(timestamp,s2) values(1, 2147483648)", + "INSERT INTO root.db1.d1(timestamp,s3) values(1, 2147483648.0)", + "INSERT INTO root.db1.d1(timestamp,s3) values(2, 2e38)", + "INSERT INTO root.db1.d1(timestamp,s4) values(1, 4e50)", + "INSERT INTO root.db1.d1(timestamp,s6) values(1, \"test\")", + "INSERT INTO root.db1.d1(timestamp,s6) values(2, \"1.1\")", + "INSERT INTO root.db1.d1(timestamp,s6) values(3, \"4e60\")", + "INSERT INTO root.db1.d1(timestamp,s6) values(4, \"4e60000\")", }; @BeforeClass @@ -128,340 +128,340 @@ private static void registerUDF() { @Test public void testNewTransformerWithIntSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS INT32)"}; String[] intRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; - resultSetEqualTest("select CAST(s1 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + resultSetEqualTest("select CAST(s1 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS INT64)"}; String[] longRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; resultSetEqualTest( - "select CAST(s1 AS INT64) from root.sg.d1", longExpectedHeader, longRetArray); + "select CAST(s1 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.0,", "3,3.0,", }; resultSetEqualTest( - "select CAST(s1 AS FLOAT) from root.sg.d1", floatExpectedHeader, floatRetArray); + "select CAST(s1 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.0,", "3,3.0,", }; resultSetEqualTest( - "select CAST(s1 AS DOUBLE) from root.sg.d1", doubleExpectedHeader, doubleRetArray); + "select CAST(s1 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,false,", "1,true,", "2,true,", "3,true,", }; resultSetEqualTest( - "select CAST(s1 AS BOOLEAN) from root.sg.d1", booleanExpectedHeader, booleanRetArray); + "select CAST(s1 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS TEXT)"}; String[] textRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; - resultSetEqualTest("select CAST(s1 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s1 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testNewTransformerWithLongSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS INT32)"}; String[] intRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; - resultSetEqualTest("select CAST(s2 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + resultSetEqualTest("select CAST(s2 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS INT64)"}; String[] longRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; resultSetEqualTest( - "select CAST(s2 AS INT64) from root.sg.d1", longExpectedHeader, longRetArray); + "select CAST(s2 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.0,", "3,3.0,", }; resultSetEqualTest( - "select CAST(s2 AS FLOAT) from root.sg.d1", floatExpectedHeader, floatRetArray); + "select CAST(s2 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.0,", "3,3.0,", }; resultSetEqualTest( - "select CAST(s2 AS DOUBLE) from root.sg.d1", doubleExpectedHeader, doubleRetArray); + "select CAST(s2 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,false,", "1,true,", "2,true,", "3,true,", }; resultSetEqualTest( - "select CAST(s2 AS BOOLEAN) from root.sg.d1", booleanExpectedHeader, booleanRetArray); + "select CAST(s2 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS TEXT)"}; String[] textRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; - resultSetEqualTest("select CAST(s2 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s2 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testNewTransformerWithFloatSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS INT32)"}; String[] intRetArray = new String[] { "0,0,", "1,1,", "2,3,", "3,3,", }; - resultSetEqualTest("select CAST(s3 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + resultSetEqualTest("select CAST(s3 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS INT64)"}; String[] longRetArray = new String[] { "0,0,", "1,1,", "2,3,", "3,3,", }; resultSetEqualTest( - "select CAST(s3 AS INT64) from root.sg.d1", longExpectedHeader, longRetArray); + "select CAST(s3 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.7,", "3,3.33,", }; resultSetEqualTest( - "select CAST(s3 AS FLOAT) from root.sg.d1", floatExpectedHeader, floatRetArray); + "select CAST(s3 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.700000047683716,", "3,3.3299999237060547,", }; resultSetEqualTest( - "select CAST(s3 AS DOUBLE) from root.sg.d1", doubleExpectedHeader, doubleRetArray); + "select CAST(s3 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,false,", "1,true,", "2,true,", "3,true,", }; resultSetEqualTest( - "select CAST(s3 AS BOOLEAN) from root.sg.d1", booleanExpectedHeader, booleanRetArray); + "select CAST(s3 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS TEXT)"}; String[] textRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.7,", "3,3.33,", }; - resultSetEqualTest("select CAST(s3 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s3 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testNewTransformerWithDoubleSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS INT32)"}; String[] intRetArray = new String[] { "0,0,", "1,1,", "2,3,", "3,3,", }; - resultSetEqualTest("select CAST(s4 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + resultSetEqualTest("select CAST(s4 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS INT64)"}; String[] longRetArray = new String[] { "0,0,", "1,1,", "2,3,", "3,3,", }; resultSetEqualTest( - "select CAST(s4 AS INT64) from root.sg.d1", longExpectedHeader, longRetArray); + "select CAST(s4 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.7,", "3,3.33,", }; resultSetEqualTest( - "select CAST(s4 AS FLOAT) from root.sg.d1", floatExpectedHeader, floatRetArray); + "select CAST(s4 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.7,", "3,3.33,", }; resultSetEqualTest( - "select CAST(s4 AS DOUBLE) from root.sg.d1", doubleExpectedHeader, doubleRetArray); + "select CAST(s4 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,false,", "1,true,", "2,true,", "3,true,", }; resultSetEqualTest( - "select CAST(s4 AS BOOLEAN) from root.sg.d1", booleanExpectedHeader, booleanRetArray); + "select CAST(s4 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS TEXT)"}; String[] textRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.7,", "3,3.33,", }; - resultSetEqualTest("select CAST(s4 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s4 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testNewTransformerWithBooleanSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS INT32)"}; String[] intRetArray = new String[] { "0,0,", "1,0,", "2,1,", "3,1,", }; - resultSetEqualTest("select CAST(s5 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + resultSetEqualTest("select CAST(s5 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS INT64)"}; String[] longRetArray = new String[] { "0,0,", "1,0,", "2,1,", "3,1,", }; resultSetEqualTest( - "select CAST(s5 AS INT64) from root.sg.d1", longExpectedHeader, longRetArray); + "select CAST(s5 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,0.0,", "1,0.0,", "2,1.0,", "3,1.0,", }; resultSetEqualTest( - "select CAST(s5 AS FLOAT) from root.sg.d1", floatExpectedHeader, floatRetArray); + "select CAST(s5 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,0.0,", "1,0.0,", "2,1.0,", "3,1.0,", }; resultSetEqualTest( - "select CAST(s5 AS DOUBLE) from root.sg.d1", doubleExpectedHeader, doubleRetArray); + "select CAST(s5 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,false,", "1,false,", "2,true,", "3,true,", }; resultSetEqualTest( - "select CAST(s5 AS BOOLEAN) from root.sg.d1", booleanExpectedHeader, booleanRetArray); + "select CAST(s5 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS TEXT)"}; String[] textRetArray = new String[] { "0,false,", "1,false,", "2,true,", "3,true,", }; - resultSetEqualTest("select CAST(s5 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s5 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testNewTransformerWithTextSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS INT32)"}; String[] intRetArray = new String[] { "0,10000,", "1,3,", }; resultSetEqualTest( - "select CAST(s6 AS INT32) from root.sg.d1 where time < 2", intExpectedHeader, intRetArray); + "select CAST(s6 AS INT32) from root.db.d1 where time < 2", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS INT64)"}; String[] longRetArray = new String[] { "0,10000,", "1,3,", }; resultSetEqualTest( - "select CAST(s6 AS INT64) from root.sg.d1 where time < 2", + "select CAST(s6 AS INT64) from root.db.d1 where time < 2", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,10000.0,", "1,3.0,", }; resultSetEqualTest( - "select CAST(s6 AS FLOAT) from root.sg.d1 where time < 2", + "select CAST(s6 AS FLOAT) from root.db.d1 where time < 2", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,10000.0,", "1,3.0,", }; resultSetEqualTest( - "select CAST(s6 AS DOUBLE) from root.sg.d1 where time < 2", + "select CAST(s6 AS DOUBLE) from root.db.d1 where time < 2", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "2,true,", "3,false,", }; resultSetEqualTest( - "select CAST(s6 AS BOOLEAN) from root.sg.d1 where time >= 2", + "select CAST(s6 AS BOOLEAN) from root.db.d1 where time >= 2", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS TEXT)"}; String[] textRetArray = new String[] { "0,10000,", "1,3,", "2,TRue,", "3,faLse,", }; - resultSetEqualTest("select CAST(s6 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s6 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } // endregion @@ -472,428 +472,428 @@ public void testNewTransformerWithTextSource() { public void testOldTransformerWithIntSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS INT32)"}; String[] intRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + "select constvalue(s1),CAST(s1 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS INT64)"}; String[] longRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS INT64) from root.sg.d1", + "select constvalue(s1),CAST(s1 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.0,", "3,1,3.0,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS FLOAT) from root.sg.d1", + "select constvalue(s1),CAST(s1 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.0,", "3,1,3.0,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS DOUBLE) from root.sg.d1", + "select constvalue(s1),CAST(s1 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,1,false,", "1,1,true,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS BOOLEAN) from root.sg.d1", + "select constvalue(s1),CAST(s1 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s1),CAST(s1 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testOldTransformerWithLongSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS INT32)"}; String[] intRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + "select constvalue(s2),CAST(s2 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS INT64)"}; String[] longRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS INT64) from root.sg.d1", + "select constvalue(s2),CAST(s2 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.0,", "3,1,3.0,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS FLOAT) from root.sg.d1", + "select constvalue(s2),CAST(s2 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.0,", "3,1,3.0,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS DOUBLE) from root.sg.d1", + "select constvalue(s2),CAST(s2 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,1,false,", "1,1,true,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS BOOLEAN) from root.sg.d1", + "select constvalue(s2),CAST(s2 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s2),CAST(s2 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testOldTransformerWithFloatSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS INT32)"}; String[] intRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,3,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + "select constvalue(s3),CAST(s3 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS INT64)"}; String[] longRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,3,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS INT64) from root.sg.d1", + "select constvalue(s3),CAST(s3 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.7,", "3,1,3.33,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS FLOAT) from root.sg.d1", + "select constvalue(s3),CAST(s3 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.700000047683716,", "3,1,3.3299999237060547,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS DOUBLE) from root.sg.d1", + "select constvalue(s3),CAST(s3 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,1,false,", "1,1,true,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS BOOLEAN) from root.sg.d1", + "select constvalue(s3),CAST(s3 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.7,", "3,1,3.33,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s3),CAST(s3 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testOldTransformerWithDoubleSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS INT32)"}; String[] intRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,3,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + "select constvalue(s4),CAST(s4 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS INT64)"}; String[] longRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,3,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS INT64) from root.sg.d1", + "select constvalue(s4),CAST(s4 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.7,", "3,1,3.33,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS FLOAT) from root.sg.d1", + "select constvalue(s4),CAST(s4 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.7,", "3,1,3.33,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS DOUBLE) from root.sg.d1", + "select constvalue(s4),CAST(s4 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,1,false,", "1,1,true,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS BOOLEAN) from root.sg.d1", + "select constvalue(s4),CAST(s4 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.7,", "3,1,3.33,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s4),CAST(s4 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testOldTransformerWithBooleanSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS INT32)"}; String[] intRetArray = new String[] { "0,1,0,", "1,1,0,", "2,1,1,", "3,1,1,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + "select constvalue(s5),CAST(s5 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS INT64)"}; String[] longRetArray = new String[] { "0,1,0,", "1,1,0,", "2,1,1,", "3,1,1,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS INT64) from root.sg.d1", + "select constvalue(s5),CAST(s5 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,0.0,", "1,1,0.0,", "2,1,1.0,", "3,1,1.0,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS FLOAT) from root.sg.d1", + "select constvalue(s5),CAST(s5 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,0.0,", "1,1,0.0,", "2,1,1.0,", "3,1,1.0,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS DOUBLE) from root.sg.d1", + "select constvalue(s5),CAST(s5 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,1,false,", "1,1,false,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS BOOLEAN) from root.sg.d1", + "select constvalue(s5),CAST(s5 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,false,", "1,1,false,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s5),CAST(s5 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testOldTransformerWithTextSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS INT32)"}; String[] intRetArray = new String[] { "0,1,10000,", "1,1,3,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS INT32) from root.sg.d1 where time < 2", + "select constvalue(s6),CAST(s6 AS INT32) from root.db.d1 where time < 2", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS INT64)"}; String[] longRetArray = new String[] { "0,1,10000,", "1,1,3,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS INT64) from root.sg.d1 where time < 2", + "select constvalue(s6),CAST(s6 AS INT64) from root.db.d1 where time < 2", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,10000.0,", "1,1,3.0,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS FLOAT) from root.sg.d1 where time < 2", + "select constvalue(s6),CAST(s6 AS FLOAT) from root.db.d1 where time < 2", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,10000.0,", "1,1,3.0,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS DOUBLE) from root.sg.d1 where time < 2", + "select constvalue(s6),CAST(s6 AS DOUBLE) from root.db.d1 where time < 2", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "2,1,true,", "3,1,false,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS BOOLEAN) from root.sg.d1 where time >= 2", + "select constvalue(s6),CAST(s6 AS BOOLEAN) from root.db.d1 where time >= 2", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,10000,", "1,1,3,", "2,1,TRue,", "3,1,faLse,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s6),CAST(s6 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } // endregion @@ -905,7 +905,7 @@ public void testCastWithLongSource() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select CAST(s2 AS INT32) from root.sg1.d1"); + statement.execute("select CAST(s2 AS INT32) from root.db1.d1"); fail(); } catch (Exception ignored) { } @@ -920,13 +920,13 @@ public void testCastWithFloatSource() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select CAST(s3 AS INT32) from root.sg1.d1"); + statement.execute("select CAST(s3 AS INT32) from root.db1.d1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s3 AS INT64) from root.sg1.d1"); + statement.execute("select CAST(s3 AS INT64) from root.db1.d1"); fail(); } catch (Exception ignored) { } @@ -941,19 +941,19 @@ public void testCastWithDoubleSource() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select CAST(s4 AS INT32) from root.sg1.d1"); + statement.execute("select CAST(s4 AS INT32) from root.db1.d1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s4 AS INT64) from root.sg1.d1"); + statement.execute("select CAST(s4 AS INT64) from root.db1.d1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s4 AS Float) from root.sg1.d1"); + statement.execute("select CAST(s4 AS Float) from root.db1.d1"); fail(); } catch (Exception ignored) { } @@ -968,55 +968,55 @@ public void testCastWithTextSource() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select CAST(s6 AS INT32) from root.sg1.d1 where time = 1"); + statement.execute("select CAST(s6 AS INT32) from root.db1.d1 where time = 1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS INT32) from root.sg1.d1 where time = 2"); + statement.execute("select CAST(s6 AS INT32) from root.db1.d1 where time = 2"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS INT64) from root.sg1.d1 where time = 1"); + statement.execute("select CAST(s6 AS INT64) from root.db1.d1 where time = 1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS INT64) from root.sg1.d1 where time = 2"); + statement.execute("select CAST(s6 AS INT64) from root.db1.d1 where time = 2"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS FLOAT) from root.sg1.d1 where time=3"); + statement.execute("select CAST(s6 AS FLOAT) from root.db1.d1 where time=3"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS FLOAT) from root.sg1.d1 where time=1"); + statement.execute("select CAST(s6 AS FLOAT) from root.db1.d1 where time=1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS DOUBLE) from root.sg1.d1 where time = 1"); + statement.execute("select CAST(s6 AS DOUBLE) from root.db1.d1 where time = 1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS DOUBLE) from root.sg1.d1 where time = 4"); + statement.execute("select CAST(s6 AS DOUBLE) from root.db1.d1 where time = 4"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS BOOLEAN) from root.sg1.d1 where time = 1"); + statement.execute("select CAST(s6 AS BOOLEAN) from root.db1.d1 where time = 1"); fail(); } catch (Exception ignored) { } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBReplaceFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBReplaceFunctionIT.java index 12c608562348a..c0360027f7555 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBReplaceFunctionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBReplaceFunctionIT.java @@ -44,22 +44,22 @@ public class IoTDBReplaceFunctionIT { private static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.s1 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s3 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s4 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s5 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s6 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s7 WITH DATATYPE=DATE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s8 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s9 WITH DATATYPE=STRING, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s10 WITH DATATYPE=BLOB, ENCODING=PLAIN", - "INSERT INTO root.sg(timestamp,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd','abcd')", - "INSERT INTO root.sg(timestamp,s1) values(2, 'test\\\\')", - "INSERT INTO root.sg(timestamp,s1) values(3, 'abcd\\\\')", - "INSERT INTO root.sg(timestamp,s9) values(2, 'test\\\\')", - "INSERT INTO root.sg(timestamp,s9) values(3, 'abcd\\\\')", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.s1 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s3 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s4 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s5 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s6 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s7 WITH DATATYPE=DATE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s8 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s9 WITH DATATYPE=STRING, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s10 WITH DATATYPE=BLOB, ENCODING=PLAIN", + "INSERT INTO root.db(timestamp,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd','abcd')", + "INSERT INTO root.db(timestamp,s1) values(2, 'test\\\\')", + "INSERT INTO root.db(timestamp,s1) values(3, 'abcd\\\\')", + "INSERT INTO root.db(timestamp,s9) values(2, 'test\\\\')", + "INSERT INTO root.db(timestamp,s9) values(3, 'abcd\\\\')", "flush" }; @@ -89,27 +89,27 @@ private static void registerUDF() { public void testNewTransformer() { String[] expectedHeader = new String[] { - TIMESTAMP_STR, "REPLACE(root.sg.s1, 'ab', 'AB')", "REPLACE(root.sg.s1, '\\', 'a')" + TIMESTAMP_STR, "REPLACE(root.db.s1, 'ab', 'AB')", "REPLACE(root.db.s1, '\\', 'a')" }; String[] retArray = new String[] { "1,ABcd,abcd,", "2,test\\\\,testaa,", "3,ABcd\\\\,abcdaa,", }; resultSetEqualTest( - "select REPLACE(s1, 'ab', 'AB'), REPLACE(s1, '\\', 'a') from root.sg", + "select REPLACE(s1, 'ab', 'AB'), REPLACE(s1, '\\', 'a') from root.db", expectedHeader, retArray); String[] expectedHeader2 = new String[] { - TIMESTAMP_STR, "REPLACE(root.sg.s9, 'ab', 'AB')", "REPLACE(root.sg.s9, '\\', 'a')" + TIMESTAMP_STR, "REPLACE(root.db.s9, 'ab', 'AB')", "REPLACE(root.db.s9, '\\', 'a')" }; String[] retArray2 = new String[] { "1,ABcd,abcd,", "2,test\\\\,testaa,", "3,ABcd\\\\,abcdaa,", }; resultSetEqualTest( - "select REPLACE(s9, 'ab', 'AB'), REPLACE(s9, '\\', 'a') from root.sg", + "select REPLACE(s9, 'ab', 'AB'), REPLACE(s9, '\\', 'a') from root.db", expectedHeader2, retArray2); } @@ -119,16 +119,16 @@ public void testOldTransformer() { String[] expectedHeader = new String[] { TIMESTAMP_STR, - "constvalue(root.sg.s1)", - "REPLACE(root.sg.s1, 'ab', 'AB')", - "REPLACE(root.sg.s1, '\\', 'a')" + "constvalue(root.db.s1)", + "REPLACE(root.db.s1, 'ab', 'AB')", + "REPLACE(root.db.s1, '\\', 'a')" }; String[] retArray = new String[] { "1,1,ABcd,abcd,", "2,1,test\\\\,testaa,", "3,1,ABcd\\\\,abcdaa,", }; resultSetEqualTest( - "select constvalue(s1),REPLACE(s1, 'ab', 'AB'), REPLACE(s1, '\\', 'a') from root.sg", + "select constvalue(s1),REPLACE(s1, 'ab', 'AB'), REPLACE(s1, '\\', 'a') from root.db", expectedHeader, retArray); } @@ -138,7 +138,7 @@ public void testWithoutFromOrTo() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select REPLACE(s1, 'b') from root.sg"); + statement.execute("select REPLACE(s1, 'b') from root.db"); fail(); } catch (Exception ignored) { } @@ -153,49 +153,49 @@ public void testWrongInputType() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select REPLACE(s2, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s2, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s3, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s3, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s4, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s4, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s5, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s5, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s6, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s6, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s7, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s7, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s8, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s8, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s10, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s10, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBSubStringFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBSubStringFunctionIT.java index 15e2d400497cd..dc800af5ed2bd 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBSubStringFunctionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBSubStringFunctionIT.java @@ -45,22 +45,22 @@ public class IoTDBSubStringFunctionIT { private static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.s1 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s3 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s4 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s5 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s6 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s7 WITH DATATYPE=DATE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s8 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s9 WITH DATATYPE=STRING, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s10 WITH DATATYPE=BLOB, ENCODING=PLAIN", - "INSERT INTO root.sg(timestamp,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', 'abcd')", - "INSERT INTO root.sg(timestamp,s1) values(2, 'test')", - "INSERT INTO root.sg(timestamp,s1) values(3, 'abcdefg')", - "INSERT INTO root.sg(timestamp,s9) values(2, 'test')", - "INSERT INTO root.sg(timestamp,s9) values(3, 'abcdefg')", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.s1 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s3 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s4 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s5 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s6 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s7 WITH DATATYPE=DATE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s8 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s9 WITH DATATYPE=STRING, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s10 WITH DATATYPE=BLOB, ENCODING=PLAIN", + "INSERT INTO root.db(timestamp,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', 'abcd')", + "INSERT INTO root.db(timestamp,s1) values(2, 'test')", + "INSERT INTO root.db(timestamp,s1) values(3, 'abcdefg')", + "INSERT INTO root.db(timestamp,s9) values(2, 'test')", + "INSERT INTO root.db(timestamp,s9) values(3, 'abcdefg')", "flush" }; @@ -91,7 +91,7 @@ public void testNewTransformer() { // Normal String[] expectedHeader = new String[] { - "Time,root.sg.s1,SUBSTRING(root.sg.s1,1),SUBSTRING(root.sg.s1,1,3),SUBSTRING(root.sg.s1 FROM 1),SUBSTRING(root.sg.s1 FROM 1 FOR 3)" + "Time,root.db.s1,SUBSTRING(root.db.s1,1),SUBSTRING(root.db.s1,1,3),SUBSTRING(root.db.s1 FROM 1),SUBSTRING(root.db.s1 FROM 1 FOR 3)" }; String[] retArray = new String[] { @@ -100,28 +100,28 @@ public void testNewTransformer() { "3,abcdefg,abcdefg,abc,abcdefg,abc,", }; resultSetEqualTest( - "select s1,SUBSTRING(s1,1),SUBSTRING(s1,1,3),SUBSTRING(s1 from 1),SUBSTRING(s1 from 1 for 3) from root.sg", + "select s1,SUBSTRING(s1,1),SUBSTRING(s1,1,3),SUBSTRING(s1 from 1),SUBSTRING(s1 from 1 for 3) from root.db", expectedHeader, retArray); // Param 1 greater than input series length expectedHeader = new String[] { - "Time,root.sg.s1,SUBSTRING(root.sg.s1,11),SUBSTRING(root.sg.s1,11,13),SUBSTRING(root.sg.s1 FROM 11),SUBSTRING(root.sg.s1 FROM 11 FOR 13)" + "Time,root.db.s1,SUBSTRING(root.db.s1,11),SUBSTRING(root.db.s1,11,13),SUBSTRING(root.db.s1 FROM 11),SUBSTRING(root.db.s1 FROM 11 FOR 13)" }; retArray = new String[] { "1,abcd,,,,,", "2,test,,,,,", "3,abcdefg,,,,,", }; resultSetEqualTest( - "select s1,SUBSTRING(s1,11),SUBSTRING(s1,11,13),SUBSTRING(s1 from 11),SUBSTRING(s1 from 11 for 13) from root.sg", + "select s1,SUBSTRING(s1,11),SUBSTRING(s1,11,13),SUBSTRING(s1 from 11),SUBSTRING(s1 from 11 for 13) from root.db", expectedHeader, retArray); // Normal String[] expectedHeader2 = new String[] { - "Time,root.sg.s9,SUBSTRING(root.sg.s9,1),SUBSTRING(root.sg.s9,1,3),SUBSTRING(root.sg.s9 FROM 1),SUBSTRING(root.sg.s9 FROM 1 FOR 3)" + "Time,root.db.s9,SUBSTRING(root.db.s9,1),SUBSTRING(root.db.s9,1,3),SUBSTRING(root.db.s9 FROM 1),SUBSTRING(root.db.s9 FROM 1 FOR 3)" }; String[] retArray2 = new String[] { @@ -130,7 +130,7 @@ public void testNewTransformer() { "3,abcdefg,abcdefg,abc,abcdefg,abc,", }; resultSetEqualTest( - "select s9,SUBSTRING(s9,1),SUBSTRING(s9,1,3),SUBSTRING(s9 from 1),SUBSTRING(s9 from 1 for 3) from root.sg", + "select s9,SUBSTRING(s9,1),SUBSTRING(s9,1,3),SUBSTRING(s9 from 1),SUBSTRING(s9 from 1 for 3) from root.db", expectedHeader2, retArray2); } @@ -140,7 +140,7 @@ public void testOldTransformer() { // Normal String[] expectedHeader = new String[] { - "Time,root.sg.s1,change_points(root.sg.s1),SUBSTRING(root.sg.s1,1),SUBSTRING(root.sg.s1,1,3),SUBSTRING(root.sg.s1 FROM 1),SUBSTRING(root.sg.s1 FROM 1 FOR 3)" + "Time,root.db.s1,change_points(root.db.s1),SUBSTRING(root.db.s1,1),SUBSTRING(root.db.s1,1,3),SUBSTRING(root.db.s1 FROM 1),SUBSTRING(root.db.s1 FROM 1 FOR 3)" }; String[] retArray = new String[] { @@ -149,28 +149,28 @@ public void testOldTransformer() { "3,abcdefg,abcdefg,abcdefg,abc,abcdefg,abc,", }; resultSetEqualTest( - "select s1,change_points(s1),SUBSTRING(s1,1),SUBSTRING(s1,1,3),SUBSTRING(s1 from 1),SUBSTRING(s1 from 1 for 3) from root.sg", + "select s1,change_points(s1),SUBSTRING(s1,1),SUBSTRING(s1,1,3),SUBSTRING(s1 from 1),SUBSTRING(s1 from 1 for 3) from root.db", expectedHeader, retArray); // Param 1 greater than input series length expectedHeader = new String[] { - "Time,root.sg.s1,change_points(root.sg.s1),SUBSTRING(root.sg.s1,11),SUBSTRING(root.sg.s1,11,13),SUBSTRING(root.sg.s1 FROM 11),SUBSTRING(root.sg.s1 FROM 11 FOR 13)" + "Time,root.db.s1,change_points(root.db.s1),SUBSTRING(root.db.s1,11),SUBSTRING(root.db.s1,11,13),SUBSTRING(root.db.s1 FROM 11),SUBSTRING(root.db.s1 FROM 11 FOR 13)" }; retArray = new String[] { "1,abcd,abcd,,,,,", "2,test,test,,,,,", "3,abcdefg,abcdefg,,,,,", }; resultSetEqualTest( - "select s1,change_points(s1),SUBSTRING(s1,11),SUBSTRING(s1,11,13),SUBSTRING(s1 from 11),SUBSTRING(s1 from 11 for 13) from root.sg", + "select s1,change_points(s1),SUBSTRING(s1,11),SUBSTRING(s1,11,13),SUBSTRING(s1 from 11),SUBSTRING(s1 from 11 for 13) from root.db", expectedHeader, retArray); // Normal String[] expectedHeader2 = new String[] { - "Time,root.sg.s9,change_points(root.sg.s1),SUBSTRING(root.sg.s9,1),SUBSTRING(root.sg.s9,1,3),SUBSTRING(root.sg.s9 FROM 1),SUBSTRING(root.sg.s9 FROM 1 FOR 3)" + "Time,root.db.s9,change_points(root.db.s1),SUBSTRING(root.db.s9,1),SUBSTRING(root.db.s9,1,3),SUBSTRING(root.db.s9 FROM 1),SUBSTRING(root.db.s9 FROM 1 FOR 3)" }; String[] retArray2 = new String[] { @@ -179,7 +179,7 @@ public void testOldTransformer() { "3,abcdefg,abcdefg,abcdefg,abc,abcdefg,abc,", }; resultSetEqualTest( - "select s9,change_points(s1),SUBSTRING(s9,1),SUBSTRING(s9,1,3),SUBSTRING(s9 from 1),SUBSTRING(s9 from 1 for 3) from root.sg", + "select s9,change_points(s1),SUBSTRING(s9,1),SUBSTRING(s9,1,3),SUBSTRING(s9 from 1),SUBSTRING(s9 from 1 for 3) from root.db", expectedHeader2, retArray2); } @@ -188,7 +188,7 @@ public void testOldTransformer() { public void testRoundBooleanAndText() { // Using substring without start and end position. assertTestFail( - "select s1,SUBSTRING(s1) from root.sg", + "select s1,SUBSTRING(s1) from root.db", TSStatusCode.SEMANTIC_ERROR.getStatusCode() + ": Argument exception,the scalar function [SUBSTRING] needs at least one argument,it must be a signed integer"); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecIT.java index ea00bbfa646a9..ddd06b3cb4cd3 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecIT.java @@ -55,19 +55,19 @@ public static void tearDown() throws Exception { @Test public void testCQExecution1() { String insertTemplate = - "INSERT INTO root.sg.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis(); long firstExecutionTime = now + 10_000; long startTime = firstExecutionTime - 3_000; - statement.execute("create timeseries root.sg.d1.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d1.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d1(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d1(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -99,8 +99,8 @@ public void testCQExecution1() { + String.format("BOUNDARY %d\n", firstExecutionTime) + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d1(s1_max)\n" - + " FROM root.sg.d1\n" + + " INTO root.db.d1(s1_max)\n" + + " FROM root.db.d1\n" + " GROUP BY(1s) \n" + "END"); @@ -121,11 +121,11 @@ public void testCQExecution1() { }; long[] expectedValue = {4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d1")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d1.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d1.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -142,19 +142,19 @@ public void testCQExecution1() { @Test public void testCQExecution2() { String insertTemplate = - "INSERT INTO root.sg.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis(); long firstExecutionTime = now + 10_000; long startTime = firstExecutionTime - 3_000; - statement.execute("create timeseries root.sg.d2.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d2.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d2(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d2(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -187,8 +187,8 @@ public void testCQExecution2() { + "RANGE 4s \n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d2(s1_max)\n" - + " FROM root.sg.d2\n" + + " INTO root.db.d2(s1_max)\n" + + " FROM root.db.d2\n" + " GROUP BY(1s) \n" + "END"); @@ -209,11 +209,11 @@ public void testCQExecution2() { }; long[] expectedValue = {2, 4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d2")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d2")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d2.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d2.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -230,19 +230,19 @@ public void testCQExecution2() { @Test public void testCQExecution3() { String insertTemplate = - "INSERT INTO root.sg.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis(); long firstExecutionTime = now + 10_000; long startTime = firstExecutionTime - 3_000; - statement.execute("create timeseries root.sg.d3.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d3.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d3(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d3(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -275,8 +275,8 @@ public void testCQExecution3() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d3(s1_max)\n" - + " FROM root.sg.d3\n" + + " INTO root.db.d3(s1_max)\n" + + " FROM root.db.d3\n" + " GROUP BY(1s) \n" + " FILL(100)\n" + "END"); @@ -305,14 +305,14 @@ public void testCQExecution3() { try (ResultSet resultSet = statement.executeQuery( - "select s1_max from root.sg.d3 where time between " + "select s1_max from root.db.d3 where time between " + (startTime - 1_000) + " and " + (startTime + 4_000))) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d3.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d3.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -329,19 +329,19 @@ public void testCQExecution3() { @Test public void testCQExecution4() { String insertTemplate = - "INSERT INTO root.sg.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis(); long firstExecutionTime = now + 10_000; long startTime = firstExecutionTime - 3_000; - statement.execute("create timeseries root.sg.d4.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d4.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d4(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d4(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -374,8 +374,8 @@ public void testCQExecution4() { + "RANGE 2s, 1s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d4(s1_max)\n" - + " FROM root.sg.d4\n" + + " INTO root.db.d4(s1_max)\n" + + " FROM root.db.d4\n" + " GROUP BY(1s) \n" + "END"); @@ -394,11 +394,11 @@ public void testCQExecution4() { long[] expectedTime = {startTime + 1_000, startTime + 3_000}; long[] expectedValue = {4, 8}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d4")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d4")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d4.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d4.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -415,19 +415,19 @@ public void testCQExecution4() { @Test public void testCQExecution5() { String insertTemplate = - "INSERT INTO root.sg.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis(); long firstExecutionTime = now + 10_000; long startTime = firstExecutionTime - 3_000; - statement.execute("create timeseries root.sg.d5.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); + statement.execute("create timeseries root.db.d5.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d5(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d5(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -460,8 +460,8 @@ public void testCQExecution5() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT s1 + 1 \n" - + " INTO root.sg.d5(precalculated_s1)\n" - + " FROM root.sg.d5\n" + + " INTO root.db.d5(precalculated_s1)\n" + + " FROM root.db.d5\n" + " align by device\n" + "END"); @@ -493,7 +493,7 @@ public void testCQExecution5() { try (ResultSet resultSet = statement.executeQuery( - "select precalculated_s1 from root.sg.d5 where time between " + "select precalculated_s1 from root.db.d5 where time between " + startTime + " and " + (startTime + 4_500))) { @@ -501,7 +501,7 @@ public void testCQExecution5() { while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); assertEquals( - expectedValue[cnt], resultSet.getDouble("root.sg.d5.precalculated_s1"), 0.00001); + expectedValue[cnt], resultSet.getDouble("root.db.d5.precalculated_s1"), 0.00001); cnt++; } assertEquals(expectedTime.length, cnt); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInNsIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInNsIT.java index 80acdb1408728..2271481919f62 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInNsIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInNsIT.java @@ -57,19 +57,19 @@ public static void tearDown() throws Exception { @Test public void testCQExecution1() { String insertTemplate = - "INSERT INTO root.sg.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000_000L; long firstExecutionTime = now + 10_000_000_000L; long startTime = firstExecutionTime - 3_000_000_000L; - statement.execute("create timeseries root.sg.d1.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d1.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d1(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d1(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -101,8 +101,8 @@ public void testCQExecution1() { + String.format("BOUNDARY %d\n", firstExecutionTime) + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d1(s1_max)\n" - + " FROM root.sg.d1\n" + + " INTO root.db.d1(s1_max)\n" + + " FROM root.db.d1\n" + " GROUP BY(1s) \n" + "END"); @@ -126,11 +126,11 @@ public void testCQExecution1() { }; long[] expectedValue = {4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d1")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d1.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d1.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -147,19 +147,19 @@ public void testCQExecution1() { @Test public void testCQExecution2() { String insertTemplate = - "INSERT INTO root.sg.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000_000L; long firstExecutionTime = now + 10_000_000_000L; long startTime = firstExecutionTime - 3_000_000_000L; - statement.execute("create timeseries root.sg.d2.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d2.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d2(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d2(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -192,8 +192,8 @@ public void testCQExecution2() { + "RANGE 4s \n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d2(s1_max)\n" - + " FROM root.sg.d2\n" + + " INTO root.db.d2(s1_max)\n" + + " FROM root.db.d2\n" + " GROUP BY(1s) \n" + "END"); @@ -218,11 +218,11 @@ public void testCQExecution2() { }; long[] expectedValue = {2, 4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d2")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d2")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d2.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d2.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -239,19 +239,19 @@ public void testCQExecution2() { @Test public void testCQExecution3() { String insertTemplate = - "INSERT INTO root.sg.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000_000L; long firstExecutionTime = now + 10_000_000_000L; long startTime = firstExecutionTime - 3_000_000_000L; - statement.execute("create timeseries root.sg.d3.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d3.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d3(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d3(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -284,8 +284,8 @@ public void testCQExecution3() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d3(s1_max)\n" - + " FROM root.sg.d3\n" + + " INTO root.db.d3(s1_max)\n" + + " FROM root.db.d3\n" + " GROUP BY(1s) \n" + " FILL(100)\n" + "END"); @@ -314,14 +314,14 @@ public void testCQExecution3() { try (ResultSet resultSet = statement.executeQuery( - "select s1_max from root.sg.d3 where time between " + "select s1_max from root.db.d3 where time between " + (startTime - 1_000_000_000L) + " and " + (startTime + 4_000_000_000L))) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d3.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d3.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -338,19 +338,19 @@ public void testCQExecution3() { @Test public void testCQExecution4() { String insertTemplate = - "INSERT INTO root.sg.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000_000L; long firstExecutionTime = now + 10_000_000_000L; long startTime = firstExecutionTime - 3_000_000_000L; - statement.execute("create timeseries root.sg.d4.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d4.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d4(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d4(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -383,8 +383,8 @@ public void testCQExecution4() { + "RANGE 2s, 1s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d4(s1_max)\n" - + " FROM root.sg.d4\n" + + " INTO root.db.d4(s1_max)\n" + + " FROM root.db.d4\n" + " GROUP BY(1s) \n" + "END"); @@ -403,11 +403,11 @@ public void testCQExecution4() { long[] expectedTime = {startTime + 1_000_000_000L, startTime + 3_000_000_000L}; long[] expectedValue = {4, 8}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d4")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d4")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d4.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d4.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -424,19 +424,19 @@ public void testCQExecution4() { @Test public void testCQExecution5() { String insertTemplate = - "INSERT INTO root.sg.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000_000L; long firstExecutionTime = now + 10_000_000_000L; long startTime = firstExecutionTime - 3_000_000_000L; - statement.execute("create timeseries root.sg.d5.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); + statement.execute("create timeseries root.db.d5.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d5(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d5(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -469,8 +469,8 @@ public void testCQExecution5() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT s1 + 1 \n" - + " INTO root.sg.d5(precalculated_s1)\n" - + " FROM root.sg.d5\n" + + " INTO root.db.d5(precalculated_s1)\n" + + " FROM root.db.d5\n" + " align by device\n" + "END"); @@ -502,7 +502,7 @@ public void testCQExecution5() { try (ResultSet resultSet = statement.executeQuery( - "select precalculated_s1 from root.sg.d5 where time between " + "select precalculated_s1 from root.db.d5 where time between " + startTime + " and " + (startTime + 4_500_000_000L))) { @@ -510,7 +510,7 @@ public void testCQExecution5() { while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); assertEquals( - expectedValue[cnt], resultSet.getDouble("root.sg.d5.precalculated_s1"), 0.00001); + expectedValue[cnt], resultSet.getDouble("root.db.d5.precalculated_s1"), 0.00001); cnt++; } assertEquals(expectedTime.length, cnt); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInUsIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInUsIT.java index c9971af3afb27..43c1a8a6f0822 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInUsIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInUsIT.java @@ -57,19 +57,19 @@ public static void tearDown() throws Exception { @Test public void testCQExecution1() { String insertTemplate = - "INSERT INTO root.sg.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000L; long firstExecutionTime = now + 10_000_000L; long startTime = firstExecutionTime - 3_000_000L; - statement.execute("create timeseries root.sg.d1.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d1.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d1(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d1(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -101,8 +101,8 @@ public void testCQExecution1() { + String.format("BOUNDARY %d\n", firstExecutionTime) + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d1(s1_max)\n" - + " FROM root.sg.d1\n" + + " INTO root.db.d1(s1_max)\n" + + " FROM root.db.d1\n" + " GROUP BY(1s) \n" + "END"); @@ -126,11 +126,11 @@ public void testCQExecution1() { }; long[] expectedValue = {4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d1")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d1.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d1.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -147,19 +147,19 @@ public void testCQExecution1() { @Test public void testCQExecution2() { String insertTemplate = - "INSERT INTO root.sg.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000L; long firstExecutionTime = now + 10_000_000L; long startTime = firstExecutionTime - 3_000_000L; - statement.execute("create timeseries root.sg.d2.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d2.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d2(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d2(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -192,8 +192,8 @@ public void testCQExecution2() { + "RANGE 4s \n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d2(s1_max)\n" - + " FROM root.sg.d2\n" + + " INTO root.db.d2(s1_max)\n" + + " FROM root.db.d2\n" + " GROUP BY(1s) \n" + "END"); @@ -218,11 +218,11 @@ public void testCQExecution2() { }; long[] expectedValue = {2, 4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d2")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d2")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d2.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d2.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -239,19 +239,19 @@ public void testCQExecution2() { @Test public void testCQExecution3() { String insertTemplate = - "INSERT INTO root.sg.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000L; long firstExecutionTime = now + 10_000_000L; long startTime = firstExecutionTime - 3_000_000L; - statement.execute("create timeseries root.sg.d3.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d3.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d3(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d3(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -284,8 +284,8 @@ public void testCQExecution3() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d3(s1_max)\n" - + " FROM root.sg.d3\n" + + " INTO root.db.d3(s1_max)\n" + + " FROM root.db.d3\n" + " GROUP BY(1s) \n" + " FILL(100)\n" + "END"); @@ -314,14 +314,14 @@ public void testCQExecution3() { try (ResultSet resultSet = statement.executeQuery( - "select s1_max from root.sg.d3 where time between " + "select s1_max from root.db.d3 where time between " + (startTime - 1_000_000L) + " and " + (startTime + 4_000_000L))) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d3.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d3.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -338,19 +338,19 @@ public void testCQExecution3() { @Test public void testCQExecution4() { String insertTemplate = - "INSERT INTO root.sg.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000L; long firstExecutionTime = now + 10_000_000L; long startTime = firstExecutionTime - 3_000_000L; - statement.execute("create timeseries root.sg.d4.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d4.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d4(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d4(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -383,8 +383,8 @@ public void testCQExecution4() { + "RANGE 2s, 1s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d4(s1_max)\n" - + " FROM root.sg.d4\n" + + " INTO root.db.d4(s1_max)\n" + + " FROM root.db.d4\n" + " GROUP BY(1s) \n" + "END"); @@ -403,11 +403,11 @@ public void testCQExecution4() { long[] expectedTime = {startTime + 1_000_000L, startTime + 3_000_000L}; long[] expectedValue = {4, 8}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d4")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d4")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d4.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d4.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -424,19 +424,19 @@ public void testCQExecution4() { @Test public void testCQExecution5() { String insertTemplate = - "INSERT INTO root.sg.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000L; long firstExecutionTime = now + 10_000_000L; long startTime = firstExecutionTime - 3_000_000L; - statement.execute("create timeseries root.sg.d5.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); + statement.execute("create timeseries root.db.d5.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d5(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d5(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -469,8 +469,8 @@ public void testCQExecution5() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT s1 + 1 \n" - + " INTO root.sg.d5(precalculated_s1)\n" - + " FROM root.sg.d5\n" + + " INTO root.db.d5(precalculated_s1)\n" + + " FROM root.db.d5\n" + " align by device\n" + "END"); @@ -502,7 +502,7 @@ public void testCQExecution5() { try (ResultSet resultSet = statement.executeQuery( - "select precalculated_s1 from root.sg.d5 where time between " + "select precalculated_s1 from root.db.d5 where time between " + startTime + " and " + (startTime + 4_500_000L))) { @@ -510,7 +510,7 @@ public void testCQExecution5() { while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); assertEquals( - expectedValue[cnt], resultSet.getDouble("root.sg.d5.precalculated_s1"), 0.00001); + expectedValue[cnt], resultSet.getDouble("root.db.d5.precalculated_s1"), 0.00001); cnt++; } assertEquals(expectedTime.length, cnt); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQIT.java index 399694b5e2cee..ab49cdcd07b72 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQIT.java @@ -64,8 +64,8 @@ public void testCreateWrongCQ() { "CREATE CQ s1_count_cq \n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY([0, 10), 30m)\n" + "END"; statement.execute(sql); @@ -83,8 +83,8 @@ public void testCreateWrongCQ() { "CREATE CQ s1_count_cq \n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " WHERE time >= 0 and time <= 10\n" + " GROUP BY(30m)\n" + "END"; @@ -103,8 +103,8 @@ public void testCreateWrongCQ() { "CREATE CQ s1_count_cq \n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + "END"; statement.execute(sql); fail(); @@ -121,7 +121,7 @@ public void testCreateWrongCQ() { "CREATE CQ s1_count_cq_2\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " FROM root.sg.d\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -141,8 +141,8 @@ public void testCreateWrongCQ() { + "RESAMPLE EVERY 50ms\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -161,8 +161,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE -1m\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -181,8 +181,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE 0m\n" + "BEGIN \n" + " SELECT count(s1)\n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -201,8 +201,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE 30m, -1m\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -221,8 +221,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE 30m, 30m\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -241,8 +241,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE 30m, 31m\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -261,8 +261,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE 30m\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(1h)\n" + "END"; statement.execute(sql); @@ -282,8 +282,8 @@ public void testCreateWrongCQ() { + "TIMEOUT POLICY UNKNOWN\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(1h)\n" + "END"; statement.execute(sql); @@ -301,8 +301,8 @@ public void testCreateWrongCQ() { "CREATE CQ s1_count_cq \n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -339,8 +339,8 @@ public void testCreateCorrectCQ() { + "TIMEOUT POLICY BLOCKED\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -354,8 +354,8 @@ public void testCreateCorrectCQ() { "CREATE CQ correct_cq_2\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -371,8 +371,8 @@ public void testCreateCorrectCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END"; statement.execute(sql); @@ -388,8 +388,8 @@ public void testCreateCorrectCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END"; statement.execute(sql); @@ -423,15 +423,15 @@ public void testShowCQ() { + "TIMEOUT POLICY BLOCKED\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END", "CREATE CQ show_cq_2\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END", "CREATE CQ show_cq_3\n" @@ -439,8 +439,8 @@ public void testShowCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END", "CREATE CQ show_cq_4\n" @@ -448,8 +448,8 @@ public void testShowCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END" }; @@ -497,15 +497,15 @@ public void testDropCQ() { + "TIMEOUT POLICY BLOCKED\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END", "CREATE CQ drop_cq_2\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END", "CREATE CQ drop_cq_3\n" @@ -513,8 +513,8 @@ public void testDropCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END", "CREATE CQ drop_cq_4\n" @@ -522,8 +522,8 @@ public void testDropCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END" }; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByConditionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByConditionIT.java index f518749b03259..4bfdd76b07e70 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByConditionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByConditionIT.java @@ -47,70 +47,70 @@ public class IoTDBGroupByConditionIT { // https://docs.google.com/spreadsheets/d/1vsSmb41pdmK-BdBR1STwr8olg1Qc8baKVEWnfJB4mAg/edit#gid=0 private static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg.beijing.car01", - "CREATE TIMESERIES root.sg.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "CREATE DATABASE root.db.beijing.car01", + "CREATE TIMESERIES root.db.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", "flush", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", "flush" }; private static final String[] SQLs2 = new String[] { - "CREATE DATABASE root.sg.beijing.car02", - "CREATE TIMESERIES root.sg.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "CREATE DATABASE root.db.beijing.car02", + "CREATE TIMESERIES root.db.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", "flush" }; @@ -151,10 +151,10 @@ public void groupByConditionTest1() { {"2400000000", "2500000000", "100000000.0", "2", "100.0"} }; String sql = - "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false)"; + "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false)"; normalTestWithEndTime(res, sql); String sql2 = - "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false)"; + "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false)"; normalTest(res, sql2); } @@ -166,7 +166,7 @@ public void groupByConditionTest2() { {"5", "2500000000", "2499999995.0", "9", "100.0"} }; String sql2 = - "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=true)"; + "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=true)"; normalTest(res, sql2); } @@ -177,7 +177,7 @@ public void groupByConditionTest3() { {"5", "2500000000", "2499999995.0", "9", "100.0"}, }; String sql = - "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=3,ignoreNull=true)"; + "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=3,ignoreNull=true)"; normalTestWithEndTime(res, sql); } @@ -188,7 +188,7 @@ public void groupByConditionTest4() { {"5", "7", "2.0", "3", "36.0"}, }; String sql2 = - "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=3,ignoreNull=false)"; + "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=3,ignoreNull=false)"; normalTest(res, sql2); } @@ -199,7 +199,7 @@ public void groupByConditionTest5() { {"3", "4", "1.0", "2", "16.0"}, }; String sql = - "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=0,KEEP=2,ignoreNull=true)"; + "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=0,KEEP=2,ignoreNull=true)"; normalTestWithEndTime(res, sql); } @@ -210,7 +210,7 @@ public void groupByConditionTest6() { {"6", "2500000000", "2499999994", "13", "100.0"}, }; String sql = - "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(soc>=24.0,KEEP<=15)"; + "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(soc>=24.0,KEEP<=15)"; normalTestWithEndTime(res, sql); } @@ -222,7 +222,7 @@ private void normalTestWithEndTime(String[][] res, String sql) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); checkHeader( resultSetMetaData, - "Time,__endTime,max_time(root.sg.beijing.car01.charging_status) - min_time(root.sg.beijing.car01.charging_status),count(root.sg.beijing.car01.vehicle_status),last_value(root.sg.beijing.car01.soc)"); + "Time,__endTime,max_time(root.db.beijing.car01.charging_status) - min_time(root.db.beijing.car01.charging_status),count(root.db.beijing.car01.vehicle_status),last_value(root.db.beijing.car01.soc)"); int count = 0; while (resultSet.next()) { String startTime = resultSet.getString(1); @@ -253,7 +253,7 @@ private void normalTest(String[][] res, String sql) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); checkHeader( resultSetMetaData, - "Time,max_time(root.sg.beijing.car01.charging_status) - min_time(root.sg.beijing.car01.charging_status),count(root.sg.beijing.car01.vehicle_status),last_value(root.sg.beijing.car01.soc)"); + "Time,max_time(root.db.beijing.car01.charging_status) - min_time(root.db.beijing.car01.charging_status),count(root.db.beijing.car01.vehicle_status),last_value(root.db.beijing.car01.soc)"); int count = 0; while (resultSet.next()) { String startTime = resultSet.getString(1); @@ -285,11 +285,11 @@ private void normalTestWithEndTimeAlignByDevice(String[][] res, String sql) { "Time,Device,__endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc)"); int count = 0; int rowNum = res.length; - String device = "root.sg.beijing.car01"; + String device = "root.db.beijing.car01"; while (resultSet.next()) { if (count == rowNum) { count = 0; - device = "root.sg.beijing.car02"; + device = "root.db.beijing.car02"; } String startTime = resultSet.getString(1); String deviceName = resultSet.getString(2); @@ -324,11 +324,11 @@ private void normalTestAlignByDevice(String[][] res, String sql) { "Time,Device,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc)"); int count = 0; int rowNum = res.length; - String device = "root.sg.beijing.car01"; + String device = "root.db.beijing.car01"; while (resultSet.next()) { if (count == rowNum) { count = 0; - device = "root.sg.beijing.car02"; + device = "root.db.beijing.car02"; } String startTime = resultSet.getString(1); String deviceName = resultSet.getString(2); @@ -374,10 +374,10 @@ public void groupByConditionTestWithHaving() { {"2400000000", "2500000000", "100000000.0", "2", "100.0"} }; String sql = - "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false) having last_value(soc)>50"; + "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false) having last_value(soc)>50"; normalTestWithEndTime(res, sql); String sql2 = - "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false) having last_value(soc)>50"; + "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false) having last_value(soc)>50"; normalTest(res, sql2); } @@ -385,13 +385,13 @@ public void groupByConditionTestWithHaving() { public void groupByConditionFirstValueTest() { String[][] res = new String[][] {{"5", "7", "18.0"}}; String sql = - "select first_value(soc) from root.sg.beijing.car01 group by condition(charging_status!=0,KEEP>2,ignoreNull=false)"; + "select first_value(soc) from root.db.beijing.car01 group by condition(charging_status!=0,KEEP>2,ignoreNull=false)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); - checkHeader(resultSetMetaData, "Time,first_value(root.sg.beijing.car01.soc)"); + checkHeader(resultSetMetaData, "Time,first_value(root.db.beijing.car01.soc)"); int count = 0; while (resultSet.next()) { String startTime = resultSet.getString(1); @@ -427,28 +427,28 @@ public void errorTest1() { @Test public void errorTest2() { errorTest( - "select first_value(soc) from root.sg.beijing.car01 group by condition(count(charging_status)!=0,KEEP>2,ignoreNull=false)", + "select first_value(soc) from root.db.beijing.car01 group by condition(count(charging_status)!=0,KEEP>2,ignoreNull=false)", "701: Aggregation expression shouldn't exist in group by clause"); } @Test public void errorTest3() { errorTest( - "select first_value(soc) from root.sg.beijing.car01 group by condition(s1!=0,KEEP>2,ignoreNull=false)", - "701: root.sg.beijing.car01.s1 != 0 in group by clause doesn't exist."); + "select first_value(soc) from root.db.beijing.car01 group by condition(s1!=0,KEEP>2,ignoreNull=false)", + "701: root.db.beijing.car01.s1 != 0 in group by clause doesn't exist."); } @Test public void errorTest4() { errorTest( - "select first_value(soc) from root.sg.beijing.car01 group by condition(s1!=0,KEEP>2,ignoreNull=false) align by device", + "select first_value(soc) from root.db.beijing.car01 group by condition(s1!=0,KEEP>2,ignoreNull=false) align by device", "701: s1 != 0 in group by clause doesn't exist."); } @Test public void errorTest5() { errorTest( - "select first_value(soc) from root.sg.beijing.car01 group by condition(root.sg.beijing.car01.soc!=0,KEEP>2,ignoreNull=false) align by device", + "select first_value(soc) from root.db.beijing.car01 group by condition(root.db.beijing.car01.soc!=0,KEEP>2,ignoreNull=false) align by device", "701: ALIGN BY DEVICE: the suffix paths can only be measurement or one-level wildcard"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByCountIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByCountIT.java index 92af9934da95a..cda9fd8a43c5e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByCountIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByCountIT.java @@ -46,60 +46,60 @@ public class IoTDBGroupByCountIT { // https://docs.google.com/spreadsheets/d/1vsSmb41pdmK-BdBR1STwr8olg1Qc8baKVEWnfJB4mAg/edit#gid=0 private static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg.beijing.car01", - "CREATE TIMESERIES root.sg.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.soc WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "CREATE DATABASE root.db.beijing.car01", + "CREATE TIMESERIES root.db.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.soc WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", "flush", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", "flush" }; private static final String[] SQLs2 = new String[] { - "CREATE DATABASE root.sg.beijing.car02", - "CREATE TIMESERIES root.sg.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.soc WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "CREATE DATABASE root.db.beijing.car02", + "CREATE TIMESERIES root.db.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.soc WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", "flush", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", "flush" }; @@ -137,8 +137,8 @@ private void normalTest(String[][] res, String sql, boolean hasEndTime) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); String title = hasEndTime - ? "Time,__endTime,sum(root.sg.beijing.car01.charging_status),count(root.sg.beijing.car01.vehicle_status),last_value(root.sg.beijing.car01.soc)" - : "Time,sum(root.sg.beijing.car01.charging_status),count(root.sg.beijing.car01.vehicle_status),last_value(root.sg.beijing.car01.soc)"; + ? "Time,__endTime,sum(root.db.beijing.car01.charging_status),count(root.db.beijing.car01.vehicle_status),last_value(root.db.beijing.car01.soc)" + : "Time,sum(root.db.beijing.car01.charging_status),count(root.db.beijing.car01.vehicle_status),last_value(root.db.beijing.car01.soc)"; checkHeader(resultSetMetaData, title); int base = hasEndTime ? 1 : 0; int count = 0; @@ -173,8 +173,8 @@ private void firstValueTest(String[][] res, String sql, boolean hasEndTime) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); String title = hasEndTime - ? "Time,__endTime,first_value(root.sg.beijing.car01.soc)" - : "Time,first_value(root.sg.beijing.car01.soc)"; + ? "Time,__endTime,first_value(root.db.beijing.car01.soc)" + : "Time,first_value(root.db.beijing.car01.soc)"; checkHeader(resultSetMetaData, title); int count = 0; while (resultSet.next()) { @@ -206,9 +206,9 @@ public void groupByCountNormalTest1() { {"6", "1900000000", "5.0", "5", "55"}, }; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5)"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 5)"; String sql2 = - "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5)"; + "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 5)"; normalTest(res, sql, false); normalTest(res, sql2, true); } @@ -217,9 +217,9 @@ public void groupByCountNormalTest1() { public void groupByCountNormalTest2() { String[][] res = {{"1", "2400000000", "10.0", "12", "80"}}; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 12)"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 12)"; String sql2 = - "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 12)"; + "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 12)"; normalTest(res, sql, false); normalTest(res, sql2, true); } @@ -231,9 +231,9 @@ public void groupByCountNormalTest3() { {"6", "1900000000", "24"}, }; String sql = - "select first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5)"; + "select first_value(soc) from root.db.beijing.car01 group by count(charging_status, 5)"; String sql2 = - "select __endTime,first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5)"; + "select __endTime,first_value(soc) from root.db.beijing.car01 group by count(charging_status, 5)"; firstValueTest(res, sql, false); firstValueTest(res, sql2, true); } @@ -245,9 +245,9 @@ public void groupByCountNormalTest4() { {"9", "2600000000", "45"}, }; String sql = - "select first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 7)"; + "select first_value(soc) from root.db.beijing.car01 group by count(charging_status, 7)"; String sql2 = - "select __endTime,first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 7)"; + "select __endTime,first_value(soc) from root.db.beijing.car01 group by count(charging_status, 7)"; firstValueTest(res, sql, false); firstValueTest(res, sql2, true); } @@ -264,9 +264,9 @@ public void groupByCountNormalTest5() { {"2500000000", "2600000000", "100"} }; String sql = - "select first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2)"; + "select first_value(soc) from root.db.beijing.car01 group by count(charging_status, 2)"; String sql2 = - "select __endTime,first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2)"; + "select __endTime,first_value(soc) from root.db.beijing.car01 group by count(charging_status, 2)"; firstValueTest(res, sql, false); firstValueTest(res, sql2, true); } @@ -283,9 +283,9 @@ public void groupByCountNormalTest6() { {"2500000000", "2600000000", "1.0", "2", "101"} }; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2)"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 2)"; String sql2 = - "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2)"; + "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 2)"; normalTest(res, sql, false); normalTest(res, sql2, true); } @@ -297,7 +297,7 @@ public void groupByCountNormalTest7() { {"2500000000", "2600000000", "1.0", "2", "101"} }; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2) having sum(charging_status)<2"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 2) having sum(charging_status)<2"; normalTest(res, sql, false); } @@ -310,9 +310,9 @@ public void groupByCountNormalTest8() { {"2200000000", "2600000000", "2.0", "5", "101"}, }; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5, ignoreNull=false)"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 5, ignoreNull=false)"; String sql2 = - "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5, ignoreNull=false)"; + "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 5, ignoreNull=false)"; normalTest(res, sql, false); normalTest(res, sql2, true); } @@ -332,9 +332,9 @@ public void groupByCountNormalTest9() { {"2500000000", "2600000000", "100"} }; String sql = - "select first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2, ignoreNull=false)"; + "select first_value(soc) from root.db.beijing.car01 group by count(charging_status, 2, ignoreNull=false)"; String sql2 = - "select __endTime,first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2, ignoreNull=false)"; + "select __endTime,first_value(soc) from root.db.beijing.car01 group by count(charging_status, 2, ignoreNull=false)"; firstValueTest(res, sql, false); firstValueTest(res, sql2, true); } @@ -343,9 +343,9 @@ public void groupByCountNormalTest9() { public void groupByCountNormalTest10() { String[][] res = {{"1", "1200000000", "7.0", "12", "0"}}; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 12, ignoreNull = false)"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 12, ignoreNull = false)"; String sql2 = - "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 12, ignoreNull = false)"; + "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 12, ignoreNull = false)"; normalTest(res, sql, false); normalTest(res, sql2, true); } @@ -362,12 +362,12 @@ private void normalTestWithAlignByDevice(String[][] res, String sql, boolean has : "Time,Device,sum(charging_status),count(vehicle_status),last_value(soc)"; checkHeader(resultSetMetaData, title); int count = 0; - String expectedDevice = "root.sg.beijing.car01"; + String expectedDevice = "root.db.beijing.car01"; int base = hasEndTime ? 1 : 0; while (resultSet.next()) { if (count == res.length) { count = 0; - expectedDevice = "root.sg.beijing.car02"; + expectedDevice = "root.db.beijing.car02"; } String startTime = resultSet.getString(1); String device = resultSet.getString(2); @@ -431,28 +431,28 @@ public void errorTest1() { @Test public void errorTest2() { errorTest( - "select count(soc) from root.sg.beijing.car01 group by count(count(soc),2)", + "select count(soc) from root.db.beijing.car01 group by count(count(soc),2)", "701: Aggregation expression shouldn't exist in group by clause"); } @Test public void errorTest3() { errorTest( - "select count(soc) from root.sg.beijing.car01 group by count(s1,2)", - "701: root.sg.beijing.car01.s1 in group by clause doesn't exist."); + "select count(soc) from root.db.beijing.car01 group by count(s1,2)", + "701: root.db.beijing.car01.s1 in group by clause doesn't exist."); } @Test public void errorTest4() { errorTest( - "select count(soc) from root.sg.beijing.car01 group by count(s1,2) align by device", + "select count(soc) from root.db.beijing.car01 group by count(s1,2) align by device", "701: s1 in group by clause doesn't exist."); } @Test public void errorTest5() { errorTest( - "select count(soc) from root.sg.beijing.car01 group by count(root.sg.beijing.car01.soc,2) align by device", + "select count(soc) from root.db.beijing.car01 group by count(root.db.beijing.car01.soc,2) align by device", "701: ALIGN BY DEVICE: the suffix paths can only be measurement or one-level wildcard"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthIT.java index 9d56acf518fbf..a2057752896ab 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthIT.java @@ -65,7 +65,7 @@ public class IoTDBGroupByNaturalMonthIT { for (long i = 1604102400000L /* 2020-10-31 00:00:00 */; i <= 1617148800000L /* 2021-03-31 00:00:00 */; i += 86400_000L) { - dataSet.add("insert into root.sg1.d1(timestamp, temperature) values (" + i + ", 1)"); + dataSet.add("insert into root.db1.d1(timestamp, temperature) values (" + i + ", 1)"); } // TimeRange: [2023-01-01 00:00:00, 2027-01-01 00:00:00] @@ -103,7 +103,7 @@ public static void tearDown() throws Exception { */ @Test public void groupByNaturalMonthTest1() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = new String[] { "10/31/2020:00:00:00,30.0,", @@ -113,7 +113,7 @@ public void groupByNaturalMonthTest1() { "02/28/2021:00:00:00,1.0," }; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2020-10-31, 2021-03-01), 1mo, 1mo)", expectedHeader, retArray, @@ -127,7 +127,7 @@ public void groupByNaturalMonthTest1() { */ @Test public void groupByNaturalMonthTest2() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = { "10/31/2020:00:00:00,10.0,", "11/30/2020:00:00:00,10.0,", @@ -136,7 +136,7 @@ public void groupByNaturalMonthTest2() { "02/28/2021:00:00:00,1.0," }; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2020-10-31, 2021-03-01), 10d, 1mo)", expectedHeader, retArray, @@ -150,10 +150,10 @@ public void groupByNaturalMonthTest2() { */ @Test public void groupByNaturalMonthTest3() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = {"10/31/2020:00:00:00,30.0,"}; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 " + "GROUP BY ([2020-10-31, 2020-11-30), 1mo)", + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2020-10-31, 2020-11-30), 1mo)", expectedHeader, retArray, df, @@ -166,10 +166,10 @@ public void groupByNaturalMonthTest3() { */ @Test public void groupByNaturalMonthTest4() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = {"01/31/2021:00:00:00,28.0,", "02/28/2021:00:00:00,31.0,"}; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 GROUP BY ([2021-01-31, 2021-03-31), 1mo)", + "select sum(temperature) from root.db1.d1 GROUP BY ([2021-01-31, 2021-03-31), 1mo)", expectedHeader, retArray, df, @@ -178,12 +178,12 @@ public void groupByNaturalMonthTest4() { @Test public void groupByNaturalMonthTest5() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = { "01/30/2021:00:00:00,29.0,", "02/28/2021:00:00:00,30.0,", "03/30/2021:00:00:00,1.0," }; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 GROUP BY ([2021-01-30, 2021-03-31), 1mo)", + "select sum(temperature) from root.db1.d1 GROUP BY ([2021-01-30, 2021-03-31), 1mo)", expectedHeader, retArray, df, @@ -194,12 +194,12 @@ public void groupByNaturalMonthTest5() { @Test public void groupByNaturalMonthFailTest() { assertTestFail( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2021-01-31, 2021-03-31), 1mo) order by time desc", "doesn't support order by time desc now."); assertTestFail( - "select sum(temperature) from root.sg1.d1 GROUP BY ([1970-01-01, 2970-01-01), 40d, 1mo)", + "select sum(temperature) from root.db1.d1 GROUP BY ([1970-01-01, 2970-01-01), 40d, 1mo)", "The time windows may exceed 10000, please ensure your input."); } @@ -217,9 +217,9 @@ public void groupByNaturalMonthWithNowTest() { List times = new ArrayList<>(); try (ResultSet resultSet = statement.executeQuery( - "select sum(temperature) from root.sg1.d1 GROUP BY ([now() - 1mo, now()), 1d)")) { + "select sum(temperature) from root.db1.d1 GROUP BY ([now() - 1mo, now()), 1d)")) { while (resultSet.next()) { - String ans = resultSet.getString(sum("root.sg1.d1.temperature")); + String ans = resultSet.getString(sum("root.db1.d1.temperature")); times.add(resultSet.getString("Time")); if (ans == null) { cnt++; @@ -236,7 +236,7 @@ public void groupByNaturalMonthWithNowTest() { @Test public void groupBySlingWindowNaturalMonth1() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = { "10/31/2020:00:00:00,61.0,", "11/30/2020:00:00:00,62.0,", @@ -245,7 +245,7 @@ public void groupBySlingWindowNaturalMonth1() { "02/28/2021:00:00:00,1.0," }; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2020-10-31, 2021-03-01), 2mo, 1mo)", expectedHeader, retArray, @@ -255,7 +255,7 @@ public void groupBySlingWindowNaturalMonth1() { @Test public void groupBySlingWindowNaturalMonth2() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = { "10/31/2020:00:00:00,30.0,", "11/10/2020:00:00:00,30.0,", @@ -272,7 +272,7 @@ public void groupBySlingWindowNaturalMonth2() { "02/28/2021:00:00:00,1.0," }; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2020-10-31, 2021-03-01), 1mo, 10d)", expectedHeader, retArray, diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthNsPrecisionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthNsPrecisionIT.java index 807ecf6620e30..ec7803921084b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthNsPrecisionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthNsPrecisionIT.java @@ -45,7 +45,7 @@ public class IoTDBGroupByNaturalMonthNsPrecisionIT extends IoTDBGroupByNaturalMo i <= 1617148800000L /* 2021-03-31 00:00:00 */; i += 86400_000L) { dataSet.add( - "insert into root.sg1.d1(timestamp, temperature) values (" + i * 1000000 + ", 1)"); + "insert into root.db1.d1(timestamp, temperature) values (" + i * 1000000 + ", 1)"); } // TimeRange: [2023-01-01 00:00:00, 2027-01-01 00:00:00] @@ -72,13 +72,13 @@ public static void setUp() throws Exception { @Test public void groupByNaturalMonthFailTest() { assertTestFail( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2021-01-31, 2021-03-31), 1mo) order by time desc", "doesn't support order by time desc now."); // 2970-01-01 in ns precision has exceeded field of long number assertTestFail( - "select sum(temperature) from root.sg1.d1 GROUP BY ([1970-01-01, 2970-01-01), 40d, 1mo)", + "select sum(temperature) from root.db1.d1 GROUP BY ([1970-01-01, 2970-01-01), 40d, 1mo)", "Input time format 2970-01-01 error."); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthUsPrecisionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthUsPrecisionIT.java index eb4bfec938f9d..81e1c2daa5b43 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthUsPrecisionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthUsPrecisionIT.java @@ -43,7 +43,7 @@ public class IoTDBGroupByNaturalMonthUsPrecisionIT extends IoTDBGroupByNaturalMo for (long i = 1604102400000L /* 2020-10-31 00:00:00 */; i <= 1617148800000L /* 2021-03-31 00:00:00 */; i += 86400_000L) { - dataSet.add("insert into root.sg1.d1(timestamp, temperature) values (" + i * 1000 + ", 1)"); + dataSet.add("insert into root.db1.d1(timestamp, temperature) values (" + i * 1000 + ", 1)"); } // TimeRange: [2023-01-01 00:00:00, 2027-01-01 00:00:00] diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByUnseqIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByUnseqIT.java index a15991c487683..3899c8f6b5fe2 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByUnseqIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByUnseqIT.java @@ -39,36 +39,36 @@ public class IoTDBGroupByUnseqIT { private static final String[] dataSet1 = new String[] { - "CREATE DATABASE root.sg1", - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg1.d1(time,s1) values(1, 1)", - "INSERT INTO root.sg1.d1(time,s1) values(2, 2)", - "INSERT INTO root.sg1.d1(time,s1) values(3, 3)", - "INSERT INTO root.sg1.d1(time,s1) values(4, 4)", - "INSERT INTO root.sg1.d1(time,s1) values(8, 8)", - "INSERT INTO root.sg1.d1(time,s1) values(10, 10)", - "INSERT INTO root.sg1.d1(time,s1) values(11, 11)", - "INSERT INTO root.sg1.d1(time,s1) values(12, 12)", + "CREATE DATABASE root.db1", + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db1.d1(time,s1) values(1, 1)", + "INSERT INTO root.db1.d1(time,s1) values(2, 2)", + "INSERT INTO root.db1.d1(time,s1) values(3, 3)", + "INSERT INTO root.db1.d1(time,s1) values(4, 4)", + "INSERT INTO root.db1.d1(time,s1) values(8, 8)", + "INSERT INTO root.db1.d1(time,s1) values(10, 10)", + "INSERT INTO root.db1.d1(time,s1) values(11, 11)", + "INSERT INTO root.db1.d1(time,s1) values(12, 12)", "flush", - "INSERT INTO root.sg1.d1(time,s1) values(7, 7)", - "INSERT INTO root.sg1.d1(time,s1) values(9, 9)", + "INSERT INTO root.db1.d1(time,s1) values(7, 7)", + "INSERT INTO root.db1.d1(time,s1) values(9, 9)", "flush" }; private static final String[] dataSet2 = new String[] { - "CREATE DATABASE root.sg2", - "CREATE TIMESERIES root.sg2.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg2.d1(time,s1) values(1, 1)", - "INSERT INTO root.sg2.d1(time,s1) values(10, 10)", + "CREATE DATABASE root.db2", + "CREATE TIMESERIES root.db2.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db2.d1(time,s1) values(1, 1)", + "INSERT INTO root.db2.d1(time,s1) values(10, 10)", "flush", - "INSERT INTO root.sg2.d1(time,s1) values(19, 19)", - "INSERT INTO root.sg2.d1(time,s1) values(30, 30)", + "INSERT INTO root.db2.d1(time,s1) values(19, 19)", + "INSERT INTO root.db2.d1(time,s1) values(30, 30)", "flush", - "INSERT INTO root.sg2.d1(time,s1) values(5, 5)", - "INSERT INTO root.sg2.d1(time,s1) values(15, 15)", - "INSERT INTO root.sg2.d1(time,s1) values(26, 26)", - "INSERT INTO root.sg2.d1(time,s1) values(30, 30)", + "INSERT INTO root.db2.d1(time,s1) values(5, 5)", + "INSERT INTO root.db2.d1(time,s1) values(15, 15)", + "INSERT INTO root.db2.d1(time,s1) values(26, 26)", + "INSERT INTO root.db2.d1(time,s1) values(30, 30)", "flush" }; @@ -86,7 +86,7 @@ public void tearDown() throws Exception { public void test1() { EnvFactory.getEnv().getConfig().getCommonConfig().setMaxNumberOfPointsInPage(4); EnvFactory.getEnv().initClusterEnvironment(); - String[] expectedHeader = new String[] {TIMESTAMP_STR, count("root.sg1.d1.s1")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, count("root.db1.d1.s1")}; String[] retArray = new String[] { "1,3,", "4,1,", "7,3,", "10,3,", @@ -94,7 +94,7 @@ public void test1() { prepareData(dataSet1); resultSetEqualTest( - "select count(s1) from root.sg1.d1 group by ([1, 13), 3ms)", expectedHeader, retArray); + "select count(s1) from root.db1.d1 group by ([1, 13), 3ms)", expectedHeader, retArray); } /** @@ -112,11 +112,11 @@ public void test2() { .setMaxNumberOfPointsInPage(4) .setTargetChunkPointNum(2); EnvFactory.getEnv().initClusterEnvironment(); - String[] expectedHeader = new String[] {TIMESTAMP_STR, count("root.sg2.d1.s1")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, count("root.db2.d1.s1")}; String[] retArray = new String[] {"5,1,", "10,1,", "15,2,", "20,0,", "25,1,"}; prepareData(dataSet2); resultSetEqualTest( - "select count(s1) from root.sg2.d1 group by ([5, 30), 5ms)", expectedHeader, retArray); + "select count(s1) from root.db2.d1 group by ([5, 30), 5ms)", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBHavingIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBHavingIT.java index 6bcd535e0b58c..26b97e43d17ed 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBHavingIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBHavingIT.java @@ -47,49 +47,49 @@ public class IoTDBHavingIT { private static final String[] SQLs = new String[] { "CREATE DATABASE root.test", - "CREATE TIMESERIES root.test.sg1.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", "CREATE ALIGNED TIMESERIES root.test.sg3(s5 INT32, s6 BOOLEAN, s7 DOUBLE, s8 INT32)", "CREATE TIMESERIES root.test.sg5.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", "CREATE TIMESERIES root.test.sg5.s9 WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) values(1, true, 1, 1.0, 1)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) values(1, false, 1, 1.0, 1)", - "INSERT INTO root.test.sg1(timestamp, s2) values(2, 2)", - "INSERT INTO root.test.sg1(timestamp, s3) values(2, 2.0)", - "INSERT INTO root.test.sg1(timestamp, s4) values(2, 2)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) values(2, true, 2, 2.0, 2)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) values(1, true, 1, 1.0, 1)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) values(1, false, 1, 1.0, 1)", + "INSERT INTO root.test.db1(timestamp, s2) values(2, 2)", + "INSERT INTO root.test.db1(timestamp, s3) values(2, 2.0)", + "INSERT INTO root.test.db1(timestamp, s4) values(2, 2)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) values(2, true, 2, 2.0, 2)", "flush", - "INSERT INTO root.test.sg1(timestamp, s1) values(3, false)", - "INSERT INTO root.test.sg1(timestamp, s2) values(5, 5)", - "INSERT INTO root.test.sg1(timestamp, s3) values(5, 5.0)", - "INSERT INTO root.test.sg1(timestamp, s4) values(5, 5)", - "INSERT INTO root.test.sg2(timestamp, s2) values(5, 5)", - "INSERT INTO root.test.sg2(timestamp, s3) values(5, 5.0)", - "INSERT INTO root.test.sg2(timestamp, s4) values(5, 5)", + "INSERT INTO root.test.db1(timestamp, s1) values(3, false)", + "INSERT INTO root.test.db1(timestamp, s2) values(5, 5)", + "INSERT INTO root.test.db1(timestamp, s3) values(5, 5.0)", + "INSERT INTO root.test.db1(timestamp, s4) values(5, 5)", + "INSERT INTO root.test.db2(timestamp, s2) values(5, 5)", + "INSERT INTO root.test.db2(timestamp, s3) values(5, 5.0)", + "INSERT INTO root.test.db2(timestamp, s4) values(5, 5)", "flush", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) values(6, true, 6, 6.0, 6)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) values(6, true, 6, 6.0, 6)", - "INSERT INTO root.test.sg1(timestamp, s1) values(7, true)", - "INSERT INTO root.test.sg1(timestamp, s3) values(7, 7.0)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3) values(7, true, 7, 7.0)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) values(6, true, 6, 6.0, 6)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) values(6, true, 6, 6.0, 6)", + "INSERT INTO root.test.db1(timestamp, s1) values(7, true)", + "INSERT INTO root.test.db1(timestamp, s3) values(7, 7.0)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3) values(7, true, 7, 7.0)", "flush", - "INSERT INTO root.test.sg1(timestamp, s1) values(8, true)", - "INSERT INTO root.test.sg1(timestamp, s2) values(8, 8)", - "INSERT INTO root.test.sg1(timestamp, s3) values(8, 8.0)", - "INSERT INTO root.test.sg2(timestamp, s3) values(8, 8.0)", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) values(9, false, 9, 9.0, 9)", - "INSERT INTO root.test.sg2(timestamp, s1) values(9, true)", + "INSERT INTO root.test.db1(timestamp, s1) values(8, true)", + "INSERT INTO root.test.db1(timestamp, s2) values(8, 8)", + "INSERT INTO root.test.db1(timestamp, s3) values(8, 8.0)", + "INSERT INTO root.test.db2(timestamp, s3) values(8, 8.0)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) values(9, false, 9, 9.0, 9)", + "INSERT INTO root.test.db2(timestamp, s1) values(9, true)", "flush", - "INSERT INTO root.test.sg2(timestamp, s2) values(9, 9)", - "INSERT INTO root.test.sg2(timestamp, s4) values(9, 9)", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) values(10, true, 10, 10.0, 10)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) values(10, true, 10, 10.0, 10)", + "INSERT INTO root.test.db2(timestamp, s2) values(9, 9)", + "INSERT INTO root.test.db2(timestamp, s4) values(9, 9)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) values(10, true, 10, 10.0, 10)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) values(10, true, 10, 10.0, 10)", "flush", "INSERT INTO root.test.sg3(time, s5, s6, s7, s8) aligned values(1, 1, true, 1.0, 1)", "INSERT INTO root.test.sg3(time, s6, s7, s8) aligned values(2, false, 2.0, 2)", @@ -144,19 +144,19 @@ public void testUnsatisfiedRuleQuery() { @Test public void groupByTimeWithHavingTest() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, count("root.test.sg1.s1")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, count("root.test.db1.s1")}; String[] retArray = new String[] {"1,1,", "5,1,", "9,2,"}; resultSetEqualWithDescOrderTest( - "select count(sg1.s1) from root.** " + "select count(db1.s1) from root.** " + "GROUP BY ([1,11), 2ms) " - + "Having count(sg1.s2) > 1", + + "Having count(db1.s2) > 1", expectedHeader, retArray); resultSetEqualWithDescOrderTest( - "select count(sg1.s1) from root.**" + "select count(db1.s1) from root.**" + "GROUP BY ([1,11), 2ms) " - + "Having count(sg1.s2) > 2", + + "Having count(db1.s2) > 2", expectedHeader, new String[] {}); } @@ -166,12 +166,12 @@ public void groupByTimeAlignByDeviceWithHavingTest() { String[] expectedHeader = new String[] {TIMESTAMP_STR, "Device", count("s1"), count("s2")}; String[] retArray = new String[] { - "1,root.test.sg1,1,2,", - "5,root.test.sg1,1,2,", - "9,root.test.sg1,2,2,", - "1,root.test.sg2,2,2,", - "5,root.test.sg2,1,2,", - "9,root.test.sg2,2,2,", + "1,root.test.db1,1,2,", + "5,root.test.db1,1,2,", + "9,root.test.db1,2,2,", + "1,root.test.db2,2,2,", + "5,root.test.db2,1,2,", + "9,root.test.db2,2,2,", }; resultSetEqualTest( "select count(s1), count(s2) from root.** " @@ -269,8 +269,8 @@ public void caseSensitiveHavingTest() { new String[] { TIMESTAMP_STR, lastValue("root.test.sg5.s1"), - lastValue("root.test.sg1.s1"), - lastValue("root.test.sg2.s1"), + lastValue("root.test.db1.s1"), + lastValue("root.test.db2.s1"), }; String[] retArray = new String[] { @@ -295,14 +295,14 @@ public void caseSensitiveHavingTest() { expectedHeader = new String[] {TIMESTAMP_STR, "Device", lastValue("s1")}; retArray = new String[] { - "1,root.test.sg1,true,", - "5,root.test.sg1,true,", - "7,root.test.sg1,true,", - "9,root.test.sg1,true,", - "1,root.test.sg2,true,", - "5,root.test.sg2,true,", - "7,root.test.sg2,true,", - "9,root.test.sg2,true," + "1,root.test.db1,true,", + "5,root.test.db1,true,", + "7,root.test.db1,true,", + "9,root.test.db1,true,", + "1,root.test.db2,true,", + "5,root.test.db2,true,", + "7,root.test.db2,true,", + "9,root.test.db2,true," }; resultSetEqualTest( "select last_value(s1) from root.** " diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBLeftORightCIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBLeftORightCIT.java index 82e32b314db8f..6aa04c304d2bd 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBLeftORightCIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBLeftORightCIT.java @@ -40,7 +40,7 @@ public class IoTDBLeftORightCIT { private static final String[] sqls = new String[] { - "insert into root.sg1.d1(time, s1) values(9, 9)", + "insert into root.db1.d1(time, s1) values(9, 9)", }; @BeforeClass @@ -58,13 +58,13 @@ public static void tearDown() throws Exception { public void testLeftORightCGroupBy() { String[] expectedHeader = new String[] { - TIMESTAMP_STR, count("root.sg1.d1.s1"), + TIMESTAMP_STR, count("root.db1.d1.s1"), }; String[] retArray = new String[] { "2,0,", "4,0,", "6,0,", "8,0,", "9,1,", }; resultSetEqualWithDescOrderTest( - "select count(s1) from root.sg1.d1 group by((0, 9], 2ms)", expectedHeader, retArray); + "select count(s1) from root.db1.d1 group by((0, 9], 2ms)", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java index 1c69857a3c506..21683fe61f493 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java @@ -75,11 +75,11 @@ public class IoTDBLastQueryLastCacheIT { "insert into root.ln_1.tb_6141(time,`waterNH4-N_DOUBLE`) aligned values(1679365910000,12.0);", "insert into root.ln_1.tb_6141(time,`waterNH4-N_DOUBLE`) aligned values(1679365910000,12.0);", "insert into root.ln_1.tb_6141(time,`switch_BOOLEAN`) aligned values(1675995566000,false);", - "create aligned timeseries root.sg(风机退出_BOOLEAN BOOLEAN encoding=RLE,`NH4-N_DOUBLE` DOUBLE encoding=GORILLA,膜产水状态_BOOLEAN BOOLEAN encoding=RLE,11_TEXT TEXT encoding=PLAIN,产水间歇运行时间设置_DOUBLE DOUBLE encoding=GORILLA,文本_TEXT TEXT encoding=PLAIN, 风机投入_BOOLEAN BOOLEAN encoding=RLE,枚举_INT32 INT32 encoding=RLE,出水TP_DOUBLE DOUBLE encoding=GORILLA,水管流速_DOUBLE DOUBLE encoding=GORILLA,CO2_DOUBLE DOUBLE encoding=GORILLA,`开关量-运行_BOOLEAN` BOOLEAN encoding=RLE,code_DOUBLE DOUBLE encoding=GORILLA);", - "insert into root.sg(time,code_DOUBLE) aligned values(1679477545000,2.0);", - "insert into root.sg(time,`NH4-N_DOUBLE`) aligned values(1679365910000,12.0);", - "create timeseries root.sg.d1.s1 with datatype=BLOB;", - "insert into root.sg.d1(time,s1) values(1,X'cafebabe')", + "create aligned timeseries root.db(风机退出_BOOLEAN BOOLEAN encoding=RLE,`NH4-N_DOUBLE` DOUBLE encoding=GORILLA,膜产水状态_BOOLEAN BOOLEAN encoding=RLE,11_TEXT TEXT encoding=PLAIN,产水间歇运行时间设置_DOUBLE DOUBLE encoding=GORILLA,文本_TEXT TEXT encoding=PLAIN, 风机投入_BOOLEAN BOOLEAN encoding=RLE,枚举_INT32 INT32 encoding=RLE,出水TP_DOUBLE DOUBLE encoding=GORILLA,水管流速_DOUBLE DOUBLE encoding=GORILLA,CO2_DOUBLE DOUBLE encoding=GORILLA,`开关量-运行_BOOLEAN` BOOLEAN encoding=RLE,code_DOUBLE DOUBLE encoding=GORILLA);", + "insert into root.db(time,code_DOUBLE) aligned values(1679477545000,2.0);", + "insert into root.db(time,`NH4-N_DOUBLE`) aligned values(1679365910000,12.0);", + "create timeseries root.db.d1.s1 with datatype=BLOB;", + "insert into root.db.d1(time,s1) values(1,X'cafebabe')", }; @BeforeClass @@ -155,10 +155,10 @@ public void testLastQuery1() { new String[] {TIMESTAMP_STR, TIMESERIES_STR, VALUE_STR, DATA_TYPE_STR}; String[] retArray = new String[] { - "1679365910000,root.sg.`NH4-N_DOUBLE`,12.0,DOUBLE,", - "1679477545000,root.sg.code_DOUBLE,2.0,DOUBLE,", + "1679365910000,root.db.`NH4-N_DOUBLE`,12.0,DOUBLE,", + "1679477545000,root.db.code_DOUBLE,2.0,DOUBLE,", }; - resultSetEqualTest("select last * from root.sg;", expectedHeader, retArray); + resultSetEqualTest("select last * from root.db;", expectedHeader, retArray); } @Test @@ -188,8 +188,8 @@ public void testLastQueryWithBlobType() { new String[] {TIMESTAMP_STR, TIMESERIES_STR, VALUE_STR, DATA_TYPE_STR}; String[] retArray = new String[] { - "1,root.sg.d1.s1,0xcafebabe,BLOB,", + "1,root.db.d1.s1,0xcafebabe,BLOB,", }; - resultSetEqualTest("select last s1 from root.sg.d1;", expectedHeader, retArray); + resultSetEqualTest("select last s1 from root.db.d1;", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryWithLimitOffsetIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryWithLimitOffsetIT.java index 995367f10ad15..f3e9fe3b89153 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryWithLimitOffsetIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryWithLimitOffsetIT.java @@ -47,8 +47,8 @@ public static void setUp() throws Exception { EnvFactory.getEnv().initClusterEnvironment(); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time, s1, s2) values(1, 1, 1)"); - statement.execute("insert into root.sg.d2(time, s1, s2) aligned values(2, 1, 1)"); + statement.execute("insert into root.db.d1(time, s1, s2) values(1, 1, 1)"); + statement.execute("insert into root.db.d2(time, s1, s2) aligned values(2, 1, 1)"); } catch (SQLException e) { e.printStackTrace(); fail(e.getMessage()); @@ -64,14 +64,14 @@ public static void tearDown() throws Exception { public void testWithLimit() { String[] retArray = new String[] { - "1,root.sg.d1.s1,1.0,DOUBLE", + "1,root.db.d1.s1,1.0,DOUBLE", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg.* order by timeseries asc limit 1")) { + statement.executeQuery("select last * from root.db.* order by timeseries asc limit 1")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -95,13 +95,13 @@ public void testWithLimit() { @Test public void testWithOffset() { - String[] retArray = new String[] {"2,root.sg.d2.s2,1.0,DOUBLE"}; + String[] retArray = new String[] {"2,root.db.d2.s2,1.0,DOUBLE"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg.* order by timeseries asc offset 3")) { + statement.executeQuery("select last * from root.db.* order by timeseries asc offset 3")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -127,7 +127,7 @@ public void testWithOffset() { public void testWithLimitAndOffset() { String[] retArray = new String[] { - "1,root.sg.d1.s2,1.0,DOUBLE", "2,root.sg.d2.s1,1.0,DOUBLE", + "1,root.db.d1.s2,1.0,DOUBLE", "2,root.db.d2.s1,1.0,DOUBLE", }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -135,7 +135,7 @@ public void testWithLimitAndOffset() { try (ResultSet resultSet = statement.executeQuery( - "select last * from root.sg.* order by timeseries asc limit 2 offset 1")) { + "select last * from root.db.* order by timeseries asc limit 2 offset 1")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -164,14 +164,14 @@ public void testWithSLimitOrSOffset() { Statement statement = connection.createStatement()) { try { - statement.executeQuery("select last * from root.sg.* order by timeseries asc slimit 1"); + statement.executeQuery("select last * from root.db.* order by timeseries asc slimit 1"); fail(); } catch (Exception ignored) { } try { - statement.executeQuery("select last * from root.sg.* order by timeseries asc soffset 1"); + statement.executeQuery("select last * from root.db.* order by timeseries asc soffset 1"); fail(); } catch (Exception ignored) { @@ -179,7 +179,7 @@ public void testWithSLimitOrSOffset() { try { statement.executeQuery( - "select last * from root.sg.* order by timeseries asc slimit 1 soffset 1"); + "select last * from root.db.* order by timeseries asc slimit 1 soffset 1"); fail(); } catch (Exception ignored) { @@ -195,7 +195,7 @@ public void testWithSLimitOrSOffset() { public void testWithSortLimit() { String[] retArray = new String[] { - "2,root.sg.d2.s2,1.0,DOUBLE", + "2,root.db.d2.s2,1.0,DOUBLE", }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -203,7 +203,7 @@ public void testWithSortLimit() { try (ResultSet resultSet = statement.executeQuery( - "select last * from root.sg.** order by time desc, timeseries desc limit 1")) { + "select last * from root.db.** order by time desc, timeseries desc limit 1")) { int cnt = 0; while (resultSet.next()) { String ans = diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastWithTTLIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastWithTTLIT.java index b69af5ab0172f..2ba3b7269127c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastWithTTLIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastWithTTLIT.java @@ -48,8 +48,8 @@ public static void setUp() throws Exception { EnvFactory.getEnv().initClusterEnvironment(); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time, s1, s2) values(1, 1, 1)"); - statement.execute("insert into root.sg.d2(time, s1, s2) aligned values(2, 1, 1)"); + statement.execute("insert into root.db.d1(time, s1, s2) values(1, 1, 1)"); + statement.execute("insert into root.db.d2(time, s1, s2) aligned values(2, 1, 1)"); } catch (SQLException e) { e.printStackTrace(); fail(e.getMessage()); @@ -65,17 +65,17 @@ public static void tearDown() throws Exception { public void withTTL() { String[] retArray = new String[] { - "1,root.sg.d1.s1,1.0,DOUBLE", - "1,root.sg.d1.s2,1.0,DOUBLE", - "2,root.sg.d2.s1,1.0,DOUBLE", - "2,root.sg.d2.s2,1.0,DOUBLE" + "1,root.db.d1.s1,1.0,DOUBLE", + "1,root.db.d1.s2,1.0,DOUBLE", + "2,root.db.d2.s1,1.0,DOUBLE", + "2,root.db.d2.s2,1.0,DOUBLE" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg.* order by timeseries asc")) { + statement.executeQuery("select last * from root.db.* order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -91,10 +91,10 @@ public void withTTL() { assertEquals(retArray.length, cnt); } - statement.execute("set ttl to root.sg 1"); + statement.execute("set ttl to root.db 1"); try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg.* order by timeseries asc")) { + statement.executeQuery("select last * from root.db.* order by timeseries asc")) { assertFalse(resultSet.next()); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java index 7f84a2df90065..212c11cd33933 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java @@ -50,51 +50,51 @@ public class IoTDBOrderByIT { // https://docs.google.com/spreadsheets/d/1OWA1bKraArCwWVnuTjuhJ5yLG0PFLdD78gD6FjquepI/edit#gid=0 private static final String[] sql = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d.bigNum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d.floatNum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", - "CREATE TIMESERIES root.sg.d.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d.bigNum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d.floatNum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", + "CREATE TIMESERIES root.db.d.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" }; private static final String[] sql2 = new String[] { - "CREATE TIMESERIES root.sg.d2.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.bigNum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.floatNum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", - "CREATE TIMESERIES root.sg.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" + "CREATE TIMESERIES root.db.d2.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.bigNum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.floatNum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", + "CREATE TIMESERIES root.db.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" }; @BeforeClass @@ -164,11 +164,11 @@ private void testNormalOrderBy(String sql, int[] ans) { metaData, new String[] { "Time", - "root.sg.d.num", - "root.sg.d.bigNum", - "root.sg.d.floatNum", - "root.sg.d.str", - "root.sg.d.bool" + "root.db.d.num", + "root.db.d.bigNum", + "root.db.d.floatNum", + "root.db.d.str", + "root.db.d.bool" }); int i = 0; while (resultSet.next()) { @@ -200,35 +200,35 @@ private void testNormalOrderBy(String sql, int[] ans) { // 1. One-level order by test @Test public void orderByTest1() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by num"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by num"; int[] ans = {2, 1, 0, 7, 8, 5, 9, 4, 3, 6, 10, 11, 13, 12, 14}; testNormalOrderBy(sql, ans); } @Test public void orderByTest2() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by bigNum,time"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by bigNum,time"; int[] ans = {13, 11, 10, 3, 1, 5, 4, 7, 9, 8, 2, 12, 0, 6, 14}; testNormalOrderBy(sql, ans); } @Test public void orderByTest3() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by floatNum"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by floatNum"; int[] ans = {2, 3, 11, 13, 10, 8, 7, 9, 0, 12, 6, 14, 1, 5, 4}; testNormalOrderBy(sql, ans); } @Test public void orderByTest4() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by str"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by str"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; testNormalOrderBy(sql, ans); } @Test public void orderByTest5() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by num desc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by num desc"; int[] ans = {2, 1, 0, 7, 8, 5, 9, 4, 3, 6, 10, 11, 13, 12, 14}; testNormalOrderBy(sql, Arrays.reverse(ans)); } @@ -236,28 +236,28 @@ public void orderByTest5() { @Test public void orderByTest6() { String sql = - "select num,bigNum,floatNum,str,bool from root.sg.d order by bigNum desc, time asc"; + "select num,bigNum,floatNum,str,bool from root.db.d order by bigNum desc, time asc"; int[] ans = {6, 14, 0, 12, 2, 8, 9, 7, 4, 5, 1, 3, 10, 11, 13}; testNormalOrderBy(sql, ans); } @Test public void orderByTest7() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by floatNum desc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by floatNum desc"; int[] ans = {2, 3, 11, 13, 10, 8, 7, 9, 0, 12, 6, 14, 1, 5, 4}; testNormalOrderBy(sql, Arrays.reverse(ans)); } @Test public void orderByTest8() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by str desc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by str desc"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; testNormalOrderBy(sql, Arrays.reverse(ans)); } @Test public void orderByTest15() { - String sql = "select num+bigNum,floatNum from root.sg.d order by str"; + String sql = "select num+bigNum,floatNum from root.db.d order by str"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -266,7 +266,7 @@ public void orderByTest15() { ResultSetMetaData metaData = resultSet.getMetaData(); checkHeader( metaData, - new String[] {"Time", "root.sg.d.num + root.sg.d.bigNum", "root.sg.d.floatNum"}); + new String[] {"Time", "root.db.d.num + root.db.d.bigNum", "root.db.d.floatNum"}); int i = 0; while (resultSet.next()) { @@ -292,14 +292,14 @@ public void orderByTest15() { // 2. Multi-level order by test @Test public void orderByTest9() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by bool asc, str asc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by bool asc, str asc"; int[] ans = {3, 12, 0, 8, 7, 10, 6, 11, 2, 5, 9, 13, 4, 1, 14}; testNormalOrderBy(sql, ans); } @Test public void orderByTest10() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by bool asc, num desc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by bool asc, num desc"; int[] ans = {12, 11, 10, 6, 3, 8, 7, 0, 14, 13, 4, 9, 5, 1, 2}; testNormalOrderBy(sql, ans); } @@ -307,7 +307,7 @@ public void orderByTest10() { @Test public void orderByTest11() { String sql = - "select num,bigNum,floatNum,str,bool from root.sg.d order by bigNum desc, floatNum desc"; + "select num,bigNum,floatNum,str,bool from root.db.d order by bigNum desc, floatNum desc"; int[] ans = {14, 6, 0, 12, 2, 8, 9, 7, 4, 5, 1, 3, 10, 11, 13}; testNormalOrderBy(sql, ans); } @@ -315,7 +315,7 @@ public void orderByTest11() { @Test public void orderByTest12() { String sql = - "select num,bigNum,floatNum,str,bool from root.sg.d order by str desc, floatNum desc"; + "select num,bigNum,floatNum,str,bool from root.db.d order by str desc, floatNum desc"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; testNormalOrderBy(sql, Arrays.reverse(ans)); } @@ -323,20 +323,20 @@ public void orderByTest12() { @Test public void orderByTest13() { String sql = - "select num,bigNum,floatNum,str,bool from root.sg.d order by num+floatNum desc, floatNum desc"; + "select num,bigNum,floatNum,str,bool from root.db.d order by num+floatNum desc, floatNum desc"; int[] ans = {4, 5, 1, 14, 12, 6, 0, 9, 7, 13, 10, 8, 11, 3, 2}; testNormalOrderBy(sql, ans); } @Test public void orderByTest14() { - String sql = "select num+bigNum from root.sg.d order by num+floatNum desc, floatNum desc"; + String sql = "select num+bigNum from root.db.d order by num+floatNum desc, floatNum desc"; int[] ans = {4, 5, 1, 14, 12, 6, 0, 9, 7, 13, 10, 8, 11, 3, 2}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { ResultSetMetaData metaData = resultSet.getMetaData(); - checkHeader(metaData, new String[] {"Time", "root.sg.d.num + root.sg.d.bigNum"}); + checkHeader(metaData, new String[] {"Time", "root.db.d.num + root.db.d.bigNum"}); int i = 0; while (resultSet.next()) { @@ -359,13 +359,13 @@ public void orderByTest14() { @Test public void orderByTest16() { - String sql = "select num+floatNum from root.sg.d order by floatNum+num desc, floatNum desc"; + String sql = "select num+floatNum from root.db.d order by floatNum+num desc, floatNum desc"; int[] ans = {4, 5, 1, 14, 12, 6, 0, 9, 7, 13, 10, 8, 11, 3, 2}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { ResultSetMetaData metaData = resultSet.getMetaData(); - checkHeader(metaData, new String[] {"Time", "root.sg.d.num + root.sg.d.floatNum"}); + checkHeader(metaData, new String[] {"Time", "root.db.d.num + root.db.d.floatNum"}); int i = 0; while (resultSet.next()) { @@ -390,14 +390,14 @@ public void orderByTest16() { @Test public void orderByTest17() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by str desc, str asc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by str desc, str asc"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; testNormalOrderBy(sql, Arrays.reverse(ans)); } @Test public void orderByTest18() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by str, str"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by str, str"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; testNormalOrderBy(sql, ans); } @@ -405,13 +405,13 @@ public void orderByTest18() { // limit cannot be pushed down in ORDER BY @Test public void orderByTest19() { - String sql = "select num from root.sg.d order by num limit 5"; + String sql = "select num from root.db.d order by num limit 5"; int[] ans = {2, 1, 0, 7, 8}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { ResultSetMetaData metaData = resultSet.getMetaData(); - checkHeader(metaData, new String[] {"Time", "root.sg.d.num"}); + checkHeader(metaData, new String[] {"Time", "root.db.d.num"}); int i = 0; while (resultSet.next()) { String actualTime = resultSet.getString(1); @@ -431,7 +431,7 @@ public void orderByTest19() { // 3. aggregation query @Test public void orderByInAggregationTest() { - String sql = "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc"; + String sql = "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc"; double[][] ans = new double[][] {{15.0}, {13.0}, {13.0}, {11.0}, {6.4}, {4.6}}; long[] times = new long[] {51536000000L, 41536000000L, 41536900000L, 31536100000L, 31536000000L, 0L}; @@ -457,7 +457,7 @@ public void orderByInAggregationTest() { @Test public void orderByInAggregationTest2() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12}, @@ -491,7 +491,7 @@ public void orderByInAggregationTest2() { @Test public void orderByInAggregationTest3() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; double[] ans = new double[] {15.0, 13.0, 13.0, 11.0, 6.4, 4.6}; long[] times = new long[] {51536000000L, 41536900000L, 41536000000L, 31536100000L, 31536000000L, 0L}; @@ -517,7 +517,7 @@ public void orderByInAggregationTest3() { @Test public void orderByInAggregationTest4() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -545,7 +545,7 @@ public void orderByInAggregationTest4() { @Test public void orderByInAggregationTest5() { String sql = - "select min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483646L, 2147483650L, 2147468648L, 2146483648L, 2107483648L, 3147483648L}; long[] times = @@ -573,7 +573,7 @@ public void orderByInAggregationTest5() { @Test public void orderByInAggregationTest6() { String sql = - "select min_value(num)+min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(num)+min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483647L, 2147483654L, 2147468659L, 2146483660L, 2107483661L, 3147483663L}; long[] times = @@ -601,7 +601,7 @@ public void orderByInAggregationTest6() { @Test public void orderByInAggregationTest7() { String sql = - "select avg(num)+min_value(floatNum) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num)+min_value(floatNum) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12, 54.12}, @@ -635,7 +635,7 @@ public void orderByInAggregationTest7() { @Test public void orderByInAggregationTest8() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(floatNum)+avg(num)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(floatNum)+avg(num)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -670,7 +670,7 @@ private void testNormalOrderByAlignByDevice(String sql, int[] ans) { metaData, new String[] {"Time", "Device", "num", "bigNum", "floatNum", "str", "bool"}); int i = 0; int total = 0; - String device = "root.sg.d"; + String device = "root.db.d"; while (resultSet.next()) { String actualTime = resultSet.getString(1); @@ -689,10 +689,10 @@ private void testNormalOrderByAlignByDevice(String sql, int[] ans) { assertEquals(res[ans[i]][4], actualStr); assertEquals(res[ans[i]][5], actualBool); - if (device.equals("root.sg.d")) { - device = "root.sg.d2"; + if (device.equals("root.db.d")) { + device = "root.db.d2"; } else { - device = "root.sg.d"; + device = "root.db.d"; i++; } total++; @@ -711,7 +711,7 @@ public void alignByDeviceOrderByTest1() { String sql = "select num+bigNum from root.** order by num+floatNum desc, floatNum desc align by device"; int[] ans = {4, 5, 1, 14, 12, 6, 0, 9, 7, 13, 10, 8, 11, 3, 2}; - String device = "root.sg.d"; + String device = "root.db.d"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { @@ -725,10 +725,10 @@ public void alignByDeviceOrderByTest1() { assertEquals(res[ans[i]][0], actualTime); assertEquals( Long.parseLong(res[ans[i]][1]) + Long.parseLong(res[ans[i]][2]), actualNum, 0.0001); - if (device.equals("root.sg.d")) { - device = "root.sg.d2"; + if (device.equals("root.db.d")) { + device = "root.db.d2"; } else { - device = "root.sg.d"; + device = "root.db.d"; i++; } } @@ -811,7 +811,7 @@ private void testNormalOrderByMixAlignBy(String sql, int[] ans) { metaData, new String[] {"Time", "Device", "num", "bigNum", "floatNum", "str", "bool"}); int i = 0; int total = 0; - String device = "root.sg.d"; + String device = "root.db.d"; while (resultSet.next()) { String actualTime = resultSet.getString(1); @@ -830,11 +830,11 @@ private void testNormalOrderByMixAlignBy(String sql, int[] ans) { assertEquals(res[ans[i]][4], actualStr); assertEquals(res[ans[i]][5], actualBool); - if (device.equals("root.sg.d2")) { + if (device.equals("root.db.d2")) { i++; - device = "root.sg.d"; + device = "root.db.d"; } else { - device = "root.sg.d2"; + device = "root.db.d2"; } total++; @@ -857,7 +857,7 @@ private void testDeviceViewOrderByMixAlignBy(String sql, int[] ans) { metaData, new String[] {"Time", "Device", "num", "bigNum", "floatNum", "str", "bool"}); int i = 0; int total = 0; - String device = "root.sg.d2"; + String device = "root.db.d2"; while (resultSet.next()) { String actualTime = resultSet.getString(1); @@ -880,10 +880,10 @@ private void testDeviceViewOrderByMixAlignBy(String sql, int[] ans) { total++; if (total == ans.length) { i = 0; - if (device.equals("root.sg.d2")) { - device = "root.sg.d"; + if (device.equals("root.db.d2")) { + device = "root.db.d"; } else { - device = "root.sg.d2"; + device = "root.db.d2"; } } } @@ -905,7 +905,7 @@ private void orderByBigNumAlignByDevice(String sql, int[] ans) { metaData, new String[] {"Time", "Device", "num", "bigNum", "floatNum", "str", "bool"}); int i = 0; int total = 0; - String device = "root.sg.d"; + String device = "root.db.d"; while (resultSet.next()) { String actualTime = resultSet.getString(1); @@ -919,9 +919,9 @@ private void orderByBigNumAlignByDevice(String sql, int[] ans) { if (total < 4) { i = total % 2; if (total < 2) { - device = "root.sg.d2"; + device = "root.db.d2"; } else { - device = "root.sg.d"; + device = "root.db.d"; } } @@ -933,11 +933,11 @@ private void orderByBigNumAlignByDevice(String sql, int[] ans) { assertEquals(res[ans[i]][4], actualStr); assertEquals(res[ans[i]][5], actualBool); - if (device.equals("root.sg.d2")) { - device = "root.sg.d"; + if (device.equals("root.db.d2")) { + device = "root.db.d"; } else { i++; - device = "root.sg.d2"; + device = "root.db.d2"; } total++; @@ -1023,18 +1023,18 @@ public void orderByInAggregationAlignByDeviceTest() { }; String[] device = new String[] { - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d", - "root.sg.d2", - "root.sg.d2", - "root.sg.d", - "root.sg.d2" + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d", + "root.db.d2", + "root.db.d2", + "root.db.d", + "root.db.d2" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -1066,8 +1066,8 @@ public void orderByInAggregationAlignByDeviceTest2() { } private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { - String device = "root.sg.d"; - if (!deviceAsc) device = "root.sg.d2"; + String device = "root.db.d"; + if (!deviceAsc) device = "root.db.d2"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { @@ -1077,8 +1077,8 @@ private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { double actualVal = resultSet.getDouble(2); assertEquals(deviceName, device); assertEquals(Double.parseDouble(value.toString()), actualVal, 1); - if (device.equals("root.sg.d")) device = "root.sg.d2"; - else device = "root.sg.d"; + if (device.equals("root.db.d")) device = "root.db.d2"; + else device = "root.db.d"; i++; } assertEquals(i, 2); @@ -1242,7 +1242,7 @@ private void orderByUDFTest(String sql, int[] ans) { @Test public void orderByUDFTest1() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; int[] ans = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 11, 12, 14}; orderByUDFTest(sql, ans); } @@ -1250,7 +1250,7 @@ public void orderByUDFTest1() { @Test public void orderByUDFTest2() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; int[] ans = {12, 14, 13, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; orderByUDFTest(sql, ans); } @@ -1267,22 +1267,22 @@ private void errorTest(String sql, String error) { @Test public void errorTest1() { errorTest( - "select num from root.sg.d order by avg(bigNum)", + "select num from root.db.d order by avg(bigNum)", "701: Raw data and aggregation hybrid query is not supported."); } @Test public void errorTest2() { errorTest( - "select avg(num) from root.sg.d order by bigNum", + "select avg(num) from root.db.d order by bigNum", "701: Raw data and aggregation hybrid query is not supported."); } @Test public void errorTest3() { errorTest( - "select bigNum,floatNum from root.sg.d order by s1", - "701: root.sg.d.s1 in order by clause doesn't exist."); + "select bigNum,floatNum from root.db.d order by s1", + "701: root.db.d.s1 in order by clause doesn't exist."); } @Test @@ -1302,15 +1302,15 @@ public void errorTest5() { @Test public void errorTest6() { errorTest( - "select bigNum,floatNum from root.** order by root.sg.d.bigNum align by device", + "select bigNum,floatNum from root.** order by root.db.d.bigNum align by device", "701: ALIGN BY DEVICE: the suffix paths can only be measurement or one-level wildcard"); } @Test public void errorTest7() { errorTest( - "select last bigNum,floatNum from root.** order by root.sg.d.bigNum", - "701: root.sg.d.bigNum in order by clause doesn't exist in the result of last query."); + "select last bigNum,floatNum from root.** order by root.db.d.bigNum", + "701: root.db.d.bigNum in order by clause doesn't exist in the result of last query."); } // last query @@ -1345,7 +1345,7 @@ public void lastQueryOrderBy() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d.num", "root.sg.d2.num", "root.sg.d.bigNum", "root.sg.d2.bigNum"}, + {"root.db.d.num", "root.db.d2.num", "root.db.d.bigNum", "root.db.d2.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1358,7 +1358,7 @@ public void lastQueryOrderBy2() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1371,7 +1371,7 @@ public void lastQueryOrderBy3() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1384,7 +1384,7 @@ public void lastQueryOrderBy4() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1397,7 +1397,7 @@ public void lastQueryOrderBy5() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBAliasIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBAliasIT.java index 0ddb6ea2f24c0..b34306fb2ff39 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBAliasIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBAliasIT.java @@ -50,40 +50,40 @@ public class IoTDBAliasIT { private static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1(speed) WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d1.s2(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.s1(speed) WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.s2(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.s3(power) WITH DATATYPE=FLOAT, ENCODING=RLE", - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(100, 10.1, 20.7)", - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(200, 15.2, 22.9)", - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(300, 30.3, 25.1)", - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(400, 50.4, 28.3)", - "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(100, 11.1, 20.2, 80.0)", - "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(200, 20.2, 21.8, 81.0)", - "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(300, 45.3, 23.4, 82.0)", - "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(400, 73.4, 26.3, 83.0)", - "CREATE DATABASE root.sg1", - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (0, -1, 1)", - "INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (1, -2, 2)", - "INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (2, -3, 3)", - "CREATE DATABASE root.sg2", - "CREATE TIMESERIES root.sg2.d1.s1 WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg2.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg2.d2.s1 WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg2.d2.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg2.d2.s3 WITH DATATYPE=FLOAT, ENCODING=RLE", - "INSERT INTO root.sg2.d1(timestamp,s1,s2) values(100, 10.1, 20.7)", - "INSERT INTO root.sg2.d1(timestamp,s1,s2) values(200, 15.2, 22.9)", - "INSERT INTO root.sg2.d1(timestamp,s1,s2) values(300, 30.3, 25.1)", - "INSERT INTO root.sg2.d1(timestamp,s1,s2) values(400, 50.4, 28.3)", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(100, 11.1, 20.2, 80.0)", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(200, 20.2, 21.8, 81.0)", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(300, 45.3, 23.4, 82.0)", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(400, 73.4, 26.3, 83.0)" + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1(speed) WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db.d1.s2(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.s1(speed) WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.s2(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.s3(power) WITH DATATYPE=FLOAT, ENCODING=RLE", + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(100, 10.1, 20.7)", + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(200, 15.2, 22.9)", + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(300, 30.3, 25.1)", + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(400, 50.4, 28.3)", + "INSERT INTO root.db.d2(timestamp,speed,temperature,power) values(100, 11.1, 20.2, 80.0)", + "INSERT INTO root.db.d2(timestamp,speed,temperature,power) values(200, 20.2, 21.8, 81.0)", + "INSERT INTO root.db.d2(timestamp,speed,temperature,power) values(300, 45.3, 23.4, 82.0)", + "INSERT INTO root.db.d2(timestamp,speed,temperature,power) values(400, 73.4, 26.3, 83.0)", + "CREATE DATABASE root.db1", + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db1.d1(timestamp, s1, s2) VALUES (0, -1, 1)", + "INSERT INTO root.db1.d1(timestamp, s1, s2) VALUES (1, -2, 2)", + "INSERT INTO root.db1.d1(timestamp, s1, s2) VALUES (2, -3, 3)", + "CREATE DATABASE root.db2", + "CREATE TIMESERIES root.db2.d1.s1 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db2.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db2.d2.s1 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db2.d2.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db2.d2.s3 WITH DATATYPE=FLOAT, ENCODING=RLE", + "INSERT INTO root.db2.d1(timestamp,s1,s2) values(100, 10.1, 20.7)", + "INSERT INTO root.db2.d1(timestamp,s1,s2) values(200, 15.2, 22.9)", + "INSERT INTO root.db2.d1(timestamp,s1,s2) values(300, 30.3, 25.1)", + "INSERT INTO root.db2.d1(timestamp,s1,s2) values(400, 50.4, 28.3)", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(100, 11.1, 20.2, 80.0)", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(200, 20.2, 21.8, 81.0)", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(300, 45.3, 23.4, 82.0)", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(400, 73.4, 26.3, 83.0)" }; private static final String LAST_QUERY_HEADER = "Time,timeseries,value,dataType,"; @@ -103,32 +103,32 @@ public static void tearDown() throws Exception { @Test public void rawDataQueryAliasTest() { - String expectedHeader = "Time,root.sg.d1.speed,root.sg.d1.temperature,"; + String expectedHeader = "Time,root.db.d1.speed,root.db.d1.temperature,"; String[] retArray = new String[] {"100,10.1,20.7,", "200,15.2,22.9,", "300,30.3,25.1,", "400,50.4,28.3,"}; - resultSetEqualTest("select speed, temperature from root.sg.d1", expectedHeader, retArray); + resultSetEqualTest("select speed, temperature from root.db.d1", expectedHeader, retArray); } @Test public void rawDataQueryWithDuplicatedColumnsAliasTest() { - String expectedHeader = "Time,root.sg.d1.speed,root.sg.d1.speed,root.sg.d1.s2,"; + String expectedHeader = "Time,root.db.d1.speed,root.db.d1.speed,root.db.d1.s2,"; String[] retArray = new String[] { "100,10.1,10.1,20.7,", "200,15.2,15.2,22.9,", "300,30.3,30.3,25.1,", "400,50.4,50.4,28.3," }; - resultSetEqualTest("select speed, speed, s2 from root.sg.d1", expectedHeader, retArray); + resultSetEqualTest("select speed, speed, s2 from root.db.d1", expectedHeader, retArray); } @Test @Ignore // TODO: remove @Ignore after support alias in last query public void lastQueryAliasTest() { String[] retArray = - new String[] {"400,root.sg.d1.speed,50.4", "400,root.sg.d1.temperature,28.3"}; + new String[] {"400,root.db.d1.speed,50.4", "400,root.db.d1.temperature,28.3"}; resultSetEqualTest( - "select last speed, temperature from root.sg.d1", LAST_QUERY_HEADER, retArray); + "select last speed, temperature from root.db.d1", LAST_QUERY_HEADER, retArray); } @Test @@ -136,22 +136,22 @@ public void lastQueryAliasTest() { public void lastQueryWithDuplicatedColumnsAliasTest() { String[] retArray = new String[] { - "400,root.sg.d1.speed,50.4", "400,root.sg.d1.s1,50.4", "400,root.sg.d1.s2,28.3" + "400,root.db.d1.speed,50.4", "400,root.db.d1.s1,50.4", "400,root.db.d1.s2,28.3" }; resultSetEqualTest( - "select last speed, s1, speed, s2 from root.sg.d1", LAST_QUERY_HEADER, retArray); + "select last speed, s1, speed, s2 from root.db.d1", LAST_QUERY_HEADER, retArray); } @Test public void aggregationQueryAliasTest() { String expectedHeader = - "count(root.sg.d1.speed),count(root.sg.d2.speed),max_value(root.sg.d1.temperature)," - + "max_value(root.sg.d2.temperature),"; + "count(root.db.d1.speed),count(root.db.d2.speed),max_value(root.db.d1.temperature)," + + "max_value(root.db.d2.temperature),"; String[] retArray = new String[] {"4,4,28.3,26.3,"}; resultSetEqualTest( - "select count(speed), max_value(temperature) from root.sg.*", expectedHeader, retArray); + "select count(speed), max_value(temperature) from root.db.*", expectedHeader, retArray); } @Test @@ -160,10 +160,10 @@ public void alterAliasTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("ALTER timeseries root.sg.d2.s3 UPSERT ALIAS='powerNew'"); + statement.execute("ALTER timeseries root.db.d2.s3 UPSERT ALIAS='powerNew'"); - try (ResultSet resultSet = statement.executeQuery("select powerNew from root.sg.d2")) { - assertResultSetEqual(resultSet, "Time,root.sg.d2.powerNew,", retArray); + try (ResultSet resultSet = statement.executeQuery("select powerNew from root.db.d2")) { + assertResultSetEqual(resultSet, "Time,root.db.d2.powerNew,", retArray); } } catch (SQLException e) { fail(e.getMessage()); @@ -178,8 +178,8 @@ public void rawDataQueryAsTest1() { String expectedHeader = "Time,power,"; String[] retArray = new String[] {"100,80.0,", "200,81.0,", "300,82.0,", "400,83.0,"}; - // root.sg.*.s3 matches root.sg.d2.s3 exactly - resultSetEqualTest("select s3 as power from root.sg2.*", expectedHeader, retArray); + // root.db.*.s3 matches root.db.d2.s3 exactly + resultSetEqualTest("select s3 as power from root.db2.*", expectedHeader, retArray); } @Test @@ -189,22 +189,22 @@ public void rawDataQueryAsTest2() { new String[] {"100,10.1,20.7,", "200,15.2,22.9,", "300,30.3,25.1,", "400,50.4,28.3,"}; resultSetEqualTest( - "select s1 as speed, s2 as temperature from root.sg2.d1", expectedHeader, retArray); + "select s1 as speed, s2 as temperature from root.db2.d1", expectedHeader, retArray); } @Test public void rawDataQueryAsTest3() { - String expectedHeader = "Time,speed,root.sg2.d1.s2,"; + String expectedHeader = "Time,speed,root.db2.d1.s2,"; String[] retArray = new String[] {"100,10.1,20.7,", "200,15.2,22.9,", "300,30.3,25.1,", "400,50.4,28.3,"}; - resultSetEqualTest("select s1 as speed, s2 from root.sg2.d1", expectedHeader, retArray); + resultSetEqualTest("select s1 as speed, s2 from root.db2.d1", expectedHeader, retArray); } @Test public void rawDataQueryAsFailTest() { assertTestFail( - "select s1 as speed from root.sg2.*", + "select s1 as speed from root.db2.*", "alias 'speed' can only be matched with one time series"); } @@ -217,16 +217,16 @@ public void aggregationQueryAsTest() { }; resultSetEqualTest( - "select count(s1) as s1_num, max_value(s2) as s2_max from root.sg2.d1", + "select count(s1) as s1_num, max_value(s2) as s2_max from root.db2.d1", expectedHeader, retArray); } @Test public void aggregationQueryAsFailTest() { - // root.sg2.*.s1 matches root.sg2.d1.s1 and root.sg2.d2.s1 both + // root.db2.*.s1 matches root.db2.d1.s1 and root.db2.d2.s1 both assertTestFail( - "select count(s1) as s1_num from root.sg2.*", + "select count(s1) as s1_num from root.db2.*", "alias 's1_num' can only be matched with one time series"); } @@ -239,7 +239,7 @@ public void groupByQueryAsTest() { }; resultSetEqualTest( - "select count(s1) as 's1_num' from root.sg2.d1 group by ([100,500), 80ms)", + "select count(s1) as 's1_num' from root.db2.d1 group by ([100,500), 80ms)", expectedHeader, retArray); } @@ -249,14 +249,14 @@ public void alignByDeviceQueryAsTest1() { String expectedHeader = "Time,Device,speed,temperature,"; String[] retArray = new String[] { - "100,root.sg2.d1,10.1,20.7,", - "200,root.sg2.d1,15.2,22.9,", - "300,root.sg2.d1,30.3,25.1,", - "400,root.sg2.d1,50.4,28.3," + "100,root.db2.d1,10.1,20.7,", + "200,root.db2.d1,15.2,22.9,", + "300,root.db2.d1,30.3,25.1,", + "400,root.db2.d1,50.4,28.3," }; resultSetEqualTest( - "select s1 as speed, s2 as temperature from root.sg2.d1 align by device", + "select s1 as speed, s2 as temperature from root.db2.d1 align by device", expectedHeader, retArray); } @@ -266,18 +266,18 @@ public void alignByDeviceQueryAsTest2() { String expectedHeader = "Time,Device,speed,s2,"; String[] retArray = new String[] { - "100,root.sg2.d1,10.1,20.7,", - "200,root.sg2.d1,15.2,22.9,", - "300,root.sg2.d1,30.3,25.1,", - "400,root.sg2.d1,50.4,28.3,", - "100,root.sg2.d2,11.1,20.2,", - "200,root.sg2.d2,20.2,21.8,", - "300,root.sg2.d2,45.3,23.4,", - "400,root.sg2.d2,73.4,26.3," + "100,root.db2.d1,10.1,20.7,", + "200,root.db2.d1,15.2,22.9,", + "300,root.db2.d1,30.3,25.1,", + "400,root.db2.d1,50.4,28.3,", + "100,root.db2.d2,11.1,20.2,", + "200,root.db2.d2,20.2,21.8,", + "300,root.db2.d2,45.3,23.4,", + "400,root.db2.d2,73.4,26.3," }; resultSetEqualTest( - "select s1 as speed, s2 from root.sg2.* align by device", expectedHeader, retArray); + "select s1 as speed, s2 from root.db2.* align by device", expectedHeader, retArray); } @Test @@ -286,41 +286,41 @@ public void alignByDeviceQueryAsTest3() { String expectedHeader = "Time,Device,speed,s1,"; String[] retArray = new String[] { - "100,root.sg2.d1,10.1,10.1,", - "200,root.sg2.d1,15.2,15.2,", - "300,root.sg2.d1,30.3,30.3,", - "400,root.sg2.d1,50.4,50.4," + "100,root.db2.d1,10.1,10.1,", + "200,root.db2.d1,15.2,15.2,", + "300,root.db2.d1,30.3,30.3,", + "400,root.db2.d1,50.4,50.4," }; resultSetEqualTest( - "select s1 as speed, s1 from root.sg2.d1 align by device", expectedHeader, retArray); + "select s1 as speed, s1 from root.db2.d1 align by device", expectedHeader, retArray); } @Test public void alignByDeviceQueryAsTest4() { String expectedHeader = "Device,s1_num,count(s2),s3_num,"; - String[] retArray = new String[] {"root.sg2.d2,4,4,4,"}; + String[] retArray = new String[] {"root.db2.d2,4,4,4,"}; resultSetEqualTest( - "select count(s1) as s1_num, count(s2), count(s3) as s3_num from root.sg2.d2 align by device", + "select count(s1) as s1_num, count(s2), count(s3) as s3_num from root.db2.d2 align by device", expectedHeader, retArray); } @Test public void alignByDeviceQueryAsFailTest() { - // root.sg.*.s1 matches root.sg.d1.s1 and root.sg.d2.s1 both + // root.db.*.s1 matches root.db.d1.s1 and root.db.d2.s1 both assertTestFail( - "select * as speed from root.sg2.d1 align by device", + "select * as speed from root.db2.d1 align by device", "can only be matched with one time series"); } @Test @Ignore // TODO: remove @Ignore after support alias in last query public void lastQueryAsTest() { - String[] retArray = new String[] {"400,speed,50.4,FLOAT,", "400,root.sg2.d1.s2,28.3,FLOAT,"}; + String[] retArray = new String[] {"400,speed,50.4,FLOAT,", "400,root.db2.d1.s2,28.3,FLOAT,"}; - resultSetEqualTest("select last s1 as speed, s2 from root.sg2.d1", LAST_QUERY_HEADER, retArray); + resultSetEqualTest("select last s1 as speed, s2 from root.db2.d1", LAST_QUERY_HEADER, retArray); } @Test @@ -328,11 +328,11 @@ public void lastQueryAsTest() { public void lastQueryAsTest2() { String[] retArray = new String[] { - "400,speed,50.4,FLOAT,", "400,root.sg2.d1.s1,50.4,FLOAT,", "400,temperature,28.3,FLOAT," + "400,speed,50.4,FLOAT,", "400,root.db2.d1.s1,50.4,FLOAT,", "400,temperature,28.3,FLOAT," }; resultSetEqualTest( - "select last s1 as speed, s1, s2 as temperature from root.sg2.d1", + "select last s1 as speed, s1, s2 as temperature from root.db2.d1", LAST_QUERY_HEADER, retArray); } @@ -340,9 +340,9 @@ public void lastQueryAsTest2() { @Test @Ignore // TODO: remove @Ignore after support alias in last query public void lastQueryAsFailTest() { - // root.sg2.*.s1 matches root.sg2.d1.s1 and root.sg2.d2.s1 both + // root.db2.*.s1 matches root.db2.d1.s1 and root.db2.d2.s1 both assertTestFail( - "select last s1 as speed from root.sg2.*", + "select last s1 as speed from root.db2.*", "alias 'speed' can only be matched with one time series"); } @@ -350,16 +350,16 @@ public void lastQueryAsFailTest() { public void UDFQueryAsTest() { List sqls = Arrays.asList( - "select -s1, sin(cos(tan(s1))) as a, cos(s2), top_k(s1 + s1, 'k'='1') as b from root.sg1.d1 WHERE time >= 1509466140000", - "select -s1, sin(cos(tan(s1))) as a, cos(s2), top_k(s1 + s1, 'k'='1') as b from root.sg1.d1", - "select -s1, -s1, sin(cos(tan(s1))) as a, sin(cos(tan(s1))), cos(s2), top_k(s1 + s1, 'k'='1') as b, cos(s2) from root.sg1.d1", - "select s1, s2, sin(s1+s2) as a from root.sg1.d1"); + "select -s1, sin(cos(tan(s1))) as a, cos(s2), top_k(s1 + s1, 'k'='1') as b from root.db1.d1 WHERE time >= 1509466140000", + "select -s1, sin(cos(tan(s1))) as a, cos(s2), top_k(s1 + s1, 'k'='1') as b from root.db1.d1", + "select -s1, -s1, sin(cos(tan(s1))) as a, sin(cos(tan(s1))), cos(s2), top_k(s1 + s1, 'k'='1') as b, cos(s2) from root.db1.d1", + "select s1, s2, sin(s1+s2) as a from root.db1.d1"); List expectHeaders = Arrays.asList( - "Time,-root.sg1.d1.s1,a,cos(root.sg1.d1.s2),b,", - "Time,-root.sg1.d1.s1,a,cos(root.sg1.d1.s2),b,", - "Time,-root.sg1.d1.s1,-root.sg1.d1.s1,a,sin(cos(tan(root.sg1.d1.s1))),cos(root.sg1.d1.s2),b,cos(root.sg1.d1.s2),", - "Time,root.sg1.d1.s1,root.sg1.d1.s2,a,"); + "Time,-root.db1.d1.s1,a,cos(root.db1.d1.s2),b,", + "Time,-root.db1.d1.s1,a,cos(root.db1.d1.s2),b,", + "Time,-root.db1.d1.s1,-root.db1.d1.s1,a,sin(cos(tan(root.db1.d1.s1))),cos(root.db1.d1.s2),b,cos(root.db1.d1.s2),", + "Time,root.db1.d1.s1,root.db1.d1.s2,a,"); List retArrays = Arrays.asList( new String[] {}, @@ -387,24 +387,24 @@ public void UDFQueryAsTest() { @Test public void aggregationFuncNameTest() { String expectedHeader = - "count(root.sg.d1.temperature),count(root.sg.d2.temperature)," - + "COUNT(root.sg.d1.s2),COUNT(root.sg.d2.s2)," - + "CoUnT(root.sg.d1.temperature),CoUnT(root.sg.d2.temperature),"; + "count(root.db.d1.temperature),count(root.db.d2.temperature)," + + "COUNT(root.db.d1.s2),COUNT(root.db.d2.s2)," + + "CoUnT(root.db.d1.temperature),CoUnT(root.db.d2.temperature),"; String[] retArray = new String[] {"4,4,4,4,4,4,"}; resultSetEqualTest( - "select count(temperature),COUNT(s2),CoUnT(temperature) from root.sg.*", + "select count(temperature),COUNT(s2),CoUnT(temperature) from root.db.*", expectedHeader, retArray); } @Test public void groupByLevelFuncNameTest() { - String expectedHeader = "count(root.sg.*.s2),COUNT(root.sg.*.temperature),CoUnT(root.sg.*.s2),"; + String expectedHeader = "count(root.db.*.s2),COUNT(root.db.*.temperature),CoUnT(root.db.*.s2),"; String[] retArray = new String[] {"8,8,8,"}; resultSetEqualTest( - "select count(s2),COUNT(temperature),CoUnT(s2) from root.sg.* group by level = 1", + "select count(s2),COUNT(temperature),CoUnT(s2) from root.db.* group by level = 1", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticDivAndModWithoutDoubleIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticDivAndModWithoutDoubleIT.java index aaeb210428f04..b02d5dfa3d23a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticDivAndModWithoutDoubleIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticDivAndModWithoutDoubleIT.java @@ -40,8 +40,8 @@ public class IoTDBArithmeticDivAndModWithoutDoubleIT { private static final String[] SQLs = new String[] { "CREATE DATABASE root.test", - "CREATE TIMESERIES root.test.sg1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.test.sg1(time,s1) values(1752034015183000006, 10001)", + "CREATE TIMESERIES root.test.db1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.test.db1(time,s1) values(1752034015183000006, 10001)", "flush", }; @@ -61,10 +61,10 @@ public static void tearDown() throws Exception { public void testArithmeticOperations() { String[] expectedHeader = new String[] { - TIMESTAMP_STR, "Time % 10", "Time / 10", "root.test.sg1.s1 % 10", "root.test.sg1.s1 / 10" + TIMESTAMP_STR, "Time % 10", "Time / 10", "root.test.db1.s1 % 10", "root.test.db1.s1 / 10" }; String[] retArray = new String[] {"1752034015183000006,6,175203401518300000,1,1000,"}; resultSetEqualTest( - "select time%10, time/10, s1%10, s1/10 from root.test.sg1", expectedHeader, retArray); + "select time%10, time/10, s1%10, s1/10 from root.test.db1", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticIT.java index 6c54b7f187535..ee3a819ea16d5 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticIT.java @@ -51,19 +51,19 @@ public class IoTDBArithmeticIT { private static final String[] INSERTION_SQLS = { "CREATE DATABASE root.test", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s7 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s8 WITH DATATYPE=INT32, ENCODING=PLAIN", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7) values (1, 1, 1, 1, 1, false, '1', 1)", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s8) values (2, 2, 2, 2, 2, false, '2', 2)", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7) values (3, 3, 3, 3, 3, true, '3', 3)", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s8) values (4, 4, 4, 4, 4, true, '4', 4)", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (5, 5, 5, 5, 5, true, '5', 5, 5)", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s7 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s8 WITH DATATYPE=INT32, ENCODING=PLAIN", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7) values (1, 1, 1, 1, 1, false, '1', 1)", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s8) values (2, 2, 2, 2, 2, false, '2', 2)", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7) values (3, 3, 3, 3, 3, true, '3', 3)", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s8) values (4, 4, 4, 4, 4, true, '4', 4)", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (5, 5, 5, 5, 5, true, '5', 5, 5)", }; @BeforeClass @@ -90,7 +90,7 @@ public void testArithmeticBinary() { expressions.add(leftOperand + operator + rightOperand); } } - String sql = String.format("select %s from root.sg.d1", String.join(",", expressions)); + String sql = String.format("select %s from root.db.d1", String.join(",", expressions)); ResultSet resultSet = statement.executeQuery(sql); @@ -132,7 +132,7 @@ public void testArithmeticUnary() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { String[] expressions = new String[] {"- s1", "- s2", "- s3", "- s4"}; - String sql = String.format("select %s from root.sg.d1", String.join(",", expressions)); + String sql = String.format("select %s from root.db.d1", String.join(",", expressions)); ResultSet resultSet = statement.executeQuery(sql); assertEquals(1 + expressions.length, resultSet.getMetaData().getColumnCount()); @@ -156,7 +156,7 @@ public void testHybridQuery() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { String[] expressions = new String[] {"s1", "s1 + s2", "sin(s1)"}; - String sql = String.format("select %s from root.sg.d1", String.join(",", expressions)); + String sql = String.format("select %s from root.db.d1", String.join(",", expressions)); ResultSet resultSet = statement.executeQuery(sql); assertEquals(1 + expressions.length, resultSet.getMetaData().getColumnCount()); @@ -177,7 +177,7 @@ public void testHybridQuery() { public void testNonAlign() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - ResultSet resultSet = statement.executeQuery("select s7 + s8 from root.sg.d1"); + ResultSet resultSet = statement.executeQuery("select s7 + s8 from root.db.d1"); assertEquals(1 + 1, resultSet.getMetaData().getColumnCount()); assertTrue(resultSet.next()); String curr = null; @@ -188,7 +188,7 @@ public void testNonAlign() { assertEquals(10, Double.parseDouble(resultSet.getString(2)), E); assertFalse(resultSet.next()); - resultSet = statement.executeQuery("select s7 + s8 from root.sg.d1 where time < 5"); + resultSet = statement.executeQuery("select s7 + s8 from root.db.d1 where time < 5"); assertEquals(1 + 1, resultSet.getMetaData().getColumnCount()); curr = null; while (curr == null) { @@ -208,7 +208,7 @@ public void testNonAlign() { public void testWrongTypeBoolean() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.executeQuery("select s1 + s5 from root.sg.d1"); + statement.executeQuery("select s1 + s5 from root.db.d1"); } catch (Exception throwable) { assertTrue(throwable.getMessage().contains("Invalid input expression data type.")); } @@ -218,7 +218,7 @@ public void testWrongTypeBoolean() { public void testWrongTypeText() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.executeQuery("select s1 + s6 from root.sg.d1"); + statement.executeQuery("select s1 + s6 from root.db.d1"); } catch (SQLException throwable) { assertTrue(throwable.getMessage().contains("Invalid input expression data type.")); } @@ -228,7 +228,7 @@ public void testWrongTypeText() { public void testNot() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select not(s5), !s5 from root.sg.d1"); ) { + ResultSet resultSet = statement.executeQuery("select not(s5), !s5 from root.db.d1"); ) { String[] retArray = new String[] {"true", "true", "false", "false", "false"}; int cnt = 0; while (resultSet.next()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java index a88b89e90b5da..ea98a85088d26 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java @@ -45,25 +45,25 @@ public class IoTDBCaseWhenThenIT { private static final String[] SQLs = new String[] { // normal cases - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "INSERT INTO root.sg.d1(timestamp,s1) values(0, 0) ", - "INSERT INTO root.sg.d1(timestamp,s1) values(1000000, 11)", - "INSERT INTO root.sg.d1(timestamp,s1) values(20000000, 22)", - "INSERT INTO root.sg.d1(timestamp,s1) values(210000000, 33)", - "INSERT INTO root.sg.d2(timestamp,s3) values(0, 0) ", - "INSERT INTO root.sg.d2(timestamp,s3) values(1000000, 11)", - "INSERT INTO root.sg.d2(timestamp,s3) values(20000000, 22)", - "INSERT INTO root.sg.d2(timestamp,s3) values(210000000, 33)", - "INSERT INTO root.sg.d2(timestamp,s4) values(0, 44)", - "INSERT INTO root.sg.d2(timestamp,s4) values(1000000, 55)", - "INSERT INTO root.sg.d2(timestamp,s4) values(20000000, 66)", - "INSERT INTO root.sg.d2(timestamp,s4) values(210000000, 77)", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "INSERT INTO root.db.d1(timestamp,s1) values(0, 0) ", + "INSERT INTO root.db.d1(timestamp,s1) values(1000000, 11)", + "INSERT INTO root.db.d1(timestamp,s1) values(20000000, 22)", + "INSERT INTO root.db.d1(timestamp,s1) values(210000000, 33)", + "INSERT INTO root.db.d2(timestamp,s3) values(0, 0) ", + "INSERT INTO root.db.d2(timestamp,s3) values(1000000, 11)", + "INSERT INTO root.db.d2(timestamp,s3) values(20000000, 22)", + "INSERT INTO root.db.d2(timestamp,s3) values(210000000, 33)", + "INSERT INTO root.db.d2(timestamp,s4) values(0, 44)", + "INSERT INTO root.db.d2(timestamp,s4) values(1000000, 55)", + "INSERT INTO root.db.d2(timestamp,s4) values(20000000, 66)", + "INSERT INTO root.db.d2(timestamp,s4) values(210000000, 77)", }; @BeforeClass @@ -72,7 +72,7 @@ public static void setUp() throws Exception { prepareData(SQLs); List moreSQLs = new ArrayList<>(); for (int i = 0; i < 100; i++) { - moreSQLs.add(String.format("INSERT INTO root.sg.d1(timestamp,s2) values(%d, %d)", i, i)); + moreSQLs.add(String.format("INSERT INTO root.db.d1(timestamp,s2) values(%d, %d)", i, i)); } prepareData(moreSQLs); } @@ -87,34 +87,34 @@ public void testKind1Basic() { String[] expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 ELSE 9999 END" + "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 ELSE 9999 END" }; String[] retArray = new String[] {"0,99.0,", "1000000,9999.0,", "20000000,9999.0,", "210000000,999.0,"}; resultSetEqualTest( - "select case when s1=0 then 99 when s1>22 then 999 else 9999 end from root.sg.d1", + "select case when s1=0 then 99 when s1>22 then 999 else 9999 end from root.db.d1", expectedHeader, retArray); // without ELSE clause expectedHeader = new String[] { - TIMESTAMP_STR, "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 END" + TIMESTAMP_STR, "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 END" }; retArray = new String[] {"0,99.0,", "1000000,null,", "20000000,null,", "210000000,999.0,"}; resultSetEqualTest( - "select case when s1=0 then 99 when s1>22 then 999 end from root.sg.d1", + "select case when s1=0 then 99 when s1>22 then 999 end from root.db.d1", expectedHeader, retArray); } @Test public void testKind2Basic() { - String sql = "select case s1 when 0 then 99 when 22 then 999 else 9999 end from root.sg.d1"; + String sql = "select case s1 when 0 then 99 when 22 then 999 else 9999 end from root.db.d1"; String[] expectedHeader = new String[] { "Time", - "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22 THEN 999 ELSE 9999 END", + "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22 THEN 999 ELSE 9999 END", }; String[] retArray = new String[] { @@ -123,10 +123,10 @@ public void testKind2Basic() { resultSetEqualTest(sql, expectedHeader, retArray); // without ELSE clause - sql = "select case s1 when 0 then 99 when 22 then 999 end from root.sg.d1"; + sql = "select case s1 when 0 then 99 when 22 then 999 end from root.db.d1"; expectedHeader = new String[] { - "Time", "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22 THEN 999 END", + "Time", "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22 THEN 999 END", }; retArray = new String[] { @@ -141,10 +141,10 @@ public void testShortCircuitEvaluation() { new String[] {"0,0.0,", "1000000,11.0,", "20000000,22.0,", "210000000,33.0,"}; String[] expectedHeader = new String[] { - "Time", "CASE WHEN 1 = 0 THEN root.sg.d1.s1 / 0 WHEN 1 != 0 THEN root.sg.d1.s1 END", + "Time", "CASE WHEN 1 = 0 THEN root.db.d1.s1 / 0 WHEN 1 != 0 THEN root.db.d1.s1 END", }; resultSetEqualTest( - "select case when 1=0 then s1/0 when 1!=0 then s1 end from root.sg.d1", + "select case when 1=0 then s1/0 when 1!=0 then s1 end from root.db.d1", expectedHeader, retArray); } @@ -152,18 +152,18 @@ public void testShortCircuitEvaluation() { @Test public void testKind1InputTypeRestrict() { // WHEN clause must return BOOLEAN - String sql = "select case when s1+1 then 20 else 22 end from root.sg.d1"; + String sql = "select case when s1+1 then 20 else 22 end from root.db.d1"; String msg = - "701: The expression in the WHEN clause must return BOOLEAN. expression: root.sg.d1.s1 + 1, actual data type: DOUBLE."; + "701: The expression in the WHEN clause must return BOOLEAN. expression: root.db.d1.s1 + 1, actual data type: DOUBLE."; assertTestFail(sql, msg); } @Test public void testKind2InputTypeRestrict() { // the expression in CASE clause must be able to be equated with the expression in WHEN clause - String sql = "select case s1 when \"1\" then 20 else 22 end from root.sg.d1"; + String sql = "select case s1 when \"1\" then 20 else 22 end from root.db.d1"; String msg = - "701: Invalid input expression data type. expression: root.sg.d1.s1, actual data type: INT32, expected data type(s): [TEXT, STRING]."; + "701: Invalid input expression data type. expression: root.db.d1.s1, actual data type: INT32, expected data type(s): [TEXT, STRING]."; assertTestFail(sql, msg); } @@ -173,35 +173,35 @@ public void testKind1OutputTypeRestrict() { String[] expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 <= 0 THEN true WHEN root.sg.d1.s1 = 11 THEN false ELSE true END" + "CASE WHEN root.db.d1.s1 <= 0 THEN true WHEN root.db.d1.s1 = 11 THEN false ELSE true END" }; String[] retArray = new String[] {"0,true,", "1000000,false,", "20000000,true,", "210000000,true,"}; // success resultSetEqualTest( - "select case when s1<=0 then true when s1=11 then false else true end from root.sg.d1", + "select case when s1<=0 then true when s1=11 then false else true end from root.db.d1", expectedHeader, retArray); // fail assertTestFail( - "select case when s1<=0 then true else 22 end from root.sg.d1", + "select case when s1<=0 then true else 22 end from root.db.d1", "701: CASE expression: BOOLEAN and other types cannot exist at the same time"); // TEXT and other types cannot exist at the same time expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 <= 0 THEN \"good\" WHEN root.sg.d1.s1 = 11 THEN \"bad\" ELSE \"okok\" END" + "CASE WHEN root.db.d1.s1 <= 0 THEN \"good\" WHEN root.db.d1.s1 = 11 THEN \"bad\" ELSE \"okok\" END" }; retArray = new String[] {"0,good,", "1000000,bad,", "20000000,okok,", "210000000,okok,"}; // success resultSetEqualTest( - "select case when s1<=0 then \"good\" when s1=11 then \"bad\" else \"okok\" end from root.sg.d1", + "select case when s1<=0 then \"good\" when s1=11 then \"bad\" else \"okok\" end from root.db.d1", expectedHeader, retArray); // fail assertTestFail( - "select case when s1<=0 then \"good\" else 22 end from root.sg.d1", + "select case when s1<=0 then \"good\" else 22 end from root.db.d1", "701: CASE expression: TEXT and other types cannot exist at the same time"); // 4 numerical types(INT LONG FLOAT DOUBLE) can exist at the same time @@ -211,7 +211,7 @@ public void testKind1OutputTypeRestrict() { "0,99.0,", "1000000,99.9,", "20000000,8.589934588E9,", "210000000,999.9999999999," }; resultSetEqualTest( - "select case when s1=0 then 99 when s1=11 then 99.9 when s1=22 then 8589934588 when s1=33 then 999.9999999999 else 10086 end as `result` from root.sg.d1", + "select case when s1=0 then 99 when s1=11 then 99.9 when s1=22 then 8589934588 when s1=33 then 999.9999999999 else 10086 end as `result` from root.db.d1", expectedHeader, retArray); } @@ -222,7 +222,7 @@ public void testKind2OutputTypeRestrict() { String[] expectedHeader = new String[] { "Time", - "CASE WHEN root.sg.d1.s1 = 0 THEN true WHEN root.sg.d1.s1 = 11 THEN false ELSE true END", + "CASE WHEN root.db.d1.s1 = 0 THEN true WHEN root.db.d1.s1 = 11 THEN false ELSE true END", }; String[] retArray = new String[] { @@ -230,29 +230,29 @@ public void testKind2OutputTypeRestrict() { }; // success resultSetEqualTest( - "select case s1 when 0 then true when 11 then false else true end from root.sg.d1", + "select case s1 when 0 then true when 11 then false else true end from root.db.d1", expectedHeader, retArray); // fail assertTestFail( - "select case s1 when 0 then true else 22 end from root.sg.d1", + "select case s1 when 0 then true else 22 end from root.db.d1", "701: CASE expression: BOOLEAN and other types cannot exist at the same time"); // TEXT and other types cannot exist at the same time expectedHeader = new String[] { "Time", - "CASE WHEN root.sg.d1.s1 = 0 THEN \"good\" WHEN root.sg.d1.s1 = 11 THEN \"bad\" ELSE \"okok\" END", + "CASE WHEN root.db.d1.s1 = 0 THEN \"good\" WHEN root.db.d1.s1 = 11 THEN \"bad\" ELSE \"okok\" END", }; retArray = new String[] {"0,good,", "1000000,bad,", "20000000,okok,", "210000000,okok,"}; // success resultSetEqualTest( - "select case s1 when 0 then \"good\" when 11 then \"bad\" else \"okok\" end from root.sg.d1", + "select case s1 when 0 then \"good\" when 11 then \"bad\" else \"okok\" end from root.db.d1", expectedHeader, retArray); // fail assertTestFail( - "select case s1 when 0 then \"good\" else 22 end from root.sg.d1", + "select case s1 when 0 then \"good\" else 22 end from root.db.d1", "701: CASE expression: TEXT and other types cannot exist at the same time"); // 4 numerical types(INT LONG FLOAT DOUBLE) can exist at the same time @@ -262,7 +262,7 @@ public void testKind2OutputTypeRestrict() { "0,99.0,", "1000000,99.9,", "20000000,8.589934588E9,", "210000000,999.9999999999," }; resultSetEqualTest( - "select case s1 when 0 then 99 when 11 then 99.9 when 22 then 8589934588 when 33 then 999.9999999999 else 10086 end as `result` from root.sg.d1", + "select case s1 when 0 then 99 when 11 then 99.9 when 22 then 8589934588 when 33 then 999.9999999999 else 10086 end as `result` from root.db.d1", expectedHeader, retArray); } @@ -277,10 +277,10 @@ public void testKind1LargeNumberBranches() { for (int i = 0; i < 100; i++) { sqlBuilder.append(String.format("when s2=%d then s2*%d ", i, i * 100)); expectedHeaderBuilder.append( - String.format("WHEN root.sg.d1.s2 = %d THEN root.sg.d1.s2 * %d ", i, i * 100)); + String.format("WHEN root.db.d1.s2 = %d THEN root.db.d1.s2 * %d ", i, i * 100)); retList.add(String.format("%d,%d.0,", i, i * i * 100)); } - sqlBuilder.append("end from root.sg.d1"); + sqlBuilder.append("end from root.db.d1"); expectedHeaderBuilder.append("END"); String[] expectedHeader = new String[] {TIMESTAMP_STR, expectedHeaderBuilder.toString()}; resultSetEqualTest(sqlBuilder.toString(), expectedHeader, retList.toArray(new String[] {})); @@ -296,10 +296,10 @@ public void testKind2LargeNumberBranches() { for (int i = 0; i < 100; i++) { sqlBuilder.append(String.format("when %d then s2*%d ", i, i * 100)); expectedHeaderBuilder.append( - String.format("WHEN root.sg.d1.s2 = %d THEN root.sg.d1.s2 * %d ", i, i * 100)); + String.format("WHEN root.db.d1.s2 = %d THEN root.db.d1.s2 * %d ", i, i * 100)); retList.add(String.format("%d,%d.0,", i, i * i * 100)); } - sqlBuilder.append("end from root.sg.d1"); + sqlBuilder.append("end from root.db.d1"); expectedHeaderBuilder.append("END"); String[] expectedHeader = new String[] {TIMESTAMP_STR, expectedHeaderBuilder.toString()}; resultSetEqualTest(sqlBuilder.toString(), expectedHeader, retList.toArray(new String[] {})); @@ -314,11 +314,11 @@ public void testKind1UsedInOtherOperation() { // use in scalar operation // multiply - sql = "select 2 * case when s1=0 then 99 when s1=22.0 then 999 else 9999 end from root.sg.d1"; + sql = "select 2 * case when s1=0 then 99 when s1=22.0 then 999 else 9999 end from root.db.d1"; expectedHeader = new String[] { TIMESTAMP_STR, - "2 * CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22.0 THEN 999 ELSE 9999 END" + "2 * CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22.0 THEN 999 ELSE 9999 END" }; retArray = new String[] {"0,198.0,", "1000000,19998.0,", "20000000,1998.0,", "210000000,19998.0,"}; @@ -330,11 +330,11 @@ public void testKind1UsedInOtherOperation() { + "case when s1=0 then 99 when s1=22.0 then 999 else 9999 end " + "+" + "case when s1=11 then 99 else 9999 end " - + "from root.sg.d1, root.sg.d2"; + + "from root.db.d1, root.db.d2"; expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22.0 THEN 999 ELSE 9999 END + CASE WHEN root.sg.d1.s1 = 11 THEN 99 ELSE 9999 END" + "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22.0 THEN 999 ELSE 9999 END + CASE WHEN root.db.d1.s1 = 11 THEN 99 ELSE 9999 END" }; retArray = new String[] { @@ -344,7 +344,7 @@ public void testKind1UsedInOtherOperation() { // function sql = - "select diff(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select diff(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {TIMESTAMP_STR, "result"}; retArray = new String[] {"0,null,", "1000000,9900.0,", "20000000,0.0,", "210000000,-9000.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); @@ -353,33 +353,33 @@ public void testKind1UsedInOtherOperation() { // avg sql = - "select avg(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select avg(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {"result"}; retArray = new String[] {"5274.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); // max_value sql = - "select max_value(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select max_value(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {"result"}; retArray = new String[] {"9999.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); // avg × max_value resultSetEqualTest( - "select avg(case when s1=0 then 99 when s1>22 then 999 else 9999 end) * max_value(case when s1=0 then 99 when s1>22 then 999 else 9999 end) from root.sg.d1", + "select avg(case when s1=0 then 99 when s1>22 then 999 else 9999 end) * max_value(case when s1=0 then 99 when s1>22 then 999 else 9999 end) from root.db.d1", new String[] { - "avg(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 ELSE 9999 END) * max_value(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 ELSE 9999 END)" + "avg(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 ELSE 9999 END) * max_value(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 ELSE 9999 END)" }, new String[] {"5.2734726E7,"}); // UDF is not allowed - sql = "select change_points(case when s1=0 then 99 end) from root.sg.d1"; + sql = "select change_points(case when s1=0 then 99 end) from root.db.d1"; String msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); - sql = "select change_points(s1) + case when s1=0 then 99 end from root.sg.d1"; + sql = "select change_points(s1) + case when s1=0 then 99 end from root.db.d1"; msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); } @@ -393,11 +393,11 @@ public void testKind2UsedInOtherOperation() { // use in scalar operation // multiply - sql = "select 2 * case s1 when 0 then 99 when 22.0 then 999 else 9999 end from root.sg.d1"; + sql = "select 2 * case s1 when 0 then 99 when 22.0 then 999 else 9999 end from root.db.d1"; expectedHeader = new String[] { "Time", - "2 * CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22.0 THEN 999 ELSE 9999 END", + "2 * CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22.0 THEN 999 ELSE 9999 END", }; retArray = new String[] {"0,198.0,", "1000000,19998.0,", "20000000,1998.0,", "210000000,19998.0,"}; @@ -409,11 +409,11 @@ public void testKind2UsedInOtherOperation() { + "case s1 when 0 then 99 when 22.0 then 999 else 9999 end " + "+" + "case s3 when 11 then 99 else 9999 end " - + "from root.sg.d1, root.sg.d2"; + + "from root.db.d1, root.db.d2"; expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22.0 THEN 999 ELSE 9999 END + CASE WHEN root.sg.d2.s3 = 11 THEN 99 ELSE 9999 END" + "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22.0 THEN 999 ELSE 9999 END + CASE WHEN root.db.d2.s3 = 11 THEN 99 ELSE 9999 END" }; retArray = new String[] { @@ -423,7 +423,7 @@ public void testKind2UsedInOtherOperation() { // function sql = - "select diff(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select diff(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {TIMESTAMP_STR, "result"}; retArray = new String[] { @@ -435,33 +435,33 @@ public void testKind2UsedInOtherOperation() { // avg sql = - "select avg(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select avg(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {"result"}; retArray = new String[] {"5274.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); // max_value sql = - "select max_value(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select max_value(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {"result"}; retArray = new String[] {"9999.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); // avg × max_value resultSetEqualTest( - "select avg(case s1 when 0 then 99 when 22 then 999 else 9999 end) * max_value(case s1 when 0 then 99 when 22 then 999 else 9999 end) from root.sg.d1", + "select avg(case s1 when 0 then 99 when 22 then 999 else 9999 end) * max_value(case s1 when 0 then 99 when 22 then 999 else 9999 end) from root.db.d1", new String[] { - "avg(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22 THEN 999 ELSE 9999 END) * max_value(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22 THEN 999 ELSE 9999 END)" + "avg(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22 THEN 999 ELSE 9999 END) * max_value(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22 THEN 999 ELSE 9999 END)" }, new String[] {"5.2734726E7,"}); // UDF is not allowed - sql = "select change_points(case s1 when 0 then 99 end) from root.sg.d1"; + sql = "select change_points(case s1 when 0 then 99 end) from root.db.d1"; String msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); - sql = "select change_points(s1) + case when s1=0 then 99 end from root.sg.d1"; + sql = "select change_points(s1) + case when s1=0 then 99 end from root.db.d1"; msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); } @@ -469,10 +469,10 @@ public void testKind2UsedInOtherOperation() { @Test public void testKind1UseOtherOperation() { // WHEN-clause use scalar function - String sql = "select case when sin(s1)>=0 then \">0\" else \"<0\" end from root.sg.d1"; + String sql = "select case when sin(s1)>=0 then \">0\" else \"<0\" end from root.db.d1"; String[] expectHeader = new String[] { - TIMESTAMP_STR, "CASE WHEN sin(root.sg.d1.s1) >= 0 THEN \">0\" ELSE \"<0\" END", + TIMESTAMP_STR, "CASE WHEN sin(root.db.d1.s1) >= 0 THEN \">0\" ELSE \"<0\" END", }; String[] retArray = new String[] { @@ -482,7 +482,7 @@ public void testKind1UseOtherOperation() { // THEN-clause and ELSE-clause use scalar function sql = - "select case when s1<=11 then CAST(diff(s1) as TEXT) else CAST(s1-1 as TEXT) end from root.sg.d1 align by device"; + "select case when s1<=11 then CAST(diff(s1) as TEXT) else CAST(s1-1 as TEXT) end from root.db.d1 align by device"; expectHeader = new String[] { TIMESTAMP_STR, @@ -491,15 +491,15 @@ public void testKind1UseOtherOperation() { }; retArray = new String[] { - "0,root.sg.d1,null,", - "1000000,root.sg.d1,11.0,", - "20000000,root.sg.d1,21.0,", - "210000000,root.sg.d1,32.0,", + "0,root.db.d1,null,", + "1000000,root.db.d1,11.0,", + "20000000,root.db.d1,21.0,", + "210000000,root.db.d1,32.0,", }; resultSetEqualTest(sql, expectHeader, retArray); // UDF is not allowed - sql = "select case when s1=0 then change_points(s1) end from root.sg.d1"; + sql = "select case when s1=0 then change_points(s1) end from root.db.d1"; String msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); } @@ -508,11 +508,11 @@ public void testKind1UseOtherOperation() { public void testKind2UseOtherOperation() { // CASE-clause use scalar function String sql = - "select case round(sin(s1)) when 0 then \"=0\" when -1 then \"<0\" else \">0\" end from root.sg.d1"; + "select case round(sin(s1)) when 0 then \"=0\" when -1 then \"<0\" else \">0\" end from root.db.d1"; String[] expectHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN ROUND(sin(root.sg.d1.s1)) = 0 THEN \"=0\" WHEN ROUND(sin(root.sg.d1.s1)) = -1 THEN \"<0\" ELSE \">0\" END", + "CASE WHEN ROUND(sin(root.db.d1.s1)) = 0 THEN \"=0\" WHEN ROUND(sin(root.db.d1.s1)) = -1 THEN \"<0\" ELSE \">0\" END", }; String[] retArray = new String[] { @@ -521,10 +521,10 @@ public void testKind2UseOtherOperation() { resultSetEqualTest(sql, expectHeader, retArray); // WHEN-clause use scalar function - sql = "select case 0 when sin(s1) then \"=0\" else \"!=0\" end from root.sg.d1"; + sql = "select case 0 when sin(s1) then \"=0\" else \"!=0\" end from root.db.d1"; expectHeader = new String[] { - TIMESTAMP_STR, "CASE WHEN 0 = sin(root.sg.d1.s1) THEN \"=0\" ELSE \"!=0\" END", + TIMESTAMP_STR, "CASE WHEN 0 = sin(root.db.d1.s1) THEN \"=0\" ELSE \"!=0\" END", }; retArray = new String[] { @@ -534,7 +534,7 @@ public void testKind2UseOtherOperation() { // THEN-clause and ELSE-clause use scalar function sql = - "select case s1 when 11 then CAST(diff(s1) as TEXT) else CAST(s1-1 as TEXT) end from root.sg.d1 align by device"; + "select case s1 when 11 then CAST(diff(s1) as TEXT) else CAST(s1-1 as TEXT) end from root.db.d1 align by device"; expectHeader = new String[] { "Time", @@ -543,41 +543,41 @@ public void testKind2UseOtherOperation() { }; retArray = new String[] { - "0,root.sg.d1,-1.0,", - "1000000,root.sg.d1,11.0,", - "20000000,root.sg.d1,21.0,", - "210000000,root.sg.d1,32.0,", + "0,root.db.d1,-1.0,", + "1000000,root.db.d1,11.0,", + "20000000,root.db.d1,21.0,", + "210000000,root.db.d1,32.0,", }; resultSetEqualTest(sql, expectHeader, retArray); // UDF is not allowed - sql = "select case s1 when 0 then change_points(s1) end from root.sg.d1"; + sql = "select case s1 when 0 then change_points(s1) end from root.db.d1"; String msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); } @Test public void testKind1Wildcard() { - String sql = "select case when *=* then * else * end from root.sg.d2"; + String sql = "select case when *=* then * else * end from root.db.d2"; String[] expectedHeaders = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", }; String[] retArray = { "0,0.0,0.0,44.0,44.0,0.0,44.0,0.0,44.0,0.0,44.0,0.0,44.0,0.0,0.0,44.0,44.0,", @@ -590,26 +590,26 @@ public void testKind1Wildcard() { @Test public void testKind2Wildcard() { - String sql = "select case * when * then * else * end from root.sg.d2"; + String sql = "select case * when * then * else * end from root.db.d2"; String[] expectedHeaders = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", }; String[] retArray = { "0,0.0,0.0,44.0,44.0,0.0,44.0,0.0,44.0,0.0,44.0,0.0,44.0,0.0,0.0,44.0,44.0,", @@ -624,23 +624,23 @@ public void testKind2Wildcard() { public void testKind1AlignedByDevice() { // from different devices, result should be empty String sql = - "select case when s1<=11 then s3 else s4 end from root.sg.d1, root.sg.d2 align by device"; + "select case when s1<=11 then s3 else s4 end from root.db.d1, root.db.d2 align by device"; String[] expectedHeader = new String[] {TIMESTAMP_STR}; String[] retArray = {}; resultSetEqualTest(sql, expectedHeader, retArray); // from same device - sql = "select case when s3<=11 then s3 else s4 end from root.sg.d1, root.sg.d2 align by device"; + sql = "select case when s3<=11 then s3 else s4 end from root.db.d1, root.db.d2 align by device"; expectedHeader = new String[] { TIMESTAMP_STR, DEVICE, "CASE WHEN s3 <= 11 THEN s3 ELSE s4 END", }; retArray = new String[] { - "0,root.sg.d2,0.0,", - "1000000,root.sg.d2,11.0,", - "20000000,root.sg.d2,66.0,", - "210000000,root.sg.d2,77.0,", + "0,root.db.d2,0.0,", + "1000000,root.db.d2,11.0,", + "20000000,root.db.d2,66.0,", + "210000000,root.db.d2,77.0,", }; resultSetEqualTest(sql, expectedHeader, retArray); @@ -649,7 +649,7 @@ public void testKind1AlignedByDevice() { "select " + "case when s1<=11 then s1 else s1*2 end, " + "case when s3<=11 then s3 else s4 end " - + "from root.sg.d1, root.sg.d2 align by device"; + + "from root.db.d1, root.db.d2 align by device"; expectedHeader = new String[] { TIMESTAMP_STR, @@ -659,14 +659,14 @@ public void testKind1AlignedByDevice() { }; retArray = new String[] { - "0,root.sg.d1,0.0,null,", - "1000000,root.sg.d1,11.0,null,", - "20000000,root.sg.d1,44.0,null,", - "210000000,root.sg.d1,66.0,null,", - "0,root.sg.d2,null,0.0,", - "1000000,root.sg.d2,null,11.0,", - "20000000,root.sg.d2,null,66.0,", - "210000000,root.sg.d2,null,77.0,", + "0,root.db.d1,0.0,null,", + "1000000,root.db.d1,11.0,null,", + "20000000,root.db.d1,44.0,null,", + "210000000,root.db.d1,66.0,null,", + "0,root.db.d2,null,0.0,", + "1000000,root.db.d2,null,11.0,", + "20000000,root.db.d2,null,66.0,", + "210000000,root.db.d2,null,77.0,", }; resultSetEqualTest(sql, expectedHeader, retArray); } @@ -675,23 +675,23 @@ public void testKind1AlignedByDevice() { public void testKind2AlignedByDevice() { // from different devices, result should be empty String sql = - "select case s1 when 11 then s3 else s4 end from root.sg.d1, root.sg.d2 align by device"; + "select case s1 when 11 then s3 else s4 end from root.db.d1, root.db.d2 align by device"; String[] expectedHeader = new String[] {TIMESTAMP_STR}; String[] retArray = {}; resultSetEqualTest(sql, expectedHeader, retArray); // from same device - sql = "select case s3 when 11 then s3 else s4 end from root.sg.d1, root.sg.d2 align by device"; + sql = "select case s3 when 11 then s3 else s4 end from root.db.d1, root.db.d2 align by device"; expectedHeader = new String[] { TIMESTAMP_STR, DEVICE, "CASE WHEN s3 = 11 THEN s3 ELSE s4 END", }; retArray = new String[] { - "0,root.sg.d2,44.0,", - "1000000,root.sg.d2,11.0,", - "20000000,root.sg.d2,66.0,", - "210000000,root.sg.d2,77.0,", + "0,root.db.d2,44.0,", + "1000000,root.db.d2,11.0,", + "20000000,root.db.d2,66.0,", + "210000000,root.db.d2,77.0,", }; resultSetEqualTest(sql, expectedHeader, retArray); @@ -700,7 +700,7 @@ public void testKind2AlignedByDevice() { "select " + "case s1 when 11 then s1 else s1*2 end, " + "case s3 when 11 then s3 else s4 end " - + "from root.sg.d1, root.sg.d2 align by device"; + + "from root.db.d1, root.db.d2 align by device"; expectedHeader = new String[] { TIMESTAMP_STR, @@ -710,14 +710,14 @@ public void testKind2AlignedByDevice() { }; retArray = new String[] { - "0,root.sg.d1,0.0,null,", - "1000000,root.sg.d1,11.0,null,", - "20000000,root.sg.d1,44.0,null,", - "210000000,root.sg.d1,66.0,null,", - "0,root.sg.d2,null,44.0,", - "1000000,root.sg.d2,null,11.0,", - "20000000,root.sg.d2,null,66.0,", - "210000000,root.sg.d2,null,77.0,", + "0,root.db.d1,0.0,null,", + "1000000,root.db.d1,11.0,null,", + "20000000,root.db.d1,44.0,null,", + "210000000,root.db.d1,66.0,null,", + "0,root.db.d2,null,44.0,", + "1000000,root.db.d2,null,11.0,", + "20000000,root.db.d2,null,66.0,", + "210000000,root.db.d2,null,77.0,", }; resultSetEqualTest(sql, expectedHeader, retArray); } @@ -725,12 +725,12 @@ public void testKind2AlignedByDevice() { @Test public void testKind1MultipleTimeseries() { // time stamp is aligned - String sql = "select s1*s1, case when s1<=11 then s3 else s4 end from root.sg.d1, root.sg.d2"; + String sql = "select s1*s1, case when s1<=11 then s3 else s4 end from root.db.d1, root.db.d2"; String[] expectedHeader = new String[] { TIMESTAMP_STR, - "root.sg.d1.s1 * root.sg.d1.s1", - "CASE WHEN root.sg.d1.s1 <= 11 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", + "root.db.d1.s1 * root.db.d1.s1", + "CASE WHEN root.db.d1.s1 <= 11 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", }; String[] retArray = new String[] { @@ -743,12 +743,12 @@ public void testKind1MultipleTimeseries() { "select " + "case when s2%2==1 then s2 else s2/2 end, " + "case when s1<=11 then s3 else s4 end " - + "from root.sg.d1, root.sg.d2 limit 5 offset 98"; + + "from root.db.d1, root.db.d2 limit 5 offset 98"; expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s2 % 2 = 1 THEN root.sg.d1.s2 ELSE root.sg.d1.s2 / 2 END", - "CASE WHEN root.sg.d1.s1 <= 11 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", + "CASE WHEN root.db.d1.s2 % 2 = 1 THEN root.db.d1.s2 ELSE root.db.d1.s2 / 2 END", + "CASE WHEN root.db.d1.s1 <= 11 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", }; retArray = new String[] { @@ -764,12 +764,12 @@ public void testKind1MultipleTimeseries() { @Test public void testKind2MultipleTimeseries() { // time stamp is aligned - String sql = "select s1*s1, case s1 when 11 then s3 else s4 end from root.sg.d1, root.sg.d2"; + String sql = "select s1*s1, case s1 when 11 then s3 else s4 end from root.db.d1, root.db.d2"; String[] expectedHeader = new String[] { TIMESTAMP_STR, - "root.sg.d1.s1 * root.sg.d1.s1", - "CASE WHEN root.sg.d1.s1 = 11 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", + "root.db.d1.s1 * root.db.d1.s1", + "CASE WHEN root.db.d1.s1 = 11 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", }; String[] retArray = new String[] { @@ -782,12 +782,12 @@ public void testKind2MultipleTimeseries() { "select " + "case s2%2 when 1 then s2 else s2/2 end, " + "case s3 when 11 then s3 else s4 end " - + "from root.sg.d1, root.sg.d2 limit 5 offset 98"; + + "from root.db.d1, root.db.d2 limit 5 offset 98"; expectedHeader = new String[] { "Time", - "CASE WHEN root.sg.d1.s2 % 2 = 1 THEN root.sg.d1.s2 ELSE root.sg.d1.s2 / 2 END", - "CASE WHEN root.sg.d2.s3 = 11 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", + "CASE WHEN root.db.d1.s2 % 2 = 1 THEN root.db.d1.s2 ELSE root.db.d1.s2 / 2 END", + "CASE WHEN root.db.d2.s3 = 11 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", }; retArray = new String[] { @@ -803,16 +803,16 @@ public void testKind2MultipleTimeseries() { @Test public void testKind1UseInWhereClause() { String sql = - "select s4 from root.sg.d2 where case when s3=0 then s4>44 when s3=22 then s4>0 when time>200000000 then true end"; + "select s4 from root.db.d2 where case when s3=0 then s4>44 when s3=22 then s4>0 when time>200000000 then true end"; String[] expectedHeader = new String[] { - TIMESTAMP_STR, "root.sg.d2.s4", + TIMESTAMP_STR, "root.db.d2.s4", }; String[] retArray = new String[] {"20000000,66.0,", "210000000,77.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); sql = - "select case when s3=0 then s4>44 when s3=22 then s4>0 when time>200000000 then true end as result from root.sg.d2"; + "select case when s3=0 then s4>44 when s3=22 then s4>0 when time>200000000 then true end as result from root.db.d2"; expectedHeader = new String[] { TIMESTAMP_STR, "result", @@ -826,15 +826,15 @@ public void testKind1UseInWhereClause() { @Test public void testKind2UseInWhereClause() { - String sql = "select s4 from root.sg.d2 where case s3 when 0 then s4>44 when 22 then s4>0 end"; + String sql = "select s4 from root.db.d2 where case s3 when 0 then s4>44 when 22 then s4>0 end"; String[] expectedHeader = new String[] { - TIMESTAMP_STR, "root.sg.d2.s4", + TIMESTAMP_STR, "root.db.d2.s4", }; String[] retArray = new String[] {"20000000,66.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); - sql = "select case s3 when 0 then s4>44 when 22 then s4>0 end as result from root.sg.d2"; + sql = "select case s3 when 0 then s4>44 when 22 then s4>0 end as result from root.db.d2"; expectedHeader = new String[] { TIMESTAMP_STR, "result", @@ -847,10 +847,10 @@ public void testKind2UseInWhereClause() { // CASE time sql = - "select s4 from root.sg.d2 where case time when 0 then false when 20000000 then true when 1000000 then true end"; + "select s4 from root.db.d2 where case time when 0 then false when 20000000 then true when 1000000 then true end"; expectedHeader = new String[] { - TIMESTAMP_STR, "root.sg.d2.s4", + TIMESTAMP_STR, "root.db.d2.s4", }; retArray = new String[] {"1000000,55.0,", "20000000,66.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); @@ -859,11 +859,11 @@ public void testKind2UseInWhereClause() { @Test public void testKind1CaseInCase() { String sql = - "select case when s1=0 || s1=22 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) else \"xxx\" end from root.sg.d1"; + "select case when s1=0 || s1=22 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) else \"xxx\" end from root.db.d1"; String[] expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 = 0 | root.sg.d1.s1 = 22 THEN CAST(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 END AS TEXT) ELSE \"xxx\" END" + "CASE WHEN root.db.d1.s1 = 0 | root.db.d1.s1 = 22 THEN CAST(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 END AS TEXT) ELSE \"xxx\" END" }; String[] retArray = new String[] { @@ -875,11 +875,11 @@ public void testKind1CaseInCase() { @Test public void testKind2CaseInCase() { String sql = - "select case s1 when 0 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) when 22 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) else \"xxx\" end from root.sg.d1"; + "select case s1 when 0 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) when 22 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) else \"xxx\" end from root.db.d1"; String[] expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 = 0 THEN CAST(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 END AS TEXT) WHEN root.sg.d1.s1 = 22 THEN CAST(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 END AS TEXT) ELSE \"xxx\" END" + "CASE WHEN root.db.d1.s1 = 0 THEN CAST(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 END AS TEXT) WHEN root.db.d1.s1 = 22 THEN CAST(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 END AS TEXT) ELSE \"xxx\" END" }; String[] retArray = new String[] { @@ -891,7 +891,7 @@ public void testKind2CaseInCase() { @Test public void testKind1Logic() { String sql = - "select case when s3 >= 0 and s3 < 20 and s4 >= 50 and s4 < 60 then 'just so so~~~' when s3 >= 20 and s3 < 40 and s4 >= 70 and s4 < 80 then 'very well~~~' end as result from root.sg.d2"; + "select case when s3 >= 0 and s3 < 20 and s4 >= 50 and s4 < 60 then 'just so so~~~' when s3 >= 20 and s3 < 40 and s4 >= 70 and s4 < 80 then 'very well~~~' end as result from root.db.d2"; String[] expectedHeader = new String[] {TIMESTAMP_STR, "result"}; String[] retArray = new String[] { @@ -904,11 +904,11 @@ public void testKind1Logic() { public void testMultipleSatisfyCase() { // Test the result when two when clause are satisfied String sql = - "select case when s3 < 20 or s4 > 60 then \"just so so~~~\" when s3 > 20 or s4 < 60 then \"very well~~~\" end from root.sg.d2"; + "select case when s3 < 20 or s4 > 60 then \"just so so~~~\" when s3 > 20 or s4 < 60 then \"very well~~~\" end from root.db.d2"; String[] expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d2.s3 < 20 | root.sg.d2.s4 > 60 THEN \"just so so~~~\" WHEN root.sg.d2.s3 > 20 | root.sg.d2.s4 < 60 THEN \"very well~~~\" END" + "CASE WHEN root.db.d2.s3 < 20 | root.db.d2.s4 > 60 THEN \"just so so~~~\" WHEN root.db.d2.s3 > 20 | root.db.d2.s4 < 60 THEN \"very well~~~\" END" }; String[] retArray = new String[] { @@ -922,7 +922,7 @@ public void testMultipleSatisfyCase() { @Test public void testThenWithBinarySameConstant() { - String sql = "SELECT CASE WHEN true THEN 200 + (s1 - 200) END AS result FROM root.sg.d1"; + String sql = "SELECT CASE WHEN true THEN 200 + (s1 - 200) END AS result FROM root.db.d1"; String[] expectedHeader = new String[] {TIMESTAMP_STR, "result"}; String[] retArray = new String[] {"0,0.0,", "1000000,11.0,", "20000000,22.0,", "210000000,33.0,"}; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBEncryptionValueQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBEncryptionValueQueryIT.java index 45bf938d71f37..e99faac4e8d8c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBEncryptionValueQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBEncryptionValueQueryIT.java @@ -96,29 +96,29 @@ public class IoTDBEncryptionValueQueryIT { "insert into root.ln.wf02.wt02(timestamp,status) values(1509466080000,false)", "insert into root.ln.wf02.wt02(timestamp,status) values(1509466140000,false)", "flush", - "CREATE DATABASE root.sgcc", - "create timeseries root.sgcc.wf03.wt01.status with datatype=BOOLEAN,encoding=PLAIN", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465600000,true)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465660000,true)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465720000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465780000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465840000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465900000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465960000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466020000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466080000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466140000,false)", - "create timeseries root.sgcc.wf03.wt01.temperature with datatype=FLOAT,encoding=RLE", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465600000,25.957603)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465660000,24.359503)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465720000,20.092794)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465780000,20.182663)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465840000,21.125198)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465900000,22.720892)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465960000,20.71)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466020000,21.451046)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466080000,22.57987)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466140000,20.98177)", + "CREATE DATABASE root.dbcc", + "create timeseries root.dbcc.wf03.wt01.status with datatype=BOOLEAN,encoding=PLAIN", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465600000,true)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465660000,true)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465720000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465780000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465840000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465900000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465960000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466020000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466080000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466140000,false)", + "create timeseries root.dbcc.wf03.wt01.temperature with datatype=FLOAT,encoding=RLE", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465600000,25.957603)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465660000,24.359503)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465720000,20.092794)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465780000,20.182663)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465840000,21.125198)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465900000,22.720892)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465960000,20.71)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466020000,21.451046)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466080000,22.57987)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466140000,20.98177)", "flush", }; @@ -167,14 +167,14 @@ public void selectTest() { Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select * from root.ln.**,root.sgcc.** where time>10"); + statement.executeQuery("select * from root.ln.**,root.dbcc.** where time>10"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -226,14 +226,14 @@ public void LimitTest() { ResultSet resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time>10 limit 5 offset 3"); + "select * from root.ln.**,root.dbcc.** where time>10 limit 5 offset 3"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -265,15 +265,15 @@ public void LimitTest() { Assert.assertEquals(10000, statement.getFetchSize()); resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time>10 limit 5 offset 3"); + "select * from root.ln.**,root.dbcc.** where time>10 limit 5 offset 3"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -325,14 +325,14 @@ public void InTest() { Assert.assertEquals(4, statement.getFetchSize()); ResultSet resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); + "select * from root.ln.**,root.dbcc.** where time in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -369,15 +369,15 @@ public void InTest() { }; resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time not in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); + "select * from root.ln.**,root.dbcc.** where time not in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -413,15 +413,15 @@ public void InTest() { resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where root.ln.wf01.wt01.temperature in (20.18, 20.71, 22.58)"); + "select * from root.ln.**,root.dbcc.** where root.ln.wf01.wt01.temperature in (20.18, 20.71, 22.58)"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBInIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBInIT.java index a83db53570d11..1ca8f2223fbfa 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBInIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBInIT.java @@ -53,22 +53,22 @@ public class IoTDBInIT { private static String[] sqls = new String[] { "CREATE DATABASE root.ln", - "CREATE DATABASE root.sg", - "create timeseries root.sg.d1.s1.qrcode with datatype=TEXT,encoding=PLAIN", - "insert into root.sg.d1.s1(timestamp,qrcode) values(1509465600000,'qrcode001')", - "insert into root.sg.d1.s1(timestamp,qrcode) values(1509465660000,'qrcode002')", - "insert into root.sg.d1.s1(timestamp,qrcode) values(1509465720000,'qrcode003')", - "insert into root.sg.d1.s1(timestamp,qrcode) values(1509465780000,'qrcode004')", - "create timeseries root.sg.d1.s2.qrcode with datatype=TEXT,encoding=PLAIN", - "insert into root.sg.d1.s2(timestamp,qrcode) values(1509465720000,'qrcode002')", - "insert into root.sg.d1.s2(timestamp,qrcode) values(1509465780000,'qrcode003')", - "insert into root.sg.d1.s2(timestamp,qrcode) values(1509465840000,'qrcode004')", - "insert into root.sg.d1.s2(timestamp,qrcode) values(1509465900000,'qrcode005')", - "create timeseries root.sg.d2.s1.qrcode with datatype=TEXT,encoding=PLAIN", - "insert into root.sg.d2.s1(timestamp,qrcode) values(1509465780000,'qrcode002')", - "insert into root.sg.d2.s1(timestamp,qrcode) values(1509465840000,'qrcode003')", - "insert into root.sg.d2.s1(timestamp,qrcode) values(1509465900000,'qrcode004')", - "insert into root.sg.d2.s1(timestamp,qrcode) values(1509465960000,'qrcode005')", + "CREATE DATABASE root.db", + "create timeseries root.db.d1.s1.qrcode with datatype=TEXT,encoding=PLAIN", + "insert into root.db.d1.s1(timestamp,qrcode) values(1509465600000,'qrcode001')", + "insert into root.db.d1.s1(timestamp,qrcode) values(1509465660000,'qrcode002')", + "insert into root.db.d1.s1(timestamp,qrcode) values(1509465720000,'qrcode003')", + "insert into root.db.d1.s1(timestamp,qrcode) values(1509465780000,'qrcode004')", + "create timeseries root.db.d1.s2.qrcode with datatype=TEXT,encoding=PLAIN", + "insert into root.db.d1.s2(timestamp,qrcode) values(1509465720000,'qrcode002')", + "insert into root.db.d1.s2(timestamp,qrcode) values(1509465780000,'qrcode003')", + "insert into root.db.d1.s2(timestamp,qrcode) values(1509465840000,'qrcode004')", + "insert into root.db.d1.s2(timestamp,qrcode) values(1509465900000,'qrcode005')", + "create timeseries root.db.d2.s1.qrcode with datatype=TEXT,encoding=PLAIN", + "insert into root.db.d2.s1(timestamp,qrcode) values(1509465780000,'qrcode002')", + "insert into root.db.d2.s1(timestamp,qrcode) values(1509465840000,'qrcode003')", + "insert into root.db.d2.s1(timestamp,qrcode) values(1509465900000,'qrcode004')", + "insert into root.db.d2.s1(timestamp,qrcode) values(1509465960000,'qrcode005')", "create timeseries root.test.s1 with datatype=INT32,encoding=PLAIN", "create timeseries root.test.s2 with datatype=INT64,encoding=PLAIN", "create timeseries root.test.s3 with datatype=FLOAT,encoding=PLAIN", @@ -135,12 +135,12 @@ public void selectWithStarTest1() { try (ResultSet resultSet = statement.executeQuery( - "select qrcode from root.sg.d1.* where qrcode in ('qrcode002', 'qrcode003')")) { + "select qrcode from root.db.d1.* where qrcode in ('qrcode002', 'qrcode003')")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, - "Time,root.sg.d1.s1.qrcode,root.sg.d1.s2.qrcode,", + "Time,root.db.d1.s1.qrcode,root.db.d1.s2.qrcode,", new int[] { Types.TIMESTAMP, Types.VARCHAR, Types.VARCHAR, }); @@ -177,12 +177,12 @@ public void selectWithStarTest2() { try (ResultSet resultSet = statement.executeQuery( - "select qrcode from root.sg.*.* where qrcode in ('qrcode002', 'qrcode003', 'qrcode004')")) { + "select qrcode from root.db.*.* where qrcode in ('qrcode002', 'qrcode003', 'qrcode004')")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, - "Time,root.sg.d1.s1.qrcode,root.sg.d1.s2.qrcode,root.sg.d2.s1.qrcode,", + "Time,root.db.d1.s1.qrcode,root.db.d1.s2.qrcode,root.db.d2.s1.qrcode,", new int[] { Types.TIMESTAMP, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, }); @@ -214,12 +214,12 @@ public void selectWithStarTest2() { public void selectWithAlignByDeviceTest() { String[] retArray = new String[] { - "1509465660000,root.sg.d1.s1,qrcode002,", - "1509465780000,root.sg.d1.s1,qrcode004,", - "1509465720000,root.sg.d1.s2,qrcode002,", - "1509465840000,root.sg.d1.s2,qrcode004,", - "1509465780000,root.sg.d2.s1,qrcode002,", - "1509465900000,root.sg.d2.s1,qrcode004,", + "1509465660000,root.db.d1.s1,qrcode002,", + "1509465780000,root.db.d1.s1,qrcode004,", + "1509465720000,root.db.d1.s2,qrcode002,", + "1509465840000,root.db.d1.s2,qrcode004,", + "1509465780000,root.db.d2.s1,qrcode002,", + "1509465900000,root.db.d2.s1,qrcode004,", }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -227,7 +227,7 @@ public void selectWithAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select qrcode from root.sg.*.* where qrcode in ('qrcode002', 'qrcode004') align by device")) { + "select qrcode from root.db.*.* where qrcode in ('qrcode002', 'qrcode004') align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNoSelectExpressionAfterAnalyzedIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNoSelectExpressionAfterAnalyzedIT.java index 8989d8a450c29..97284c18263ea 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNoSelectExpressionAfterAnalyzedIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNoSelectExpressionAfterAnalyzedIT.java @@ -43,8 +43,8 @@ public class IoTDBNoSelectExpressionAfterAnalyzedIT { private static final String[] SQLs = new String[] { - "insert into root.sg.d1(time,s1) values(1,1)", - "insert into root.sg.d2(time,s1,s2) values(1,1,1)" + "insert into root.db.d1(time,s1) values(1,1)", + "insert into root.db.d2(time,s1,s2) values(1,1,1)" }; @BeforeClass @@ -63,31 +63,31 @@ public void testAlignByDevice() { String[] expectedHeader = new String[] {TIMESTAMP_STR}; String[] retArray = new String[] {}; resultSetEqualTest( - "select s2 from root.sg.d1 where s1>0 align by device", expectedHeader, retArray); + "select s2 from root.db.d1 where s1>0 align by device", expectedHeader, retArray); resultSetEqualTest( - "select count(s2) from root.sg.d1 where s1>0 align by device", expectedHeader, retArray); + "select count(s2) from root.db.d1 where s1>0 align by device", expectedHeader, retArray); // mix test expectedHeader = new String[] {DEVICE, count(s1), count(s2)}; - retArray = new String[] {"root.sg.d1,1,null,", "root.sg.d2,1,1,"}; + retArray = new String[] {"root.db.d1,1,null,", "root.db.d2,1,1,"}; resultSetEqualTest( - "select count(s1), count(s2) from root.sg.* where s1>0 align by device", + "select count(s1), count(s2) from root.db.* where s1>0 align by device", expectedHeader, retArray); expectedHeader = new String[] {TIMESTAMP_STR, DEVICE, s1, s2}; - retArray = new String[] {"1,root.sg.d1,1.0,null,", "1,root.sg.d2,1.0,1.0,"}; + retArray = new String[] {"1,root.db.d1,1.0,null,", "1,root.db.d2,1.0,1.0,"}; resultSetEqualTest( - "select s1, s2 from root.sg.* where s1>0 align by device", expectedHeader, retArray); + "select s1, s2 from root.db.* where s1>0 align by device", expectedHeader, retArray); } @Test public void testAlignByTime() { String[] expectedHeader = new String[] {TIMESTAMP_STR}; String[] retArray = new String[] {}; - resultSetEqualTest("select s2 from root.sg.d1 where s1>0", expectedHeader, retArray); + resultSetEqualTest("select s2 from root.db.d1 where s1>0", expectedHeader, retArray); - resultSetEqualTest("select count(s2) from root.sg.d1 where s1>0", expectedHeader, retArray); + resultSetEqualTest("select count(s2) from root.db.d1 where s1>0", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullOperandIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullOperandIT.java index f292b162155f5..17e2559cdd9c4 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullOperandIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullOperandIT.java @@ -40,14 +40,14 @@ public class IoTDBNullOperandIT { private static final String[] SQLs = new String[] { "CREATE DATABASE root.test", - "CREATE TIMESERIES root.test.sg1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s3 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s4 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s5 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "INSERT INTO root.test.sg1(timestamp,s1,s3,s4) values(1, 1, true, false)", - "INSERT INTO root.test.sg1(timestamp,s1,s3) values(2, 2, true)", - "INSERT INTO root.test.sg1(timestamp,s1,s4) values(3, 3, false)", + "CREATE TIMESERIES root.test.db1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s3 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s4 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s5 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "INSERT INTO root.test.db1(timestamp,s1,s3,s4) values(1, 1, true, false)", + "INSERT INTO root.test.db1(timestamp,s1,s3) values(2, 2, true)", + "INSERT INTO root.test.db1(timestamp,s1,s4) values(3, 3, false)", "flush", }; @@ -73,12 +73,12 @@ public void testArithmeticOperations() { String[] expectedHeader = new String[] { TIMESTAMP_STR, - "root.test.sg1.s1 + root.test.sg1.s2", - "root.test.sg1.s1 - root.test.sg1.s2", - "root.test.sg1.s1 * root.test.sg1.s2", - "root.test.sg1.s1 / root.test.sg1.s2", - "root.test.sg1.s1 % root.test.sg1.s2", - "root.test.sg1.s2 % root.test.sg1.s2", + "root.test.db1.s1 + root.test.db1.s2", + "root.test.db1.s1 - root.test.db1.s2", + "root.test.db1.s1 * root.test.db1.s2", + "root.test.db1.s1 / root.test.db1.s2", + "root.test.db1.s1 % root.test.db1.s2", + "root.test.db1.s2 % root.test.db1.s2", }; String[] retArray = new String[] { @@ -87,7 +87,7 @@ public void testArithmeticOperations() { "3,null,null,null,null,null,null,", }; resultSetEqualTest( - "select s1+s2, s1-s2, s1*s2, s1/s2, s1%s2, s2%s2 from root.test.sg1", + "select s1+s2, s1-s2, s1*s2, s1/s2, s1%s2, s2%s2 from root.test.db1", expectedHeader, retArray); } @@ -101,12 +101,12 @@ public void testCompareOperations() { String[] expectedHeader = new String[] { TIMESTAMP_STR, - "root.test.sg1.s1 = root.test.sg1.s2", - "root.test.sg1.s1 > root.test.sg1.s2", - "root.test.sg1.s1 < root.test.sg1.s2", - "root.test.sg1.s5 LIKE pattern = 'test'", - "root.test.sg1.s2 IN (1,2)", - "root.test.sg1.s2 BETWEEN 1 AND 3", + "root.test.db1.s1 = root.test.db1.s2", + "root.test.db1.s1 > root.test.db1.s2", + "root.test.db1.s1 < root.test.db1.s2", + "root.test.db1.s5 LIKE pattern = 'test'", + "root.test.db1.s2 IN (1,2)", + "root.test.db1.s2 BETWEEN 1 AND 3", }; String[] retArray = new String[] { @@ -115,7 +115,7 @@ public void testCompareOperations() { "3,null,null,null,null,null,null,", }; resultSetEqualTest( - "select s1=s2, s1>s2, s1s2, s10", expectedHeader, retArray); @@ -188,9 +188,9 @@ public void testWhere() { retArray = new String[] { - "1,root.test.sg1,1,true,false,", - "2,root.test.sg1,2,true,null,", - "3,root.test.sg1,3,null,false,", + "1,root.test.db1,1,true,false,", + "2,root.test.db1,2,true,null,", + "3,root.test.db1,3,null,false,", }; expectedHeader = new String[] { @@ -206,7 +206,7 @@ public void testWhere() { public void testHaving() { String[] expectedHeader = new String[] { - TIMESTAMP_STR, "count(root.test.sg1.s1)", "count(root.test.sg1.s2)", + TIMESTAMP_STR, "count(root.test.db1.s1)", "count(root.test.db1.s2)", }; String[] retArray = new String[] {}; resultSetEqualTest( @@ -225,7 +225,7 @@ public void testHaving() { retArray = new String[] { - "1,root.test.sg1,1,0,", "2,root.test.sg1,1,0,", "3,root.test.sg1,1,0,", + "1,root.test.db1,1,0,", "2,root.test.db1,1,0,", "3,root.test.db1,1,0,", }; expectedHeader = new String[] { @@ -242,7 +242,7 @@ public void testSeriesNotExist() { // series in select not exist String[] expectedHeader = new String[] { - TIMESTAMP_STR, "root.test.sg1.s1", "root.test.sg1.s3", "root.test.sg1.s4", + TIMESTAMP_STR, "root.test.db1.s1", "root.test.db1.s3", "root.test.db1.s4", }; String[] retArray = new String[] { @@ -271,7 +271,7 @@ public void testSeriesNotExist() { // series in having not exist expectedHeader = new String[] { - TIMESTAMP_STR, "count(root.test.sg1.s1)", "count(root.test.sg1.s2)", + TIMESTAMP_STR, "count(root.test.db1.s1)", "count(root.test.db1.s2)", }; retArray = new String[] {}; resultSetEqualTest( diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullValueFillIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullValueFillIT.java index 3ca0d6bef6bfc..b2e8198a7cffe 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullValueFillIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullValueFillIT.java @@ -39,7 +39,7 @@ public class IoTDBNullValueFillIT { /** - * [root.sg1.d1 (aligned)] + * [root.db1.d1 (aligned)] * *

Time, s1[INT32], s2[INT64], s3[FLOAT], s4[DOUBLE], s5[BOOLEAN], s6[TEXT]
* 1, null, 1, null, 1.0, null, t1
@@ -52,7 +52,7 @@ public class IoTDBNullValueFillIT { * 8, 8, 8, 8.0, 8.0, true, t8
* 9, 9, null, 9.0, null, true, null * - *

[root.sg1.d2 (non-aligned)] + *

[root.db1.d2 (non-aligned)] * *

Time, s1[INT32], s2[INT64], s3[FLOAT], s4[DOUBLE], s5[BOOLEAN], s6[TEXT]
* 1, 1, null, 1.0, null, true, null
@@ -67,41 +67,41 @@ public class IoTDBNullValueFillIT { */ private static final String[] sqls = new String[] { - "CREATE DATABASE root.sg1", - "create aligned timeseries root.sg1.d1(s1 INT32, s2 INT64, s3 FLOAT, s4 DOUBLE, s5 BOOLEAN, s6 TEXT)", - "insert into root.sg1.d1(time, s2, s4, s6) aligned values(1, 1, 1.0, 't1')", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(2, 2, 2, 2.0, 2.0, true, 't2')", - "insert into root.sg1.d1(time, s1, s3, s5) aligned values(3, 3, 3.0, false)", - "insert into root.sg1.d1(time, s2, s4, s6) aligned values(4, 4, 4.0, 't4')", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(5, 5, 5, 5.0, 5.0, false, 't5')", - "insert into root.sg1.d1(time, s2, s4, s6) aligned values(6, 6, 6.0, 't6')", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(8, 8, 8, 8.0, 8.0, true, 't8')", - "insert into root.sg1.d1(time, s1, s3, s5) aligned values(9, 9, 9.0, true)", - "create timeseries root.sg1.d2.s1 INT32", - "create timeseries root.sg1.d2.s2 INT64", - "create timeseries root.sg1.d2.s3 FLOAT", - "create timeseries root.sg1.d2.s4 DOUBLE", - "create timeseries root.sg1.d2.s5 BOOLEAN", - "create timeseries root.sg1.d2.s6 TEXT", - "insert into root.sg1.d2(time, s1, s3, s5) values(1, 1, 1.0, true)", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5, s6) values(2, 2, 2, 2.0, 2.0, true, 't2')", - "insert into root.sg1.d2(time, s2, s4, s6) values(3, 3, 3.0, 't3')", - "insert into root.sg1.d2(time, s1, s3, s5) values(4, 4, 4.0, false)", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5, s6) values(5, 5, 5, 5.0, 5.0, false, 't5')", - "insert into root.sg1.d2(time, s1, s3, s5) values(6, 6, 6.0, false)", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5, s6) values(8, 8, 8, 8.0, 8.0, true, 't8')", - "insert into root.sg1.d2(time, s2, s4, s6) values(9, 9, 9.0, 't9')" + "CREATE DATABASE root.db1", + "create aligned timeseries root.db1.d1(s1 INT32, s2 INT64, s3 FLOAT, s4 DOUBLE, s5 BOOLEAN, s6 TEXT)", + "insert into root.db1.d1(time, s2, s4, s6) aligned values(1, 1, 1.0, 't1')", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(2, 2, 2, 2.0, 2.0, true, 't2')", + "insert into root.db1.d1(time, s1, s3, s5) aligned values(3, 3, 3.0, false)", + "insert into root.db1.d1(time, s2, s4, s6) aligned values(4, 4, 4.0, 't4')", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(5, 5, 5, 5.0, 5.0, false, 't5')", + "insert into root.db1.d1(time, s2, s4, s6) aligned values(6, 6, 6.0, 't6')", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(8, 8, 8, 8.0, 8.0, true, 't8')", + "insert into root.db1.d1(time, s1, s3, s5) aligned values(9, 9, 9.0, true)", + "create timeseries root.db1.d2.s1 INT32", + "create timeseries root.db1.d2.s2 INT64", + "create timeseries root.db1.d2.s3 FLOAT", + "create timeseries root.db1.d2.s4 DOUBLE", + "create timeseries root.db1.d2.s5 BOOLEAN", + "create timeseries root.db1.d2.s6 TEXT", + "insert into root.db1.d2(time, s1, s3, s5) values(1, 1, 1.0, true)", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5, s6) values(2, 2, 2, 2.0, 2.0, true, 't2')", + "insert into root.db1.d2(time, s2, s4, s6) values(3, 3, 3.0, 't3')", + "insert into root.db1.d2(time, s1, s3, s5) values(4, 4, 4.0, false)", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5, s6) values(5, 5, 5, 5.0, 5.0, false, 't5')", + "insert into root.db1.d2(time, s1, s3, s5) values(6, 6, 6.0, false)", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5, s6) values(8, 8, 8, 8.0, 8.0, true, 't8')", + "insert into root.db1.d2(time, s2, s4, s6) values(9, 9, 9.0, 't9')" }; private final String[] expectedHeader = new String[] { "Time", - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5", - "root.sg1.d1.s6" + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5", + "root.db1.d1.s6" }; private final String[] expectedAlignByDeviceHeader = @@ -132,7 +132,7 @@ public void previousFillTest() { "9,9,8,9.0,8.0,true,t8," }; resultSetEqualTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(previous)", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(previous)", expectedHeader, retArray); } @Test @@ -149,7 +149,7 @@ public void previousDescFillTest() { "1,2,1,2.0,1.0,true,t1," }; resultSetEqualTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(previous) order by time desc", + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(previous) order by time desc", expectedHeader, retArray); } @@ -158,25 +158,25 @@ public void previousDescFillTest() { public void previousFillAlignByDeviceTest() { String[] retArray = new String[] { - "1,root.sg1.d1,null,1,null,1.0,null,t1,", - "2,root.sg1.d1,2,2,2.0,2.0,true,t2,", - "3,root.sg1.d1,3,2,3.0,2.0,false,t2,", - "4,root.sg1.d1,3,4,3.0,4.0,false,t4,", - "5,root.sg1.d1,5,5,5.0,5.0,false,t5,", - "6,root.sg1.d1,5,6,5.0,6.0,false,t6,", - "8,root.sg1.d1,8,8,8.0,8.0,true,t8,", - "9,root.sg1.d1,9,8,9.0,8.0,true,t8,", - "1,root.sg1.d2,1,8,1.0,8.0,true,t8,", - "2,root.sg1.d2,2,2,2.0,2.0,true,t2,", - "3,root.sg1.d2,2,3,2.0,3.0,true,t3,", - "4,root.sg1.d2,4,3,4.0,3.0,false,t3,", - "5,root.sg1.d2,5,5,5.0,5.0,false,t5,", - "6,root.sg1.d2,6,5,6.0,5.0,false,t5,", - "8,root.sg1.d2,8,8,8.0,8.0,true,t8,", - "9,root.sg1.d2,8,9,8.0,9.0,true,t9," + "1,root.db1.d1,null,1,null,1.0,null,t1,", + "2,root.db1.d1,2,2,2.0,2.0,true,t2,", + "3,root.db1.d1,3,2,3.0,2.0,false,t2,", + "4,root.db1.d1,3,4,3.0,4.0,false,t4,", + "5,root.db1.d1,5,5,5.0,5.0,false,t5,", + "6,root.db1.d1,5,6,5.0,6.0,false,t6,", + "8,root.db1.d1,8,8,8.0,8.0,true,t8,", + "9,root.db1.d1,9,8,9.0,8.0,true,t8,", + "1,root.db1.d2,1,8,1.0,8.0,true,t8,", + "2,root.db1.d2,2,2,2.0,2.0,true,t2,", + "3,root.db1.d2,2,3,2.0,3.0,true,t3,", + "4,root.db1.d2,4,3,4.0,3.0,false,t3,", + "5,root.db1.d2,5,5,5.0,5.0,false,t5,", + "6,root.db1.d2,6,5,6.0,5.0,false,t5,", + "8,root.db1.d2,8,8,8.0,8.0,true,t8,", + "9,root.db1.d2,8,9,8.0,9.0,true,t9," }; resultSetEqualTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.* fill(previous) align by device", + "select s1, s2, s3, s4, s5, s6 from root.db1.* fill(previous) align by device", expectedAlignByDeviceHeader, retArray); } @@ -185,25 +185,25 @@ public void previousFillAlignByDeviceTest() { public void previousDescFillAlignByDeviceTest() { String[] retArray = new String[] { - "9,root.sg1.d1,9,null,9.0,null,true,null,", - "8,root.sg1.d1,8,8,8.0,8.0,true,t8,", - "6,root.sg1.d1,8,6,8.0,6.0,true,t6,", - "5,root.sg1.d1,5,5,5.0,5.0,false,t5,", - "4,root.sg1.d1,5,4,5.0,4.0,false,t4,", - "3,root.sg1.d1,3,4,3.0,4.0,false,t4,", - "2,root.sg1.d1,2,2,2.0,2.0,true,t2,", - "1,root.sg1.d1,2,1,2.0,1.0,true,t1,", - "9,root.sg1.d2,2,9,2.0,9.0,true,t9,", - "8,root.sg1.d2,8,8,8.0,8.0,true,t8,", - "6,root.sg1.d2,6,8,6.0,8.0,false,t8,", - "5,root.sg1.d2,5,5,5.0,5.0,false,t5,", - "4,root.sg1.d2,4,5,4.0,5.0,false,t5,", - "3,root.sg1.d2,4,3,4.0,3.0,false,t3,", - "2,root.sg1.d2,2,2,2.0,2.0,true,t2,", - "1,root.sg1.d2,1,2,1.0,2.0,true,t2," + "9,root.db1.d1,9,null,9.0,null,true,null,", + "8,root.db1.d1,8,8,8.0,8.0,true,t8,", + "6,root.db1.d1,8,6,8.0,6.0,true,t6,", + "5,root.db1.d1,5,5,5.0,5.0,false,t5,", + "4,root.db1.d1,5,4,5.0,4.0,false,t4,", + "3,root.db1.d1,3,4,3.0,4.0,false,t4,", + "2,root.db1.d1,2,2,2.0,2.0,true,t2,", + "1,root.db1.d1,2,1,2.0,1.0,true,t1,", + "9,root.db1.d2,2,9,2.0,9.0,true,t9,", + "8,root.db1.d2,8,8,8.0,8.0,true,t8,", + "6,root.db1.d2,6,8,6.0,8.0,false,t8,", + "5,root.db1.d2,5,5,5.0,5.0,false,t5,", + "4,root.db1.d2,4,5,4.0,5.0,false,t5,", + "3,root.db1.d2,4,3,4.0,3.0,false,t3,", + "2,root.db1.d2,2,2,2.0,2.0,true,t2,", + "1,root.db1.d2,1,2,1.0,2.0,true,t2," }; resultSetEqualTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.* fill(previous) order by device,time desc align by device", + "select s1, s2, s3, s4, s5, s6 from root.db1.* fill(previous) order by device,time desc align by device", expectedAlignByDeviceHeader, retArray); } @@ -222,32 +222,32 @@ public void linearFillTest() { "9,9,null,9.0,null,true,null," }; resultSetEqualWithDescOrderTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(linear)", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(linear)", expectedHeader, retArray); } @Test public void linearFillAlignByDeviceTest() { String[] retArray = new String[] { - "1,root.sg1.d1,null,1,null,1.0,null,t1,", - "2,root.sg1.d1,2,2,2.0,2.0,true,t2,", - "3,root.sg1.d1,3,3,3.0,3.0,false,null,", - "4,root.sg1.d1,4,4,4.0,4.0,null,t4,", - "5,root.sg1.d1,5,5,5.0,5.0,false,t5,", - "6,root.sg1.d1,6,6,6.0,6.0,null,t6,", - "8,root.sg1.d1,8,8,8.0,8.0,true,t8,", - "9,root.sg1.d1,9,9,9.0,9.0,true,null,", - "1,root.sg1.d2,1,1,1.0,1.0,true,null,", - "2,root.sg1.d2,2,2,2.0,2.0,true,t2,", - "3,root.sg1.d2,3,3,3.0,3.0,null,t3,", - "4,root.sg1.d2,4,4,4.0,4.0,false,null,", - "5,root.sg1.d2,5,5,5.0,5.0,false,t5,", - "6,root.sg1.d2,6,6,6.0,6.0,false,null,", - "8,root.sg1.d2,8,8,8.0,8.0,true,t8,", - "9,root.sg1.d2,null,9,null,9.0,null,t9," + "1,root.db1.d1,null,1,null,1.0,null,t1,", + "2,root.db1.d1,2,2,2.0,2.0,true,t2,", + "3,root.db1.d1,3,3,3.0,3.0,false,null,", + "4,root.db1.d1,4,4,4.0,4.0,null,t4,", + "5,root.db1.d1,5,5,5.0,5.0,false,t5,", + "6,root.db1.d1,6,6,6.0,6.0,null,t6,", + "8,root.db1.d1,8,8,8.0,8.0,true,t8,", + "9,root.db1.d1,9,9,9.0,9.0,true,null,", + "1,root.db1.d2,1,1,1.0,1.0,true,null,", + "2,root.db1.d2,2,2,2.0,2.0,true,t2,", + "3,root.db1.d2,3,3,3.0,3.0,null,t3,", + "4,root.db1.d2,4,4,4.0,4.0,false,null,", + "5,root.db1.d2,5,5,5.0,5.0,false,t5,", + "6,root.db1.d2,6,6,6.0,6.0,false,null,", + "8,root.db1.d2,8,8,8.0,8.0,true,t8,", + "9,root.db1.d2,null,9,null,9.0,null,t9," }; resultSetEqualTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.* fill(linear) align by device", + "select s1, s2, s3, s4, s5, s6 from root.db1.* fill(linear) align by device", expectedAlignByDeviceHeader, retArray); } @@ -266,7 +266,7 @@ public void intFillTest() { "9,9,1000,9.0,1000.0,true,1000," }; resultSetEqualWithDescOrderTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(1000)", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(1000)", expectedHeader, retArray); } @Test @@ -283,7 +283,7 @@ public void floatFillTest() { "9,9,null,9.0,3.14,true,3.14," }; resultSetEqualWithDescOrderTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(3.14)", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(3.14)", expectedHeader, retArray); } @Test @@ -300,7 +300,7 @@ public void booleanFillTest() { "9,9,null,9.0,null,true,true," }; resultSetEqualWithDescOrderTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(true)", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(true)", expectedHeader, retArray); } @Test @@ -317,6 +317,6 @@ public void textFillTest() { "9,9,null,9.0,null,true,t0," }; resultSetEqualWithDescOrderTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill('t0')", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill('t0')", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryDemoIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryDemoIT.java index 198ea449dcc71..dd4b592abf285 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryDemoIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryDemoIT.java @@ -97,29 +97,29 @@ public class IoTDBQueryDemoIT { "insert into root.ln.wf02.wt02(timestamp,status) values(1509466020000,false)", "insert into root.ln.wf02.wt02(timestamp,status) values(1509466080000,false)", "insert into root.ln.wf02.wt02(timestamp,status) values(1509466140000,false)", - "CREATE DATABASE root.sgcc", - "create timeseries root.sgcc.wf03.wt01.status with datatype=BOOLEAN,encoding=PLAIN", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465600000,true)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465660000,true)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465720000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465780000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465840000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465900000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465960000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466020000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466080000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466140000,false)", - "create timeseries root.sgcc.wf03.wt01.temperature with datatype=FLOAT,encoding=RLE", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465600000,25.957603)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465660000,24.359503)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465720000,20.092794)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465780000,20.182663)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465840000,21.125198)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465900000,22.720892)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465960000,20.71)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466020000,21.451046)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466080000,22.57987)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466140000,20.98177)", + "CREATE DATABASE root.dbcc", + "create timeseries root.dbcc.wf03.wt01.status with datatype=BOOLEAN,encoding=PLAIN", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465600000,true)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465660000,true)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465720000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465780000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465840000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465900000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465960000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466020000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466080000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466140000,false)", + "create timeseries root.dbcc.wf03.wt01.temperature with datatype=FLOAT,encoding=RLE", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465600000,25.957603)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465660000,24.359503)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465720000,20.092794)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465780000,20.182663)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465840000,21.125198)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465900000,22.720892)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465960000,20.71)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466020000,21.451046)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466080000,22.57987)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466140000,20.98177)", }; @BeforeClass @@ -167,14 +167,14 @@ public void selectTest() { Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select * from root.ln.**,root.sgcc.** where time>10"); + statement.executeQuery("select * from root.ln.**,root.dbcc.** where time>10"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -226,14 +226,14 @@ public void LimitTest() { ResultSet resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time>10 limit 5 offset 3"); + "select * from root.ln.**,root.dbcc.** where time>10 limit 5 offset 3"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -265,15 +265,15 @@ public void LimitTest() { Assert.assertEquals(10000, statement.getFetchSize()); resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time>10 limit 5 offset 3"); + "select * from root.ln.**,root.dbcc.** where time>10 limit 5 offset 3"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -325,14 +325,14 @@ public void InTest() { Assert.assertEquals(4, statement.getFetchSize()); ResultSet resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); + "select * from root.ln.**,root.dbcc.** where time in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -369,15 +369,15 @@ public void InTest() { }; resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time not in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); + "select * from root.ln.**,root.dbcc.** where time not in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -413,15 +413,15 @@ public void InTest() { resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where root.ln.wf01.wt01.temperature in (20.18, 20.71, 22.58)"); + "select * from root.ln.**,root.dbcc.** where root.ln.wf01.wt01.temperature in (20.18, 20.71, 22.58)"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryWithComplexValueFilterIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryWithComplexValueFilterIT.java index fa89c6ebc9996..c2b45219c1ed0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryWithComplexValueFilterIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryWithComplexValueFilterIT.java @@ -57,7 +57,7 @@ public void testRawQuery1() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s1 from root.sg1.d1 where (time > 4 and s1 <= 6) or (s2 > 3 and time <= 5)")) { + "select s1 from root.db1.d1 where (time > 4 and s1 <= 6) or (s2 > 3 and time <= 5)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -76,7 +76,7 @@ public void testRawQuery2() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s1 from root.sg1.d1 where (time > 4 and s1 <= 6) and (s2 > 3 and time <= 5)")) { + "select s1 from root.db1.d1 where (time > 4 and s1 <= 6) and (s2 > 3 and time <= 5)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -95,7 +95,7 @@ public void testRawQuery3() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 == '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 == '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -104,7 +104,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 == '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 == '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -113,7 +113,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 == 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 == 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -122,7 +122,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 != '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 != '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -131,7 +131,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 != '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 != '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -140,7 +140,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 != 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 != 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -158,7 +158,7 @@ public void testRawQuery4() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 > '0'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 > '0'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -167,7 +167,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 > '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 > '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -176,7 +176,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 > 0")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 > 0")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -185,7 +185,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 < '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 < '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -194,7 +194,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 < '2024-01-02'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 < '2024-01-02'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -203,7 +203,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 < 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 < 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -212,7 +212,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 >= '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 >= '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -221,7 +221,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 >= '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 >= '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -230,7 +230,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 >= 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 >= 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -239,7 +239,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 <= '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 <= '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -248,7 +248,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 <= '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 <= '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -257,7 +257,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 <= 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 <= 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -275,7 +275,7 @@ public void testRawQuery5() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 == '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 == '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -284,7 +284,7 @@ public void testRawQuery5() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 == '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 == '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -293,7 +293,7 @@ public void testRawQuery5() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 == '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 == '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -302,7 +302,7 @@ public void testRawQuery5() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 == 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 == 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -318,28 +318,28 @@ public void testRawQuery5() { private static void prepareData() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("create database root.sg1"); - statement.execute("create timeseries root.sg1.d1.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("create timeseries root.sg1.d1.s2 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("create timeseries root.sg1.d1.s3 with datatype=STRING,encoding=PLAIN"); - statement.execute("create timeseries root.sg1.d1.s4 with datatype=DATE,encoding=PLAIN"); - statement.execute("create timeseries root.sg1.d1.s5 with datatype=TIMESTAMP,encoding=PLAIN"); + statement.execute("create database root.db1"); + statement.execute("create timeseries root.db1.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("create timeseries root.db1.d1.s2 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("create timeseries root.db1.d1.s3 with datatype=STRING,encoding=PLAIN"); + statement.execute("create timeseries root.db1.d1.s4 with datatype=DATE,encoding=PLAIN"); + statement.execute("create timeseries root.db1.d1.s5 with datatype=TIMESTAMP,encoding=PLAIN"); statement.execute( - "insert into root.sg1.d1(time,s1,s2,s3,s4,s5) values(0,0,0,'0','2024-01-01',0)"); + "insert into root.db1.d1(time,s1,s2,s3,s4,s5) values(0,0,0,'0','2024-01-01',0)"); statement.execute( - "insert into root.sg1.d1(time,s1,s2,s3,s4,s5) values(1,1,1,'1','2024-01-02',1)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(2,2,2)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(3,3,3)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(4,4,4)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(5,5,5)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(6,6,6)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(7,7,7)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(8,8,8)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(9,9,9)"); + "insert into root.db1.d1(time,s1,s2,s3,s4,s5) values(1,1,1,'1','2024-01-02',1)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(2,2,2)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(3,3,3)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(4,4,4)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(5,5,5)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(6,6,6)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(7,7,7)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(8,8,8)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(9,9,9)"); // for (int i = 0; i < 10; i++) { // statement.addBatch( // String.format( - // "insert into root.sg1.d1(time,s1,s2) values(%d,%d,%f)", i, i, (double) i)); + // "insert into root.db1.d1(time,s1,s2) values(%d,%d,%f)", i, i, (double) i)); // } // statement.executeBatch(); } catch (Exception e) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java index 33648973284a5..e2f0b8e035d4c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java @@ -59,8 +59,8 @@ public class IoTDBResultSetIT { "CREATE TIMESERIES root.t1.wf01.wt02.temperature WITH DATATYPE=FLOAT, ENCODING=RLE", "CREATE TIMESERIES root.t1.wf01.wt02.type WITH DATATYPE=INT32, ENCODING=RLE", "CREATE TIMESERIES root.t1.wf01.wt02.grade WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.dev.status WITH DATATYPE=text,ENCODING=PLAIN", - "insert into root.sg.dev(time,status) values(1,3.14)" + "CREATE TIMESERIES root.db.dev.status WITH DATATYPE=text,ENCODING=PLAIN", + "insert into root.db.dev(time,status) values(1,3.14)" }; private static final String[] emptyResultSet = new String[] {}; @@ -119,14 +119,14 @@ public void columnTypeTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select status from root.sg.dev")) { + try (ResultSet resultSet = statement.executeQuery("select status from root.db.dev")) { Assert.assertTrue(resultSet.next()); ResultSetMetaData metaData = resultSet.getMetaData(); assertEquals(2, metaData.getColumnCount()); assertEquals("Time", metaData.getColumnName(1)); assertEquals(Types.TIMESTAMP, metaData.getColumnType(1)); assertEquals("TIMESTAMP", metaData.getColumnTypeName(1)); - assertEquals("root.sg.dev.status", metaData.getColumnName(2)); + assertEquals("root.db.dev.status", metaData.getColumnName(2)); assertEquals(Types.VARCHAR, metaData.getColumnType(2)); assertEquals("TEXT", metaData.getColumnTypeName(2)); } @@ -140,7 +140,7 @@ public void columnTypeTest() { @Test public void emptyQueryTest1() { String expectedHeader = ColumnHeaderConstant.TIME + ","; - resultSetEqualTest("select * from root.sg1.d1", expectedHeader, emptyResultSet); + resultSetEqualTest("select * from root.db1.d1", expectedHeader, emptyResultSet); } @Test @@ -180,7 +180,7 @@ public void emptyShowTimeseriesTest() { + "," + ColumnHeaderConstant.VIEW_TYPE + ","; - resultSetEqualTest("show timeseries root.sg1.**", expectedHeader, emptyResultSet); + resultSetEqualTest("show timeseries root.db1.**", expectedHeader, emptyResultSet); } @Test @@ -194,7 +194,7 @@ public void emptyShowDeviceTest() { + "," + ColumnHeaderConstant.COLUMN_TTL + ","; - resultSetEqualTest("show devices root.sg1.**", expectedHeader, emptyResultSet); + resultSetEqualTest("show devices root.db1.**", expectedHeader, emptyResultSet); } @Test @@ -204,20 +204,20 @@ public void timeWasNullTest() throws Exception { // create timeseries statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s3 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s3 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); for (int i = 0; i < 10; i++) { statement.addBatch( - "insert into root.sg1.d1(timestamp, s1, s2) values(" + i + "," + 1 + "," + 1 + ")"); + "insert into root.db1.d1(timestamp, s1, s2) values(" + i + "," + 1 + "," + 1 + ")"); } - statement.execute("insert into root.sg1.d1(timestamp, s3) values(103, 1)"); - statement.execute("insert into root.sg1.d1(timestamp, s3) values(104, 1)"); - statement.execute("insert into root.sg1.d1(timestamp, s3) values(105, 1)"); + statement.execute("insert into root.db1.d1(timestamp, s3) values(103, 1)"); + statement.execute("insert into root.db1.d1(timestamp, s3) values(104, 1)"); + statement.execute("insert into root.db1.d1(timestamp, s3) values(105, 1)"); statement.executeBatch(); try (ResultSet resultSet = statement.executeQuery("select * from root.**")) { ResultSetMetaData metaData = resultSet.getMetaData(); @@ -247,6 +247,6 @@ public void emptyLastQueryTest() { + "," + ColumnHeaderConstant.DATATYPE + ","; - resultSetEqualTest("select last s1 from root.sg.d1", expectedHeader, emptyResultSet); + resultSetEqualTest("select last s1 from root.db.d1", expectedHeader, emptyResultSet); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectCompareExpressionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectCompareExpressionIT.java index ddddf58725f58..8bdfa0916820d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectCompareExpressionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectCompareExpressionIT.java @@ -85,7 +85,7 @@ private static String generateInsertionSQL( String _text) { return String.format( Locale.CHINA, - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6) values (%d, %d, %d, %f, %f, %s, %s);", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6) values (%d, %d, %d, %f, %f, %s, %s);", time, intValue32, intValue64, @@ -117,13 +117,13 @@ private static void generateData() { private static void createTimeSeries() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s3 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s4 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s5 with datatype=BOOLEAN,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s6 with datatype=TEXT,encoding=PLAIN"); + statement.execute("CREATE DATABASE root.db"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s3 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s4 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s5 with datatype=BOOLEAN,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s6 with datatype=TEXT,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -142,7 +142,7 @@ public void testCompareWithConstant() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select s1>=5, s1<=5, s1>5, s1<5, s1==5, s1!=5 from root.sg.d1"); + statement.executeQuery("select s1>=5, s1<=5, s1>5, s1<5, s1==5, s1!=5 from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 6, columnCount); @@ -175,7 +175,7 @@ public void testCompareWithConstant() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select s2>=5, s2<=5, s2>5, s2<5, s2==5, s2!=5 from root.sg.d1"); + statement.executeQuery("select s2>=5, s2<=5, s2>5, s2<5, s2==5, s2!=5 from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 6, columnCount); @@ -208,7 +208,7 @@ public void testCompareWithConstant() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select s3>=5, s3<=5, s3>5, s3<5, s3==5, s3!=5 from root.sg.d1"); + statement.executeQuery("select s3>=5, s3<=5, s3>5, s3<5, s3==5, s3!=5 from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 6, columnCount); @@ -241,7 +241,7 @@ public void testCompareWithConstant() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select s4>=5, s4<=5, s4>5, s4<5, s4==5, s4!=5 from root.sg.d1"); + statement.executeQuery("select s4>=5, s4<=5, s4>5, s4<5, s4==5, s4!=5 from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 6, columnCount); @@ -274,7 +274,7 @@ public void testCompareWithConstant() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select s5==true, s5!=true, s5==false, s5!=false from root.sg.d1"); + statement.executeQuery("select s5==true, s5!=true, s5==false, s5!=false from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 4, columnCount); @@ -305,7 +305,7 @@ public void testCompareDifferentType() { Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery( - "select s1>=s2, s1<=s2, s1>s3, s1=s2, s1<=s2, s1>s3, s1=s3, s2<=s3, s2>s4, s2=s3, s2<=s3, s2>s4, s2=s4, s3<=s4, s3>s1, s3=s4, s3<=s4, s3>s1, s3=s1, s4<=s1, s4>s2, s4=s1, s4<=s1, s4>s2, s4=1 && s1<3, !(s1 < 2 || s1> 8), !(s2>3) from root.sg.d1"); + "select s1>=1 && s1<3, !(s1 < 2 || s1> 8), !(s2>3) from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 3, columnCount); @@ -472,7 +472,7 @@ public void testComplexExpression() { Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery( - "select ( s1 + 1 ) * 2 - 4 < ( s3 * 3 - 6) / 2 && ( s1 + 5 ) * 2 > s2 * 3 + 4 from root.sg.d1"); + "select ( s1 + 1 ) * 2 - 4 < ( s3 * 3 - 6) / 2 && ( s1 + 5 ) * 2 > s2 * 3 + 4 from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 1, columnCount); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectSchemaIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectSchemaIT.java index 3fdf6f93d1437..c7cb573638cfc 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectSchemaIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectSchemaIT.java @@ -42,15 +42,15 @@ @Category({LocalStandaloneIT.class, ClusterIT.class}) public class IoTDBSelectSchemaIT { private static String INSERTION_SQLS = - "insert into root.sg.d1(time, s1, s2, s3) values (1, 1, 2, 3.0);"; + "insert into root.db.d1(time, s1, s2, s3) values (1, 1, 2, 3.0);"; private static void createTimeSeries() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s3 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE DATABASE root.db"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s3 with datatype=DOUBLE,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -93,24 +93,24 @@ public void testSchemaExpression() { "((s1+1)*2-1)%2+1.5+s2" }; String[] completeExpressions = { - "root.sg.d1.s1+root.sg.d1.s2", - "-root.sg.d1.s1+root.sg.d1.s2", - "-(root.sg.d1.s1+root.sg.d1.s3)", - "!(root.sg.d1.s1>root.sg.d1.s2)", - "-(-root.sg.d1.s1)", - "(root.sg.d1.s1+root.sg.d1.s2)*root.sg.d1.s3", - "-2+root.sg.d1.s1", - "!true|root.sg.d1.s1>0", - "-(-1)+root.sg.d1.s1", - "sin(root.sg.d1.s1)+root.sg.d1.s1", - "((root.sg.d1.s1+1)*2-1)%2+1.5+root.sg.d1.s2", + "root.db.d1.s1+root.db.d1.s2", + "-root.db.d1.s1+root.db.d1.s2", + "-(root.db.d1.s1+root.db.d1.s3)", + "!(root.db.d1.s1>root.db.d1.s2)", + "-(-root.db.d1.s1)", + "(root.db.d1.s1+root.db.d1.s2)*root.db.d1.s3", + "-2+root.db.d1.s1", + "!true|root.db.d1.s1>0", + "-(-1)+root.db.d1.s1", + "sin(root.db.d1.s1)+root.db.d1.s1", + "((root.db.d1.s1+1)*2-1)%2+1.5+root.db.d1.s2", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery( String.format( - "select %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s from root.sg.d1", + "select %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s from root.db.d1", expressions[0], expressions[1], expressions[2], diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java index 7ed80f7ab4ad6..b8bc752a2dfcd 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java @@ -64,16 +64,16 @@ public void tearDown() throws Exception { public void timeseriesNumExceedTest() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=3 on root.sg0"); + adminStmt.execute("set space quota timeseries=3 on root.db0"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); } catch (SQLException | InterruptedException throwables) { Assert.assertEquals( "1700: The number of timeseries has reached the upper limit", throwables.getMessage()); @@ -84,16 +84,16 @@ public void timeseriesNumExceedTest() { public void devicesNumExceedTest() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3 on root.sg0"); + adminStmt.execute("set space quota devices=3 on root.db0"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); adminStmt.execute( - "create timeseries root.sg0.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); } catch (SQLException | InterruptedException throwables) { Assert.assertEquals( "1700: The number of devices has reached the upper limit", throwables.getMessage()); @@ -104,42 +104,42 @@ public void devicesNumExceedTest() { public void setSpaceQuotaTest0() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=3 on root.sg0"); + adminStmt.execute("set space quota timeseries=3 on root.db0"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); - adminStmt.execute("set space quota timeseries=4 on root.sg0"); + adminStmt.execute("set space quota timeseries=4 on root.db0"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); } catch (SQLException | InterruptedException throwables) { Assert.fail(throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3 on root.sg1"); + adminStmt.execute("set space quota devices=3 on root.db1"); adminStmt.execute( - "create timeseries root.sg1.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg1.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg1.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); - adminStmt.execute("set space quota devices=4 on root.sg1"); + adminStmt.execute("set space quota devices=4 on root.db1"); adminStmt.execute( - "create timeseries root.sg1.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); } catch (SQLException | InterruptedException throwables) { Assert.fail(throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk=100M on root.sg2"); - adminStmt.execute("set space quota disk=200M on root.sg2"); + adminStmt.execute("set space quota disk=100M on root.db2"); + adminStmt.execute("set space quota disk=200M on root.db2"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } @@ -149,15 +149,15 @@ public void setSpaceQuotaTest0() { public void setSpaceQuotaTest1() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=3 on root.sg0"); + adminStmt.execute("set space quota timeseries=3 on root.db0"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); - adminStmt.execute("set space quota timeseries=2 on root.sg0"); + adminStmt.execute("set space quota timeseries=2 on root.db0"); } catch (SQLException | InterruptedException throwables) { Assert.assertEquals( "301: The used quota exceeds the preset quota. Please set a larger value.", @@ -166,15 +166,15 @@ public void setSpaceQuotaTest1() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3 on root.sg1"); + adminStmt.execute("set space quota devices=3 on root.db1"); adminStmt.execute( - "create timeseries root.sg1.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg1.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg1.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); - adminStmt.execute("set space quota devices=2 on root.sg1"); + adminStmt.execute("set space quota devices=2 on root.db1"); } catch (SQLException | InterruptedException throwables) { Assert.assertEquals( "301: The used quota exceeds the preset quota. Please set a larger value.", @@ -186,7 +186,7 @@ public void setSpaceQuotaTest1() { public void setSpaceQuotaTest2() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=0 on root.sg0"); + adminStmt.execute("set space quota timeseries=0 on root.db0"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of timeseries greater than 0", throwables.getMessage()); @@ -194,7 +194,7 @@ public void setSpaceQuotaTest2() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=0 on root.sg1"); + adminStmt.execute("set space quota devices=0 on root.db1"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of devices greater than 0", throwables.getMessage()); @@ -202,14 +202,14 @@ public void setSpaceQuotaTest2() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk=0M on root.sg2"); + adminStmt.execute("set space quota disk=0M on root.db2"); } catch (SQLException throwables) { Assert.assertEquals("701: Please set the disk size greater than 0", throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=0,devices=0,disk=0M on root.sg3"); + adminStmt.execute("set space quota timeseries=0,devices=0,disk=0M on root.db3"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of devices greater than 0", throwables.getMessage()); @@ -220,33 +220,33 @@ public void setSpaceQuotaTest2() { public void setSpaceQuotaTest3() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=2 on root.sg0"); - adminStmt.execute("set space quota timeseries='unlimited' on root.sg0"); + adminStmt.execute("set space quota timeseries=2 on root.db0"); + adminStmt.execute("set space quota timeseries='unlimited' on root.db0"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=2 on root.sg1"); - adminStmt.execute("set space quota devices='unlimited' on root.sg1"); + adminStmt.execute("set space quota devices=2 on root.db1"); + adminStmt.execute("set space quota devices='unlimited' on root.db1"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk=10M on root.sg2"); - adminStmt.execute("set space quota disk='unlimited' on root.sg2"); + adminStmt.execute("set space quota disk=10M on root.db2"); + adminStmt.execute("set space quota disk='unlimited' on root.db2"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=2,devices=2,disk=10M on root.sg3"); + adminStmt.execute("set space quota timeseries=2,devices=2,disk=10M on root.db3"); adminStmt.execute( - "set space quota timeseries='unlimited',devices='unlimited',disk='unlimited' on root.sg3"); + "set space quota timeseries='unlimited',devices='unlimited',disk='unlimited' on root.db3"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } @@ -256,31 +256,31 @@ public void setSpaceQuotaTest3() { public void setSpaceQuotaTest4() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3,timeseries=5 on root.sg0;"); + adminStmt.execute("set space quota devices=3,timeseries=5 on root.db0;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt02.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt02.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt03.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt03.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt04.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt04.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); - adminStmt.execute("set space quota devices=4,timeseries=6 on root.sg0;"); + "create timeseries root.db0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); + adminStmt.execute("set space quota devices=4,timeseries=6 on root.db0;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt05.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt05.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status5 with datatype=BOOLEAN,encoding=PLAIN;"); - adminStmt.execute("set space quota devices='unlimited',timeseries='unlimited' on root.sg0;"); + "create timeseries root.db0.wf01.wt01.status5 with datatype=BOOLEAN,encoding=PLAIN;"); + adminStmt.execute("set space quota devices='unlimited',timeseries='unlimited' on root.db0;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt06.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt06.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status6 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status6 with datatype=BOOLEAN,encoding=PLAIN;"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } @@ -290,21 +290,21 @@ public void setSpaceQuotaTest4() { public void setSpaceQuotaTest5() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.sg0;"); + adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.db0;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt02.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt02.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt02.status1 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt02.status1 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(2000); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg0;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db0;"); String ans1 = - "root.sg0,diskSize,0.09765625G,0.0G" + "root.db0,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg0,deviceNum,3,2" + + "root.db0,deviceNum,3,2" + ",\n" - + "root.sg0,timeSeriesNum,5,3" + + "root.db0,timeSeriesNum,5,3" + ",\n"; validateResultSet(resultSet1, ans1); } catch (InterruptedException | SQLException e) { @@ -316,7 +316,7 @@ public void setSpaceQuotaTest5() { public void setSpaceQuotaTest6() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='100K' on root.sg0;"); + adminStmt.execute("set space quota disk='100K' on root.db0;"); } catch (SQLException e) { Assert.assertEquals( "701: When setting the disk size, the unit is incorrect. Please use 'M', 'G', 'P', 'T' as the unit", @@ -324,14 +324,14 @@ public void setSpaceQuotaTest6() { } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='100M' on root.sg0;"); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg0;"); + adminStmt.execute("set space quota disk='100M' on root.db0;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db0;"); String ans1 = - "root.sg0,diskSize,0.09765625G,0.0G" + "root.db0,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg0,deviceNum,unlimited,0" + + "root.db0,deviceNum,unlimited,0" + ",\n" - + "root.sg0,timeSeriesNum,unlimited,0" + + "root.db0,timeSeriesNum,unlimited,0" + ",\n"; validateResultSet(resultSet1, ans1); } catch (SQLException e) { @@ -339,14 +339,14 @@ public void setSpaceQuotaTest6() { } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='100G' on root.sg1;"); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg1;"); + adminStmt.execute("set space quota disk='100G' on root.db1;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db1;"); String ans1 = - "root.sg1,diskSize,100.0G,0.0G" + "root.db1,diskSize,100.0G,0.0G" + ",\n" - + "root.sg1,deviceNum,unlimited,0" + + "root.db1,deviceNum,unlimited,0" + ",\n" - + "root.sg1,timeSeriesNum,unlimited,0" + + "root.db1,timeSeriesNum,unlimited,0" + ",\n"; validateResultSet(resultSet1, ans1); } catch (SQLException e) { @@ -354,14 +354,14 @@ public void setSpaceQuotaTest6() { } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='100T' on root.sg2;"); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg2;"); + adminStmt.execute("set space quota disk='100T' on root.db2;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db2;"); String ans1 = - "root.sg2,diskSize,102400.0G,0.0G" + "root.db2,diskSize,102400.0G,0.0G" + ",\n" - + "root.sg2,deviceNum,unlimited,0" + + "root.db2,deviceNum,unlimited,0" + ",\n" - + "root.sg2,timeSeriesNum,unlimited,0" + + "root.db2,timeSeriesNum,unlimited,0" + ",\n"; validateResultSet(resultSet1, ans1); } catch (SQLException e) { @@ -369,14 +369,14 @@ public void setSpaceQuotaTest6() { } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='100P' on root.sg3;"); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg3;"); + adminStmt.execute("set space quota disk='100P' on root.db3;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db3;"); String ans1 = - "root.sg3,diskSize,1.048576E8G,0.0G" + "root.db3,diskSize,1.048576E8G,0.0G" + ",\n" - + "root.sg3,deviceNum,unlimited,0" + + "root.db3,deviceNum,unlimited,0" + ",\n" - + "root.sg3,timeSeriesNum,unlimited,0" + + "root.db3,timeSeriesNum,unlimited,0" + ",\n"; validateResultSet(resultSet1, ans1); } catch (SQLException e) { @@ -389,18 +389,18 @@ public void setSpaceQuotaTest7() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf05.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); - adminStmt.execute("set space quota devices=5 on root.sg0;"); - adminStmt.execute("set space quota disk='5g' on root.sg0;"); - adminStmt.execute("set space quota devices=10 on root.sg0;"); + "create timeseries root.db0.wf05.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + adminStmt.execute("set space quota devices=5 on root.db0;"); + adminStmt.execute("set space quota disk='5g' on root.db0;"); + adminStmt.execute("set space quota devices=10 on root.db0;"); } catch (SQLException e) { Assert.fail(e.getMessage()); } @@ -410,7 +410,7 @@ public void setSpaceQuotaTest7() { public void setSpaceQuotaTest8() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=-5 on root.sg0"); + adminStmt.execute("set space quota timeseries=-5 on root.db0"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of timeseries greater than 0", throwables.getMessage()); @@ -418,7 +418,7 @@ public void setSpaceQuotaTest8() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=-6 on root.sg1"); + adminStmt.execute("set space quota devices=-6 on root.db1"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of devices greater than 0", throwables.getMessage()); @@ -426,14 +426,14 @@ public void setSpaceQuotaTest8() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='-7M' on root.sg2"); + adminStmt.execute("set space quota disk='-7M' on root.db2"); } catch (SQLException throwables) { Assert.assertEquals("701: Please set the disk size greater than 0", throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=-5,devices=6,disk=0M on root.sg3"); + adminStmt.execute("set space quota timeseries=-5,devices=6,disk=0M on root.db3"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of timeseries greater than 0", throwables.getMessage()); @@ -444,7 +444,7 @@ public void setSpaceQuotaTest8() { public void setSpaceQuotaTest9() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeserie=5 on root.sg0"); + adminStmt.execute("set space quota timeserie=5 on root.db0"); } catch (SQLException throwables) { Assert.assertEquals("701: Wrong space quota type: timeserie", throwables.getMessage()); } @@ -455,31 +455,31 @@ public void showSpaceQuotaTest0() throws SQLException { IoTDBDescriptor.getInstance().getConfig().setQuotaEnable(true); try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.sg1,root.sg2;"); + adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.db1,root.db2;"); ResultSet resultSet1 = adminStmt.executeQuery("show space quota;"); String ans1 = - "root.sg1,diskSize,0.09765625G,0.0G" + "root.db1,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg1,deviceNum,3,0" + + "root.db1,deviceNum,3,0" + ",\n" - + "root.sg1,timeSeriesNum,5,0" + + "root.db1,timeSeriesNum,5,0" + ",\n" - + "root.sg2,diskSize,0.09765625G,0.0G" + + "root.db2,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg2,deviceNum,3,0" + + "root.db2,deviceNum,3,0" + ",\n" - + "root.sg2,timeSeriesNum,5,0" + + "root.db2,timeSeriesNum,5,0" + ",\n"; validateResultSet(resultSet1, ans1); adminStmt.execute( - "set space quota devices='unlimited',timeseries='unlimited',disk='unlimited' on root.sg1;"); - ResultSet resultSet2 = adminStmt.executeQuery("show space quota root.sg1;"); + "set space quota devices='unlimited',timeseries='unlimited',disk='unlimited' on root.db1;"); + ResultSet resultSet2 = adminStmt.executeQuery("show space quota root.db1;"); String ans2 = - "root.sg1,diskSize,unlimited,0.0G" + "root.db1,diskSize,unlimited,0.0G" + ",\n" - + "root.sg1,deviceNum,unlimited,0" + + "root.db1,deviceNum,unlimited,0" + ",\n" - + "root.sg1,timeSeriesNum,unlimited,0" + + "root.db1,timeSeriesNum,unlimited,0" + ",\n"; validateResultSet(resultSet2, ans2); IoTDBDescriptor.getInstance().getConfig().setQuotaEnable(false); @@ -490,20 +490,20 @@ public void showSpaceQuotaTest0() throws SQLException { public void showSpaceQuotaTest1() throws SQLException { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.sg4,root.sg5;"); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg4,root.sg5;"); + adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.db4,root.db5;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db4,root.db5;"); String ans1 = - "root.sg4,diskSize,0.09765625G,0.0G" + "root.db4,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg4,deviceNum,3,0" + + "root.db4,deviceNum,3,0" + ",\n" - + "root.sg4,timeSeriesNum,5,0" + + "root.db4,timeSeriesNum,5,0" + ",\n" - + "root.sg5,diskSize,0.09765625G,0.0G" + + "root.db5,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg5,deviceNum,3,0" + + "root.db5,deviceNum,3,0" + ",\n" - + "root.sg5,timeSeriesNum,5,0" + + "root.db5,timeSeriesNum,5,0" + ",\n"; validateResultSet(resultSet1, ans1); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAutoCreateSchemaIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAutoCreateSchemaIT.java index 620411b8c78cc..4c325f14fc57d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAutoCreateSchemaIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAutoCreateSchemaIT.java @@ -76,8 +76,8 @@ public void tearDown() throws Exception { @Test public void createTimeseriesTest() throws ClassNotFoundException { String[] sqls = { - "CREATE TIMESERIES root.sg0.d1.s2 WITH DATATYPE=INT32,ENCODING=RLE", - "INSERT INTO root.sg0.d1(timestamp,s2) values(1,123)", + "CREATE TIMESERIES root.db0.d1.s2 WITH DATATYPE=INT32,ENCODING=RLE", + "INSERT INTO root.db0.d1(timestamp,s2) values(1,123)", }; executeSQL(sqls); } @@ -86,9 +86,9 @@ public void createTimeseriesTest() throws ClassNotFoundException { @Test public void insertTest1() throws ClassNotFoundException { String[] sqls = { - "CREATE DATABASE root.sg0", - "INSERT INTO root.sg0.d1(timestamp,s2) values(1,123.123)", - "INSERT INTO root.sg0.d1(timestamp,s3) values(1,\"abc\")", + "CREATE DATABASE root.db0", + "INSERT INTO root.db0.d1(timestamp,s2) values(1,123.123)", + "INSERT INTO root.db0.d1(timestamp,s3) values(1,\"abc\")", }; executeSQL(sqls); } @@ -97,9 +97,9 @@ public void insertTest1() throws ClassNotFoundException { @Test public void insertTest2() throws ClassNotFoundException { String[] sqls = { - "INSERT INTO root.sg0.d1(timestamp,s2) values(1,\"abc\")", - "INSERT INTO root.sg0.d2(timestamp,s3) values(1,123.123)", - "INSERT INTO root.sg0.d2(timestamp,s4) values(1,123456)", + "INSERT INTO root.db0.d1(timestamp,s2) values(1,\"abc\")", + "INSERT INTO root.db0.d2(timestamp,s3) values(1,123.123)", + "INSERT INTO root.db0.d2(timestamp,s4) values(1,123456)", }; executeSQL(sqls); } @@ -164,8 +164,8 @@ private void executeSQL(String[] sqls) throws ClassNotFoundException { */ @Test public void testInsertAutoCreate2() throws Exception { - String database = "root.sg2.a.b.c"; - String timeSeriesPrefix = "root.sg2.a.b"; + String database = "root.db2.a.b.c"; + String timeSeriesPrefix = "root.db2.a.b"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -213,8 +213,8 @@ private void InsertAutoCreate2Tool(Statement statement, String database, String @Test public void testInsertAutoCreate3() throws SQLException { String[] sqls = { - "INSERT INTO root.sg0.d3(timestamp,s1) values(1,null)", - "INSERT INTO root.sg0.d3(timestamp,s1,s2) values(1,null,2)", + "INSERT INTO root.db0.d3(timestamp,s1) values(1,null)", + "INSERT INTO root.db0.d3(timestamp,s1,s2) values(1,null,2)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -222,7 +222,7 @@ public void testInsertAutoCreate3() throws SQLException { try { statement.execute(sql); } catch (SQLException e) { - Assert.assertTrue(e.getMessage().contains("Path [root.sg0.d3.s1] does not exist")); + Assert.assertTrue(e.getMessage().contains("Path [root.db0.d3.s1] does not exist")); } } } @@ -234,34 +234,34 @@ public void testInsertAutoCreate3() throws SQLException { @Test public void testAutoCreateDataType() throws SQLException { String SQL = - "INSERT INTO root.sg0.d1(time,s1,s2,s3,s4,s5,s6) values(1,true,1,now(),X'cafe',\"string\",\"2024-01-01\")"; + "INSERT INTO root.db0.d1(time,s1,s2,s3,s4,s5,s6) values(1,true,1,now(),X'cafe',\"string\",\"2024-01-01\")"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute(SQL); ResultSet resultSet = statement.executeQuery("show timeseries"); while (resultSet.next()) { switch (resultSet.getString(ColumnHeaderConstant.TIMESERIES)) { - case "root.sg0.d1.s1": + case "root.db0.d1.s1": assertEquals( TSDataType.BOOLEAN.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; - case "root.sg0.d1.s2": + case "root.db0.d1.s2": assertEquals( TSDataType.DOUBLE.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; - case "root.sg0.d1.s3": + case "root.db0.d1.s3": assertEquals( TSDataType.INT64.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; - case "root.sg0.d1.s4": + case "root.db0.d1.s4": assertEquals( TSDataType.BLOB.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; - case "root.sg0.d1.s5": + case "root.db0.d1.s5": assertEquals( TSDataType.TEXT.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; - case "root.sg0.d1.s6": + case "root.db0.d1.s6": assertEquals( TSDataType.TEXT.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCountDeviceIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCountDeviceIT.java index 5478c7e341e4c..7a7e614db60a9 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCountDeviceIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCountDeviceIT.java @@ -168,26 +168,26 @@ public void testCountDevicesWithSpecificPath() throws Exception { Statement statement = connection.createStatement()) { // Create database - statement.execute("CREATE DATABASE root.sg"); + statement.execute("CREATE DATABASE root.db"); // Create devices - statement.execute("CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.g1.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.g2.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d2.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.g1.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.g2.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); - // Count devices exactly under root.sg.d1 - long countResult = getCountDevices(statement, "root.sg.d1.*"); + // Count devices exactly under root.db.d1 + long countResult = getCountDevices(statement, "root.db.d1.*"); // Get actual device count using show devices - long showDevicesCount = getShowDevicesCount(statement, "root.sg.d1.*"); + long showDevicesCount = getShowDevicesCount(statement, "root.db.d1.*"); // They should match Assert.assertEquals( "Count devices should match show devices count", showDevicesCount, countResult); - // Expected: root.sg.d1.g1, root.sg.d1.g2 = 2 devices - Assert.assertEquals("Should have exactly 2 devices under root.sg.d1", 2, countResult); + // Expected: root.db.d1.g1, root.db.d1.g2 = 2 devices + Assert.assertEquals("Should have exactly 2 devices under root.db.d1", 2, countResult); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateAlignedTimeseriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateAlignedTimeseriesIT.java index 7b784c034ab60..1536efee97b04 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateAlignedTimeseriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateAlignedTimeseriesIT.java @@ -71,14 +71,14 @@ public void tearDown() throws Exception { public void testCreateAlignedTimeseries() throws Exception { String[] timeSeriesArray = new String[] { - "root.sg1.d1.vector1.s1,FLOAT,PLAIN,UNCOMPRESSED", "root.sg1.d1.vector1.s2,INT64,RLE,LZ4" + "root.db1.d1.vector1.s1,FLOAT,PLAIN,UNCOMPRESSED", "root.db1.d1.vector1.s2,INT64,RLE,LZ4" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); try { statement.execute( - "CREATE ALIGNED TIMESERIES root.sg1.d1.vector1(s1 FLOAT encoding=PLAIN compressor=UNCOMPRESSED,s2 INT64 encoding=RLE)"); + "CREATE ALIGNED TIMESERIES root.db1.d1.vector1(s1 FLOAT encoding=PLAIN compressor=UNCOMPRESSED,s2 INT64 encoding=RLE)"); } catch (SQLException ignored) { } @@ -97,17 +97,17 @@ public void testCreateAlignedTimeseries() throws Exception { public void testCreateAlignedTimeseriesWithDeletion() throws Exception { String[] timeSeriesArray = new String[] { - "root.sg1.d1.vector1.s1,DOUBLE,PLAIN,SNAPPY", "root.sg1.d1.vector1.s2,INT64,RLE,LZ4" + "root.db1.d1.vector1.s1,DOUBLE,PLAIN,SNAPPY", "root.db1.d1.vector1.s2,INT64,RLE,LZ4" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); try { statement.execute( - "CREATE ALIGNED TIMESERIES root.sg1.d1.vector1(s1 FLOAT encoding=PLAIN compressor=UNCOMPRESSED,s2 INT64 encoding=RLE)"); - statement.execute("DELETE TIMESERIES root.sg1.d1.vector1.s1"); + "CREATE ALIGNED TIMESERIES root.db1.d1.vector1(s1 FLOAT encoding=PLAIN compressor=UNCOMPRESSED,s2 INT64 encoding=RLE)"); + statement.execute("DELETE TIMESERIES root.db1.d1.vector1.s1"); statement.execute( - "CREATE ALIGNED TIMESERIES root.sg1.d1.vector1(s1 DOUBLE encoding=PLAIN compressor=SNAPPY)"); + "CREATE ALIGNED TIMESERIES root.db1.d1.vector1(s1 DOUBLE encoding=PLAIN compressor=SNAPPY)"); } catch (SQLException e) { e.printStackTrace(); } @@ -129,7 +129,7 @@ private void assertTimeseriesEquals(String[] timeSeriesArray) throws SQLExceptio int count = 0; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { while (resultSet.next()) { String ActualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -151,13 +151,13 @@ public void testDifferentDeviceAlignment() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // Should ignore the alignment difference - statement.execute("create aligned timeseries root.sg2.d (s2 int64, s3 int64)"); + statement.execute("create aligned timeseries root.db2.d (s2 int64, s3 int64)"); // Should use the existing alignment - statement.execute("create timeseries root.sg2.d.s1 with datatype=INT64"); - statement.execute("insert into root.sg2.d (time, s4) values (-1, 1)"); + statement.execute("create timeseries root.db2.d.s1 with datatype=INT64"); + statement.execute("insert into root.db2.d (time, s4) values (-1, 1)"); TestUtils.assertResultSetEqual( - statement.executeQuery("select * from root.sg2.d"), - "Time,root.sg2.d.s3,root.sg2.d.s4,root.sg2.d.s1,root.sg2.d.s2,", + statement.executeQuery("select * from root.db2.d"), + "Time,root.db2.d.s3,root.db2.d.s4,root.db2.d.s1,root.db2.d.s2,", Collections.singleton("-1,null,1.0,null,null,")); } catch (SQLException ignored) { fail(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateDatabaseIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateDatabaseIT.java index 8681878d254cb..c1d0b06e88e55 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateDatabaseIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateDatabaseIT.java @@ -73,7 +73,7 @@ public void tearDown() throws Exception { /** The test creates three databases */ @Test public void testCreateDatabase() throws Exception { - final String[] databases = {"root.sg1", "root.sg2", "root.sg3"}; + final String[] databases = {"root.db1", "root.db2", "root.db3"}; try (final Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (final String database : databases) { @@ -95,7 +95,7 @@ private void createDatabaseTool(final Statement statement, final String[] Databa throws SQLException { List resultList = new ArrayList<>(); - try (final ResultSet resultSet = statement.executeQuery("SHOW DATABASES root.sg*")) { + try (final ResultSet resultSet = statement.executeQuery("SHOW DATABASES root.db*")) { while (resultSet.next()) { final String databasePath = resultSet.getString(ColumnHeaderConstant.DATABASE); resultList.add(databasePath); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java index b2b6f1c1078ad..419f75e30a639 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java @@ -74,7 +74,7 @@ public void tearDown() throws Exception { /** Test if creating a time series will cause the database with same name to disappear */ @Test public void testCreateTimeseries() throws Exception { - String database = "root.sg1.a.b.c"; + String database = "root.db1.a.b.c"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -126,7 +126,7 @@ public void testCreateTimeseriesWithSpecialCharacter() throws Exception { statement.execute( String.format( "create timeseries %s with datatype=INT64, encoding=PLAIN, compression=SNAPPY", - "root.sg.d.a\".\"b")); + "root.db.d.a\".\"b")); fail(); } catch (SQLException ignored) { } @@ -134,7 +134,7 @@ public void testCreateTimeseriesWithSpecialCharacter() throws Exception { statement.execute( String.format( "create timeseries %s with datatype=INT64, encoding=PLAIN, compression=SNAPPY", - "root.sg.d.a“(Φ)”b")); + "root.db.d.a“(Φ)”b")); fail(); } catch (SQLException ignored) { } @@ -142,17 +142,17 @@ public void testCreateTimeseriesWithSpecialCharacter() throws Exception { statement.execute( String.format( "create timeseries %s with datatype=INT64, encoding=PLAIN, compression=SNAPPY", - "root.sg.d.a>b")); + "root.db.d.a>b")); fail(); } catch (SQLException ignored) { } } String[] timeSeriesArray = { - "root.sg.d.`a.b`", "root.sg.d.`a“(Φ)”b`", "root.sg.d.`a>b`", "root.sg.d.`0e38`" + "root.db.d.`a.b`", "root.db.d.`a“(Φ)”b`", "root.db.d.`a>b`", "root.db.d.`0e38`" }; String[] timeSeriesResArray = { - "root.sg.d.`a.b`", "root.sg.d.`a“(Φ)”b`", "root.sg.d.`a>b`", "root.sg.d.`0e38`", + "root.db.d.`a.b`", "root.db.d.`a“(Φ)”b`", "root.db.d.`a>b`", "root.db.d.`0e38`", }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -173,7 +173,7 @@ private void createTimeSeriesWithSpecialCharacterTool(String[] timeSeriesArray) throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("count timeseries root.sg.**")) { + ResultSet resultSet = statement.executeQuery("count timeseries root.db.**")) { while (resultSet.next()) { long count = resultSet.getLong(1); Assert.assertEquals(timeSeriesArray.length, count); @@ -186,14 +186,14 @@ public void testCreateTimeSeriesWithWrongAttribute() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - String.format("create timeseries %s with datatype=INT64, datatype = test", "root.sg.a")); + String.format("create timeseries %s with datatype=INT64, datatype = test", "root.db.a")); fail(); } catch (SQLException ignored) { } try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute(String.format("create timeseries %s with encoding=plain", "root.sg.a")); + statement.execute(String.format("create timeseries %s with encoding=plain", "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -202,7 +202,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { Statement statement = connection.createStatement()) { statement.execute( String.format( - "create timeseries %s with encoding=plain, compressor=snappy", "root.sg.a")); + "create timeseries %s with encoding=plain, compressor=snappy", "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -210,7 +210,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - String.format("create timeseries %s with datatype=float, encoding=plan", "root.sg.a")); + String.format("create timeseries %s with datatype=float, encoding=plan", "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -218,7 +218,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - String.format("create timeseries %s with datatype=INT64, encoding=test", "root.sg.a")); + String.format("create timeseries %s with datatype=INT64, encoding=test", "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -228,7 +228,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { statement.execute( String.format( "create timeseries %s with datatype=INT64, encoding=test, compression=test", - "root.sg.a")); + "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -236,7 +236,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - String.format("create timeseries %s with datatype=INT64,compression=test", "root.sg.a")); + String.format("create timeseries %s with datatype=INT64,compression=test", "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -246,7 +246,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { statement.execute( String.format( "create timeseries %s with datatype=INT64, encoding=PLAIN, compression=test", - "root.sg.a")); + "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -256,14 +256,14 @@ public void testCreateTimeSeriesWithWrongAttribute() { public void testQueryDataFromTimeSeriesWithoutData() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("create timeseries root.sg2.d.s1 with datatype=INT64"); + statement.execute("create timeseries root.db2.d.s1 with datatype=INT64"); } catch (SQLException ignored) { fail(); } int cnt = 0; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select s1 from root.sg2.d")) { + ResultSet resultSet = statement.executeQuery("select s1 from root.db2.d")) { while (resultSet.next()) { cnt++; } @@ -277,19 +277,19 @@ public void testQueryDataFromTimeSeriesWithoutData() { public void testIllegalInput() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("create timeseries root.sg2.d.s1 with datatype=INT64"); + statement.execute("create timeseries root.db2.d.s1 with datatype=INT64"); assertThrows( "Unsupported datatype: UNKNOWN", SQLException.class, - () -> statement.execute("create timeseries root.sg2.d.s1 with datatype=UNKNOWN")); + () -> statement.execute("create timeseries root.db2.d.s1 with datatype=UNKNOWN")); assertThrows( "Unsupported datatype: VECTOR", SQLException.class, - () -> statement.execute("create timeseries root.sg2.d.s1 with datatype=VECTOR")); + () -> statement.execute("create timeseries root.db2.d.s1 with datatype=VECTOR")); assertThrows( "Unsupported datatype: YES", SQLException.class, - () -> statement.execute("create timeseries root.sg2.d.s1 with datatype=YES")); + () -> statement.execute("create timeseries root.db2.d.s1 with datatype=YES")); assertThrows( "Unsupported datatype: UNKNOWN", SQLException.class, @@ -307,14 +307,14 @@ public void testIllegalInput() { public void testDifferentDeviceAlignment() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("create timeseries root.sg2.d.s1 with datatype=INT64"); + statement.execute("create timeseries root.db2.d.s1 with datatype=INT64"); // Should ignore the alignment difference - statement.execute("create aligned timeseries root.sg2.d (s2 int64, s3 int64)"); + statement.execute("create aligned timeseries root.db2.d (s2 int64, s3 int64)"); // Should use the existing alignment - statement.execute("insert into root.sg2.d (time, s4) aligned values (-1, 1)"); + statement.execute("insert into root.db2.d (time, s4) aligned values (-1, 1)"); TestUtils.assertResultSetEqual( - statement.executeQuery("select * from root.sg2.d"), - "Time,root.sg2.d.s3,root.sg2.d.s4,root.sg2.d.s1,root.sg2.d.s2,", + statement.executeQuery("select * from root.db2.d"), + "Time,root.db2.d.s3,root.db2.d.s4,root.db2.d.s1,root.db2.d.s2,", Collections.singleton("-1,null,1.0,null,null,")); } catch (SQLException ignored) { fail(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeactivateTemplateIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeactivateTemplateIT.java index 22572aac6eeb6..9359874c7ac4b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeactivateTemplateIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeactivateTemplateIT.java @@ -72,23 +72,23 @@ private void prepareTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE DATABASE root.sg2"); - statement.execute("CREATE DATABASE root.sg3"); - statement.execute("CREATE DATABASE root.sg4"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE DATABASE root.db2"); + statement.execute("CREATE DATABASE root.db3"); + statement.execute("CREATE DATABASE root.db4"); // create device template statement.execute("CREATE DEVICE TEMPLATE t1 (s1 INT64, s2 DOUBLE)"); statement.execute("CREATE DEVICE TEMPLATE t2 (s1 INT64, s2 DOUBLE)"); // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg2"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg3"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg4"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db2"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db3"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db4"); for (int j = 1; j <= 4; j++) { - statement.execute(String.format("create timeseries of device template on root.sg%d.d1", j)); + statement.execute(String.format("create timeseries of device template on root.db%d.d1", j)); } } } @@ -97,26 +97,26 @@ private void prepareTemplate() throws SQLException { public void deactivateTemplateAndReactivateTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.sg1.d1"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.db1.d1"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); } - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d1"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d1"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(3, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); } - statement.execute("insert into root.sg1.d1(time, s1, s2) values(1, 1, 1)"); + statement.execute("insert into root.db1.d1(time, s1, s2) values(1, 1, 1)"); String[] retArray = new String[] {"1,1,1.0,"}; int cnt = 0; - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(3, resultSetMetaData.getColumnCount()); while (resultSet.next()) { @@ -136,13 +136,13 @@ public void deactivateTemplateAndReactivateTest() throws Exception { public void deactivateTemplateAndAutoDeleteDeviceTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.sg1.d1"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.db1.d1"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertFalse(resultSet.next()); } @@ -151,7 +151,7 @@ public void deactivateTemplateAndAutoDeleteDeviceTest() throws Exception { @Test public void deactivateTemplateCrossSchemaRegionTest() throws Exception { - String insertSql = "insert into root.sg1.d%d(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db1.d%d(time, s1, s2) values(%d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -160,8 +160,8 @@ public void deactivateTemplateCrossSchemaRegionTest() throws Exception { } } - statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.sg1.*"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.**")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.db1.*"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.**")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); @@ -171,7 +171,7 @@ public void deactivateTemplateCrossSchemaRegionTest() throws Exception { @Test public void deactivateTemplateCrossDatabaseTest() throws Exception { - String insertSql = "insert into root.sg%d.d2(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db%d.d2(time, s1, s2) values(%d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -184,7 +184,7 @@ public void deactivateTemplateCrossDatabaseTest() throws Exception { String[] retArray = new String[] {"1,1,1.0,1,1.0,", "2,2,2.0,2,2.0,", "3,3,3.0,3,3.0,", "4,4,4.0,4,4.0,"}; int cnt = 0; - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.**,root.sg2.**")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.**,root.db2.**")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(5, resultSetMetaData.getColumnCount()); while (resultSet.next()) { @@ -198,8 +198,8 @@ public void deactivateTemplateCrossDatabaseTest() throws Exception { Assert.assertEquals(retArray.length, cnt); } - statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.**, root.sg1.*"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.**,root.sg2.**")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.**, root.db1.*"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.**,root.db2.**")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); @@ -211,8 +211,8 @@ public void deactivateTemplateCrossDatabaseTest() throws Exception { public void deactivateTemplateWithMultiPatternTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.sg1.d1, root.sg2.*"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*, root.sg2.*")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.db1.d1, root.db2.*"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*, root.db2.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); @@ -225,19 +225,19 @@ public void deactivateNoneUsageTemplateTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.sg5.d1"); + statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.db5.d1"); Assert.fail(); } catch (SQLException e) { Assert.assertEquals( TSStatusCode.TEMPLATE_NOT_SET.getStatusCode() - + ": Device Template t1 is not set on any prefix path of [root.sg5.d1]", + + ": Device Template t1 is not set on any prefix path of [root.db5.d1]", e.getMessage()); } - statement.execute("CREATE DATABASE root.sg5"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg5 "); + statement.execute("CREATE DATABASE root.db5"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db5 "); try { - statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.sg5.d1"); + statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.db5.d1"); Assert.fail(); } catch (SQLException e) { Assert.assertEquals( @@ -252,22 +252,22 @@ public void deactivateNoneUsageTemplateTest() throws Exception { public void multiSyntaxTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("DELETE TIMESERIES OF DEVICE TEMPLATE t1 FROM root.sg1.d1"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*")) { + statement.execute("DELETE TIMESERIES OF DEVICE TEMPLATE t1 FROM root.db1.d1"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); } - statement.execute("DEACTIVATE DEVICE TEMPLATE t2 FROM root.sg3.d1"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg3.*")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE t2 FROM root.db3.d1"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db3.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); } statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.**"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.**,root.sg2.**")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.**,root.db2.**")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteAlignedTimeseriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteAlignedTimeseriesIT.java index 2ade000fbb664..c0f02f111d30e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteAlignedTimeseriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteAlignedTimeseriesIT.java @@ -160,23 +160,23 @@ public void deleteTimeseriesAndChangeDeviceAlignmentTest() throws Exception { int cnt = 0; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("INSERT INTO root.sg3.d1(timestamp,s1,s2) ALIGNED VALUES(1,1,2)"); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg3.**")) { + statement.execute("INSERT INTO root.db3.d1(timestamp,s1,s2) ALIGNED VALUES(1,1,2)"); + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db3.**")) { while (resultSet.next()) { Assert.assertEquals("true", resultSet.getString(ColumnHeaderConstant.IS_ALIGNED)); } } cnt = 0; - statement.execute("DELETE timeseries root.sg3.d1.s1"); - statement.execute("DELETE timeseries root.sg3.d1.s2"); - statement.execute("INSERT INTO root.sg3.d1(timestamp,s1,s2) VALUES(1,1,2)"); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg3.**")) { + statement.execute("DELETE timeseries root.db3.d1.s1"); + statement.execute("DELETE timeseries root.db3.d1.s2"); + statement.execute("INSERT INTO root.db3.d1(timestamp,s1,s2) VALUES(1,1,2)"); + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db3.**")) { while (resultSet.next()) { Assert.assertEquals("false", resultSet.getString(ColumnHeaderConstant.IS_ALIGNED)); } } - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg3.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db3.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); while (resultSet.next()) { StringBuilder builder = new StringBuilder(); @@ -188,16 +188,16 @@ public void deleteTimeseriesAndChangeDeviceAlignmentTest() throws Exception { } } cnt = 0; - statement.execute("DELETE timeseries root.sg3.d1.s1"); - statement.execute("DELETE timeseries root.sg3.d1.s2"); - statement.execute("INSERT INTO root.sg3.d1(timestamp,s1,s2) ALIGNED VALUES(1,1,2)"); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg3.**")) { + statement.execute("DELETE timeseries root.db3.d1.s1"); + statement.execute("DELETE timeseries root.db3.d1.s2"); + statement.execute("INSERT INTO root.db3.d1(timestamp,s1,s2) ALIGNED VALUES(1,1,2)"); + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db3.**")) { while (resultSet.next()) { Assert.assertEquals("true", resultSet.getString(ColumnHeaderConstant.IS_ALIGNED)); } } - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg3.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db3.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); while (resultSet.next()) { StringBuilder builder = new StringBuilder(); @@ -217,21 +217,21 @@ public void deleteTimeSeriesMultiIntervalTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - String insertSql = "insert into root.sg.d1(time, s1) aligned values(%d, %d)"; + String insertSql = "insert into root.db.d1(time, s1) aligned values(%d, %d)"; for (int i = 1; i <= 4; i++) { statement.execute(String.format(insertSql, i, i)); } statement.execute("flush"); - statement.execute("delete from root.sg.d1.s1 where time >= 1 and time <= 2"); - statement.execute("delete from root.sg.d1.s1 where time >= 3 and time <= 4"); + statement.execute("delete from root.db.d1.s1 where time >= 1 and time <= 2"); + statement.execute("delete from root.db.d1.s1 where time >= 3 and time <= 4"); int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(s1) from root.sg.d1 where time >= 3 and time <= 4")) { + "select count(s1) from root.db.d1 where time >= 3 and time <= 4")) { while (resultSet.next()) { - String ans = resultSet.getString(count("root.sg.d1.s1")); + String ans = resultSet.getString(count("root.db.d1.s1")); Assert.assertEquals(retArray1[cnt], ans); cnt++; } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteDatabaseIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteDatabaseIT.java index 4de6b726d44ec..11bb3770dce9c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteDatabaseIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteDatabaseIT.java @@ -168,17 +168,17 @@ public void testDeleteAllDatabases() throws Exception { public void testDeleteDatabaseAndThenQuery() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg1.d1(time,s1) values(1,1);"); + statement.execute("insert into root.db1.d1(time,s1) values(1,1);"); statement.execute("flush"); - statement.execute("select count(*) from root.sg1.**;"); - statement.execute("delete database root.sg1"); - statement.execute("insert into root.sg1.sdhkajhd(time,s1) values(1,1);"); + statement.execute("select count(*) from root.db1.**;"); + statement.execute("delete database root.db1"); + statement.execute("insert into root.db1.sdhkajhd(time,s1) values(1,1);"); statement.execute("flush"); int count = 0; - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.**")) { while (resultSet.next()) { count++; - assertEquals(1, resultSet.getLong("count(root.sg1.sdhkajhd.s1)")); + assertEquals(1, resultSet.getLong("count(root.db1.sdhkajhd.s1)")); } } assertEquals(1, count); @@ -190,15 +190,15 @@ public void testDeleteDatabaseInvalidateCache() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { try { - statement.execute("insert into root.sg1.d1(s1) values(1);"); - statement.execute("insert into root.sg2(s2) values(1);"); - statement.execute("select last(s1) from root.sg1.d1;"); - statement.execute("select last(s2) from root.sg2;"); - statement.execute("insert into root.sg1.d1(s1) values(1);"); - statement.execute("insert into root.sg2(s2) values(1);"); + statement.execute("insert into root.db1.d1(s1) values(1);"); + statement.execute("insert into root.db2(s2) values(1);"); + statement.execute("select last(s1) from root.db1.d1;"); + statement.execute("select last(s2) from root.db2;"); + statement.execute("insert into root.db1.d1(s1) values(1);"); + statement.execute("insert into root.db2(s2) values(1);"); statement.execute("delete database root.**"); - statement.execute("insert into root.sg1.d1(s1) values(\"2001-08-01\");"); - statement.execute("insert into root.sg2(s2) values(\"2001-08-01\");"); + statement.execute("insert into root.db1.d1(s1) values(\"2001-08-01\");"); + statement.execute("insert into root.db2(s2) values(\"2001-08-01\");"); } catch (final Exception e) { Assert.fail(e.getMessage()); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteTimeSeriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteTimeSeriesIT.java index 0866b37836e23..9dfc4c9df11e2 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteTimeSeriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteTimeSeriesIT.java @@ -173,21 +173,21 @@ public void deleteTimeSeriesMultiIntervalTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - String insertSql = "insert into root.sg.d1(time, s1) values(%d, %d)"; + String insertSql = "insert into root.db.d1(time, s1) values(%d, %d)"; for (int i = 1; i <= 4; i++) { statement.execute(String.format(insertSql, i, i)); } statement.execute("flush"); - statement.execute("delete from root.sg.d1.s1 where time >= 1 and time <= 2"); - statement.execute("delete from root.sg.d1.s1 where time >= 3 and time <= 4"); + statement.execute("delete from root.db.d1.s1 where time >= 1 and time <= 2"); + statement.execute("delete from root.db.d1.s1 where time >= 3 and time <= 4"); int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(s1) from root.sg.d1 where time >= 3 and time <= 4")) { + "select count(s1) from root.db.d1 where time >= 3 and time <= 4")) { while (resultSet.next()) { - String ans = resultSet.getString(count("root.sg.d1.s1")); + String ans = resultSet.getString(count("root.db.d1.s1")); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -203,7 +203,7 @@ public void deleteTimeSeriesMultiIntervalTest() { public void deleteTimeSeriesAndAutoDeleteDeviceTest() throws Exception { String[] retArray1 = new String[] {"4,4,4,4"}; - String insertSql = "insert into root.sg.d1(time, s1, s2, s3, s4) values(%d, %d, %d, %d, %d)"; + String insertSql = "insert into root.db.d1(time, s1, s2, s3, s4) values(%d, %d, %d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -213,11 +213,11 @@ public void deleteTimeSeriesAndAutoDeleteDeviceTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), count(s2), count(s3), count(s4) from root.sg.d1")) { + "select count(s1), count(s2), count(s3), count(s4) from root.db.d1")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg.d1.s1"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db.d1.s1"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg.d1.s" + i))); + ans.append(",").append(resultSet.getString(count("root.db.d1.s" + i))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -225,16 +225,16 @@ public void deleteTimeSeriesAndAutoDeleteDeviceTest() throws Exception { Assert.assertEquals(retArray1.length, cnt); } - statement.execute("delete timeseries root.sg.d1.*"); - try (ResultSet resultSet = statement.executeQuery("select * from root.sg.d1")) { + statement.execute("delete timeseries root.db.d1.*"); + try (ResultSet resultSet = statement.executeQuery("select * from root.db.d1")) { Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg.d1.*")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db.d1.*")) { Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("show devices root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("show devices root.db.d1")) { Assert.assertFalse(resultSet.next()); } } @@ -244,9 +244,9 @@ public void deleteTimeSeriesAndAutoDeleteDeviceTest() throws Exception { public void deleteTimeSeriesAndInvalidationTest() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1 (c1, c2) values (1, 1)"); - statement.execute("delete timeSeries root.sg.d1.**"); - try (final ResultSet resultSet = statement.executeQuery("select c1, c2 from root.sg.d1")) { + statement.execute("insert into root.db.d1 (c1, c2) values (1, 1)"); + statement.execute("delete timeSeries root.db.d1.**"); + try (final ResultSet resultSet = statement.executeQuery("select c1, c2 from root.db.d1")) { Assert.assertEquals(1, resultSet.getMetaData().getColumnCount()); Assert.assertFalse(resultSet.next()); } @@ -257,7 +257,7 @@ public void deleteTimeSeriesAndInvalidationTest() throws Exception { public void deleteTimeSeriesCrossSchemaRegionTest() throws Exception { String[] retArray1 = new String[] {"4,4,4,4"}; - String insertSql = "insert into root.sg.d%d(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db.d%d(time, s1, s2) values(%d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -267,11 +267,11 @@ public void deleteTimeSeriesCrossSchemaRegionTest() throws Exception { } int cnt = 0; - try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.sg.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.db.*")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg.d1.s1"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db.d1.s1"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg.d" + i + ".s1"))); + ans.append(",").append(resultSet.getString(count("root.db.d" + i + ".s1"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -279,21 +279,21 @@ public void deleteTimeSeriesCrossSchemaRegionTest() throws Exception { Assert.assertEquals(retArray1.length, cnt); } - statement.execute("delete timeseries root.sg.*.s1"); - try (ResultSet resultSet = statement.executeQuery("select s1 from root.sg.*")) { + statement.execute("delete timeseries root.db.*.s1"); + try (ResultSet resultSet = statement.executeQuery("select s1 from root.db.*")) { Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg.*.s1")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db.*.s1")) { Assert.assertFalse(resultSet.next()); } cnt = 0; - try (ResultSet resultSet = statement.executeQuery("select count(s2) from root.sg.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(s2) from root.db.*")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg.d1.s2"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db.d1.s2"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg.d" + i + ".s2"))); + ans.append(",").append(resultSet.getString(count("root.db.d" + i + ".s2"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -307,7 +307,7 @@ public void deleteTimeSeriesCrossSchemaRegionTest() throws Exception { public void deleteTimeSeriesCrossDatabaseTest() throws Exception { String[] retArray1 = new String[] {"4,4,4,4"}; - String insertSql = "insert into root.sg%d.d1(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db%d.d1(time, s1, s2) values(%d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -319,9 +319,9 @@ public void deleteTimeSeriesCrossDatabaseTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.*.d1")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg1.d1.s1"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db1.d1.s1"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg" + i + ".d1.s1"))); + ans.append(",").append(resultSet.getString(count("root.db" + i + ".d1.s1"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -341,9 +341,9 @@ public void deleteTimeSeriesCrossDatabaseTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery("select count(s2) from root.*.*")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg1.d1.s2"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db1.d1.s2"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg" + i + ".d1.s2"))); + ans.append(",").append(resultSet.getString(count("root.db" + i + ".d1.s2"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -351,12 +351,12 @@ public void deleteTimeSeriesCrossDatabaseTest() throws Exception { Assert.assertEquals(retArray1.length, cnt); } - statement.execute("delete timeseries root.sg1.d1.s2, root.sg2.**"); - try (ResultSet resultSet = statement.executeQuery("select s2 from root.sg1.*")) { + statement.execute("delete timeseries root.db1.d1.s2, root.db2.**"); + try (ResultSet resultSet = statement.executeQuery("select s2 from root.db1.*")) { Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg2.*.s2")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db2.*.s2")) { Assert.assertFalse(resultSet.next()); } @@ -364,9 +364,9 @@ public void deleteTimeSeriesCrossDatabaseTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery("select count(s2) from root.*.*")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg3.d1.s2"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db3.d1.s2"))); for (int i = 4; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg" + i + ".d1.s2"))); + ans.append(",").append(resultSet.getString(count("root.db" + i + ".d1.s2"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -380,7 +380,7 @@ public void deleteTimeSeriesCrossDatabaseTest() throws Exception { public void deleteTimeSeriesWithMultiPatternTest() throws Exception { String[] retArray1 = new String[] {"4,4,4,4"}; - String insertSql = "insert into root.sg%d.d1(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db%d.d1(time, s1, s2) values(%d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -392,9 +392,9 @@ public void deleteTimeSeriesWithMultiPatternTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.*.d1")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg1.d1.s1"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db1.d1.s1"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg" + i + ".d1.s1"))); + ans.append(",").append(resultSet.getString(count("root.db" + i + ".d1.s1"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -461,7 +461,7 @@ public void deleteTimeSeriesAndReturnPathNotExistsTest() throws Exception { String[] retArray1 = new String[] {"4,4,4,4"}; - String insertSql = "insert into root.sg%d.d1(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db%d.d1(time, s1, s2) values(%d, %d, %d)"; for (int i = 1; i <= 4; i++) { for (int j = 1; j <= 4; j++) { statement.execute(String.format(insertSql, j, i, i, i)); @@ -472,9 +472,9 @@ public void deleteTimeSeriesAndReturnPathNotExistsTest() throws Exception { try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.*.d1")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg1.d1.s1"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db1.d1.s1"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg" + i + ".d1.s1"))); + ans.append(",").append(resultSet.getString(count("root.db" + i + ".d1.s1"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBMetadataFetchIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBMetadataFetchIT.java index 1b6818d39f0a5..8f42063d3bc91 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBMetadataFetchIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBMetadataFetchIT.java @@ -268,31 +268,31 @@ public void showDevicesWithSgTest() throws SQLException { public void showDevicesWithTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE DATABASE root.sg2"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE DATABASE root.db2"); statement.execute("CREATE DEVICE TEMPLATE t1 (s1 INT64, s2 DOUBLE)"); statement.execute("CREATE DEVICE TEMPLATE t2 aligned (s1 INT64, s2 DOUBLE)"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg1.d2"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg2.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg2.d2"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d2"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg2.d1"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg2.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db1.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db2.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db2.d2"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d2"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db2.d1"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db2.d2"); String[] sqls = new String[] { "show devices root.** where template is not null", - "show devices root.sg2.** with database where template = 't2'", + "show devices root.db2.** with database where template = 't2'", }; Set[] standards = new Set[] { new HashSet<>( Arrays.asList( - "root.sg1.d2,true,t2,INF,", - "root.sg2.d1,false,t1,INF,", - "root.sg2.d2,true,t2,INF,")), - new HashSet<>(Arrays.asList("root.sg2.d2,root.sg2,true,t2,INF,")), + "root.db1.d2,true,t2,INF,", + "root.db2.d1,false,t1,INF,", + "root.db2.d2,true,t2,INF,")), + new HashSet<>(Arrays.asList("root.db2.d2,root.db2,true,t2,INF,")), }; for (int n = 0; n < sqls.length; n++) { @@ -418,7 +418,7 @@ public void showChildPaths() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { String[] sqls = new String[] {"show child paths root.ln"}; - String[] standards = new String[] {"root.ln.wf01,SG INTERNAL,\n"}; + String[] standards = new String[] {"root.ln.wf01,DB INTERNAL,\n"}; for (int n = 0; n < sqls.length; n++) { String sql = sqls[n]; String standard = standards[n]; @@ -774,15 +774,15 @@ public void showAlignedTimeseriesWithAliasAndTags() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "create aligned timeseries root.sg.d(s1(alias1) int32 tags('tag1'='v1', 'tag2'='v2'), s2 double attributes('attr3'='v3'))"); + "create aligned timeseries root.db.d(s1(alias1) int32 tags('tag1'='v1', 'tag2'='v2'), s2 double attributes('attr3'='v3'))"); String[] expected = new String[] { - "root.sg.d.s1,alias1,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", - "root.sg.d.s2,null,root.sg,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE," + "root.db.d.s1,alias1,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", + "root.db.d.s2,null,root.db,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE," }; int num = 0; - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg.d.*")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db.d.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); while (resultSet.next()) { StringBuilder builder = new StringBuilder(); @@ -835,9 +835,9 @@ public void showDeadbandInfo() throws SQLException { String[] sqls = new String[] { - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32", - "CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2", - "CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15" + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32", + "CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2", + "CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15" }; for (String sql : sqls) { statement.execute(sql); @@ -845,10 +845,10 @@ public void showDeadbandInfo() throws SQLException { Set standard = new HashSet<>( Arrays.asList( - "root.sg1.d0.s0,null,root.sg1,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,\n", - "root.sg1.d0.s1,null,root.sg1,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,\n", - "root.sg1.d0.s2,null,root.sg1,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,\n")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.d0.*")) { + "root.db1.d0.s0,null,root.db1,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,\n", + "root.db1.d0.s1,null,root.db1,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,\n", + "root.db1.d0.s2,null,root.db1,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,\n")); + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.d0.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); while (resultSet.next()) { StringBuilder builder = new StringBuilder(); @@ -861,7 +861,7 @@ public void showDeadbandInfo() throws SQLException { } catch (SQLException e) { fail(e.getMessage()); } finally { - statement.execute("delete timeseries root.sg1.d0.*"); + statement.execute("delete timeseries root.db1.d0.*"); } } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBSchemaTemplateIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBSchemaTemplateIT.java index 822cca2e78cec..9c01717991209 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBSchemaTemplateIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBSchemaTemplateIT.java @@ -80,9 +80,9 @@ private void prepareTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // create database - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE DATABASE root.sg2"); - statement.execute("CREATE DATABASE root.sg3"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE DATABASE root.db2"); + statement.execute("CREATE DATABASE root.db3"); // create device template statement.execute("CREATE DEVICE TEMPLATE t1 (s1 INT64, s2 DOUBLE)"); @@ -120,9 +120,9 @@ public void testCreateTemplateAndCreateTimeseries() throws SQLException { } // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg1.d2"); - statement.execute("SET DEVICE TEMPLATE t3 TO root.sg1.d3"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db1.d2"); + statement.execute("SET DEVICE TEMPLATE t3 TO root.db1.d3"); // test drop template which has been set try { @@ -135,25 +135,25 @@ public void testCreateTemplateAndCreateTimeseries() throws SQLException { e.getMessage()); } - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { Assert.assertFalse(resultSet.next()); } // create timeseries of device template - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d1"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d2"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d3"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d1"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d2"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d3"); Set expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d1.s1,INT64,TS_2DIFF,LZ4", - "root.sg1.d1.s2,DOUBLE,GORILLA,LZ4", - "root.sg1.d2.s1,INT64,TS_2DIFF,LZ4", - "root.sg1.d2.s2,DOUBLE,GORILLA,LZ4", - "root.sg1.d3.s1,INT64,TS_2DIFF,LZ4")); + "root.db1.d1.s1,INT64,TS_2DIFF,LZ4", + "root.db1.d1.s2,DOUBLE,GORILLA,LZ4", + "root.db1.d2.s1,INT64,TS_2DIFF,LZ4", + "root.db1.d2.s2,DOUBLE,GORILLA,LZ4", + "root.db1.d3.s1,INT64,TS_2DIFF,LZ4")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**"); ) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**"); ) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -169,15 +169,15 @@ public void testCreateTemplateAndCreateTimeseries() throws SQLException { } Assert.assertTrue(expectedResult.isEmpty()); - try (ResultSet resultSet = statement.executeQuery("COUNT TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("COUNT TIMESERIES root.db1.**")) { resultSet.next(); Assert.assertEquals(5, resultSet.getLong(1)); } expectedResult = - new HashSet<>(Arrays.asList("root.sg1.d1,false", "root.sg1.d2,true", "root.sg1.d3,true")); + new HashSet<>(Arrays.asList("root.db1.d1,false", "root.db1.d2,true", "root.db1.d3,true")); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db1.**")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.DEVICE) @@ -190,11 +190,11 @@ public void testCreateTemplateAndCreateTimeseries() throws SQLException { Assert.assertTrue(expectedResult.isEmpty()); try { - statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.sg1.d1"); + statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.db1.d1"); fail(); } catch (SQLException e) { Assert.assertEquals( - TSStatusCode.TEMPLATE_IS_IN_USE.getStatusCode() + ": Template is in use on root.sg1.d1", + TSStatusCode.TEMPLATE_IS_IN_USE.getStatusCode() + ": Template is in use on root.db1.d1", e.getMessage()); } } @@ -216,26 +216,26 @@ public void testCreateAndSetSchemaTemplate() throws SQLException { } // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg1.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db1.d2"); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { Assert.assertFalse(resultSet.next()); } // set using device template - statement.execute("INSERT INTO root.sg1.d1(time,s1) VALUES (1,1)"); - statement.execute("INSERT INTO root.sg1.d2(time,s1) ALIGNED VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1) VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d2(time,s1) ALIGNED VALUES (1,1)"); Set expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d1.s1,INT64,TS_2DIFF,LZ4", - "root.sg1.d1.s2,DOUBLE,GORILLA,LZ4", - "root.sg1.d2.s1,INT64,TS_2DIFF,LZ4", - "root.sg1.d2.s2,DOUBLE,GORILLA,LZ4")); + "root.db1.d1.s1,INT64,TS_2DIFF,LZ4", + "root.db1.d1.s2,DOUBLE,GORILLA,LZ4", + "root.db1.d2.s1,INT64,TS_2DIFF,LZ4", + "root.db1.d2.s2,DOUBLE,GORILLA,LZ4")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -251,14 +251,14 @@ public void testCreateAndSetSchemaTemplate() throws SQLException { } Assert.assertTrue(expectedResult.isEmpty()); - try (ResultSet resultSet = statement.executeQuery("COUNT TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("COUNT TIMESERIES root.db1.**")) { resultSet.next(); Assert.assertEquals(4, resultSet.getLong(1)); } - expectedResult = new HashSet<>(Arrays.asList("root.sg1.d1,false", "root.sg1.d2,true")); + expectedResult = new HashSet<>(Arrays.asList("root.db1.d1,false", "root.db1.d2,true")); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db1.**")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.DEVICE) @@ -271,11 +271,11 @@ public void testCreateAndSetSchemaTemplate() throws SQLException { Assert.assertTrue(expectedResult.isEmpty()); try { - statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.sg1.d1"); + statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.db1.d1"); fail(); } catch (SQLException e) { Assert.assertEquals( - TSStatusCode.TEMPLATE_IS_IN_USE.getStatusCode() + ": Template is in use on root.sg1.d1", + TSStatusCode.TEMPLATE_IS_IN_USE.getStatusCode() + ": Template is in use on root.db1.d1", e.getMessage()); } } @@ -341,13 +341,13 @@ public void testShowPathsSetOrUsingSchemaTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d2"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg2.d1"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg2.d2"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg3.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg3.d2"); - statement.execute("INSERT INTO root.sg3.d2.verify(time, show) ALIGNED VALUES (1, 1)"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db2.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db2.d2"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db3.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db3.d2"); + statement.execute("INSERT INTO root.db3.d2.verify(time, show) ALIGNED VALUES (1, 1)"); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS USING DEVICE TEMPLATE t1")) { String resultRecord; @@ -358,12 +358,12 @@ public void testShowPathsSetOrUsingSchemaTemplate() throws SQLException { } // activate device template - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d2"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg2.d1"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d2"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db2.d1"); // show paths set device template String[] expectedResult = - new String[] {"root.sg1.d1", "root.sg2.d2", "root.sg1.d2", "root.sg2.d1"}; + new String[] {"root.db1.d1", "root.db2.d2", "root.db1.d2", "root.db2.d1"}; Set expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { String resultRecord; @@ -375,7 +375,7 @@ public void testShowPathsSetOrUsingSchemaTemplate() throws SQLException { } Assert.assertEquals(0, expectedResultSet.size()); - expectedResult = new String[] {"root.sg3.d1", "root.sg3.d2"}; + expectedResult = new String[] {"root.db3.d1", "root.db3.d2"}; expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t2")) { String resultRecord; @@ -387,7 +387,7 @@ public void testShowPathsSetOrUsingSchemaTemplate() throws SQLException { } Assert.assertEquals(0, expectedResultSet.size()); - expectedResult = new String[] {"root.sg1.d2", "root.sg2.d1"}; + expectedResult = new String[] {"root.db1.d2", "root.db2.d1"}; expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS USING DEVICE TEMPLATE t1")) { String resultRecord; @@ -437,15 +437,15 @@ public void testDeleteTimeSeriesWhenUsingTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg1.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db1.d2"); - statement.execute("CREATE TIMESERIES root.sg3.d1.s1 INT64"); + statement.execute("CREATE TIMESERIES root.db3.d1.s1 INT64"); // set using device template - statement.execute("INSERT INTO root.sg1.d1(time,s1) VALUES (1,1)"); - statement.execute("INSERT INTO root.sg1.d2(time,s1) ALIGNED VALUES (1,1)"); - statement.execute("INSERT INTO root.sg3.d1(time,s1) VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1) VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d2(time,s1) ALIGNED VALUES (1,1)"); + statement.execute("INSERT INTO root.db3.d1(time,s1) VALUES (1,1)"); Set expectedResult = new HashSet<>(Collections.singletonList("1,1,1,1,")); @@ -467,7 +467,7 @@ public void testDeleteTimeSeriesWhenUsingTemplate() throws SQLException { expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d1.s1,INT64,TS_2DIFF,LZ4", "root.sg1.d2.s1,INT64,TS_2DIFF,LZ4")); + "root.db1.d1.s1,INT64,TS_2DIFF,LZ4", "root.db1.d2.s1,INT64,TS_2DIFF,LZ4")); try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.**.s1")) { while (resultSet.next()) { @@ -498,12 +498,12 @@ public void testSchemaQueryAndFetchWithUnrelatedTemplate() throws SQLException { statement.execute("CREATE DEVICE TEMPLATE t4 (s3 INT64, s4 DOUBLE)"); // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t4 TO root.sg1.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t4 TO root.db1.d2"); // set using device template - statement.execute("INSERT INTO root.sg1.d1(time,s1) VALUES (1,1)"); - statement.execute("INSERT INTO root.sg1.d2(time,s3) VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1) VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d2(time,s3) VALUES (1,1)"); Set expectedResult = new HashSet<>(Collections.singletonList("1,1,")); @@ -521,7 +521,7 @@ public void testSchemaQueryAndFetchWithUnrelatedTemplate() throws SQLException { Assert.assertTrue(expectedResult.isEmpty()); expectedResult = - new HashSet<>(Collections.singletonList("root.sg1.d1.s1,INT64,TS_2DIFF,LZ4")); + new HashSet<>(Collections.singletonList("root.db1.d1.s1,INT64,TS_2DIFF,LZ4")); try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.**.s1")) { while (resultSet.next()) { @@ -546,17 +546,17 @@ public void testInsertDataWithMeasurementsBeyondTemplate() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); // insert data and auto activate device template - statement.execute("INSERT INTO root.sg1.d1(time,s1,s2) VALUES (1,1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1,s2) VALUES (1,1,1)"); // insert twice to make sure the timeseries in template has been cached - statement.execute("INSERT INTO root.sg1.d1(time,s1,s2) VALUES (2,1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1,s2) VALUES (2,1,1)"); // insert data with extra measurement s3 which should be checked by schema fetch and auto // created - statement.execute("INSERT INTO root.sg1.d1(time,s1,s2,s3) VALUES (2,1,1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1,s2,s3) VALUES (2,1,1,1)"); - try (ResultSet resultSet = statement.executeQuery("count timeseries root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("count timeseries root.db1.**")) { Assert.assertTrue(resultSet.next()); long resultRecord = resultSet.getLong(1); Assert.assertEquals(3, resultRecord); @@ -569,9 +569,9 @@ public void testUnsetTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); // show paths set device template - String[] expectedResult = new String[] {"root.sg1.d1"}; + String[] expectedResult = new String[] {"root.db1.d1"}; Set expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { String resultRecord; @@ -583,7 +583,7 @@ public void testUnsetTemplate() throws SQLException { } Assert.assertEquals(0, expectedResultSet.size()); // unset device template - statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.sg1.d1"); + statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.db1.d1"); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { Assert.assertFalse(resultSet.next()); } @@ -595,9 +595,9 @@ public void testTemplateSetAndTimeSeriesExistenceCheck() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); // show paths set device template - String[] expectedResult = new String[] {"root.sg1.d1"}; + String[] expectedResult = new String[] {"root.db1.d1"}; Set expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { String resultRecord; @@ -610,34 +610,34 @@ public void testTemplateSetAndTimeSeriesExistenceCheck() throws SQLException { Assert.assertEquals(0, expectedResultSet.size()); try { - statement.execute("CREATE TIMESERIES root.sg1.d1.s INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.s INT32"); fail(); } catch (SQLException e) { Assert.assertEquals( - "516: Cannot create timeseries [root.sg1.d1.s] since device template [t1] already set on path [root.sg1.d1].", + "516: Cannot create timeseries [root.db1.d1.s] since device template [t1] already set on path [root.db1.d1].", e.getMessage()); } // unset device template - statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.sg1.d1"); + statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.db1.d1"); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { Assert.assertFalse(resultSet.next()); } - statement.execute("CREATE TIMESERIES root.sg1.d1.s INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.s INT32"); try { - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); } catch (SQLException e) { Assert.assertEquals( - "516: Cannot set device template [t1] to path [root.sg1.d1] since there's timeseries under path [root.sg1.d1].", + "516: Cannot set device template [t1] to path [root.db1.d1] since there's timeseries under path [root.db1.d1].", e.getMessage()); } - statement.execute("DELETE TIMESERIES root.sg1.d1.s"); + statement.execute("DELETE TIMESERIES root.db1.d1.s"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - expectedResult = new String[] {"root.sg1.d1"}; + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + expectedResult = new String[] {"root.db1.d1"}; expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { String resultRecord; @@ -649,22 +649,22 @@ public void testTemplateSetAndTimeSeriesExistenceCheck() throws SQLException { } Assert.assertEquals(0, expectedResultSet.size()); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d2.tmp.m"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d2.tmp.m"); try { - statement.execute("CREATE TIMESERIES root.sg1.d2 INT32"); + statement.execute("CREATE TIMESERIES root.db1.d2 INT32"); } catch (SQLException e) { Assert.assertEquals( - "516: Cannot create timeseries [root.sg1.d2] since device template [t1] already set on path [root.sg1.d2.tmp.m].", + "516: Cannot create timeseries [root.db1.d2] since device template [t1] already set on path [root.db1.d2.tmp.m].", e.getMessage()); } try { - statement.execute("CREATE TIMESERIES root.sg1.d2.s(tmp) INT32"); + statement.execute("CREATE TIMESERIES root.db1.d2.s(tmp) INT32"); } catch (SQLException e) { Assert.assertEquals( - "516: Cannot create timeseries [root.sg1.d2.s] since device template [t1] already set on path [root.sg1.d2.tmp.m].", + "516: Cannot create timeseries [root.db1.d2.s] since device template [t1] already set on path [root.db1.d2.tmp.m].", e.getMessage()); } - statement.execute("CREATE TIMESERIES root.sg1.d2.s INT32"); + statement.execute("CREATE TIMESERIES root.db1.d2.s INT32"); } } @@ -674,24 +674,24 @@ public void testShowTemplateSeriesWithFuzzyQuery() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg2"); - statement.execute("SET DEVICE TEMPLATE t3 TO root.sg3"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db2"); + statement.execute("SET DEVICE TEMPLATE t3 TO root.db3"); // activate device template - statement.execute("create timeseries using device template on root.sg1.d1"); - statement.execute("create timeseries using device template on root.sg2.d2"); - statement.execute("create timeseries using device template on root.sg3.d3"); + statement.execute("create timeseries using device template on root.db1.d1"); + statement.execute("create timeseries using device template on root.db2.d2"); + statement.execute("create timeseries using device template on root.db3.d3"); Set expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d1.s1,INT64,TS_2DIFF,LZ4", - "root.sg1.d1.s2,DOUBLE,GORILLA,LZ4", - "root.sg2.d2.s1,INT64,TS_2DIFF,LZ4", - "root.sg2.d2.s2,DOUBLE,GORILLA,LZ4", - "root.sg3.d3.s1,INT64,TS_2DIFF,LZ4")); + "root.db1.d1.s1,INT64,TS_2DIFF,LZ4", + "root.db1.d1.s2,DOUBLE,GORILLA,LZ4", + "root.db2.d2.s1,INT64,TS_2DIFF,LZ4", + "root.db2.d2.s2,DOUBLE,GORILLA,LZ4", + "root.db3.d3.s1,INT64,TS_2DIFF,LZ4")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg*.*.s*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db*.*.s*")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -709,9 +709,9 @@ public void testShowTemplateSeriesWithFuzzyQuery() throws Exception { expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d1.s1,INT64,TS_2DIFF,LZ4", "root.sg1.d1.s2,DOUBLE,GORILLA,LZ4")); + "root.db1.d1.s1,INT64,TS_2DIFF,LZ4", "root.db1.d1.s2,DOUBLE,GORILLA,LZ4")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.d1.s*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.d1.s*")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -736,7 +736,7 @@ public void testEmptySchemaTemplate() throws Exception { // create empty device template statement.execute("create device template e_t"); // set device template - statement.execute("SET DEVICE TEMPLATE e_t TO root.sg1"); + statement.execute("SET DEVICE TEMPLATE e_t TO root.db1"); try (ResultSet resultSet = statement.executeQuery("show nodes in device template e_t")) { Assert.assertFalse(resultSet.next()); } @@ -747,16 +747,16 @@ public void testEmptySchemaTemplate() throws Exception { } statement.execute("alter device template e_t add(s1 int32)"); - statement.execute("insert into root.sg1.d(time, s2, s3) values(1, 1, 1)"); + statement.execute("insert into root.db1.d(time, s2, s3) values(1, 1, 1)"); Set expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d.s1,INT32,TS_2DIFF,LZ4", - "root.sg1.d.s2,DOUBLE,GORILLA,LZ4", - "root.sg1.d.s3,DOUBLE,GORILLA,LZ4")); + "root.db1.d.s1,INT32,TS_2DIFF,LZ4", + "root.db1.d.s2,DOUBLE,GORILLA,LZ4", + "root.db1.d.s3,DOUBLE,GORILLA,LZ4")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg*.*.s*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db*.*.s*")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -778,18 +778,18 @@ public void testEmptySchemaTemplate() throws Exception { public void testLevelCountWithTemplate() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg1.d2"); - statement.execute("SET DEVICE TEMPLATE t3 TO root.sg1.d3"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db1.d2"); + statement.execute("SET DEVICE TEMPLATE t3 TO root.db1.d3"); // create timeseries of device template - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d1"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d2"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d3"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d1"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d2"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d3"); // count Set expectedResult = - new HashSet<>(Arrays.asList("root.sg1.d1,2", "root.sg1.d2,2", "root.sg1.d3,1")); + new HashSet<>(Arrays.asList("root.db1.d1,2", "root.db1.d2,2", "root.db1.d3,1")); try (ResultSet resultSet = - statement.executeQuery("COUNT TIMESERIES root.sg1.** group by level=2")) { + statement.executeQuery("COUNT TIMESERIES root.db1.** group by level=2")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.COLUMN) @@ -807,26 +807,26 @@ public void testLevelCountWithTemplate() throws Exception { public void testAlterTemplateTimeseries() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1;"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d1;"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1;"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d1;"); try { statement.execute( - "ALTER timeseries root.sg1.d1.s1 UPSERT tags(s0_tag1=s0_tag1, s0_tag2=s0_tag2) attributes(s0_attr1=s0_attr1, s0_attr2=s0_attr2);"); + "ALTER timeseries root.db1.d1.s1 UPSERT tags(s0_tag1=s0_tag1, s0_tag2=s0_tag2) attributes(s0_attr1=s0_attr1, s0_attr2=s0_attr2);"); Assert.fail("expect exception because the template timeseries does not support tag"); } catch (Exception e) { Assert.assertTrue( e.getMessage() .contains( - "Cannot alter template timeseries [root.sg1.d1.s1] since device template [t1] already set on path [root.sg1.d1]")); + "Cannot alter template timeseries [root.db1.d1.s1] since device template [t1] already set on path [root.db1.d1]")); } try { - statement.execute("ALTER timeseries root.sg1.d1.s1 UPSERT ALIAS=s0Alias;"); + statement.execute("ALTER timeseries root.db1.d1.s1 UPSERT ALIAS=s0Alias;"); Assert.fail("expect exception because the template timeseries does not support alias"); } catch (Exception e) { Assert.assertTrue( e.getMessage() .contains( - "Cannot alter template timeseries [root.sg1.d1.s1] since device template [t1] already set on path [root.sg1.d1]")); + "Cannot alter template timeseries [root.db1.d1.s1] since device template [t1] already set on path [root.db1.d1]")); } } } @@ -836,9 +836,9 @@ public void testActivateAndDropEmptyTemplate() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute("CREATE DEVICE TEMPLATE e_t;"); - statement.execute("SET DEVICE TEMPLATE e_t TO root.sg1.t.d1;"); - statement.execute("insert into root.sg1.t.d2(timestamp,s1) values(now(),false);"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.t.d1;"); + statement.execute("SET DEVICE TEMPLATE e_t TO root.db1.t.d1;"); + statement.execute("insert into root.db1.t.d2(timestamp,s1) values(now(),false);"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.t.d1;"); try (ResultSet resultSet = statement.executeQuery("show nodes in device template e_t")) { Assert.assertFalse(resultSet.next()); } @@ -846,8 +846,8 @@ public void testActivateAndDropEmptyTemplate() throws Exception { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.sg1.t.d1;"); - statement.execute("UNSET DEVICE TEMPLATE e_t FROM root.sg1.t.d1;"); + statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.db1.t.d1;"); + statement.execute("UNSET DEVICE TEMPLATE e_t FROM root.db1.t.d1;"); try (ResultSet resultSet = statement.executeQuery("show paths set device template e_t")) { Assert.assertFalse(resultSet.next()); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterMixQuotaIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterMixQuotaIT.java index e910918e1c485..3afa41b075361 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterMixQuotaIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterMixQuotaIT.java @@ -54,49 +54,49 @@ public void testClusterSchemaQuota2() { Statement statement = connection.createStatement()) { try { statement.execute( - "create timeseries root.sg1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } try { - statement.execute("create timeseries of device template on root.sg2.d2;"); + statement.execute("create timeseries of device template on root.db2.d2;"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } // delete some timeseries and database - statement.execute("delete database root.sg2;"); - statement.execute("delete timeseries root.sg1.d0.s0;"); + statement.execute("delete database root.db2;"); + statement.execute("delete timeseries root.db1.d0.s0;"); Thread.sleep(2000); // wait heartbeat // now we can create 3 new timeseries and 1 new device - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d4"); - statement.execute("create timeseries of device template on root.sg1.d4"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d4"); + statement.execute("create timeseries of device template on root.db1.d4"); statement.execute( - "create timeseries root.sg1.d1.s3 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d1.s3 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Thread.sleep(2000); // wait heartbeat try { statement.execute( - "create timeseries root.sg1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } try { statement.execute( - "create timeseries root.sg1.d1.s4 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d1.s4 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } try { - statement.execute("insert into root.sg1.d1(timestamp,s4) values(1,1.0)"); + statement.execute("insert into root.db1.d1(timestamp,s4) values(1,1.0)"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } try { - statement.execute("insert into root.sg1.d4(timestamp,s4) values(1,1.0)"); + statement.execute("insert into root.db1.d4(timestamp,s4) values(1,1.0)"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterQuotaIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterQuotaIT.java index 8eea7fc04709d..dfc3fa1c7b231 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterQuotaIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterQuotaIT.java @@ -52,21 +52,21 @@ private void prepareTimeSeries() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // create database - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE DATABASE root.sg2"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE DATABASE root.db2"); // create device template statement.execute("CREATE DEVICE TEMPLATE t1 (s1 INT64, s2 DOUBLE)"); // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db2"); statement.execute( - "create timeseries root.sg1.d0.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d0.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); statement.execute( - "create timeseries root.sg1.d0.s1 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d0.s1 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); statement.execute( - "create timeseries root.sg1.d1.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d1.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); statement.execute( - "create timeseries root.sg1.d1.s1 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); - statement.execute("create timeseries of device template on root.sg2.d1;"); + "create timeseries root.db1.d1.s1 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + statement.execute("create timeseries of device template on root.db2.d1;"); } } @@ -76,30 +76,30 @@ public void testClusterSchemaQuota() { Statement statement = connection.createStatement()) { try { statement.execute( - "create timeseries root.sg1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } try { - statement.execute("create timeseries of device template on root.sg2.d2;"); + statement.execute("create timeseries of device template on root.db2.d2;"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } // delete some timeseries and database - statement.execute("delete database root.sg2;"); - statement.execute("delete timeseries root.sg1.d0.s0;"); + statement.execute("delete database root.db2;"); + statement.execute("delete timeseries root.db1.d0.s0;"); Thread.sleep(2000); // wait heartbeat // now we can create 3 new timeseries or 1 new device - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d4"); - statement.execute("create timeseries of device template on root.sg1.d4"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d4"); + statement.execute("create timeseries of device template on root.db1.d4"); statement.execute( - "create timeseries root.sg1.d1.s3 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d1.s3 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Thread.sleep(2000); // wait heartbeat try { statement.execute( - "create timeseries root.sg1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanIT.java index 7b4f5ab78b039..f767f2999c757 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanIT.java @@ -49,78 +49,78 @@ public class IoTDBActiveRegionScanIT extends AbstractSchemaIT { // https://docs.google.com/spreadsheets/d/11tNRIaHmNdFWc0RC4yAloO6JJbmo9S5qxwAqWxeVY6c/edit#gid=0 public static final String[] common_insert_sqls = new String[] { - "create aligned timeseries root.sg.aligned.d1(s1 INT32 encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY)", - "create aligned timeseries root.sg.aligned.d2(s3 BOOLEAN, s4 TEXT)", - "create timeseries root.sg.unaligned.d2.s1 WITH DATATYPE=INT64, encoding=RLE", - "create timeseries root.sg.unaligned.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", - "create timeseries root.sg.unaligned.d3.s4 WITH DATATYPE=INT32, encoding=Gorilla", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(1, 1, 2)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(2, 2, 3)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(3, 3, 4)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(5, 5, 6)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(6, 6, 7)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(7, 7, 8)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(8, null, 9)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(9, 9, 10)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(10, 10, 11)", + "create aligned timeseries root.db.aligned.d1(s1 INT32 encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY)", + "create aligned timeseries root.db.aligned.d2(s3 BOOLEAN, s4 TEXT)", + "create timeseries root.db.unaligned.d2.s1 WITH DATATYPE=INT64, encoding=RLE", + "create timeseries root.db.unaligned.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", + "create timeseries root.db.unaligned.d3.s4 WITH DATATYPE=INT32, encoding=Gorilla", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(1, 1, 2)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(2, 2, 3)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(3, 3, 4)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(5, 5, 6)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(6, 6, 7)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(7, 7, 8)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(8, null, 9)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(9, 9, 10)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(10, 10, 11)", "flush", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(5, FALSE, 'aligned_test1')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(6, TRUE, 'aligned_test2')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(7, TRUE, 'aligned_test3')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(8, null, 'aligned_test4')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(9, TRUE, 'aligned_test5')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(10, TRUE, 'aligned_test6')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(12, TRUE, 'aligned_test8')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(13, TRUE, null)", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(14, TRUE, 'aligned_test10')", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(11, 11, 12)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(12, 12, 13)", - "insert into root.sg.unaligned.d2(time, s1) values(1, 1)", - "insert into root.sg.unaligned.d2(time, s1) values(2, 2)", - "insert into root.sg.unaligned.d2(time, s1) values(3, 3)", - "insert into root.sg.unaligned.d2(time, s1) values(4, 4)", - "insert into root.sg.unaligned.d2(time, s1) values(5, 5)", - "insert into root.sg.unaligned.d2(time, s1) values(7, null)", - "insert into root.sg.unaligned.d2(time, s1) values(8, 8)", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(5, FALSE, 'aligned_test1')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(6, TRUE, 'aligned_test2')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(7, TRUE, 'aligned_test3')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(8, null, 'aligned_test4')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(9, TRUE, 'aligned_test5')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(10, TRUE, 'aligned_test6')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(12, TRUE, 'aligned_test8')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(13, TRUE, null)", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(14, TRUE, 'aligned_test10')", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(11, 11, 12)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(12, 12, 13)", + "insert into root.db.unaligned.d2(time, s1) values(1, 1)", + "insert into root.db.unaligned.d2(time, s1) values(2, 2)", + "insert into root.db.unaligned.d2(time, s1) values(3, 3)", + "insert into root.db.unaligned.d2(time, s1) values(4, 4)", + "insert into root.db.unaligned.d2(time, s1) values(5, 5)", + "insert into root.db.unaligned.d2(time, s1) values(7, null)", + "insert into root.db.unaligned.d2(time, s1) values(8, 8)", "flush", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(20, 1, 2)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(22, 2, 3)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(23, 3, 4)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(25, 5, 6)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(26, 6, 7)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(27, 7, 8)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(28, null, 9)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(29, 9, 10)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(30, 10, 11)", - "insert into root.sg.unaligned.d2(time, s2) values(22, 1)", - "insert into root.sg.unaligned.d2(time, s2) values(24, 2)", - "insert into root.sg.unaligned.d3(time, s4) values(22, 1)", - "insert into root.sg.unaligned.d3(time, s4) values(23, 2)", - "insert into root.sg.unaligned.d3(time, s4) values(24, 3)", - "insert into root.sg.unaligned.d3(time, s4) values(25, 4)", - "insert into root.sg.unaligned.d3(time, s4) values(26, 5)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(20, 1, 2)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(22, 2, 3)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(23, 3, 4)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(25, 5, 6)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(26, 6, 7)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(27, 7, 8)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(28, null, 9)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(29, 9, 10)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(30, 10, 11)", + "insert into root.db.unaligned.d2(time, s2) values(22, 1)", + "insert into root.db.unaligned.d2(time, s2) values(24, 2)", + "insert into root.db.unaligned.d3(time, s4) values(22, 1)", + "insert into root.db.unaligned.d3(time, s4) values(23, 2)", + "insert into root.db.unaligned.d3(time, s4) values(24, 3)", + "insert into root.db.unaligned.d3(time, s4) values(25, 4)", + "insert into root.db.unaligned.d3(time, s4) values(26, 5)", "flush", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(40, TRUE, 'aligned_test1')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(42, TRUE, 'aligned_test2')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(41, TRUE, 'aligned_test3')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(43, TRUE, 'aligned_test4')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(44, TRUE, 'aligned_test5')", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(40, 1, 2)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(42, 2, 3)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(44, 3, 4)", - "insert into root.sg.unaligned.d2(time, s1) values(40, 1)", - "insert into root.sg.unaligned.d2(time, s1) values(41, 2)", - "insert into root.sg.unaligned.d2(time, s1) values(42, 3)", - "insert into root.sg.unaligned.d2(time, s1) values(43, 4)", - "insert into root.sg.unaligned.d2(time, s1) values(44, 5)", - "insert into root.sg.unaligned.d2(time, s1) values(45, 6)", - "insert into root.sg.unaligned.d2(time, s2) values(40, 1)", - "insert into root.sg.unaligned.d2(time, s2) values(41, 2)", - "insert into root.sg.unaligned.d2(time, s2) values(42, 3)", - "insert into root.sg.unaligned.d2(time, s2) values(43, 4)", - "insert into root.sg.unaligned.d3(time, s4) values(40, 1)", - "insert into root.sg.unaligned.d3(time, s4) values(41, 2)", - "insert into root.sg.unaligned.d3(time, s4) values(42, 3)", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(40, TRUE, 'aligned_test1')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(42, TRUE, 'aligned_test2')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(41, TRUE, 'aligned_test3')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(43, TRUE, 'aligned_test4')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(44, TRUE, 'aligned_test5')", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(40, 1, 2)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(42, 2, 3)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(44, 3, 4)", + "insert into root.db.unaligned.d2(time, s1) values(40, 1)", + "insert into root.db.unaligned.d2(time, s1) values(41, 2)", + "insert into root.db.unaligned.d2(time, s1) values(42, 3)", + "insert into root.db.unaligned.d2(time, s1) values(43, 4)", + "insert into root.db.unaligned.d2(time, s1) values(44, 5)", + "insert into root.db.unaligned.d2(time, s1) values(45, 6)", + "insert into root.db.unaligned.d2(time, s2) values(40, 1)", + "insert into root.db.unaligned.d2(time, s2) values(41, 2)", + "insert into root.db.unaligned.d2(time, s2) values(42, 3)", + "insert into root.db.unaligned.d2(time, s2) values(43, 4)", + "insert into root.db.unaligned.d3(time, s4) values(40, 1)", + "insert into root.db.unaligned.d3(time, s4) values(41, 2)", + "insert into root.db.unaligned.d3(time, s4) values(42, 3)", }; public static final String[] SHOW_DEVICES_COLUMN_NAMES = @@ -184,7 +184,7 @@ public void showActiveDeviceTest() { String sql = "show devices where time = 4"; String[] retArray = new String[] { - "root.sg.unaligned.d2", + "root.db.unaligned.d2", }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); @@ -198,7 +198,7 @@ public void showActiveDeviceTest2() { String sql = "show devices where time >= 6 and time <=10"; String[] retArray = new String[] { - "root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d2", + "root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d2", }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); @@ -212,7 +212,7 @@ public void showActiveDeviceTest3() { String sql = "show devices where time >= 6 and time <=30"; String[] retArray = new String[] { - "root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d2", "root.sg.unaligned.d3" + "root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d2", "root.db.unaligned.d3" }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); @@ -224,7 +224,7 @@ public void showActiveDeviceTest3() { @Test public void showActiveDeviceTest4() { String sql = "show devices where time >= 25 and time <= 28"; - String[] retArray = new String[] {"root.sg.aligned.d1", "root.sg.unaligned.d3"}; + String[] retArray = new String[] {"root.db.aligned.d1", "root.db.unaligned.d3"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); sql = "count devices where time >= 25 and time <= 28"; @@ -237,7 +237,7 @@ public void showActiveDeviceTest5() { String sql = "show devices where time >= 40 and time <= 44"; String[] retArray = new String[] { - "root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d2", "root.sg.unaligned.d3" + "root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d2", "root.db.unaligned.d3" }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); @@ -251,22 +251,22 @@ public void showActiveDeviceTest6() { String sql = "show devices where time >= 43 and time < 44"; String[] retArray = new String[] { - "root.sg.aligned.d2", "root.sg.unaligned.d2", + "root.db.aligned.d2", "root.db.unaligned.d2", }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); } @Test public void showActiveDeviceTest7() { - String sql = "show devices root.sg.** where time > 45"; + String sql = "show devices root.db.** where time > 45"; String[] retArray = new String[] {}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); } @Test public void showActiveDeviceTest8() { - String sql = "show devices root.sg.** where time > 44 or time < 4"; - String[] retArray = new String[] {"root.sg.aligned.d1", "root.sg.unaligned.d2"}; + String sql = "show devices root.db.** where time > 44 or time < 4"; + String[] retArray = new String[] {"root.db.aligned.d1", "root.db.unaligned.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); } @@ -274,7 +274,7 @@ public void showActiveDeviceTest8() { public void showActiveDeviceTest9() { String sql = "show devices where time = 8"; String[] retArray = - new String[] {"root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d2"}; + new String[] {"root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); } @@ -283,7 +283,7 @@ public void showActiveDeviceTest10() { String sql = "show devices where time < 50"; String[] retArray = new String[] { - "root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d3", "root.sg.unaligned.d2" + "root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d3", "root.db.unaligned.d2" }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); } @@ -315,7 +315,7 @@ public void showActiveTimeseriesTest() { String sql = "show timeseries where time = 4"; String[] retArray = new String[] { - "root.sg.unaligned.d2.s1", + "root.db.unaligned.d2.s1", }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); } @@ -325,11 +325,11 @@ public void showActiveTimeseriesTest2() { String sql = "show timeseries where time >= 6 and time <=10"; String[] retArray = new String[] { - "root.sg.aligned.d1.s1", - "root.sg.aligned.d1.s2", - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", + "root.db.aligned.d1.s1", + "root.db.aligned.d1.s2", + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); @@ -340,13 +340,13 @@ public void showActiveTimeseriesTest3() { String sql = "show timeseries where time >= 6 and time <=30"; String[] retArray = new String[] { - "root.sg.aligned.d1.s1", - "root.sg.aligned.d1.s2", - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", - "root.sg.unaligned.d2.s2", - "root.sg.unaligned.d3.s4" + "root.db.aligned.d1.s1", + "root.db.aligned.d1.s2", + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", + "root.db.unaligned.d2.s2", + "root.db.unaligned.d3.s4" }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); } @@ -355,7 +355,7 @@ public void showActiveTimeseriesTest3() { public void showActiveTimeseriesTest4() { String sql = "show timeseries where time >= 25 and time <= 28"; String[] retArray = - new String[] {"root.sg.aligned.d1.s1", "root.sg.aligned.d1.s2", "root.sg.unaligned.d3.s4"}; + new String[] {"root.db.aligned.d1.s1", "root.db.aligned.d1.s2", "root.db.unaligned.d3.s4"}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); } @@ -364,13 +364,13 @@ public void showActiveTimeseriesTest5() { String sql = "show timeseries where time >= 40 and time <= 44"; String[] retArray = new String[] { - "root.sg.aligned.d1.s1", - "root.sg.aligned.d1.s2", - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", - "root.sg.unaligned.d2.s2", - "root.sg.unaligned.d3.s4" + "root.db.aligned.d1.s1", + "root.db.aligned.d1.s2", + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", + "root.db.unaligned.d2.s2", + "root.db.unaligned.d3.s4" }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); @@ -384,10 +384,10 @@ public void showActiveTimeseriesTest6() { String sql = "show timeseries where time >= 43 and time < 44"; String[] retArray = new String[] { - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", - "root.sg.unaligned.d2.s2" + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", + "root.db.unaligned.d2.s2" }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); @@ -398,23 +398,23 @@ public void showActiveTimeseriesTest6() { @Test public void showActiveTimeseriesTest7() { - String sql = "show timeseries root.sg.** where time > 45"; + String sql = "show timeseries root.db.** where time > 45"; String[] retArray = new String[] {}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); - sql = "count timeseries root.sg.** where time > 45"; + sql = "count timeseries root.db.** where time > 45"; long value = 0; basicCountActiveDeviceTest(sql, COUNT_TIMESERIES_COLUMN_NAMES, value); } @Test public void showActiveTimeseriesTest8() { - String sql = "show timeseries root.sg.** where time > 44 or time < 4"; + String sql = "show timeseries root.db.** where time > 44 or time < 4"; String[] retArray = - new String[] {"root.sg.aligned.d1.s1", "root.sg.aligned.d1.s2", "root.sg.unaligned.d2.s1"}; + new String[] {"root.db.aligned.d1.s1", "root.db.aligned.d1.s2", "root.db.unaligned.d2.s1"}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); - sql = "count timeseries root.sg.** where time > 44 or time < 4"; + sql = "count timeseries root.db.** where time > 44 or time < 4"; long value = 3; basicCountActiveDeviceTest(sql, COUNT_TIMESERIES_COLUMN_NAMES, value); } @@ -423,7 +423,7 @@ public void showActiveTimeseriesTest8() { public void showActiveTimeseriesTest9() { String sql = "show timeseries where time = 8"; String[] retArray = - new String[] {"root.sg.aligned.d1.s2", "root.sg.aligned.d2.s4", "root.sg.unaligned.d2.s1"}; + new String[] {"root.db.aligned.d1.s2", "root.db.aligned.d2.s4", "root.db.unaligned.d2.s1"}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); sql = "count timeseries where time = 8"; @@ -436,13 +436,13 @@ public void showActiveTimeseriesTest10() { String sql = "show timeseries where time < 50"; String[] retArray = new String[] { - "root.sg.aligned.d1.s1", - "root.sg.aligned.d1.s2", - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", - "root.sg.unaligned.d2.s2", - "root.sg.unaligned.d3.s4" + "root.db.aligned.d1.s1", + "root.db.aligned.d1.s2", + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", + "root.db.unaligned.d2.s2", + "root.db.unaligned.d3.s4" }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithModsIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithModsIT.java index 2f614a4763d9d..3f1198161ddec 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithModsIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithModsIT.java @@ -45,13 +45,13 @@ public class IoTDBActiveRegionScanWithModsIT extends AbstractSchemaIT { private static String[] delete_sqls = new String[] { - "delete from root.sg.aligned.** where time >= 1 and time <= 3", - "delete from root.sg.aligned.d1.* where time = 20", - "delete from root.sg.aligned.d2.* where time = 30", + "delete from root.db.aligned.** where time >= 1 and time <= 3", + "delete from root.db.aligned.d1.* where time = 20", + "delete from root.db.aligned.d2.* where time = 30", "delete from root.** where time >=9 and time <=15", - "delete from root.sg.unaligned.** where time >= 20 and time <= 30", - "delete from root.sg.aligned.** where time > 40 and time <= 43", - "delete from root.sg.unaligned.d2.* where time > 40 and time <= 43" + "delete from root.db.unaligned.** where time >= 20 and time <= 30", + "delete from root.db.aligned.** where time > 40 and time <= 43", + "delete from root.db.unaligned.d2.* where time > 40 and time <= 43" }; public IoTDBActiveRegionScanWithModsIT(final SchemaTestMode schemaTestMode) { @@ -97,7 +97,7 @@ public static void after() throws Exception { @Test public void showActiveDataWithMods() { String sql = "show devices where time < 5"; - String[] retArray = new String[] {"root.sg.unaligned.d2"}; + String[] retArray = new String[] {"root.db.unaligned.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); sql = "count devices where time < 5"; @@ -105,7 +105,7 @@ public void showActiveDataWithMods() { basicCountActiveDeviceTest(sql, COUNT_DEVICES_COLUMN_NAMES, value); sql = "show timeseries where time < 5"; - retArray = new String[] {"root.sg.unaligned.d2.s1"}; + retArray = new String[] {"root.db.unaligned.d2.s1"}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); sql = "count timeseries where time < 5"; @@ -116,7 +116,7 @@ public void showActiveDataWithMods() { @Test public void showActiveDataWithMods2() { String sql = "show devices where time < 31 and time > 15"; - String[] retArray = new String[] {"root.sg.aligned.d1"}; + String[] retArray = new String[] {"root.db.aligned.d1"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); sql = "count devices where time < 31 and time > 15"; @@ -126,7 +126,7 @@ public void showActiveDataWithMods2() { sql = "show timeseries where time < 31 and time > 15"; retArray = new String[] { - "root.sg.aligned.d1.s1", "root.sg.aligned.d1.s2", + "root.db.aligned.d1.s1", "root.db.aligned.d1.s2", }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); @@ -139,7 +139,7 @@ public void showActiveDataWithMods2() { public void showActiveDataWithMods3() { String sql = "show devices where time > 7 and time < 20"; String[] retArray = - new String[] {"root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d2"}; + new String[] {"root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); sql = "count devices where time > 7 and time < 20"; @@ -148,7 +148,7 @@ public void showActiveDataWithMods3() { sql = "show timeseries where time > 7 and time < 20"; retArray = - new String[] {"root.sg.aligned.d1.s2", "root.sg.aligned.d2.s4", "root.sg.unaligned.d2.s1"}; + new String[] {"root.db.aligned.d1.s2", "root.db.aligned.d2.s4", "root.db.unaligned.d2.s1"}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); sql = "count timeseries where time > 7 and time < 20"; @@ -158,33 +158,33 @@ public void showActiveDataWithMods3() { @Test public void showActiveDataWithMods4() { - String sql = "show devices root.sg.** where time > 40"; + String sql = "show devices root.db.** where time > 40"; String[] retArray = new String[] { - "root.sg.aligned.d1", - "root.sg.aligned.d2", - "root.sg.unaligned.d2", - "root.sg.unaligned.d3", + "root.db.aligned.d1", + "root.db.aligned.d2", + "root.db.unaligned.d2", + "root.db.unaligned.d3", }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); - sql = "count devices root.sg.** where time > 40"; + sql = "count devices root.db.** where time > 40"; long value = 4; basicCountActiveDeviceTest(sql, COUNT_DEVICES_COLUMN_NAMES, value); - sql = "show timeseries root.sg.** where time > 40"; + sql = "show timeseries root.db.** where time > 40"; retArray = new String[] { - "root.sg.aligned.d1.s1", - "root.sg.aligned.d1.s2", - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", - "root.sg.unaligned.d3.s4", + "root.db.aligned.d1.s1", + "root.db.aligned.d1.s2", + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", + "root.db.unaligned.d3.s4", }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); - sql = "count timeseries root.sg.** where time > 40"; + sql = "count timeseries root.db.** where time > 40"; value = 6; basicCountActiveDeviceTest(sql, COUNT_TIMESERIES_COLUMN_NAMES, value); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithTTLIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithTTLIT.java index 124b37323036e..5fe7a3ffadb4a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithTTLIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithTTLIT.java @@ -44,23 +44,23 @@ public IoTDBActiveRegionScanWithTTLIT(final SchemaTestMode schemaTestMode) { private static String[] sqls = new String[] { - "create timeseries root.sg.d1.s1 WITH DATATYPE=INT64, encoding=RLE", - "create timeseries root.sg.d1.s2 WITH DATATYPE=INT32, encoding=Gorilla", - "create timeseries root.sg.d2.s1 WITH DATATYPE=INT64, encoding=RLE", - "create timeseries root.sg.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", - "insert into root.sg.d1(time, s1, s2) values(1, 1, 2)", - "insert into root.sg.d1(time, s1, s2) values(2, 2, 3)", - "insert into root.sg.d1(time, s1, s2) values(3, 3, 4)", - "insert into root.sg.d1(time, s1, s2) values(5, 5, 6)", - "insert into root.sg.d1(time, s1, s2) values(6, 6, 7)", - "insert into root.sg.d1(time, s1, s2) values(7, 7, 8)", - "insert into root.sg.d1(time, s1, s2) values(8, null, 9)", - "insert into root.sg.d1(time, s1, s2) values(9, 9, 10)", - "insert into root.sg.d1(time, s1, s2) values(10, 10, 11)", + "create timeseries root.db.d1.s1 WITH DATATYPE=INT64, encoding=RLE", + "create timeseries root.db.d1.s2 WITH DATATYPE=INT32, encoding=Gorilla", + "create timeseries root.db.d2.s1 WITH DATATYPE=INT64, encoding=RLE", + "create timeseries root.db.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", + "insert into root.db.d1(time, s1, s2) values(1, 1, 2)", + "insert into root.db.d1(time, s1, s2) values(2, 2, 3)", + "insert into root.db.d1(time, s1, s2) values(3, 3, 4)", + "insert into root.db.d1(time, s1, s2) values(5, 5, 6)", + "insert into root.db.d1(time, s1, s2) values(6, 6, 7)", + "insert into root.db.d1(time, s1, s2) values(7, 7, 8)", + "insert into root.db.d1(time, s1, s2) values(8, null, 9)", + "insert into root.db.d1(time, s1, s2) values(9, 9, 10)", + "insert into root.db.d1(time, s1, s2) values(10, 10, 11)", "flush", - "insert into root.sg.d2(time, s1, s2) values(now(), null, 9)", - "insert into root.sg.d2(time, s1, s2) values(now(), 9, 10)", - "insert into root.sg.d2(time, s1, s2) values(now(), 10, 11)" + "insert into root.db.d2(time, s1, s2) values(now(), null, 9)", + "insert into root.db.d2(time, s1, s2) values(now(), 9, 10)", + "insert into root.db.d2(time, s1, s2) values(now(), 10, 11)" }; public static void insertData() { @@ -77,7 +77,7 @@ public static void insertData() { } private static void setTTL() { - final String[] ttl_sqls = {"set ttl to root.sg.d1 3600000", "set ttl to root.sg.d2 3600000"}; + final String[] ttl_sqls = {"set ttl to root.db.d1 3600000", "set ttl to root.db.d2 3600000"}; try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { for (final String sql : ttl_sqls) { @@ -90,7 +90,7 @@ private static void setTTL() { } private static void unsetTTL() { - final String[] ttl_sqls = {"unset ttl to root.sg.d1", "unset ttl to root.sg.d2"}; + final String[] ttl_sqls = {"unset ttl to root.db.d1", "unset ttl to root.db.d2"}; try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { for (final String sql : ttl_sqls) { @@ -123,13 +123,13 @@ public static void after() throws Exception { @Test public void showActiveDataWithMods() { - final String sql = "show devices root.sg.** where time > 0"; - String[] retArray = new String[] {"root.sg.d1", "root.sg.d2"}; + final String sql = "show devices root.db.** where time > 0"; + String[] retArray = new String[] {"root.db.d1", "root.db.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); setTTL(); - retArray = new String[] {"root.sg.d2"}; + retArray = new String[] {"root.db.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); unsetTTL(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveSchemaQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveSchemaQueryIT.java index c0e7673d7d642..8145a3ee5c19c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveSchemaQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveSchemaQueryIT.java @@ -45,17 +45,17 @@ public class IoTDBActiveSchemaQueryIT extends AbstractSchemaIT { private static String[] sqls = new String[] { - "create aligned timeseries root.sg.d1(s1(alias1) int32 tags('tag1'='v1', 'tag2'='v2'), s2 double attributes('attr3'='v3'))", - "CREATE TIMESERIES root.sg.d0.s0 WITH DATATYPE=INT32", - "CREATE TIMESERIES root.sg.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2", - "CREATE TIMESERIES root.sg.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15", + "create aligned timeseries root.db.d1(s1(alias1) int32 tags('tag1'='v1', 'tag2'='v2'), s2 double attributes('attr3'='v3'))", + "CREATE TIMESERIES root.db.d0.s0 WITH DATATYPE=INT32", + "CREATE TIMESERIES root.db.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2", + "CREATE TIMESERIES root.db.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15", "CREATE DEVICE TEMPLATE t1 (s1 INT64 encoding=RLE compressor=SNAPPY, s2 INT32)", "CREATE DEVICE TEMPLATE t2 aligned(s1 INT64 encoding=RLE compressor=SNAPPY, s2 INT32)", - "SET DEVICE TEMPLATE t1 to root.sg.d2", - "SET DEVICE TEMPLATE t2 to root.sg.d3", - "CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg.d2", - "CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg.d3", - "set ttl to root.sg.d3 60000", + "SET DEVICE TEMPLATE t1 to root.db.d2", + "SET DEVICE TEMPLATE t2 to root.db.d3", + "CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db.d2", + "CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db.d3", + "set ttl to root.db.d3 60000", }; public IoTDBActiveSchemaQueryIT(SchemaTestMode schemaTestMode) { @@ -107,19 +107,19 @@ public void testShowTimeSeries() { Set expected = new HashSet<>( Arrays.asList( - "root.sg.d1.s1,alias1,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", - "root.sg.d1.s2,null,root.sg,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", - "root.sg.d0.s0,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d0.s1,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", - "root.sg.d0.s2,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,", - "root.sg.d2.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d2.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d3.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d3.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); - checkResultSet(statement, "show timeseries root.sg.**", expected); + "root.db.d1.s1,alias1,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", + "root.db.d1.s2,null,root.db,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", + "root.db.d0.s0,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d0.s1,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", + "root.db.d0.s2,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,", + "root.db.d2.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d2.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d3.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d3.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); + checkResultSet(statement, "show timeseries root.db.**", expected); // 1. Without any data, result set should be empty try (ResultSet resultSet = - statement.executeQuery("show timeseries root.sg.** where time>0")) { + statement.executeQuery("show timeseries root.db.** where time>0")) { Assert.assertFalse(resultSet.next()); } // 2. Insert data and check again. @@ -127,107 +127,107 @@ public void testShowTimeSeries() { // - root.db.d1.* time=2 // - root.db.d2.* time=3 // - root.db.d3.* time=now() - statement.execute("insert into root.sg.d0(timestamp,s0, s1, s2) values(1,1,1,1)"); - statement.execute("insert into root.sg.d1(timestamp,s1,s2) values(2,2,2)"); - statement.execute("insert into root.sg.d2(timestamp,s1,s2) values(3,3,3)"); - statement.execute("insert into root.sg.d3(timestamp,s1,s2) values(now(),4,4)"); + statement.execute("insert into root.db.d0(timestamp,s0, s1, s2) values(1,1,1,1)"); + statement.execute("insert into root.db.d1(timestamp,s1,s2) values(2,2,2)"); + statement.execute("insert into root.db.d2(timestamp,s1,s2) values(3,3,3)"); + statement.execute("insert into root.db.d3(timestamp,s1,s2) values(now(),4,4)"); expected = new HashSet<>( Arrays.asList( - "root.sg.d1.s1,alias1,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", - "root.sg.d1.s2,null,root.sg,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", - "root.sg.d0.s0,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d0.s1,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", - "root.sg.d0.s2,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,", - "root.sg.d2.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d2.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d3.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d3.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); - checkResultSet(statement, "show timeseries root.sg.** where time>0", expected); + "root.db.d1.s1,alias1,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", + "root.db.d1.s2,null,root.db,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", + "root.db.d0.s0,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d0.s1,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", + "root.db.d0.s2,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,", + "root.db.d2.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d2.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d3.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d3.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); + checkResultSet(statement, "show timeseries root.db.** where time>0", expected); checkResultSet( statement, - "count timeseries root.sg.** where time>0", + "count timeseries root.db.** where time>0", new HashSet<>(Collections.singletonList("9,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d1.s1,alias1,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", - "root.sg.d1.s2,null,root.sg,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", - "root.sg.d2.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d2.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d3.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d3.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); - checkResultSet(statement, "show timeseries root.sg.** where time>1", expected); + "root.db.d1.s1,alias1,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", + "root.db.d1.s2,null,root.db,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", + "root.db.d2.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d2.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d3.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d3.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); + checkResultSet(statement, "show timeseries root.db.** where time>1", expected); checkResultSet( statement, - "count timeseries root.sg.** where time>1", + "count timeseries root.db.** where time>1", new HashSet<>(Collections.singletonList("6,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d1.s1,alias1,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", - "root.sg.d1.s2,null,root.sg,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", - "root.sg.d2.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d2.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d3.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d3.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); - checkResultSet(statement, "show timeseries root.sg.** where time!=1", expected); + "root.db.d1.s1,alias1,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", + "root.db.d1.s2,null,root.db,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", + "root.db.d2.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d2.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d3.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d3.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); + checkResultSet(statement, "show timeseries root.db.** where time!=1", expected); checkResultSet( statement, - "count timeseries root.sg.** where time!=1", + "count timeseries root.db.** where time!=1", new HashSet<>(Collections.singletonList("6,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d0.s0,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d0.s1,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", - "root.sg.d0.s2,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,")); - checkResultSet(statement, "show timeseries root.sg.** where time<2", expected); + "root.db.d0.s0,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d0.s1,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", + "root.db.d0.s2,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,")); + checkResultSet(statement, "show timeseries root.db.** where time<2", expected); checkResultSet( statement, - "count timeseries root.sg.** where time<2", + "count timeseries root.db.** where time<2", new HashSet<>(Collections.singletonList("3,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d0.s0,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d0.s1,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", - "root.sg.d0.s2,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,")); - checkResultSet(statement, "show timeseries root.sg.** where time=1", expected); + "root.db.d0.s0,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d0.s1,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", + "root.db.d0.s2,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,")); + checkResultSet(statement, "show timeseries root.db.** where time=1", expected); checkResultSet( statement, - "count timeseries root.sg.** where time=1", + "count timeseries root.db.** where time=1", new HashSet<>(Collections.singletonList("3,"))); // 3. Check non-root user statement.execute("CREATE USER user1 'password123456'"); - statement.execute("GRANT READ_SCHEMA ON root.sg.d0.s1 TO USER user1"); - statement.execute("GRANT READ_SCHEMA ON root.sg.d3.s1 TO USER user1"); + statement.execute("GRANT READ_SCHEMA ON root.db.d0.s1 TO USER user1"); + statement.execute("GRANT READ_SCHEMA ON root.db.d3.s1 TO USER user1"); try (Connection userCon = EnvFactory.getEnv().getConnection("user1", "password123456"); Statement userStmt = userCon.createStatement()) { // 3.1 Without read data permission, result set should be empty try (ResultSet resultSet = - userStmt.executeQuery("show timeseries root.sg.** where time>0")) { + userStmt.executeQuery("show timeseries root.db.** where time>0")) { Assert.assertFalse(resultSet.next()); } checkResultSet( userStmt, - "count timeseries root.sg.** where time>0", + "count timeseries root.db.** where time>0", new HashSet<>(Collections.singletonList("0,"))); } - statement.execute("GRANT READ_DATA ON root.sg.d0.s1 TO USER user1"); - statement.execute("GRANT READ_DATA ON root.sg.d3.s1 TO USER user1"); + statement.execute("GRANT READ_DATA ON root.db.d0.s1 TO USER user1"); + statement.execute("GRANT READ_DATA ON root.db.d3.s1 TO USER user1"); try (Connection userCon = EnvFactory.getEnv().getConnection("user1", "password123456"); Statement userStmt = userCon.createStatement()) { // 3.2 With read data permission, result set should not be empty expected = new HashSet<>( Arrays.asList( - "root.sg.d0.s1,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", - "root.sg.d3.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,")); - checkResultSet(userStmt, "show timeseries root.sg.** where time>0", expected); + "root.db.d0.s1,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", + "root.db.d3.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,")); + checkResultSet(userStmt, "show timeseries root.db.** where time>0", expected); checkResultSet( userStmt, - "count timeseries root.sg.** where time>0", + "count timeseries root.db.** where time>0", new HashSet<>(Collections.singletonList("2,"))); } } catch (Exception e) { @@ -244,96 +244,96 @@ public void testShowDevices() { Set expected = new HashSet<>( Arrays.asList( - "root.sg.d0,false,null,INF,", - "root.sg.d1,true,null,INF,", - "root.sg.d2,false,t1,INF,", - "root.sg.d3,true,t2,60000,")); - checkResultSet(statement, "show devices root.sg.*", expected); + "root.db.d0,false,null,INF,", + "root.db.d1,true,null,INF,", + "root.db.d2,false,t1,INF,", + "root.db.d3,true,t2,60000,")); + checkResultSet(statement, "show devices root.db.*", expected); // 1. Without any data, result set should be empty - try (ResultSet resultSet = statement.executeQuery("show devices root.sg.* where time>0")) { + try (ResultSet resultSet = statement.executeQuery("show devices root.db.* where time>0")) { Assert.assertFalse(resultSet.next()); } // 2. Insert data and check again. - // - root.sg.d0.* time=1 - // - root.sg.d1.* time=2 - // - root.sg.d2.* time=3 - // - root.sg.d3.* time=now() - statement.execute("insert into root.sg.d0(timestamp,s0, s1, s2) values(1,1,1,1)"); - statement.execute("insert into root.sg.d1(timestamp,s1,s2) values(2,2,2)"); - statement.execute("insert into root.sg.d2(timestamp,s1,s2) values(3,3,3)"); - statement.execute("insert into root.sg.d3(timestamp,s1,s2) values(now(),4,4)"); + // - root.db.d0.* time=1 + // - root.db.d1.* time=2 + // - root.db.d2.* time=3 + // - root.db.d3.* time=now() + statement.execute("insert into root.db.d0(timestamp,s0, s1, s2) values(1,1,1,1)"); + statement.execute("insert into root.db.d1(timestamp,s1,s2) values(2,2,2)"); + statement.execute("insert into root.db.d2(timestamp,s1,s2) values(3,3,3)"); + statement.execute("insert into root.db.d3(timestamp,s1,s2) values(now(),4,4)"); expected = new HashSet<>( Arrays.asList( - "root.sg.d0,false,null,INF,", - "root.sg.d1,true,null,INF,", - "root.sg.d2,false,t1,INF,", - "root.sg.d3,true,t2,60000,")); - checkResultSet(statement, "show devices root.sg.* where time>0", expected); + "root.db.d0,false,null,INF,", + "root.db.d1,true,null,INF,", + "root.db.d2,false,t1,INF,", + "root.db.d3,true,t2,60000,")); + checkResultSet(statement, "show devices root.db.* where time>0", expected); checkResultSet( statement, - "count devices root.sg.* where time>0", + "count devices root.db.* where time>0", new HashSet<>(Collections.singletonList("4,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d1,true,null,INF,", - "root.sg.d2,false,t1,INF,", - "root.sg.d3,true,t2,60000,")); - checkResultSet(statement, "show devices root.sg.* where time>1", expected); + "root.db.d1,true,null,INF,", + "root.db.d2,false,t1,INF,", + "root.db.d3,true,t2,60000,")); + checkResultSet(statement, "show devices root.db.* where time>1", expected); checkResultSet( statement, - "count devices root.sg.* where time>1", + "count devices root.db.* where time>1", new HashSet<>(Collections.singletonList("3,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d1,true,null,INF,", - "root.sg.d2,false,t1,INF,", - "root.sg.d3,true,t2,60000,")); - checkResultSet(statement, "show devices root.sg.* where time!=1", expected); + "root.db.d1,true,null,INF,", + "root.db.d2,false,t1,INF,", + "root.db.d3,true,t2,60000,")); + checkResultSet(statement, "show devices root.db.* where time!=1", expected); checkResultSet( statement, - "count devices root.sg.* where time!=1", + "count devices root.db.* where time!=1", new HashSet<>(Collections.singletonList("3,"))); - expected = new HashSet<>(Collections.singletonList("root.sg.d0,false,null,INF,")); - checkResultSet(statement, "show devices root.sg.* where time<2", expected); + expected = new HashSet<>(Collections.singletonList("root.db.d0,false,null,INF,")); + checkResultSet(statement, "show devices root.db.* where time<2", expected); checkResultSet( statement, - "count devices root.sg.* where time<2", + "count devices root.db.* where time<2", new HashSet<>(Collections.singletonList("1,"))); - expected = new HashSet<>(Collections.singletonList("root.sg.d0,false,null,INF,")); - checkResultSet(statement, "show devices root.sg.* where time=1", expected); + expected = new HashSet<>(Collections.singletonList("root.db.d0,false,null,INF,")); + checkResultSet(statement, "show devices root.db.* where time=1", expected); checkResultSet( statement, - "count devices root.sg.* where time=1", + "count devices root.db.* where time=1", new HashSet<>(Collections.singletonList("1,"))); // 3. Check non-root user statement.execute("CREATE USER user1 'password123456'"); - statement.execute("GRANT READ_SCHEMA ON root.sg.d0.s1 TO USER user1"); - statement.execute("GRANT READ_SCHEMA ON root.sg.d3.s1 TO USER user1"); + statement.execute("GRANT READ_SCHEMA ON root.db.d0.s1 TO USER user1"); + statement.execute("GRANT READ_SCHEMA ON root.db.d3.s1 TO USER user1"); try (Connection userCon = EnvFactory.getEnv().getConnection("user1", "password123456"); Statement userStmt = userCon.createStatement()) { // 3.1 Without read data permission, result set should be empty - try (ResultSet resultSet = userStmt.executeQuery("show devices root.sg.* where time>0")) { + try (ResultSet resultSet = userStmt.executeQuery("show devices root.db.* where time>0")) { Assert.assertFalse(resultSet.next()); } checkResultSet( userStmt, - "count devices root.sg.* where time>0", + "count devices root.db.* where time>0", new HashSet<>(Collections.singletonList("0,"))); } - statement.execute("GRANT READ_DATA ON root.sg.d0.s1 TO USER user1"); - statement.execute("GRANT READ_DATA ON root.sg.d3.s1 TO USER user1"); + statement.execute("GRANT READ_DATA ON root.db.d0.s1 TO USER user1"); + statement.execute("GRANT READ_DATA ON root.db.d3.s1 TO USER user1"); try (Connection userCon = EnvFactory.getEnv().getConnection("user1", "password123456"); Statement userStmt = userCon.createStatement()) { // 3.2 With read data permission, result set should not be empty expected = - new HashSet<>(Arrays.asList("root.sg.d0,false,null,INF,", "root.sg.d3,true,t2,60000,")); - checkResultSet(userStmt, "show devices root.sg.* where time>0", expected); + new HashSet<>(Arrays.asList("root.db.d0,false,null,INF,", "root.db.d3,true,t2,60000,")); + checkResultSet(userStmt, "show devices root.db.* where time>0", expected); checkResultSet( userStmt, - "count devices root.sg.* where time>0", + "count devices root.db.* where time>0", new HashSet<>(Collections.singletonList("2,"))); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java index 620e2718b04d9..8f2f750806b81 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java @@ -54,38 +54,38 @@ public class IoTDBSelectIntoIT { public static final List SELECT_INTO_SQL_LIST = new ArrayList<>( Arrays.asList( - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.s1 WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", - "INSERT INTO root.sg.d1(time, s1) VALUES (1, 1)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (2, 2, 2)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (3, 3, 3)", - "INSERT INTO root.sg.d1(time, s2) VALUES (4, 4)", - "INSERT INTO root.sg.d1(time, s1) VALUES (5, 5)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (6, 6, 6)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (7, 7, 7)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (8, 8, 8)", - "INSERT INTO root.sg.d1(time, s2) VALUES (9, 9)", - "INSERT INTO root.sg.d1(time, s1) VALUES (10, 10)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (11, 11, 11)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (12, 12, 12)", - "INSERT INTO root.sg.d2(time, s1, s2) VALUES (1, 1, 1)", - "INSERT INTO root.sg.d2(time, s2) VALUES (2, 2)", - "INSERT INTO root.sg.d2(time, s1) VALUES (3, 3)", - "INSERT INTO root.sg.d2(time, s1, s2) VALUES (4, 4, 4)", - "INSERT INTO root.sg.d2(time, s2) VALUES (5, 5)", - "INSERT INTO root.sg.d2(time, s2) VALUES (6, 6)", - "INSERT INTO root.sg.d2(time, s1) VALUES (7, 7)", - "INSERT INTO root.sg.d2(time, s1, s2) VALUES (8, 8, 8)", - "INSERT INTO root.sg.d2(time, s1, s2) VALUES (10, 10, 10)", - "INSERT INTO root.sg.d2(time, s2) VALUES (11, 11)", - "INSERT INTO root.sg.d2(time, s1) VALUES (12, 12)", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.s1 WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", + "INSERT INTO root.db.d1(time, s1) VALUES (1, 1)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (2, 2, 2)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (3, 3, 3)", + "INSERT INTO root.db.d1(time, s2) VALUES (4, 4)", + "INSERT INTO root.db.d1(time, s1) VALUES (5, 5)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (6, 6, 6)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (7, 7, 7)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (8, 8, 8)", + "INSERT INTO root.db.d1(time, s2) VALUES (9, 9)", + "INSERT INTO root.db.d1(time, s1) VALUES (10, 10)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (11, 11, 11)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (12, 12, 12)", + "INSERT INTO root.db.d2(time, s1, s2) VALUES (1, 1, 1)", + "INSERT INTO root.db.d2(time, s2) VALUES (2, 2)", + "INSERT INTO root.db.d2(time, s1) VALUES (3, 3)", + "INSERT INTO root.db.d2(time, s1, s2) VALUES (4, 4, 4)", + "INSERT INTO root.db.d2(time, s2) VALUES (5, 5)", + "INSERT INTO root.db.d2(time, s2) VALUES (6, 6)", + "INSERT INTO root.db.d2(time, s1) VALUES (7, 7)", + "INSERT INTO root.db.d2(time, s1, s2) VALUES (8, 8, 8)", + "INSERT INTO root.db.d2(time, s1, s2) VALUES (10, 10, 10)", + "INSERT INTO root.db.d2(time, s2) VALUES (11, 11)", + "INSERT INTO root.db.d2(time, s1) VALUES (12, 12)", "flush", - "CREATE DATABASE root.sg1", - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE DATABASE root.db1", + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", "create timeseries root.db.d1.s1 BOOLEAN encoding=PLAIN", "create timeseries root.db.d1.s2 FLOAT encoding=RLE", "create timeseries root.db.d1.s3 TEXT encoding=PLAIN", @@ -102,13 +102,13 @@ public class IoTDBSelectIntoIT { "insert into root.db.d1(time,s2) values(2,1.2)")); static { - SELECT_INTO_SQL_LIST.add("CREATE DATABASE root.sg_type"); + SELECT_INTO_SQL_LIST.add("CREATE DATABASE root.db_type"); for (int deviceId = 0; deviceId < 6; deviceId++) { for (TSDataType dataType : TSDataType.values()) { if (!dataType.equals(TSDataType.VECTOR) && !dataType.equals(TSDataType.UNKNOWN)) { SELECT_INTO_SQL_LIST.add( String.format( - "CREATE TIMESERIES root.sg_type.d_%d.s_%s %s", + "CREATE TIMESERIES root.db_type.d_%d.s_%s %s", deviceId, dataType.name().toLowerCase(), dataType)); } } @@ -117,7 +117,7 @@ public class IoTDBSelectIntoIT { SELECT_INTO_SQL_LIST.add( String.format( Locale.ENGLISH, - "INSERT INTO root.sg_type.d_0(time, s_int32, s_int64, s_float, s_double, s_boolean, s_text) " + "INSERT INTO root.db_type.d_0(time, s_int32, s_int64, s_float, s_double, s_boolean, s_text) " + "VALUES (%d, %d, %d, %f, %f, %s, 'text%d')", time, time, @@ -171,39 +171,39 @@ public static void tearDown() throws Exception { public void testRawDataQuery1() { String[] intoRetArray = new String[] { - "root.sg.d1.s1,root.sg_bk1.new_d.t1,10,", - "root.sg.d2.s1,root.sg_bk1.new_d.t2,7,", - "root.sg.d1.s2,root.sg_bk1.new_d.t3,9,", - "root.sg.d2.s2,root.sg_bk1.new_d.t4,8,", + "root.db.d1.s1,root.db_bk1.new_d.t1,10,", + "root.db.d2.s1,root.db_bk1.new_d.t2,7,", + "root.db.d1.s2,root.db_bk1.new_d.t3,9,", + "root.db.d2.s2,root.db_bk1.new_d.t4,8,", }; resultSetEqualTest( - "select s1, s2 into root.sg_bk1.new_d(t1, t2, t3, t4) from root.sg.*;", + "select s1, s2 into root.db_bk1.new_d(t1, t2, t3, t4) from root.db.*;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_bk1.new_d.t1,root.sg_bk1.new_d.t3,root.sg_bk1.new_d.t2,root.sg_bk1.new_d.t4,"; + "Time,root.db_bk1.new_d.t1,root.db_bk1.new_d.t3,root.db_bk1.new_d.t2,root.db_bk1.new_d.t4,"; resultSetEqualTest( - "select t1, t3, t2, t4 from root.sg_bk1.new_d;", expectedQueryHeader, rawDataSet); + "select t1, t3, t2, t4 from root.db_bk1.new_d;", expectedQueryHeader, rawDataSet); } @Test public void testRawDataQuery2() { String[] intoRetArray = new String[] { - "root.sg.d1.s1,root.sg_bk2.new_d1.s1,10,", - "root.sg.d2.s1,root.sg_bk2.new_d2.s1,7,", - "root.sg.d1.s2,root.sg_bk2.new_d1.s2,9,", - "root.sg.d2.s2,root.sg_bk2.new_d2.s2,8," + "root.db.d1.s1,root.db_bk2.new_d1.s1,10,", + "root.db.d2.s1,root.db_bk2.new_d2.s1,7,", + "root.db.d1.s2,root.db_bk2.new_d1.s2,9,", + "root.db.d2.s2,root.db_bk2.new_d2.s2,8," }; resultSetEqualTest( - "select s1, s2 into root.sg_bk2.new_${2}(::) from root.sg.*;", + "select s1, s2 into root.db_bk2.new_${2}(::) from root.db.*;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_bk2.new_d1.s1,root.sg_bk2.new_d1.s2,root.sg_bk2.new_d2.s1,root.sg_bk2.new_d2.s2,"; + "Time,root.db_bk2.new_d1.s1,root.db_bk2.new_d1.s2,root.db_bk2.new_d2.s1,root.db_bk2.new_d2.s2,"; resultSetEqualTest( - "select new_d1.s1, new_d1.s2, new_d2.s1, new_d2.s2 from root.sg_bk2;", + "select new_d1.s1, new_d1.s2, new_d2.s1, new_d2.s2 from root.db_bk2;", expectedQueryHeader, rawDataSet); } @@ -212,18 +212,18 @@ public void testRawDataQuery2() { public void testSamePathQuery() { String[] intoRetArray = new String[] { - "root.sg.d1.s1,root.sg_bk3.new_d1.t1,10,", - "root.sg.d1.s2,root.sg_bk3.new_d1.t2,9,", - "root.sg.d1.s1,root.sg_bk3.new_d2.t1,10,", - "root.sg.d1.s2,root.sg_bk3.new_d2.t2,9," + "root.db.d1.s1,root.db_bk3.new_d1.t1,10,", + "root.db.d1.s2,root.db_bk3.new_d1.t2,9,", + "root.db.d1.s1,root.db_bk3.new_d2.t1,10,", + "root.db.d1.s2,root.db_bk3.new_d2.t2,9," }; resultSetEqualTest( - "select s1, s2, s1, s2 into root.sg_bk3.new_d1(t1, t2), aligned root.sg_bk3.new_d2(t1, t2) from root.sg.d1;", + "select s1, s2, s1, s2 into root.db_bk3.new_d1(t1, t2), aligned root.db_bk3.new_d2(t1, t2) from root.db.d1;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_bk3.new_d1.t1,root.sg_bk3.new_d1.t2,root.sg_bk3.new_d2.t1,root.sg_bk3.new_d2.t2,"; + "Time,root.db_bk3.new_d1.t1,root.db_bk3.new_d1.t2,root.db_bk3.new_d2.t1,root.db_bk3.new_d2.t2,"; String[] queryRetArray = new String[] { "1,1,null,1,null,", @@ -240,7 +240,7 @@ public void testSamePathQuery() { "12,12,12.0,12,12.0," }; resultSetEqualTest( - "select new_d1.t1, new_d1.t2, new_d2.t1, new_d2.t2 from root.sg_bk3;", + "select new_d1.t1, new_d1.t2, new_d2.t1, new_d2.t2 from root.db_bk3;", expectedQueryHeader, queryRetArray); } @@ -248,7 +248,7 @@ public void testSamePathQuery() { @Test public void testEmptyQuery() { resultSetEqualTest( - "select s1, s2 into root.sg_bk4.new_${2}(::) from root.sg1.d1, root.sg1.d2;", + "select s1, s2 into root.db_bk4.new_${2}(::) from root.db1.d1, root.db1.d2;", selectIntoHeader, new String[] {}); } @@ -256,23 +256,23 @@ public void testEmptyQuery() { public void testAggregationQuery1() { String[] intoRetArray = new String[] { - "count(root.sg.d1.s1),root.sg_agg1.d1.count_s1,1,", - "last_value(root.sg.d1.s2),root.sg_agg1.d1.last_value_s2,1,", - "count(root.sg.d2.s1),root.sg_agg1.d2.count_s1,1,", - "last_value(root.sg.d2.s2),root.sg_agg1.d2.last_value_s2,1," + "count(root.db.d1.s1),root.db_agg1.d1.count_s1,1,", + "last_value(root.db.d1.s2),root.db_agg1.d1.last_value_s2,1,", + "count(root.db.d2.s1),root.db_agg1.d2.count_s1,1,", + "last_value(root.db.d2.s2),root.db_agg1.d2.last_value_s2,1," }; resultSetEqualTest( "select count(d1.s1), last_value(d1.s2), count(d2.s1), last_value(d2.s2) " - + "into root.sg_agg1.d1(count_s1, last_value_s2), aligned root.sg_agg1.d2(count_s1, last_value_s2) " - + "from root.sg;", + + "into root.db_agg1.d1(count_s1, last_value_s2), aligned root.db_agg1.d2(count_s1, last_value_s2) " + + "from root.db;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_agg1.d1.count_s1,root.sg_agg1.d2.count_s1,root.sg_agg1.d1.last_value_s2,root.sg_agg1.d2.last_value_s2,"; + "Time,root.db_agg1.d1.count_s1,root.db_agg1.d2.count_s1,root.db_agg1.d1.last_value_s2,root.db_agg1.d2.last_value_s2,"; String[] queryRetArray = new String[] {"0,10,7,12.0,11.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_agg1.d1, root.sg_agg1.d2;", + "select count_s1, last_value_s2 from root.db_agg1.d1, root.db_agg1.d2;", expectedQueryHeader, queryRetArray); } @@ -281,24 +281,24 @@ public void testAggregationQuery1() { public void testAggregationQuery2() { String[] intoRetArray = new String[] { - "count(root.sg.d1.s1),root.sg_agg2.d1.count_s1,4,", - "last_value(root.sg.d1.s2),root.sg_agg2.d1.last_value_s2,4,", - "count(root.sg.d2.s1),root.sg_agg2.d2.count_s1,4,", - "last_value(root.sg.d2.s2),root.sg_agg2.d2.last_value_s2,4," + "count(root.db.d1.s1),root.db_agg2.d1.count_s1,4,", + "last_value(root.db.d1.s2),root.db_agg2.d1.last_value_s2,4,", + "count(root.db.d2.s1),root.db_agg2.d2.count_s1,4,", + "last_value(root.db.d2.s2),root.db_agg2.d2.last_value_s2,4," }; resultSetEqualTest( "select count(d1.s1), last_value(d1.s2), count(d2.s1), last_value(d2.s2) " - + "into aligned root.sg_agg2.d1(count_s1, last_value_s2), aligned root.sg_agg2.d2(count_s1, last_value_s2) " - + "from root.sg group by ([1, 13), 3ms);", + + "into aligned root.db_agg2.d1(count_s1, last_value_s2), aligned root.db_agg2.d2(count_s1, last_value_s2) " + + "from root.db group by ([1, 13), 3ms);", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_agg2.d1.count_s1,root.sg_agg2.d2.count_s1,root.sg_agg2.d1.last_value_s2,root.sg_agg2.d2.last_value_s2,"; + "Time,root.db_agg2.d1.count_s1,root.db_agg2.d2.count_s1,root.db_agg2.d1.last_value_s2,root.db_agg2.d2.last_value_s2,"; String[] queryRetArray = new String[] {"1,3,2,3.0,2.0,", "4,2,1,6.0,6.0,", "7,2,2,9.0,8.0,", "10,3,2,12.0,11.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_agg2.d1, root.sg_agg2.d2;", + "select count_s1, last_value_s2 from root.db_agg2.d1, root.db_agg2.d2;", expectedQueryHeader, queryRetArray); } @@ -307,17 +307,17 @@ public void testAggregationQuery2() { public void testExpression() { String[] intoRetArray = new String[] { - "root.sg.d1.s1 + root.sg.d2.s1,root.sg_expr.d.k1,6,", - "-sin(root.sg.d1.s2),root.sg_expr.d.k2,9,", - "top_k(root.sg.d2.s2, \"k\"=\"3\"),root.sg_expr.d.k3,3," + "root.db.d1.s1 + root.db.d2.s1,root.db_expr.d.k1,6,", + "-sin(root.db.d1.s2),root.db_expr.d.k2,9,", + "top_k(root.db.d2.s2, \"k\"=\"3\"),root.db_expr.d.k3,3," }; resultSetEqualTest( "select d1.s1 + d2.s1, -sin(d1.s2), top_k(d2.s2,'k'='3') " - + "into root.sg_expr.d(k1, k2, k3) from root.sg;", + + "into root.db_expr.d(k1, k2, k3) from root.db;", selectIntoHeader, intoRetArray); - String expectedQueryHeader = "Time,root.sg_expr.d.k1,root.sg_expr.d.k2,root.sg_expr.d.k3,"; + String expectedQueryHeader = "Time,root.db_expr.d.k1,root.db_expr.d.k2,root.db_expr.d.k3,"; String[] queryRetArray = new String[] { "1,2.0,null,null,", @@ -333,37 +333,37 @@ public void testExpression() { "12,24.0,0.5365729180004349,null," }; resultSetEqualTest( - "select k1, k2, k3 from root.sg_expr.d;", expectedQueryHeader, queryRetArray); + "select k1, k2, k3 from root.db_expr.d;", expectedQueryHeader, queryRetArray); } @Test public void testUsingUnMatchedAlignment() { String[] intoRetArray = new String[] { - "root.sg.d1.s1,root.sg_bk1.new_aligned_d.t1,10,", - "root.sg.d2.s1,root.sg_bk1.new_aligned_d.t2,7,", - "root.sg.d1.s2,root.sg_bk1.new_aligned_d.t3,9,", - "root.sg.d2.s2,root.sg_bk1.new_aligned_d.t4,8,", + "root.db.d1.s1,root.db_bk1.new_aligned_d.t1,10,", + "root.db.d2.s1,root.db_bk1.new_aligned_d.t2,7,", + "root.db.d1.s2,root.db_bk1.new_aligned_d.t3,9,", + "root.db.d2.s2,root.db_bk1.new_aligned_d.t4,8,", }; executeNonQuery( - "CREATE ALIGNED TIMESERIES root.sg_bk1.new_aligned_d(t1 INT32, t2 INT32, t3 FLOAT, t4 FLOAT);"); + "CREATE ALIGNED TIMESERIES root.db_bk1.new_aligned_d(t1 INT32, t2 INT32, t3 FLOAT, t4 FLOAT);"); // use matched interface (aligned == aligned) resultSetEqualTest( - "select s1, s2 into aligned root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;", + "select s1, s2 into aligned root.db_bk1.new_aligned_d(t1, t2, t3, t4) from root.db.*;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_bk1.new_aligned_d.t1,root.sg_bk1.new_aligned_d.t3,root.sg_bk1.new_aligned_d.t2,root.sg_bk1.new_aligned_d.t4,"; + "Time,root.db_bk1.new_aligned_d.t1,root.db_bk1.new_aligned_d.t3,root.db_bk1.new_aligned_d.t2,root.db_bk1.new_aligned_d.t4,"; resultSetEqualTest( - "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); + "select t1, t3, t2, t4 from root.db_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); // use unmatched interface (non-aligned != aligned) resultSetEqualTest( - "select s1, s2 into root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;", + "select s1, s2 into root.db_bk1.new_aligned_d(t1, t2, t3, t4) from root.db.*;", selectIntoHeader, intoRetArray); resultSetEqualTest( - "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); + "select t1, t3, t2, t4 from root.db_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); } // -------------------------------------- ALIGN BY DEVICE ------------------------------------- @@ -372,39 +372,39 @@ public void testUsingUnMatchedAlignment() { public void testRawDataQueryAlignByDevice1() { String[] intoRetArray = new String[] { - "root.sg.d1,s1,root.sg_abd_bk1.new_d.t1,10,", - "root.sg.d1,s2,root.sg_abd_bk1.new_d.t2,9,", - "root.sg.d2,s1,root.sg_abd_bk1.new_d.t3,7,", - "root.sg.d2,s2,root.sg_abd_bk1.new_d.t4,8,", + "root.db.d1,s1,root.db_abd_bk1.new_d.t1,10,", + "root.db.d1,s2,root.db_abd_bk1.new_d.t2,9,", + "root.db.d2,s1,root.db_abd_bk1.new_d.t3,7,", + "root.db.d2,s2,root.db_abd_bk1.new_d.t4,8,", }; resultSetEqualTest( - "select s1, s2 into root.sg_abd_bk1.new_d(t1, t2), root.sg_abd_bk1.new_d(t3, t4) from root.sg.* align by device;", + "select s1, s2 into root.db_abd_bk1.new_d(t1, t2), root.db_abd_bk1.new_d(t3, t4) from root.db.* align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_bk1.new_d.t1,root.sg_abd_bk1.new_d.t2,root.sg_abd_bk1.new_d.t3,root.sg_abd_bk1.new_d.t4,"; + "Time,root.db_abd_bk1.new_d.t1,root.db_abd_bk1.new_d.t2,root.db_abd_bk1.new_d.t3,root.db_abd_bk1.new_d.t4,"; resultSetEqualTest( - "select t1, t2, t3, t4 from root.sg_abd_bk1.new_d;", expectedQueryHeader, rawDataSet); + "select t1, t2, t3, t4 from root.db_abd_bk1.new_d;", expectedQueryHeader, rawDataSet); } @Test public void testRawDataQueryAlignByDevice2() { String[] intoRetArray = new String[] { - "root.sg.d1,s1,root.sg_abd_bk2.new_d1.s1,10,", - "root.sg.d1,s2,root.sg_abd_bk2.new_d1.s2,9,", - "root.sg.d2,s1,root.sg_abd_bk2.new_d2.s1,7,", - "root.sg.d2,s2,root.sg_abd_bk2.new_d2.s2,8," + "root.db.d1,s1,root.db_abd_bk2.new_d1.s1,10,", + "root.db.d1,s2,root.db_abd_bk2.new_d1.s2,9,", + "root.db.d2,s1,root.db_abd_bk2.new_d2.s1,7,", + "root.db.d2,s2,root.db_abd_bk2.new_d2.s2,8," }; resultSetEqualTest( - "select s1, s2 into root.sg_abd_bk2.new_${2}(::) from root.sg.* align by device;", + "select s1, s2 into root.db_abd_bk2.new_${2}(::) from root.db.* align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_bk2.new_d1.s1,root.sg_abd_bk2.new_d1.s2,root.sg_abd_bk2.new_d2.s1,root.sg_abd_bk2.new_d2.s2,"; + "Time,root.db_abd_bk2.new_d1.s1,root.db_abd_bk2.new_d1.s2,root.db_abd_bk2.new_d2.s1,root.db_abd_bk2.new_d2.s2,"; resultSetEqualTest( - "select new_d1.s1, new_d1.s2, new_d2.s1, new_d2.s2 from root.sg_abd_bk2;", + "select new_d1.s1, new_d1.s2, new_d2.s1, new_d2.s2 from root.db_abd_bk2;", expectedQueryHeader, rawDataSet); } @@ -413,18 +413,18 @@ public void testRawDataQueryAlignByDevice2() { public void testSamePathQueryAlignByDevice() { String[] intoRetArray = new String[] { - "root.sg.d1,s1,root.sg_abd_bk3.new_d1.t1,10,", - "root.sg.d1,s2,root.sg_abd_bk3.new_d1.t2,9,", - "root.sg.d1,s1,root.sg_abd_bk3.new_d1.t3,10,", - "root.sg.d1,s2,root.sg_abd_bk3.new_d1.t4,9," + "root.db.d1,s1,root.db_abd_bk3.new_d1.t1,10,", + "root.db.d1,s2,root.db_abd_bk3.new_d1.t2,9,", + "root.db.d1,s1,root.db_abd_bk3.new_d1.t3,10,", + "root.db.d1,s2,root.db_abd_bk3.new_d1.t4,9," }; resultSetEqualTest( - "select s1, s2, s1, s2 into root.sg_abd_bk3.new_d1(t1, t2, t3, t4) from root.sg.d1 align by device;", + "select s1, s2, s1, s2 into root.db_abd_bk3.new_d1(t1, t2, t3, t4) from root.db.d1 align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_bk3.new_d1.t1,root.sg_abd_bk3.new_d1.t2,root.sg_abd_bk3.new_d1.t3,root.sg_abd_bk3.new_d1.t4,"; + "Time,root.db_abd_bk3.new_d1.t1,root.db_abd_bk3.new_d1.t2,root.db_abd_bk3.new_d1.t3,root.db_abd_bk3.new_d1.t4,"; String[] queryRetArray = new String[] { "1,1,null,1,null,", @@ -441,13 +441,13 @@ public void testSamePathQueryAlignByDevice() { "12,12,12.0,12,12.0," }; resultSetEqualTest( - "select t1, t2, t3, t4 from root.sg_abd_bk3.new_d1;", expectedQueryHeader, queryRetArray); + "select t1, t2, t3, t4 from root.db_abd_bk3.new_d1;", expectedQueryHeader, queryRetArray); } @Test public void testEmptyQueryAlignByDevice() { resultSetEqualTest( - "select s1, s2 into root.sg_abd_bk4.new_${2}(::) from root.sg1.d1, root.sg1.d2 align by device;", + "select s1, s2 into root.db_abd_bk4.new_${2}(::) from root.db1.d1, root.db1.d2 align by device;", selectIntoAlignByDeviceHeader, new String[] {}); } @@ -455,23 +455,23 @@ public void testEmptyQueryAlignByDevice() { public void testAggregationQueryAlignByDevice1() { String[] intoRetArray = new String[] { - "root.sg.d1,count(s1),root.sg_abd_agg1.d1.count_s1,1,", - "root.sg.d1,last_value(s2),root.sg_abd_agg1.d1.last_value_s2,1,", - "root.sg.d2,count(s1),root.sg_abd_agg1.d2.count_s1,1,", - "root.sg.d2,last_value(s2),root.sg_abd_agg1.d2.last_value_s2,1," + "root.db.d1,count(s1),root.db_abd_agg1.d1.count_s1,1,", + "root.db.d1,last_value(s2),root.db_abd_agg1.d1.last_value_s2,1,", + "root.db.d2,count(s1),root.db_abd_agg1.d2.count_s1,1,", + "root.db.d2,last_value(s2),root.db_abd_agg1.d2.last_value_s2,1," }; resultSetEqualTest( "select count(s1), last_value(s2) " - + "into root.sg_abd_agg1.${2}(count_s1, last_value_s2) " - + "from root.sg.* align by device;", + + "into root.db_abd_agg1.${2}(count_s1, last_value_s2) " + + "from root.db.* align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_agg1.d1.count_s1,root.sg_abd_agg1.d2.count_s1," - + "root.sg_abd_agg1.d1.last_value_s2,root.sg_abd_agg1.d2.last_value_s2,"; + "Time,root.db_abd_agg1.d1.count_s1,root.db_abd_agg1.d2.count_s1," + + "root.db_abd_agg1.d1.last_value_s2,root.db_abd_agg1.d2.last_value_s2,"; String[] queryRetArray = new String[] {"0,10,7,12.0,11.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_abd_agg1.d1, root.sg_abd_agg1.d2;", + "select count_s1, last_value_s2 from root.db_abd_agg1.d1, root.db_abd_agg1.d2;", expectedQueryHeader, queryRetArray); } @@ -480,24 +480,24 @@ public void testAggregationQueryAlignByDevice1() { public void testAggregationQueryAlignByDevice2() { String[] intoRetArray = new String[] { - "root.sg.d1,count(s1),root.sg_abd_agg2.d1.count_s1,4,", - "root.sg.d1,last_value(s2),root.sg_abd_agg2.d1.last_value_s2,4,", - "root.sg.d2,count(s1),root.sg_abd_agg2.d2.count_s1,4,", - "root.sg.d2,last_value(s2),root.sg_abd_agg2.d2.last_value_s2,4," + "root.db.d1,count(s1),root.db_abd_agg2.d1.count_s1,4,", + "root.db.d1,last_value(s2),root.db_abd_agg2.d1.last_value_s2,4,", + "root.db.d2,count(s1),root.db_abd_agg2.d2.count_s1,4,", + "root.db.d2,last_value(s2),root.db_abd_agg2.d2.last_value_s2,4," }; resultSetEqualTest( "select count(s1), last_value(s2) " - + "into aligned root.sg_abd_agg2.${2}(count_s1, last_value_s2) " - + "from root.sg.* group by ([1, 13), 3ms) align by device;", + + "into aligned root.db_abd_agg2.${2}(count_s1, last_value_s2) " + + "from root.db.* group by ([1, 13), 3ms) align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_agg2.d1.count_s1,root.sg_abd_agg2.d2.count_s1," - + "root.sg_abd_agg2.d1.last_value_s2,root.sg_abd_agg2.d2.last_value_s2,"; + "Time,root.db_abd_agg2.d1.count_s1,root.db_abd_agg2.d2.count_s1," + + "root.db_abd_agg2.d1.last_value_s2,root.db_abd_agg2.d2.last_value_s2,"; String[] queryRetArray = new String[] {"1,3,2,3.0,2.0,", "4,2,1,6.0,6.0,", "7,2,2,9.0,8.0,", "10,3,2,12.0,11.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_abd_agg2.d1, root.sg_abd_agg2.d2;", + "select count_s1, last_value_s2 from root.db_abd_agg2.d1, root.db_abd_agg2.d2;", expectedQueryHeader, queryRetArray); } @@ -506,22 +506,22 @@ public void testAggregationQueryAlignByDevice2() { public void testExpressionAlignByDevice() { String[] intoRetArray = new String[] { - "root.sg.d1,s1 + s2,root.sg_abd_expr.d1.k1,7,", - "root.sg.d1,-sin(s1),root.sg_abd_expr.d1.k2,10,", - "root.sg.d1,top_k(s2, \"k\"=\"3\"),root.sg_abd_expr.d1.k3,3,", - "root.sg.d2,s1 + s2,root.sg_abd_expr.d2.k1,4,", - "root.sg.d2,-sin(s1),root.sg_abd_expr.d2.k2,7,", - "root.sg.d2,top_k(s2, \"k\"=\"3\"),root.sg_abd_expr.d2.k3,3,", + "root.db.d1,s1 + s2,root.db_abd_expr.d1.k1,7,", + "root.db.d1,-sin(s1),root.db_abd_expr.d1.k2,10,", + "root.db.d1,top_k(s2, \"k\"=\"3\"),root.db_abd_expr.d1.k3,3,", + "root.db.d2,s1 + s2,root.db_abd_expr.d2.k1,4,", + "root.db.d2,-sin(s1),root.db_abd_expr.d2.k2,7,", + "root.db.d2,top_k(s2, \"k\"=\"3\"),root.db_abd_expr.d2.k3,3,", }; resultSetEqualTest( "select s1 + s2, -sin(s1), top_k(s2,'k'='3') " - + "into root.sg_abd_expr.::(k1, k2, k3) from root.sg.* align by device;", + + "into root.db_abd_expr.::(k1, k2, k3) from root.db.* align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_expr.d1.k1,root.sg_abd_expr.d2.k1,root.sg_abd_expr.d1.k2," - + "root.sg_abd_expr.d2.k2,root.sg_abd_expr.d1.k3,root.sg_abd_expr.d2.k3,"; + "Time,root.db_abd_expr.d1.k1,root.db_abd_expr.d2.k1,root.db_abd_expr.d1.k2," + + "root.db_abd_expr.d2.k2,root.db_abd_expr.d1.k3,root.db_abd_expr.d2.k3,"; String[] queryRetArray = new String[] { "1,null,2.0,-0.8414709848078965,-0.8414709848078965,null,null,", @@ -538,24 +538,24 @@ public void testExpressionAlignByDevice() { "12,24.0,null,0.5365729180004349,0.5365729180004349,12.0,null," }; resultSetEqualTest( - "select k1, k2, k3 from root.sg_abd_expr.*;", expectedQueryHeader, queryRetArray); + "select k1, k2, k3 from root.db_abd_expr.*;", expectedQueryHeader, queryRetArray); } @Test public void testExpressionAlignByDevice2() { String[] intoRetArray = new String[] { - "root.sg.d1,avg(s1),root.agg_expr.d1.avg_s1,1,", - "root.sg.d1,sum(s1) + sum(s1),root.agg_expr.d1.sum_s1_add_s1,1,", - "root.sg.d1,count(s2),root.agg_expr.d1.count_s2,1,", - "root.sg.d2,avg(s1),root.agg_expr.d2.avg_s1,1,", - "root.sg.d2,sum(s1) + sum(s1),root.agg_expr.d2.sum_s1_add_s1,1,", - "root.sg.d2,count(s2),root.agg_expr.d2.count_s2,1,", + "root.db.d1,avg(s1),root.agg_expr.d1.avg_s1,1,", + "root.db.d1,sum(s1) + sum(s1),root.agg_expr.d1.sum_s1_add_s1,1,", + "root.db.d1,count(s2),root.agg_expr.d1.count_s2,1,", + "root.db.d2,avg(s1),root.agg_expr.d2.avg_s1,1,", + "root.db.d2,sum(s1) + sum(s1),root.agg_expr.d2.sum_s1_add_s1,1,", + "root.db.d2,count(s2),root.agg_expr.d2.count_s2,1,", }; resultSetEqualTest( "select avg(s1), sum(s1) + sum(s1), count(s2)" + " into root.agg_expr.${2}(avg_s1, sum_s1_add_s1, count_s2)" - + " from root.sg.d1, root.sg.d2 align by device;", + + " from root.db.d1, root.db.d2 align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = @@ -575,19 +575,19 @@ public void testExpressionAlignByDevice2() { public void testAliasAlignByDevice() { String[] intoRetArray = new String[] { - "root.sg.d1,s1,root.sg_abd_alias.d1.k1,10,", + "root.db.d1,s1,root.db_abd_alias.d1.k1,10,", }; resultSetEqualTest( - "select s1 as k1 " + "into root.sg_abd_alias.d1(::) from root.sg.d1 align by device;", + "select s1 as k1 " + "into root.db_abd_alias.d1(::) from root.db.d1 align by device;", selectIntoAlignByDeviceHeader, intoRetArray); intoRetArray = new String[] { - "k1,root.sg_abd_alias.d2.k1,10,", + "k1,root.db_abd_alias.d2.k1,10,", }; resultSetEqualTest( - "select s1 as k1 " + "into root.sg_abd_alias.d2(::) from root.sg.d1;", + "select s1 as k1 " + "into root.db_abd_alias.d2(::) from root.db.d1;", selectIntoHeader, intoRetArray); } @@ -599,14 +599,14 @@ public void testPermission1() throws SQLException { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { adminStmt.execute("CREATE USER tempuser1 'temppw1123456'"); - adminStmt.execute("GRANT WRITE_DATA on root.sg_bk.** TO USER tempuser1;"); + adminStmt.execute("GRANT WRITE_DATA on root.db_bk.** TO USER tempuser1;"); ResultSet resultSet; try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser1", "temppw1123456"); Statement userStmt = userCon.createStatement()) { userStmt.executeQuery( - "select s1, s2 into root.sg_bk.new_d(t1, t2, t3, t4) from root.sg.*;"); - resultSet = userStmt.executeQuery("select * from root.sg_bk.new_d"); + "select s1, s2 into root.db_bk.new_d(t1, t2, t3, t4) from root.db.*;"); + resultSet = userStmt.executeQuery("select * from root.db_bk.new_d"); Assert.assertEquals(resultSet.next(), false); } catch (SQLException e) { Assert.assertTrue( @@ -622,12 +622,12 @@ public void testPermission2() throws SQLException { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { adminStmt.execute("CREATE USER tempuser2 'temppw2123456'"); - adminStmt.execute("GRANT WRITE_DATA on root.sg.** TO USER tempuser2;"); + adminStmt.execute("GRANT WRITE_DATA on root.db.** TO USER tempuser2;"); try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser2", "temppw2123456"); Statement userStmt = userCon.createStatement()) { userStmt.executeQuery( - "select s1, s2 into root.sg_bk.new_d(t1, t2, t3, t4) from root.sg.*;"); + "select s1, s2 into root.db_bk.new_d(t1, t2, t3, t4) from root.db.*;"); fail("No exception!"); } catch (SQLException e) { Assert.assertTrue( @@ -644,112 +644,112 @@ public void testPermission2() throws SQLException { public void testDataTypeIncompatible() { // test INT32 assertTestFail( - "select s_int32 into root.sg_type.d_1(s_boolean) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.sg_type.d_0.s_int32[INT32])."); + "select s_int32 into root.db_type.d_1(s_boolean) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.db_type.d_0.s_int32[INT32])."); assertTestFail( - "select s_int32 into root.sg_type.d_1(s_text) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.sg_type.d_0.s_int32[INT32])."); + "select s_int32 into root.db_type.d_1(s_text) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.db_type.d_0.s_int32[INT32])."); // test INT64 assertTestFail( - "select s_int64 into root.sg_type.d_1(s_int32) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.sg_type.d_0.s_int64[INT64])."); + "select s_int64 into root.db_type.d_1(s_int32) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.db_type.d_0.s_int64[INT64])."); assertTestFail( - "select s_int64 into root.sg_type.d_1(s_float) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.sg_type.d_0.s_int64[INT64])."); + "select s_int64 into root.db_type.d_1(s_float) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.db_type.d_0.s_int64[INT64])."); assertTestFail( - "select s_int64 into root.sg_type.d_1(s_boolean) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.sg_type.d_0.s_int64[INT64])."); + "select s_int64 into root.db_type.d_1(s_boolean) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.db_type.d_0.s_int64[INT64])."); assertTestFail( - "select s_int64 into root.sg_type.d_1(s_text) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.sg_type.d_0.s_int64[INT64])."); + "select s_int64 into root.db_type.d_1(s_text) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.db_type.d_0.s_int64[INT64])."); // test FLOAT assertTestFail( - "select s_float into root.sg_type.d_1(s_int32) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.sg_type.d_0.s_float[FLOAT])."); + "select s_float into root.db_type.d_1(s_int32) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.db_type.d_0.s_float[FLOAT])."); assertTestFail( - "select s_float into root.sg_type.d_1(s_int64) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.sg_type.d_0.s_float[FLOAT])."); + "select s_float into root.db_type.d_1(s_int64) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.db_type.d_0.s_float[FLOAT])."); assertTestFail( - "select s_float into root.sg_type.d_1(s_boolean) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.sg_type.d_0.s_float[FLOAT])."); + "select s_float into root.db_type.d_1(s_boolean) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.db_type.d_0.s_float[FLOAT])."); assertTestFail( - "select s_float into root.sg_type.d_1(s_text) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.sg_type.d_0.s_float[FLOAT])."); + "select s_float into root.db_type.d_1(s_text) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.db_type.d_0.s_float[FLOAT])."); // test DOUBLE assertTestFail( - "select s_double into root.sg_type.d_1(s_int32) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.sg_type.d_0.s_double[DOUBLE])."); + "select s_double into root.db_type.d_1(s_int32) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.db_type.d_0.s_double[DOUBLE])."); assertTestFail( - "select s_double into root.sg_type.d_1(s_int64) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.sg_type.d_0.s_double[DOUBLE])."); + "select s_double into root.db_type.d_1(s_int64) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.db_type.d_0.s_double[DOUBLE])."); assertTestFail( - "select s_double into root.sg_type.d_1(s_float) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.sg_type.d_0.s_double[DOUBLE])."); + "select s_double into root.db_type.d_1(s_float) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.db_type.d_0.s_double[DOUBLE])."); assertTestFail( - "select s_double into root.sg_type.d_1(s_boolean) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.sg_type.d_0.s_double[DOUBLE])."); + "select s_double into root.db_type.d_1(s_boolean) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.db_type.d_0.s_double[DOUBLE])."); assertTestFail( - "select s_double into root.sg_type.d_1(s_text) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.sg_type.d_0.s_double[DOUBLE])."); + "select s_double into root.db_type.d_1(s_text) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.db_type.d_0.s_double[DOUBLE])."); // test BOOLEAN assertTestFail( - "select s_boolean into root.sg_type.d_1(s_int32) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.sg_type.d_0.s_boolean[BOOLEAN])."); + "select s_boolean into root.db_type.d_1(s_int32) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.db_type.d_0.s_boolean[BOOLEAN])."); assertTestFail( - "select s_boolean into root.sg_type.d_1(s_int64) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.sg_type.d_0.s_boolean[BOOLEAN])."); + "select s_boolean into root.db_type.d_1(s_int64) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.db_type.d_0.s_boolean[BOOLEAN])."); assertTestFail( - "select s_boolean into root.sg_type.d_1(s_float) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.sg_type.d_0.s_boolean[BOOLEAN])."); + "select s_boolean into root.db_type.d_1(s_float) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.db_type.d_0.s_boolean[BOOLEAN])."); assertTestFail( - "select s_boolean into root.sg_type.d_1(s_double) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_double[DOUBLE]) is not compatible with the data type of source column (root.sg_type.d_0.s_boolean[BOOLEAN])."); + "select s_boolean into root.db_type.d_1(s_double) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_double[DOUBLE]) is not compatible with the data type of source column (root.db_type.d_0.s_boolean[BOOLEAN])."); assertTestFail( - "select s_boolean into root.sg_type.d_1(s_text) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.sg_type.d_0.s_boolean[BOOLEAN])."); + "select s_boolean into root.db_type.d_1(s_text) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.db_type.d_0.s_boolean[BOOLEAN])."); // test TEXT assertTestFail( - "select s_text into root.sg_type.d_1(s_int32) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.sg_type.d_0.s_text[TEXT])."); + "select s_text into root.db_type.d_1(s_int32) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.db_type.d_0.s_text[TEXT])."); assertTestFail( - "select s_text into root.sg_type.d_1(s_int64) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.sg_type.d_0.s_text[TEXT])."); + "select s_text into root.db_type.d_1(s_int64) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.db_type.d_0.s_text[TEXT])."); assertTestFail( - "select s_text into root.sg_type.d_1(s_float) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.sg_type.d_0.s_text[TEXT])."); + "select s_text into root.db_type.d_1(s_float) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.db_type.d_0.s_text[TEXT])."); assertTestFail( - "select s_text into root.sg_type.d_1(s_double) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_double[DOUBLE]) is not compatible with the data type of source column (root.sg_type.d_0.s_text[TEXT])."); + "select s_text into root.db_type.d_1(s_double) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_double[DOUBLE]) is not compatible with the data type of source column (root.db_type.d_0.s_text[TEXT])."); assertTestFail( - "select s_text into root.sg_type.d_1(s_boolean) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.sg_type.d_0.s_text[TEXT])."); + "select s_text into root.db_type.d_1(s_boolean) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.db_type.d_0.s_text[TEXT])."); } @Test public void testDataTypeAutoCast() { String[] intoRetArray = new String[] { - "root.sg_type.d_0.s_int32,root.sg_type.d_1.s_int64,12,", - "root.sg_type.d_0.s_int32,root.sg_type.d_1.s_float,12,", - "root.sg_type.d_0.s_int32,root.sg_type.d_1.s_double,12,", - "root.sg_type.d_0.s_int64,root.sg_type.d_2.s_double,12,", - "root.sg_type.d_0.s_float,root.sg_type.d_3.s_double,12,", + "root.db_type.d_0.s_int32,root.db_type.d_1.s_int64,12,", + "root.db_type.d_0.s_int32,root.db_type.d_1.s_float,12,", + "root.db_type.d_0.s_int32,root.db_type.d_1.s_double,12,", + "root.db_type.d_0.s_int64,root.db_type.d_2.s_double,12,", + "root.db_type.d_0.s_float,root.db_type.d_3.s_double,12,", }; resultSetEqualTest( "select s_int32, s_int32, s_int32, s_int64, s_float " - + " into root.sg_type.d_1(s_int64, s_float, s_double), root.sg_type.d_2(s_double), root.sg_type.d_3(s_double) " - + " from root.sg_type.d_0;", + + " into root.db_type.d_1(s_int64, s_float, s_double), root.db_type.d_2(s_double), root.db_type.d_3(s_double) " + + " from root.db_type.d_0;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_type.d_1.s_int64,root.sg_type.d_1.s_float,root.sg_type.d_1.s_double," - + "root.sg_type.d_2.s_double,root.sg_type.d_3.s_double,"; + "Time,root.db_type.d_1.s_int64,root.db_type.d_1.s_float,root.db_type.d_1.s_double," + + "root.db_type.d_2.s_double,root.db_type.d_3.s_double,"; String[] queryRetArray = new String[] { "0,0,0.0,0.0,0.0,0.0,", @@ -766,7 +766,7 @@ public void testDataTypeAutoCast() { "11,11,11.0,11.0,11.0,11.0," }; resultSetEqualTest( - "select d_1.s_int64, d_1.s_float, d_1.s_double, d_2.s_double, d_3.s_double from root.sg_type;", + "select d_1.s_int64, d_1.s_float, d_1.s_double, d_2.s_double, d_3.s_double from root.db_type;", expectedQueryHeader, queryRetArray); } @@ -813,23 +813,23 @@ public void testNewDataType() { public void testRemoveBackQuote() { String[] intoRetArray = new String[] { - "count(root.sg.d1.s1),root.sg_agg1.d1.count_s1,1,", - "last_value(root.sg.d1.s2),root.sg_agg1.d1.last_value_s2,1,", - "count(root.sg.d2.s1),root.sg_agg1.d2.count_s1,1,", - "last_value(root.sg.d2.s2),root.sg_agg1.d2.last_value_s2,1," + "count(root.db.d1.s1),root.db_agg1.d1.count_s1,1,", + "last_value(root.db.d1.s2),root.db_agg1.d1.last_value_s2,1,", + "count(root.db.d2.s1),root.db_agg1.d2.count_s1,1,", + "last_value(root.db.d2.s2),root.db_agg1.d2.last_value_s2,1," }; resultSetEqualTest( "select count(d1.s1), last_value(d1.s2), count(d2.s1), last_value(d2.s2) " - + "into root.sg_agg1.`d1`(`count_s1`, last_value_s2), aligned root.sg_agg1.d2(count_s1, last_value_s2) " - + "from root.sg;", + + "into root.db_agg1.`d1`(`count_s1`, last_value_s2), aligned root.db_agg1.d2(count_s1, last_value_s2) " + + "from root.db;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_agg1.d1.count_s1,root.sg_agg1.d2.count_s1,root.sg_agg1.d1.last_value_s2,root.sg_agg1.d2.last_value_s2,"; + "Time,root.db_agg1.d1.count_s1,root.db_agg1.d2.count_s1,root.db_agg1.d1.last_value_s2,root.db_agg1.d2.last_value_s2,"; String[] queryRetArray = new String[] {"0,10,7,12.0,11.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_agg1.d1, root.sg_agg1.d2;", + "select count_s1, last_value_s2 from root.db_agg1.d1, root.db_agg1.d2;", expectedQueryHeader, queryRetArray); } @@ -838,21 +838,21 @@ public void testRemoveBackQuote() { public void testRemoveBackQuoteAlignByDevice() { String[] intoRetArray = new String[] { - "root.sg.d1,count(s1),root.sg_abd_agg1.d1.count_s1,1,", - "root.sg.d1,last_value(s2),root.sg_abd_agg1.d1.last_value_s2,1," + "root.db.d1,count(s1),root.db_abd_agg1.d1.count_s1,1,", + "root.db.d1,last_value(s2),root.db_abd_agg1.d1.last_value_s2,1," }; resultSetEqualTest( "select count(s1), last_value(s2) " - + "into root.sg_abd_agg1.`d1`(`count_s1`, last_value_s2) " - + "from root.sg.d1 align by device;", + + "into root.db_abd_agg1.`d1`(`count_s1`, last_value_s2) " + + "from root.db.d1 align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_agg1.d1.count_s1," + "root.sg_abd_agg1.d1.last_value_s2,"; + "Time,root.db_abd_agg1.d1.count_s1," + "root.db_abd_agg1.d1.last_value_s2,"; String[] queryRetArray = new String[] {"0,10,12.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_abd_agg1.d1, root.sg_abd_agg1.d2;", + "select count_s1, last_value_s2 from root.db_abd_agg1.d1, root.db_abd_agg1.d2;", expectedQueryHeader, queryRetArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/specialwords/IoTDBSpecialWordsIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/specialwords/IoTDBSpecialWordsIT.java index 6ccc2d3272085..a25b5d057a093 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/specialwords/IoTDBSpecialWordsIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/specialwords/IoTDBSpecialWordsIT.java @@ -55,16 +55,16 @@ public void testDeviceId() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.deviceId.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("INSERT INTO root.sg1.deviceId(time, s1) values(1, 1)"); + "CREATE TIMESERIES root.db1.deviceId.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("INSERT INTO root.db1.deviceId(time, s1) values(1, 1)"); - try (ResultSet resultSet = statement.executeQuery("select s1 from root.sg1.deviceId")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from root.db1.deviceId")) { int count = 0; while (resultSet.next()) { assertEquals("1", resultSet.getString("Time")); - assertEquals("1", resultSet.getString("root.sg1.deviceId.s1")); + assertEquals("1", resultSet.getString("root.db1.deviceId.s1")); count++; } assertEquals(1, count); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByConditionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByConditionIT.java index c327d6301d0fa..c108782d49dcb 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByConditionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByConditionIT.java @@ -47,65 +47,65 @@ public class IoTDBUDAFGroupByConditionIT { private static final String[] dataset = new String[] { - "CREATE DATABASE root.sg.beijing.car01", - "CREATE TIMESERIES root.sg.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "CREATE DATABASE root.db.beijing.car01", + "CREATE TIMESERIES root.db.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", "flush", - "CREATE DATABASE root.sg.beijing.car02", - "CREATE TIMESERIES root.sg.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "CREATE DATABASE root.db.beijing.car02", + "CREATE TIMESERIES root.db.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", "flush" }; @@ -152,14 +152,14 @@ public void UDAFGroupByConditionNotIgnoreNullTest() { String sqlWithEndTime = "SELECT __endTime, max_time(charging_status) - min_time(charging_status), " + "count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY CONDITION(charging_status=1, KEEP>=2, ignoreNull=false)"; UDAFGroupByConditionITChecker(sqlWithEndTime, expected, true); String sqlWithoutEndTime = "SELECT max_time(charging_status) - min_time(charging_status), " + "count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY CONDITION(charging_status=1, KEEP>=2, ignoreNull=false)"; UDAFGroupByConditionITChecker(sqlWithoutEndTime, expected, false); } @@ -175,7 +175,7 @@ public void UDAFGroupByConditionIgnoreNullTest() { String sql = "SELECT max_time(charging_status) - min_time(charging_status), " + "count_udaf(vehicle_status),last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY CONDITION(charging_status=1, KEEP>=2, ignoreNull=true)"; UDAFGroupByConditionITChecker(sql, expected, false); } @@ -189,7 +189,7 @@ public void UDAFGroupByConditionKeepTest() { String sql = "SELECT __endTime, max_time(charging_status) - min_time(charging_status)," + "count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 GROUP BY CONDITION(soc>=24.0, KEEP<=15)"; + + "FROM root.db.beijing.car01 GROUP BY CONDITION(soc>=24.0, KEEP<=15)"; UDAFGroupByConditionITChecker(sql, expected, true); } @@ -197,10 +197,10 @@ public void UDAFGroupByConditionKeepTest() { public void UDAFGroupByConditionTestAlignByDevice() { String[][] expected = new String[][] { - {"1", "root.sg.beijing.car01", "2", "1.0", "2", "16.0"}, - {"5", "root.sg.beijing.car01", "2500000000", "2499999995.0", "9", "100.0"}, - {"1", "root.sg.beijing.car02", "2", "1.0", "2", "16.0"}, - {"5", "root.sg.beijing.car02", "2500000000", "2499999995.0", "9", "100.0"}, + {"1", "root.db.beijing.car01", "2", "1.0", "2", "16.0"}, + {"5", "root.db.beijing.car01", "2500000000", "2499999995.0", "9", "100.0"}, + {"1", "root.db.beijing.car02", "2", "1.0", "2", "16.0"}, + {"5", "root.db.beijing.car02", "2500000000", "2499999995.0", "9", "100.0"}, }; String sqlWithEndTime = @@ -232,7 +232,7 @@ public void UDAFGroupByConditionTestWithHaving() { String sqlWithEndTime = "SELECT __endTime,max_time(charging_status) - min_time(charging_status)," + "count_udaf(vehicle_status),last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY CONDITION(charging_status=1, KEEP>=2, ignoreNull=false) " + "HAVING last_value(soc)>50"; UDAFGroupByConditionITChecker(sqlWithEndTime, expected, true); @@ -240,16 +240,16 @@ public void UDAFGroupByConditionTestWithHaving() { String sqlWithoutEndTime = "SELECT max_time(charging_status) - min_time(charging_status)," + "count_udaf(vehicle_status),last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY CONDITION(charging_status=1, KEEP>=2, ignoreNull=false) " + "HAVING last_value(soc)>50"; UDAFGroupByConditionITChecker(sqlWithoutEndTime, expected, false); } private void UDAFGroupByConditionITChecker(String sql, String[][] expected, boolean hasEndTime) { - String targetSeries1 = "root.sg.beijing.car01.charging_status"; - String targetSeries2 = "root.sg.beijing.car01.vehicle_status"; - String targetSeries3 = "root.sg.beijing.car01.soc"; + String targetSeries1 = "root.db.beijing.car01.charging_status"; + String targetSeries2 = "root.db.beijing.car01.vehicle_status"; + String targetSeries3 = "root.db.beijing.car01.soc"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByCountIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByCountIT.java index 839aea68522ee..efe01d6adc36c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByCountIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByCountIT.java @@ -43,55 +43,55 @@ public class IoTDBUDAFGroupByCountIT { private static final String[] dataset = new String[] { - "CREATE DATABASE root.sg.beijing.car01", - "CREATE TIMESERIES root.sg.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.soc WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", + "CREATE DATABASE root.db.beijing.car01", + "CREATE TIMESERIES root.db.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.soc WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", "flush", - "CREATE DATABASE root.sg.beijing.car02", - "CREATE TIMESERIES root.sg.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.soc WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", + "CREATE DATABASE root.db.beijing.car02", + "CREATE TIMESERIES root.db.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.soc WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", "flush" }; @@ -134,13 +134,13 @@ public void UDAFGroupByCountTest() { }; String sqlWithoutEndTime = "SELECT sum_udaf(charging_status), count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY COUNT(charging_status, 5)"; UDAFGroupByCountITChecker(sqlWithoutEndTime, expected, false); String sqlWithEndTime = "SELECT __endTime, sum_udaf(charging_status), count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY COUNT(charging_status, 5)"; UDAFGroupByCountITChecker(sqlWithEndTime, expected, true); } @@ -153,7 +153,7 @@ public void UDAFGroupByCountWithHavingTest() { }; String sql = "SELECT sum_udaf(charging_status), count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY COUNT(charging_status, 2) " + "HAVING sum_udaf(charging_status) < 2"; UDAFGroupByCountITChecker(sql, expected, false); @@ -170,13 +170,13 @@ public void UDAFGroupByCountIgnoreNullTest() { String sqlWithoutEndTime = "SELECT sum_udaf(charging_status), count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY COUNT(charging_status, 5, ignoreNull=false)"; UDAFGroupByCountITChecker(sqlWithoutEndTime, expected, false); String sqlWithEndTime = "SELECT __endTime, sum_udaf(charging_status), count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY COUNT(charging_status, 5, ignoreNull=false)"; UDAFGroupByCountITChecker(sqlWithEndTime, expected, true); } @@ -184,20 +184,20 @@ public void UDAFGroupByCountIgnoreNullTest() { @Test public void UDAFGroupByCountAlignByDeviceTest() { String[][] expected = { - {"1", "root.sg.beijing.car01", "2", "2.0", "2", "16"}, - {"3", "root.sg.beijing.car01", "4", "0.0", "2", "16"}, - {"5", "root.sg.beijing.car01", "6", "2.0", "2", "24"}, - {"7", "root.sg.beijing.car01", "9", "2.0", "2", "45"}, - {"10", "root.sg.beijing.car01", "1900000000", "2.0", "2", "55"}, - {"2000000000", "root.sg.beijing.car01", "2400000000", "2.0", "2", "80"}, - {"2500000000", "root.sg.beijing.car01", "2600000000", "1.0", "2", "101"}, - {"1", "root.sg.beijing.car02", "2", "2.0", "2", "16"}, - {"3", "root.sg.beijing.car02", "4", "0.0", "2", "16"}, - {"5", "root.sg.beijing.car02", "6", "2.0", "2", "24"}, - {"7", "root.sg.beijing.car02", "9", "2.0", "2", "45"}, - {"10", "root.sg.beijing.car02", "1900000000", "2.0", "2", "55"}, - {"2000000000", "root.sg.beijing.car02", "2400000000", "2.0", "2", "80"}, - {"2500000000", "root.sg.beijing.car02", "2600000000", "1.0", "2", "101"}, + {"1", "root.db.beijing.car01", "2", "2.0", "2", "16"}, + {"3", "root.db.beijing.car01", "4", "0.0", "2", "16"}, + {"5", "root.db.beijing.car01", "6", "2.0", "2", "24"}, + {"7", "root.db.beijing.car01", "9", "2.0", "2", "45"}, + {"10", "root.db.beijing.car01", "1900000000", "2.0", "2", "55"}, + {"2000000000", "root.db.beijing.car01", "2400000000", "2.0", "2", "80"}, + {"2500000000", "root.db.beijing.car01", "2600000000", "1.0", "2", "101"}, + {"1", "root.db.beijing.car02", "2", "2.0", "2", "16"}, + {"3", "root.db.beijing.car02", "4", "0.0", "2", "16"}, + {"5", "root.db.beijing.car02", "6", "2.0", "2", "24"}, + {"7", "root.db.beijing.car02", "9", "2.0", "2", "45"}, + {"10", "root.db.beijing.car02", "1900000000", "2.0", "2", "55"}, + {"2000000000", "root.db.beijing.car02", "2400000000", "2.0", "2", "80"}, + {"2500000000", "root.db.beijing.car02", "2600000000", "1.0", "2", "101"}, }; String sqlWithoutEndTime = @@ -216,9 +216,9 @@ public void UDAFGroupByCountAlignByDeviceTest() { } private void UDAFGroupByCountITChecker(String sql, String[][] expected, boolean hasEndTime) { - String targetSeries1 = "root.sg.beijing.car01.charging_status"; - String targetSeries2 = "root.sg.beijing.car01.vehicle_status"; - String targetSeries3 = "root.sg.beijing.car01.soc"; + String targetSeries1 = "root.db.beijing.car01.charging_status"; + String targetSeries2 = "root.db.beijing.car01.vehicle_status"; + String targetSeries3 = "root.db.beijing.car01.soc"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByLevelIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByLevelIT.java index 35447f295747f..4263cd47474dd 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByLevelIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByLevelIT.java @@ -42,25 +42,25 @@ public class IoTDBUDAFGroupByLevelIT { private static final String[] dataset = new String[] { - "CREATE DATABASE root.sg1", - "CREATE DATABASE root.sg2", - "CREATE TIMESERIES root.sg1.d1.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d2.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d1.status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "INSERT INTO root.sg1.d1(timestamp,status) values(150,true)", - "INSERT INTO root.sg1.d1(timestamp,status,temperature) values(200,false,20.71)", - "INSERT INTO root.sg1.d1(timestamp,status,temperature) values(600,false,71.12)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(200,false,42.66)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(300,false,46.77)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(700,true,62.15)", - "INSERT INTO root.sg2.d1(timestamp,status,temperature) values(100,3,88.24)", - "INSERT INTO root.sg2.d1(timestamp,status,temperature) values(500,5,125.5)", - "INSERT INTO root.sg2.d2(timestamp,temperature) values(200,105.5)", - "INSERT INTO root.sg2.d2(timestamp,temperature) values(800,61.22)", + "CREATE DATABASE root.db1", + "CREATE DATABASE root.db2", + "CREATE TIMESERIES root.db1.d1.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d2.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d1.status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "INSERT INTO root.db1.d1(timestamp,status) values(150,true)", + "INSERT INTO root.db1.d1(timestamp,status,temperature) values(200,false,20.71)", + "INSERT INTO root.db1.d1(timestamp,status,temperature) values(600,false,71.12)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(200,false,42.66)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(300,false,46.77)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(700,true,62.15)", + "INSERT INTO root.db2.d1(timestamp,status,temperature) values(100,3,88.24)", + "INSERT INTO root.db2.d1(timestamp,status,temperature) values(500,5,125.5)", + "INSERT INTO root.db2.d2(timestamp,temperature) values(200,105.5)", + "INSERT INTO root.db2.d2(timestamp,temperature) values(800,61.22)", }; @BeforeClass @@ -97,9 +97,9 @@ public void UDAFGroupByLevelTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "SELECT avg_udaf(temperature) " + "FROM root.sg1.* " + "GROUP BY LEVEL=1")) { + "SELECT avg_udaf(temperature) " + "FROM root.db1.* " + "GROUP BY LEVEL=1")) { while (resultSet.next()) { - String actual = resultSet.getString(avgUDAF("root.sg1.*.temperature")); + String actual = resultSet.getString(avgUDAF("root.db1.*.temperature")); Assert.assertEquals(expected[cnt], Double.parseDouble(actual), DELTA); cnt++; } @@ -107,9 +107,9 @@ public void UDAFGroupByLevelTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( - "SELECT avg_udaf(temperature) " + "FROM root.sg2.* " + "GROUP BY LEVEL=1")) { + "SELECT avg_udaf(temperature) " + "FROM root.db2.* " + "GROUP BY LEVEL=1")) { while (resultSet.next()) { - String actual = resultSet.getString(avgUDAF("root.sg2.*.temperature")); + String actual = resultSet.getString(avgUDAF("root.db2.*.temperature")); Assert.assertEquals(expected[cnt], Double.parseDouble(actual), DELTA); cnt++; } @@ -127,10 +127,10 @@ public void UDAFGroupByLevelTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( - "SELECT avg_udaf(temperature) " + "FROM root.sg1.* " + "GROUP BY LEVEL=1, 2")) { + "SELECT avg_udaf(temperature) " + "FROM root.db1.* " + "GROUP BY LEVEL=1, 2")) { while (resultSet.next()) { - String actual1 = resultSet.getString(avgUDAF("root.sg1.d1.temperature")); - String actual2 = resultSet.getString(avgUDAF("root.sg1.d2.temperature")); + String actual1 = resultSet.getString(avgUDAF("root.db1.d1.temperature")); + String actual2 = resultSet.getString(avgUDAF("root.db1.d2.temperature")); Assert.assertEquals(expected[cnt++], Double.parseDouble(actual1), DELTA); Assert.assertEquals(expected[cnt++], Double.parseDouble(actual2), DELTA); } @@ -140,9 +140,9 @@ public void UDAFGroupByLevelTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 1 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 1 * - *

Result is [root.sg.*.temperature] + *

Result is [root.db.*.temperature] */ @Test public void UDAFGroupByLevelWithAliasTest() throws Exception { @@ -154,7 +154,7 @@ public void UDAFGroupByLevelWithAliasTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( "SELECT count_udaf(temperature) AS ct " - + "FROM root.sg1.d1, root.sg1.d2 " + + "FROM root.db1.d1, root.db1.d2 " + "GROUP BY LEVEL=1")) { while (resultSet.next()) { String actual = resultSet.getString("ct"); @@ -166,7 +166,7 @@ public void UDAFGroupByLevelWithAliasTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "SELECT count_udaf(temperature) AS ct " + "FROM root.sg1.* " + "GROUP BY LEVEL=1")) { + "SELECT count_udaf(temperature) AS ct " + "FROM root.db1.* " + "GROUP BY LEVEL=1")) { while (resultSet.next()) { String actual = resultSet.getString("ct"); Assert.assertEquals(expected[cnt], actual); @@ -177,7 +177,7 @@ public void UDAFGroupByLevelWithAliasTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 2 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 2 * *

Result is [root.*.d1.temperature, root.*.d2.temperature] */ @@ -186,21 +186,21 @@ public void UDAFGroupByLevelWithAliasFailTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( - "SELECT count_udaf(temperature) AS ct " + "FROM root.sg1.* " + "GROUP BY LEVEL=2"); + "SELECT count_udaf(temperature) AS ct " + "FROM root.db1.* " + "GROUP BY LEVEL=2"); fail("No exception thrown"); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("can only be matched with one")); } } - // Different from above at: root.sg1.*.temperature is just one ResultColumn + // Different from above at: root.db1.*.temperature is just one ResultColumn @Test public void UDAFGroupByLevelWithAliasFailTest2() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( "SELECT count_udaf(temperature) AS ct " - + "FROM root.sg1.d1, root.sg2.d2 " + + "FROM root.db1.d1, root.db2.d2 " + "GROUP BY LEVEL=2"); fail("No exception thrown"); } catch (Exception e) { @@ -215,7 +215,7 @@ public void UDAFGroupByLevelWithAliasFailTest3() { Statement statement = connection.createStatement()) { statement.executeQuery( "SELECT count_udaf(temperature) AS ct, count_udaf(temperature) AS ct2 " - + "FROM root.sg1.d1 " + + "FROM root.db1.d1 " + "GROUP BY LEVEL=2"); fail("No exception thrown"); } catch (Exception e) { @@ -233,7 +233,7 @@ public void UDAFGroupByLevelWithAliasWithTimeIntervalTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( "SELECT count_udaf(temperature) AS ct " - + "FROM root.sg1.d1, root.sg1.d2 " + + "FROM root.db1.d1, root.db1.d2 " + "GROUP BY ([0, 600), 100ms), LEVEL=1")) { while (resultSet.next()) { String actual = @@ -246,7 +246,7 @@ public void UDAFGroupByLevelWithAliasWithTimeIntervalTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "SELECT count_udaf(temperature) AS ct FROM root.sg1.* " + "SELECT count_udaf(temperature) AS ct FROM root.db1.* " + "GROUP BY ([0, 600), 100ms), LEVEL=1")) { while (resultSet.next()) { String actual = @@ -259,7 +259,7 @@ public void UDAFGroupByLevelWithAliasWithTimeIntervalTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 2 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 2 * *

Result is [root.*.d1.temperature, root.*.d2.temperature] */ @@ -269,7 +269,7 @@ public void UDAFGroupByLevelWithAliasWithTimeIntervalFailTest() { Statement statement = connection.createStatement()) { statement.executeQuery( "SELECT count_udaf(temperature) AS ct " - + "FROM root.sg1.* " + + "FROM root.db1.* " + "GROUP BY ([0, 600), 100ms), LEVEL=2"); fail(); } catch (Exception e) { @@ -277,14 +277,14 @@ public void UDAFGroupByLevelWithAliasWithTimeIntervalFailTest() { } } - // Different from above at: root.sg1.*.temperature is just one ResultColumn + // Different from above at: root.db1.*.temperature is just one ResultColumn @Test public void UDAFGroupByLevelWithAliasWithTimeIntervalFailTest2() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( "SELECT count_udaf(temperature) AS ct " - + "FROM root.sg1.d1, root.sg1.d2 " + + "FROM root.db1.d1, root.db1.d2 " + "GROUP BY ([0, 600), 100ms), level=2"); fail(); } catch (Exception e) { @@ -307,9 +307,9 @@ public void UDAFGroupByLevelSLimitTest() throws Exception { + "SLIMIT 2")) { while (resultSet.next()) { String actual = - resultSet.getString(countUDAF("root.sg1.*.temperature")) + resultSet.getString(countUDAF("root.db1.*.temperature")) + "," - + resultSet.getString(countUDAF("root.sg2.*.temperature")); + + resultSet.getString(countUDAF("root.db2.*.temperature")); Assert.assertEquals(expected[cnt], actual); cnt++; } @@ -323,9 +323,9 @@ public void UDAFGroupByLevelSLimitTest() throws Exception { + "SLIMIT 2 SOFFSET 1")) { while (resultSet.next()) { String actual = - resultSet.getString(countUDAF("root.sg2.*.temperature")) + resultSet.getString(countUDAF("root.db2.*.temperature")) + "," - + resultSet.getString(countUDAF("root.sg1.*.status")); + + resultSet.getString(countUDAF("root.db1.*.status")); Assert.assertEquals(expected[cnt], actual); cnt++; } @@ -338,7 +338,7 @@ public void UDAFGroupByLevelSLimitTest() throws Exception { + "GROUP BY level=1,2 " + "slimit 1 soffset 4")) { while (resultSet.next()) { - String actual = resultSet.getString(countUDAF("root.sg1.d1.status")); + String actual = resultSet.getString(countUDAF("root.db1.d1.status")); Assert.assertEquals(expected[cnt], actual); cnt++; } @@ -368,10 +368,10 @@ public void UDAFGroupByLevelWithTimeIntervalTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( "SELECT sum_udaf(temperature) " - + "FROM root.sg2.* " + + "FROM root.db2.* " + "GROUP BY ([0, 600), 100ms), LEVEL=1")) { while (resultSet.next()) { - String actual = "" + resultSet.getString(sumUDAF("root.sg2.*.temperature")); + String actual = "" + resultSet.getString(sumUDAF("root.db2.*.temperature")); Assert.assertEquals(expected1[cnt], actual); cnt++; } @@ -385,13 +385,13 @@ public void UDAFGroupByLevelWithTimeIntervalTest() throws Exception { + "GROUP BY ([0, 600), 100ms), LEVEL=1")) { while (resultSet.next()) { String actual = - resultSet.getString(maxTime("root.sg1.*.temperature")) + resultSet.getString(maxTime("root.db1.*.temperature")) + "," - + resultSet.getString(maxTime("root.sg2.*.temperature")) + + resultSet.getString(maxTime("root.db2.*.temperature")) + "," - + resultSet.getString(avgUDAF("root.sg1.*.temperature")) + + resultSet.getString(avgUDAF("root.db1.*.temperature")) + "," - + resultSet.getString(avgUDAF("root.sg2.*.temperature")); + + resultSet.getString(avgUDAF("root.db2.*.temperature")); Assert.assertEquals(expected2[cnt], actual); cnt++; } @@ -412,10 +412,10 @@ public void UDAFGroupByMultiLevelWithTimeIntervalTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( "SELECT sum_udaf(temperature) " - + "FROM root.sg2.* " + + "FROM root.db2.* " + "GROUP BY ([0, 600), 100ms), LEVEL=0,1")) { while (resultSet.next()) { - String actual = "" + resultSet.getString(sumUDAF("root.sg2.*.temperature")); + String actual = "" + resultSet.getString(sumUDAF("root.db2.*.temperature")); Assert.assertEquals(expected[cnt], actual); cnt++; } @@ -445,9 +445,9 @@ public void UDAFGroupByMultiLevelWithTimeIntervalSLimitTest() throws Exception { String actual = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(countUDAF("root.sg1.*.temperature")) + + resultSet.getString(countUDAF("root.db1.*.temperature")) + "," - + resultSet.getString(countUDAF("root.sg2.*.temperature")); + + resultSet.getString(countUDAF("root.db2.*.temperature")); Assert.assertEquals(expected[cnt], actual); cnt++; } @@ -464,9 +464,9 @@ public void UDAFGroupByMultiLevelWithTimeIntervalSLimitTest() throws Exception { String actual = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(countUDAF("root.sg2.*.temperature")) + + resultSet.getString(countUDAF("root.db2.*.temperature")) + "," - + resultSet.getString(countUDAF("root.sg1.*.status")); + + resultSet.getString(countUDAF("root.db1.*.status")); Assert.assertEquals(expected2[cnt], actual); cnt++; } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFHavingIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFHavingIT.java index 298dc362740b3..1ad451d146088 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFHavingIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFHavingIT.java @@ -45,45 +45,45 @@ public class IoTDBUDAFHavingIT { private static final String[] SQLs = new String[] { "CREATE DATABASE root.test", - "CREATE TIMESERIES root.test.sg1.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", "CREATE ALIGNED TIMESERIES root.test.sg3(s5 INT32, s6 BOOLEAN, s7 DOUBLE, s8 INT32)", "CREATE TIMESERIES root.test.sg5.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", "CREATE TIMESERIES root.test.sg5.s9 WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) values(1, true, 1, 1.0, 1)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) values(1, false, 1, 1.0, 1)", - "INSERT INTO root.test.sg1(timestamp, s2) values(2, 2)", - "INSERT INTO root.test.sg1(timestamp, s3) values(2, 2.0)", - "INSERT INTO root.test.sg1(timestamp, s4) values(2, 2)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) values(2, true, 2, 2.0, 2)", - "INSERT INTO root.test.sg1(timestamp, s1) values(3, false)", - "INSERT INTO root.test.sg1(timestamp, s2) values(5, 5)", - "INSERT INTO root.test.sg1(timestamp, s3) values(5, 5.0)", - "INSERT INTO root.test.sg1(timestamp, s4) values(5, 5)", - "INSERT INTO root.test.sg2(timestamp, s2) values(5, 5)", - "INSERT INTO root.test.sg2(timestamp, s3) values(5, 5.0)", - "INSERT INTO root.test.sg2(timestamp, s4) values(5, 5)", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) values(6, true, 6, 6.0, 6)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) values(6, true, 6, 6.0, 6)", - "INSERT INTO root.test.sg1(timestamp, s1) values(7, true)", - "INSERT INTO root.test.sg1(timestamp, s3) values(7, 7.0)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3) values(7, true, 7, 7.0)", - "INSERT INTO root.test.sg1(timestamp, s1) values(8, true)", - "INSERT INTO root.test.sg1(timestamp, s2) values(8, 8)", - "INSERT INTO root.test.sg1(timestamp, s3) values(8, 8.0)", - "INSERT INTO root.test.sg2(timestamp, s3) values(8, 8.0)", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) values(9, false, 9, 9.0, 9)", - "INSERT INTO root.test.sg2(timestamp, s1) values(9, true)", - "INSERT INTO root.test.sg2(timestamp, s2) values(9, 9)", - "INSERT INTO root.test.sg2(timestamp, s4) values(9, 9)", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) values(10, true, 10, 10.0, 10)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) values(10, true, 10, 10.0, 10)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) values(1, true, 1, 1.0, 1)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) values(1, false, 1, 1.0, 1)", + "INSERT INTO root.test.db1(timestamp, s2) values(2, 2)", + "INSERT INTO root.test.db1(timestamp, s3) values(2, 2.0)", + "INSERT INTO root.test.db1(timestamp, s4) values(2, 2)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) values(2, true, 2, 2.0, 2)", + "INSERT INTO root.test.db1(timestamp, s1) values(3, false)", + "INSERT INTO root.test.db1(timestamp, s2) values(5, 5)", + "INSERT INTO root.test.db1(timestamp, s3) values(5, 5.0)", + "INSERT INTO root.test.db1(timestamp, s4) values(5, 5)", + "INSERT INTO root.test.db2(timestamp, s2) values(5, 5)", + "INSERT INTO root.test.db2(timestamp, s3) values(5, 5.0)", + "INSERT INTO root.test.db2(timestamp, s4) values(5, 5)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) values(6, true, 6, 6.0, 6)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) values(6, true, 6, 6.0, 6)", + "INSERT INTO root.test.db1(timestamp, s1) values(7, true)", + "INSERT INTO root.test.db1(timestamp, s3) values(7, 7.0)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3) values(7, true, 7, 7.0)", + "INSERT INTO root.test.db1(timestamp, s1) values(8, true)", + "INSERT INTO root.test.db1(timestamp, s2) values(8, 8)", + "INSERT INTO root.test.db1(timestamp, s3) values(8, 8.0)", + "INSERT INTO root.test.db2(timestamp, s3) values(8, 8.0)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) values(9, false, 9, 9.0, 9)", + "INSERT INTO root.test.db2(timestamp, s1) values(9, true)", + "INSERT INTO root.test.db2(timestamp, s2) values(9, 9)", + "INSERT INTO root.test.db2(timestamp, s4) values(9, 9)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) values(10, true, 10, 10.0, 10)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) values(10, true, 10, 10.0, 10)", "INSERT INTO root.test.sg3(time, s5, s6, s7, s8) aligned values(1, 1, true, 1.0, 1)", "INSERT INTO root.test.sg3(time, s6, s7, s8) aligned values(2, false, 2.0, 2)", "INSERT INTO root.test.sg3(time, s5, s7, s8) aligned values(3, 3, 3.0, 3)", @@ -152,21 +152,21 @@ public void unsatisfiedRuleQueryTest() { @Test public void UDAFGroupByTimeWithHavingTest() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, countUDAF("root.test.sg1.s1")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, countUDAF("root.test.db1.s1")}; String[] retArray = new String[] {"1,1,", "5,1,", "9,2,"}; resultSetEqualWithDescOrderTest( - "SELECT count_udaf(sg1.s1) " + "SELECT count_udaf(db1.s1) " + "FROM root.** " + "GROUP BY ([1,11), 2ms) " - + "HAVING count_udaf(sg1.s2) > 1", + + "HAVING count_udaf(db1.s2) > 1", expectedHeader, retArray); resultSetEqualWithDescOrderTest( - "SELECT count_udaf(sg1.s1) " + "SELECT count_udaf(db1.s1) " + "FROM root.**" + "GROUP BY ([1,11), 2ms) " - + "HAVING count_udaf(sg1.s2) > 2", + + "HAVING count_udaf(db1.s2) > 2", expectedHeader, new String[] {}); } @@ -177,12 +177,12 @@ public void UDAFGroupByTimeAlignByDeviceWithHavingTest() { new String[] {TIMESTAMP_STR, "Device", countUDAF("s1"), countUDAF("s2")}; String[] retArray = new String[] { - "1,root.test.sg1,1,2,", - "5,root.test.sg1,1,2,", - "9,root.test.sg1,2,2,", - "1,root.test.sg2,2,2,", - "5,root.test.sg2,1,2,", - "9,root.test.sg2,2,2,", + "1,root.test.db1,1,2,", + "5,root.test.db1,1,2,", + "9,root.test.db1,2,2,", + "1,root.test.db2,2,2,", + "5,root.test.db2,1,2,", + "9,root.test.db2,2,2,", }; resultSetEqualTest( "SELECT count_udaf(s1), count_udaf(s2) " diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFMiscIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFMiscIT.java index fc4bbf588157a..33073173d1808 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFMiscIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFMiscIT.java @@ -45,12 +45,12 @@ public class IoTDBUDAFMiscIT { private static final String[] dataset = new String[] { - "CREATE DATABASE root.sg;", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN;", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN;", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES(1, 1, 1);", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES(2, 2, 2);", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES(3, 3, 3);", + "CREATE DATABASE root.db;", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN;", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN;", + "INSERT INTO root.db.d1(time, s1, s2) VALUES(1, 1, 1);", + "INSERT INTO root.db.d1(time, s1, s2) VALUES(2, 2, 2);", + "INSERT INTO root.db.d1(time, s1, s2) VALUES(3, 3, 3);", "flush;", }; @@ -92,7 +92,7 @@ public void mixUDAFAndUDTFTest() throws Exception { int count = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT udaf(udf(s1, s2)) AS res " + "FROM root.sg.d1 ")) { + statement.executeQuery("SELECT udaf(udf(s1, s2)) AS res " + "FROM root.db.d1 ")) { while (resultSet.next()) { String actual = resultSet.getString("res"); Assert.assertEquals(expected[count], actual); @@ -112,7 +112,7 @@ public void UDAFAsOperandTest() throws Exception { int count = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT udaf(s1) + udaf(s2) AS res " + "FROM root.sg.d1 ")) { + statement.executeQuery("SELECT udaf(s1) + udaf(s2) AS res " + "FROM root.db.d1 ")) { while (resultSet.next()) { String actual = resultSet.getString("res"); Assert.assertEquals(expected[count], actual); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFNormalQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFNormalQueryIT.java index 82f61879dd774..15428a56d3e0b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFNormalQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFNormalQueryIT.java @@ -76,16 +76,16 @@ public class IoTDBUDAFNormalQueryIT { }; private static final String[] dataSet3 = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", - "insert into root.sg.d1(timestamp,s1) values(5,5)", - "insert into root.sg.d1(timestamp,s1) values(12,12)", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", + "insert into root.db.d1(timestamp,s1) values(5,5)", + "insert into root.db.d1(timestamp,s1) values(12,12)", "flush", - "insert into root.sg.d1(timestamp,s1) values(15,15)", - "insert into root.sg.d1(timestamp,s1) values(25,25)", + "insert into root.db.d1(timestamp,s1) values(15,15)", + "insert into root.db.d1(timestamp,s1) values(25,25)", "flush", - "insert into root.sg.d1(timestamp,s1) values(1,111)", - "insert into root.sg.d1(timestamp,s1) values(20,200)", + "insert into root.db.d1(timestamp,s1) values(1,111)", + "insert into root.db.d1(timestamp,s1) values(20,200)", "flush", }; private final String d0s0 = "root.vehicle.d0.s0"; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFOrderByIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFOrderByIT.java index 46f0a35a249ee..9cee6bec0f29d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFOrderByIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFOrderByIT.java @@ -50,48 +50,48 @@ public class IoTDBUDAFOrderByIT { protected static final String[] dataset = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d.bigNum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d.floatNum WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d.bigNum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d.floatNum WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)", "flush", - "CREATE TIMESERIES root.sg.d2.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.bigNum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.floatNum WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)", + "CREATE TIMESERIES root.db.d2.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.bigNum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.floatNum WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)", }; @BeforeClass @@ -124,7 +124,7 @@ private static void registerUDAF() { @Test public void UDAFOrderByWithAggregationTest() { String sql = - "SELECT avg_udaf(num) FROM root.sg.d " + "SELECT avg_udaf(num) FROM root.db.d " + "GROUP BY SESSION(10000ms) " + "ORDER BY avg_udaf(num) DESC"; double[][] ans = new double[][] {{15.0}, {13.0}, {13.0}, {11.0}, {6.4}, {4.6}}; @@ -153,7 +153,7 @@ public void UDAFOrderByWithAggregationTest() { public void UDAFOrderByWithAggregationTest2() { String sql = "SELECT avg_udaf(num) " - + "FROM root.sg.d " + + "FROM root.db.d " + "GROUP BY SESSION(10000ms) " + "ORDER BY max_value(floatNum)"; double[][] ans = @@ -190,7 +190,7 @@ public void UDAFOrderByWithAggregationTest2() { public void UDAFOrderByWithAggregationTest3() { String sql = "SELECT avg_udaf(num) " - + "FROM root.sg.d GROUP BY SESSION(10000ms) " + + "FROM root.db.d GROUP BY SESSION(10000ms) " + "ORDER BY avg_udaf(num) DESC, max_value(floatNum)"; double[] ans = new double[] {15.0, 13.0, 13.0, 11.0, 6.4, 4.6}; long[] times = @@ -218,7 +218,7 @@ public void UDAFOrderByWithAggregationTest3() { public void UDAFOrderByWithAggregationTest4() { String sql = "SELECT avg_udaf(num) + avg_udaf(floatNum) " - + "FROM root.sg.d " + + "FROM root.db.d " + "GROUP BY SESSION(10000ms) " + "ORDER BY avg_udaf(num) + avg_udaf(floatNum)"; double[][] ans = @@ -272,18 +272,18 @@ public void UDAFOrderByWithAggregationAlignByDeviceTest() { }; String[] device = new String[] { - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d", - "root.sg.d2", - "root.sg.d2", - "root.sg.d", - "root.sg.d2" + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d", + "root.db.d2", + "root.db.d2", + "root.db.d", + "root.db.d2" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -426,8 +426,8 @@ public void UDAFOrderByWithAggregationAlignByDeviceTest12() { } private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { - String device = "root.sg.d"; - if (!deviceAsc) device = "root.sg.d2"; + String device = "root.db.d"; + if (!deviceAsc) device = "root.db.d2"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { @@ -451,10 +451,10 @@ private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { assertEquals(device, actualDeviceList.get(0)); assertEquals(Double.parseDouble(value.toString()), actualValueList.get(0), 1); // Change device name - if (device.equals("root.sg.d")) { - device = "root.sg.d2"; + if (device.equals("root.db.d")) { + device = "root.db.d2"; } else { - device = "root.sg.d"; + device = "root.db.d"; } assertEquals(device, actualDeviceList.get(1)); assertEquals(Double.parseDouble(value.toString()), actualValueList.get(1), 1); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFIntermediateBlockSerdeIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFIntermediateBlockSerdeIT.java index 06464debd9ea6..7e7b6d65874ee 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFIntermediateBlockSerdeIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFIntermediateBlockSerdeIT.java @@ -39,12 +39,12 @@ public class IoTDBUDFIntermediateBlockSerdeIT { private static final String[] SQLs = new String[] { - "insert into root.sg.d1(time, s1) values (1,1)", - "insert into root.sg.d1(time, s1) values (2,2)", - "insert into root.sg.d1(time, s1) values (3,3)", - "insert into root.sg.d1(time, s1) values (4,4)", - "insert into root.sg.d1(time, s1) values (5,5)", - "insert into root.sg.d1(time, s1) values (6,6)" + "insert into root.db.d1(time, s1) values (1,1)", + "insert into root.db.d1(time, s1) values (2,2)", + "insert into root.db.d1(time, s1) values (3,3)", + "insert into root.db.d1(time, s1) values (4,4)", + "insert into root.db.d1(time, s1) values (5,5)", + "insert into root.db.d1(time, s1) values (6,6)" }; @BeforeClass @@ -63,11 +63,11 @@ public static void tearDown() throws Exception { public void testM4() { String[] expectedHeader = new String[] { - TIMESTAMP_STR, "EQUAL_SIZE_BUCKET_M4_SAMPLE(root.sg.d1.s1, \"proportion\"=\"1\")" + TIMESTAMP_STR, "EQUAL_SIZE_BUCKET_M4_SAMPLE(root.db.d1.s1, \"proportion\"=\"1\")" }; String[] retArray = new String[] {"1,1.0,", "2,2.0,", "3,3.0,", "4,4.0,", "5,5.0,", "6,6.0,"}; resultSetEqualWithDescOrderTest( - "select EQUAL_SIZE_BUCKET_M4_SAMPLE(s1,'proportion'='1') from root.sg.d1", + "select EQUAL_SIZE_BUCKET_M4_SAMPLE(s1,'proportion'='1') from root.db.d1", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFWindowQuery2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFWindowQuery2IT.java index c2a2db78b36d9..42ed5cecc5622 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFWindowQuery2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFWindowQuery2IT.java @@ -65,9 +65,9 @@ public static void tearDown() throws Exception { private static void createTimeSeries() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE DATABASE root.db"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 with datatype=INT32,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -77,16 +77,16 @@ private static void generateData() { // SessionWindow try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (1, 1, 1)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (2, 2, 2)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (3, 3, 3)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (9, 9, 9)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (5, 5, 5)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (12, 12, 12)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (14, 14, 14)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (18, 18, 18)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (21, 21, 21)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (24, 24, 24)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (1, 1, 1)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (2, 2, 2)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (3, 3, 3)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (9, 9, 9)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (5, 5, 5)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (12, 12, 12)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (14, 14, 14)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (18, 18, 18)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (21, 21, 21)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (24, 24, 24)"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -129,7 +129,7 @@ private void testSessionTimeWindowSS( if (displayBegin == null) { sql = String.format( - "select window_start_end(s1, '%s'='%s', '%s'='%s') from root.sg.d1", + "select window_start_end(s1, '%s'='%s', '%s'='%s') from root.db.d1", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_SESSION, UDFTestConstant.SESSION_GAP_KEY, @@ -137,7 +137,7 @@ private void testSessionTimeWindowSS( } else { sql = String.format( - "select window_start_end(s1, '%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s') from root.sg.d1", + "select window_start_end(s1, '%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s') from root.db.d1", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_SESSION, UDFTestConstant.DISPLAY_WINDOW_BEGIN_KEY, @@ -171,12 +171,12 @@ private void testStateWindowSS( if (delta == null) { sql = String.format( - "select window_start_end(%s, '%s'='%s') from root.sg.d1", + "select window_start_end(%s, '%s'='%s') from root.db.d1", "s2", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_STATE); } else { sql = String.format( - "select window_start_end(%s, '%s'='%s', '%s'='%s') from root.sg.d1", + "select window_start_end(%s, '%s'='%s', '%s'='%s') from root.db.d1", "s2", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_STATE, @@ -186,7 +186,7 @@ private void testStateWindowSS( } else { sql = String.format( - "select window_start_end(%s, '%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s') from root.sg.d1", + "select window_start_end(%s, '%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s') from root.db.d1", "s2", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_STATE, diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFAlignByTimeQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFAlignByTimeQueryIT.java index e3955df58d604..eb0e2a74b449b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFAlignByTimeQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFAlignByTimeQueryIT.java @@ -86,8 +86,8 @@ private static void createTimeSeries() { statement.execute("CREATE TIMESERIES root.vehicle.d4.s1 with datatype=INT32,encoding=PLAIN"); statement.execute("CREATE TIMESERIES root.vehicle.d4.s2 with datatype=INT32,encoding=PLAIN"); // create aligned timeseries - statement.execute(("CREATE DATABASE root.sg1")); - statement.execute("CREATE ALIGNED TIMESERIES root.sg1(s1 INT32, s2 INT32)"); + statement.execute(("CREATE DATABASE root.db1")); + statement.execute("CREATE ALIGNED TIMESERIES root.db1(s1 INT32, s2 INT32)"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -116,7 +116,7 @@ private static void generateData() { "insert into root.vehicle.d4(timestamp,s1) values(%d,%d)", 2 * i, 3 * i))); statement.execute( (String.format( - "insert into root.sg1(timestamp,s1, s2) aligned values(%d,%d,%d)", i, i, i))); + "insert into root.db1(timestamp,s1, s2) aligned values(%d,%d,%d)", i, i, i))); } } catch (SQLException throwable) { fail(throwable.getMessage()); 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 61de72829ccc9..32f97e990160c 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 @@ -55,12 +55,12 @@ public class IoTDBUDTFBuiltinFunctionIT { private static final String[] INSERTION_SQLS = { - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s8, s10, s11, s12) values (0, 0, 0, 0, 0, true, '0', 0, 0, '2024-01-01', 0, '0')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s10, s11, s12) values (2, 1, 1, 1, 1, false, '1', 1, '2024-01-02', 1, '1')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s10, s11, s12) values (4, 2, 2, 2, 2, false, '2', 2, '2024-01-03', 2, '2')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (6, 3, 3, 3, 3, true, '3', 3, '2024-01-04', 3, '3')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (8, 4, 4, 4, 4, true, '4', 4, '2024-01-05', 4, '4')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (10000000000, 5, 5, 5, 5, false, '5', 5, '2024-01-06', 5, '5')" + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s8, s10, s11, s12) values (0, 0, 0, 0, 0, true, '0', 0, 0, '2024-01-01', 0, '0')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s10, s11, s12) values (2, 1, 1, 1, 1, false, '1', 1, '2024-01-02', 1, '1')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s10, s11, s12) values (4, 2, 2, 2, 2, false, '2', 2, '2024-01-03', 2, '2')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (6, 3, 3, 3, 3, true, '3', 3, '2024-01-04', 3, '3')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (8, 4, 4, 4, 4, true, '4', 4, '2024-01-05', 4, '4')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (10000000000, 5, 5, 5, 5, false, '5', 5, '2024-01-06', 5, '5')" }; private static final double E = 0.0001; @@ -80,16 +80,16 @@ public static void tearDown() throws Exception { private static void createTimeSeries() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s3 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s4 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s5 with datatype=BOOLEAN,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s6 with datatype=TEXT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s10 with datatype=DATE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s11 with datatype=TIMESTAMP,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s12 with datatype=STRING,encoding=PLAIN"); + statement.execute("CREATE DATABASE root.db"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s3 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s4 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s5 with datatype=BOOLEAN,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s6 with datatype=TEXT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s10 with datatype=DATE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s11 with datatype=TIMESTAMP,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s12 with datatype=STRING,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -141,7 +141,7 @@ private void testMathFunction(String functionName, MathFunctionProxy functionPro ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4) from root.sg.d1", + "select %s(s1), %s(s2), %s(s3), %s(s4) from root.db.d1", functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); @@ -160,7 +160,7 @@ private void testMathFunction(String functionName, MathFunctionProxy functionPro resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4) from root.sg.d1 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4) from root.db.d1 align by device", functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); @@ -191,7 +191,7 @@ public void testSelectorFunctions() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s), %s(s10, %s), %s(s11, %s), %s(s12, %s) from root.sg.d1", + "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s), %s(s10, %s), %s(s11, %s), %s(s12, %s) from root.db.d1", TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K)); int columnCount = resultSet.getMetaData().getColumnCount(); @@ -214,7 +214,7 @@ public void testSelectorFunctions() { resultSet = statement.executeQuery( String.format( - "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s) from root.sg.d1 align by device", + "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s) from root.db.d1 align by device", TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K)); columnCount = resultSet.getMetaData().getColumnCount(); @@ -236,7 +236,7 @@ public void testSelectorFunctions() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s), %s(s10, %s), %s(s11, %s), %s(s12, %s) from root.sg.d1", + "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s), %s(s10, %s), %s(s11, %s), %s(s12, %s) from root.db.d1", BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K)); @@ -260,7 +260,7 @@ public void testSelectorFunctions() { resultSet = statement.executeQuery( String.format( - "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s) from root.sg.d1 align by device", + "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s) from root.db.d1 align by device", BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K)); columnCount = resultSet.getMetaData().getColumnCount(); @@ -284,7 +284,7 @@ public void testStringProcessingFunctions() { Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery( - "select STRING_CONTAINS(s6, 's'='0'), STRING_MATCHES(s6, 'regex'='\\d') from root.sg.d1"); + "select STRING_CONTAINS(s6, 's'='0'), STRING_MATCHES(s6, 'regex'='\\d') from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 2, columnCount); @@ -302,7 +302,7 @@ public void testStringProcessingFunctions() { resultSet = statement.executeQuery( - "select STRING_CONTAINS(s6, 's'='0'), STRING_MATCHES(s6, 'regex'='\\d') from root.sg.d1 align by device"); + "select STRING_CONTAINS(s6, 's'='0'), STRING_MATCHES(s6, 'regex'='\\d') from root.db.d1 align by device"); columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(2 + 2, columnCount); @@ -338,7 +338,7 @@ public void testVariationTrendCalculationFunction( ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4) from root.sg.d1", + "select %s(s1), %s(s2), %s(s3), %s(s4) from root.db.d1", functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); @@ -359,7 +359,7 @@ public void testVariationTrendCalculationFunction( resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4) from root.sg.d1 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4) from root.db.d1 align by device", functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); @@ -397,7 +397,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select s7, s8, const(s7, 'value'='1024', 'type'='INT64'), pi(s7, s7), e(s7, s8, s7, s8) from root.sg.d1")) { + "select s7, s8, const(s7, 'value'='1024', 'type'='INT64'), pi(s7, s7), e(s7, s8, s7, s8) from root.db.d1")) { assertEquals(1 + 5, resultSet.getMetaData().getColumnCount()); for (int i = 0; i < INSERTION_SQLS.length; ++i) { @@ -415,7 +415,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select s7, s8, const(s7, 'value'='1024', 'type'='INT64'), pi(s7, s7), e(s7, s8, s7, s8) from root.sg.d1 align by device")) { + "select s7, s8, const(s7, 'value'='1024', 'type'='INT64'), pi(s7, s7), e(s7, s8, s7, s8) from root.db.d1 align by device")) { assertEquals(2 + 5, resultSet.getMetaData().getColumnCount()); for (int i = 0; i < INSERTION_SQLS.length; ++i) { @@ -433,7 +433,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet ignored = - statement.executeQuery("select const(s7, 'value'='1024') from root.sg.d1")) { + statement.executeQuery("select const(s7, 'value'='1024') from root.db.d1")) { fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("attribute \"type\" is required but was not provided")); @@ -441,7 +441,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet ignored = - statement.executeQuery("select const(s8, 'type'='INT64') from root.sg.d1")) { + statement.executeQuery("select const(s8, 'type'='INT64') from root.db.d1")) { fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("attribute \"value\" is required but was not provided")); @@ -450,7 +450,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet ignored = statement.executeQuery( - "select const(s8, 'value'='1024', 'type'='long') from root.sg.d1")) { + "select const(s8, 'value'='1024', 'type'='long') from root.db.d1")) { fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("the given value type is not supported")); @@ -459,7 +459,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet ignored = statement.executeQuery( - "select const(s8, 'value'='1024e', 'type'='INT64') from root.sg.d1")) { + "select const(s8, 'value'='1024e', 'type'='INT64') from root.db.d1")) { fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("java.lang.NumberFormatException")); @@ -483,7 +483,7 @@ public void testConversionFunction() { Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery( - "select cast(s1, 'type'='TEXT'), cast(s3, 'type'='FLOAT'), cast(s5, 'type'='INT32'), cast(s7, 'type'='DOUBLE') from root.sg.d1"); + "select cast(s1, 'type'='TEXT'), cast(s3, 'type'='FLOAT'), cast(s5, 'type'='INT32'), cast(s7, 'type'='DOUBLE') from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(5, columnCount); @@ -500,7 +500,7 @@ public void testConversionFunction() { resultSet = statement.executeQuery( - "select cast(s1, 'type'='TEXT'), cast(s3, 'type'='FLOAT'), cast(s5, 'type'='INT32'), cast(s7, 'type'='DOUBLE') from root.sg.d1 align by device"); + "select cast(s1, 'type'='TEXT'), cast(s3, 'type'='FLOAT'), cast(s5, 'type'='INT32'), cast(s7, 'type'='DOUBLE') from root.db.d1 align by device"); columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(6, columnCount); @@ -524,26 +524,26 @@ public void testConversionFunction() { public void testContinuouslySatisfies() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d2.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d2.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d2.s3 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d2.s4 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d2.s5 with datatype=BOOLEAN,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s3 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s4 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s5 with datatype=BOOLEAN,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } // create timeseries with only 0,1 values String[] ZERO_ONE_SQL = { - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (0, 0, 0, 0, 0, false)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (1, 1, 1, 1, 1, true)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (2, 1, 1, 1, 1, true)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (3, 0, 0, 0, 0, false)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (4, 1, 1, 1, 1, true)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (5, 0, 0, 0, 0, false)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (6, 0, 0, 0, 0, false)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (7, 1, 1, 1, 1, true)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (10000000000, 0, 0, 0, 0, false)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (0, 0, 0, 0, 0, false)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (1, 1, 1, 1, 1, true)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (2, 1, 1, 1, 1, true)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (3, 0, 0, 0, 0, false)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (4, 1, 1, 1, 1, true)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (5, 0, 0, 0, 0, false)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (6, 0, 0, 0, 0, false)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (7, 1, 1, 1, 1, true)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (10000000000, 0, 0, 0, 0, false)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -565,7 +565,7 @@ public void testContinuouslySatisfies() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2", functionName, functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 5, columnCount); @@ -586,7 +586,7 @@ public void testContinuouslySatisfies() { resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2 align by device", functionName, functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(2 + 5, columnCount); @@ -617,7 +617,7 @@ public void testContinuouslySatisfies() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2", functionName, functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); @@ -639,7 +639,7 @@ public void testContinuouslySatisfies() { resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2 align by device", functionName, functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); @@ -671,7 +671,7 @@ public void testContinuouslySatisfies() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2", functionName, functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 5, columnCount); @@ -692,7 +692,7 @@ public void testContinuouslySatisfies() { resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2 align by device", functionName, functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(2 + 5, columnCount); @@ -723,7 +723,7 @@ public void testContinuouslySatisfies() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2", functionName, functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 5, columnCount); @@ -744,7 +744,7 @@ public void testContinuouslySatisfies() { resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2 align by device", functionName, functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(2 + 5, columnCount); @@ -776,7 +776,7 @@ public void testOnOffFunction() { statement.executeQuery( String.format( Locale.ENGLISH, - "select on_off(s1,'threshold'='%f'), on_off(s2,'threshold'='%f'), on_off(s3,'threshold'='%f'), on_off(s4,'threshold'='%f') from root.sg.d1", + "select on_off(s1,'threshold'='%f'), on_off(s2,'threshold'='%f'), on_off(s3,'threshold'='%f'), on_off(s4,'threshold'='%f') from root.db.d1", threshold, threshold, threshold, @@ -799,7 +799,7 @@ public void testOnOffFunction() { statement.executeQuery( String.format( Locale.ENGLISH, - "select on_off(s1,'threshold'='%f'), on_off(s2,'threshold'='%f'), on_off(s3,'threshold'='%f'), on_off(s4,'threshold'='%f') from root.sg.d1 align by device", + "select on_off(s1,'threshold'='%f'), on_off(s2,'threshold'='%f'), on_off(s3,'threshold'='%f'), on_off(s4,'threshold'='%f') from root.db.d1 align by device", threshold, threshold, threshold, @@ -837,7 +837,7 @@ public void testInRange() { String.format( Locale.ENGLISH, "select in_range(s1,'upper'='%f','lower'='%f'), in_range(s2,'upper'='%f','lower'='%f'), " - + "in_range(s3,'upper'='%f','lower'='%f'), in_range(s4,'upper'='%f','lower'='%f') from root.sg.d1", + + "in_range(s3,'upper'='%f','lower'='%f'), in_range(s4,'upper'='%f','lower'='%f') from root.db.d1", upper, lower, upper, @@ -865,7 +865,7 @@ public void testInRange() { String.format( Locale.ENGLISH, "select in_range(s1,'upper'='%f','lower'='%f'), in_range(s2,'upper'='%f','lower'='%f'), " - + "in_range(s3,'upper'='%f','lower'='%f'), in_range(s4,'upper'='%f','lower'='%f') from root.sg.d1 align by device", + + "in_range(s3,'upper'='%f','lower'='%f'), in_range(s4,'upper'='%f','lower'='%f') from root.db.d1 align by device", upper, lower, upper, @@ -897,14 +897,14 @@ public void testInRange() { public void testEqualBucketSampleForRandom() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d5.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d5.s1 with datatype=INT32,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } String[] SQL_FOR_SAMPLE_S1 = new String[100]; for (int i = 0; i < 100; i++) { SQL_FOR_SAMPLE_S1[i] = - String.format("insert into root.sg.d5(time, s1) values (%d, %d)", i, i); + String.format("insert into root.db.d5(time, s1) values (%d, %d)", i, i); } try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -923,7 +923,7 @@ public void testEqualBucketSampleForRandom() { statement.executeQuery( String.format( Locale.ENGLISH, - "select " + "%s(s1, 'proportion'='%f') from root.sg.d5", + "select " + "%s(s1, 'proportion'='%f') from root.db.d5", functionName, proportionValue)); int columnCount = resultSet.getMetaData().getColumnCount(); @@ -942,12 +942,12 @@ public void testEqualBucketSampleForRandom() { public void testEqualBucketSampleForAgg() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d4.s1 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d4.s2 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d4.s3 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d4.s4 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d4.s5 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d4.s6 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s1 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s2 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s3 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s4 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s5 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s6 with datatype=DOUBLE,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -961,19 +961,19 @@ public void testEqualBucketSampleForAgg() { for (int i = 0; i < 100; i++) { SQL_FOR_SAMPLE_S1[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d4(time, s1) values (%d, %f)", i, i * 1.0); + Locale.ENGLISH, "insert into root.db.d4(time, s1) values (%d, %f)", i, i * 1.0); SQL_FOR_SAMPLE_S2[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d4(time, s2) values (%d, %f)", i, i * 1.0); + Locale.ENGLISH, "insert into root.db.d4(time, s2) values (%d, %f)", i, i * 1.0); SQL_FOR_SAMPLE_S3[i] = - String.format(Locale.ENGLISH, "insert into root.sg.d4(time, s3) values (%d, %d)", i, i); + String.format(Locale.ENGLISH, "insert into root.db.d4(time, s3) values (%d, %d)", i, i); SQL_FOR_SAMPLE_S4[i] = - String.format(Locale.ENGLISH, "insert into root.sg.d4(time, s4) values (%d, %d)", i, i); + String.format(Locale.ENGLISH, "insert into root.db.d4(time, s4) values (%d, %d)", i, i); SQL_FOR_SAMPLE_S5[i] = - String.format(Locale.ENGLISH, "insert into root.sg.d4(time, s5) values (%d, %d)", i, -i); + String.format(Locale.ENGLISH, "insert into root.db.d4(time, s5) values (%d, %d)", i, -i); SQL_FOR_SAMPLE_S6[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d4(time, s6) values (%d, %f)", i, i * 1.0); + Locale.ENGLISH, "insert into root.db.d4(time, s6) values (%d, %f)", i, i * 1.0); } float[] ANSWER1 = new float[] {4.5F, 14.5F, 24.5F, 34.5F, 44.5F, 54.5F, 64.5F, 74.5F, 84.5F, 94.5F}; @@ -1011,7 +1011,7 @@ public void testEqualBucketSampleForAgg() { + "%s(s4, 'type'='%s', 'proportion'='%f'), " + "%s(s5, 'type'='%s', 'proportion'='%f'), " + "%s(s6, 'type'='%s', 'proportion'='%f')" - + "from root.sg.d4", + + "from root.db.d4", functionName, proportionValue, functionName, @@ -1049,14 +1049,14 @@ public void testEqualBucketSampleForAgg() { public void testEqualBucketSampleForM4() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d3.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d3.s1 with datatype=INT32,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } String[] SQL_FOR_SAMPLE = new String[100]; for (int i = 0; i < 100; i++) { SQL_FOR_SAMPLE[i] = - String.format("insert into root.sg.d3(time, s1) values (%d, %d)", i, i + 1); + String.format("insert into root.db.d3(time, s1) values (%d, %d)", i, i + 1); } int[] ANSWER1 = new int[] {1, 2, 39, 40, 41, 42, 79, 80, 81, 82, 99, 100}; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -1077,7 +1077,7 @@ public void testEqualBucketSampleForM4() { statement.executeQuery( String.format( Locale.ENGLISH, - "select %s(s1, 'method'='%s', 'proportion'='%f') from root.sg.d3", + "select %s(s1, 'method'='%s', 'proportion'='%f') from root.db.d3", functionName, methodName, proportionValue)); @@ -1096,11 +1096,11 @@ public void testEqualBucketSampleForM4() { public void testEqualBucketSampleForOutlier() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d6.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d6.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d6.s3 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d6.s4 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d6.s5 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d6.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d6.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d6.s3 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d6.s4 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d6.s5 with datatype=FLOAT,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -1112,24 +1112,24 @@ public void testEqualBucketSampleForOutlier() { for (int i = 0; i < 100; i++) { SQL_FOR_SAMPLE_S1[i] = String.format( - "insert into root.sg.d6(time, s1) values (%d, %d)", + "insert into root.db.d6(time, s1) values (%d, %d)", i, i % 5 == 0 && i % 10 != 0 ? i + 100 : i); SQL_FOR_SAMPLE_S2[i] = String.format( - "insert into root.sg.d6(time, s2) values (%d, %d)", i, i % 10 == 6 ? i + 100 : i); + "insert into root.db.d6(time, s2) values (%d, %d)", i, i % 10 == 6 ? i + 100 : i); if (i % 10 == 9 || i % 20 == 0) { - SQL_FOR_SAMPLE_S2[i] = String.format("insert into root.sg.d6(time, s2) values (%d, 0)", i); + SQL_FOR_SAMPLE_S2[i] = String.format("insert into root.db.d6(time, s2) values (%d, 0)", i); } SQL_FOR_SAMPLE_S3[i] = String.format( - "insert into root.sg.d6(time, s3) values (%d, %d)", i, i % 10 == 7 ? i + 100 : i); + "insert into root.db.d6(time, s3) values (%d, %d)", i, i % 10 == 7 ? i + 100 : i); SQL_FOR_SAMPLE_S4[i] = String.format( - "insert into root.sg.d6(time, s4) values (%d, %d)", i, i % 10 == 8 ? i + 100 : i); + "insert into root.db.d6(time, s4) values (%d, %d)", i, i % 10 == 8 ? i + 100 : i); } for (int i = 0; i < 20; i++) { SQL_FOR_SAMPLE_S5[i] = - String.format("insert into root.sg.d6(time, s5) values (%d, %d)", i, i); + String.format("insert into root.db.d6(time, s5) values (%d, %d)", i, i); } int[] ANSWER1 = new int[] {105, 115, 125, 135, 145, 155, 165, 175, 185, 195}; long[] ANSWER2 = new long[] {106, 116, 126, 136, 146, 156, 166, 176, 186, 196}; @@ -1162,7 +1162,7 @@ public void testEqualBucketSampleForOutlier() { Locale.ENGLISH, "select " + "%s(s1, 'proportion'='%f', 'type'='%s', 'number'='%d') " - + "from root.sg.d6", + + "from root.db.d6", functionName, proportionValue, "avg", @@ -1180,7 +1180,7 @@ public void testEqualBucketSampleForOutlier() { Locale.ENGLISH, "select " + "%s(s2, 'proportion'='%f', 'type'='%s', 'number'='%d') " - + "from root.sg.d6", + + "from root.db.d6", functionName, proportionValue, "stendis", @@ -1198,7 +1198,7 @@ public void testEqualBucketSampleForOutlier() { Locale.ENGLISH, "select " + "%s(s3, 'proportion'='%f', 'type'='%s', 'number'='%d') " - + "from root.sg.d6", + + "from root.db.d6", functionName, proportionValue, "cos", @@ -1216,7 +1216,7 @@ public void testEqualBucketSampleForOutlier() { Locale.ENGLISH, "select " + "%s(s4, 'proportion'='%f', 'type'='%s', 'number'='%d') " - + "from root.sg.d6", + + "from root.db.d6", functionName, proportionValue, "prenextdis", @@ -1234,7 +1234,7 @@ public void testEqualBucketSampleForOutlier() { Locale.ENGLISH, "select " + "%s(s5, 'proportion'='%f', 'type'='%s', 'number'='%d') " - + "from root.sg.d6", + + "from root.db.d6", functionName, 0.5, "cos", @@ -1494,15 +1494,15 @@ private void test_M4_constantTimeSeries() { public void testUDTFJexl() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d7.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s2 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s3 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s4 with datatype=TEXT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s5 with datatype=BOOLEAN,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s6 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s7 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s8 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s9 with datatype=TEXT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s2 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s3 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s4 with datatype=TEXT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s5 with datatype=BOOLEAN,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s6 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s7 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s8 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s9 with datatype=TEXT,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -1518,77 +1518,77 @@ public void testUDTFJexl() { for (int i = 0; i < 5; i++) { SQL_FOR_SAMPLE_1[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s1) values (%d, %d)", i, i + 1); + Locale.ENGLISH, "insert into root.db.d7(time, s1) values (%d, %d)", i, i + 1); SQL_FOR_SAMPLE_2[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s2) values (%d, %f)", i, i + 1.0); + Locale.ENGLISH, "insert into root.db.d7(time, s2) values (%d, %f)", i, i + 1.0); SQL_FOR_SAMPLE_3[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s3) values (%d, %f)", i, i + 1.0); + Locale.ENGLISH, "insert into root.db.d7(time, s3) values (%d, %f)", i, i + 1.0); SQL_FOR_SAMPLE_4[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s4) values (%d, '%s')", i, "string"); - SQL_FOR_SAMPLE_5[i] = String.format("insert into root.sg.d7(time, s5) values (%d, true)", i); + Locale.ENGLISH, "insert into root.db.d7(time, s4) values (%d, '%s')", i, "string"); + SQL_FOR_SAMPLE_5[i] = String.format("insert into root.db.d7(time, s5) values (%d, true)", i); SQL_FOR_SAMPLE_6[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s6) values (%d, %d)", i, i + 8); + Locale.ENGLISH, "insert into root.db.d7(time, s6) values (%d, %d)", i, i + 8); SQL_FOR_SAMPLE_7[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s7) values (%d, %d)", i, i + 1); + Locale.ENGLISH, "insert into root.db.d7(time, s7) values (%d, %d)", i, i + 1); SQL_FOR_SAMPLE_8[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s8) values (%d, %f)", i, i + 1.0); + Locale.ENGLISH, "insert into root.db.d7(time, s8) values (%d, %f)", i, i + 1.0); SQL_FOR_SAMPLE_9[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s9) values (%d, '%s')", i, "string"); + Locale.ENGLISH, "insert into root.db.d7(time, s9) values (%d, '%s')", i, "string"); } SQL_FOR_SAMPLE_1[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s1) values (%d, %d)", + "insert into root.db.d7(time, s1) values (%d, %d)", 10000000000L, 5 + 1); SQL_FOR_SAMPLE_2[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s2) values (%d, %f)", + "insert into root.db.d7(time, s2) values (%d, %f)", 10000000000L, 5 + 1.0); SQL_FOR_SAMPLE_3[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s3) values (%d, %f)", + "insert into root.db.d7(time, s3) values (%d, %f)", 10000000000L, 5 + 1.0); SQL_FOR_SAMPLE_4[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s4) values (%d, '%s')", + "insert into root.db.d7(time, s4) values (%d, '%s')", 10000000000L, "string"); - SQL_FOR_SAMPLE_5[5] = String.format("insert into root.sg.d7(time, s5) values (%d, true)", 5); + SQL_FOR_SAMPLE_5[5] = String.format("insert into root.db.d7(time, s5) values (%d, true)", 5); SQL_FOR_SAMPLE_6[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s6) values (%d, %d)", + "insert into root.db.d7(time, s6) values (%d, %d)", 10000000000L, 5 + 8); SQL_FOR_SAMPLE_7[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s7) values (%d, %d)", + "insert into root.db.d7(time, s7) values (%d, %d)", 10000000000L, 5 + 1); SQL_FOR_SAMPLE_8[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s8) values (%d, %f)", + "insert into root.db.d7(time, s8) values (%d, %f)", 10000000000L, 5 + 1.0); SQL_FOR_SAMPLE_9[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s9) values (%d, '%s')", + "insert into root.db.d7(time, s9) values (%d, '%s')", 10000000000L, "string"); double[] ANSWER1 = new double[] {2, 4, 6, 8, 10, 12}; @@ -1641,7 +1641,7 @@ public void testUDTFJexl() { + "%s(s7, s8, 'expr'='%s'), " + "%s(s4, s7, s1, 'expr'='%s'), " + "%s(s1, s7, s8, s5, 'expr'='%s') " - + "from root.sg.d7", + + "from root.db.d7", functionName, expr1, functionName, @@ -1687,7 +1687,7 @@ public void testUDTFJexl() { + "%s(s7, s8, 'expr'='%s'), " + "%s(s4, s7, s1, 'expr'='%s'), " + "%s(s1, s7, s8, s5, 'expr'='%s') " - + "from root.sg.d7 align by device", + + "from root.db.d7 align by device", functionName, expr1, functionName, diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFHybridQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFHybridQueryIT.java index 93e7a09bb51af..297c3fe0cbc6d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFHybridQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFHybridQueryIT.java @@ -198,7 +198,7 @@ public void testUserDefinedFunctionFillFunctionHybridQuery() { public void testLastUserDefinedFunctionQuery() { String sql = String.format( - "select last counter(temperature, '%s'='%s') from root.sgcc.wf03.wt01", + "select last counter(temperature, '%s'='%s') from root.dbcc.wf03.wt01", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_ROW_BY_ROW); try (Connection connection = EnvFactory.getEnv().getConnection(); 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 798f1b2b889d4..9f39b00e2a27e 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 @@ -37,99 +37,99 @@ public class AlignedWriteUtil { private static final String[] sqls = new String[] { - "CREATE DATABASE root.sg1", - "create aligned timeseries root.sg1.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64, s4 BOOLEAN, s5 TEXT)", - "create timeseries root.sg1.d2.s1 WITH DATATYPE=FLOAT, encoding=RLE", - "create timeseries root.sg1.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", - "create timeseries root.sg1.d2.s3 WITH DATATYPE=INT64", - "create timeseries root.sg1.d2.s4 WITH DATATYPE=BOOLEAN", - "create timeseries root.sg1.d2.s5 WITH DATATYPE=TEXT", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(1, 1.0, 1, 1, TRUE, 'aligned_test1')", - "insert into root.sg1.d1(time, s1, s2, s3, s5) aligned values(2, 2.0, 2, 2, 'aligned_test2')", - "insert into root.sg1.d1(time, s1, s3, s4, s5) aligned values(3, 3.0, 3, FALSE, 'aligned_test3')", - "insert into root.sg1.d1(time, s1, s2, s4, s5) aligned values(4, 4.0, 4, TRUE, 'aligned_test4')", - "insert into root.sg1.d1(time, s1, s2, s4, s5) aligned values(5, 5.0, 5, TRUE, 'aligned_test5')", - "insert into root.sg1.d1(time, s1, s2, s3, s4) aligned values(6, 6.0, 6, 6, TRUE)", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(7, 7.0, 7, 7, FALSE, 'aligned_test7')", - "insert into root.sg1.d1(time, s1, s2, s3, s5) aligned values(8, 8.0, 8, 8, 'aligned_test8')", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(9, 9.0, 9, 9, FALSE, 'aligned_test9')", - "insert into root.sg1.d1(time, s2, s3, s4, s5) aligned values(10, 10, 10, TRUE, 'aligned_test10')", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(1, 1.0, 1, 1, TRUE, 'non_aligned_test1')", - "insert into root.sg1.d2(time, s1, s2, s3, s5) values(2, 2.0, 2, 2, 'non_aligned_test2')", - "insert into root.sg1.d2(time, s1, s3, s4, s5) values(3, 3.0, 3, FALSE, 'non_aligned_test3')", - "insert into root.sg1.d2(time, s1, s2, s4, s5) values(4, 4.0, 4, TRUE, 'non_aligned_test4')", - "insert into root.sg1.d2(time, s1, s2, s4, s5) values(5, 5.0, 5, TRUE, 'non_aligned_test5')", - "insert into root.sg1.d2(time, s1, s2, s3, s4) values(6, 6.0, 6, 6, TRUE)", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(7, 7.0, 7, 7, FALSE, 'non_aligned_test7')", - "insert into root.sg1.d2(time, s1, s2, s3, s5) values(8, 8.0, 8, 8, 'non_aligned_test8')", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(9, 9.0, 9, 9, FALSE, 'non_aligned_test9')", - "insert into root.sg1.d2(time, s2, s3, s4, s5) values(10, 10, 10, TRUE, 'non_aligned_test10')", + "CREATE DATABASE root.db1", + "create aligned timeseries root.db1.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64, s4 BOOLEAN, s5 TEXT)", + "create timeseries root.db1.d2.s1 WITH DATATYPE=FLOAT, encoding=RLE", + "create timeseries root.db1.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", + "create timeseries root.db1.d2.s3 WITH DATATYPE=INT64", + "create timeseries root.db1.d2.s4 WITH DATATYPE=BOOLEAN", + "create timeseries root.db1.d2.s5 WITH DATATYPE=TEXT", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(1, 1.0, 1, 1, TRUE, 'aligned_test1')", + "insert into root.db1.d1(time, s1, s2, s3, s5) aligned values(2, 2.0, 2, 2, 'aligned_test2')", + "insert into root.db1.d1(time, s1, s3, s4, s5) aligned values(3, 3.0, 3, FALSE, 'aligned_test3')", + "insert into root.db1.d1(time, s1, s2, s4, s5) aligned values(4, 4.0, 4, TRUE, 'aligned_test4')", + "insert into root.db1.d1(time, s1, s2, s4, s5) aligned values(5, 5.0, 5, TRUE, 'aligned_test5')", + "insert into root.db1.d1(time, s1, s2, s3, s4) aligned values(6, 6.0, 6, 6, TRUE)", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(7, 7.0, 7, 7, FALSE, 'aligned_test7')", + "insert into root.db1.d1(time, s1, s2, s3, s5) aligned values(8, 8.0, 8, 8, 'aligned_test8')", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(9, 9.0, 9, 9, FALSE, 'aligned_test9')", + "insert into root.db1.d1(time, s2, s3, s4, s5) aligned values(10, 10, 10, TRUE, 'aligned_test10')", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(1, 1.0, 1, 1, TRUE, 'non_aligned_test1')", + "insert into root.db1.d2(time, s1, s2, s3, s5) values(2, 2.0, 2, 2, 'non_aligned_test2')", + "insert into root.db1.d2(time, s1, s3, s4, s5) values(3, 3.0, 3, FALSE, 'non_aligned_test3')", + "insert into root.db1.d2(time, s1, s2, s4, s5) values(4, 4.0, 4, TRUE, 'non_aligned_test4')", + "insert into root.db1.d2(time, s1, s2, s4, s5) values(5, 5.0, 5, TRUE, 'non_aligned_test5')", + "insert into root.db1.d2(time, s1, s2, s3, s4) values(6, 6.0, 6, 6, TRUE)", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(7, 7.0, 7, 7, FALSE, 'non_aligned_test7')", + "insert into root.db1.d2(time, s1, s2, s3, s5) values(8, 8.0, 8, 8, 'non_aligned_test8')", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(9, 9.0, 9, 9, FALSE, 'non_aligned_test9')", + "insert into root.db1.d2(time, s2, s3, s4, s5) values(10, 10, 10, TRUE, 'non_aligned_test10')", "flush", - "insert into root.sg1.d1(time, s1, s3, s4, s5) aligned values(3, 30000.0, 30000, TRUE, 'aligned_unseq_test3')", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(11, 11.0, 11, 11)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(12, 12.0, 12, 12)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(13, 13.0, 13, 13)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(14, 14.0, 14, 14)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(15, 15.0, 15, 15)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(16, 16.0, 16, 16)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(17, 17.0, 17, 17)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(18, 18.0, 18, 18)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(19, 19.0, 19, 19)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(20, 20.0, 20, 20)", - "insert into root.sg1.d2(time, s1, s2, s3) values(11, 11.0, 11, 11)", - "insert into root.sg1.d2(time, s1, s2, s3) values(12, 12.0, 12, 12)", - "insert into root.sg1.d2(time, s1, s2, s3) values(13, 13.0, 13, 13)", - "insert into root.sg1.d2(time, s1, s2, s3) values(14, 14.0, 14, 14)", - "insert into root.sg1.d2(time, s1, s2, s3) values(15, 15.0, 15, 15)", - "insert into root.sg1.d2(time, s1, s2, s3) values(16, 16.0, 16, 16)", - "insert into root.sg1.d2(time, s1, s2, s3) values(17, 17.0, 17, 17)", - "insert into root.sg1.d2(time, s1, s2, s3) values(18, 18.0, 18, 18)", - "insert into root.sg1.d2(time, s1, s2, s3) values(19, 19.0, 19, 19)", - "insert into root.sg1.d2(time, s1, s2, s3) values(20, 20.0, 20, 20)", + "insert into root.db1.d1(time, s1, s3, s4, s5) aligned values(3, 30000.0, 30000, TRUE, 'aligned_unseq_test3')", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(11, 11.0, 11, 11)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(12, 12.0, 12, 12)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(13, 13.0, 13, 13)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(14, 14.0, 14, 14)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(15, 15.0, 15, 15)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(16, 16.0, 16, 16)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(17, 17.0, 17, 17)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(18, 18.0, 18, 18)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(19, 19.0, 19, 19)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(20, 20.0, 20, 20)", + "insert into root.db1.d2(time, s1, s2, s3) values(11, 11.0, 11, 11)", + "insert into root.db1.d2(time, s1, s2, s3) values(12, 12.0, 12, 12)", + "insert into root.db1.d2(time, s1, s2, s3) values(13, 13.0, 13, 13)", + "insert into root.db1.d2(time, s1, s2, s3) values(14, 14.0, 14, 14)", + "insert into root.db1.d2(time, s1, s2, s3) values(15, 15.0, 15, 15)", + "insert into root.db1.d2(time, s1, s2, s3) values(16, 16.0, 16, 16)", + "insert into root.db1.d2(time, s1, s2, s3) values(17, 17.0, 17, 17)", + "insert into root.db1.d2(time, s1, s2, s3) values(18, 18.0, 18, 18)", + "insert into root.db1.d2(time, s1, s2, s3) values(19, 19.0, 19, 19)", + "insert into root.db1.d2(time, s1, s2, s3) values(20, 20.0, 20, 20)", "flush", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(13, 130000.0, 130000, 130000, TRUE, 'aligned_unseq_test13')", - "insert into root.sg1.d1(time, s3, s4) aligned values(21, 21, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(22, 22, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(23, 23, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(24, 24, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(25, 25, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(26, 26, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(27, 27, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(28, 28, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(29, 29, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(30, 30, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(21, 21, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(22, 22, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(23, 23, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(24, 24, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(25, 25, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(26, 26, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(27, 27, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(28, 28, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(29, 29, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(30, 30, FALSE)", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(13, 130000.0, 130000, 130000, TRUE, 'aligned_unseq_test13')", + "insert into root.db1.d1(time, s3, s4) aligned values(21, 21, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(22, 22, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(23, 23, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(24, 24, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(25, 25, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(26, 26, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(27, 27, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(28, 28, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(29, 29, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(30, 30, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(21, 21, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(22, 22, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(23, 23, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(24, 24, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(25, 25, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(26, 26, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(27, 27, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(28, 28, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(29, 29, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(30, 30, FALSE)", "flush", - "insert into root.sg1.d1(time, s1, s3, s4) aligned values(23, 230000.0, 230000, FALSE)", - "insert into root.sg1.d1(time, s2, s5) aligned values(31, 31, 'aligned_test31')", - "insert into root.sg1.d1(time, s2, s5) aligned values(32, 32, 'aligned_test32')", - "insert into root.sg1.d1(time, s2, s5) aligned values(33, 33, 'aligned_test33')", - "insert into root.sg1.d1(time, s2, s5) aligned values(34, 34, 'aligned_test34')", - "insert into root.sg1.d1(time, s2, s5) aligned values(35, 35, 'aligned_test35')", - "insert into root.sg1.d1(time, s2, s5) aligned values(36, 36, 'aligned_test36')", - "insert into root.sg1.d1(time, s2, s5) aligned values(37, 37, 'aligned_test37')", - "insert into root.sg1.d1(time, s2, s5) aligned values(38, 38, 'aligned_test38')", - "insert into root.sg1.d1(time, s2, s5) aligned values(39, 39, 'aligned_test39')", - "insert into root.sg1.d1(time, s2, s5) aligned values(40, 40, 'aligned_test40')", - "insert into root.sg1.d2(time, s2, s5) values(31, 31, 'non_aligned_test31')", - "insert into root.sg1.d2(time, s2, s5) values(32, 32, 'non_aligned_test32')", - "insert into root.sg1.d2(time, s2, s5) values(33, 33, 'non_aligned_test33')", - "insert into root.sg1.d2(time, s2, s5) values(34, 34, 'non_aligned_test34')", - "insert into root.sg1.d2(time, s2, s5) values(35, 35, 'non_aligned_test35')", - "insert into root.sg1.d2(time, s2, s5) values(36, 36, 'non_aligned_test36')", - "insert into root.sg1.d2(time, s2, s5) values(37, 37, 'non_aligned_test37')", - "insert into root.sg1.d2(time, s2, s5) values(38, 38, 'non_aligned_test38')", - "insert into root.sg1.d2(time, s2, s5) values(39, 39, 'non_aligned_test39')", - "insert into root.sg1.d2(time, s2, s5) values(40, 40, 'non_aligned_test40')", + "insert into root.db1.d1(time, s1, s3, s4) aligned values(23, 230000.0, 230000, FALSE)", + "insert into root.db1.d1(time, s2, s5) aligned values(31, 31, 'aligned_test31')", + "insert into root.db1.d1(time, s2, s5) aligned values(32, 32, 'aligned_test32')", + "insert into root.db1.d1(time, s2, s5) aligned values(33, 33, 'aligned_test33')", + "insert into root.db1.d1(time, s2, s5) aligned values(34, 34, 'aligned_test34')", + "insert into root.db1.d1(time, s2, s5) aligned values(35, 35, 'aligned_test35')", + "insert into root.db1.d1(time, s2, s5) aligned values(36, 36, 'aligned_test36')", + "insert into root.db1.d1(time, s2, s5) aligned values(37, 37, 'aligned_test37')", + "insert into root.db1.d1(time, s2, s5) aligned values(38, 38, 'aligned_test38')", + "insert into root.db1.d1(time, s2, s5) aligned values(39, 39, 'aligned_test39')", + "insert into root.db1.d1(time, s2, s5) aligned values(40, 40, 'aligned_test40')", + "insert into root.db1.d2(time, s2, s5) values(31, 31, 'non_aligned_test31')", + "insert into root.db1.d2(time, s2, s5) values(32, 32, 'non_aligned_test32')", + "insert into root.db1.d2(time, s2, s5) values(33, 33, 'non_aligned_test33')", + "insert into root.db1.d2(time, s2, s5) values(34, 34, 'non_aligned_test34')", + "insert into root.db1.d2(time, s2, s5) values(35, 35, 'non_aligned_test35')", + "insert into root.db1.d2(time, s2, s5) values(36, 36, 'non_aligned_test36')", + "insert into root.db1.d2(time, s2, s5) values(37, 37, 'non_aligned_test37')", + "insert into root.db1.d2(time, s2, s5) values(38, 38, 'non_aligned_test38')", + "insert into root.db1.d2(time, s2, s5) values(39, 39, 'non_aligned_test39')", + "insert into root.db1.d2(time, s2, s5) values(40, 40, 'non_aligned_test40')", }; public static void insertData() { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/withoutNull/IoTDBWithoutNullAllFilterIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/withoutNull/IoTDBWithoutNullAllFilterIT.java index a5506836764f1..ed87be448da29 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/withoutNull/IoTDBWithoutNullAllFilterIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/withoutNull/IoTDBWithoutNullAllFilterIT.java @@ -47,49 +47,49 @@ public class IoTDBWithoutNullAllFilterIT { private static String[] dataSet1 = new String[] { "CREATE DATABASE root.test", - "CREATE TIMESERIES root.test.sg1.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", "CREATE ALIGNED TIMESERIES root.test.sg3(s5 INT32, s6 BOOLEAN, s7 DOUBLE, s8 INT32)", "CREATE TIMESERIES root.test.sg5.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", "CREATE TIMESERIES root.test.sg5.s9 WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) " + "values(1, true, 1, 1.0, 1)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) " + "values(1, false, 1, 1.0, 1)", - "INSERT INTO root.test.sg1(timestamp, s2) " + "values(2, 2)", - "INSERT INTO root.test.sg1(timestamp, s3) " + "values(2, 2.0)", - "INSERT INTO root.test.sg1(timestamp, s4) " + "values(2, 2)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) " + "values(2, true, 2, 2.0, 2)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) " + "values(1, true, 1, 1.0, 1)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) " + "values(1, false, 1, 1.0, 1)", + "INSERT INTO root.test.db1(timestamp, s2) " + "values(2, 2)", + "INSERT INTO root.test.db1(timestamp, s3) " + "values(2, 2.0)", + "INSERT INTO root.test.db1(timestamp, s4) " + "values(2, 2)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) " + "values(2, true, 2, 2.0, 2)", "flush", - "INSERT INTO root.test.sg1(timestamp, s1) " + "values(3, false)", - "INSERT INTO root.test.sg1(timestamp, s2) " + "values(5, 5)", - "INSERT INTO root.test.sg1(timestamp, s3) " + "values(5, 5.0)", - "INSERT INTO root.test.sg1(timestamp, s4) " + "values(5, 5)", - "INSERT INTO root.test.sg2(timestamp, s2) " + "values(5, 5)", - "INSERT INTO root.test.sg2(timestamp, s3) " + "values(5, 5.0)", - "INSERT INTO root.test.sg2(timestamp, s4) " + "values(5, 5)", + "INSERT INTO root.test.db1(timestamp, s1) " + "values(3, false)", + "INSERT INTO root.test.db1(timestamp, s2) " + "values(5, 5)", + "INSERT INTO root.test.db1(timestamp, s3) " + "values(5, 5.0)", + "INSERT INTO root.test.db1(timestamp, s4) " + "values(5, 5)", + "INSERT INTO root.test.db2(timestamp, s2) " + "values(5, 5)", + "INSERT INTO root.test.db2(timestamp, s3) " + "values(5, 5.0)", + "INSERT INTO root.test.db2(timestamp, s4) " + "values(5, 5)", "flush", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) " + "values(6, true, 6, 6.0, 6)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) " + "values(6, true, 6, 6.0, 6)", - "INSERT INTO root.test.sg1(timestamp, s1) " + "values(7, true)", - "INSERT INTO root.test.sg1(timestamp, s3) " + "values(7, 7.0)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3) " + "values(7, true, 7, 7.0)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) " + "values(6, true, 6, 6.0, 6)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) " + "values(6, true, 6, 6.0, 6)", + "INSERT INTO root.test.db1(timestamp, s1) " + "values(7, true)", + "INSERT INTO root.test.db1(timestamp, s3) " + "values(7, 7.0)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3) " + "values(7, true, 7, 7.0)", "flush", - "INSERT INTO root.test.sg1(timestamp, s1) " + "values(8, true)", - "INSERT INTO root.test.sg1(timestamp, s2) " + "values(8, 8)", - "INSERT INTO root.test.sg1(timestamp, s3) " + "values(8, 8.0)", - "INSERT INTO root.test.sg2(timestamp, s3) " + "values(8, 8.0)", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) " + "values(9, false, 9, 9.0, 9)", - "INSERT INTO root.test.sg2(timestamp, s1) " + "values(9, true)", + "INSERT INTO root.test.db1(timestamp, s1) " + "values(8, true)", + "INSERT INTO root.test.db1(timestamp, s2) " + "values(8, 8)", + "INSERT INTO root.test.db1(timestamp, s3) " + "values(8, 8.0)", + "INSERT INTO root.test.db2(timestamp, s3) " + "values(8, 8.0)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) " + "values(9, false, 9, 9.0, 9)", + "INSERT INTO root.test.db2(timestamp, s1) " + "values(9, true)", "flush", - "INSERT INTO root.test.sg2(timestamp, s2) " + "values(9, 9)", - "INSERT INTO root.test.sg2(timestamp, s4) " + "values(9, 9)", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) " + "values(10, true, 10, 10.0, 10)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) " + "values(10, true, 10, 10.0, 10)", + "INSERT INTO root.test.db2(timestamp, s2) " + "values(9, 9)", + "INSERT INTO root.test.db2(timestamp, s4) " + "values(9, 9)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) " + "values(10, true, 10, 10.0, 10)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) " + "values(10, true, 10, 10.0, 10)", "flush", "INSERT INTO root.test.sg3(time, s5, s6, s7, s8) aligned values(1, 1, true, 1.0, 1)", "INSERT INTO root.test.sg3(time, s6, s7, s8) aligned values(2, false, 2.0, 2)", @@ -185,19 +185,19 @@ public void rawDataWithoutValueFilterQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select * from root.test.sg1 where s2 is not null || s3 is not null")) { + "select * from root.test.db1 where s2 is not null || s3 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -205,38 +205,38 @@ public void rawDataWithoutValueFilterQueryTest() { } try (ResultSet resultSet = - statement.executeQuery("select * from root.test.sg1 where s1 is not null")) { + statement.executeQuery("select * from root.test.db1 where s1 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray2[cnt], ans); cnt++; } Assert.assertEquals(retArray2.length, cnt); } - try (ResultSet resultSet = statement.executeQuery("select * from root.test.sg1")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.test.db1")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray3[cnt], ans); cnt++; } @@ -245,19 +245,19 @@ public void rawDataWithoutValueFilterQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.test.sg1 where s1 is not null || s2 is not null || s3 is not null || s4 is not null")) { + "select * from root.test.db1 where s1 is not null || s2 is not null || s3 is not null || s4 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray4[cnt], ans); cnt++; } @@ -296,19 +296,19 @@ public void rawDataWithValueFilterQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select * from root.test.sg1 where s1 = false && (s2 is not null || s3 is not null)")) { + "select * from root.test.db1 where s1 = false && (s2 is not null || s3 is not null)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); // Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -316,19 +316,19 @@ public void rawDataWithValueFilterQueryTest() { } try (ResultSet resultSet = - statement.executeQuery("select * from root.test.sg1 where s2 = 1 && s1 is not null")) { + statement.executeQuery("select * from root.test.db1 where s2 = 1 && s1 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray2[cnt], ans); cnt++; } @@ -336,24 +336,24 @@ public void rawDataWithValueFilterQueryTest() { } try (ResultSet resultSet = - statement.executeQuery("select * from root.test.sg1 where s2 = 2 && s1 is not null")) { + statement.executeQuery("select * from root.test.db1 where s2 = 2 && s1 is not null")) { Assert.assertFalse(resultSet.next()); } try (ResultSet resultSet = - statement.executeQuery("select * from root.test.sg1 where s1 = true")) { + statement.executeQuery("select * from root.test.db1 where s1 = true")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray3[cnt], ans); cnt++; } @@ -362,19 +362,19 @@ public void rawDataWithValueFilterQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.test.sg1 where s1 = true && (s1 is not null || s2 is not null || s3 is not null || s4 is not null)")) { + "select * from root.test.db1 where s1 = true && (s1 is not null || s2 is not null || s3 is not null || s4 is not null)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray4[cnt], ans); cnt++; } @@ -434,29 +434,29 @@ public void withExpressionQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.sg1 where s2 is not null && s4 is not null && s2 + s4 is not null")) { + "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.db1 where s2 is not null && s4 is not null && s2 + s4 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("-root.test.sg1.s2") + + resultSet.getString("-root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 + root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 + root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 - root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 - root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 * root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 * root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 / root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 / root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 % root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s2 % root.test.db1.s4"); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -465,29 +465,29 @@ public void withExpressionQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.sg1 where s2 is not null || s4 is not null || s2 / s4 is not null")) { + "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.db1 where s2 is not null || s4 is not null || s2 / s4 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("-root.test.sg1.s2") + + resultSet.getString("-root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 + root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 + root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 - root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 - root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 * root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 * root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 / root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 / root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 % root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s2 % root.test.db1.s4"); Assert.assertEquals(retArray2[cnt], ans); cnt++; } @@ -496,30 +496,30 @@ public void withExpressionQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.sg1" + "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.db1" + " where s2 is not null || s4 is not null || s2 % s4 is not null || s2 % s4 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("-root.test.sg1.s2") + + resultSet.getString("-root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 + root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 + root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 - root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 - root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 * root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 * root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 / root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 / root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 % root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s2 % root.test.db1.s4"); Assert.assertEquals(retArray3[cnt], ans); cnt++; } @@ -528,30 +528,30 @@ public void withExpressionQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.sg1" + "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.db1" + " where s2 is not null || s4 is not null || s2 / s4 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("-root.test.sg1.s2") + + resultSet.getString("-root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 + root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 + root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 - root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 - root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 * root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 * root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 / root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 / root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 % root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s2 % root.test.db1.s4"); Assert.assertEquals(retArray4[cnt], ans); cnt++; } @@ -615,32 +615,32 @@ public void withUDFQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select s1, sin(s2), cos(s2), tan(s2) from root.test.sg1 where sin(s2) is not null || s1 is not null")) { + "select s1, sin(s2), cos(s2), tan(s2) from root.test.db1 where sin(s2) is not null || s1 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + (resultSet.getString("sin(root.test.sg1.s2)") == null - || resultSet.getString("sin(root.test.sg1.s2)").equals("null") + + (resultSet.getString("sin(root.test.db1.s2)") == null + || resultSet.getString("sin(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("sin(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("sin(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," - + (resultSet.getString("cos(root.test.sg1.s2)") == null - || resultSet.getString("cos(root.test.sg1.s2)").equals("null") + + (resultSet.getString("cos(root.test.db1.s2)") == null + || resultSet.getString("cos(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("cos(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("cos(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," - + (resultSet.getString("tan(root.test.sg1.s2)") == null - || resultSet.getString("tan(root.test.sg1.s2)").equals("null") + + (resultSet.getString("tan(root.test.db1.s2)") == null + || resultSet.getString("tan(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("tan(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("tan(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()); Assert.assertEquals(retArray1[cnt], ans); @@ -651,14 +651,14 @@ public void withUDFQueryTest() { String[] columns = new String[] { - "root.test.sg1.s1", - "sin(root.test.sg1.s2) + cos(root.test.sg1.s2)", - "cos(sin(root.test.sg1.s2 + root.test.sg1.s4) + root.test.sg1.s2)" + "root.test.db1.s1", + "sin(root.test.db1.s2) + cos(root.test.db1.s2)", + "cos(sin(root.test.db1.s2 + root.test.db1.s4) + root.test.db1.s2)" }; try (ResultSet resultSet = statement.executeQuery( - "select s1, sin(s2) + cos(s2), cos(sin(s2 + s4) + s2) from root.test.sg1 where sin(s2) + cos(s2) is not null || cos(sin(s2 + s4) + s2) is not null")) { + "select s1, sin(s2) + cos(s2), cos(sin(s2 + s4) + s2) from root.test.db1 where sin(s2) + cos(s2) is not null || cos(sin(s2 + s4) + s2) is not null")) { cnt = 0; while (resultSet.next()) { String ans = @@ -687,7 +687,7 @@ public void withUDFQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s1, cos(sin(s2 + s4) + s2) from root.test.sg1 where (cos(sin(s2 + s4) + s2)) is not null")) { + "select s1, cos(sin(s2 + s4) + s2) from root.test.db1 where (cos(sin(s2 + s4) + s2)) is not null")) { cnt = 0; while (resultSet.next()) { String ans = @@ -709,7 +709,7 @@ public void withUDFQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s1, sin(s2) + cos(s2), cos(sin(s2 + s4) + s2) from root.test.sg1 where s1 is not null || s2 is not null || s4 is not null")) { + "select s1, sin(s2) + cos(s2), cos(sin(s2 + s4) + s2) from root.test.db1 where s1 is not null || s2 is not null || s4 is not null")) { cnt = 0; while (resultSet.next()) { String ans = @@ -762,23 +762,23 @@ public void withGroupByTimeQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select avg(s4), sum(s2) from root.test.sg1 group by ([1,10), 2ms) without null all(sum(s2))")) { + "select avg(s4), sum(s2) from root.test.db1 group by ([1,10), 2ms) without null all(sum(s2))")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + (resultSet.getString("avg(root.test.sg1.s4)") == null - || resultSet.getString("avg(root.test.sg1.s4)").equals("null") + + (resultSet.getString("avg(root.test.db1.s4)") == null + || resultSet.getString("avg(root.test.db1.s4)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("avg(root.test.sg1.s4)")) + : new BigDecimal(resultSet.getString("avg(root.test.db1.s4)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," - + (resultSet.getString("sum(root.test.sg1.s2)") == null - || resultSet.getString("sum(root.test.sg1.s2)").equals("null") + + (resultSet.getString("sum(root.test.db1.s2)") == null + || resultSet.getString("sum(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("sum(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("sum(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()); Assert.assertEquals(retArray1[cnt], ans); @@ -789,12 +789,12 @@ public void withGroupByTimeQueryTest() { String[] columns = new String[] { - "avg(root.test.sg1.s4)", "sum(root.test.sg1.s2)", "count(root.test.sg1.s3)" + "avg(root.test.db1.s4)", "sum(root.test.db1.s2)", "count(root.test.db1.s3)" }; try (ResultSet resultSet = statement.executeQuery( - "select avg(s4), sum(s2), count(s3) from root.test.sg1 group by ([1,10), 2ms) without null all(avg(s4), sum(s2))")) { + "select avg(s4), sum(s2), count(s3) from root.test.db1 group by ([1,10), 2ms) without null all(avg(s4), sum(s2))")) { cnt = 0; while (resultSet.next()) { String ans = @@ -823,7 +823,7 @@ public void withGroupByTimeQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select avg(s4) as t, avg(s2) from root.test.sg1 group by ([1,10), 1ms) without null all(t, avg(s2))")) { + "select avg(s4) as t, avg(s2) from root.test.db1 group by ([1,10), 1ms) without null all(t, avg(s2))")) { cnt = 0; while (resultSet.next()) { String ans = @@ -835,10 +835,10 @@ public void withGroupByTimeQueryTest() { .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," - + (resultSet.getString("avg(root.test.sg1.s2)") == null - || resultSet.getString("avg(root.test.sg1.s2)").equals("null") + + (resultSet.getString("avg(root.test.db1.s2)") == null + || resultSet.getString("avg(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("avg(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("avg(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()); Assert.assertEquals(retArray3[cnt], ans); @@ -849,16 +849,16 @@ public void withGroupByTimeQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select avg(s4), sum(s3) as t, avg(s2) from root.test.sg1 group by ([1,10), 2ms) without null all(t, avg(s2))")) { + "select avg(s4), sum(s3) as t, avg(s2) from root.test.db1 group by ([1,10), 2ms) without null all(t, avg(s2))")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + (resultSet.getString("avg(root.test.sg1.s4)") == null - || resultSet.getString("avg(root.test.sg1.s4)").equals("null") + + (resultSet.getString("avg(root.test.db1.s4)") == null + || resultSet.getString("avg(root.test.db1.s4)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("avg(root.test.sg1.s4)")) + : new BigDecimal(resultSet.getString("avg(root.test.db1.s4)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," @@ -868,10 +868,10 @@ public void withGroupByTimeQueryTest() { .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," - + (resultSet.getString("avg(root.test.sg1.s2)") == null - || resultSet.getString("avg(root.test.sg1.s2)").equals("null") + + (resultSet.getString("avg(root.test.db1.s2)") == null + || resultSet.getString("avg(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("avg(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("avg(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()); Assert.assertEquals(retArray4[cnt], ans); @@ -909,7 +909,7 @@ public void withGroupByLevelQueryTest() { String[] columns = new String[] { - "avg(root.*.sg1.s2)", "avg(root.*.sg2.s2)", "sum(root.*.sg1.s4)", "sum(root.*.sg2.s4)" + "avg(root.*.db1.s2)", "avg(root.*.db2.s2)", "sum(root.*.db1.s4)", "sum(root.*.db2.s4)" }; int cnt; @@ -997,7 +997,7 @@ public void withGroupByLevelQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select avg(s2), sum(s4) as t from root.*.sg1 group by ([1, 10), 2ms), level = 1 without null all(avg(s2), t)")) { + "select avg(s2), sum(s4) as t from root.*.db1 group by ([1, 10), 2ms), level = 1 without null all(avg(s2), t)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1029,9 +1029,9 @@ public void withGroupByLevelQueryTest() { @Ignore @Test public void withoutNullColumnsIsFullPathQueryTest() { - // select s2, s3 from root.test.** without null all(root.test.sg1.s2, root.test.sg2.s3) - // select s2, s3 from root.test.sg1, root.test.sg2 without null all(root.test.sg1.s2) - // select s2, s3 from root.test.sg1, root.test.sg2 without null all(root.test.sg1.s2, s3) + // select s2, s3 from root.test.** without null all(root.test.db1.s2, root.test.db2.s3) + // select s2, s3 from root.test.db1, root.test.db2 without null all(root.test.db1.s2) + // select s2, s3 from root.test.db1, root.test.db2 without null all(root.test.db1.s2, s3) System.out.println("withoutNullColumnsIsFullPathQueryTest"); String[] retArray1 = new String[] { @@ -1082,13 +1082,13 @@ public void withoutNullColumnsIsFullPathQueryTest() { String[] columns = new String[] { - "root.test.sg1.s2", "root.test.sg1.s3", "root.test.sg2.s2", "root.test.sg2.s3" + "root.test.db1.s2", "root.test.db1.s3", "root.test.db2.s2", "root.test.db2.s3" }; int cnt; try (ResultSet resultSet = statement.executeQuery( - "select s2, s3 from root.test.** where root.test.sg1.s2 is not null || root.test.sg2.s3 is not null")) { + "select s2, s3 from root.test.** where root.test.db1.s2 is not null || root.test.db2.s3 is not null")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1109,7 +1109,7 @@ public void withoutNullColumnsIsFullPathQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, s3 from root.test.sg1, root.test.sg2 where root.test.sg1.s2 is not null")) { + "select s2, s3 from root.test.db1, root.test.db2 where root.test.db1.s2 is not null")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1130,7 +1130,7 @@ public void withoutNullColumnsIsFullPathQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, s3 from root.test.sg1, root.test.sg2 where root.test.sg1.s2 is not null || s3 is not null")) { + "select s2, s3 from root.test.db1, root.test.db2 where root.test.db1.s2 is not null || s3 is not null")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1151,7 +1151,7 @@ public void withoutNullColumnsIsFullPathQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, s3 from root.test.sg1, root.test.sg2 where root.test.*.s2 is not null")) { + "select s2, s3 from root.test.db1, root.test.db2 where root.test.*.s2 is not null")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1182,10 +1182,10 @@ public void withoutNullColumnsMisMatchSelectedQueryTest() { String[] expectedHeader = new String[] { TIMESTAMP_STR, - "root.test.sg1.s1", - "root.test.sg1.s2", - "root.test.sg1.s3", - "root.test.sg1.s4", + "root.test.db1.s1", + "root.test.db1.s2", + "root.test.db1.s3", + "root.test.db1.s4", }; String[] retArray = new String[] { @@ -1198,7 +1198,7 @@ public void withoutNullColumnsMisMatchSelectedQueryTest() { "10,true,10,10.0,10," }; resultSetEqualTest( - "select s1, s2, s3, s4 from root.test.sg1 where s1 is not null || usage is not null", + "select s1, s2, s3, s4 from root.test.db1 where s1 is not null || usage is not null", expectedHeader, retArray); } @@ -1254,7 +1254,7 @@ public void alignByDeviceQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.test.sg1 group by([1,10), 2ms) without null all(last_value(s2), last_value(s3)) align by device")) { + "select last_value(*) from root.test.db1 group by([1,10), 2ms) without null all(last_value(s2), last_value(s3)) align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1275,7 +1275,7 @@ public void alignByDeviceQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.test.sg1 group by([1,10), 2ms) without null all(last_value(s2)) align by device")) { + "select last_value(*) from root.test.db1 group by([1,10), 2ms) without null all(last_value(s2)) align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1338,7 +1338,7 @@ public void alignByDeviceQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s2) as t, last_value(s3), last_value(s4) from root.test.sg1 group by([1,10), 2ms) without null all(t, last_value(s3)) align by device")) { + "select last_value(s2) as t, last_value(s3), last_value(s4) from root.test.db1 group by([1,10), 2ms) without null all(t, last_value(s3)) align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1357,7 +1357,7 @@ public void alignByDeviceQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s1,s2,s9 from root.test.sg1,root.test.sg5 without null all(s2) align by device")) { + "select s1,s2,s9 from root.test.db1,root.test.sg5 without null all(s2) align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1432,15 +1432,15 @@ public void alignTimeSeriesQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select sg1.s1, sg1.s2, sg3.*, sg2.s3 from root.test where sg3.* is not null || sg1.s2 is not null")) { + "select db1.s1, db1.s2, db3.*, db2.s3 from root.test where db3.* is not null || db1.s2 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," + resultSet.getString("root.test.sg3.s5") + "," @@ -1450,7 +1450,7 @@ public void alignTimeSeriesQueryTest() { + "," + resultSet.getString("root.test.sg3.s8") + "," - + resultSet.getString("root.test.sg2.s3"); + + resultSet.getString("root.test.db2.s3"); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -1458,17 +1458,17 @@ public void alignTimeSeriesQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select sg1.s1, sg1.s2, sg2.s3, sg3.* from root.test where sg3.* is not null")) { + "select db1.s1, db1.s2, db2.s3, db3.* from root.test where db3.* is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg2.s3") + + resultSet.getString("root.test.db2.s3") + "," + resultSet.getString("root.test.sg3.s5") + "," @@ -1485,17 +1485,17 @@ public void alignTimeSeriesQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select sg1.s1, sg1.s2, sg2.s3, sg3.* from root.test where sg3.s5 is not null || sg3.s6 is not null")) { + "select db1.s1, db1.s2, db2.s3, db3.* from root.test where db3.s5 is not null || db3.s6 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg2.s3") + + resultSet.getString("root.test.db2.s3") + "," + resultSet.getString("root.test.sg3.s5") + "," @@ -1512,17 +1512,17 @@ public void alignTimeSeriesQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select sg1.s1, sg1.s2, sg2.s3, sg3.* from root.test where sg3.s5 is not null || sg3.s6 is not null || sg2.s3 is not null")) { + "select db1.s1, db1.s2, db2.s3, db3.* from root.test where db3.s5 is not null || db3.s6 is not null || db2.s3 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg2.s3") + + resultSet.getString("root.test.db2.s3") + "," + resultSet.getString("root.test.sg3.s5") + "," @@ -1539,17 +1539,17 @@ public void alignTimeSeriesQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select sg1.s1, sg1.s2, sg2.s3, sg3.* from root.test where sg1.s1 is not null || sg1.s2 is not null || sg2.s3 is not null || sg3.* is not null")) { + "select db1.s1, db1.s2, db2.s3, db3.* from root.test where db1.s1 is not null || db1.s2 is not null || db2.s3 is not null || db3.* is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg2.s3") + + resultSet.getString("root.test.db2.s3") + "," + resultSet.getString("root.test.sg3.s5") + "," @@ -1585,7 +1585,7 @@ public void withLimitOffsetQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.test.sg1 group by([1,10), 2ms) without null all(last_value(s2), last_value(s3)) limit 5 offset 3 align by device")) { + "select last_value(*) from root.test.db1 group by([1,10), 2ms) without null all(last_value(s2), last_value(s3)) limit 5 offset 3 align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1606,7 +1606,7 @@ public void withLimitOffsetQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.test.sg1 group by([1,10), 2ms) without null all(last_value(s4), last_value(s3)) limit 5 offset 2 slimit 3 align by device")) { + "select last_value(*) from root.test.db1 group by([1,10), 2ms) without null all(last_value(s4), last_value(s3)) limit 5 offset 2 slimit 3 align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1625,7 +1625,7 @@ public void withLimitOffsetQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.test.sg1 group by([1,10), 2ms) without null all(last_value(s2)) limit 5 offset 2 slimit 3 soffset 1 align by device")) { + "select last_value(*) from root.test.db1 group by([1,10), 2ms) without null all(last_value(s2)) limit 5 offset 2 slimit 3 soffset 1 align by device")) { cnt = 0; while (resultSet.next()) { String ans = diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/withoutNull/IoTDBWithoutNullAnyFilterIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/withoutNull/IoTDBWithoutNullAnyFilterIT.java index 6d307dc96d855..bb26a9744c391 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/withoutNull/IoTDBWithoutNullAnyFilterIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/withoutNull/IoTDBWithoutNullAnyFilterIT.java @@ -47,49 +47,49 @@ public class IoTDBWithoutNullAnyFilterIT { private static String[] dataSet1 = new String[] { "CREATE DATABASE root.test", - "CREATE TIMESERIES root.test.sg1.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg1.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.test.sg2.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db1.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s3 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.test.db2.s4 WITH DATATYPE=INT32, ENCODING=PLAIN", "CREATE ALIGNED TIMESERIES root.test.sg3(s5 INT32, s6 BOOLEAN, s7 DOUBLE, s8 INT32)", "CREATE TIMESERIES root.test.sg5.s1 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", "CREATE TIMESERIES root.test.sg5.s9 WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) " + "values(1, true, 1, 1.0, 1)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) " + "values(1, false, 1, 1.0, 1)", - "INSERT INTO root.test.sg1(timestamp, s2) " + "values(2, 2)", - "INSERT INTO root.test.sg1(timestamp, s3) " + "values(2, 2.0)", - "INSERT INTO root.test.sg1(timestamp, s4) " + "values(2, 2)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) " + "values(2, true, 2, 2.0, 2)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) " + "values(1, true, 1, 1.0, 1)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) " + "values(1, false, 1, 1.0, 1)", + "INSERT INTO root.test.db1(timestamp, s2) " + "values(2, 2)", + "INSERT INTO root.test.db1(timestamp, s3) " + "values(2, 2.0)", + "INSERT INTO root.test.db1(timestamp, s4) " + "values(2, 2)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) " + "values(2, true, 2, 2.0, 2)", "flush", - "INSERT INTO root.test.sg1(timestamp, s1) " + "values(3, false)", - "INSERT INTO root.test.sg1(timestamp, s2) " + "values(5, 5)", - "INSERT INTO root.test.sg1(timestamp, s3) " + "values(5, 5.0)", - "INSERT INTO root.test.sg1(timestamp, s4) " + "values(5, 5)", - "INSERT INTO root.test.sg2(timestamp, s2) " + "values(5, 5)", - "INSERT INTO root.test.sg2(timestamp, s3) " + "values(5, 5.0)", - "INSERT INTO root.test.sg2(timestamp, s4) " + "values(5, 5)", + "INSERT INTO root.test.db1(timestamp, s1) " + "values(3, false)", + "INSERT INTO root.test.db1(timestamp, s2) " + "values(5, 5)", + "INSERT INTO root.test.db1(timestamp, s3) " + "values(5, 5.0)", + "INSERT INTO root.test.db1(timestamp, s4) " + "values(5, 5)", + "INSERT INTO root.test.db2(timestamp, s2) " + "values(5, 5)", + "INSERT INTO root.test.db2(timestamp, s3) " + "values(5, 5.0)", + "INSERT INTO root.test.db2(timestamp, s4) " + "values(5, 5)", "flush", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) " + "values(6, true, 6, 6.0, 6)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) " + "values(6, true, 6, 6.0, 6)", - "INSERT INTO root.test.sg1(timestamp, s1) " + "values(7, true)", - "INSERT INTO root.test.sg1(timestamp, s3) " + "values(7, 7.0)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3) " + "values(7, true, 7, 7.0)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) " + "values(6, true, 6, 6.0, 6)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) " + "values(6, true, 6, 6.0, 6)", + "INSERT INTO root.test.db1(timestamp, s1) " + "values(7, true)", + "INSERT INTO root.test.db1(timestamp, s3) " + "values(7, 7.0)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3) " + "values(7, true, 7, 7.0)", "flush", - "INSERT INTO root.test.sg1(timestamp, s1) " + "values(8, true)", - "INSERT INTO root.test.sg1(timestamp, s2) " + "values(8, 8)", - "INSERT INTO root.test.sg1(timestamp, s3) " + "values(8, 8.0)", - "INSERT INTO root.test.sg2(timestamp, s3) " + "values(8, 8.0)", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) " + "values(9, false, 9, 9.0, 9)", - "INSERT INTO root.test.sg2(timestamp, s1) " + "values(9, true)", + "INSERT INTO root.test.db1(timestamp, s1) " + "values(8, true)", + "INSERT INTO root.test.db1(timestamp, s2) " + "values(8, 8)", + "INSERT INTO root.test.db1(timestamp, s3) " + "values(8, 8.0)", + "INSERT INTO root.test.db2(timestamp, s3) " + "values(8, 8.0)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) " + "values(9, false, 9, 9.0, 9)", + "INSERT INTO root.test.db2(timestamp, s1) " + "values(9, true)", "flush", - "INSERT INTO root.test.sg2(timestamp, s2) " + "values(9, 9)", - "INSERT INTO root.test.sg2(timestamp, s4) " + "values(9, 9)", - "INSERT INTO root.test.sg1(timestamp,s1,s2, s3, s4) " + "values(10, true, 10, 10.0, 10)", - "INSERT INTO root.test.sg2(timestamp,s1,s2, s3, s4) " + "values(10, true, 10, 10.0, 10)", + "INSERT INTO root.test.db2(timestamp, s2) " + "values(9, 9)", + "INSERT INTO root.test.db2(timestamp, s4) " + "values(9, 9)", + "INSERT INTO root.test.db1(timestamp,s1,s2, s3, s4) " + "values(10, true, 10, 10.0, 10)", + "INSERT INTO root.test.db2(timestamp,s1,s2, s3, s4) " + "values(10, true, 10, 10.0, 10)", "flush", "INSERT INTO root.test.sg3(time, s5, s6, s7, s8) aligned values(1, 1, true, 1.0, 1)", "INSERT INTO root.test.sg3(time, s6, s7, s8) aligned values(2, false, 2.0, 2)", @@ -163,19 +163,19 @@ public void rawDataWithoutValueFilterQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select * from root.test.sg1 where s2 is not null && s3 is not null")) { + "select * from root.test.db1 where s2 is not null && s3 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -183,19 +183,19 @@ public void rawDataWithoutValueFilterQueryTest() { } try (ResultSet resultSet = - statement.executeQuery("select * from root.test.sg1 where s1 is not null")) { + statement.executeQuery("select * from root.test.db1 where s1 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray2[cnt], ans); cnt++; } @@ -203,19 +203,19 @@ public void rawDataWithoutValueFilterQueryTest() { } try (ResultSet resultSet = - statement.executeQuery("select * from root.test.sg1 where * is not null")) { + statement.executeQuery("select * from root.test.db1 where * is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray3[cnt], ans); cnt++; } @@ -224,19 +224,19 @@ public void rawDataWithoutValueFilterQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.test.sg1 where s1 is not null && s2 is not null && s3 is not null && s4 is not null")) { + "select * from root.test.db1 where s1 is not null && s2 is not null && s3 is not null && s4 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray4[cnt], ans); cnt++; } @@ -261,19 +261,19 @@ public void rawDataWithValueFilterQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select * from root.test.sg1 where s1 = false && s2 is not null && s3 is not null")) { + "select * from root.test.db1 where s1 = false && s2 is not null && s3 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -281,19 +281,19 @@ public void rawDataWithValueFilterQueryTest() { } try (ResultSet resultSet = - statement.executeQuery("select * from root.test.sg1 where s2 = 1 && s1 is not null")) { + statement.executeQuery("select * from root.test.db1 where s2 = 1 && s1 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray2[cnt], ans); cnt++; } @@ -302,23 +302,23 @@ public void rawDataWithValueFilterQueryTest() { Assert.assertFalse( statement - .executeQuery("select * from root.test.sg1 where s2 = 2 && s1 is not null") + .executeQuery("select * from root.test.db1 where s2 = 2 && s1 is not null") .next()); try (ResultSet resultSet = - statement.executeQuery("select * from root.test.sg1 where s1 = true && * is not null")) { + statement.executeQuery("select * from root.test.db1 where s1 = true && * is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray3[cnt], ans); cnt++; } @@ -327,19 +327,19 @@ public void rawDataWithValueFilterQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.test.sg1 where s1 = true && s1 is not null && s2 is not null && s3 is not null && s4 is not null")) { + "select * from root.test.db1 where s1 = true && s1 is not null && s2 is not null && s3 is not null && s4 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s3") + + resultSet.getString("root.test.db1.s3") + "," - + resultSet.getString("root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s4"); Assert.assertEquals(retArray4[cnt], ans); cnt++; } @@ -396,29 +396,29 @@ public void withExpressionQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.sg1 where (s2+s4) is not null")) { + "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.db1 where (s2+s4) is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("-root.test.sg1.s2") + + resultSet.getString("-root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 + root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 + root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 - root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 - root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 * root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 * root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 / root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 / root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 % root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s2 % root.test.db1.s4"); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -427,29 +427,29 @@ public void withExpressionQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.sg1 where s2+s4 is not null && s2 is not null")) { + "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.db1 where s2+s4 is not null && s2 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("-root.test.sg1.s2") + + resultSet.getString("-root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 + root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 + root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 - root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 - root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 * root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 * root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 / root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 / root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 % root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s2 % root.test.db1.s4"); Assert.assertEquals(retArray2[cnt], ans); cnt++; } @@ -458,30 +458,30 @@ public void withExpressionQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.sg1 " + "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.db1 " + "where s2 is not null && s4 is not null && s2 / s4 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("-root.test.sg1.s2") + + resultSet.getString("-root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 + root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 + root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 - root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 - root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 * root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 * root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 / root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 / root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 % root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s2 % root.test.db1.s4"); Assert.assertEquals(retArray3[cnt], ans); cnt++; } @@ -490,30 +490,30 @@ public void withExpressionQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.sg1 " + "select s2, - s2, s4, + s4, s2 + s4, s2 - s4, s2 * s4, s2 / s4, s2 % s4 from root.test.db1 " + "where s2 is not null && s4 is not null && s2 / s4 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("-root.test.sg1.s2") + + resultSet.getString("-root.test.db1.s2") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s4") + + resultSet.getString("root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 + root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 + root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 - root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 - root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 * root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 * root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 / root.test.sg1.s4") + + resultSet.getString("root.test.db1.s2 / root.test.db1.s4") + "," - + resultSet.getString("root.test.sg1.s2 % root.test.sg1.s4"); + + resultSet.getString("root.test.db1.s2 % root.test.db1.s4"); Assert.assertEquals(retArray4[cnt], ans); cnt++; } @@ -564,32 +564,32 @@ public void withUDFQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select s1, sin(s2), cos(s2), tan(s2) from root.test.sg1 where sin(s2) is not null && s1 is not null")) { + "select s1, sin(s2), cos(s2), tan(s2) from root.test.db1 where sin(s2) is not null && s1 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + (resultSet.getString("sin(root.test.sg1.s2)") == null - || resultSet.getString("sin(root.test.sg1.s2)").equals("null") + + (resultSet.getString("sin(root.test.db1.s2)") == null + || resultSet.getString("sin(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("sin(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("sin(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," - + (resultSet.getString("cos(root.test.sg1.s2)") == null - || resultSet.getString("cos(root.test.sg1.s2)").equals("null") + + (resultSet.getString("cos(root.test.db1.s2)") == null + || resultSet.getString("cos(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("cos(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("cos(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," - + (resultSet.getString("tan(root.test.sg1.s2)") == null - || resultSet.getString("tan(root.test.sg1.s2)").equals("null") + + (resultSet.getString("tan(root.test.db1.s2)") == null + || resultSet.getString("tan(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("tan(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("tan(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()); Assert.assertEquals(retArray1[cnt], ans); @@ -600,14 +600,14 @@ public void withUDFQueryTest() { String[] columns = new String[] { - "root.test.sg1.s1", - "sin(root.test.sg1.s2) + cos(root.test.sg1.s2)", - "cos(sin(root.test.sg1.s2 + root.test.sg1.s4) + root.test.sg1.s2)" + "root.test.db1.s1", + "sin(root.test.db1.s2) + cos(root.test.db1.s2)", + "cos(sin(root.test.db1.s2 + root.test.db1.s4) + root.test.db1.s2)" }; try (ResultSet resultSet = statement.executeQuery( - "select s1, sin(s2) + cos(s2), cos(sin(s2 + s4) + s2) from root.test.sg1 where sin(s2) + cos(s2) is not null && cos(sin(s2 + s4) + s2) is not null")) { + "select s1, sin(s2) + cos(s2), cos(sin(s2 + s4) + s2) from root.test.db1 where sin(s2) + cos(s2) is not null && cos(sin(s2 + s4) + s2) is not null")) { cnt = 0; while (resultSet.next()) { String ans = @@ -636,7 +636,7 @@ public void withUDFQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s1, cos(sin(s2 + s4) + s2) from root.test.sg1 where cos(sin(s2 + s4) + s2) is not null")) { + "select s1, cos(sin(s2 + s4) + s2) from root.test.db1 where cos(sin(s2 + s4) + s2) is not null")) { cnt = 0; while (resultSet.next()) { String ans = @@ -658,7 +658,7 @@ public void withUDFQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s1, sin(s2) + cos(s2), cos(sin(s2 + s4) + s2) from root.test.sg1 where s1 is not null && sin(s2) + cos(s2) is not null && cos(sin(s2 + s4) + s2) is not null")) { + "select s1, sin(s2) + cos(s2), cos(sin(s2 + s4) + s2) from root.test.db1 where s1 is not null && sin(s2) + cos(s2) is not null && cos(sin(s2 + s4) + s2) is not null")) { cnt = 0; while (resultSet.next()) { String ans = @@ -708,23 +708,23 @@ public void withGroupByTimeQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select avg(s4), sum(s2) from root.test.sg1 group by ([1,10), 2ms) without null any(sum(s2))")) { + "select avg(s4), sum(s2) from root.test.db1 group by ([1,10), 2ms) without null any(sum(s2))")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + (resultSet.getString("avg(root.test.sg1.s4)") == null - || resultSet.getString("avg(root.test.sg1.s4)").equals("null") + + (resultSet.getString("avg(root.test.db1.s4)") == null + || resultSet.getString("avg(root.test.db1.s4)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("avg(root.test.sg1.s4)")) + : new BigDecimal(resultSet.getString("avg(root.test.db1.s4)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," - + (resultSet.getString("sum(root.test.sg1.s2)") == null - || resultSet.getString("sum(root.test.sg1.s2)").equals("null") + + (resultSet.getString("sum(root.test.db1.s2)") == null + || resultSet.getString("sum(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("sum(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("sum(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()); Assert.assertEquals(retArray1[cnt], ans); @@ -735,12 +735,12 @@ public void withGroupByTimeQueryTest() { String[] columns = new String[] { - "avg(root.test.sg1.s4)", "sum(root.test.sg1.s2)", "count(root.test.sg1.s3)" + "avg(root.test.db1.s4)", "sum(root.test.db1.s2)", "count(root.test.db1.s3)" }; try (ResultSet resultSet = statement.executeQuery( - "select avg(s4), sum(s2), count(s3) from root.test.sg1 group by ([1,10), 2ms) without null any(avg(s4), sum(s2))")) { + "select avg(s4), sum(s2), count(s3) from root.test.db1 group by ([1,10), 2ms) without null any(avg(s4), sum(s2))")) { cnt = 0; while (resultSet.next()) { String ans = @@ -769,7 +769,7 @@ public void withGroupByTimeQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select avg(s4) as t, avg(s2) from root.test.sg1 group by ([1,10), 1ms) without null any(t, avg(s2))")) { + "select avg(s4) as t, avg(s2) from root.test.db1 group by ([1,10), 1ms) without null any(t, avg(s2))")) { cnt = 0; while (resultSet.next()) { String ans = @@ -781,10 +781,10 @@ public void withGroupByTimeQueryTest() { .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," - + (resultSet.getString("avg(root.test.sg1.s2)") == null - || resultSet.getString("avg(root.test.sg1.s2)").equals("null") + + (resultSet.getString("avg(root.test.db1.s2)") == null + || resultSet.getString("avg(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("avg(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("avg(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()); Assert.assertEquals(retArray3[cnt], ans); @@ -795,16 +795,16 @@ public void withGroupByTimeQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select avg(s4), sum(s3) as t, avg(s2) from root.test.sg1 group by ([1,10), 2ms) without null any(t, avg(s2))")) { + "select avg(s4), sum(s3) as t, avg(s2) from root.test.db1 group by ([1,10), 2ms) without null any(t, avg(s2))")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + (resultSet.getString("avg(root.test.sg1.s4)") == null - || resultSet.getString("avg(root.test.sg1.s4)").equals("null") + + (resultSet.getString("avg(root.test.db1.s4)") == null + || resultSet.getString("avg(root.test.db1.s4)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("avg(root.test.sg1.s4)")) + : new BigDecimal(resultSet.getString("avg(root.test.db1.s4)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," @@ -814,10 +814,10 @@ public void withGroupByTimeQueryTest() { .setScale(2, RoundingMode.HALF_UP) .toPlainString()) + "," - + (resultSet.getString("avg(root.test.sg1.s2)") == null - || resultSet.getString("avg(root.test.sg1.s2)").equals("null") + + (resultSet.getString("avg(root.test.db1.s2)") == null + || resultSet.getString("avg(root.test.db1.s2)").equals("null") ? "null" - : new BigDecimal(resultSet.getString("avg(root.test.sg1.s2)")) + : new BigDecimal(resultSet.getString("avg(root.test.db1.s2)")) .setScale(2, RoundingMode.HALF_UP) .toPlainString()); Assert.assertEquals(retArray4[cnt], ans); @@ -852,7 +852,7 @@ public void withGroupByLevelQueryTest() { String[] columns = new String[] { - "avg(root.*.sg1.s2)", "avg(root.*.sg2.s2)", "sum(root.*.sg1.s4)", "sum(root.*.sg2.s4)" + "avg(root.*.db1.s2)", "avg(root.*.db2.s2)", "sum(root.*.db1.s4)", "sum(root.*.db2.s4)" }; int cnt; @@ -940,7 +940,7 @@ public void withGroupByLevelQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select avg(s2), sum(s4) as t from root.*.sg1 group by ([1, 10), 2ms), level = 1 without null any (avg(s2), t)")) { + "select avg(s2), sum(s4) as t from root.*.db1 group by ([1, 10), 2ms), level = 1 without null any (avg(s2), t)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -966,7 +966,7 @@ public void withGroupByLevelQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select avg(sg1.s2), avg(sg2.s2) from root.test group by level = 1 without null any(avg(sg1.s2), avg(sg2.s2))")) { + "select avg(db1.s2), avg(db2.s2) from root.test group by level = 1 without null any(avg(db1.s2), avg(db2.s2))")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1030,13 +1030,13 @@ public void withoutNullColumnsIsFullPathQueryTest() { String[] columns = new String[] { - "root.test.sg1.s2", "root.test.sg1.s3", "root.test.sg2.s2", "root.test.sg2.s3" + "root.test.db1.s2", "root.test.db1.s3", "root.test.db2.s2", "root.test.db2.s3" }; int cnt; try (ResultSet resultSet = statement.executeQuery( - "select s2, s3 from root.test.** without null any(root.test.sg1.s2, root.test.sg2.s3)")) { + "select s2, s3 from root.test.** without null any(root.test.db1.s2, root.test.db2.s3)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1057,7 +1057,7 @@ public void withoutNullColumnsIsFullPathQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, s3 from root.test.sg1, root.test.sg2 without null any(root.test.sg1.s2)")) { + "select s2, s3 from root.test.db1, root.test.db2 without null any(root.test.db1.s2)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1078,7 +1078,7 @@ public void withoutNullColumnsIsFullPathQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, s3 from root.test.sg1, root.test.sg2 without null any(root.test.sg1.s2, s3)")) { + "select s2, s3 from root.test.db1, root.test.db2 without null any(root.test.db1.s2, s3)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1099,7 +1099,7 @@ public void withoutNullColumnsIsFullPathQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s2, s3 from root.test.sg1, root.test.sg2 without null any(root.test.*.s2)")) { + "select s2, s3 from root.test.db1, root.test.db2 without null any(root.test.*.s2)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1130,10 +1130,10 @@ public void withoutNullColumnsMisMatchSelectedQueryTest() { String[] expectedHeader = new String[] { TIMESTAMP_STR, - "root.test.sg1.s1", - "root.test.sg1.s2", - "root.test.sg1.s3", - "root.test.sg1.s4", + "root.test.db1.s1", + "root.test.db1.s2", + "root.test.db1.s3", + "root.test.db1.s4", }; String[] retArray = new String[] { @@ -1146,7 +1146,7 @@ public void withoutNullColumnsMisMatchSelectedQueryTest() { "10,true,10,10.0,10," }; resultSetEqualTest( - "select s1, s2, s3, s4 from root.test.sg1 where s1 is not null && usage is null", + "select s1, s2, s3, s4 from root.test.db1 where s1 is not null && usage is null", expectedHeader, retArray); } @@ -1200,7 +1200,7 @@ public void alignByDeviceQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.test.sg1 group by([1,10), 2ms) without null any(last_value(s2), last_value(s3)) align by device")) { + "select last_value(*) from root.test.db1 group by([1,10), 2ms) without null any(last_value(s2), last_value(s3)) align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1221,7 +1221,7 @@ public void alignByDeviceQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.test.sg1 group by([1,10), 2ms) without null any(last_value(s2)) align by device")) { + "select last_value(*) from root.test.db1 group by([1,10), 2ms) without null any(last_value(s2)) align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1284,7 +1284,7 @@ public void alignByDeviceQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s2) as t, last_value(s3), last_value(s4) from root.test.sg1 group by([1,10), 2ms) without null any(t, last_value(s3)) align by device")) { + "select last_value(s2) as t, last_value(s3), last_value(s4) from root.test.db1 group by([1,10), 2ms) without null any(t, last_value(s3)) align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1303,7 +1303,7 @@ public void alignByDeviceQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select s1,s2,s9 from root.test.sg1,root.test.sg5 without null any(s2) align by device")) { + "select s1,s2,s9 from root.test.db1,root.test.sg5 without null any(s2) align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1337,17 +1337,17 @@ public void alignTimeSeriesQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select sg1.s1, sg1.s2, sg2.s3, sg3.* from root.test where sg3.* is not null && sg1.s2 is not null")) { + "select db1.s1, db1.s2, db2.s3, db3.* from root.test where db3.* is not null && db1.s2 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg2.s3") + + resultSet.getString("root.test.db2.s3") + "," + resultSet.getString("root.test.sg3.s5") + "," @@ -1364,17 +1364,17 @@ public void alignTimeSeriesQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select sg1.s1, sg1.s2, sg2.s3, sg3.* from root.test where sg3.* is not null")) { + "select db1.s1, db1.s2, db2.s3, db3.* from root.test where db3.* is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg2.s3") + + resultSet.getString("root.test.db2.s3") + "," + resultSet.getString("root.test.sg3.s5") + "," @@ -1391,17 +1391,17 @@ public void alignTimeSeriesQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select sg1.s1, sg1.s2, sg2.s3, sg3.* from root.test where sg3.s5 is not null && sg3.s6 is not null")) { + "select db1.s1, db1.s2, db2.s3, db3.* from root.test where db3.s5 is not null && db3.s6 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg2.s3") + + resultSet.getString("root.test.db2.s3") + "," + resultSet.getString("root.test.sg3.s5") + "," @@ -1418,17 +1418,17 @@ public void alignTimeSeriesQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select sg1.s1, sg1.s2, sg2.s3, sg3.* from root.test where sg3.s5 is not null && sg3.s6 is not null && sg2.s3 is not null")) { + "select db1.s1, db1.s2, db2.s3, db3.* from root.test where db3.s5 is not null && db3.s6 is not null && db2.s3 is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg2.s3") + + resultSet.getString("root.test.db2.s3") + "," + resultSet.getString("root.test.sg3.s5") + "," @@ -1445,17 +1445,17 @@ public void alignTimeSeriesQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select sg1.s1, sg1.s2, sg2.s3, sg3.* from root.test where sg1.s1 is not null && sg1.s2 is not null && sg2.s3 is not null && sg3.* is not null")) { + "select db1.s1, db1.s2, db2.s3, db3.* from root.test where db1.s1 is not null && db1.s2 is not null && db2.s3 is not null && db3.* is not null")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString("root.test.sg1.s1") + + resultSet.getString("root.test.db1.s1") + "," - + resultSet.getString("root.test.sg1.s2") + + resultSet.getString("root.test.db1.s2") + "," - + resultSet.getString("root.test.sg2.s3") + + resultSet.getString("root.test.db2.s3") + "," + resultSet.getString("root.test.sg3.s5") + "," @@ -1491,7 +1491,7 @@ public void withLimitOffsetQueryTest() { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.test.sg1 group by([1,10), 2ms) without null any(last_value(s2), last_value(s3)) limit 5 offset 3 align by device")) { + "select last_value(*) from root.test.db1 group by([1,10), 2ms) without null any(last_value(s2), last_value(s3)) limit 5 offset 3 align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1512,7 +1512,7 @@ public void withLimitOffsetQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.test.sg1 group by([1,10), 2ms) without null any(last_value(s4), last_value(s3)) limit 5 offset 2 slimit 3 align by device")) { + "select last_value(*) from root.test.db1 group by([1,10), 2ms) without null any(last_value(s4), last_value(s3)) limit 5 offset 2 slimit 3 align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -1531,7 +1531,7 @@ public void withLimitOffsetQueryTest() { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.test.sg1 group by([1,10), 2ms) without null any(last_value(s2)) limit 5 offset 2 slimit 3 soffset 1 align by device")) { + "select last_value(*) from root.test.db1 group by([1,10), 2ms) without null any(last_value(s2)) limit 5 offset 2 slimit 3 soffset 1 align by device")) { cnt = 0; while (resultSet.next()) { String ans = diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeLifeCycleIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeLifeCycleIT.java index a11cc5cc80c6f..3fd03bebd7585 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeLifeCycleIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeLifeCycleIT.java @@ -75,22 +75,22 @@ public void testLifeCycleWithHistoryEnabled() throws Exception { TableModelUtils.createDataBaseAndTable(senderEnv, "test", "test"); TableModelUtils.insertData("test", "test", 0, 100, senderEnv); - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); + final Map sinkAttributes = new HashMap<>(); - extractorAttributes.put("capture.table", "true"); - extractorAttributes.put("user", "root"); + sourceAttributes.put("capture.table", "true"); + sourceAttributes.put("user", "root"); - connectorAttributes.put("connector", "iotdb-thrift-connector"); - connectorAttributes.put("connector.batch.enable", "false"); - connectorAttributes.put("connector.ip", receiverIp); - connectorAttributes.put("connector.port", Integer.toString(receiverPort)); + sinkAttributes.put("sink", "iotdb-thrift-sink"); + sinkAttributes.put("sink.batch.enable", "false"); + sinkAttributes.put("sink.ip", receiverIp); + sinkAttributes.put("sink.port", Integer.toString(receiverPort)); final TSStatus status = client.createPipe( - new TCreatePipeReq("p1", connectorAttributes) - .setExtractorAttributes(extractorAttributes) + new TCreatePipeReq("p1", sinkAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); @@ -139,29 +139,29 @@ public void testLifeCycleWithHistoryDisabled() throws Exception { TestUtils.executeNonQueries(senderEnv, Collections.singletonList("flush"), null); Thread.sleep(10000); - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); + final Map sinkAttributes = new HashMap<>(); - extractorAttributes.put("capture.table", "true"); - extractorAttributes.put("user", "root"); - extractorAttributes.put("extractor.inclusion", "data.insert"); - extractorAttributes.put("extractor.inclusion.exclusion", ""); + sourceAttributes.put("capture.table", "true"); + sourceAttributes.put("user", "root"); + sourceAttributes.put("source.inclusion", "data.insert"); + sourceAttributes.put("source.inclusion.exclusion", ""); - extractorAttributes.put("extractor.history.enable", "false"); + sourceAttributes.put("source.history.enable", "false"); // start-time and end-time should not work - extractorAttributes.put("extractor.history.start-time", "0"); - extractorAttributes.put("extractor.history.end-time", "50"); + sourceAttributes.put("source.history.start-time", "0"); + sourceAttributes.put("source.history.end-time", "50"); - connectorAttributes.put("connector", "iotdb-thrift-connector"); - connectorAttributes.put("connector.batch.enable", "false"); - connectorAttributes.put("connector.ip", receiverIp); - connectorAttributes.put("connector.port", Integer.toString(receiverPort)); + sinkAttributes.put("sink", "iotdb-thrift-sink"); + sinkAttributes.put("sink.batch.enable", "false"); + sinkAttributes.put("sink.ip", receiverIp); + sinkAttributes.put("sink.port", Integer.toString(receiverPort)); final TSStatus status = client.createPipe( - new TCreatePipeReq("p1", connectorAttributes) - .setExtractorAttributes(extractorAttributes) + new TCreatePipeReq("p1", sinkAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); @@ -196,23 +196,23 @@ public void testLifeCycleLogMode() throws Exception { try (final SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) { - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); + final Map sinkAttributes = new HashMap<>(); - extractorAttributes.put("capture.table", "true"); - extractorAttributes.put("extractor.mode", "forced-log"); - extractorAttributes.put("user", "root"); + sourceAttributes.put("capture.table", "true"); + sourceAttributes.put("source.mode", "forced-log"); + sourceAttributes.put("user", "root"); - connectorAttributes.put("connector", "iotdb-thrift-connector"); - connectorAttributes.put("connector.batch.enable", "false"); - connectorAttributes.put("connector.ip", receiverIp); - connectorAttributes.put("connector.port", Integer.toString(receiverPort)); + sinkAttributes.put("sink", "iotdb-thrift-sink"); + sinkAttributes.put("sink.batch.enable", "false"); + sinkAttributes.put("sink.ip", receiverIp); + sinkAttributes.put("sink.port", Integer.toString(receiverPort)); final TSStatus status = client.createPipe( - new TCreatePipeReq("p1", connectorAttributes) - .setExtractorAttributes(extractorAttributes) + new TCreatePipeReq("p1", sinkAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); @@ -252,23 +252,23 @@ public void testLifeCycleFileMode() throws Exception { try (final SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) { - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); + final Map sinkAttributes = new HashMap<>(); - extractorAttributes.put("capture.table", "true"); - extractorAttributes.put("mode.streaming", "false"); - extractorAttributes.put("user", "root"); + sourceAttributes.put("capture.table", "true"); + sourceAttributes.put("mode.streaming", "false"); + sourceAttributes.put("user", "root"); - connectorAttributes.put("connector", "iotdb-thrift-connector"); - connectorAttributes.put("connector.batch.enable", "false"); - connectorAttributes.put("connector.ip", receiverIp); - connectorAttributes.put("connector.port", Integer.toString(receiverPort)); + sinkAttributes.put("sink", "iotdb-thrift-sink"); + sinkAttributes.put("sink.batch.enable", "false"); + sinkAttributes.put("sink.ip", receiverIp); + sinkAttributes.put("sink.port", Integer.toString(receiverPort)); final TSStatus status = client.createPipe( - new TCreatePipeReq("p1", connectorAttributes) - .setExtractorAttributes(extractorAttributes) + new TCreatePipeReq("p1", sinkAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); @@ -306,23 +306,23 @@ public void testLifeCycleHybridMode() throws Exception { TableModelUtils.createDataBaseAndTable(senderEnv, "test", "test"); TableModelUtils.insertData("test", "test", 0, 100, senderEnv); - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); + final Map sinkAttributes = new HashMap<>(); - extractorAttributes.put("capture.table", "true"); - extractorAttributes.put("extractor.mode", "hybrid"); - extractorAttributes.put("user", "root"); + sourceAttributes.put("capture.table", "true"); + sourceAttributes.put("source.mode", "hybrid"); + sourceAttributes.put("user", "root"); - connectorAttributes.put("connector", "iotdb-thrift-connector"); - connectorAttributes.put("connector.batch.enable", "false"); - connectorAttributes.put("connector.ip", receiverIp); - connectorAttributes.put("connector.port", Integer.toString(receiverPort)); + sinkAttributes.put("sink", "iotdb-thrift-sink"); + sinkAttributes.put("sink.batch.enable", "false"); + sinkAttributes.put("sink.ip", receiverIp); + sinkAttributes.put("sink.port", Integer.toString(receiverPort)); final TSStatus status = client.createPipe( - new TCreatePipeReq("p1", connectorAttributes) - .setExtractorAttributes(extractorAttributes) + new TCreatePipeReq("p1", sinkAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); @@ -358,22 +358,22 @@ public void testLifeCycleWithClusterRestart() throws Exception { TableModelUtils.createDataBaseAndTable(senderEnv, "test", "test"); TableModelUtils.insertData("test", "test", 0, 100, senderEnv); - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); + final Map sinkAttributes = new HashMap<>(); - extractorAttributes.put("capture.table", "true"); - extractorAttributes.put("user", "root"); + sourceAttributes.put("capture.table", "true"); + sourceAttributes.put("user", "root"); - connectorAttributes.put("connector", "iotdb-thrift-connector"); - connectorAttributes.put("connector.batch.enable", "false"); - connectorAttributes.put("connector.ip", receiverIp); - connectorAttributes.put("connector.port", Integer.toString(receiverPort)); + sinkAttributes.put("sink", "iotdb-thrift-sink"); + sinkAttributes.put("sink.batch.enable", "false"); + sinkAttributes.put("sink.ip", receiverIp); + sinkAttributes.put("sink.port", Integer.toString(receiverPort)); final TSStatus status = client.createPipe( - new TCreatePipeReq("p1", connectorAttributes) - .setExtractorAttributes(extractorAttributes) + new TCreatePipeReq("p1", sinkAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); @@ -421,22 +421,22 @@ public void testReceiverRestartWhenTransferring() throws Exception { TableModelUtils.createDataBaseAndTable(senderEnv, "test", "test"); TableModelUtils.insertData("test", "test", 0, 100, senderEnv); - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); + final Map sinkAttributes = new HashMap<>(); - extractorAttributes.put("capture.table", "true"); - extractorAttributes.put("user", "root"); + sourceAttributes.put("capture.table", "true"); + sourceAttributes.put("user", "root"); - connectorAttributes.put("connector", "iotdb-thrift-connector"); - connectorAttributes.put("connector.batch.enable", "false"); - connectorAttributes.put("connector.ip", receiverIp); - connectorAttributes.put("connector.port", Integer.toString(receiverPort)); + sinkAttributes.put("sink", "iotdb-thrift-sink"); + sinkAttributes.put("sink.batch.enable", "false"); + sinkAttributes.put("sink.ip", receiverIp); + sinkAttributes.put("sink.port", Integer.toString(receiverPort)); final TSStatus status = client.createPipe( - new TCreatePipeReq("p1", connectorAttributes) - .setExtractorAttributes(extractorAttributes) + new TCreatePipeReq("p1", sinkAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); @@ -500,22 +500,22 @@ public void testReceiverAlreadyHaveTimeSeries() throws Exception { TableModelUtils.createDataBaseAndTable(senderEnv, "test", "test"); TableModelUtils.insertData("test", "test", 0, 100, senderEnv); - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); + final Map sinkAttributes = new HashMap<>(); - extractorAttributes.put("capture.table", "true"); - extractorAttributes.put("user", "root"); + sourceAttributes.put("capture.table", "true"); + sourceAttributes.put("user", "root"); - connectorAttributes.put("connector", "iotdb-thrift-connector"); - connectorAttributes.put("connector.batch.enable", "false"); - connectorAttributes.put("connector.ip", receiverIp); - connectorAttributes.put("connector.port", Integer.toString(receiverPort)); + sinkAttributes.put("sink", "iotdb-thrift-sink"); + sinkAttributes.put("sink.batch.enable", "false"); + sinkAttributes.put("sink.ip", receiverIp); + sinkAttributes.put("sink.port", Integer.toString(receiverPort)); final TSStatus status = client.createPipe( - new TCreatePipeReq("p1", connectorAttributes) - .setExtractorAttributes(extractorAttributes) + new TCreatePipeReq("p1", sinkAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); @@ -559,24 +559,24 @@ public void testDoubleLiving() throws Exception { try (final SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) { - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); + final Map sinkAttributes = new HashMap<>(); // Add this property to avoid to make self cycle. - extractorAttributes.put("capture.table", "true"); - extractorAttributes.put("forwarding-pipe-requests", "false"); - extractorAttributes.put("user", "root"); + sourceAttributes.put("capture.table", "true"); + sourceAttributes.put("forwarding-pipe-requests", "false"); + sourceAttributes.put("user", "root"); - connectorAttributes.put("connector", "iotdb-thrift-connector"); - connectorAttributes.put("connector.batch.enable", "false"); - connectorAttributes.put("connector.ip", receiverIp); - connectorAttributes.put("connector.port", Integer.toString(receiverPort)); + sinkAttributes.put("sink", "iotdb-thrift-sink"); + sinkAttributes.put("sink.batch.enable", "false"); + sinkAttributes.put("sink.ip", receiverIp); + sinkAttributes.put("sink.port", Integer.toString(receiverPort)); final TSStatus status = client.createPipe( - new TCreatePipeReq("p1", connectorAttributes) - .setExtractorAttributes(extractorAttributes) + new TCreatePipeReq("p1", sinkAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); @@ -592,25 +592,25 @@ public void testDoubleLiving() throws Exception { try (final SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) receiverEnv.getLeaderConfigNodeConnection()) { - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); + final Map sinkAttributes = new HashMap<>(); // Add this property to avoid to make self cycle. - extractorAttributes.put("capture.table", "true"); - extractorAttributes.put("capture.tree", "true"); - extractorAttributes.put("forwarding-pipe-requests", "false"); - extractorAttributes.put("user", "root"); + sourceAttributes.put("capture.table", "true"); + sourceAttributes.put("capture.tree", "true"); + sourceAttributes.put("forwarding-pipe-requests", "false"); + sourceAttributes.put("user", "root"); - connectorAttributes.put("connector", "iotdb-thrift-connector"); - connectorAttributes.put("connector.batch.enable", "false"); - connectorAttributes.put("connector.ip", senderIp); - connectorAttributes.put("connector.port", Integer.toString(senderPort)); + sinkAttributes.put("sink", "iotdb-thrift-sink"); + sinkAttributes.put("sink.batch.enable", "false"); + sinkAttributes.put("sink.ip", senderIp); + sinkAttributes.put("sink.port", Integer.toString(senderPort)); final TSStatus status = client.createPipe( - new TCreatePipeReq("p1", connectorAttributes) - .setExtractorAttributes(extractorAttributes) + new TCreatePipeReq("p1", sinkAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); @@ -643,10 +643,10 @@ public void testPermission() { assertTableNonQueryTestFail( senderEnv, "create pipe testPipe\n" - + "with connector (\n" - + " 'connector'='iotdb-thrift-connector',\n" - + " 'connector.ip'='127.0.0.1',\n" - + " 'connector.port'='6668'\n" + + "with sink (\n" + + " 'sink'='iotdb-thrift-sink',\n" + + " 'sink.ip'='127.0.0.1',\n" + + " 'sink.port'='6668'\n" + ")", "803: Access Denied: No permissions for this operation, please add privilege SYSTEM", "test", diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeTsFileDecompositionWithModsIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeTsFileDecompositionWithModsIT.java index 22e042e285382..c141ff2e9e688 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeTsFileDecompositionWithModsIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/basic/IoTDBPipeTsFileDecompositionWithModsIT.java @@ -43,14 +43,14 @@ public class IoTDBPipeTsFileDecompositionWithModsIT extends AbstractPipeTableMod * Test IoTDB pipe handling TsFile decomposition with Mods (modification operations) in table * model * - *

Test scenario: 1. Create two storage groups sg1 and sg2, each containing table1 2. Insert - * small amount of data in sg1 (1-6 rows), insert large amount of data in sg2 (110 batches, 100 + *

Test scenario: 1. Create two storage groups db1 and db2, each containing table1 2. Insert + * small amount of data in db1 (1-6 rows), insert large amount of data in db2 (110 batches, 100 * rows per batch) 3. Execute FLUSH operation to persist data to TsFile 4. Execute multiple DELETE - * operations on sg1, deleting data in time ranges 2-4 and 3-5 5. Execute multiple DELETE - * operations on sg2, deleting data matching specific conditions (s0-s3 field values) 6. Execute + * operations on db1, deleting data in time ranges 2-4 and 3-5 5. Execute multiple DELETE + * operations on db2, deleting data matching specific conditions (s0-s3 field values) 6. Execute * FLUSH operation again 7. Create pipe with mods enabled, synchronize data to receiver 8. Verify - * correctness of receiver data: - sg1 only retains time=1 data, time=2-4 data is correctly - * deleted - sg2 DELETE operation results meet expectations (t10 retains 1000 rows, t11 all + * correctness of receiver data: - db1 only retains time=1 data, time=2-4 data is correctly + * deleted - db2 DELETE operation results meet expectations (t10 retains 1000 rows, t11 all * deleted, t12 retains 5900 rows, etc.) * *

Test purpose: Verify that IoTDB pipe can correctly handle Mods (modification operations) in @@ -59,14 +59,14 @@ public class IoTDBPipeTsFileDecompositionWithModsIT extends AbstractPipeTableMod */ @Test public void testTsFileDecompositionWithMods() { - TableModelUtils.createDataBaseAndTable(senderEnv, "table1", "sg1"); - TableModelUtils.createDataBaseAndTable(receiverEnv, "table1", "sg1"); + TableModelUtils.createDataBaseAndTable(senderEnv, "table1", "db1"); + TableModelUtils.createDataBaseAndTable(receiverEnv, "table1", "db1"); - TableModelUtils.insertData("sg1", "table1", 1, 6, senderEnv); + TableModelUtils.insertData("db1", "table1", 1, 6, senderEnv); - TableModelUtils.createDataBaseAndTable(senderEnv, "table1", "sg2"); + TableModelUtils.createDataBaseAndTable(senderEnv, "table1", "db2"); for (int i = 1; i <= 110; i++) { - TableModelUtils.insertData("sg2", "table1", 10, 15, (i - 1) * 100, i * 100, senderEnv); + TableModelUtils.insertData("db2", "table1", 10, 15, (i - 1) * 100, i * 100, senderEnv); } executeNonQueryWithRetry(senderEnv, "FLUSH"); @@ -76,7 +76,7 @@ public void testTsFileDecompositionWithMods() { "DELETE FROM table1 WHERE time >= 2 AND time <= 4", SessionConfig.DEFAULT_USER, SessionConfig.DEFAULT_PASSWORD, - "sg1", + "db1", "table"); executeNonQueryWithRetry( @@ -84,7 +84,7 @@ public void testTsFileDecompositionWithMods() { "DELETE FROM table1 WHERE time >= 3 AND time <= 5", SessionConfig.DEFAULT_USER, SessionConfig.DEFAULT_PASSWORD, - "sg1", + "db1", "table"); executeNonQueryWithRetry( @@ -92,7 +92,7 @@ public void testTsFileDecompositionWithMods() { "DELETE FROM table1 WHERE time >= 0 AND time < 10000 AND s0 ='t10' AND s1='t10' AND s2='t10' AND s3='t10'", SessionConfig.DEFAULT_USER, SessionConfig.DEFAULT_PASSWORD, - "sg2", + "db2", "table"); executeNonQueryWithRetry( @@ -100,7 +100,7 @@ public void testTsFileDecompositionWithMods() { "DELETE FROM table1 WHERE time >= 0 AND time <= 11000 AND s0 ='t11' AND s1='t11' AND s2='t11' AND s3='t11'", SessionConfig.DEFAULT_USER, SessionConfig.DEFAULT_PASSWORD, - "sg2", + "db2", "table"); executeNonQueryWithRetry( @@ -108,7 +108,7 @@ public void testTsFileDecompositionWithMods() { "DELETE FROM table1 WHERE time >= 5000 AND time < 10100 AND s0 ='t12' AND s1='t12' AND s2='t12' AND s3='t12'", SessionConfig.DEFAULT_USER, SessionConfig.DEFAULT_PASSWORD, - "sg2", + "db2", "table"); executeNonQueryWithRetry( @@ -116,7 +116,7 @@ public void testTsFileDecompositionWithMods() { "DELETE FROM table1 WHERE time >= 0 AND time < 10000 AND s0 ='t13' AND s1='t13' AND s2='t13' AND s3='t13'", SessionConfig.DEFAULT_USER, SessionConfig.DEFAULT_PASSWORD, - "sg2", + "db2", "table"); executeNonQueryWithRetry( @@ -124,7 +124,7 @@ public void testTsFileDecompositionWithMods() { "DELETE FROM table1 WHERE time >= 10000 AND time <= 11000 AND s0 ='t14' AND s1='t14' AND s2='t14' AND s3='t14'", SessionConfig.DEFAULT_USER, SessionConfig.DEFAULT_PASSWORD, - "sg2", + "db2", "table"); executeNonQueryWithRetry(senderEnv, "FLUSH"); @@ -145,48 +145,48 @@ public void testTsFileDecompositionWithMods() { TableModelUtils.getQuerySql("table1"), TableModelUtils.generateHeaderResults(), expectedResults, - "sg1"); + "db1"); TestUtils.assertDataEventuallyOnEnv( receiverEnv, "SELECT s4 FROM table1 WHERE time >= 2 AND time <= 4", "s4,", Collections.emptySet(), - "sg1"); + "db1"); TestUtils.assertDataEventuallyOnEnv( receiverEnv, "SELECT COUNT(*) as count FROM table1 WHERE s0 ='t10' AND s1='t10' AND s2='t10' AND s3='t10'", "count,", Collections.singleton("1000,"), - "sg2"); + "db2"); TestUtils.assertDataEventuallyOnEnv( receiverEnv, "SELECT COUNT(*) as count FROM table1 WHERE s0 ='t11' AND s1='t11' AND s2='t11' AND s3='t11'", "count,", Collections.singleton("0,"), - "sg2"); + "db2"); TestUtils.assertDataEventuallyOnEnv( receiverEnv, "SELECT COUNT(*) as count FROM table1 WHERE s0 ='t12' AND s1='t12' AND s2='t12' AND s3='t12'", "count,", Collections.singleton("5900,"), - "sg2"); + "db2"); TestUtils.assertDataEventuallyOnEnv( receiverEnv, "SELECT COUNT(*) as count FROM table1 WHERE s0 ='t13' AND s1='t13' AND s2='t13' AND s3='t13'", "count,", Collections.singleton("1000,"), - "sg2"); + "db2"); TestUtils.assertDataEventuallyOnEnv( receiverEnv, "SELECT COUNT(*) as count FROM table1 WHERE s0 ='t14' AND s1='t14' AND s2='t14' AND s3='t14'", "count,", Collections.singleton("10000,"), - "sg2"); + "db2"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/enhanced/IoTDBPipeSinkParallelIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/enhanced/IoTDBPipeSinkParallelIT.java index 85f3b93aa7635..e88d786473e28 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/enhanced/IoTDBPipeSinkParallelIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/enhanced/IoTDBPipeSinkParallelIT.java @@ -96,10 +96,10 @@ public void testIoTConnectorParallel() throws Exception { TestUtils.executeNonQueries( senderEnv, Arrays.asList( - "insert into root.sg1.d1(time, s1) values (0, 1)", - "insert into root.sg1.d1(time, s1) values (1, 2)", - "insert into root.sg1.d1(time, s1) values (2, 3)", - "insert into root.sg1.d1(time, s1) values (3, 4)", + "insert into root.db1.d1(time, s1) values (0, 1)", + "insert into root.db1.d1(time, s1) values (1, 2)", + "insert into root.db1.d1(time, s1) values (2, 3)", + "insert into root.db1.d1(time, s1) values (3, 4)", "flush"), null); TableModelUtils.insertData("test", "test", 100, 200, senderEnv); @@ -109,8 +109,8 @@ public void testIoTConnectorParallel() throws Exception { expectedResSet.add("3,4.0,"); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "select * from root.sg1.**", - "Time,root.sg1.d1.s1,", + "select * from root.db1.**", + "Time,root.db1.d1.s1,", expectedResSet, handleFailure); diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSinkParallelIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSinkParallelIT.java index 9cd61d68fbf11..195f6b254a406 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSinkParallelIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSinkParallelIT.java @@ -85,10 +85,10 @@ public void testIoTConnectorParallel() throws Exception { TestUtils.executeNonQueries( senderEnv, Arrays.asList( - "insert into root.sg1.d1(time, s1) values (0, 1)", - "insert into root.sg1.d1(time, s1) values (1, 2)", - "insert into root.sg1.d1(time, s1) values (2, 3)", - "insert into root.sg1.d1(time, s1) values (3, 4)", + "insert into root.db1.d1(time, s1) values (0, 1)", + "insert into root.db1.d1(time, s1) values (1, 2)", + "insert into root.db1.d1(time, s1) values (2, 3)", + "insert into root.db1.d1(time, s1) values (3, 4)", "flush"), null); @@ -97,7 +97,7 @@ public void testIoTConnectorParallel() throws Exception { expectedResSet.add("2,3.0,"); expectedResSet.add("3,4.0,"); TestUtils.assertDataEventuallyOnEnv( - receiverEnv, "select * from root.sg1.**", "Time,root.sg1.d1.s1,", expectedResSet); + receiverEnv, "select * from root.db1.**", "Time,root.db1.d1.s1,", expectedResSet); } } } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeAutoConflictIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeAutoConflictIT.java index d8a191c371964..e1321e6e93257 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeAutoConflictIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeAutoConflictIT.java @@ -398,15 +398,15 @@ public void testHistoricalActivationRace() throws Exception { TestUtils.executeNonQueries( senderEnv, Arrays.asList( - "create database root.sg_aligned", + "create database root.db_aligned", "create device template aligned_template aligned (s0 int32, s1 int64, s2 float, s3 double, s4 boolean, s5 text)", - "set device template aligned_template to root.sg_aligned.device_aligned", - "create timeseries using device template on root.sg_aligned.device_aligned.d10", - "create timeseries using device template on root.sg_aligned.device_aligned.d12", - "insert into root.sg_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5) values (1706659200,1706659200,10,20.245,25.24555,true,''),(1706662800,null,1706662800,20.241,25.24111,false,'2'),(1706666400,3,null,20.242,25.24222,true,'3'),(1706670000,4,40,null,35.5474,true,'4'),(1706670600,5,1706670600000,20.246,null,false,'5'),(1706671200,6,60,20.248,25.24888,null,'6'),(1706671800,7,1706671800,20.249,25.24999,false,null),(1706672400,8,80,1245.392,75.51234,false,'8'),(1706672600,9,90,2345.397,2285.58734,false,'9'),(1706673000,10,100,20.241,25.24555,false,'10'),(1706673600,11,110,3345.394,4105.544,false,'11'),(1706674200,12,1706674200,30.245,35.24555,false,'12'),(1706674800,13,130,5.39,125.51234,false,'13'),(1706675400,14,1706675400,5.39,135.51234,false,'14'),(1706676000,15,150,5.39,145.51234,false,'15'),(1706676600,16,160,5.39,155.51234,false,'16'),(1706677200,17,170,5.39,165.51234,false,'17'),(1706677600,18,180,5.39,175.51234,false,'18'),(1706677800,19,190,5.39,185.51234,false,'19'),(1706678000,20,200,5.39,195.51234,false,'20'),(1706678200,21,210,5.39,null,false,'21')", - "insert into root.sg_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5) values (-1,1,10,5.39,5.51234,false,'negative')", - "insert into root.sg_aligned.device_aligned.d11(time, s0, s1, s2,s3,s4,s5) values (-1,-11,-110,-5.39,-5.51234,false,'activate:1')", - "insert into root.sg_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5,s6) values(1706678800,1,1706678800,5.39,5.51234,false,'add:s6',32);"), + "set device template aligned_template to root.db_aligned.device_aligned", + "create timeseries using device template on root.db_aligned.device_aligned.d10", + "create timeseries using device template on root.db_aligned.device_aligned.d12", + "insert into root.db_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5) values (1706659200,1706659200,10,20.245,25.24555,true,''),(1706662800,null,1706662800,20.241,25.24111,false,'2'),(1706666400,3,null,20.242,25.24222,true,'3'),(1706670000,4,40,null,35.5474,true,'4'),(1706670600,5,1706670600000,20.246,null,false,'5'),(1706671200,6,60,20.248,25.24888,null,'6'),(1706671800,7,1706671800,20.249,25.24999,false,null),(1706672400,8,80,1245.392,75.51234,false,'8'),(1706672600,9,90,2345.397,2285.58734,false,'9'),(1706673000,10,100,20.241,25.24555,false,'10'),(1706673600,11,110,3345.394,4105.544,false,'11'),(1706674200,12,1706674200,30.245,35.24555,false,'12'),(1706674800,13,130,5.39,125.51234,false,'13'),(1706675400,14,1706675400,5.39,135.51234,false,'14'),(1706676000,15,150,5.39,145.51234,false,'15'),(1706676600,16,160,5.39,155.51234,false,'16'),(1706677200,17,170,5.39,165.51234,false,'17'),(1706677600,18,180,5.39,175.51234,false,'18'),(1706677800,19,190,5.39,185.51234,false,'19'),(1706678000,20,200,5.39,195.51234,false,'20'),(1706678200,21,210,5.39,null,false,'21')", + "insert into root.db_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5) values (-1,1,10,5.39,5.51234,false,'negative')", + "insert into root.db_aligned.device_aligned.d11(time, s0, s1, s2,s3,s4,s5) values (-1,-11,-110,-5.39,-5.51234,false,'activate:1')", + "insert into root.db_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5,s6) values(1706678800,1,1706678800,5.39,5.51234,false,'add:s6',32);"), null); final Map extractorAttributes = new HashMap<>(); @@ -432,7 +432,7 @@ public void testHistoricalActivationRace() throws Exception { TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "count devices root.sg_aligned.**", + "count devices root.db_aligned.**", "count(devices),", Collections.singleton("3,")); } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeIdempotentIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeIdempotentIT.java index 39bdd8216470e..d3f099de34ad9 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeIdempotentIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeIdempotentIT.java @@ -176,7 +176,7 @@ public void testDeleteTimeSeriesIdempotent() throws Exception { Collections.singletonList( "create timeSeries root.ln.wf01.wt01.status0(status0) with datatype=BOOLEAN,encoding=PLAIN"), "delete timeSeries root.ln.wf01.wt01.status0", - "create database root.sg", + "create database root.db", "count databases", "count,", Collections.singleton("3,")); @@ -187,7 +187,7 @@ public void testCreateTemplateIdempotent() throws Exception { testIdempotent( Collections.emptyList(), "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -199,7 +199,7 @@ public void testExtendTemplateIdempotent() throws Exception { Collections.singletonList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)"), "alter schema template t1 add (rest FLOAT encoding=RLE, FLOAT2 TEXT encoding=PLAIN compression=SNAPPY)", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -211,7 +211,7 @@ public void testDropTemplateIdempotent() throws Exception { Collections.singletonList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)"), "drop schema template t1", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -222,9 +222,9 @@ public void testSetTemplateIdempotent() throws Exception { testIdempotent( Arrays.asList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1"), - "set schema template t1 to root.sg1", - "create database root.sg2", + "create database root.db1"), + "set schema template t1 to root.db1", + "create database root.db2", "count databases", "count,", Collections.singleton("3,")); @@ -235,10 +235,10 @@ public void testUnsetTemplateIdempotent() throws Exception { testIdempotent( Arrays.asList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1", - "set schema template t1 to root.sg1"), - "unset schema template t1 from root.sg1", - "create database root.sg2", + "create database root.db1", + "set schema template t1 to root.db1"), + "unset schema template t1 from root.db1", + "create database root.db2", "count databases", "count,", Collections.singleton("3,")); @@ -249,11 +249,11 @@ public void testActivateTemplateIdempotent() throws Exception { testIdempotent( Arrays.asList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1", - "set schema template t1 to root.sg1"), - "create timeSeries using device template on root.sg1.d1", - "create timeSeries using device template on root.sg1.d2", - "count timeSeries root.sg1.**", + "create database root.db1", + "set schema template t1 to root.db1"), + "create timeSeries using device template on root.db1.d1", + "create timeSeries using device template on root.db1.d2", + "count timeSeries root.db1.**", "count(timeseries),", Collections.singleton("6,")); } @@ -263,12 +263,12 @@ public void testDeactivateTemplateIdempotent() throws Exception { testIdempotent( Arrays.asList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1", - "set schema template t1 to root.sg1", - "create timeSeries using device template on root.sg1.d1", - "create timeSeries using device template on root.sg1.d2"), - "delete timeSeries of schema template t1 from root.sg1.*", - "create database root.sg2", + "create database root.db1", + "set schema template t1 to root.db1", + "create timeSeries using device template on root.db1.d1", + "create timeSeries using device template on root.db1.d2"), + "delete timeSeries of schema template t1 from root.db1.*", + "create database root.db2", "count databases", "count,", Collections.singleton("3,")); @@ -278,8 +278,8 @@ public void testDeactivateTemplateIdempotent() throws Exception { public void testCreateDatabaseIdempotent() throws Exception { testIdempotent( Collections.emptyList(), - "create database root.sg1", - "create database root.sg2", + "create database root.db1", + "create database root.db2", "count databases", "count,", Collections.singleton("3,")); @@ -288,9 +288,9 @@ public void testCreateDatabaseIdempotent() throws Exception { @Test public void testAlterDatabaseIdempotent() throws Exception { testIdempotent( - Collections.singletonList("create database root.sg1"), - "ALTER DATABASE root.sg1 WITH SCHEMA_REGION_GROUP_NUM=2, DATA_REGION_GROUP_NUM=3;", - "create database root.sg2", + Collections.singletonList("create database root.db1"), + "ALTER DATABASE root.db1 WITH SCHEMA_REGION_GROUP_NUM=2, DATA_REGION_GROUP_NUM=3;", + "create database root.db2", "count databases", "count,", Collections.singleton("3,")); @@ -299,9 +299,9 @@ public void testAlterDatabaseIdempotent() throws Exception { @Test public void testDropDatabaseIdempotent() throws Exception { testIdempotent( - Collections.singletonList("create database root.sg1"), - "drop database root.sg1", - "create database root.sg2", + Collections.singletonList("create database root.db1"), + "drop database root.db1", + "create database root.db2", "count databases", "count,", Collections.singleton("2,")); @@ -312,7 +312,7 @@ public void testCreateUserIdempotent() throws Exception { testIdempotent( Collections.emptyList(), "create user `ln_write_user` 'write_pwd123456'", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -323,7 +323,7 @@ public void testCreateRoleIdempotent() throws Exception { testIdempotent( Collections.emptyList(), "create role `test`", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -334,7 +334,7 @@ public void testGrantRoleToUserIdempotent() throws Exception { testIdempotent( Arrays.asList("create user `ln_write_user` 'write_pwd123456'", "create role `test`"), "grant role test to ln_write_user", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -347,7 +347,7 @@ public void testRevokeUserIdempotent() throws Exception { "create user `ln_write_user` 'write_pwd123456'", "GRANT READ_DATA, WRITE_DATA ON root.t1.** TO USER ln_write_user;"), "REVOKE READ_DATA, WRITE_DATA ON root.t1.** FROM USER ln_write_user;", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -358,7 +358,7 @@ public void testRevokeRoleIdempotent() throws Exception { testIdempotent( Arrays.asList("create role `test`", "GRANT READ ON root.** TO ROLE test;"), "REVOKE READ ON root.** FROM ROLE test;", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -372,7 +372,7 @@ public void testRevokeRoleFromUserIdempotent() throws Exception { "create role `test`", "grant role test to ln_write_user"), "revoke role test from ln_write_user", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -383,7 +383,7 @@ public void testDropUserIdempotent() throws Exception { testIdempotent( Collections.singletonList("create user `ln_write_user` 'write_pwd123456'"), "drop user `ln_write_user`", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -394,7 +394,7 @@ public void testDropRoleIdempotent() throws Exception { testIdempotent( Collections.singletonList("create role `test`"), "drop role test", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeNullValueIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeNullValueIT.java index 9dc07aaa6c3ae..66f0a9c8e8621 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeNullValueIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeNullValueIT.java @@ -73,13 +73,13 @@ private enum InsertType { private static final List CREATE_TIMESERIES_SQL = Arrays.asList( - "create timeseries root.sg.d1.s0 with datatype=float", - "create timeseries root.sg.d1.s1 with datatype=float"); + "create timeseries root.db.d1.s0 with datatype=float", + "create timeseries root.db.d1.s1 with datatype=float"); private static final List CREATE_ALIGNED_TIMESERIES_SQL = - Collections.singletonList("create aligned timeseries root.sg.d1(s0 float, s1 float)"); + Collections.singletonList("create aligned timeseries root.db.d1(s0 float, s1 float)"); - private final String deviceId = "root.sg.d1"; + private final String deviceId = "root.db.d1"; private final List measurements = Arrays.asList("s0", "s1"); private final List types = Arrays.asList(TSDataType.FLOAT, TSDataType.FLOAT); @@ -189,18 +189,18 @@ public void setUp() { senderEnv, isAligned ? Collections.singletonList( - "insert into root.sg.d1(time, s0, s1) aligned values (3, null, 25.34)") + "insert into root.db.d1(time, s0, s1) aligned values (3, null, 25.34)") : Collections.singletonList( - "insert into root.sg.d1(time, s0, s1) values (3, null, 25.34)"), + "insert into root.db.d1(time, s0, s1) values (3, null, 25.34)"), null); // All null TestUtils.executeNonQueries( senderEnv, isAligned ? Collections.singletonList( - "insert into root.sg.d1(time, s0, s1) aligned values (4, null, null)") + "insert into root.db.d1(time, s0, s1) aligned values (4, null, null)") : Collections.singletonList( - "insert into root.sg.d1(time, s0, s1) values (4, null, null)"), + "insert into root.db.d1(time, s0, s1) values (4, null, null)"), null); }); } @@ -226,7 +226,7 @@ private void testInsertNullValueTemplate( if (withParsing) { extractorAttributes.put("start-time", "1970-01-01T08:00:00.000+08:00"); extractorAttributes.put("end-time", "1970-01-01T09:00:00.000+08:00"); - extractorAttributes.put("extractor.pattern", "root.sg.d1"); + extractorAttributes.put("extractor.pattern", "root.db.d1"); } final TSStatus status = @@ -248,8 +248,8 @@ private void testInsertNullValueTemplate( TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "select count(*) from root.sg.**", - "count(root.sg.d1.s0),count(root.sg.d1.s1),", + "select count(*) from root.db.**", + "count(root.db.d1.s0),count(root.db.d1.s1),", Collections.singleton("0,1,")); } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeManualConflictIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeManualConflictIT.java index cc391f39b437d..b1fe0b49c6c28 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeManualConflictIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeManualConflictIT.java @@ -218,40 +218,40 @@ public void testDoubleLivingTemplate() throws Exception { senderEnv, Arrays.asList( "create device template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1", - "set device template t1 to root.sg1", - "create timeseries using device template on root.sg1.d1", - "insert into root.sg1.d1(time, s1, s2, s3) values(0, 1, 2, 3);", + "create database root.db1", + "set device template t1 to root.db1", + "create timeseries using device template on root.db1.d1", + "insert into root.db1.d1(time, s1, s2, s3) values(0, 1, 2, 3);", "flush"), null); TestUtils.executeNonQueries( receiverEnv, Arrays.asList( - "create timeseries using device template on root.sg1.d2", - "insert into root.sg1.d2(time, s1, s2, s3) values(0, 1, 2, 3);", + "create timeseries using device template on root.db1.d2", + "insert into root.db1.d2(time, s1, s2, s3) values(0, 1, 2, 3);", "flush"), null); TestUtils.assertDataEventuallyOnEnv( senderEnv, - "count timeseries root.sg1.**", + "count timeseries root.db1.**", "count(timeseries),", Collections.singleton("6,")); TestUtils.assertDataEventuallyOnEnv( senderEnv, - "select count(*) from root.sg1.** group by level=1", - "count(root.sg1.*.*),", + "select count(*) from root.db1.** group by level=1", + "count(root.db1.*.*),", Collections.singleton("6,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "count timeseries root.sg1.**", + "count timeseries root.db1.**", "count(timeseries),", Collections.singleton("6,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "select count(*) from root.sg1.** group by level=1", - "count(root.sg1.*.*),", + "select count(*) from root.db1.** group by level=1", + "count(root.db1.*.*),", Collections.singleton("6,")); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMetaHistoricalIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMetaHistoricalIT.java index cb0c334f68b9a..36d364788703e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMetaHistoricalIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMetaHistoricalIT.java @@ -282,9 +282,9 @@ public void testTimeSeriesInclusion() throws Exception { TestUtils.executeNonQueries( senderEnv, Arrays.asList( - "create database root.sg", - "create timeseries root.sg.a.b int32", - "create aligned timeseries root.sg.`apache|timecho-tag-attr`.d1(s1 INT32 tags(tag1=v1, tag2=v2) attributes(attr1=v1, attr2=v2), s2 DOUBLE tags(tag3=v3, tag4=v4) attributes(attr3=v3, attr4=v4))"), + "create database root.db", + "create timeseries root.db.a.b int32", + "create aligned timeseries root.db.`apache|timecho-tag-attr`.d1(s1 INT32 tags(tag1=v1, tag2=v2) attributes(attr1=v1, attr2=v2), s2 DOUBLE tags(tag3=v3, tag4=v4) attributes(attr3=v3, attr4=v4))"), null); final Map extractorAttributes = new HashMap<>(); @@ -312,13 +312,13 @@ public void testTimeSeriesInclusion() throws Exception { TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "show timeseries root.sg.**", + "show timeseries root.db.**", "Timeseries,Alias,Database,DataType,Encoding,Compression,Tags,Attributes,Deadband,DeadbandParameters,ViewType,", new HashSet<>( Arrays.asList( - "root.sg.a.b,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.`apache|timecho-tag-attr`.d1.s1,null,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},{\"attr2\":\"v2\",\"attr1\":\"v1\"},null,null,BASE,", - "root.sg.`apache|timecho-tag-attr`.d1.s2,null,root.sg,DOUBLE,GORILLA,LZ4,{\"tag4\":\"v4\",\"tag3\":\"v3\"},{\"attr4\":\"v4\",\"attr3\":\"v3\"},null,null,BASE,"))); + "root.db.a.b,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.`apache|timecho-tag-attr`.d1.s1,null,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},{\"attr2\":\"v2\",\"attr1\":\"v1\"},null,null,BASE,", + "root.db.`apache|timecho-tag-attr`.d1.s2,null,root.db,DOUBLE,GORILLA,LZ4,{\"tag4\":\"v4\",\"tag3\":\"v3\"},{\"attr4\":\"v4\",\"attr3\":\"v3\"},null,null,BASE,"))); } } } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMultiSchemaRegionIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMultiSchemaRegionIT.java index a0d5ee7e1d135..46f9186ea1c3e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMultiSchemaRegionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMultiSchemaRegionIT.java @@ -55,7 +55,7 @@ public void testMultiSchemaRegion() throws Exception { senderEnv, Arrays.asList( "create timeseries root.ln.wf01.GPS.status0 with datatype=BOOLEAN,encoding=PLAIN", - "create timeseries root.sg.wf01.GPS.status0 with datatype=BOOLEAN,encoding=PLAIN"), + "create timeseries root.db.wf01.GPS.status0 with datatype=BOOLEAN,encoding=PLAIN"), null); final Map extractorAttributes = new HashMap<>(); @@ -87,7 +87,7 @@ public void testMultiSchemaRegion() throws Exception { senderEnv, Arrays.asList( "create timeseries root.ln.wf01.GPS.status1 with datatype=BOOLEAN,encoding=PLAIN", - "create timeseries root.sg.wf01.GPS.status1 with datatype=BOOLEAN,encoding=PLAIN"), + "create timeseries root.db.wf01.GPS.status1 with datatype=BOOLEAN,encoding=PLAIN"), null); TestUtils.assertDataEventuallyOnEnv( @@ -97,7 +97,7 @@ public void testMultiSchemaRegion() throws Exception { Collections.singleton("2,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "count timeseries root.sg.**", + "count timeseries root.db.**", "count(timeseries),", Collections.singleton("2,")); } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeTsFileDecompositionWithModsIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeTsFileDecompositionWithModsIT.java index 89f1c3fb4401d..2ec5770f1f684 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeTsFileDecompositionWithModsIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeTsFileDecompositionWithModsIT.java @@ -47,7 +47,7 @@ protected void setupConfig() { /** * Test IoTDB pipe handling TsFile decomposition with Mods (modification operations) in tree model * - *

Test scenario: 1. Create database root.sg1 with 4 devices: d1 (aligned timeseries), d2 + *

Test scenario: 1. Create database root.db1 with 4 devices: d1 (aligned timeseries), d2 * (non-aligned timeseries), d3 (aligned timeseries), d4 (aligned timeseries) 2. Insert initial * data into d1, d2, d3 3. Execute FLUSH operation to persist data to TsFile 4. Execute DELETE * operation on d1.s1, deleting data in time range 2-4 5. Insert large amount of data into d4 @@ -64,42 +64,42 @@ protected void setupConfig() { */ @Test public void testTsFileDecompositionWithMods() throws Exception { - TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.sg1"); - TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.sg1"); + TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.db1"); + TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.db1"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d1(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d1(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE TIMESERIES root.sg1.d2.s1 WITH DATATYPE=FLOAT"); + senderEnv, "CREATE TIMESERIES root.db1.d2.s1 WITH DATATYPE=FLOAT"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE TIMESERIES root.sg1.d2.s2 WITH DATATYPE=FLOAT"); + senderEnv, "CREATE TIMESERIES root.db1.d2.s2 WITH DATATYPE=FLOAT"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d3(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d3(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d1(time, s1, s2, s3) ALIGNED VALUES (1, 1.0, 2.0, 3.0), (2, 1.1, 2.1, 3.1), (3, 1.2, 2.2, 3.2), (4, 1.3, 2.3, 3.3), (5, 1.4, 2.4, 3.4)"); + "INSERT INTO root.db1.d1(time, s1, s2, s3) ALIGNED VALUES (1, 1.0, 2.0, 3.0), (2, 1.1, 2.1, 3.1), (3, 1.2, 2.2, 3.2), (4, 1.3, 2.3, 3.3), (5, 1.4, 2.4, 3.4)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d2(time, s1, s2) VALUES (1, 10.0, 20.0), (2, 10.1, 20.1), (3, 10.2, 20.2), (4, 10.3, 20.3), (5, 10.4, 20.4)"); + "INSERT INTO root.db1.d2(time, s1, s2) VALUES (1, 10.0, 20.0), (2, 10.1, 20.1), (3, 10.2, 20.2), (4, 10.3, 20.3), (5, 10.4, 20.4)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); + "INSERT INTO root.db1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s1 WHERE time >= 2 AND time <= 4"); + senderEnv, "DELETE FROM root.db1.d1.s1 WHERE time >= 2 AND time <= 4"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); + "INSERT INTO root.db1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d4(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); - String s = "INSERT INTO root.sg1.d4(time, s1, s2, s3) ALIGNED VALUES "; + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d4(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + String s = "INSERT INTO root.db1.d4(time, s1, s2, s3) ALIGNED VALUES "; StringBuilder insertBuilder = new StringBuilder(s); for (int i = 1; i <= 11000; i++) { insertBuilder @@ -122,13 +122,13 @@ public void testTsFileDecompositionWithMods() throws Exception { TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s1 WHERE time <= 10000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s2 WHERE time > 1000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s3 WHERE time <= 8000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s1 WHERE time <= 10000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s2 WHERE time > 1000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s3 WHERE time <= 8000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d2.*"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d2.*"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d3.*"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d3.*"); TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); @@ -144,8 +144,8 @@ public void testTsFileDecompositionWithMods() throws Exception { TestUtils.assertDataEventuallyOnEnv( senderEnv, - "SELECT * FROM root.sg1.d1 ORDER BY time", - "Time,root.sg1.d1.s3,root.sg1.d1.s1,root.sg1.d1.s2,", + "SELECT * FROM root.db1.d1 ORDER BY time", + "Time,root.db1.d1.s3,root.db1.d1.s1,root.db1.d1.s2,", results); executeNonQueryWithRetry( @@ -157,26 +157,26 @@ public void testTsFileDecompositionWithMods() throws Exception { TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT * FROM root.sg1.d1 ORDER BY time", - "Time,root.sg1.d1.s3,root.sg1.d1.s1,root.sg1.d1.s2,", + "SELECT * FROM root.db1.d1 ORDER BY time", + "Time,root.db1.d1.s3,root.db1.d1.s1,root.db1.d1.s2,", results); TestUtils.assertDataEventuallyOnEnv( - receiverEnv, "SELECT * FROM root.sg1.d2 ORDER BY time", "Time,", Collections.emptySet()); + receiverEnv, "SELECT * FROM root.db1.d2 ORDER BY time", "Time,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( - receiverEnv, "SELECT * FROM root.sg1.d3 ORDER BY time", "Time,", Collections.emptySet()); + receiverEnv, "SELECT * FROM root.db1.d3 ORDER BY time", "Time,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT s1 FROM root.sg1.d1 WHERE time >= 2 AND time <= 4", - "Time,root.sg1.d1.s1,", + "SELECT s1 FROM root.db1.d1 WHERE time >= 2 AND time <= 4", + "Time,root.db1.d1.s1,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(**) FROM root.sg1.d4", - "COUNT(root.sg1.d4.s3),COUNT(root.sg1.d4.s1),COUNT(root.sg1.d4.s2),", + "SELECT COUNT(**) FROM root.db1.d4", + "COUNT(root.db1.d4.s3),COUNT(root.db1.d4.s1),COUNT(root.db1.d4.s2),", Collections.singleton("3000,1000,1000,")); } @@ -184,7 +184,7 @@ public void testTsFileDecompositionWithMods() throws Exception { * Test IoTDB pipe handling TsFile decomposition with Mods (modification operations) in tree model * - Multi-pipe scenario * - *

Test scenario: 1. Create database root.sg1 with 4 devices: d1 (aligned timeseries), d2 + *

Test scenario: 1. Create database root.db1 with 4 devices: d1 (aligned timeseries), d2 * (non-aligned timeseries), d3 (aligned timeseries), d4 (aligned timeseries) 2. Insert initial * data into d1, d2, d3 3. Execute FLUSH operation to persist data to TsFile 4. Execute DELETE * operation on d1.s1, deleting data in time range 2-4 5. Insert large amount of data into d4 @@ -192,8 +192,8 @@ public void testTsFileDecompositionWithMods() throws Exception { * field data where time<=10000 - Delete s2 field data where time>1000 - Delete s3 field data * where time<=8000 7. Delete all data from d2 and d3 8. Execute FLUSH operation again 9. Create 4 * independent pipes, each targeting different device paths: - test_pipe1: handles data for - * root.sg1.d1.** path - test_pipe2: handles data for root.sg1.d2.** path - test_pipe3: handles - * data for root.sg1.d3.** path - test_pipe4: handles data for root.sg1.d4.** path 10. Verify + * root.db1.d1.** path - test_pipe2: handles data for root.db1.d2.** path - test_pipe3: handles + * data for root.db1.d3.** path - test_pipe4: handles data for root.db1.d4.** path 10. Verify * correctness of receiver data: - d1 s1 field is null in time range 2-4, other data is normal - * d2 and d3 data is completely deleted - d4 DELETE operation results meet expectations for each * field @@ -206,42 +206,42 @@ public void testTsFileDecompositionWithMods() throws Exception { */ @Test public void testTsFileDecompositionWithMods2() throws Exception { - TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.sg1"); - TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.sg1"); + TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.db1"); + TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.db1"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d1(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d1(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE TIMESERIES root.sg1.d2.s1 WITH DATATYPE=FLOAT"); + senderEnv, "CREATE TIMESERIES root.db1.d2.s1 WITH DATATYPE=FLOAT"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE TIMESERIES root.sg1.d2.s2 WITH DATATYPE=FLOAT"); + senderEnv, "CREATE TIMESERIES root.db1.d2.s2 WITH DATATYPE=FLOAT"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d3(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d3(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d1(time, s1, s2, s3) ALIGNED VALUES (1, 1.0, 2.0, 3.0), (2, 1.1, 2.1, 3.1), (3, 1.2, 2.2, 3.2), (4, 1.3, 2.3, 3.3), (5, 1.4, 2.4, 3.4)"); + "INSERT INTO root.db1.d1(time, s1, s2, s3) ALIGNED VALUES (1, 1.0, 2.0, 3.0), (2, 1.1, 2.1, 3.1), (3, 1.2, 2.2, 3.2), (4, 1.3, 2.3, 3.3), (5, 1.4, 2.4, 3.4)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d2(time, s1, s2) VALUES (1, 10.0, 20.0), (2, 10.1, 20.1), (3, 10.2, 20.2), (4, 10.3, 20.3), (5, 10.4, 20.4)"); + "INSERT INTO root.db1.d2(time, s1, s2) VALUES (1, 10.0, 20.0), (2, 10.1, 20.1), (3, 10.2, 20.2), (4, 10.3, 20.3), (5, 10.4, 20.4)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); + "INSERT INTO root.db1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s1 WHERE time >= 2 AND time <= 4"); + senderEnv, "DELETE FROM root.db1.d1.s1 WHERE time >= 2 AND time <= 4"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); + "INSERT INTO root.db1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d4(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); - String s = "INSERT INTO root.sg1.d4(time, s1, s2, s3) ALIGNED VALUES "; + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d4(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + String s = "INSERT INTO root.db1.d4(time, s1, s2, s3) ALIGNED VALUES "; StringBuilder insertBuilder = new StringBuilder(s); for (int i = 1; i <= 11000; i++) { insertBuilder @@ -264,13 +264,13 @@ public void testTsFileDecompositionWithMods2() throws Exception { TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s1 WHERE time <= 10000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s2 WHERE time > 1000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s3 WHERE time <= 8000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s1 WHERE time <= 10000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s2 WHERE time > 1000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s3 WHERE time <= 8000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d2.*"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d2.*"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d3.*"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d3.*"); TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); @@ -286,60 +286,60 @@ public void testTsFileDecompositionWithMods2() throws Exception { TestUtils.assertDataEventuallyOnEnv( senderEnv, - "SELECT * FROM root.sg1.d1 ORDER BY time", - "Time,root.sg1.d1.s3,root.sg1.d1.s1,root.sg1.d1.s2,", + "SELECT * FROM root.db1.d1 ORDER BY time", + "Time,root.db1.d1.s3,root.db1.d1.s1,root.db1.d1.s2,", results); executeNonQueryWithRetry( senderEnv, String.format( - "CREATE PIPE test_pipe1 WITH SOURCE ('mods.enable'='true','path'='root.sg1.d1.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", + "CREATE PIPE test_pipe1 WITH SOURCE ('mods.enable'='true','path'='root.db1.d1.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", receiverEnv.getDataNodeWrapperList().get(0).getIp(), receiverEnv.getDataNodeWrapperList().get(0).getPort())); executeNonQueryWithRetry( senderEnv, String.format( - "CREATE PIPE test_pipe2 WITH SOURCE ('mods.enable'='true','path'='root.sg1.d2.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", + "CREATE PIPE test_pipe2 WITH SOURCE ('mods.enable'='true','path'='root.db1.d2.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", receiverEnv.getDataNodeWrapperList().get(0).getIp(), receiverEnv.getDataNodeWrapperList().get(0).getPort())); executeNonQueryWithRetry( senderEnv, String.format( - "CREATE PIPE test_pipe3 WITH SOURCE ('mods.enable'='true','path'='root.sg1.d3.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", + "CREATE PIPE test_pipe3 WITH SOURCE ('mods.enable'='true','path'='root.db1.d3.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", receiverEnv.getDataNodeWrapperList().get(0).getIp(), receiverEnv.getDataNodeWrapperList().get(0).getPort())); executeNonQueryWithRetry( senderEnv, String.format( - "CREATE PIPE test_pipe4 WITH SOURCE ('mods.enable'='true','path'='root.sg1.d4.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", + "CREATE PIPE test_pipe4 WITH SOURCE ('mods.enable'='true','path'='root.db1.d4.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", receiverEnv.getDataNodeWrapperList().get(0).getIp(), receiverEnv.getDataNodeWrapperList().get(0).getPort())); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT * FROM root.sg1.d1 ORDER BY time", - "Time,root.sg1.d1.s3,root.sg1.d1.s1,root.sg1.d1.s2,", + "SELECT * FROM root.db1.d1 ORDER BY time", + "Time,root.db1.d1.s3,root.db1.d1.s1,root.db1.d1.s2,", results); TestUtils.assertDataEventuallyOnEnv( - receiverEnv, "SELECT * FROM root.sg1.d2 ORDER BY time", "Time,", Collections.emptySet()); + receiverEnv, "SELECT * FROM root.db1.d2 ORDER BY time", "Time,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( - receiverEnv, "SELECT * FROM root.sg1.d3 ORDER BY time", "Time,", Collections.emptySet()); + receiverEnv, "SELECT * FROM root.db1.d3 ORDER BY time", "Time,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT s1 FROM root.sg1.d1 WHERE time >= 2 AND time <= 4", - "Time,root.sg1.d1.s1,", + "SELECT s1 FROM root.db1.d1 WHERE time >= 2 AND time <= 4", + "Time,root.db1.d1.s1,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(**) FROM root.sg1.d4", - "COUNT(root.sg1.d4.s3),COUNT(root.sg1.d4.s1),COUNT(root.sg1.d4.s2),", + "SELECT COUNT(**) FROM root.db1.d4", + "COUNT(root.db1.d4.s3),COUNT(root.db1.d4.s1),COUNT(root.db1.d4.s2),", Collections.singleton("3000,1000,1000,")); } @@ -347,7 +347,7 @@ public void testTsFileDecompositionWithMods2() throws Exception { * Test IoTDB pipe handling TsFile decomposition with Mods (modification operations) in tree model * - Large scale single point deletion scenario * - *

Test scenario: 1. Create database root.sg1 with 1 device: d1 (aligned timeseries with 5 + *

Test scenario: 1. Create database root.db1 with 1 device: d1 (aligned timeseries with 5 * sensors) 2. Insert 20000 data points for each sensor with different time ranges: - s1: time * 1-20000 - s2: time 10001-30000 - s3: time 20001-40000 - s4: time 30001-50000 - s5: time * 40001-60000 3. Execute FLUSH operation to persist data to TsFile 4. Execute 2000 single point @@ -361,11 +361,11 @@ public void testTsFileDecompositionWithMods2() throws Exception { */ @Test public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throws Exception { - TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.sg1"); - TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.sg1"); + TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.db1"); + TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.db1"); // Insert 20000 data points for s1 (time 1-20000) - String s1 = "INSERT INTO root.sg1.d1(time, s1) ALIGNED VALUES "; + String s1 = "INSERT INTO root.db1.d1(time, s1) ALIGNED VALUES "; StringBuilder insertBuilder1 = new StringBuilder(s1); for (int i = 1; i <= 20000; i++) { insertBuilder1.append("(").append(i).append(",").append(1.0f).append(")"); @@ -382,7 +382,7 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw } // Insert 20000 data points for s2 (time 10001-30000) - String s2 = "INSERT INTO root.sg1.d1(time, s2) ALIGNED VALUES "; + String s2 = "INSERT INTO root.db1.d1(time, s2) ALIGNED VALUES "; StringBuilder insertBuilder2 = new StringBuilder(s2); for (int i = 10001; i <= 30000; i++) { insertBuilder2.append("(").append(i).append(",").append(2.0f).append(")"); @@ -399,7 +399,7 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw } // Insert 20000 data points for s3 (time 20001-40000) - String s3 = "INSERT INTO root.sg1.d1(time, s3) ALIGNED VALUES "; + String s3 = "INSERT INTO root.db1.d1(time, s3) ALIGNED VALUES "; StringBuilder insertBuilder3 = new StringBuilder(s3); for (int i = 20001; i <= 40000; i++) { insertBuilder3.append("(").append(i).append(",").append(3.0f).append(")"); @@ -416,7 +416,7 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw } // Insert 20000 data points for s4 (time 30001-50000) - String s4 = "INSERT INTO root.sg1.d1(time, s4) ALIGNED VALUES "; + String s4 = "INSERT INTO root.db1.d1(time, s4) ALIGNED VALUES "; StringBuilder insertBuilder4 = new StringBuilder(s4); for (int i = 30001; i <= 50000; i++) { insertBuilder4.append("(").append(i).append(",").append(4.0f).append(")"); @@ -433,7 +433,7 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw } // Insert 20000 data points for s5 (time 40001-60000) - String s5 = "INSERT INTO root.sg1.d1(time, s5) ALIGNED VALUES "; + String s5 = "INSERT INTO root.db1.d1(time, s5) ALIGNED VALUES "; StringBuilder insertBuilder5 = new StringBuilder(s5); for (int i = 40001; i <= 60000; i++) { insertBuilder5.append("(").append(i).append(",").append(5.0f).append(")"); @@ -456,23 +456,23 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw for (int i = 0; i < 400; i++) { // Delete from s1: every 10th point starting from 10 TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s1 WHERE time = " + (10 + i * 10)); + senderEnv, "DELETE FROM root.db1.d1.s1 WHERE time = " + (10 + i * 10)); // Delete from s2: every 10th point starting from 10010 TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s2 WHERE time = " + (10010 + i * 10)); + senderEnv, "DELETE FROM root.db1.d1.s2 WHERE time = " + (10010 + i * 10)); // Delete from s3: every 10th point starting from 20010 TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s3 WHERE time = " + (20010 + i * 10)); + senderEnv, "DELETE FROM root.db1.d1.s3 WHERE time = " + (20010 + i * 10)); // Delete from s4: every 10th point starting from 30010 TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s4 WHERE time = " + (30010 + i * 10)); + senderEnv, "DELETE FROM root.db1.d1.s4 WHERE time = " + (30010 + i * 10)); // Delete from s5: every 10th point starting from 40010 TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s5 WHERE time = " + (40010 + i * 10)); + senderEnv, "DELETE FROM root.db1.d1.s5 WHERE time = " + (40010 + i * 10)); } TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); @@ -482,8 +482,8 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw // before starting the pipe synchronization process TestUtils.assertDataEventuallyOnEnv( senderEnv, - "SELECT COUNT(**) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s3),COUNT(root.sg1.d1.s4),COUNT(root.sg1.d1.s5),COUNT(root.sg1.d1.s1),COUNT(root.sg1.d1.s2),", + "SELECT COUNT(**) FROM root.db1.d1", + "COUNT(root.db1.d1.s3),COUNT(root.db1.d1.s4),COUNT(root.db1.d1.s5),COUNT(root.db1.d1.s1),COUNT(root.db1.d1.s2),", Collections.singleton("19600,19600,19600,19600,19600,")); executeNonQueryWithRetry( @@ -496,165 +496,165 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw // Verify total count of all sensors using COUNT(*) TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(**) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s3),COUNT(root.sg1.d1.s4),COUNT(root.sg1.d1.s5),COUNT(root.sg1.d1.s1),COUNT(root.sg1.d1.s2),", + "SELECT COUNT(**) FROM root.db1.d1", + "COUNT(root.db1.d1.s3),COUNT(root.db1.d1.s4),COUNT(root.db1.d1.s5),COUNT(root.db1.d1.s1),COUNT(root.db1.d1.s2),", Collections.singleton("19600,19600,19600,19600,19600,")); // Verify individual sensor counts TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s1) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s1),", + "SELECT COUNT(s1) FROM root.db1.d1", + "COUNT(root.db1.d1.s1),", Collections.singleton("19600,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s2) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s2),", + "SELECT COUNT(s2) FROM root.db1.d1", + "COUNT(root.db1.d1.s2),", Collections.singleton("19600,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s3) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s3),", + "SELECT COUNT(s3) FROM root.db1.d1", + "COUNT(root.db1.d1.s3),", Collections.singleton("19600,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s4) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s4),", + "SELECT COUNT(s4) FROM root.db1.d1", + "COUNT(root.db1.d1.s4),", Collections.singleton("19600,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s5) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s5),", + "SELECT COUNT(s5) FROM root.db1.d1", + "COUNT(root.db1.d1.s5),", Collections.singleton("19600,")); // Verify count of deleted time ranges using COUNT with WHERE clause // These should return 0 since all points in these ranges were deleted TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s1) FROM root.sg1.d1 WHERE time >= 10 AND time <= 4000 AND time % 10 = 0", - "COUNT(root.sg1.d1.s1),", + "SELECT COUNT(s1) FROM root.db1.d1 WHERE time >= 10 AND time <= 4000 AND time % 10 = 0", + "COUNT(root.db1.d1.s1),", Collections.singleton("0,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s2) FROM root.sg1.d1 WHERE time >= 10010 AND time <= 14000 AND time % 10 = 0", - "COUNT(root.sg1.d1.s2),", + "SELECT COUNT(s2) FROM root.db1.d1 WHERE time >= 10010 AND time <= 14000 AND time % 10 = 0", + "COUNT(root.db1.d1.s2),", Collections.singleton("0,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s3) FROM root.sg1.d1 WHERE time >= 20010 AND time <= 24000 AND time % 10 = 0", - "COUNT(root.sg1.d1.s3),", + "SELECT COUNT(s3) FROM root.db1.d1 WHERE time >= 20010 AND time <= 24000 AND time % 10 = 0", + "COUNT(root.db1.d1.s3),", Collections.singleton("0,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s4) FROM root.sg1.d1 WHERE time >= 30010 AND time <= 34000 AND time % 10 = 0", - "COUNT(root.sg1.d1.s4),", + "SELECT COUNT(s4) FROM root.db1.d1 WHERE time >= 30010 AND time <= 34000 AND time % 10 = 0", + "COUNT(root.db1.d1.s4),", Collections.singleton("0,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s5) FROM root.sg1.d1 WHERE time >= 40010 AND time <= 44000 AND time % 10 = 0", - "COUNT(root.sg1.d1.s5),", + "SELECT COUNT(s5) FROM root.db1.d1 WHERE time >= 40010 AND time <= 44000 AND time % 10 = 0", + "COUNT(root.db1.d1.s5),", Collections.singleton("0,")); // Verify count of non-deleted time ranges using multiple range queries // Check ranges before deletion area TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s1) FROM root.sg1.d1 WHERE time >= 1 AND time < 10", - "COUNT(root.sg1.d1.s1),", + "SELECT COUNT(s1) FROM root.db1.d1 WHERE time >= 1 AND time < 10", + "COUNT(root.db1.d1.s1),", Collections.singleton("9,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s2) FROM root.sg1.d1 WHERE time >= 10001 AND time < 10010", - "COUNT(root.sg1.d1.s2),", + "SELECT COUNT(s2) FROM root.db1.d1 WHERE time >= 10001 AND time < 10010", + "COUNT(root.db1.d1.s2),", Collections.singleton("9,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s3) FROM root.sg1.d1 WHERE time >= 20001 AND time < 20010", - "COUNT(root.sg1.d1.s3),", + "SELECT COUNT(s3) FROM root.db1.d1 WHERE time >= 20001 AND time < 20010", + "COUNT(root.db1.d1.s3),", Collections.singleton("9,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s4) FROM root.sg1.d1 WHERE time >= 30001 AND time < 30010", - "COUNT(root.sg1.d1.s4),", + "SELECT COUNT(s4) FROM root.db1.d1 WHERE time >= 30001 AND time < 30010", + "COUNT(root.db1.d1.s4),", Collections.singleton("9,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s5) FROM root.sg1.d1 WHERE time >= 40001 AND time < 40010", - "COUNT(root.sg1.d1.s5),", + "SELECT COUNT(s5) FROM root.db1.d1 WHERE time >= 40001 AND time < 40010", + "COUNT(root.db1.d1.s5),", Collections.singleton("9,")); // Check ranges after deletion area TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s1) FROM root.sg1.d1 WHERE time > 4000 AND time <= 20000", - "COUNT(root.sg1.d1.s1),", + "SELECT COUNT(s1) FROM root.db1.d1 WHERE time > 4000 AND time <= 20000", + "COUNT(root.db1.d1.s1),", Collections.singleton("16000,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s2) FROM root.sg1.d1 WHERE time > 14000 AND time <= 30000", - "COUNT(root.sg1.d1.s2),", + "SELECT COUNT(s2) FROM root.db1.d1 WHERE time > 14000 AND time <= 30000", + "COUNT(root.db1.d1.s2),", Collections.singleton("16000,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s3) FROM root.sg1.d1 WHERE time > 24000 AND time <= 40000", - "COUNT(root.sg1.d1.s3),", + "SELECT COUNT(s3) FROM root.db1.d1 WHERE time > 24000 AND time <= 40000", + "COUNT(root.db1.d1.s3),", Collections.singleton("16000,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s4) FROM root.sg1.d1 WHERE time > 34000 AND time <= 50000", - "COUNT(root.sg1.d1.s4),", + "SELECT COUNT(s4) FROM root.db1.d1 WHERE time > 34000 AND time <= 50000", + "COUNT(root.db1.d1.s4),", Collections.singleton("16000,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s5) FROM root.sg1.d1 WHERE time > 44000 AND time <= 60000", - "COUNT(root.sg1.d1.s5),", + "SELECT COUNT(s5) FROM root.db1.d1 WHERE time > 44000 AND time <= 60000", + "COUNT(root.db1.d1.s5),", Collections.singleton("16000,")); // Check non-deleted points within deletion range (every 10th point except the ones we deleted) TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s1) FROM root.sg1.d1 WHERE time >= 10 AND time <= 4000 AND time % 10 != 0", - "COUNT(root.sg1.d1.s1),", + "SELECT COUNT(s1) FROM root.db1.d1 WHERE time >= 10 AND time <= 4000 AND time % 10 != 0", + "COUNT(root.db1.d1.s1),", Collections.singleton("3591,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s2) FROM root.sg1.d1 WHERE time >= 10010 AND time <= 14000 AND time % 10 != 0", - "COUNT(root.sg1.d1.s2),", + "SELECT COUNT(s2) FROM root.db1.d1 WHERE time >= 10010 AND time <= 14000 AND time % 10 != 0", + "COUNT(root.db1.d1.s2),", Collections.singleton("3591,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s3) FROM root.sg1.d1 WHERE time >= 20010 AND time <= 24000 AND time % 10 != 0", - "COUNT(root.sg1.d1.s3),", + "SELECT COUNT(s3) FROM root.db1.d1 WHERE time >= 20010 AND time <= 24000 AND time % 10 != 0", + "COUNT(root.db1.d1.s3),", Collections.singleton("3591,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s4) FROM root.sg1.d1 WHERE time >= 30010 AND time <= 34000 AND time % 10 != 0", - "COUNT(root.sg1.d1.s4),", + "SELECT COUNT(s4) FROM root.db1.d1 WHERE time >= 30010 AND time <= 34000 AND time % 10 != 0", + "COUNT(root.db1.d1.s4),", Collections.singleton("3591,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s5) FROM root.sg1.d1 WHERE time >= 40010 AND time <= 44000 AND time % 10 != 0", - "COUNT(root.sg1.d1.s5),", + "SELECT COUNT(s5) FROM root.db1.d1 WHERE time >= 40010 AND time <= 44000 AND time % 10 != 0", + "COUNT(root.db1.d1.s5),", Collections.singleton("3591,")); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/triple/IoTDBPipeForwardIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/triple/IoTDBPipeForwardIT.java index 25019a705f6dd..ad639c4101622 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/triple/IoTDBPipeForwardIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/triple/IoTDBPipeForwardIT.java @@ -104,14 +104,14 @@ public void testForwardingPipeRequests() throws Exception { TestUtils.executeNonQueries( env1, Arrays.asList( - "create database root.sg", - "create timeseries root.sg.wf01.GPS.status0 with datatype=BOOLEAN,encoding=PLAIN", - "insert into root.sg.wf01.GPS (time, status0) values (0, 1)"), + "create database root.db", + "create timeseries root.db.wf01.GPS.status0 with datatype=BOOLEAN,encoding=PLAIN", + "insert into root.db.wf01.GPS (time, status0) values (0, 1)"), null); TestUtils.assertDataEventuallyOnEnv( env3, - "select status0 from root.sg.**", - "Time,root.sg.wf01.GPS.status0,", + "select status0 from root.db.**", + "Time,root.db.wf01.GPS.status0,", Collections.singleton("0,true,")); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBCaseWhenThenTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBCaseWhenThenTableIT.java index cda57e726ea9d..a1d18062153e6 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBCaseWhenThenTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBCaseWhenThenTableIT.java @@ -435,7 +435,7 @@ public void testKind2UseOtherOperation() { @Test @Ignore public void testKind1Wildcard() { - String sql = "select case when *=* then * else * end from root.sg.d2"; + String sql = "select case when *=* then * else * end from root.db.d2"; String[] expectedHeaders = new String[16]; for (int i = 0; i < expectedHeaders.length; i++) { expectedHeaders[i] = "_col" + i; @@ -501,10 +501,10 @@ public void testKind1AlignedByDevice() { tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE); // from same device - sql = "select case when s3<=11 then s3 else s4 end from table1, root.sg.d2 align by device"; + sql = "select case when s3<=11 then s3 else s4 end from table1, root.db.d2 align by device"; retArray = new String[] { - "root.sg.d2,0.0,", "root.sg.d2,11.0,", "root.sg.d2,66.0,", "root.sg.d2,77.0,", + "root.db.d2,0.0,", "root.db.d2,11.0,", "root.db.d2,66.0,", "root.db.d2,77.0,", }; tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE); @@ -521,10 +521,10 @@ public void testKind1AlignedByDevice() { "table1,11.0,null,", "table1,44.0,null,", "table1,66.0,null,", - "root.sg.d2,null,0.0,", - "root.sg.d2,null,11.0,", - "root.sg.d2,null,66.0,", - "root.sg.d2,null,77.0,", + "root.db.d2,null,0.0,", + "root.db.d2,null,11.0,", + "root.db.d2,null,66.0,", + "root.db.d2,null,77.0,", }; tableResultSetEqualTest(sql, new String[] {"_col0", "_col1"}, retArray, DATABASE); } @@ -538,7 +538,7 @@ public void testKind2AlignedByDevice() { tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE); // from same device - sql = "select case s3 when 11 then s3 else s4 end from table1, root.sg.d2 align by device"; + sql = "select case s3 when 11 then s3 else s4 end from table1, root.db.d2 align by device"; retArray = new String[] { "table2,44.0,", "table2,11.0,", "table2,66.0,", "table2,77.0,", @@ -550,17 +550,17 @@ public void testKind2AlignedByDevice() { "select " + "case s1 when 11 then s1 else s1*2 end, " + "case s3 when 11 then s3 else s4 end " - + "from table1, root.sg.d2 align by device"; + + "from table1, root.db.d2 align by device"; retArray = new String[] { "0,table1,0.0,null,", "1000000,table1,11.0,null,", "20000000,table1,44.0,null,", "210000000,table1,66.0,null,", - "0,root.sg.d2,null,44.0,", - "1000000,root.sg.d2,null,11.0,", - "20000000,root.sg.d2,null,66.0,", - "210000000,root.sg.d2,null,77.0,", + "0,root.db.d2,null,44.0,", + "1000000,root.db.d2,null,11.0,", + "20000000,root.db.d2,null,66.0,", + "210000000,root.db.d2,null,77.0,", }; resultSetEqualTest(sql, expectedHeader, retArray); } @@ -610,7 +610,7 @@ public void testKind2MultipleTimeseries() { "select " + "case s2%2 when 1 then s2 else s2/2 end, " + "case s3 when 11 then s3 else s4 end " - + "from table1, root.sg.d2 limit 5 offset 98"; + + "from table1, root.db.d2 limit 5 offset 98"; retArray = new String[] { "49.0,null,", "99.0,null,", "null,11.0,", "null,66.0,", "null,77.0,", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertAlignedValuesTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertAlignedValuesTableIT.java index 5740e8d42577c..a1f170ec24b20 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertAlignedValuesTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertAlignedValuesTableIT.java @@ -244,12 +244,12 @@ public void testInsertAlignedValuesWithSameTimestamp() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); - statement.addBatch("create table sg3 (tag1 string tag, s2 double field, s1 double field)"); - statement.addBatch("insert into sg3(tag1,time,s2) values('d1',1,2)"); - statement.addBatch("insert into sg3(tag1,time,s1) values('d1',1,2)"); + statement.addBatch("create table db3 (tag1 string tag, s2 double field, s1 double field)"); + statement.addBatch("insert into db3(tag1,time,s2) values('d1',1,2)"); + statement.addBatch("insert into db3(tag1,time,s1) values('d1',1,2)"); statement.executeBatch(); - try (ResultSet resultSet = statement.executeQuery("select time, s1, s2 from sg3")) { + try (ResultSet resultSet = statement.executeQuery("select time, s1, s2 from db3")) { assertTrue(resultSet.next()); assertEquals(1, resultSet.getLong(1)); @@ -260,7 +260,7 @@ public void testInsertAlignedValuesWithSameTimestamp() throws SQLException { } statement.execute("flush"); - try (ResultSet resultSet = statement.executeQuery("select time, s1, s2 from sg3")) { + try (ResultSet resultSet = statement.executeQuery("select time, s1, s2 from db3")) { assertTrue(resultSet.next()); assertEquals(1, resultSet.getLong(1)); @@ -337,9 +337,9 @@ public void testInsertMultiRows() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); - statement.execute("create table sg8 (tag1 string tag, s1 int32 field, s2 int32 field)"); + statement.execute("create table db8 (tag1 string tag, s1 int32 field, s2 int32 field)"); statement.execute( - "insert into sg8(tag1, time, s1, s2) values('d1', 10, 2, 2), ('d1', 11, 3, '3'), ('d1', 12,12.11,false)"); + "insert into db8(tag1, time, s1, s2) values('d1', 10, 2, 2), ('d1', 11, 3, '3'), ('d1', 12,12.11,false)"); fail(); } catch (SQLException e) { assertTrue(e.getMessage(), e.getMessage().contains("data type is not consistent")); @@ -351,9 +351,9 @@ public void testInsertLargeNumber() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); - statement.execute("create table sg9 (tag1 string tag, s98 int64 field, s99 int64 field)"); + statement.execute("create table db9 (tag1 string tag, s98 int64 field, s99 int64 field)"); statement.execute( - "insert into sg9(tag1, time, s98, s99) values('d1', 10, 2, 271840880000000000000000)"); + "insert into db9(tag1, time, s98, s99) values('d1', 10, 2, 271840880000000000000000)"); fail("Exception expected"); } catch (SQLException e) { assertEquals( @@ -440,13 +440,13 @@ public void testInsertAlignedWithEmptyPage2() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); - statement.execute("create table sg11 (tag1 string tag, s1 string field, s2 string field)"); + statement.execute("create table db11 (tag1 string tag, s1 string field, s2 string field)"); - statement.execute("insert into sg11(tag1, time, s1, s2) values('d1', 1,'aa','bb')"); - statement.execute("insert into sg11(tag1, time, s1, s2) values('d1', 1,'aa','bb')"); - statement.execute("insert into sg11(tag1, time, s1, s2) values('d2', 1,'aa','bb')"); + statement.execute("insert into db11(tag1, time, s1, s2) values('d1', 1,'aa','bb')"); + statement.execute("insert into db11(tag1, time, s1, s2) values('d1', 1,'aa','bb')"); + statement.execute("insert into db11(tag1, time, s1, s2) values('d2', 1,'aa','bb')"); statement.execute("flush"); - statement.execute("insert into sg11(tag1, time, s1, s2) values('d1', 1,'aa','bb')"); + statement.execute("insert into db11(tag1, time, s1, s2) values('d1', 1,'aa','bb')"); } } @@ -456,20 +456,20 @@ public void testInsertComplexAlignedValues() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); - statement.addBatch("create table sg12 (tag1 string tag, s1 int32 field, s2 int32 field)"); - statement.addBatch("insert into sg12(tag1, time, s1) values('tag1', 3,1)"); - statement.addBatch("insert into sg12(tag1, time, s1) values('tag1', 3,1)"); - statement.addBatch("insert into sg12(tag1, time, s1) values('tag1', 1,1)"); - statement.addBatch("insert into sg12(tag1, time, s1) values('tag1', 2,1)"); - statement.addBatch("insert into sg12(tag1, time, s2) values('tag1', 2,2)"); - statement.addBatch("insert into sg12(tag1, time, s2) values('tag1', 1,2)"); - statement.addBatch("insert into sg12(tag1, time, s2) values('tag1', 3,2)"); - statement.addBatch("insert into sg12(tag1, time, s3) values('tag1', 1,3)"); - statement.addBatch("insert into sg12(tag1, time, s3) values('tag1', 3,3)"); + statement.addBatch("create table db12 (tag1 string tag, s1 int32 field, s2 int32 field)"); + statement.addBatch("insert into db12(tag1, time, s1) values('tag1', 3,1)"); + statement.addBatch("insert into db12(tag1, time, s1) values('tag1', 3,1)"); + statement.addBatch("insert into db12(tag1, time, s1) values('tag1', 1,1)"); + statement.addBatch("insert into db12(tag1, time, s1) values('tag1', 2,1)"); + statement.addBatch("insert into db12(tag1, time, s2) values('tag1', 2,2)"); + statement.addBatch("insert into db12(tag1, time, s2) values('tag1', 1,2)"); + statement.addBatch("insert into db12(tag1, time, s2) values('tag1', 3,2)"); + statement.addBatch("insert into db12(tag1, time, s3) values('tag1', 1,3)"); + statement.addBatch("insert into db12(tag1, time, s3) values('tag1', 3,3)"); statement.executeBatch(); try (ResultSet resultSet = - statement.executeQuery("select count(s1), count(s2), count(s3) from sg12")) { + statement.executeQuery("select count(s1), count(s2), count(s3) from db12")) { assertTrue(resultSet.next()); assertEquals(3, resultSet.getInt(1)); @@ -481,7 +481,7 @@ public void testInsertComplexAlignedValues() throws SQLException { statement.execute("flush"); try (ResultSet resultSet = - statement.executeQuery("select count(s1), count(s2), count(s3) from sg12")) { + statement.executeQuery("select count(s1), count(s2), count(s3) from db12")) { assertTrue(resultSet.next()); assertEquals(3, resultSet.getInt(1)); @@ -568,15 +568,15 @@ public void testExtendTextColumn() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); - statement.execute("create table sg14 (tag1 string tag, s1 string field, s2 string field)"); - statement.execute("insert into sg14(tag1,time,s1,s2) values('d1',1,'test','test')"); - statement.execute("insert into sg14(tag1,time,s1,s2) values('d1',2,'test','test')"); - statement.execute("insert into sg14(tag1,time,s1,s2) values('d1',3,'test','test')"); - statement.execute("insert into sg14(tag1,time,s1,s2) values('d1',4,'test','test')"); - statement.execute("insert into sg14(tag1,time,s1,s3) values('d1',5,'test','test')"); - statement.execute("insert into sg14(tag1,time,s1,s2) values('d1',6,'test','test')"); + statement.execute("create table db14 (tag1 string tag, s1 string field, s2 string field)"); + statement.execute("insert into db14(tag1,time,s1,s2) values('d1',1,'test','test')"); + statement.execute("insert into db14(tag1,time,s1,s2) values('d1',2,'test','test')"); + statement.execute("insert into db14(tag1,time,s1,s2) values('d1',3,'test','test')"); + statement.execute("insert into db14(tag1,time,s1,s2) values('d1',4,'test','test')"); + statement.execute("insert into db14(tag1,time,s1,s3) values('d1',5,'test','test')"); + statement.execute("insert into db14(tag1,time,s1,s2) values('d1',6,'test','test')"); statement.execute("flush"); - statement.execute("insert into sg14(tag1,time,s1,s3) values('d1',7,'test','test')"); + statement.execute("insert into db14(tag1,time,s1,s3) values('d1',7,'test','test')"); fail(); } catch (SQLException ignored) { } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertTableIT.java index d2666b98ce94c..b36730f3ea01b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertTableIT.java @@ -93,9 +93,9 @@ public static void setUp() throws Exception { statement.execute("create database if not exists test"); statement.execute("use test"); statement.execute( - "CREATE TABLE sg10(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"); + "CREATE TABLE db10(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"); statement.execute( - "CREATE TABLE sg11(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"); + "CREATE TABLE db11(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"); } } @@ -109,11 +109,11 @@ public void testInsertMultiPartition() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute("create table sg1 (tag1 string tag, s1 int32 field)"); - statement.execute("insert into sg1(tag1,time,s1) values('d1',1,2)"); + statement.execute("create table db1 (tag1 string tag, s1 int32 field)"); + statement.execute("insert into db1(tag1,time,s1) values('d1',1,2)"); statement.execute("flush"); - statement.execute("insert into sg1(tag1,time,s1) values('d1',2,2)"); - statement.execute("insert into sg1(tag1,time,s1) values('d1',604800001,2)"); + statement.execute("insert into db1(tag1,time,s1) values('d1',2,2)"); + statement.execute("insert into db1(tag1,time,s1) values('d1',604800001,2)"); statement.execute("flush"); } catch (Exception e) { fail(e.getMessage()); @@ -126,11 +126,11 @@ public void testShowRegion() { EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); final Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute("create table sg2 (tag1 string tag, s1 int32 field)"); - statement.execute("insert into sg2(tag1,time,s1) values('d1',1,2)"); + statement.execute("create table db2 (tag1 string tag, s1 int32 field)"); + statement.execute("insert into db2(tag1,time,s1) values('d1',1,2)"); statement.execute("flush"); - statement.execute("insert into sg2(tag1,time,s1) values('d1',2,2)"); - statement.execute("insert into sg2(tag1,time,s1) values('d1',604800001,2)"); + statement.execute("insert into db2(tag1,time,s1) values('d1',2,2)"); + statement.execute("insert into db2(tag1,time,s1) values('d1',604800001,2)"); statement.execute("flush"); // Test show regions in table model @@ -210,8 +210,8 @@ public void testPartialInsertionAllFailed() throws SQLException { Statement statement = connection.createStatement()) { try { statement.execute("USE \"test\""); - statement.execute("create table sg4 (tag1 string tag, s0 int32 field)"); - statement.execute("INSERT INTO sg4(tag1, timestamp, s0) VALUES ('tag', 1, 1)"); + statement.execute("create table db4 (tag1 string tag, s0 int32 field)"); + statement.execute("INSERT INTO db4(tag1, timestamp, s0) VALUES ('tag', 1, 1)"); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Unknown column category")); @@ -225,7 +225,7 @@ public void testPartialInsertTablet() { session.executeNonQueryStatement("use \"test\""); session.executeNonQueryStatement("SET CONFIGURATION enable_auto_create_schema='false'"); session.executeNonQueryStatement( - "create table sg6 (tag1 string tag, s1 int64 field, s2 int64 field)"); + "create table db6 (tag1 string tag, s1 int64 field, s2 int64 field)"); List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); @@ -278,7 +278,7 @@ public void testPartialInsertTablet() { } finally { session.executeNonQueryStatement("SET CONFIGURATION enable_auto_create_schema='false'"); } - try (SessionDataSet dataSet = session.executeQueryStatement("SELECT * FROM sg6")) { + try (SessionDataSet dataSet = session.executeQueryStatement("SELECT * FROM db6")) { assertEquals(dataSet.getColumnNames().size(), 4); assertEquals(dataSet.getColumnNames().get(0), "time"); assertEquals(dataSet.getColumnNames().get(1), "tag1"); @@ -311,12 +311,12 @@ public void testInsertNull() { Statement statement = connection.createStatement()) { statement.execute("use \"test\""); statement.execute( - "CREATE TABLE sg7 (tag1 string tag, s1 boolean field, s2 float field, s3 int32 field)"); - statement.execute("insert into sg7(tag1,time,s1,s2,s3) values('d2',1,null,1.0,1)"); - statement.execute("insert into sg7(tag1,time,s1,s2,s3) values('d2',2,true,null,2)"); - statement.execute("insert into sg7(tag1,time,s1,s2,s3) values('d2',3,true,3.0,null)"); + "CREATE TABLE db7 (tag1 string tag, s1 boolean field, s2 float field, s3 int32 field)"); + statement.execute("insert into db7(tag1,time,s1,s2,s3) values('d2',1,null,1.0,1)"); + statement.execute("insert into db7(tag1,time,s1,s2,s3) values('d2',2,true,null,2)"); + statement.execute("insert into db7(tag1,time,s1,s2,s3) values('d2',3,true,3.0,null)"); - try (ResultSet resultSet = statement.executeQuery("select * from sg7")) { + try (ResultSet resultSet = statement.executeQuery("select * from db7")) { assertNotNull(resultSet); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = @@ -358,26 +358,26 @@ public void testInsertNaN() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute("CREATE TABLE sg8 (tag1 string tag, s1 float field, s2 double field)"); + statement.execute("CREATE TABLE db8 (tag1 string tag, s1 float field, s2 double field)"); // NaN should be a string literal, i.e., 'NaN', not NaN or "NaN" try { - statement.execute("insert into sg8(tag1,time,s1,s2) values('d2',1,NaN,NaN)"); + statement.execute("insert into db8(tag1,time,s1,s2) values('d2',1,NaN,NaN)"); fail("expected exception"); } catch (SQLException e) { assertEquals( "701: Cannot insert identifier NaN, please use string literal", e.getMessage()); } try { - statement.execute("insert into sg8(tag1,time,s1,s2) values('d2',1,\"NaN\",\"NaN\")"); + statement.execute("insert into db8(tag1,time,s1,s2) values('d2',1,\"NaN\",\"NaN\")"); fail("expected exception"); } catch (SQLException e) { assertEquals( "701: Cannot insert identifier \"NaN\", please use string literal", e.getMessage()); } - statement.execute("insert into sg8(tag1,time,s1,s2) values('d2',1,'NaN','NaN')"); + statement.execute("insert into db8(tag1,time,s1,s2) values('d2',1,'NaN','NaN')"); - try (ResultSet resultSet = statement.executeQuery("select * from sg8")) { + try (ResultSet resultSet = statement.executeQuery("select * from db8")) { assertNotNull(resultSet); int cnt = 0; while (resultSet.next()) { @@ -401,16 +401,16 @@ public void testInsertWithoutTime() { Statement statement = connection.createStatement()) { statement.execute("USE \"test\""); statement.execute( - "CREATE TABLE sg9(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"); - statement.execute("insert into sg9(tag1, s1, s2, s3) values ('d1',1, 1, '1')"); + "CREATE TABLE db9(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"); + statement.execute("insert into db9(tag1, s1, s2, s3) values ('d1',1, 1, '1')"); Thread.sleep(1); - statement.execute("insert into sg9(tag1, s2, s1, s3) values ('d1',2, 2, '2')"); + statement.execute("insert into db9(tag1, s2, s1, s3) values ('d1',2, 2, '2')"); Thread.sleep(1); - statement.execute("insert into sg9(tag1, s3, s2, s1) values ('d1','3', 3, 3)"); + statement.execute("insert into db9(tag1, s3, s2, s1) values ('d1','3', 3, 3)"); Thread.sleep(1); - statement.execute("insert into sg9(tag1, s1) values ('d1',1)"); - statement.execute("insert into sg9(tag1, s2) values ('d1',2)"); - statement.execute("insert into sg9(tag1, s3) values ('d1','3')"); + statement.execute("insert into db9(tag1, s1) values ('d1',1)"); + statement.execute("insert into db9(tag1, s2) values ('d1',2)"); + statement.execute("insert into db9(tag1, s3) values ('d1','3')"); } catch (SQLException | InterruptedException e) { e.printStackTrace(); fail(e.getMessage()); @@ -419,17 +419,17 @@ public void testInsertWithoutTime() { String[] expectedHeader = new String[] {"_col0", "_col1", "_col2"}; String[] retArray = new String[] {"4,4,4,"}; tableResultSetEqualTest( - "select count(s1), count(s2), count(s3) from sg9", expectedHeader, retArray, "test"); + "select count(s1), count(s2), count(s3) from db9", expectedHeader, retArray, "test"); } @Test public void testInsertMultiRow() { assertTableNonQueryTestFail( - "insert into sg10(s3) values ('d1', '1'), ('d1', '2')", + "insert into db10(s3) values ('d1', '1'), ('d1', '2')", "need timestamps when insert multi rows", "test"); assertTableNonQueryTestFail( - "insert into sg10(tag1, s1, s2) values ('d1', 1, 1), ('d1', 2, 2)", + "insert into db10(tag1, s1, s2) values ('d1', 1, 1), ('d1', 2, 2)", "need timestamps when insert multi rows", "test"); } @@ -437,11 +437,11 @@ public void testInsertMultiRow() { @Test public void testInsertWithMultiTimesColumns() { assertTableNonQueryTestFail( - "insert into sg11(tag1, time, time) values ('d1', 1, 1)", + "insert into db11(tag1, time, time) values ('d1', 1, 1)", "One row should only have one time value", "test"); assertTableNonQueryTestFail( - "insert into sg11(tag1, time, s1, time) values ('d1', 1, 1, 1)", + "insert into db11(tag1, time, s1, time) values ('d1', 1, 1, 1)", "One row should only have one time value", "test"); } @@ -556,14 +556,14 @@ public void testInsertMultiRowWithMultiTimePartition() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement st1 = connection.createStatement()) { st1.execute("use \"test\""); - st1.execute("create table sg17 (tag1 string tag, s1 int32 field)"); - st1.execute("insert into sg17(tag1, time, s1) values('d1', 604800010,1)"); + st1.execute("create table db17 (tag1 string tag, s1 int32 field)"); + st1.execute("insert into db17(tag1, time, s1) values('d1', 604800010,1)"); st1.execute("flush"); st1.execute( - "insert into sg17(tag1, time, s1) values('d1', 604799990,1), ('d1', 604800001,1)"); + "insert into db17(tag1, time, s1) values('d1', 604799990,1), ('d1', 604800001,1)"); st1.execute("flush"); - ResultSet rs1 = st1.executeQuery("select time, s1 from sg17"); + ResultSet rs1 = st1.executeQuery("select time, s1 from db17"); assertTrue(rs1.next()); assertEquals(604799990, rs1.getLong("time")); assertTrue(rs1.next()); @@ -580,11 +580,11 @@ public void testInsertAttributes() throws SQLException { Statement st1 = connection.createStatement()) { st1.execute("use \"test\""); st1.execute( - "create table if not exists sg18 (tag1 string tag, s1 string attribute, s2 int32 field)"); - st1.execute("insert into sg18(tag1, s1, s2) values('d1','1', 1)"); - st1.execute("insert into sg18(tag1, s1, s2) values('d2', 2, 2)"); + "create table if not exists db18 (tag1 string tag, s1 string attribute, s2 int32 field)"); + st1.execute("insert into db18(tag1, s1, s2) values('d1','1', 1)"); + st1.execute("insert into db18(tag1, s1, s2) values('d2', 2, 2)"); - ResultSet rs1 = st1.executeQuery("select time, s1, s2 from sg18 order by s1"); + ResultSet rs1 = st1.executeQuery("select time, s1, s2 from db18 order by s1"); assertTrue(rs1.next()); assertEquals("1", rs1.getString("s1")); assertTrue(rs1.next()); @@ -601,18 +601,18 @@ public void testInsertCaseSensitivity() Statement st1 = connection.createStatement()) { st1.execute("use \"test\""); st1.execute( - "create table if not exists sg19 (tag1 string tag, ss1 string attribute, ss2 int32 field)"); + "create table if not exists db19 (tag1 string tag, ss1 string attribute, ss2 int32 field)"); // lower case - st1.execute("insert into sg19(time, tag1, ss1, ss2) values(1, 'd1','1', 1)"); - st1.execute("insert into sg19(time, tag1, ss1, ss2) values(2, 'd2', 2, 2)"); + st1.execute("insert into db19(time, tag1, ss1, ss2) values(1, 'd1','1', 1)"); + st1.execute("insert into db19(time, tag1, ss1, ss2) values(2, 'd2', 2, 2)"); // upper case - st1.execute("insert into sg19(TIME, TAG1, SS1, SS2) values(3, 'd3','3', 3)"); - st1.execute("insert into sg19(TIME, TAG1, SS1, SS2) values(4, 'd4', 4, 4)"); + st1.execute("insert into db19(TIME, TAG1, SS1, SS2) values(3, 'd3','3', 3)"); + st1.execute("insert into db19(TIME, TAG1, SS1, SS2) values(4, 'd4', 4, 4)"); // mixed - st1.execute("insert into sg19(TIme, Tag1, Ss1, Ss2) values(5, 'd5','5', 5)"); - st1.execute("insert into sg19(TIme, Tag1, sS1, sS2) values(6, 'd6', 6, 6)"); + st1.execute("insert into db19(TIme, Tag1, Ss1, Ss2) values(5, 'd5','5', 5)"); + st1.execute("insert into db19(TIme, Tag1, sS1, sS2) values(6, 'd6', 6, 6)"); - ResultSet rs1 = st1.executeQuery("select time, ss1, ss2 from sg19 order by time"); + ResultSet rs1 = st1.executeQuery("select time, ss1, ss2 from db19 order by time"); for (int i = 1; i <= 6; i++) { assertTrue(rs1.next()); assertEquals(i, rs1.getLong("time")); @@ -929,16 +929,16 @@ public void testInsertSingleColumn() throws SQLException, InterruptedException { Statement st1 = connection.createStatement()) { st1.execute("use \"test\""); st1.execute( - "create table if not exists sg21 (tag1 string tag, ss1 string attribute, ss2 int32 field)"); + "create table if not exists db21 (tag1 string tag, ss1 string attribute, ss2 int32 field)"); // only tag try { - st1.execute("insert into sg21(tag1) values('1')"); + st1.execute("insert into db21(tag1) values('1')"); } catch (SQLException e) { assertEquals("507: No Field column present, please check the request", e.getMessage()); } // only time try { - st1.execute("insert into sg21(time) values(1)"); + st1.execute("insert into db21(time) values(1)"); } catch (SQLException e) { assertEquals( "507: No column other than Time present, please check the request", e.getMessage()); @@ -947,25 +947,25 @@ public void testInsertSingleColumn() throws SQLException, InterruptedException { Thread.sleep(10); // only attribute try { - st1.execute("insert into sg21(ss1) values('1')"); + st1.execute("insert into db21(ss1) values('1')"); } catch (SQLException e) { assertEquals("507: No Field column present, please check the request", e.getMessage()); } // sleep a while to avoid the same timestamp between two insertions Thread.sleep(10); // only field - st1.execute("insert into sg21(ss2) values(1)"); + st1.execute("insert into db21(ss2) values(1)"); - ResultSet rs1 = st1.executeQuery("show devices from sg21"); + ResultSet rs1 = st1.executeQuery("show devices from db21"); assertTrue(rs1.next()); - // from "insert into sg21(ss2) values(1)" + // from "insert into db21(ss2) values(1)" assertEquals(null, rs1.getString("tag1")); assertFalse(rs1.next()); - // from "insert into sg21(tag1) values('1')" + // from "insert into db21(tag1) values('1')" assertEquals(null, rs1.getString("tag1")); assertFalse(rs1.next()); - rs1 = st1.executeQuery("select time, ss1, ss2 from sg21 order by time"); + rs1 = st1.executeQuery("select time, ss1, ss2 from db21 order by time"); assertTrue(rs1.next()); rs1.getString("ss1"); assertTrue(rs1.wasNull()); @@ -981,11 +981,11 @@ public void testInsertWithTTL() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute("create table sg22 (tag1 string tag, s1 int64 field)"); - statement.execute("alter table sg22 set properties TTL=1"); + statement.execute("create table db22 (tag1 string tag, s1 int64 field)"); + statement.execute("alter table db22 set properties TTL=1"); statement.execute( String.format( - "insert into sg22(tag1,time,s1) values('d1',%s,2)", + "insert into db22(tag1,time,s1) values('d1',%s,2)", System.currentTimeMillis() - 10000)); fail(); } catch (Exception e) { @@ -999,8 +999,8 @@ public void testInsertTabletWithTTL() long ttl = 1; try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("use \"test\""); - session.executeNonQueryStatement("create table sg23 (tag1 string tag, s1 int64 field)"); - session.executeNonQueryStatement("alter table sg23 set properties TTL=" + ttl); + session.executeNonQueryStatement("create table db23 (tag1 string tag, s1 int64 field)"); + session.executeNonQueryStatement("alter table db23 set properties TTL=" + ttl); List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); @@ -1012,7 +1012,7 @@ public void testInsertTabletWithTTL() long timestamp = 0; Tablet tablet = new Tablet( - "sg23", + "db23", IMeasurementSchema.getMeasurementNameList(schemaList), IMeasurementSchema.getDataTypeList(schemaList), columnTypes, @@ -1051,7 +1051,7 @@ public void testInsertTabletWithTTL() // part of data is indeed inserted long timeLowerBound = System.currentTimeMillis() - ttl; - SessionDataSet dataSet = session.executeQueryStatement("select time, s1 from sg23"); + SessionDataSet dataSet = session.executeQueryStatement("select time, s1 from db23"); int count = 0; while (dataSet.hasNext()) { RowRecord record = dataSet.next(); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterTableIT.java index 7ecc9673b2344..892b1193475c7 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterTableIT.java @@ -78,7 +78,7 @@ private static void createTimeSeries() { statement.execute( "CREATE TABLE testTimeSeries(device STRING TAG, s1 BOOLEAN FIELD, s2 BOOLEAN FIELD)"); statement.execute("CREATE TABLE testUDTF(device STRING TAG, s1 TEXT FIELD, s2 DOUBLE FIELD)"); - statement.execute("CREATE TABLE sg1(device STRING TAG, s1 DOUBLE FIELD, s2 TEXT FIELD)"); + statement.execute("CREATE TABLE db1(device STRING TAG, s1 DOUBLE FIELD, s2 TEXT FIELD)"); } catch (SQLException throwable) { fail(throwable.getMessage()); @@ -112,8 +112,8 @@ private static void generateData() { break; } } - statement.execute(" insert into sg1(time, device, s1, s2) values (1,'d1',1,'1')"); - statement.execute(" insert into sg1(time, device, s1, s2) values (2,'d1',2,'2')"); + statement.execute(" insert into db1(time, device, s1, s2) values (1,'d1',1,'1')"); + statement.execute(" insert into db1(time, device, s1, s2) values (2,'d1',2,'2')"); statement.execute(" insert into testUDTF(time, device, s1, s2) values (1,'d1','ss',0)"); statement.execute(" insert into testUDTF(time, device, s1, s2) values (2,'d1','d',3)"); } catch (SQLException throwable) { @@ -182,7 +182,7 @@ public void testSameConstantWithDifferentType() { Statement statement = connection.createStatement()) { statement.execute("USE " + DATABASE_NAME); ResultSet resultSet = - statement.executeQuery("select s2 from sg1 where s1 = 1 and s2 >= '1' and s2 <= '2'"); + statement.executeQuery("select s2 from db1 where s1 = 1 and s2 >= '1' and s2 <= '2'"); int count = 0; while (resultSet.next()) { ++count; @@ -196,15 +196,15 @@ public void testSameConstantWithDifferentType() { @Test public void testMismatchedDataTypes() { tableAssertTestFail( - "select s1 from sg1 where s1", + "select s1 from db1 where s1", "701: WHERE clause must evaluate to a boolean: actual type DOUBLE", DATABASE_NAME); // TODO After Aggregation supported /*assertTestFail( - "select count(s1) from root.sg1.d1 group by ([0, 40), 5ms) having count(s1) + 1;", + "select count(s1) from root.db1.d1 group by ([0, 40), 5ms) having count(s1) + 1;", "The output type of the expression in HAVING clause should be BOOLEAN, actual data type: DOUBLE."); assertTestFail( - "select count(s1) from root.sg1.d1 group by ([0, 40), 5ms) having count(s1) + 1 align by device;", + "select count(s1) from root.db1.d1 group by ([0, 40), 5ms) having count(s1) + 1 align by device;", "The output type of the expression in HAVING clause should be BOOLEAN, actual data type: DOUBLE.");*/ } @@ -239,22 +239,22 @@ public void testFilterWithUDTF() { @Test public void testCompareWithNull() { tableResultSetEqualTest( - "select s1 from sg1 where s1 != null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); + "select s1 from db1 where s1 != null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); tableResultSetEqualTest( - "select s1 from sg1 where s1 <> null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); + "select s1 from db1 where s1 <> null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); tableResultSetEqualTest( - "select s1 from sg1 where s1 = null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); + "select s1 from db1 where s1 = null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); } @Test public void testCalculateWithNull() { tableResultSetEqualTest( - "select s1 + null from sg1", + "select s1 + null from db1", new String[] {"_col0"}, new String[] {"null,", "null,"}, DATABASE_NAME); tableResultSetEqualTest( - "select s1 - null from sg1", + "select s1 - null from db1", new String[] {"_col0"}, new String[] {"null,", "null,"}, DATABASE_NAME); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBSimpleQueryTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBSimpleQueryTableIT.java index 57a187950e27b..f9fd74a18f03a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBSimpleQueryTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBSimpleQueryTableIT.java @@ -356,12 +356,12 @@ public void testDescribeWithLimitOffset() throws SQLException { public void testShowDevicesWithLimitOffset() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d1(timestamp, s2) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d2(timestamp, s3) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d3(timestamp, s4) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d1(timestamp, s2) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d2(timestamp, s3) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d3(timestamp, s4) VALUES (5, 5)"); - List exps = Arrays.asList("root.sg1.d1,false", "root.sg1.d2,false"); + List exps = Arrays.asList("root.db1.d1,false", "root.db1.d2,false"); int count = 0; try (ResultSet resultSet = statement.executeQuery("show devices limit 2 offset 1")) { while (resultSet.next()) { @@ -380,12 +380,12 @@ public void testShowDevicesWithLimit() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { - List exps = Arrays.asList("root.sg1.d0,false", "root.sg1.d1,false"); + List exps = Arrays.asList("root.db1.d0,false", "root.db1.d1,false"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d1(timestamp, s2) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d2(timestamp, s3) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d3(timestamp, s4) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d1(timestamp, s2) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d2(timestamp, s3) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d3(timestamp, s4) VALUES (5, 5)"); int count = 0; try (ResultSet resultSet = statement.executeQuery("show devices limit 2")) { diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedSeriesQueryTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedSeriesQueryTableIT.java index 8ddb2a6223243..ed2b382249c70 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedSeriesQueryTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedSeriesQueryTableIT.java @@ -913,7 +913,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { try (Connection connection = EnvFactory.getEnv().getTableConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2138,7 +2138,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.* align by device")) { + statement.executeQuery("select count(*) from root.db1.* align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2617,7 +2617,7 @@ public void groupByWithNonAlignedTimeseriesAlignByDeviceTest() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.* " + "select count(s1), sum(s2), avg(s1) from root.db1.* " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -2902,7 +2902,7 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -2928,7 +2928,7 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = @@ -3158,7 +3158,7 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -3189,7 +3189,7 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = @@ -3393,7 +3393,7 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -3415,7 +3415,7 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 " + + "from root.db1 where time > 5 and time < 38 " + "GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/orderBy/IoTDBOrderByTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/orderBy/IoTDBOrderByTableIT.java index 9f4f78011020f..138c07d3b75e7 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/orderBy/IoTDBOrderByTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/orderBy/IoTDBOrderByTableIT.java @@ -446,7 +446,7 @@ public void orderByTest19() { @Ignore @Test public void orderByInAggregationTest() { - String sql = "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc"; + String sql = "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc"; double[][] ans = new double[][] {{15.0}, {13.0}, {13.0}, {11.0}, {6.4}, {4.6}}; long[] times = new long[] {51536000000L, 41536000000L, 41536900000L, 31536100000L, 31536000000L, 0L}; @@ -473,7 +473,7 @@ public void orderByInAggregationTest() { @Test public void orderByInAggregationTest2() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12}, @@ -508,7 +508,7 @@ public void orderByInAggregationTest2() { @Test public void orderByInAggregationTest3() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; double[] ans = new double[] {15.0, 13.0, 13.0, 11.0, 6.4, 4.6}; long[] times = new long[] {51536000000L, 41536900000L, 41536000000L, 31536100000L, 31536000000L, 0L}; @@ -535,7 +535,7 @@ public void orderByInAggregationTest3() { @Test public void orderByInAggregationTest4() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -564,7 +564,7 @@ public void orderByInAggregationTest4() { @Test public void orderByInAggregationTest5() { String sql = - "select min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483646L, 2147483650L, 2147468648L, 2146483648L, 2107483648L, 3147483648L}; long[] times = @@ -593,7 +593,7 @@ public void orderByInAggregationTest5() { @Test public void orderByInAggregationTest6() { String sql = - "select min_value(num)+min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(num)+min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483647L, 2147483654L, 2147468659L, 2146483660L, 2107483661L, 3147483663L}; long[] times = @@ -622,7 +622,7 @@ public void orderByInAggregationTest6() { @Test public void orderByInAggregationTest7() { String sql = - "select avg(num)+min_value(floatNum) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num)+min_value(floatNum) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12, 54.12}, @@ -657,7 +657,7 @@ public void orderByInAggregationTest7() { @Test public void orderByInAggregationTest8() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(floatNum)+avg(num)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(floatNum)+avg(num)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -1053,18 +1053,18 @@ public void orderByInAggregationAlignByDeviceTest() { }; String[] device = new String[] { - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d", - "root.sg.d2", - "root.sg.d2", - "root.sg.d", - "root.sg.d2" + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d", + "root.db.d2", + "root.db.d2", + "root.db.d", + "root.db.d2" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -1097,8 +1097,8 @@ public void orderByInAggregationAlignByDeviceTest2() { } private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { - String device = "root.sg.d"; - if (!deviceAsc) device = "root.sg.d2"; + String device = "root.db.d"; + if (!deviceAsc) device = "root.db.d2"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { @@ -1108,8 +1108,8 @@ private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { double actualVal = resultSet.getDouble(2); assertEquals(deviceName, device); assertEquals(Double.parseDouble(value.toString()), actualVal, 1); - if (device.equals("root.sg.d")) device = "root.sg.d2"; - else device = "root.sg.d"; + if (device.equals("root.db.d")) device = "root.db.d2"; + else device = "root.db.d"; i++; } assertEquals(i, 2); @@ -1286,7 +1286,7 @@ private void orderByUDFTest(String sql, int[] ans) { @Test public void orderByUDFTest1() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; int[] ans = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 11, 12, 14}; orderByUDFTest(sql, ans); } @@ -1295,7 +1295,7 @@ public void orderByUDFTest1() { @Test public void orderByUDFTest2() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; int[] ans = {12, 14, 13, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; orderByUDFTest(sql, ans); } @@ -1313,7 +1313,7 @@ private void errorTest(String sql, String error) { @Test public void errorTest1() { errorTest( - "select num from root.sg.d order by avg(bigNum)", + "select num from root.db.d order by avg(bigNum)", "701: Raw data and aggregation hybrid query is not supported."); } @@ -1321,7 +1321,7 @@ public void errorTest1() { @Test public void errorTest2() { errorTest( - "select avg(num) from root.sg.d order by bigNum", + "select avg(num) from root.db.d order by bigNum", "701: Raw data and aggregation hybrid query is not supported."); } @@ -1344,8 +1344,8 @@ public void errorTest4() { @Test public void errorTest7() { errorTest( - "select last bigNum,floatNum from root.** order by root.sg.d.bigNum", - "701: root.sg.d.bigNum in order by clause doesn't exist in the result of last query."); + "select last bigNum,floatNum from root.** order by root.db.d.bigNum", + "701: root.db.d.bigNum in order by clause doesn't exist in the result of last query."); } // last query @@ -1381,7 +1381,7 @@ public void lastQueryOrderBy() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d.num", "root.sg.d2.num", "root.sg.d.bigNum", "root.sg.d2.bigNum"}, + {"root.db.d.num", "root.db.d2.num", "root.db.d.bigNum", "root.db.d2.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1395,7 +1395,7 @@ public void lastQueryOrderBy2() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1409,7 +1409,7 @@ public void lastQueryOrderBy3() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1423,7 +1423,7 @@ public void lastQueryOrderBy4() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1437,7 +1437,7 @@ public void lastQueryOrderBy5() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBInTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBInTableIT.java index c8ffc4c0f47cd..f9d954c27596e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBInTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBInTableIT.java @@ -58,19 +58,19 @@ public class IoTDBInTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE sg(device1 STRING TAG, device2 STRING TAG, qrcode TEXT FIELD, date_v DATE FIELD, blob_v BLOB FIELD, timestamp_v TIMESTAMP FIELD)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465600000,'d1','s1','qrcode001', '2024-08-01', X'abc0',1509465600000)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465660000,'d1','s1','qrcode002', '2024-08-02', X'abc1',1509465660000)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465720000,'d1','s1','qrcode003', '2024-08-03', X'abc2',1509465720000)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465780000,'d1','s1','qrcode004', '2024-08-04', X'abc3',1509465780000)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465720000,'d1','s2','qrcode002', '2024-08-05', X'abc4',1509465720000)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465780000,'d1','s2','qrcode003', '2024-08-06', X'abc5',1509465780000)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465840000,'d1','s2','qrcode004', '2024-08-07', X'abc6',1509465840000)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465900000,'d1','s2','qrcode005', '2024-08-08', X'abc7',1509465900000)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465780000,'d2','s1','qrcode002', '2024-08-09', X'abc8',1509465780000)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465840000,'d2','s1','qrcode003', '2024-08-10', X'abc9',1509465840000)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465900000,'d2','s1','qrcode004', '2024-08-11', X'abca',1509465900000)", - "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465960000,'d2','s1','qrcode005', '2024-08-12', X'abcb',1509465960000)", + "CREATE TABLE db(device1 STRING TAG, device2 STRING TAG, qrcode TEXT FIELD, date_v DATE FIELD, blob_v BLOB FIELD, timestamp_v TIMESTAMP FIELD)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465600000,'d1','s1','qrcode001', '2024-08-01', X'abc0',1509465600000)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465660000,'d1','s1','qrcode002', '2024-08-02', X'abc1',1509465660000)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465720000,'d1','s1','qrcode003', '2024-08-03', X'abc2',1509465720000)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465780000,'d1','s1','qrcode004', '2024-08-04', X'abc3',1509465780000)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465720000,'d1','s2','qrcode002', '2024-08-05', X'abc4',1509465720000)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465780000,'d1','s2','qrcode003', '2024-08-06', X'abc5',1509465780000)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465840000,'d1','s2','qrcode004', '2024-08-07', X'abc6',1509465840000)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465900000,'d1','s2','qrcode005', '2024-08-08', X'abc7',1509465900000)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465780000,'d2','s1','qrcode002', '2024-08-09', X'abc8',1509465780000)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465840000,'d2','s1','qrcode003', '2024-08-10', X'abc9',1509465840000)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465900000,'d2','s1','qrcode004', '2024-08-11', X'abca',1509465900000)", + "insert into db(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465960000,'d2','s1','qrcode005', '2024-08-12', X'abcb',1509465960000)", "CREATE TABLE table1(device STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 BOOLEAN FIELD)", }; @@ -133,7 +133,7 @@ public void selectWithAlignByDeviceTest() { statement.execute("USE " + DATABASE_NAME); try (ResultSet resultSet = statement.executeQuery( - "select time,device1,device2,qrcode from sg where qrcode in ('d1','s1','qrcode002','qrcode004') order by device1,device2")) { + "select time,device1,device2,qrcode from db where qrcode in ('d1','s1','qrcode002','qrcode004') order by device1,device2")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( @@ -163,7 +163,7 @@ public void selectWithAlignByDeviceTest() { // DATE IN try (ResultSet resultSet = statement.executeQuery( - "select date_v from sg where date_v in (CAST('2024-08-05' AS DATE), CAST('2024-08-12' AS DATE), CAST('2024-08-22' AS DATE)) order by date_v")) { + "select date_v from db where date_v in (CAST('2024-08-05' AS DATE), CAST('2024-08-12' AS DATE), CAST('2024-08-22' AS DATE)) order by date_v")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); checkHeader( resultSetMetaData, @@ -188,7 +188,7 @@ public void selectWithAlignByDeviceTest() { // BLOB IN try (ResultSet resultSet = statement.executeQuery( - "select blob_v from sg where blob_v in (X'abc3', X'abca', X'bbbb') order by blob_v")) { + "select blob_v from db where blob_v in (X'abc3', X'abca', X'bbbb') order by blob_v")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); checkHeader( resultSetMetaData, @@ -218,7 +218,7 @@ public void selectWithAlignByDeviceTest() { @Test public void testTimestampIn() { - // select time,device1,device2,timestamp_v from sg where timestamp_v in (1509465600000) + // select time,device1,device2,timestamp_v from db where timestamp_v in (1509465600000) // 1509465600000,'d1','s1', String[] expectedHeader = new String[] {"time", "device1", "device2", "timestamp_v"}; String[] retArray = @@ -226,36 +226,36 @@ public void testTimestampIn() { "2017-10-31T16:00:00.000Z,d1,s1,2017-10-31T16:00:00.000Z,", }; tableResultSetEqualTest( - "select time,device1,device2,timestamp_v from sg where timestamp_v in (1509465600000)", + "select time,device1,device2,timestamp_v from db where timestamp_v in (1509465600000)", expectedHeader, retArray, DATABASE_NAME); tableResultSetEqualTest( - "select time,device1,device2,timestamp_v from sg where timestamp_v=1509465600000", + "select time,device1,device2,timestamp_v from db where timestamp_v=1509465600000", expectedHeader, retArray, DATABASE_NAME); tableResultSetEqualTest( - "select time,device1,device2,timestamp_v from sg where timestamp_v=2017-11-01T00:00:00.000+08:00", + "select time,device1,device2,timestamp_v from db where timestamp_v=2017-11-01T00:00:00.000+08:00", expectedHeader, retArray, DATABASE_NAME); tableResultSetEqualTest( - "select time,device1,device2,timestamp_v from sg where timestamp_v=CAST('2017-11-01T00:00:00.000+08:00' AS TIMESTAMP)", + "select time,device1,device2,timestamp_v from db where timestamp_v=CAST('2017-11-01T00:00:00.000+08:00' AS TIMESTAMP)", expectedHeader, retArray, DATABASE_NAME); tableResultSetEqualTest( - "select time,device1,device2,timestamp_v from sg where timestamp_v in (1509465600000.0)", + "select time,device1,device2,timestamp_v from db where timestamp_v in (1509465600000.0)", expectedHeader, retArray, DATABASE_NAME); tableResultSetEqualTest( - "select time,device1,device2,timestamp_v from sg where timestamp_v=1509465600000.0", + "select time,device1,device2,timestamp_v from db where timestamp_v=1509465600000.0", expectedHeader, retArray, DATABASE_NAME); @@ -272,7 +272,7 @@ public void testTimestampIn() { "2017-10-31T16:06:00.000Z,d2,s1,2017-10-31T16:06:00.000Z,", }; tableResultSetEqualTest( - "select time,device1,device2,timestamp_v from sg where timestamp_v not in (2017-11-01T00:00:00.000+08:00,1509465660000.0,CAST('2017-11-01T00:02:00.000+08:00' AS TIMESTAMP)) order by device1,device2,time", + "select time,device1,device2,timestamp_v from db where timestamp_v not in (2017-11-01T00:00:00.000+08:00,1509465660000.0,CAST('2017-11-01T00:02:00.000+08:00' AS TIMESTAMP)) order by device1,device2,time", expectedHeader, retArray, DATABASE_NAME); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java index 27d14c0e1fccb..efa79fcc3ac2c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java @@ -42,9 +42,9 @@ public class IoTDBNoSelectExpressionAfterAnalyzedTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE sg(device STRING TAG, s1 INT32 FIELD)", - "insert into sg(time,device,s1) values(1,'d1',1)", - "insert into sg(time,device,s1,s2) values(1,'d1',1,1)" + "CREATE TABLE db(device STRING TAG, s1 INT32 FIELD)", + "insert into db(time,device,s1) values(1,'d1',1)", + "insert into db(time,device,s1,s2) values(1,'d1',1,1)" }; @BeforeClass @@ -63,24 +63,24 @@ public void testAlignByDevice() { String[] expectedHeader = new String[] {TIMESTAMP_STR}; String[] retArray = new String[] {}; tableAssertTestFail( - "select s2 from sg where s1>0 order by device", + "select s2 from db where s1>0 order by device", "616: Column 's2' cannot be resolved", DATABASE_NAME); // TODO After Aggregation supported /*tableResultSetEqualTest( - "select count(s2) from sg where s1>0 order by device", expectedHeader, retArray,DATABASE_NAME);*/ + "select count(s2) from db where s1>0 order by device", expectedHeader, retArray,DATABASE_NAME);*/ // mix test /* expectedHeader = new String[] {DEVICE, count(s1), count(s2)}; - retArray = new String[] {"sg,1,null,", "root.sg.d2,1,1,"}; + retArray = new String[] {"db,1,null,", "root.db.d2,1,1,"}; tableResultSetEqualTest( - "select count(s1), count(s2) from sg where s1>0 order by device", + "select count(s1), count(s2) from db where s1>0 order by device", expectedHeader, retArray,DATABASE_NAME);*/ tableAssertTestFail( - "select s1, s2 from sg where s1>0 order by device", + "select s1, s2 from db where s1>0 order by device", "616: Column 's2' cannot be resolved", DATABASE_NAME); } @@ -88,8 +88,8 @@ public void testAlignByDevice() { @Test public void testAlignByTime() { tableAssertTestFail( - "select s2 from sg where s1>0", "616: Column 's2' cannot be resolved", DATABASE_NAME); + "select s2 from db where s1>0", "616: Column 's2' cannot be resolved", DATABASE_NAME); - /*tableResultSetEqualTest("select count(s2) from sg where s1>0", expectedHeader, retArray,DATABASE_NAME);*/ + /*tableResultSetEqualTest("select count(s2) from db where s1>0", expectedHeader, retArray,DATABASE_NAME);*/ } } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullOperandTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullOperandTableIT.java index eef6773f03f08..11c1cd34e8bc1 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullOperandTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullOperandTableIT.java @@ -43,10 +43,10 @@ public class IoTDBNullOperandTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE sg1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 BOOLEAN FIELD, s4 BOOLEAN FIELD, s5 TEXT FIELD)", - "INSERT INTO sg1(time,device,s1,s3,s4) values(1, 'd1', 1, true, false)", - "INSERT INTO sg1(time,device,s1,s3) values(2, 'd1', 2, true)", - "INSERT INTO sg1(time,device,s1,s4) values(3, 'd1', 3, false)", + "CREATE TABLE db1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 BOOLEAN FIELD, s4 BOOLEAN FIELD, s5 TEXT FIELD)", + "INSERT INTO db1(time,device,s1,s3,s4) values(1, 'd1', 1, true, false)", + "INSERT INTO db1(time,device,s1,s3) values(2, 'd1', 2, true)", + "INSERT INTO db1(time,device,s1,s4) values(3, 'd1', 3, false)", "flush", }; @@ -80,7 +80,7 @@ public void testArithmeticOperations() { "null,null,null,null,null,null,", }; tableResultSetEqualTest( - "select s1+s2, s1-s2, s1*s2, s1/s2, s1%s2, s2%s2 from sg1", + "select s1+s2, s1-s2, s1*s2, s1/s2, s1%s2, s2%s2 from db1", expectedHeader, retArray, DATABASE_NAME); } @@ -102,7 +102,7 @@ public void testCompareOperations() { "null,null,null,null,null,null,", }; tableResultSetEqualTest( - "select s1=s2, s1>s2, s1s2, s10", expectedHeader, retArray, DATABASE_NAME); + "select s1, s3, s4 from db1 where s2>0", expectedHeader, retArray, DATABASE_NAME); tableResultSetEqualTest( - "select s1, s3, s4 from sg1 where s2 is not null", expectedHeader, retArray, DATABASE_NAME); + "select s1, s3, s4 from db1 where s2 is not null", expectedHeader, retArray, DATABASE_NAME); retArray = new String[] { "1,true,false,", "2,true,null,", "3,null,false,", }; tableResultSetEqualTest( - "select s1, s3, s4 from sg1 where s2 is null and s5 is null", + "select s1, s3, s4 from db1 where s2 is null and s5 is null", expectedHeader, retArray, DATABASE_NAME); @@ -182,7 +182,7 @@ public void testWhere() { "s1", "s3", "s4", }; tableResultSetEqualTest( - "select s1, s3, s4 from sg1 where s2 is null and s5 is null order by device", + "select s1, s3, s4 from db1 where s2 is null and s5 is null order by device", expectedHeader, retArray, DATABASE_NAME); @@ -214,7 +214,7 @@ public void testHaving() { retArray = new String[] { - "1,root.test.sg1,1,0,", "2,root.test.sg1,1,0,", "3,root.test.sg1,1,0,", + "1,root.test.db1,1,0,", "2,root.test.db1,1,0,", "3,root.test.db1,1,0,", }; expectedHeader = new String[] { diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryWithComplexValueFilterTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryWithComplexValueFilterTableIT.java index e5f495cdf46c9..a26cb4228b66c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryWithComplexValueFilterTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryWithComplexValueFilterTableIT.java @@ -46,17 +46,17 @@ public class IoTDBQueryWithComplexValueFilterTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE sg1(device STRING TAG, s1 INT32 FIELD, s2 DOUBLE FIELD, s3 STRING FIELD, s4 DATE FIELD, s5 TIMESTAMP FIELD)", - "insert into sg1(time,device,s1,s2,s3,s4,s5) values(0,'d1',0,0,'0','2024-01-01',0)", - "insert into sg1(time,device,s1,s2,s3,s4,s5) values(1,'d1',1,1,'1','2024-01-02',1)", - "insert into sg1(time,device,s1,s2) values(2,'d1',2,2)", - "insert into sg1(time,device,s1,s2) values(3,'d1',3,3)", - "insert into sg1(time,device,s1,s2) values(4,'d1',4,4)", - "insert into sg1(time,device,s1,s2) values(5,'d1',5,5)", - "insert into sg1(time,device,s1,s2) values(6,'d1',6,6)", - "insert into sg1(time,device,s1,s2) values(7,'d1',7,7)", - "insert into sg1(time,device,s1,s2) values(8,'d1',8,8)", - "insert into sg1(time,device,s1,s2) values(9,'d1',9,9)" + "CREATE TABLE db1(device STRING TAG, s1 INT32 FIELD, s2 DOUBLE FIELD, s3 STRING FIELD, s4 DATE FIELD, s5 TIMESTAMP FIELD)", + "insert into db1(time,device,s1,s2,s3,s4,s5) values(0,'d1',0,0,'0','2024-01-01',0)", + "insert into db1(time,device,s1,s2,s3,s4,s5) values(1,'d1',1,1,'1','2024-01-02',1)", + "insert into db1(time,device,s1,s2) values(2,'d1',2,2)", + "insert into db1(time,device,s1,s2) values(3,'d1',3,3)", + "insert into db1(time,device,s1,s2) values(4,'d1',4,4)", + "insert into db1(time,device,s1,s2) values(5,'d1',5,5)", + "insert into db1(time,device,s1,s2) values(6,'d1',6,6)", + "insert into db1(time,device,s1,s2) values(7,'d1',7,7)", + "insert into db1(time,device,s1,s2) values(8,'d1',8,8)", + "insert into db1(time,device,s1,s2) values(9,'d1',9,9)" }; @BeforeClass @@ -77,7 +77,7 @@ public void testRawQuery1() { statement.execute("USE " + DATABASE_NAME); try (ResultSet resultSet = statement.executeQuery( - "select s1 from sg1 where (time > 4 and s1 <= 6) or (s2 > 3 and time <= 5)")) { + "select s1 from db1 where (time > 4 and s1 <= 6) or (s2 > 3 and time <= 5)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -97,7 +97,7 @@ public void testRawQuery2() { statement.execute("USE " + DATABASE_NAME); try (ResultSet resultSet = statement.executeQuery( - "select s1 from sg1 where (time > 4 and s1 <= 6) and (s2 > 3 and time <= 5)")) { + "select s1 from db1 where (time > 4 and s1 <= 6) and (s2 > 3 and time <= 5)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -116,7 +116,7 @@ public void testRawQuery3() { Statement statement = connection.createStatement()) { statement.execute("USE " + DATABASE_NAME); - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s3 = '1'")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s3 = '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -125,7 +125,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from sg1 where s4 = CAST('2024-01-01' AS DATE)")) { + statement.executeQuery("select s1 from db1 where s4 = CAST('2024-01-01' AS DATE)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -133,7 +133,7 @@ public void testRawQuery3() { Assert.assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s5 = 1")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s5 = 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -141,7 +141,7 @@ public void testRawQuery3() { Assert.assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s3 != '1'")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s3 != '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -150,7 +150,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from sg1 where s4 != CAST('2024-01-01' AS DATE)")) { + statement.executeQuery("select s1 from db1 where s4 != CAST('2024-01-01' AS DATE)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -158,7 +158,7 @@ public void testRawQuery3() { Assert.assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s5 != 1")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s5 != 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -176,7 +176,7 @@ public void testRawQuery4() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("USE " + DATABASE_NAME); - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s3 > '0'")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s3 > '0'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -185,7 +185,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from sg1 where s4 > CAST('2024-01-01' AS DATE)")) { + statement.executeQuery("select s1 from db1 where s4 > CAST('2024-01-01' AS DATE)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -193,7 +193,7 @@ public void testRawQuery4() { Assert.assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s5 > 0")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s5 > 0")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -201,7 +201,7 @@ public void testRawQuery4() { Assert.assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s3 < '1'")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s3 < '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -210,7 +210,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from sg1 where s4 < CAST('2024-01-02' AS DATE)")) { + statement.executeQuery("select s1 from db1 where s4 < CAST('2024-01-02' AS DATE)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -218,7 +218,7 @@ public void testRawQuery4() { Assert.assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s5 < 1")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s5 < 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -226,7 +226,7 @@ public void testRawQuery4() { Assert.assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s3 >= '1'")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s3 >= '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -235,7 +235,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from sg1 where s4 >= CAST('2024-01-01' AS DATE)")) { + statement.executeQuery("select s1 from db1 where s4 >= CAST('2024-01-01' AS DATE)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -243,7 +243,7 @@ public void testRawQuery4() { Assert.assertEquals(2, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s5 >= 1")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s5 >= 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -251,7 +251,7 @@ public void testRawQuery4() { Assert.assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s3 <= '1'")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s3 <= '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -260,7 +260,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from sg1 where s4 <= CAST('2024-01-01' AS DATE)")) { + statement.executeQuery("select s1 from db1 where s4 <= CAST('2024-01-01' AS DATE)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -268,7 +268,7 @@ public void testRawQuery4() { Assert.assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s5 <= 1")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s5 <= 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -286,7 +286,7 @@ public void testRawQuery5() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("USE " + DATABASE_NAME); - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s3 = '1'")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s3 = '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -294,7 +294,7 @@ public void testRawQuery5() { Assert.assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s3 = '1'")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s3 = '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -303,7 +303,7 @@ public void testRawQuery5() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from sg1 where s4 = CAST('2024-01-01' AS DATE)")) { + statement.executeQuery("select s1 from db1 where s4 = CAST('2024-01-01' AS DATE)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -311,7 +311,7 @@ public void testRawQuery5() { Assert.assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("select s1 from sg1 where s5 = 1")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from db1 where s5 = 1")) { int cnt = 0; while (resultSet.next()) { cnt++; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBResultSetTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBResultSetTableIT.java index a7ad4a07be957..41536824bc48f 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBResultSetTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBResultSetTableIT.java @@ -57,7 +57,7 @@ public class IoTDBResultSetTableIT { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, "CREATE TABLE t1(device STRING TAG, status BOOLEAN FIELD, temperature FLOAT FIELD, type INT32 FIELD, grade INT64 FIELD)", - "CREATE TABLE sg(device STRING TAG, status FLOAT FIELD)", + "CREATE TABLE db(device STRING TAG, status FLOAT FIELD)", }; private static final String[] emptyResultSet = new String[] {}; @@ -119,7 +119,7 @@ public void columnTypeTest() { Statement statement = connection.createStatement()) { statement.execute("USE " + DATABASE_NAME); - try (ResultSet resultSet = statement.executeQuery("select * from sg")) { + try (ResultSet resultSet = statement.executeQuery("select * from db")) { Assert.assertTrue(!resultSet.next()); ResultSetMetaData metaData = resultSet.getMetaData(); assertEquals(3, metaData.getColumnCount()); @@ -144,7 +144,7 @@ public void columnTypeTest() { @Test public void emptyQueryTest1() { - tableAssertTestFail("select * from sg1", "550: Table 'test.sg1' does not exist", DATABASE_NAME); + tableAssertTestFail("select * from db1", "550: Table 'test.db1' does not exist", DATABASE_NAME); } @Test @@ -201,6 +201,6 @@ public void emptyLastQueryTest() { + "," + ColumnHeaderConstant.DATATYPE + ","; - resultSetEqualTest("select last s1 from sg", expectedHeader, emptyResultSet); + resultSetEqualTest("select last s1 from db", expectedHeader, emptyResultSet); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectSchemaTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectSchemaTableIT.java index e17f873e116b5..4d99aa07e6efb 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectSchemaTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectSchemaTableIT.java @@ -48,8 +48,8 @@ public class IoTDBSelectSchemaTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE sg(device STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 DOUBLE FIELD)", - "insert into sg(time, device, s1, s2, s3) values (1, 'd1', 1, 2, 3.0)" + "CREATE TABLE db(device STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 DOUBLE FIELD)", + "insert into db(time, device, s1, s2, s3) values (1, 'd1', 1, 2, 3.0)" }; @BeforeClass @@ -88,7 +88,7 @@ public void testSchemaExpression() { ResultSet resultSet = statement.executeQuery( String.format( - "select time, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s from sg", + "select time, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s from db", expressions[0], expressions[1], expressions[2], diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBFilterTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBFilterTableViewIT.java index 1f6bacf097177..8f548879287ac 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBFilterTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBFilterTableViewIT.java @@ -117,7 +117,7 @@ private static void generateData() { } } statement.execute( - " insert into root.sg1.d1(time, s1, s2) aligned values (1,1, \"1\"), (2,2,\"2\")"); + " insert into root.db1.d1(time, s1, s2) aligned values (1,1, \"1\"), (2,2,\"2\")"); statement.execute( " insert into root.vehicle.testUDTF.d1(time, s1, s2) values (1,\"ss\",0), (2,\"d\",3)"); } catch (SQLException throwable) { @@ -137,7 +137,7 @@ private static void createTableView() { statement.execute( "CREATE VIEW testUDTF(device STRING TAG, s1 TEXT FIELD, s2 DOUBLE FIELD) as root.vehicle.testUDTF.**"); statement.execute( - "CREATE VIEW sg1(device STRING TAG, s1 DOUBLE FIELD, s2 TEXT FIELD) as root.sg1.**"); + "CREATE VIEW db1(device STRING TAG, s1 DOUBLE FIELD, s2 TEXT FIELD) as root.db1.**"); } catch (SQLException throwable) { fail(throwable.getMessage()); @@ -205,7 +205,7 @@ public void testSameConstantWithDifferentType() { Statement statement = connection.createStatement()) { statement.execute("USE " + DATABASE_NAME); ResultSet resultSet = - statement.executeQuery("select s2 from sg1 where s1 = 1 and s2 >= '1' and s2 <= '2'"); + statement.executeQuery("select s2 from db1 where s1 = 1 and s2 >= '1' and s2 <= '2'"); int count = 0; while (resultSet.next()) { ++count; @@ -219,22 +219,22 @@ public void testSameConstantWithDifferentType() { @Test public void testCompareWithNull() { tableResultSetEqualTest( - "select s1 from sg1 where s1 != null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); + "select s1 from db1 where s1 != null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); tableResultSetEqualTest( - "select s1 from sg1 where s1 <> null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); + "select s1 from db1 where s1 <> null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); tableResultSetEqualTest( - "select s1 from sg1 where s1 = null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); + "select s1 from db1 where s1 = null", new String[] {"s1"}, new String[] {}, DATABASE_NAME); } @Test public void testCalculateWithNull() { tableResultSetEqualTest( - "select s1 + null from sg1", + "select s1 + null from db1", new String[] {"_col0"}, new String[] {"null,", "null,"}, DATABASE_NAME); tableResultSetEqualTest( - "select s1 - null from sg1", + "select s1 - null from db1", new String[] {"_col0"}, new String[] {"null,", "null,"}, DATABASE_NAME); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBSimpleQueryTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBSimpleQueryTableViewIT.java index 91f4998ac537b..293203e9b206c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBSimpleQueryTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBSimpleQueryTableViewIT.java @@ -73,8 +73,8 @@ public void testCreateTimeseries1() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); } catch (SQLException e) { e.printStackTrace(); @@ -84,7 +84,7 @@ public void testCreateTimeseries1() { statement.setFetchSize(5); statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute("CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD) as root.sg1.**"); + statement.execute("CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD) as root.db1.**"); try (ResultSet resultSet = statement.executeQuery("describe table1")) { if (resultSet.next() @@ -105,15 +105,15 @@ public void testOrderByTimeDesc() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TREE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (2, 2)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (3, 3)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (4, 4)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (3, 3)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (1, 1)"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (2, 2)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (3, 3)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (4, 4)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (3, 3)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (1, 1)"); statement.execute("flush"); } try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); @@ -122,7 +122,7 @@ public void testOrderByTimeDesc() throws Exception { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD, s1 INT32 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD, s1 INT32 FIELD) as root.db1.**"); statement.execute("flush"); String[] expectedHeader = new String[] {"time", "device", "s0", "s1"}; @@ -145,17 +145,17 @@ public void testShowTimeseriesDataSet1() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TREE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); } @@ -165,7 +165,7 @@ public void testShowTimeseriesDataSet1() throws SQLException { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.db1.**"); int count = 0; try (ResultSet resultSet = statement.executeQuery("describe table1")) { @@ -187,17 +187,17 @@ public void testShowTimeseriesDataSet2() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(10); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); } @@ -207,7 +207,7 @@ public void testShowTimeseriesDataSet2() throws SQLException { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.db1.**"); statement.execute("flush"); @@ -231,17 +231,17 @@ public void testShowTimeseriesDataSet3() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(15); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); } @@ -251,7 +251,7 @@ public void testShowTimeseriesDataSet3() throws SQLException { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.db1.**"); statement.execute("flush"); @@ -275,24 +275,24 @@ public void testFirstOverlappedPageFiltered() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); // seq chunk : [1,10] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (10, 10)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (10, 10)"); statement.execute("flush"); // seq chunk : [13,20] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (13, 13)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (20, 20)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (13, 13)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (20, 20)"); statement.execute("flush"); // unseq chunk : [5,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 15)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 15)"); statement.execute("flush"); } @@ -300,7 +300,7 @@ public void testFirstOverlappedPageFiltered() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute("CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD) as root.sg1.**"); + statement.execute("CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD) as root.db1.**"); long count = 0; try (ResultSet resultSet = statement.executeQuery("select s0 from table1 where s0 > 18")) { @@ -317,12 +317,12 @@ public void testFirstOverlappedPageFiltered() throws SQLException { public void testPartialInsertion() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); try { - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0, s1) VALUES (1, 1, 2.2)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0, s1) VALUES (1, 1, 2.2)"); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("s1")); @@ -333,7 +333,7 @@ public void testPartialInsertion() throws SQLException { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD, s1 INT32 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD, s1 INT32 FIELD) as root.db1.**"); try (ResultSet resultSet = statement.executeQuery("select s0, s1 from table1")) { while (resultSet.next()) { @@ -349,28 +349,28 @@ public void testOverlappedPagesMerge() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); // seq chunk : start-end [1000, 1000] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1000, 0)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1000, 0)"); statement.execute("flush"); // unseq chunk : [1,10] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (10, 10)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (10, 10)"); statement.execute("flush"); // usneq chunk : [5,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 15)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 15)"); statement.execute("flush"); // unseq chunk : [15,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 150)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 150)"); statement.execute("flush"); } @@ -378,7 +378,7 @@ public void testOverlappedPagesMerge() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute("CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD) as root.sg1.**"); + statement.execute("CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD) as root.db1.**"); long count = 0; @@ -397,13 +397,13 @@ public void testTimeseriesMetadataCache() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); for (int i = 0; i < 10000; i++) { statement.execute( - "CREATE TIMESERIES root.sg1.d0.s" + i + " WITH DATATYPE=INT32,ENCODING=PLAIN"); + "CREATE TIMESERIES root.db1.d0.s" + i + " WITH DATATYPE=INT32,ENCODING=PLAIN"); } for (int i = 1; i < 10000; i++) { - statement.execute("INSERT INTO root.sg1.d0(timestamp, s" + i + ") VALUES (1000, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s" + i + ") VALUES (1000, 1)"); } statement.execute("flush"); } @@ -419,7 +419,7 @@ public void testTimeseriesMetadataCache() throws SQLException { } createTableBuilder .deleteCharAt(createTableBuilder.lastIndexOf(",")) - .append(") as root.sg1.**"); + .append(") as root.db1.**"); statement.execute(createTableBuilder.toString()); statement.executeQuery("select s0 from table1"); } catch (SQLException e) { @@ -432,26 +432,26 @@ public void testUseSameStatement() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); - statement.execute("insert into root.sg1.d0(timestamp,s0,s1) values(1,1,1)"); - statement.execute("insert into root.sg1.d1(timestamp,s0,s1) values(1000,1000,1000)"); - statement.execute("insert into root.sg1.d0(timestamp,s0,s1) values(10,10,10)"); + statement.execute("insert into root.db1.d0(timestamp,s0,s1) values(1,1,1)"); + statement.execute("insert into root.db1.d1(timestamp,s0,s1) values(1000,1000,1000)"); + statement.execute("insert into root.db1.d0(timestamp,s0,s1) values(10,10,10)"); } try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE test"); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s0 INT64 FIELD, s1 INT64 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s0 INT64 FIELD, s1 INT64 FIELD) as root.db1.**"); List resultSetList = new ArrayList<>(); @@ -485,15 +485,15 @@ public void testUseSameStatement() throws SQLException { public void testEnableAlign() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=BOOLEAN"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=BOOLEAN"); } try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE test"); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 BOOLEAN FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 BOOLEAN FIELD) as root.db1.**"); ResultSet resultSet = statement.executeQuery("select time, s1, s2 from table1"); ResultSetMetaData metaData = resultSet.getMetaData(); int[] types = {Types.TIMESTAMP, Types.INTEGER, Types.BOOLEAN}; @@ -510,19 +510,19 @@ public void testNewDataType() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); for (int i = 1; i <= 10; i++) { statement.execute( String.format( - "insert into root.sg1.d1(timestamp, s4, s5, s6, s7) values(%d, \"%s\", %d, %s, \"%s\")", + "insert into root.db1.d1(timestamp, s4, s5, s6, s7) values(%d, \"%s\", %d, %s, \"%s\")", i, LocalDate.of(2024, 5, i % 31 + 1), i, "X'cafebabe'", i)); } } @@ -531,7 +531,7 @@ public void testNewDataType() throws SQLException { statement.execute("CREATE DATABASE test"); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s4 DATE FIELD, s5 TIMESTAMP FIELD, s6 BLOB FIELD, s7 STRING FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s4 DATE FIELD, s5 TIMESTAMP FIELD, s6 BLOB FIELD, s7 STRING FIELD) as root.db1.**"); try (ResultSet resultSet = statement.executeQuery("select * from table1")) { final ResultSetMetaData metaData = resultSet.getMetaData(); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableViewIT.java index 668cd36a71a01..dcf603603b9a0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableViewIT.java @@ -49,29 +49,29 @@ public class IoTDBAlignByDeviceWithTemplateTableViewIT { private static final String[] sqls = new String[] { // non-aligned template - "CREATE database root.sg1;", + "CREATE database root.db1;", "CREATE schema template t1 (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t1 to root.sg1;", - "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", - "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", - "INSERT INTO root.sg1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", - "INSERT INTO root.sg1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", + "SET SCHEMA TEMPLATE t1 to root.db1;", + "INSERT INTO root.db1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", + "INSERT INTO root.db1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", + "INSERT INTO root.db1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", + "INSERT INTO root.db1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", // aligned template - "CREATE database root.sg2;", + "CREATE database root.db2;", "CREATE schema template t2 aligned (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t2 to root.sg2;", - "INSERT INTO root.sg2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", - "INSERT INTO root.sg2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", - "INSERT INTO root.sg2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", + "SET SCHEMA TEMPLATE t2 to root.db2;", + "INSERT INTO root.db2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", + "INSERT INTO root.db2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", + "INSERT INTO root.db2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", }; private static final String[] createTableViewSqls = new String[] { "CREATE database " + DATABASE_NAME, "use " + DATABASE_NAME, - "create view table1(device_id STRING TAG, s1 FLOAT FIELD, s2 BOOLEAN FIELD, s3 INT32 FIELD) as root.sg2.**", + "create view table1(device_id STRING TAG, s1 FLOAT FIELD, s2 BOOLEAN FIELD, s3 INT32 FIELD) as root.db2.**", }; @BeforeClass diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/IoTDBAlignedSeriesQueryTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/IoTDBAlignedSeriesQueryTableViewIT.java index 34051a1d26260..daef532c9d6c0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/IoTDBAlignedSeriesQueryTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/IoTDBAlignedSeriesQueryTableViewIT.java @@ -913,7 +913,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { try (Connection connection = EnvFactory.getEnv().getTableConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2138,7 +2138,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.* align by device")) { + statement.executeQuery("select count(*) from root.db1.* align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2617,7 +2617,7 @@ public void groupByWithNonAlignedTimeseriesAlignByDeviceTest() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.* " + "select count(s1), sum(s2), avg(s1) from root.db1.* " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -2902,7 +2902,7 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -2928,7 +2928,7 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = @@ -3158,7 +3158,7 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -3189,7 +3189,7 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = @@ -3393,7 +3393,7 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -3415,7 +3415,7 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 " + + "from root.db1 where time > 5 and time < 38 " + "GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/TableViewUtils.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/TableViewUtils.java index 656f1b24fafea..63cd1ae9b1a81 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/TableViewUtils.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/TableViewUtils.java @@ -44,104 +44,104 @@ public class TableViewUtils { private static final String[] sqls = new String[] { - "CREATE DATABASE root.sg1", - "create aligned timeseries root.sg1.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64, s4 BOOLEAN, s5 TEXT)", - "create timeseries root.sg1.d2.s1 WITH DATATYPE=FLOAT, encoding=RLE", - "create timeseries root.sg1.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", - "create timeseries root.sg1.d2.s3 WITH DATATYPE=INT64", - "create timeseries root.sg1.d2.s4 WITH DATATYPE=BOOLEAN", - "create timeseries root.sg1.d2.s5 WITH DATATYPE=TEXT", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(1, 1.0, 1, 1, TRUE, 'aligned_test1')", - "insert into root.sg1.d1(time, s1, s2, s3, s5) aligned values(2, 2.0, 2, 2, 'aligned_test2')", - "insert into root.sg1.d1(time, s1, s3, s4, s5) aligned values(3, 3.0, 3, FALSE, 'aligned_test3')", - "insert into root.sg1.d1(time, s1, s2, s4, s5) aligned values(4, 4.0, 4, TRUE, 'aligned_test4')", - "insert into root.sg1.d1(time, s1, s2, s4, s5) aligned values(5, 5.0, 5, TRUE, 'aligned_test5')", - "insert into root.sg1.d1(time, s1, s2, s3, s4) aligned values(6, 6.0, 6, 6, TRUE)", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(7, 7.0, 7, 7, FALSE, 'aligned_test7')", - "insert into root.sg1.d1(time, s1, s2, s3, s5) aligned values(8, 8.0, 8, 8, 'aligned_test8')", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(9, 9.0, 9, 9, FALSE, 'aligned_test9')", - "insert into root.sg1.d1(time, s2, s3, s4, s5) aligned values(10, 10, 10, TRUE, 'aligned_test10')", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(1, 1.0, 1, 1, TRUE, 'non_aligned_test1')", - "insert into root.sg1.d2(time, s1, s2, s3, s5) values(2, 2.0, 2, 2, 'non_aligned_test2')", - "insert into root.sg1.d2(time, s1, s3, s4, s5) values(3, 3.0, 3, FALSE, 'non_aligned_test3')", - "insert into root.sg1.d2(time, s1, s2, s4, s5) values(4, 4.0, 4, TRUE, 'non_aligned_test4')", - "insert into root.sg1.d2(time, s1, s2, s4, s5) values(5, 5.0, 5, TRUE, 'non_aligned_test5')", - "insert into root.sg1.d2(time, s1, s2, s3, s4) values(6, 6.0, 6, 6, TRUE)", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(7, 7.0, 7, 7, FALSE, 'non_aligned_test7')", - "insert into root.sg1.d2(time, s1, s2, s3, s5) values(8, 8.0, 8, 8, 'non_aligned_test8')", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(9, 9.0, 9, 9, FALSE, 'non_aligned_test9')", - "insert into root.sg1.d2(time, s2, s3, s4, s5) values(10, 10, 10, TRUE, 'non_aligned_test10')", + "CREATE DATABASE root.db1", + "create aligned timeseries root.db1.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64, s4 BOOLEAN, s5 TEXT)", + "create timeseries root.db1.d2.s1 WITH DATATYPE=FLOAT, encoding=RLE", + "create timeseries root.db1.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", + "create timeseries root.db1.d2.s3 WITH DATATYPE=INT64", + "create timeseries root.db1.d2.s4 WITH DATATYPE=BOOLEAN", + "create timeseries root.db1.d2.s5 WITH DATATYPE=TEXT", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(1, 1.0, 1, 1, TRUE, 'aligned_test1')", + "insert into root.db1.d1(time, s1, s2, s3, s5) aligned values(2, 2.0, 2, 2, 'aligned_test2')", + "insert into root.db1.d1(time, s1, s3, s4, s5) aligned values(3, 3.0, 3, FALSE, 'aligned_test3')", + "insert into root.db1.d1(time, s1, s2, s4, s5) aligned values(4, 4.0, 4, TRUE, 'aligned_test4')", + "insert into root.db1.d1(time, s1, s2, s4, s5) aligned values(5, 5.0, 5, TRUE, 'aligned_test5')", + "insert into root.db1.d1(time, s1, s2, s3, s4) aligned values(6, 6.0, 6, 6, TRUE)", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(7, 7.0, 7, 7, FALSE, 'aligned_test7')", + "insert into root.db1.d1(time, s1, s2, s3, s5) aligned values(8, 8.0, 8, 8, 'aligned_test8')", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(9, 9.0, 9, 9, FALSE, 'aligned_test9')", + "insert into root.db1.d1(time, s2, s3, s4, s5) aligned values(10, 10, 10, TRUE, 'aligned_test10')", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(1, 1.0, 1, 1, TRUE, 'non_aligned_test1')", + "insert into root.db1.d2(time, s1, s2, s3, s5) values(2, 2.0, 2, 2, 'non_aligned_test2')", + "insert into root.db1.d2(time, s1, s3, s4, s5) values(3, 3.0, 3, FALSE, 'non_aligned_test3')", + "insert into root.db1.d2(time, s1, s2, s4, s5) values(4, 4.0, 4, TRUE, 'non_aligned_test4')", + "insert into root.db1.d2(time, s1, s2, s4, s5) values(5, 5.0, 5, TRUE, 'non_aligned_test5')", + "insert into root.db1.d2(time, s1, s2, s3, s4) values(6, 6.0, 6, 6, TRUE)", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(7, 7.0, 7, 7, FALSE, 'non_aligned_test7')", + "insert into root.db1.d2(time, s1, s2, s3, s5) values(8, 8.0, 8, 8, 'non_aligned_test8')", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(9, 9.0, 9, 9, FALSE, 'non_aligned_test9')", + "insert into root.db1.d2(time, s2, s3, s4, s5) values(10, 10, 10, TRUE, 'non_aligned_test10')", "flush", - "insert into root.sg1.d1(time, s1, s3, s4, s5) aligned values(3, 30000.0, 30000, TRUE, 'aligned_unseq_test3')", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(11, 11.0, 11, 11)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(12, 12.0, 12, 12)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(13, 13.0, 13, 13)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(14, 14.0, 14, 14)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(15, 15.0, 15, 15)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(16, 16.0, 16, 16)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(17, 17.0, 17, 17)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(18, 18.0, 18, 18)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(19, 19.0, 19, 19)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(20, 20.0, 20, 20)", - "insert into root.sg1.d2(time, s1, s2, s3) values(11, 11.0, 11, 11)", - "insert into root.sg1.d2(time, s1, s2, s3) values(12, 12.0, 12, 12)", - "insert into root.sg1.d2(time, s1, s2, s3) values(13, 13.0, 13, 13)", - "insert into root.sg1.d2(time, s1, s2, s3) values(14, 14.0, 14, 14)", - "insert into root.sg1.d2(time, s1, s2, s3) values(15, 15.0, 15, 15)", - "insert into root.sg1.d2(time, s1, s2, s3) values(16, 16.0, 16, 16)", - "insert into root.sg1.d2(time, s1, s2, s3) values(17, 17.0, 17, 17)", - "insert into root.sg1.d2(time, s1, s2, s3) values(18, 18.0, 18, 18)", - "insert into root.sg1.d2(time, s1, s2, s3) values(19, 19.0, 19, 19)", - "insert into root.sg1.d2(time, s1, s2, s3) values(20, 20.0, 20, 20)", + "insert into root.db1.d1(time, s1, s3, s4, s5) aligned values(3, 30000.0, 30000, TRUE, 'aligned_unseq_test3')", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(11, 11.0, 11, 11)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(12, 12.0, 12, 12)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(13, 13.0, 13, 13)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(14, 14.0, 14, 14)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(15, 15.0, 15, 15)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(16, 16.0, 16, 16)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(17, 17.0, 17, 17)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(18, 18.0, 18, 18)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(19, 19.0, 19, 19)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(20, 20.0, 20, 20)", + "insert into root.db1.d2(time, s1, s2, s3) values(11, 11.0, 11, 11)", + "insert into root.db1.d2(time, s1, s2, s3) values(12, 12.0, 12, 12)", + "insert into root.db1.d2(time, s1, s2, s3) values(13, 13.0, 13, 13)", + "insert into root.db1.d2(time, s1, s2, s3) values(14, 14.0, 14, 14)", + "insert into root.db1.d2(time, s1, s2, s3) values(15, 15.0, 15, 15)", + "insert into root.db1.d2(time, s1, s2, s3) values(16, 16.0, 16, 16)", + "insert into root.db1.d2(time, s1, s2, s3) values(17, 17.0, 17, 17)", + "insert into root.db1.d2(time, s1, s2, s3) values(18, 18.0, 18, 18)", + "insert into root.db1.d2(time, s1, s2, s3) values(19, 19.0, 19, 19)", + "insert into root.db1.d2(time, s1, s2, s3) values(20, 20.0, 20, 20)", "flush", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(13, 130000.0, 130000, 130000, TRUE, 'aligned_unseq_test13')", - "insert into root.sg1.d1(time, s3, s4) aligned values(21, 21, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(22, 22, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(23, 23, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(24, 24, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(25, 25, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(26, 26, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(27, 27, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(28, 28, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(29, 29, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(30, 30, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(21, 21, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(22, 22, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(23, 23, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(24, 24, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(25, 25, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(26, 26, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(27, 27, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(28, 28, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(29, 29, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(30, 30, FALSE)", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(13, 130000.0, 130000, 130000, TRUE, 'aligned_unseq_test13')", + "insert into root.db1.d1(time, s3, s4) aligned values(21, 21, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(22, 22, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(23, 23, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(24, 24, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(25, 25, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(26, 26, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(27, 27, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(28, 28, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(29, 29, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(30, 30, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(21, 21, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(22, 22, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(23, 23, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(24, 24, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(25, 25, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(26, 26, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(27, 27, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(28, 28, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(29, 29, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(30, 30, FALSE)", "flush", - "insert into root.sg1.d1(time, s1, s3, s4) aligned values(23, 230000.0, 230000, FALSE)", - "insert into root.sg1.d1(time, s2, s5) aligned values(31, 31, 'aligned_test31')", - "insert into root.sg1.d1(time, s2, s5) aligned values(32, 32, 'aligned_test32')", - "insert into root.sg1.d1(time, s2, s5) aligned values(33, 33, 'aligned_test33')", - "insert into root.sg1.d1(time, s2, s5) aligned values(34, 34, 'aligned_test34')", - "insert into root.sg1.d1(time, s2, s5) aligned values(35, 35, 'aligned_test35')", - "insert into root.sg1.d1(time, s2, s5) aligned values(36, 36, 'aligned_test36')", - "insert into root.sg1.d1(time, s2, s5) aligned values(37, 37, 'aligned_test37')", - "insert into root.sg1.d1(time, s2, s5) aligned values(38, 38, 'aligned_test38')", - "insert into root.sg1.d1(time, s2, s5) aligned values(39, 39, 'aligned_test39')", - "insert into root.sg1.d1(time, s2, s5) aligned values(40, 40, 'aligned_test40')", - "insert into root.sg1.d2(time, s2, s5) values(31, 31, 'non_aligned_test31')", - "insert into root.sg1.d2(time, s2, s5) values(32, 32, 'non_aligned_test32')", - "insert into root.sg1.d2(time, s2, s5) values(33, 33, 'non_aligned_test33')", - "insert into root.sg1.d2(time, s2, s5) values(34, 34, 'non_aligned_test34')", - "insert into root.sg1.d2(time, s2, s5) values(35, 35, 'non_aligned_test35')", - "insert into root.sg1.d2(time, s2, s5) values(36, 36, 'non_aligned_test36')", - "insert into root.sg1.d2(time, s2, s5) values(37, 37, 'non_aligned_test37')", - "insert into root.sg1.d2(time, s2, s5) values(38, 38, 'non_aligned_test38')", - "insert into root.sg1.d2(time, s2, s5) values(39, 39, 'non_aligned_test39')", - "insert into root.sg1.d2(time, s2, s5) values(40, 40, 'non_aligned_test40')", + "insert into root.db1.d1(time, s1, s3, s4) aligned values(23, 230000.0, 230000, FALSE)", + "insert into root.db1.d1(time, s2, s5) aligned values(31, 31, 'aligned_test31')", + "insert into root.db1.d1(time, s2, s5) aligned values(32, 32, 'aligned_test32')", + "insert into root.db1.d1(time, s2, s5) aligned values(33, 33, 'aligned_test33')", + "insert into root.db1.d1(time, s2, s5) aligned values(34, 34, 'aligned_test34')", + "insert into root.db1.d1(time, s2, s5) aligned values(35, 35, 'aligned_test35')", + "insert into root.db1.d1(time, s2, s5) aligned values(36, 36, 'aligned_test36')", + "insert into root.db1.d1(time, s2, s5) aligned values(37, 37, 'aligned_test37')", + "insert into root.db1.d1(time, s2, s5) aligned values(38, 38, 'aligned_test38')", + "insert into root.db1.d1(time, s2, s5) aligned values(39, 39, 'aligned_test39')", + "insert into root.db1.d1(time, s2, s5) aligned values(40, 40, 'aligned_test40')", + "insert into root.db1.d2(time, s2, s5) values(31, 31, 'non_aligned_test31')", + "insert into root.db1.d2(time, s2, s5) values(32, 32, 'non_aligned_test32')", + "insert into root.db1.d2(time, s2, s5) values(33, 33, 'non_aligned_test33')", + "insert into root.db1.d2(time, s2, s5) values(34, 34, 'non_aligned_test34')", + "insert into root.db1.d2(time, s2, s5) values(35, 35, 'non_aligned_test35')", + "insert into root.db1.d2(time, s2, s5) values(36, 36, 'non_aligned_test36')", + "insert into root.db1.d2(time, s2, s5) values(37, 37, 'non_aligned_test37')", + "insert into root.db1.d2(time, s2, s5) values(38, 38, 'non_aligned_test38')", + "insert into root.db1.d2(time, s2, s5) values(39, 39, 'non_aligned_test39')", + "insert into root.db1.d2(time, s2, s5) values(40, 40, 'non_aligned_test40')", }; private static final String[] createTableViewSqls = { "CREATE DATABASE db", "USE db", - "CREATE VIEW table0 (device string tag, s1 FLOAT field, s2 INT32 field, s3 INT64 field, s4 BOOLEAN field, s5 TEXT field) as root.sg1.**", + "CREATE VIEW table0 (device string tag, s1 FLOAT field, s2 INT32 field, s3 INT64 field, s4 BOOLEAN field, s5 TEXT field) as root.db1.**", }; public static void insertData() { diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/orderby/IoTDBOrderByTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/orderby/IoTDBOrderByTableViewIT.java index 9aa60526da027..5bb2252db7582 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/orderby/IoTDBOrderByTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/orderby/IoTDBOrderByTableViewIT.java @@ -61,58 +61,58 @@ public class IoTDBOrderByTableViewIT { // https://docs.google.com/spreadsheets/d/1OWA1bKraArCwWVnuTjuhJ5yLG0PFLdD78gD6FjquepI/edit#gid=0 private static final String[] sql = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d1.bignum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d1.floatnum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", - "CREATE TIMESERIES root.sg.d1.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d1.bignum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d1.floatnum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", + "CREATE TIMESERIES root.db.d1.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" }; private static final String[] createTableViewSql = { "CREATE DATABASE db", "USE db", "CREATE VIEW table0 (device string tag, num int32 field, bignum int64 field, " - + "floatnum double field, str TEXT field, bool BOOLEAN field) as root.sg.**", + + "floatnum double field, str TEXT field, bool BOOLEAN field) as root.db.**", }; private static final String[] sql2 = new String[] { - "CREATE TIMESERIES root.sg.d2.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.bignum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.floatnum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", - "CREATE TIMESERIES root.sg.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" + "CREATE TIMESERIES root.db.d2.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.bignum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.floatnum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", + "CREATE TIMESERIES root.db.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" }; @BeforeClass @@ -470,7 +470,7 @@ public void orderByTest19() { @Ignore @Test public void orderByInAggregationTest() { - String sql = "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc"; + String sql = "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc"; double[][] ans = new double[][] {{15.0}, {13.0}, {13.0}, {11.0}, {6.4}, {4.6}}; long[] times = new long[] {51536000000L, 41536000000L, 41536900000L, 31536100000L, 31536000000L, 0L}; @@ -497,7 +497,7 @@ public void orderByInAggregationTest() { @Test public void orderByInAggregationTest2() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12}, @@ -532,7 +532,7 @@ public void orderByInAggregationTest2() { @Test public void orderByInAggregationTest3() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; double[] ans = new double[] {15.0, 13.0, 13.0, 11.0, 6.4, 4.6}; long[] times = new long[] {51536000000L, 41536900000L, 41536000000L, 31536100000L, 31536000000L, 0L}; @@ -559,7 +559,7 @@ public void orderByInAggregationTest3() { @Test public void orderByInAggregationTest4() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -588,7 +588,7 @@ public void orderByInAggregationTest4() { @Test public void orderByInAggregationTest5() { String sql = - "select min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483646L, 2147483650L, 2147468648L, 2146483648L, 2107483648L, 3147483648L}; long[] times = @@ -617,7 +617,7 @@ public void orderByInAggregationTest5() { @Test public void orderByInAggregationTest6() { String sql = - "select min_value(num)+min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(num)+min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483647L, 2147483654L, 2147468659L, 2146483660L, 2107483661L, 3147483663L}; long[] times = @@ -646,7 +646,7 @@ public void orderByInAggregationTest6() { @Test public void orderByInAggregationTest7() { String sql = - "select avg(num)+min_value(floatNum) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num)+min_value(floatNum) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12, 54.12}, @@ -681,7 +681,7 @@ public void orderByInAggregationTest7() { @Test public void orderByInAggregationTest8() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(floatNum)+avg(num)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(floatNum)+avg(num)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -1077,18 +1077,18 @@ public void orderByInAggregationAlignByDeviceTest() { }; String[] device = new String[] { - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d", - "root.sg.d2", - "root.sg.d2", - "root.sg.d", - "root.sg.d2" + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d", + "root.db.d2", + "root.db.d2", + "root.db.d", + "root.db.d2" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -1121,8 +1121,8 @@ public void orderByInAggregationAlignByDeviceTest2() { } private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { - String device = "root.sg.d"; - if (!deviceAsc) device = "root.sg.d2"; + String device = "root.db.d"; + if (!deviceAsc) device = "root.db.d2"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { @@ -1132,8 +1132,8 @@ private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { double actualVal = resultSet.getDouble(2); assertEquals(deviceName, device); assertEquals(Double.parseDouble(value.toString()), actualVal, 1); - if (device.equals("root.sg.d")) device = "root.sg.d2"; - else device = "root.sg.d"; + if (device.equals("root.db.d")) device = "root.db.d2"; + else device = "root.db.d"; i++; } assertEquals(i, 2); @@ -1310,7 +1310,7 @@ private void orderByUDFTest(String sql, int[] ans) { @Test public void orderByUDFTest1() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; int[] ans = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 11, 12, 14}; orderByUDFTest(sql, ans); } @@ -1319,7 +1319,7 @@ public void orderByUDFTest1() { @Test public void orderByUDFTest2() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; int[] ans = {12, 14, 13, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; orderByUDFTest(sql, ans); } @@ -1337,7 +1337,7 @@ private void errorTest(String sql, String error) { @Test public void errorTest1() { errorTest( - "select num from root.sg.d order by avg(bigNum)", + "select num from root.db.d order by avg(bigNum)", "701: Raw data and aggregation hybrid query is not supported."); } @@ -1345,7 +1345,7 @@ public void errorTest1() { @Test public void errorTest2() { errorTest( - "select avg(num) from root.sg.d order by bigNum", + "select avg(num) from root.db.d order by bigNum", "701: Raw data and aggregation hybrid query is not supported."); } @@ -1368,8 +1368,8 @@ public void errorTest4() { @Test public void errorTest7() { errorTest( - "select last bigNum,floatNum from root.** order by root.sg.d.bigNum", - "701: root.sg.d.bigNum in order by clause doesn't exist in the result of last query."); + "select last bigNum,floatNum from root.** order by root.db.d.bigNum", + "701: root.db.d.bigNum in order by clause doesn't exist in the result of last query."); } // last query @@ -1405,7 +1405,7 @@ public void lastQueryOrderBy() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d.num", "root.sg.d2.num", "root.sg.d.bigNum", "root.sg.d2.bigNum"}, + {"root.db.d.num", "root.db.d2.num", "root.db.d.bigNum", "root.db.d2.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1419,7 +1419,7 @@ public void lastQueryOrderBy2() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1433,7 +1433,7 @@ public void lastQueryOrderBy3() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1447,7 +1447,7 @@ public void lastQueryOrderBy4() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1461,7 +1461,7 @@ public void lastQueryOrderBy5() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/query/IoTDBArithmeticTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/query/IoTDBArithmeticTableViewIT.java index e8a19eb2c59cd..fbf700061dba6 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/query/IoTDBArithmeticTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/query/IoTDBArithmeticTableViewIT.java @@ -73,27 +73,27 @@ public class IoTDBArithmeticTableViewIT { private static final String[] INSERTION_SQLS = { "CREATE DATABASE root.test", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s5 WITH DATATYPE=DATE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s6 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s7 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s8 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (1, 1, 1, 1.0, 1.0, '2024-01-01', 10, true, 'test')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (2, 2, 2, 2.0, 2.0, '2024-02-01', 20, true, 'test')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (3, 3, 3, 3.0, 3.0, '2024-03-01', 30, true, 'test')", - "CREATE ALIGNED TIMESERIES root.sg2.d1(date DATE)", - "insert into root.sg2.d1(time, date) values (1, '9999-12-31')", - "insert into root.sg2.d1(time, date) values (2, '1000-01-01')" + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s5 WITH DATATYPE=DATE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s6 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s7 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s8 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (1, 1, 1, 1.0, 1.0, '2024-01-01', 10, true, 'test')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (2, 2, 2, 2.0, 2.0, '2024-02-01', 20, true, 'test')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (3, 3, 3, 3.0, 3.0, '2024-03-01', 30, true, 'test')", + "CREATE ALIGNED TIMESERIES root.db2.d1(date DATE)", + "insert into root.db2.d1(time, date) values (1, '9999-12-31')", + "insert into root.db2.d1(time, date) values (2, '1000-01-01')" }; private static final String[] CREATE_TABLE_VIEW_SQLS = { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE VIEW table1 (device STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 DATE FIELD, s6 TIMESTAMP FIELD, s7 BOOLEAN FIELD, s8 TEXT FIELD) as root.sg.**", - "CREATE VIEW table2 (device STRING TAG, date DATE FIELD) as root.sg2.**", + "CREATE VIEW table1 (device STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 DATE FIELD, s6 TIMESTAMP FIELD, s7 BOOLEAN FIELD, s8 TEXT FIELD) as root.db.**", + "CREATE VIEW table2 (device STRING TAG, date DATE FIELD) as root.db2.**", }; @BeforeClass diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceIT.java index 8ffe434db738b..d9566a96c5c60 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceIT.java @@ -85,8 +85,8 @@ public void tearDown() throws Exception { new String[] { "create database if not exists test", "use test", - "CREATE TABLE sg10(tag1 string tag, s1 int64 field, s2 float field, s3 string field)", - "CREATE TABLE sg11(tag1 string tag, s1 int64 field, s2 float field, s3 string field)" + "CREATE TABLE db10(tag1 string tag, s1 int64 field, s2 float field, s3 string field)", + "CREATE TABLE db11(tag1 string tag, s1 int64 field, s2 float field, s3 string field)" }; public void ping() { @@ -152,14 +152,14 @@ public void test() { } public void testQuery() { - String sql = "insert into sg11(tag1,s1,s2,s3,time) values('aa',11,1.1,1,1),('aa2',21,2.1,2,2)"; + String sql = "insert into db11(tag1,s1,s2,s3,time) values('aa',11,1.1,1,1),('aa2',21,2.1,2,2)"; JsonObject result = RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); assertEquals(200, result.get("code").getAsInt()); JsonObject queryResult = RestUtils.query( httpClient, port, - sqlHandler("test", "select tag1,s1,s2,s3,time from sg11 order by time")); + sqlHandler("test", "select tag1,s1,s2,s3,time from db11 order by time")); JsonArray jsonArray = queryResult.get("values").getAsJsonArray(); for (int i = 0; i < jsonArray.size(); i++) { JsonArray jsonArray1 = jsonArray.get(i).getAsJsonArray(); @@ -184,7 +184,7 @@ public void testQuery1() { RestUtils.query( httpClient, port, - sqlHandler(null, "select tag1,s1,s2,s3,time from sg11 order by time")); + sqlHandler(null, "select tag1,s1,s2,s3,time from db11 order by time")); assertEquals(701, result.get("code").getAsInt()); assertEquals( "Database must be specified when session database is not set", @@ -204,13 +204,13 @@ public void rightNonQuery() { } public void rightNonQuery2() { - String sql = "insert into sg10(tag1,s1,time,s2) values('aa',1,1,1.1)"; + String sql = "insert into db10(tag1,s1,time,s2) values('aa',1,1,1.1)"; JsonObject result = RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); assertEquals(200, result.get("code").getAsInt()); } public void rightNonQuery4() { - String sql = "insert into sg10(tag1,s1,time,s2) values('aa',1,1,1.1),('bb',2,2,2.1)"; + String sql = "insert into db10(tag1,s1,time,s2) values('aa',1,1,1.1),('bb',2,2,2.1)"; JsonObject result = RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); assertEquals(200, result.get("code").getAsInt()); } @@ -230,7 +230,7 @@ public void errorNonQuery() { public void errorNonQuery1() { String sql = - "CREATE TABLE sg10(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"; + "CREATE TABLE db10(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"; JsonObject result = RestUtils.nonQuery(httpClient, port, sqlHandler(null, sql)); assertEquals(701, result.get("code").getAsInt()); assertEquals("database is not specified", result.get("message").getAsString()); @@ -244,7 +244,7 @@ public void errorNonQuery2() { } public void errorNonQuery3() { - String sql = "select * from sg10"; + String sql = "select * from db10"; JsonObject result = RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); assertEquals(301, result.get("code").getAsInt()); assertEquals("EXECUTE_STATEMENT_ERROR", result.get("message").getAsString()); @@ -260,11 +260,11 @@ public String sqlHandler(String database, String sql) { public void testInsertMultiPartition() { List sqls = Arrays.asList( - "create table sg1 (tag1 string tag, s1 int32 field)", - "insert into sg1(tag1,time,s1) values('d1',1,2)", + "create table db1 (tag1 string tag, s1 int32 field)", + "insert into db1(tag1,time,s1) values('d1',1,2)", "flush", - "insert into sg1(tag1,time,s1) values('d1',2,2)", - "insert into sg1(tag1,time,s1) values('d1',604800001,2)", + "insert into db1(tag1,time,s1) values('d1',2,2)", + "insert into db1(tag1,time,s1) values('d1',604800001,2)", "flush"); for (String sql : sqls) { RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); @@ -274,24 +274,24 @@ public void testInsertMultiPartition() { public void testInsertTablet() { List sqls = Collections.singletonList( - "create table sg211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); + "create table db211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); for (String sql : sqls) { RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); } String json = - "{\"database\":\"test\",\"column_categories\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"tag1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; + "{\"database\":\"test\",\"column_categories\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"tag1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"db211\"}"; rightInsertTablet(json); } public void testInsertTabletNoDatabase() { List sqls = Collections.singletonList( - "create table sg211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); + "create table db211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); for (String sql : sqls) { RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); } String json = - "{\"database\":\"\",\"column_categories\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"tag1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; + "{\"database\":\"\",\"column_categories\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"tag1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"db211\"}"; JsonObject result = RestUtils.insertTablet(httpClient, port, json); assertEquals(305, Integer.parseInt(result.get("code").toString())); } @@ -299,12 +299,12 @@ public void testInsertTabletNoDatabase() { public void testInsertTablet1() { List sqls = Collections.singletonList( - "create table sg211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); + "create table db211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); for (String sql : sqls) { RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); } String json = - "{\"database\":\"test\",\"column_categories\":[\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"id1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; + "{\"database\":\"test\",\"column_categories\":[\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"id1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"db211\"}"; JsonObject result = RestUtils.insertTablet(httpClient, port, json); assertEquals(305, Integer.parseInt(result.get("code").toString())); assertEquals( @@ -315,12 +315,12 @@ public void testInsertTablet1() { public void testInsertTablet2() { List sqls = Collections.singletonList( - "create table sg211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); + "create table db211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); for (String sql : sqls) { RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); } String json = - "{\"database\":\"test\",\"column_categories\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232183960],\"column_names\":[\"tag1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; + "{\"database\":\"test\",\"column_categories\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232183960],\"column_names\":[\"tag1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"db211\"}"; JsonObject result = RestUtils.insertTablet(httpClient, port, json); assertEquals(305, Integer.parseInt(result.get("code").toString())); assertEquals( @@ -332,7 +332,7 @@ public void rightInsertTablet(String json) { assertEquals(200, Integer.parseInt(result.get("code").toString())); JsonObject queryResult = RestUtils.query( - httpClient, port, sqlHandler("test", "select tag1,t1,s1 from sg211 order by time")); + httpClient, port, sqlHandler("test", "select tag1,t1,s1 from db211 order by time")); JsonArray jsonArray = queryResult.get("values").getAsJsonArray(); JsonArray jsonArray1 = jsonArray.get(0).getAsJsonArray(); assertEquals("a11", jsonArray1.get(0).getAsString()); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceInsertValuesIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceInsertValuesIT.java index d4c95063bab8e..cb38892dbce0b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceInsertValuesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceInsertValuesIT.java @@ -248,14 +248,14 @@ public void testUpdatingValues() { public void testInsertValuesWithSameTimestamp() { List sqls = Arrays.asList( - "create table sg3 (tag1 string tag, s2 double field, s1 double field)", - "insert into sg3(tag1,time,s2) values('d1',1,2)", - "insert into sg3(tag1,time,s1) values('d1',1,2)"); + "create table db3 (tag1 string tag, s2 double field, s1 double field)", + "insert into db3(tag1,time,s2) values('d1',1,2)", + "insert into db3(tag1,time,s1) values('d1',1,2)"); for (String sql : sqls) { nonQuery(sqlHandler("t1", sql)); } - JsonObject jsonObject = query(sqlHandler("t1", "select time, s1, s2 from sg3")); + JsonObject jsonObject = query(sqlHandler("t1", "select time, s1, s2 from db3")); JsonArray valuesList = jsonObject.getAsJsonArray("values"); for (int i = 0; i < valuesList.size(); i++) { JsonArray jsonArray = valuesList.get(i).getAsJsonArray(); @@ -310,12 +310,12 @@ public void testInsertWithDuplicatedMeasurements() { public void testInsertMultiRows() { nonQuery( - sqlHandler("t1", "create table sg8 (tag1 string tag, s1 int32 field, s2 int32 field)")); + sqlHandler("t1", "create table db8 (tag1 string tag, s1 int32 field, s2 int32 field)")); JsonObject jsonObject = nonQuery( sqlHandler( "t1", - "insert into sg8(tag1, time, s1, s2) values('d1', 10, 2, 2), ('d1', 11, 3, '3'), ('d1', 12,12.11,false)")); + "insert into db8(tag1, time, s1, s2) values('d1', 10, 2, 2), ('d1', 11, 3, '3'), ('d1', 12,12.11,false)")); assertEquals( "507: Fail to insert measurements [s1, s2] caused by [data type is not consistent, input 12.11, registered INT32, data type is not consistent, input false, registered INT32]", jsonObject.get("code") + ": " + jsonObject.get("message").getAsString()); @@ -323,12 +323,12 @@ public void testInsertMultiRows() { public void testInsertLargeNumber() { nonQuery( - sqlHandler("t1", "create table sg9 (tag1 string tag, s98 int64 field, s99 int64 field)")); + sqlHandler("t1", "create table db9 (tag1 string tag, s98 int64 field, s99 int64 field)")); JsonObject jsonObject = nonQuery( sqlHandler( "t1", - "insert into sg9(tag1, time, s98, s99) values('d1', 10, 2, 271840880000000000000000)")); + "insert into db9(tag1, time, s98, s99) values('d1', 10, 2, 271840880000000000000000)")); assertEquals( "700: line 1:59: Invalid numeric literal: 271840880000000000000000", jsonObject.get("code") + ": " + jsonObject.get("message").getAsString()); @@ -338,15 +338,15 @@ public void testExtendTextColumn() { List sqls = Arrays.asList( "use t1", - "create table sg14 (tag1 string tag, s1 string field, s2 string field)", - "insert into sg14(tag1,time,s1,s2) values('d1',1,'test','test')", - "insert into sg14(tag1,time,s1,s2) values('d1',3,'test','test')", - "insert into sg14(tag1,time,s1,s2) values('d1',3,'test','test')", - "insert into sg14(tag1,time,s1,s2) values('d1',4,'test','test')", - "insert into sg14(tag1,time,s1,s3) values('d1',5,'test','test')", - "insert into sg14(tag1,time,s1,s2) values('d1',6,'test','test')", + "create table db14 (tag1 string tag, s1 string field, s2 string field)", + "insert into db14(tag1,time,s1,s2) values('d1',1,'test','test')", + "insert into db14(tag1,time,s1,s2) values('d1',3,'test','test')", + "insert into db14(tag1,time,s1,s2) values('d1',3,'test','test')", + "insert into db14(tag1,time,s1,s2) values('d1',4,'test','test')", + "insert into db14(tag1,time,s1,s3) values('d1',5,'test','test')", + "insert into db14(tag1,time,s1,s2) values('d1',6,'test','test')", "flush", - "insert into sg14(tag1,time,s1,s3) values('d1',7,'test','test')"); + "insert into db14(tag1,time,s1,s3) values('d1',7,'test','test')"); try { for (String sql : sqls) { JsonObject jsonObject = new JsonObject(); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBInsertTableSessionPoolIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBInsertTableSessionPoolIT.java index c92d09b4dbba6..8ce6adb9a8212 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBInsertTableSessionPoolIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBInsertTableSessionPoolIT.java @@ -80,7 +80,7 @@ public void testPartialInsertTablet() { session.executeNonQueryStatement("use \"test\""); session.executeNonQueryStatement("SET CONFIGURATION enable_auto_create_schema='false'"); session.executeNonQueryStatement( - "create table sg6 (tag1 string tag, s1 int64 field, s2 int64 field)"); + "create table db6 (tag1 string tag, s1 int64 field, s2 int64 field)"); List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); @@ -133,7 +133,7 @@ public void testPartialInsertTablet() { } finally { session.executeNonQueryStatement("SET CONFIGURATION enable_auto_create_schema='false'"); } - try (SessionDataSet dataSet = session.executeQueryStatement("SELECT * FROM sg6")) { + try (SessionDataSet dataSet = session.executeQueryStatement("SELECT * FROM db6")) { assertEquals(4, dataSet.getColumnNames().size()); assertEquals("time", dataSet.getColumnNames().get(0)); assertEquals("tag1", dataSet.getColumnNames().get(1)); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionAlignedInsertIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionAlignedInsertIT.java index 2340cf3f326b2..351457957db27 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionAlignedInsertIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionAlignedInsertIT.java @@ -48,9 +48,9 @@ @Category({LocalStandaloneIT.class, ClusterIT.class}) public class IoTDBSessionAlignedInsertIT { - private static final String ROOT_SG1_D1_VECTOR1 = "root.sg_1.d1.vector"; - private static final String ROOT_SG1_D1 = "root.sg_1.d1"; - private static final String ROOT_SG1_D2 = "root.sg_1.d2"; + private static final String ROOT_DB1_D1_VECTOR1 = "root.db_1.d1.vector"; + private static final String ROOT_DB1_D1 = "root.db_1.d1"; + private static final String ROOT_DB1_D2 = "root.db_1.d2"; private static final double DELTA_DOUBLE = 1e-7d; @Before @@ -69,11 +69,11 @@ public void insertAlignedTabletTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { insertTabletWithAlignedTimeseriesMethod(session); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db_1.d1.vector"); assertEquals(dataSet.getColumnNames().size(), 3); assertEquals(dataSet.getColumnNames().get(0), "Time"); - assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s1"); - assertEquals(dataSet.getColumnNames().get(2), ROOT_SG1_D1_VECTOR1 + ".s2"); + assertEquals(dataSet.getColumnNames().get(1), ROOT_DB1_D1_VECTOR1 + ".s1"); + assertEquals(dataSet.getColumnNames().get(2), ROOT_DB1_D1_VECTOR1 + ".s2"); long time = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); @@ -116,12 +116,12 @@ private void insertAlignedRecord(ISession session, String deviceId) @Test public void insertAlignedRecordTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - insertAlignedRecord(session, ROOT_SG1_D1_VECTOR1); + insertAlignedRecord(session, ROOT_DB1_D1_VECTOR1); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); - assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s2"); + assertEquals(dataSet.getColumnNames().get(1), ROOT_DB1_D1_VECTOR1 + ".s2"); long time = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); @@ -140,12 +140,12 @@ public void insertAlignedRecordTest() { @Test public void insertAlignedStringRecordTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - insertAlignedStringRecord(session, ROOT_SG1_D1_VECTOR1); + insertAlignedStringRecord(session, ROOT_DB1_D1_VECTOR1); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); - assertEquals(ROOT_SG1_D1_VECTOR1 + ".s2", dataSet.getColumnNames().get(1)); + assertEquals(ROOT_DB1_D1_VECTOR1 + ".s2", dataSet.getColumnNames().get(1)); long time = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); @@ -164,12 +164,12 @@ public void insertAlignedStringRecordTest() { @Test public void insertAlignedStringRecordsTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - insertAlignedStringRecords(session, ROOT_SG1_D1_VECTOR1); + insertAlignedStringRecords(session, ROOT_DB1_D1_VECTOR1); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); - assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s2"); + assertEquals(dataSet.getColumnNames().get(1), ROOT_DB1_D1_VECTOR1 + ".s2"); long time = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); @@ -188,12 +188,12 @@ public void insertAlignedStringRecordsTest() { @Test public void insertAlignedRecordsTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - insertAlignedRecords(session, ROOT_SG1_D1_VECTOR1); + insertAlignedRecords(session, ROOT_DB1_D1_VECTOR1); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); - assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s2"); + assertEquals(dataSet.getColumnNames().get(1), ROOT_DB1_D1_VECTOR1 + ".s2"); long time = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); @@ -212,12 +212,12 @@ public void insertAlignedRecordsTest() { @Test public void insertAlignedRecordsOfOneDeviceTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - insertAlignedRecordsOfOneDevice(session, ROOT_SG1_D1_VECTOR1); + insertAlignedRecordsOfOneDevice(session, ROOT_DB1_D1_VECTOR1); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); - assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s2"); + assertEquals(dataSet.getColumnNames().get(1), ROOT_DB1_D1_VECTOR1 + ".s2"); long time = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); @@ -236,14 +236,14 @@ public void insertAlignedRecordsOfOneDeviceTest() { @Test public void nonAlignedSingleSelectTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - insertNonAlignedRecord(session, ROOT_SG1_D1); + insertNonAlignedRecord(session, ROOT_DB1_D1); insertTabletWithAlignedTimeseriesMethod(session); - insertNonAlignedRecord(session, ROOT_SG1_D2); + insertNonAlignedRecord(session, ROOT_DB1_D2); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); - assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s2"); + assertEquals(dataSet.getColumnNames().get(1), ROOT_DB1_D1_VECTOR1 + ".s2"); long time = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); @@ -262,15 +262,15 @@ public void nonAlignedSingleSelectTest() { @Test public void nonAlignedVectorSelectTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - insertNonAlignedRecord(session, ROOT_SG1_D1); + insertNonAlignedRecord(session, ROOT_DB1_D1); insertTabletWithAlignedTimeseriesMethod(session); - insertNonAlignedRecord(session, ROOT_SG1_D2); + insertNonAlignedRecord(session, ROOT_DB1_D2); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db_1.d1.vector"); assertEquals(3, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); - assertEquals(ROOT_SG1_D1_VECTOR1 + ".s1", dataSet.getColumnNames().get(1)); - assertEquals(ROOT_SG1_D1_VECTOR1 + ".s2", dataSet.getColumnNames().get(2)); + assertEquals(ROOT_DB1_D1_VECTOR1 + ".s1", dataSet.getColumnNames().get(1)); + assertEquals(ROOT_DB1_D1_VECTOR1 + ".s2", dataSet.getColumnNames().get(2)); long time = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); @@ -296,7 +296,7 @@ private void insertTabletWithAlignedTimeseriesMethod(ISession session) schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT32)); - Tablet tablet = new Tablet(ROOT_SG1_D1_VECTOR1, schemaList); + Tablet tablet = new Tablet(ROOT_DB1_D1_VECTOR1, schemaList); long timestamp = 0; for (long row = 0; row < 100; row++) { diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java index a456a05d0229f..8fa8a64fabec0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java @@ -85,11 +85,11 @@ public void insertByStrTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); createTimeseries(session); insertByStr(session); insertViaSQL(session); - queryByDevice(session, "root.sg1.d1"); + queryByDevice(session, "root.db1.d1"); } catch (Exception e) { e.printStackTrace(); @@ -99,7 +99,7 @@ public void insertByStrTest() { private void createTimeseries(ISession session) throws StatementExecutionException, IoTDBConnectionException { - createTimeseries(session, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + createTimeseries(session, Arrays.asList("root.db1.d1", "root.db1.d2")); } private void createTimeseries(ISession session, List deviceIds) @@ -116,7 +116,7 @@ private void createTimeseries(ISession session, List deviceIds) private void insertByStr(ISession session) throws IoTDBConnectionException, StatementExecutionException { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -134,7 +134,7 @@ private void insertByStr(ISession session) private void insertViaSQL(ISession session) throws IoTDBConnectionException, StatementExecutionException { session.executeNonQueryStatement( - "insert into root.sg1.d1(timestamp,s1, s2, s3) values(100, 1,2,3)"); + "insert into root.db1.d1(timestamp,s1, s2, s3) values(100, 1,2,3)"); } private void queryByDevice(ISession session, String deviceId) @@ -153,10 +153,10 @@ private void queryByDevice(ISession session, String deviceId) } switch (deviceId) { - case "root.sg1.d1": + case "root.db1.d1": assertEquals(101, count); break; - case "root.sg1.d2": + case "root.db1.d2": assertEquals(500, count); break; } @@ -168,10 +168,10 @@ private void queryByDevice(ISession session, String deviceId) public void insertByObjectTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); createTimeseries(session); - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); List types = new ArrayList<>(); measurements.add("s1"); @@ -184,30 +184,30 @@ public void insertByObjectTest() { // auth test try (ISession authSession = EnvFactory.getEnv().getSessionConnection("test", "test123123456")) { - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s1"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s2"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s1"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s2"); try { authSession.insertRecord(deviceId, 0, measurements, types, 1L, 2L, 3L); } catch (Exception e) { if (!e.getMessage() .contains( - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg1.d1.s3]")) { + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db1.d1.s3]")) { fail(e.getMessage()); } } - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s3"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s3"); try { authSession.insertRecord(deviceId, 0, measurements, types, 1L, 2L, 3L); } catch (Exception e) { if (!e.getMessage() .contains( - "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg1.d1.s1, root.sg1.d1.s2, root.sg1.d1.s3]")) { + "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db1.d1.s1, root.db1.d1.s2, root.db1.d1.s3]")) { fail(e.getMessage()); } } - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); try { authSession.insertRecord(deviceId, 0, measurements, types, 1L, 2L, 3L); } catch (Exception e) { @@ -226,10 +226,10 @@ public void insertByObjectTest() { } catch (Exception e) { fail(e.getMessage()); } - revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s1"); - revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s2"); - revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s3"); - revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); + revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s1"); + revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s2"); + revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s3"); + revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); revokeUserSeriesPrivilege("test", PrivilegeType.SYSTEM, "root.**"); for (long time = 0; time < 100; time++) { @@ -237,7 +237,7 @@ public void insertByObjectTest() { } insertViaSQL(session); - queryByDevice(session, "root.sg1.d1"); + queryByDevice(session, "root.db1.d1"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -249,11 +249,11 @@ public void insertByObjectTest() { public void alignByDeviceTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); createTimeseries(session); - insertTablet(session, "root.sg1.d1"); + insertTablet(session, "root.db1.d1"); SessionDataSet sessionDataSet = - session.executeQueryStatement("select s1 from root.sg1.d1 align by device"); + session.executeQueryStatement("select s1 from root.db1.d1 align by device"); sessionDataSet.setFetchSize(1024); int count = 0; @@ -264,7 +264,7 @@ public void alignByDeviceTest() { for (Field f : fields) { sb.append(f.getStringValue()).append(","); } - assertEquals("root.sg1.d1,0,", sb.toString()); + assertEquals("root.db1.d1,0,", sb.toString()); } assertEquals(100, count); sessionDataSet.closeOperationHandle(); @@ -446,13 +446,13 @@ public void testBatchInsertSeqAndUnseq() try (ISession session = EnvFactory.getEnv().getSessionConnection()) { createTimeseries(session); - insertTablet(session, "root.sg1.d1"); + insertTablet(session, "root.db1.d1"); session.executeNonQueryStatement("FLUSH"); - session.executeNonQueryStatement("FLUSH root.sg1"); + session.executeNonQueryStatement("FLUSH root.db1"); List deviceIds = new ArrayList<>(); - queryForBatch(Collections.singletonList("root.sg1.d1"), 400); + queryForBatch(Collections.singletonList("root.db1.d1"), 400); } catch (Exception e) { e.printStackTrace(); @@ -499,12 +499,12 @@ public void sessionClusterTest() { } try (ISession session = EnvFactory.getEnv().getSessionConnection(nodeList)) { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); createTimeseries(session); insertByStr(session); insertViaSQL(session); - queryByDevice(session, "root.sg1.d1"); + queryByDevice(session, "root.db1.d1"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -532,17 +532,17 @@ public void errorSessionClusterTest() { public void insertWithMultipleTimeSlotsTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - createTimeseries(session, Arrays.asList("root.sg1.d1", "root.sg1.d2")); - insertRecords(session, Arrays.asList("root.sg1.d1", "root.sg1.d2")); - queryForBatch(Arrays.asList("root.sg1.d1", "root.sg1.d2"), 400); + createTimeseries(session, Arrays.asList("root.db1.d1", "root.db1.d2")); + insertRecords(session, Arrays.asList("root.db1.d1", "root.db1.d2")); + queryForBatch(Arrays.asList("root.db1.d1", "root.db1.d2"), 400); - createTimeseries(session, Arrays.asList("root.sg2.d1", "root.sg2.d2")); - insertMultiTablets(session, Arrays.asList("root.sg2.d1", "root.sg2.d2")); - queryForBatch(Arrays.asList("root.sg2.d1", "root.sg2.d2"), 400); + createTimeseries(session, Arrays.asList("root.db2.d1", "root.db2.d2")); + insertMultiTablets(session, Arrays.asList("root.db2.d1", "root.db2.d2")); + queryForBatch(Arrays.asList("root.db2.d1", "root.db2.d2"), 400); - createTimeseries(session, Collections.singletonList("root.sg3.d1")); - insertRecordsOfOneDevice(session, "root.sg3.d1"); - queryForBatch(Collections.singletonList("root.sg3.d1"), 400); + createTimeseries(session, Collections.singletonList("root.db3.d1")); + insertRecordsOfOneDevice(session, "root.db3.d1"); + queryForBatch(Collections.singletonList("root.db3.d1"), 400); } catch (Exception e) { e.printStackTrace(); @@ -555,42 +555,42 @@ public void insertNotAutoCreateSchemaTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { session.executeNonQueryStatement("SET CONFIGURATION 'enable_auto_create_schema'='false'"); - session.createDatabase("root.sg1"); - session.createDatabase("root.sg2"); - session.createDatabase("root.sg3"); + session.createDatabase("root.db1"); + session.createDatabase("root.db2"); + session.createDatabase("root.db3"); try { - insertTablet(session, "root.sg1.d1"); + insertTablet(session, "root.db1.d1"); } catch (Exception e) { Assert.assertTrue( e.getMessage() != null - && e.getMessage().contains("Path [root.sg1.d1.s1] does not exist")); + && e.getMessage().contains("Path [root.db1.d1.s1] does not exist")); } try { - insertRecords(session, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertRecords(session, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { Assert.assertTrue( e.getMessage() != null - && e.getMessage().contains("Path [root.sg1.d2.s1] does not exist") - || e.getMessage().contains("Path [root.sg1.d1.s1] does not exist")); + && e.getMessage().contains("Path [root.db1.d2.s1] does not exist") + || e.getMessage().contains("Path [root.db1.d1.s1] does not exist")); } try { - insertMultiTablets(session, Arrays.asList("root.sg2.d1", "root.sg2.d2")); + insertMultiTablets(session, Arrays.asList("root.db2.d1", "root.db2.d2")); } catch (Exception e) { Assert.assertTrue( e.getMessage() != null - && e.getMessage().contains("Path [root.sg2.d2.s1] does not exist") - || e.getMessage().contains("Path [root.sg2.d1.s1] does not exist")); + && e.getMessage().contains("Path [root.db2.d2.s1] does not exist") + || e.getMessage().contains("Path [root.db2.d1.s1] does not exist")); } try { - insertRecordsOfOneDevice(session, "root.sg3.d1"); + insertRecordsOfOneDevice(session, "root.db3.d1"); } catch (Exception e) { Assert.assertTrue( e.getMessage() != null - && e.getMessage().contains("Path [root.sg3.d1.s1] does not exist")); + && e.getMessage().contains("Path [root.db3.d1.s1] does not exist")); } } catch (Exception e) { @@ -602,73 +602,73 @@ public void insertNotAutoCreateSchemaTest() { public void testAuth() { // auth test try (ISession authSession = EnvFactory.getEnv().getSessionConnection("test", "test123123456")) { - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s1"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s2"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d2.**"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d2.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s1"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s2"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d2.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d2.**"); try { - insertRecords(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertRecords(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { if (!e.getMessage() .contains( - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg1.d1.s3]")) { + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db1.d1.s3]")) { fail(e.getMessage()); } } try { - insertTablet(authSession, "root.sg1.d1"); + insertTablet(authSession, "root.db1.d1"); } catch (Exception e) { if (!e.getMessage() .contains( - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg1.d1.s3]")) { + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db1.d1.s3]")) { fail(e.getMessage()); } } try { - insertMultiTablets(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d1")); + insertMultiTablets(authSession, Arrays.asList("root.db1.d1", "root.db1.d1")); } catch (Exception e) { if (!e.getMessage() .contains( - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg1.d1.s3]")) { + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db1.d1.s3]")) { fail(e.getMessage()); } } - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s3"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s3"); try { - insertRecords(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertRecords(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { if (!e.getMessage() .contains( "No permissions for this operation, please add privilege WRITE_SCHEMA on ") - && !e.getMessage().contains("root.sg1.d1.s1") - && !e.getMessage().contains("root.sg1.d1.s2") - && !e.getMessage().contains("root.sg1.d1.s3")) { + && !e.getMessage().contains("root.db1.d1.s1") + && !e.getMessage().contains("root.db1.d1.s2") + && !e.getMessage().contains("root.db1.d1.s3")) { fail(e.getMessage()); } } try { - insertTablet(authSession, "root.sg1.d1"); + insertTablet(authSession, "root.db1.d1"); } catch (Exception e) { if (!e.getMessage() .contains( - "No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg1.d1.s1, root.sg1.d1.s2, root.sg1.d1.s3]")) { + "No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db1.d1.s1, root.db1.d1.s2, root.db1.d1.s3]")) { fail(e.getMessage()); } } try { - insertMultiTablets(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertMultiTablets(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { if (!e.getMessage() .contains( - "No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg1.d1.s1, root.sg1.d1.s2, root.sg1.d1.s3]")) { + "No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db1.d1.s1, root.db1.d1.s2, root.db1.d1.s3]")) { fail(e.getMessage()); } } - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); try { - insertRecords(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertRecords(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { if (!e.getMessage() .contains("No permissions for this operation, please add privilege SYSTEM")) { @@ -676,7 +676,7 @@ public void testAuth() { } } try { - insertTablet(authSession, "root.sg1.d1"); + insertTablet(authSession, "root.db1.d1"); } catch (Exception e) { if (!e.getMessage() .contains("No permissions for this operation, please add privilege SYSTEM")) { @@ -684,7 +684,7 @@ public void testAuth() { } } try { - insertMultiTablets(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertMultiTablets(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { if (!e.getMessage() .contains("No permissions for this operation, please add privilege SYSTEM")) { @@ -694,15 +694,15 @@ public void testAuth() { grantUserSystemPrivileges("test", PrivilegeType.SYSTEM); try { - insertRecords(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); - insertTablet(authSession, "root.sg1.d1"); - insertMultiTablets(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertRecords(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); + insertTablet(authSession, "root.db1.d1"); + insertMultiTablets(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { fail(e.getMessage()); } } catch (Exception e) { fail(e.getMessage()); } - executeNonQuery("drop timeseries root.sg1.d1.**, root.sg1.d2.**"); + executeNonQuery("drop timeseries root.db1.d1.**, root.db1.d2.**"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionDisableMemControlIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionDisableMemControlIT.java index a24e2c20c2615..d16349bc0acd7 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionDisableMemControlIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionDisableMemControlIT.java @@ -74,24 +74,24 @@ public void tearDown() throws Exception { @Test public void insertPartialTabletTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - if (!session.checkTimeseriesExists("root.sg.d.s1")) { + if (!session.checkTimeseriesExists("root.db.d.s1")) { session.createTimeseries( - "root.sg.d.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists("root.sg.d.s2")) { + if (!session.checkTimeseriesExists("root.db.d.s2")) { session.createTimeseries( - "root.sg.d.s2", TSDataType.DOUBLE, TSEncoding.GORILLA, CompressionType.SNAPPY); + "root.db.d.s2", TSDataType.DOUBLE, TSEncoding.GORILLA, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists("root.sg.d.s3")) { + if (!session.checkTimeseriesExists("root.db.d.s3")) { session.createTimeseries( - "root.sg.d.s3", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d.s3", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg.d", schemaList, 10); + Tablet tablet = new Tablet("root.db.d", schemaList, 10); long timestamp = System.currentTimeMillis(); @@ -107,7 +107,7 @@ public void insertPartialTabletTest() { } catch (StatementExecutionException e) { LOGGER.error(e.getMessage()); assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } @@ -120,13 +120,13 @@ public void insertPartialTabletTest() { } catch (StatementExecutionException e) { LOGGER.error(e.getMessage()); assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } SessionDataSet dataSet = - session.executeQueryStatement("select count(s1), count(s2), count(s3) from root.sg.d"); + session.executeQueryStatement("select count(s1), count(s2), count(s3) from root.db.d"); while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); assertEquals(15L, rowRecord.getFields().get(0).getLongV()); @@ -157,7 +157,7 @@ public void insertPartialAlignedTabletTest() { compressors.add(CompressionType.SNAPPY); } session.createAlignedTimeseries( - "root.sg.d", + "root.db.d", multiMeasurementComponents, dataTypes, encodings, @@ -170,7 +170,7 @@ public void insertPartialAlignedTabletTest() { schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg.d", schemaList, 10); + Tablet tablet = new Tablet("root.db.d", schemaList, 10); long timestamp = System.currentTimeMillis(); @@ -186,7 +186,7 @@ public void insertPartialAlignedTabletTest() { } catch (StatementExecutionException e) { LOGGER.error(e.getMessage()); assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } @@ -199,12 +199,12 @@ public void insertPartialAlignedTabletTest() { } catch (StatementExecutionException e) { LOGGER.error(e.getMessage()); assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } - SessionDataSet dataSet = session.executeQueryStatement("select s1, s2, s3 from root.sg.d"); + SessionDataSet dataSet = session.executeQueryStatement("select s1, s2, s3 from root.db.d"); while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); assertEquals(1, rowRecord.getFields().get(0).getLongV()); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionInsertNullIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionInsertNullIT.java index 5fdf733578f75..e1f73463c6edd 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionInsertNullIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionInsertNullIT.java @@ -72,21 +72,21 @@ public void tearDown() throws Exception { private void prepareData(ISession session) throws IoTDBConnectionException, StatementExecutionException { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); session.createTimeseries( - "root.sg1.clsu.d1.s1", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s1", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d1.s2", TSDataType.INT32, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s2", TSDataType.INT32, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d1.s3", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s3", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d1.s4", TSDataType.FLOAT, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s4", TSDataType.FLOAT, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d1.s5", TSDataType.DOUBLE, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s5", TSDataType.DOUBLE, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d1.s6", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s6", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d2.s1", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d2.s1", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); } private long queryCountRecords(ISession session, String sql) @@ -113,7 +113,7 @@ public void insertRecordNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId = "root.sg1.clsu.d1"; + String deviceId = "root.db1.clsu.d1"; session.insertRecord(deviceId, 100, Arrays.asList("s1"), Arrays.asList("true")); List t = new ArrayList<>(); t.add(null); @@ -149,7 +149,7 @@ public void insertAlignedRecordNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId = "root.sg1.clsu.aligned_d1"; + String deviceId = "root.db1.clsu.aligned_d1"; session.insertAlignedRecord(deviceId, 100, Arrays.asList("s1"), Arrays.asList("true")); List t = new ArrayList<>(); t.add(null); @@ -193,8 +193,8 @@ public void insertRecordsNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId1 = "root.sg1.clsu.d2"; - String deviceId2 = "root.sg1.clsu.d3"; + String deviceId1 = "root.db1.clsu.d2"; + String deviceId2 = "root.db1.clsu.d3"; session.insertRecords( Arrays.asList(deviceId1, deviceId2), Arrays.asList(300L, 300L), @@ -245,8 +245,8 @@ public void insertRecordsNullTest() { public void insertAlignedRecordsNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId1 = "root.sg1.clsu.aligned_d2"; - String deviceId2 = "root.sg1.clsu.aligned_d3"; + String deviceId1 = "root.db1.clsu.aligned_d2"; + String deviceId2 = "root.db1.clsu.aligned_d3"; session.insertAlignedRecords( Arrays.asList(deviceId1, deviceId2), Arrays.asList(300L, 300L), @@ -288,7 +288,7 @@ public void insertAlignedRecordsNullTest() { public void insertRecordsOfOneDeviceNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId1 = "root.sg1.clsu.InsertRecordsOfOneDevice"; + String deviceId1 = "root.db1.clsu.InsertRecordsOfOneDevice"; session.insertRecordsOfOneDevice( deviceId1, Arrays.asList(300L, 301L), @@ -327,7 +327,7 @@ public void insertRecordsOfOneDeviceNullTest() { public void insertAlignedRecordsOfOneDeviceNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId1 = "root.sg1.clsu.InsertAlignedRecordsOfOneDevice"; + String deviceId1 = "root.db1.clsu.InsertAlignedRecordsOfOneDevice"; session.insertAlignedRecordsOfOneDevice( deviceId1, Arrays.asList(300L, 301L), @@ -367,7 +367,7 @@ public void insertTabletNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId = "root.sg1.clsu.d1"; + String deviceId = "root.db1.clsu.d1"; Tablet tablet = new Tablet( deviceId, @@ -401,7 +401,7 @@ public void insertAlignedTabletNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId = "root.sg1.clsu.aligned_d1"; + String deviceId = "root.db1.clsu.aligned_d1"; Tablet tablet = new Tablet( deviceId, @@ -435,7 +435,7 @@ public void insertAlignedTabletNullTest() { + File.separator + "sequence" + File.separator - + "root.sg1" + + "root.db1" + File.separator + "1" + File.separator @@ -458,7 +458,7 @@ public void insertAlignedTabletNullTest() { @Test public void insertTabletNullMeasurementTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.clsu.aligned_d1"; + String deviceId = "root.db1.clsu.aligned_d1"; Tablet tablet = new Tablet( deviceId, @@ -476,7 +476,7 @@ public void insertTabletNullMeasurementTest() { } try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.clsu.aligned_d1"; + String deviceId = "root.db1.clsu.aligned_d1"; Tablet tablet = new Tablet( deviceId, @@ -494,7 +494,7 @@ public void insertTabletNullMeasurementTest() { } try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.clsu.aligned_d1"; + String deviceId = "root.db1.clsu.aligned_d1"; Tablet tablet = new Tablet( deviceId, diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionQueryIT.java index ba5c22ab9969e..54ebef938868d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionQueryIT.java @@ -87,7 +87,7 @@ public void rawDataQueryWithTimeRangeTest1() throws IoTDBConnectionException { "34,null,null,aligned_test34", }; - List columnNames = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"); + List columnNames = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { try (SessionDataSet resultSet = session.executeRawDataQuery(columnNames, 16, 35)) { @@ -126,12 +126,12 @@ public void rawDataQueryWithTimeRangeTest2() throws IoTDBConnectionException { List columnNames = Arrays.asList( - "root.sg1.d2.s5", - "root.sg1.d1.s4", - "root.sg1.d2.s1", - "root.sg1.d1.s5", - "root.sg1.d2.s4", - "root.sg1.d1.s1"); + "root.db1.d2.s5", + "root.db1.d1.s4", + "root.db1.d2.s1", + "root.db1.d1.s5", + "root.db1.d2.s4", + "root.db1.d1.s1"); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { try (SessionDataSet resultSet = session.executeRawDataQuery(columnNames, 16, 35)) { @@ -149,9 +149,9 @@ public void rawDataQueryWithTimeRangeTest2() throws IoTDBConnectionException { @Test public void lastQueryTest() throws IoTDBConnectionException { - String[] retArray = new String[] {"23,root.sg1.d1.s1,230000.0,FLOAT"}; + String[] retArray = new String[] {"23,root.db1.d1.s1,230000.0,FLOAT"}; - List selectedPaths = Collections.singletonList("root.sg1.d1.s1"); + List selectedPaths = Collections.singletonList("root.db1.d1.s1"); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { try (SessionDataSet resultSet = session.executeLastDataQuery(selectedPaths)) { @@ -167,7 +167,7 @@ public void lastQueryTest() throws IoTDBConnectionException { public void lastQueryWithLastTimeTest() throws IoTDBConnectionException { String[] retArray = new String[] {}; - List selectedPaths = Collections.singletonList("root.sg1.d1.s1"); + List selectedPaths = Collections.singletonList("root.db1.d1.s1"); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { try (SessionDataSet resultSet = session.executeLastDataQuery(selectedPaths, 30)) { @@ -181,19 +181,19 @@ public void lastQueryWithLastTimeTest() throws IoTDBConnectionException { @Test public void lastQueryForOneDevice() throws IoTDBConnectionException { - String[] retArray = new String[] {"23,root.sg1.d1.s1,230000.0,FLOAT"}; + String[] retArray = new String[] {"23,root.db1.d1.s1,230000.0,FLOAT"}; try (ISession session = EnvFactory.getEnv().getSessionConnection()) { // first time, cache miss try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.d1", Collections.singletonList("s1"), true)) { + "root.db1", "root.db1.d1", Collections.singletonList("s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray, true); } // second time, cache hit try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.d1", Collections.singletonList("s1"), true)) { + "root.db1", "root.db1.d1", Collections.singletonList("s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray, true); } } catch (StatementExecutionException e) { @@ -205,37 +205,37 @@ public void lastQueryForOneDevice() throws IoTDBConnectionException { @Test public void lastQueryForOneDeviceNoSchema() throws IoTDBConnectionException { String[] retArray = new String[] {}; - String[] retArray2 = new String[] {"23,root.sg1.d1.s1,230000.0,FLOAT"}; + String[] retArray2 = new String[] {"23,root.db1.d1.s1,230000.0,FLOAT"}; try (ISession session = EnvFactory.getEnv().getSessionConnection()) { // database has no schema try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1.d1", "root.sg1.d1", Collections.singletonList("s1"), true)) { + "root.db1.d1", "root.db1.d1", Collections.singletonList("s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray, true); } // device has no schema try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.noThisDevice", Collections.singletonList("s1"), true)) { + "root.db1", "root.db1.noThisDevice", Collections.singletonList("s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray, true); } // sensor has no schema try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.d1", Collections.singletonList("notExist"), true)) { + "root.db1", "root.db1.d1", Collections.singletonList("notExist"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray, true); } // some sensor has no schema try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.d1", Arrays.asList("notExist", "s1"), true)) { + "root.db1", "root.db1.d1", Arrays.asList("notExist", "s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray2, true); } try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.d1", Arrays.asList("notExist", "s1"), true)) { + "root.db1", "root.db1.d1", Arrays.asList("notExist", "s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray2, true); } } catch (StatementExecutionException e) { @@ -250,11 +250,11 @@ public void aggregationQueryTest() { String[] retArray = new String[] {"0,20,29,28,19,20"}; List paths = Arrays.asList( - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5"); + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5"); List aggregations = Collections.nCopies(paths.size(), TAggregationType.COUNT); List columnNames = new ArrayList<>(); @@ -277,11 +277,11 @@ public void aggregationQueryWithTimeRangeTest() { String[] retArray = new String[] {"0,12,15,22,13,6"}; List paths = Arrays.asList( - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5"); + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5"); List aggregations = Collections.nCopies(paths.size(), TAggregationType.COUNT); List columnNames = new ArrayList<>(); @@ -304,7 +304,7 @@ public void aggregationQueryWithTimeRangeTest() { public void groupByQueryTest1() { String[] retArray = new String[] {"11,10,130142.0,13014.2", "21,1,null,230000.0", "31,0,355.0,null"}; - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s1"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s1"); List aggregations = Arrays.asList(TAggregationType.COUNT, TAggregationType.SUM, TAggregationType.AVG); @@ -336,7 +336,7 @@ public void groupByQueryTest2() { "31,0,130.0,null", "37,0,154.0,null" }; - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s1"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s1"); List aggregations = Arrays.asList(TAggregationType.COUNT, TAggregationType.SUM, TAggregationType.AVG); @@ -369,7 +369,7 @@ public void groupByQueryTest3() { "31,0,355.0,null", "36,0,190.0,null" }; - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s1"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s1"); List aggregations = Arrays.asList(TAggregationType.COUNT, TAggregationType.SUM, TAggregationType.AVG); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java index ef7bffdb9f06a..b0dc9aced7200 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java @@ -90,16 +90,16 @@ public void testCreateFlatTemplate() List compressors = Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY, CompressionType.LZ4); - session.setStorageGroup("root.sg"); + session.setStorageGroup("root.db"); session.createSchemaTemplate(tempName, measurements, dataTypes, encodings, compressors, true); - session.setSchemaTemplate("flatTemplate", "root.sg.d0"); + session.setSchemaTemplate("flatTemplate", "root.db.d0"); try { - session.setSchemaTemplate("flatTemplate", "root.sg.d0"); + session.setSchemaTemplate("flatTemplate", "root.db.d0"); fail(); } catch (StatementExecutionException e) { assertEquals( - TSStatusCode.METADATA_ERROR.getStatusCode() + ": Template already exists on root.sg.d0", + TSStatusCode.METADATA_ERROR.getStatusCode() + ": Template already exists on root.db.d0", e.getMessage()); } } @@ -107,7 +107,7 @@ public void testCreateFlatTemplate() @Test public void testShowTemplates() throws StatementExecutionException, IoTDBConnectionException, IOException { - session.setStorageGroup("root.sg"); + session.setStorageGroup("root.db"); Template temp1 = getTemplate("template1"); Template temp2 = getTemplate("template2"); @@ -121,68 +121,68 @@ public void testShowTemplates() new HashSet<>(Arrays.asList("template1", "template2")), new HashSet<>(session.showAllTemplates())); - session.setSchemaTemplate("template1", "root.sg.v1"); - session.setSchemaTemplate("template1", "root.sg.v2"); - session.setSchemaTemplate("template1", "root.sg.v3"); + session.setSchemaTemplate("template1", "root.db.v1"); + session.setSchemaTemplate("template1", "root.db.v2"); + session.setSchemaTemplate("template1", "root.db.v3"); assertEquals( - new HashSet<>(Arrays.asList("root.sg.v1", "root.sg.v2", "root.sg.v3")), + new HashSet<>(Arrays.asList("root.db.v1", "root.db.v2", "root.db.v3")), new HashSet<>(session.showPathsTemplateSetOn("template1"))); assertEquals( new HashSet<>(Collections.emptyList()), new HashSet<>(session.showPathsTemplateUsingOn("template1"))); - session.setSchemaTemplate("template2", "root.sg.v4"); - session.setSchemaTemplate("template2", "root.sg.v5"); - session.setSchemaTemplate("template2", "root.sg.v6"); + session.setSchemaTemplate("template2", "root.db.v4"); + session.setSchemaTemplate("template2", "root.db.v5"); + session.setSchemaTemplate("template2", "root.db.v6"); assertEquals( - new HashSet<>(Arrays.asList("root.sg.v4", "root.sg.v5", "root.sg.v6")), + new HashSet<>(Arrays.asList("root.db.v4", "root.db.v5", "root.db.v6")), new HashSet<>(session.showPathsTemplateSetOn("template2"))); assertEquals( new HashSet<>( Arrays.asList( - "root.sg.v1", - "root.sg.v2", - "root.sg.v3", - "root.sg.v4", - "root.sg.v5", - "root.sg.v6")), + "root.db.v1", + "root.db.v2", + "root.db.v3", + "root.db.v4", + "root.db.v5", + "root.db.v6")), new HashSet<>(session.showPathsTemplateSetOn("*"))); session.insertRecord( - "root.sg.v1.GPS", + "root.db.v1.GPS", 110L, Collections.singletonList("x"), Collections.singletonList(TSDataType.FLOAT), Collections.singletonList(1.0f)); assertEquals( - new HashSet<>(Collections.singletonList("root.sg.v1.GPS")), + new HashSet<>(Collections.singletonList("root.db.v1.GPS")), new HashSet<>(session.showPathsTemplateUsingOn("template1"))); session.insertRecord( - "root.sg.v5.GPS", + "root.db.v5.GPS", 110L, Collections.singletonList("x"), Collections.singletonList(TSDataType.FLOAT), Collections.singletonList(1.0f)); assertEquals( - new HashSet<>(Collections.singletonList("root.sg.v1.GPS")), + new HashSet<>(Collections.singletonList("root.db.v1.GPS")), new HashSet<>(session.showPathsTemplateUsingOn("template1"))); assertEquals( - new HashSet<>(Collections.singletonList("root.sg.v5.GPS")), + new HashSet<>(Collections.singletonList("root.db.v5.GPS")), new HashSet<>(session.showPathsTemplateUsingOn("template2"))); } @Test public void testDropTemplate() throws StatementExecutionException, IoTDBConnectionException, IOException { - session.setStorageGroup("root.sg"); + session.setStorageGroup("root.db"); Template temp1 = getTemplate("template1"); @@ -204,7 +204,7 @@ public void testDropTemplate() session.dropSchemaTemplate("template1"); session.createSchemaTemplate(temp1); - session.setSchemaTemplate("template1", "root.sg.v1"); + session.setSchemaTemplate("template1", "root.db.v1"); try { session.dropSchemaTemplate("template1"); @@ -216,7 +216,7 @@ public void testDropTemplate() e.getMessage()); } - session.unsetSchemaTemplate("root.sg.v1", "template1"); + session.unsetSchemaTemplate("root.db.v1", "template1"); session.dropSchemaTemplate("template1"); session.createSchemaTemplate(temp1); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java index 38f6345bae5d1..225140a4e0eaa 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java @@ -92,7 +92,7 @@ public class IoTDBSessionSimpleIT { private static Logger LOGGER = LoggerFactory.getLogger(IoTDBSessionSimpleIT.class); - private static final String[] databasesToClear = new String[] {"root.sg", "root.sg1"}; + private static final String[] databasesToClear = new String[] {"root.db", "root.db1"}; @BeforeClass public static void setUpClass() throws Exception { @@ -124,7 +124,7 @@ public void insertPartialTabletTest() { schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg.d", schemaList, 10); + Tablet tablet = new Tablet("root.db.d", schemaList, 10); long timestamp = System.currentTimeMillis(); @@ -163,21 +163,21 @@ public void insertPartialTabletTest() { public void insertPartialTabletsTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { session.createTimeseries( - "root.sg.d2.s2", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db.d2.s2", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet1 = new Tablet("root.sg.d1", schemaList, 10); - Tablet tablet2 = new Tablet("root.sg.d2", schemaList, 10); - Tablet tablet3 = new Tablet("root.sg.d3", schemaList, 10); + Tablet tablet1 = new Tablet("root.db.d1", schemaList, 10); + Tablet tablet2 = new Tablet("root.db.d2", schemaList, 10); + Tablet tablet3 = new Tablet("root.db.d3", schemaList, 10); Map tabletMap = new HashMap<>(); - tabletMap.put("root.sg.d1", tablet1); - tabletMap.put("root.sg.d2", tablet2); - tabletMap.put("root.sg.d3", tablet3); + tabletMap.put("root.db.d1", tablet1); + tabletMap.put("root.db.d2", tablet2); + tabletMap.put("root.db.d3", tablet3); long timestamp = System.currentTimeMillis(); @@ -217,7 +217,7 @@ public void insertPartialTabletsTest() { } fail(); } catch (Exception e) { - assertTrue(e.getMessage().contains("data type of root.sg.d2.s2 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d2.s2 is not consistent")); } } @@ -225,7 +225,7 @@ public void insertPartialTabletsTest() { @Category({LocalStandaloneIT.class, ClusterIT.class}) public void insertByStrAndInferTypeTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -246,7 +246,7 @@ public void insertByStrAndInferTypeTest() { expected.add(TSDataType.TEXT.name()); Set actual = new HashSet<>(); - SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.sg1.**"); + SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.db1.**"); while (dataSet.hasNext()) { actual.add(dataSet.next().getFields().get(3).getStringValue()); } @@ -262,7 +262,7 @@ public void insertByStrAndInferTypeTest() { @Category({LocalStandaloneIT.class, ClusterIT.class}) public void insertWrongPathByStrAndInferTypeTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1..d1"; + String deviceId = "root.db1..d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -293,7 +293,7 @@ public void insertWrongPathByStrAndInferTypeTest() { @Category({LocalStandaloneIT.class, ClusterIT.class}) public void insertIntoIllegalTimeseriesTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1\n"; + String deviceId = "root.db1.d1\n"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -324,7 +324,7 @@ public void insertIntoIllegalTimeseriesTest() { @Category({LocalStandaloneIT.class, ClusterIT.class}) public void insertByObjAndNotInferTypeTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -351,7 +351,7 @@ public void insertByObjAndNotInferTypeTest() { expected.add(TSDataType.TEXT.name()); Set actual = new HashSet<>(); - SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.sg1.**"); + SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.db1.**"); while (dataSet.hasNext()) { actual.add(dataSet.next().getFields().get(3).getStringValue()); } @@ -368,8 +368,8 @@ public void insertByObjAndNotInferTypeTest() { public void createMultiTimeseriesTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { List paths = new ArrayList<>(); - paths.add("root.sg1.d1.s1"); - paths.add("root.sg1.d1.s2"); + paths.add("root.db1.d1.s1"); + paths.add("root.db1.d1.s2"); List tsDataTypes = new ArrayList<>(); tsDataTypes.add(TSDataType.DOUBLE); tsDataTypes.add(TSDataType.DOUBLE); @@ -389,8 +389,8 @@ public void createMultiTimeseriesTest() { session.createMultiTimeseries( paths, tsDataTypes, tsEncodings, compressionTypes, null, tagsList, null, null); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.s1")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.s2")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.s1")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.s2")); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -457,7 +457,7 @@ public void insertTabletWithAlignedTimeseriesTest() { schemaList.add(new MeasurementSchema("s2", TSDataType.INT32)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); long timestamp = System.currentTimeMillis(); for (long row = 0; row < 10; row++) { @@ -504,7 +504,7 @@ public void insertTabletWithNullValuesTest() throws InterruptedException { schemaList.add(new MeasurementSchema("s4", TSDataType.BOOLEAN, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s5", TSDataType.TEXT, TSEncoding.RLE)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); for (long time = 0; time < 10; time++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, time); @@ -537,7 +537,7 @@ public void insertTabletWithNullValuesTest() throws InterruptedException { assertEquals(9L, field.getLongV()); } } - dataSet = session.executeQueryStatement("select s3 from root.sg1.d1"); + dataSet = session.executeQueryStatement("select s3 from root.db1.d1"); int result = 0; assertTrue(dataSet.hasNext()); while (dataSet.hasNext()) { @@ -558,7 +558,7 @@ public void insertTabletWithNullValuesTest() throws InterruptedException { TestUtils.stopForciblyAndRestartDataNodes(); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - SessionDataSet dataSet = session.executeQueryStatement("select s3 from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select s3 from root.db1.d1"); int result = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); @@ -588,7 +588,7 @@ public void insertTabletWithStringValuesTest() { schemaList.add(new MeasurementSchema("s5", TSDataType.TEXT, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s6", TSDataType.TEXT, TSEncoding.RLE)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); for (long time = 0; time < 10; time++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, time); @@ -610,14 +610,14 @@ public void insertTabletWithStringValuesTest() { tablet.reset(); } - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db1.d1"); while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); List fields = rowRecord.getFields(); // this test may occasionally fail by IndexOutOfBoundsException if (fields.size() != 7) { SessionDataSet showTimeseriesDataSet = - session.executeQueryStatement("show timeseries root.sg1.d1.*"); + session.executeQueryStatement("show timeseries root.db1.d1.*"); LOGGER.error("show timeseries result:"); while (showTimeseriesDataSet.hasNext()) { RowRecord row = showTimeseriesDataSet.next(); @@ -646,7 +646,7 @@ public void insertTabletWithNegativeTimestampTest() { schemaList.add(new MeasurementSchema("s5", TSDataType.TEXT, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s6", TSDataType.TEXT, TSEncoding.RLE)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); for (long time = 0; time < 10; time++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, -time); @@ -668,7 +668,7 @@ public void insertTabletWithNegativeTimestampTest() { tablet.reset(); } - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db1.d1"); long count = 0L; while (dataSet.hasNext()) { count++; @@ -694,7 +694,7 @@ public void insertTabletWithWrongTimestampPrecisionTest() { schemaList.add(new MeasurementSchema("s5", TSDataType.TEXT, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s6", TSDataType.TEXT, TSEncoding.RLE)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); for (long time = 1694689856546000000L; time < 1694689856546000010L; time++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, time); @@ -729,7 +729,7 @@ public void insertTabletWithDuplicatedMeasurementsTest() { schemaList.add(new MeasurementSchema("s0", TSDataType.DOUBLE, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s0", TSDataType.DOUBLE, TSEncoding.RLE)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); for (long time = 0L; time < 10L; time++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, time); @@ -757,11 +757,11 @@ public void createTimeSeriesWithDoubleTicksTest() { session.close(); return; } - String database = "root.sg"; + String database = "root.db"; session.setStorageGroup(database); session.createTimeseries( - "root.sg.`my.device.with.colon:`.s", + "root.db.`my.device.with.colon:`.s", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); @@ -785,12 +785,12 @@ public void createWrongTimeSeriesTest() { session.close(); return; } - String database = "root.sg"; + String database = "root.db"; session.setStorageGroup(database); try { session.createTimeseries( - "root.sg.d1..s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d1..s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } catch (IoTDBConnectionException | StatementExecutionException e) { LOGGER.error("", e); } @@ -801,7 +801,7 @@ public void createWrongTimeSeriesTest() { LOGGER.error("", e); } - final SessionDataSet dataSet = session.executeQueryStatement("SHOW TIMESERIES root.sg.**"); + final SessionDataSet dataSet = session.executeQueryStatement("SHOW TIMESERIES root.db.**"); assertFalse(dataSet.hasNext()); session.deleteDatabase(database); @@ -816,16 +816,16 @@ public void createWrongTimeSeriesTest() { public void deleteNonExistTimeSeriesTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { session.insertRecord( - "root.sg1.d1", 0, Arrays.asList("t1", "t2", "t3"), Arrays.asList("123", "333", "444")); + "root.db1.d1", 0, Arrays.asList("t1", "t2", "t3"), Arrays.asList("123", "333", "444")); try { session.deleteTimeseries( - Arrays.asList("root.sg1.d1.t6", "root.sg1.d1.t2", "root.sg1.d1.t3")); + Arrays.asList("root.db1.d1.t6", "root.db1.d1.t2", "root.db1.d1.t3")); } catch (BatchExecutionException e) { - assertTrue(e.getMessage().contains("Path [root.sg1.d1.t6] does not exist;")); + assertTrue(e.getMessage().contains("Path [root.db1.d1.t6] does not exist;")); } - assertTrue(session.checkTimeseriesExists("root.sg1.d1.t1")); - assertFalse(session.checkTimeseriesExists("root.sg1.d1.t2")); - assertFalse(session.checkTimeseriesExists("root.sg1.d1.t3")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.t1")); + assertFalse(session.checkTimeseriesExists("root.db1.d1.t2")); + assertFalse(session.checkTimeseriesExists("root.db1.d1.t3")); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -877,7 +877,7 @@ public void insertOneDeviceRecordsTest() { TSDataType.BOOLEAN, 5.0f, Boolean.TRUE); - session.insertRecordsOfOneDevice("root.sg.d1", times, measurements, datatypes, values); + session.insertRecordsOfOneDevice("root.db.d1", times, measurements, datatypes, values); checkResult(session); } catch (Exception e) { e.printStackTrace(); @@ -914,17 +914,17 @@ private void addLine( private void checkResult(ISession session) throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db.d1"); dataSet.getColumnNames(); assertArrayEquals( dataSet.getColumnNames().toArray(new String[0]), new String[] { "Time", - "root.sg.d1.s3", - "root.sg.d1.s4", - "root.sg.d1.s5", - "root.sg.d1.s1", - "root.sg.d1.s2" + "root.db.d1.s3", + "root.db.d1.s4", + "root.db.d1.s5", + "root.db.d1.s1", + "root.db.d1.s2" }); assertArrayEquals( dataSet.getColumnTypes().toArray(new String[0]), @@ -1017,7 +1017,7 @@ public void insertOneDeviceRecordsWithOrderTest() { 1, 2); - session.insertRecordsOfOneDevice("root.sg.d1", times, measurements, datatypes, values, true); + session.insertRecordsOfOneDevice("root.db.d1", times, measurements, datatypes, values, true); checkResult(session); } catch (Exception e) { e.printStackTrace(); @@ -1071,7 +1071,7 @@ public void insertOneDeviceRecordsWithIncorrectOrderTest() { 5.0f, Boolean.TRUE); - session.insertRecordsOfOneDevice("root.sg.d1", times, measurements, datatypes, values, true); + session.insertRecordsOfOneDevice("root.db.d1", times, measurements, datatypes, values, true); checkResult(session); } catch (Exception e) { e.printStackTrace(); @@ -1124,7 +1124,7 @@ public void insertOneDeviceRecordsWithDuplicatedMeasurementsTest() { TSDataType.BOOLEAN, 5.0f, Boolean.TRUE); - session.insertRecordsOfOneDevice("root.sg.d1", times, measurements, datatypes, values); + session.insertRecordsOfOneDevice("root.db.d1", times, measurements, datatypes, values); } catch (Exception e) { assertTrue(e.getMessage().contains("Insertion contains duplicated measurement: s2")); } @@ -1140,7 +1140,7 @@ public void insertRecordsWithDuplicatedMeasurementsTest() { List> values = new ArrayList<>(); List devices = new ArrayList<>(); - devices.add("root.sg.d1"); + devices.add("root.db.d1"); addLine( times, measurements, @@ -1153,7 +1153,7 @@ public void insertRecordsWithDuplicatedMeasurementsTest() { TSDataType.INT32, 1, 2); - devices.add("root.sg.d2"); + devices.add("root.db.d2"); addLine( times, measurements, @@ -1166,7 +1166,7 @@ public void insertRecordsWithDuplicatedMeasurementsTest() { TSDataType.INT32, 3, 4); - devices.add("root.sg.d3"); + devices.add("root.db.d3"); addLine( times, measurements, @@ -1196,7 +1196,7 @@ public void insertRecordsWithExpiredDataTest() List> values = new ArrayList<>(); List devices = new ArrayList<>(); - devices.add("root.sg.d1"); + devices.add("root.db.d1"); addLine( times, measurements, @@ -1209,15 +1209,15 @@ public void insertRecordsWithExpiredDataTest() TSDataType.INT32, 1, 2); - session.executeNonQueryStatement("set ttl to root.sg.d1 1"); + session.executeNonQueryStatement("set ttl to root.db.d1 1"); try { session.insertRecords(devices, times, measurements, datatypes, values); fail(); } catch (Exception e) { assertTrue(e.getMessage().contains("less than ttl time bound")); } - session.executeNonQueryStatement("unset ttl to root.sg.d1"); - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg.d1"); + session.executeNonQueryStatement("unset ttl to root.db.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db.d1"); assertFalse(dataSet.hasNext()); } } @@ -1234,7 +1234,7 @@ public void insertStringRecordsOfOneDeviceWithOrderTest() { addStringLine(times, measurements, values, 2L, "s2", "s3", "3", "4"); addStringLine(times, measurements, values, 3L, "s1", "s2", "false", "6"); - session.insertStringRecordsOfOneDevice("root.sg.d1", times, measurements, values, true); + session.insertStringRecordsOfOneDevice("root.db.d1", times, measurements, values, true); checkResultForInsertStringRecordsOfOneDevice(session); } catch (Exception e) { e.printStackTrace(); @@ -1244,17 +1244,17 @@ public void insertStringRecordsOfOneDeviceWithOrderTest() { private void checkResultForInsertStringRecordsOfOneDevice(ISession session) throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db.d1"); dataSet.getColumnNames(); assertArrayEquals( dataSet.getColumnNames().toArray(new String[0]), new String[] { "Time", - "root.sg.d1.s3", - "root.sg.d1.s4", - "root.sg.d1.s5", - "root.sg.d1.s1", - "root.sg.d1.s2" + "root.db.d1.s3", + "root.db.d1.s4", + "root.db.d1.s5", + "root.db.d1.s1", + "root.db.d1.s2" }); assertArrayEquals( dataSet.getColumnTypes().toArray(new String[0]), @@ -1330,7 +1330,7 @@ public void insertStringRecordsOfOneDeviceWithIncorrectOrderTest() { addStringLine(times, measurements, values, 1L, "s4", "s5", "5.0", "true"); addStringLine(times, measurements, values, 3L, "s1", "s2", "false", "6"); - session.insertStringRecordsOfOneDevice("root.sg.d1", times, measurements, values); + session.insertStringRecordsOfOneDevice("root.db.d1", times, measurements, values); checkResultForInsertStringRecordsOfOneDevice(session); } catch (Exception e) { e.printStackTrace(); @@ -1351,7 +1351,7 @@ public void insertAlignedStringRecordsOfOneDeviceWithOrderTest() { addStringLine(times, measurements, values, 3L, "s1", "s2", "false", "6"); session.insertAlignedStringRecordsOfOneDevice( - "root.sg.d1", times, measurements, values, true); + "root.db.d1", times, measurements, values, true); checkResultForInsertStringRecordsOfOneDevice(session); } catch (Exception e) { e.printStackTrace(); @@ -1371,7 +1371,7 @@ public void insertAlignedStringRecordsOfOneDeviceWithIncorrectOrderTest() { addStringLine(times, measurements, values, 1L, "s4", "s5", "5.0", "true"); addStringLine(times, measurements, values, 3L, "s1", "s2", "false", "6"); - session.insertAlignedStringRecordsOfOneDevice("root.sg.d1", times, measurements, values); + session.insertAlignedStringRecordsOfOneDevice("root.db.d1", times, measurements, values); checkResultForInsertStringRecordsOfOneDevice(session); } catch (Exception e) { e.printStackTrace(); @@ -1384,8 +1384,8 @@ public void insertAlignedStringRecordsOfOneDeviceWithIncorrectOrderTest() { public void insertIllegalPathTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { String msg = "[%s] Exception occurred: %s failed. %s is not a legal path"; - String deviceId = "root.sg..d1"; - List deviceIds = Arrays.asList("root.sg..d1", "root.sg.d2"); + String deviceId = "root.db..d1"; + List deviceIds = Arrays.asList("root.db..d1", "root.db.d2"); List timestamps = Arrays.asList(1L, 1L); List measurements = Arrays.asList("s1", "s2", "s3"); List> allMeasurements = Arrays.asList(measurements, measurements); @@ -1519,14 +1519,14 @@ public void insertIllegalPathTest() { 5); Tablet tablet2 = new Tablet( - "root.sg.d2", + "root.db.d2", Arrays.asList( new MeasurementSchema("s1", TSDataType.INT32), new MeasurementSchema("s2", TSDataType.FLOAT)), 5); HashMap tablets = new HashMap<>(); tablets.put(deviceId, tablet1); - tablets.put("root.sg.d2", tablet2); + tablets.put("root.db.d2", tablet2); long ts = 16L; for (long row = 0; row < 8; row++) { int row1 = tablet1.getRowSize(); @@ -1554,22 +1554,19 @@ public void insertIllegalPathTest() { } try { - session.setStorageGroup("root..sg"); + session.setStorageGroup("root..db"); fail("Exception expected"); } catch (StatementExecutionException e) { assertTrue( e.getMessage() .contains( String.format( - msg, - TSStatusCode.ILLEGAL_PATH, - OperationType.SET_STORAGE_GROUP, - "root..sg"))); + msg, TSStatusCode.ILLEGAL_PATH, OperationType.SET_DATABASE, "root..sg"))); } try { session.createTimeseries( - "root.sg..d1.s1", TSDataType.INT32, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db..d1.s1", TSDataType.INT32, TSEncoding.PLAIN, CompressionType.SNAPPY); fail("Exception expected"); } catch (StatementExecutionException e) { assertTrue( @@ -1579,7 +1576,7 @@ public void insertIllegalPathTest() { msg, TSStatusCode.ILLEGAL_PATH, OperationType.CREATE_TIMESERIES, - "root.sg..d1.s1"))); + "root.db..d1.s1"))); } try { @@ -1607,7 +1604,7 @@ public void insertIllegalPathTest() { try { session.createMultiTimeseries( - Arrays.asList("root.sg.d1..s1", "root.sg.d1.s2", "root.sg.d1.s3"), + Arrays.asList("root.db.d1..s1", "root.db.d1.s2", "root.db.d1.s3"), tsDataTypes, tsEncodings, compressionTypes, @@ -1624,11 +1621,11 @@ public void insertIllegalPathTest() { msg, TSStatusCode.ILLEGAL_PATH, OperationType.CREATE_MULTI_TIMESERIES, - "root.sg.d1..s1"))); + "root.db.d1..s1"))); } try { - session.deleteTimeseries("root.sg.d1..s1"); + session.deleteTimeseries("root.db.d1..s1"); fail("Exception expected"); } catch (StatementExecutionException e) { assertTrue( @@ -1638,7 +1635,7 @@ public void insertIllegalPathTest() { msg, TSStatusCode.ILLEGAL_PATH, OperationType.DELETE_TIMESERIES, - "root.sg.d1..s1"))); + "root.db.d1..s1"))); } } catch (Exception e) { e.printStackTrace(); @@ -1651,7 +1648,7 @@ public void insertIllegalPathTest() { public void conversionFunctionTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { // prepare data - String deviceId = "root.sg.d1"; + String deviceId = "root.db.d1"; List times = new ArrayList<>(); List> measurementsList = new ArrayList<>(); List> typesList = new ArrayList<>(); @@ -1698,7 +1695,7 @@ public void conversionFunctionTest() { casts[i] = String.format("cast(s%s, 'type'='%s')", i + 1, targetTypes[i]); } buffer.append(StringUtils.join(casts, ",")); - buffer.append(" from root.sg.d1"); + buffer.append(" from root.db.d1"); String sql = buffer.toString(); SessionDataSet sessionDataSet = session.executeQueryStatement(sql); @@ -1726,24 +1723,24 @@ public void conversionFunctionTest() { @Category({LocalStandaloneIT.class, ClusterIT.class}) public void insertPartialTablet2Test() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - if (!session.checkTimeseriesExists("root.sg.d.s1")) { + if (!session.checkTimeseriesExists("root.db.d.s1")) { session.createTimeseries( - "root.sg.d.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists("root.sg.d.s2")) { + if (!session.checkTimeseriesExists("root.db.d.s2")) { session.createTimeseries( - "root.sg.d.s2", TSDataType.DOUBLE, TSEncoding.GORILLA, CompressionType.SNAPPY); + "root.db.d.s2", TSDataType.DOUBLE, TSEncoding.GORILLA, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists("root.sg.d.s3")) { + if (!session.checkTimeseriesExists("root.db.d.s3")) { session.createTimeseries( - "root.sg.d.s3", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d.s3", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg.d", schemaList, 10); + Tablet tablet = new Tablet("root.db.d", schemaList, 10); long timestamp = System.currentTimeMillis(); @@ -1758,7 +1755,7 @@ public void insertPartialTablet2Test() { session.insertTablet(tablet, true); } catch (StatementExecutionException e) { assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } @@ -1770,13 +1767,13 @@ public void insertPartialTablet2Test() { session.insertTablet(tablet); } catch (StatementExecutionException e) { assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } SessionDataSet dataSet = - session.executeQueryStatement("select count(s1), count(s2), count(s3) from root.sg.d"); + session.executeQueryStatement("select count(s1), count(s2), count(s3) from root.db.d"); while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); assertEquals(15L, rowRecord.getFields().get(0).getLongV()); @@ -1843,7 +1840,7 @@ public void insertBinaryAsTextTest() { byte[] data = (byte[]) bytesData.get(i); Binary dataBinary = new Binary(data); session.insertRecord( - "root.sg1.d1", + "root.db1.d1", i, Collections.singletonList("s0"), Collections.singletonList(TSDataType.TEXT), @@ -1852,7 +1849,7 @@ public void insertBinaryAsTextTest() { // insert data using insertTablet List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList, 100); + Tablet tablet = new Tablet("root.db1.d1", schemaList, 100); for (int i = 0; i < bytesData.size(); i++) { byte[] data = (byte[]) bytesData.get(i); int rowIndex = tablet.getRowSize(); @@ -1862,10 +1859,10 @@ public void insertBinaryAsTextTest() { } session.insertTablet(tablet); // check result - SessionDataSet dataSet = session.executeQueryStatement("select ** from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select ** from root.db1.d1"); assertArrayEquals( dataSet.getColumnNames().toArray(new String[0]), - new String[] {"Time", "root.sg1.d1.s0", "root.sg1.d1.s1"}); + new String[] {"Time", "root.db1.d1.s0", "root.db1.d1.s1"}); while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); for (int i = 0; i < 2; i++) { @@ -1930,14 +1927,14 @@ public void convertRecordsToTabletsTest() { List> values = new ArrayList<>(); List timestamps = new ArrayList<>(); for (long row = 0; row < 1000; row++) { - devices.add("root.sg1.d1"); + devices.add("root.db1.d1"); measurementsList.add(measurements); typeList.add(types); values.add(value); timestamps.add(row); } List queryMeasurement = new ArrayList<>(); - queryMeasurement.add("root.sg1.d1.s1"); + queryMeasurement.add("root.db1.d1.s1"); List queryType = new ArrayList<>(); queryType.add(TAggregationType.COUNT); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { @@ -2115,20 +2112,20 @@ record = dataSet.next(); public void testWriteRestartAndDeleteDB() throws IoTDBConnectionException, StatementExecutionException { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - session.insertRecord("root.sg1.d1", 1, Arrays.asList("s3"), Arrays.asList("1")); + session.insertRecord("root.db1.d1", 1, Arrays.asList("s3"), Arrays.asList("1")); TestUtils.stopForciblyAndRestartDataNodes(); - SessionDataSet dataSet = session.executeQueryStatement("select s3 from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select s3 from root.db1.d1"); dataSet.next(); dataSet.close(); - session.executeNonQueryStatement("DELETE DATABASE root.sg1"); + session.executeNonQueryStatement("DELETE DATABASE root.db1"); session.insertRecord( - "root.sg1.d1", 1, Arrays.asList("s1", "s2", "s3"), Arrays.asList("1", "1", "1")); + "root.db1.d1", 1, Arrays.asList("s1", "s2", "s3"), Arrays.asList("1", "1", "1")); - dataSet = session.executeQueryStatement("SELECT * FROM root.sg1.d1"); + dataSet = session.executeQueryStatement("SELECT * FROM root.db1.d1"); RowRecord record = dataSet.next(); assertEquals(3, record.getFields().size()); } @@ -2139,7 +2136,7 @@ public void testWriteRestartAndDeleteDB() public void testQueryAllDataType() throws IoTDBConnectionException, StatementExecutionException { Tablet tablet = new Tablet( - "root.sg.d1", + "root.db.d1", Arrays.asList( new MeasurementSchema("s1", TSDataType.INT32), new MeasurementSchema("s2", TSDataType.INT64), @@ -2168,33 +2165,33 @@ public void testQueryAllDataType() throws IoTDBConnectionException, StatementExe try (ISession session = EnvFactory.getEnv().getSessionConnection()) { session.insertTablet(tablet); - try (SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg.d1")) { + try (SessionDataSet dataSet = session.executeQueryStatement("select * from root.db.d1")) { DataIterator iterator = dataSet.iterator(); int count = 0; while (iterator.next()) { count++; - assertFalse(iterator.isNull("root.sg.d1.s1")); - assertEquals(1, iterator.getInt("root.sg.d1.s1")); - assertFalse(iterator.isNull("root.sg.d1.s2")); - assertEquals(1L, iterator.getLong("root.sg.d1.s2")); - assertFalse(iterator.isNull("root.sg.d1.s3")); - assertEquals(0, iterator.getFloat("root.sg.d1.s3"), 0.01); - assertFalse(iterator.isNull("root.sg.d1.s4")); - assertEquals(0, iterator.getDouble("root.sg.d1.s4"), 0.01); - assertFalse(iterator.isNull("root.sg.d1.s5")); - assertEquals("text_value", iterator.getString("root.sg.d1.s5")); - assertFalse(iterator.isNull("root.sg.d1.s6")); - assertTrue(iterator.getBoolean("root.sg.d1.s6")); - assertFalse(iterator.isNull("root.sg.d1.s7")); - assertEquals(new Timestamp(1), iterator.getTimestamp("root.sg.d1.s7")); - assertFalse(iterator.isNull("root.sg.d1.s8")); - assertEquals(new Binary(new byte[] {1}), iterator.getBlob("root.sg.d1.s8")); - assertFalse(iterator.isNull("root.sg.d1.s9")); - assertEquals("string_value", iterator.getString("root.sg.d1.s9")); - assertFalse(iterator.isNull("root.sg.d1.s10")); - assertEquals(DateUtils.parseIntToLocalDate(20250403), iterator.getDate("root.sg.d1.s10")); - assertTrue(iterator.isNull("root.sg.d1.s11")); - assertNull(iterator.getTimestamp("root.sg.d1.s11")); + assertFalse(iterator.isNull("root.db.d1.s1")); + assertEquals(1, iterator.getInt("root.db.d1.s1")); + assertFalse(iterator.isNull("root.db.d1.s2")); + assertEquals(1L, iterator.getLong("root.db.d1.s2")); + assertFalse(iterator.isNull("root.db.d1.s3")); + assertEquals(0, iterator.getFloat("root.db.d1.s3"), 0.01); + assertFalse(iterator.isNull("root.db.d1.s4")); + assertEquals(0, iterator.getDouble("root.db.d1.s4"), 0.01); + assertFalse(iterator.isNull("root.db.d1.s5")); + assertEquals("text_value", iterator.getString("root.db.d1.s5")); + assertFalse(iterator.isNull("root.db.d1.s6")); + assertTrue(iterator.getBoolean("root.db.d1.s6")); + assertFalse(iterator.isNull("root.db.d1.s7")); + assertEquals(new Timestamp(1), iterator.getTimestamp("root.db.d1.s7")); + assertFalse(iterator.isNull("root.db.d1.s8")); + assertEquals(new Binary(new byte[] {1}), iterator.getBlob("root.db.d1.s8")); + assertFalse(iterator.isNull("root.db.d1.s9")); + assertEquals("string_value", iterator.getString("root.db.d1.s9")); + assertFalse(iterator.isNull("root.db.d1.s10")); + assertEquals(DateUtils.parseIntToLocalDate(20250403), iterator.getDate("root.db.d1.s10")); + assertTrue(iterator.isNull("root.db.d1.s11")); + assertNull(iterator.getTimestamp("root.db.d1.s11")); assertEquals(new Timestamp(0), iterator.getTimestamp("Time")); assertFalse(iterator.isNull("Time")); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSyntaxConventionIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSyntaxConventionIT.java index ac65c6be784e6..aaad7923cf2de 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSyntaxConventionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSyntaxConventionIT.java @@ -69,12 +69,12 @@ public void tearDown() throws Exception { @Test public void createTimeSeriesTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String database = "root.sg"; + String database = "root.db"; session.setStorageGroup(database); try { session.createTimeseries( - "root.sg.d1.`a.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d1.`a.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); fail(); } catch (Exception e) { assertTrue(e.getMessage().contains("is not a legal path")); @@ -82,13 +82,13 @@ public void createTimeSeriesTest() { try { session.createTimeseries( - "root.sg.d1.a`.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d1.a`.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); fail(); } catch (Exception e) { assertTrue(e.getMessage().contains("is not a legal path")); } - final SessionDataSet dataSet = session.executeQueryStatement("SHOW TIMESERIES root.sg.**"); + final SessionDataSet dataSet = session.executeQueryStatement("SHOW TIMESERIES root.db.**"); assertFalse(dataSet.hasNext()); session.deleteDatabase(database); @@ -101,7 +101,7 @@ public void createTimeSeriesTest() { @Test public void insertTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("`\"a“(Φ)”b\"`"); @@ -121,15 +121,15 @@ public void insertTest() { session.insertRecord(deviceId, 1L, measurements, values); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`\"a“(Φ)”b\"`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`\"a>b\"`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.```a.b```")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`'a“(Φ)”b'`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`'a>b'`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`a“(Φ)”b`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`a>b`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`\\\"a`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.aaa")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`\"a“(Φ)”b\"`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`\"a>b\"`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.```a.b```")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`'a“(Φ)”b'`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`'a>b'`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`a“(Φ)”b`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`a>b`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`\\\"a`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.aaa")); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -139,7 +139,7 @@ public void insertTest() { @Test public void inserRecordWithIllegalMeasurementTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); List values = new ArrayList<>(); measurements.add("a.b"); @@ -221,7 +221,7 @@ public void inserRecordWithIllegalMeasurementTest() { @Test public void insertRecordsWithIllegalMeasurementTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("a.b"); measurements.add("111"); @@ -256,7 +256,7 @@ public void insertRecordsWithIllegalMeasurementTest() { @Test public void insertTabletWithIllegalMeasurementTest() { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("wrong`", TSDataType.INT64, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE, TSEncoding.RLE)); @@ -292,7 +292,7 @@ public void insertTabletWithIllegalMeasurementTest() { @Test public void createAlignedTimeseriesWithIllegalMeasurementTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("111"); measurements.add("a.b"); @@ -322,7 +322,7 @@ public void createAlignedTimeseriesWithIllegalMeasurementTest() { @Test public void createAlignedTimeseriesWithIllegalMeasurementAliasTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -363,8 +363,8 @@ public void createAlignedTimeseriesWithIllegalMeasurementAliasTest() { public void createMultiTimeseriesWithIllegalMeasurementAliasTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { List paths = new ArrayList<>(); - paths.add("root.sg1.d1.s1"); - paths.add("root.sg1.d1.s2"); + paths.add("root.db1.d1.s1"); + paths.add("root.db1.d1.s2"); List tsDataTypes = new ArrayList<>(); tsDataTypes.add(TSDataType.DOUBLE); tsDataTypes.add(TSDataType.DOUBLE); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/SessionIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/SessionIT.java index 52638352ee37c..12fdc979a27c0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/SessionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/SessionIT.java @@ -73,7 +73,7 @@ public void tearDown() throws Exception { @Test public void testInsertByStrAndSelectFailedData() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; session.createTimeseries( deviceId + ".s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.UNCOMPRESSED); @@ -90,7 +90,7 @@ public void testInsertByStrAndSelectFailedData() { schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT, TSEncoding.PLAIN)); schemaList.add(new MeasurementSchema("s4", TSDataType.INT64, TSEncoding.PLAIN)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList, 10); + Tablet tablet = new Tablet("root.db1.d1", schemaList, 10); for (long time = 0; time < 10; time++) { int row = tablet.getRowSize(); @@ -109,7 +109,7 @@ public void testInsertByStrAndSelectFailedData() { } SessionDataSet dataSet = - session.executeQueryStatement("select s1, s2, s3, s4 from root.sg1.d1"); + session.executeQueryStatement("select s1, s2, s3, s4 from root.db1.d1"); int i = 0; while (dataSet.hasNext()) { RowRecord record = dataSet.next(); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/pool/SessionPoolIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/pool/SessionPoolIT.java index d8fb9bb4c5072..03963088f150c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/pool/SessionPoolIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/pool/SessionPoolIT.java @@ -81,7 +81,7 @@ public void insert() { () -> { try { pool.insertRecord( - "root.sg1.d1", + "root.db1.d1", 1, Collections.singletonList("s" + no), Collections.singletonList(TSDataType.INT64), @@ -110,7 +110,7 @@ public void incorrectSQL() { assertEquals(0, pool.currentAvailableSize()); try { pool.insertRecord( - ".root.sg1.d1", + ".root.db1.d1", 1, Collections.singletonList("s"), Collections.singletonList(TSDataType.INT64), @@ -135,7 +135,7 @@ public void incorrectExecuteQueryStatement() { () -> { try { SessionDataSetWrapper wrapper = - pool.executeQueryStatement("select * from root.sg1.d1 where time = " + no); + pool.executeQueryStatement("select * from root.db1.d1 where time = " + no); // this is incorrect because wrapper is not closed. // so all other 7 queries will be blocked } catch (IoTDBConnectionException | StatementExecutionException e) { @@ -182,11 +182,11 @@ private void correctQuery(ISessionPool pool, long timeoutInMs) { SessionDataSetWrapper wrapper; if (timeoutInMs == DEFAULT_QUERY_TIMEOUT) { wrapper = - pool.executeQueryStatement("select * from root.sg1.d1 where time = " + no); + pool.executeQueryStatement("select * from root.db1.d1 where time = " + no); } else { wrapper = pool.executeQueryStatement( - "select * from root.sg1.d1 where time = " + no, timeoutInMs); + "select * from root.db1.d1 where time = " + no, timeoutInMs); } pool.closeResultSet(wrapper); } catch (Exception e) { @@ -212,7 +212,7 @@ public void executeRawDataQuery() { ExecutorService service = Executors.newFixedThreadPool(10); write10Data(pool, true); List pathList = new ArrayList<>(); - pathList.add("root.sg1.d1.s1"); + pathList.add("root.db1.d1.s1"); for (int i = 0; i < 10; i++) { final int no = i; service.submit( @@ -247,7 +247,7 @@ public void tryIfTheServerIsRestart() { SessionDataSetWrapper wrapper = null; BaseNodeWrapper node = EnvFactory.getEnv().getDataNodeWrapper(0); try { - wrapper = pool.executeQueryStatement("select * from root.sg1.d1 where time > 1"); + wrapper = pool.executeQueryStatement("select * from root.db1.d1 where time > 1"); node.stop(); EnvFactory.getEnv() .ensureNodeStatus( @@ -316,7 +316,7 @@ public void tryIfTheServerIsRestartButDataIsGotten() { assertEquals(1, pool.currentAvailableSize()); SessionDataSetWrapper wrapper; try { - wrapper = pool.executeQueryStatement("select * from root.sg1.d1 where time > 1"); + wrapper = pool.executeQueryStatement("select * from root.db1.d1 where time > 1"); // user does not know what happens. assertEquals(0, pool.currentAvailableSize()); assertEquals(1, pool.currentOccupiedSize()); @@ -361,7 +361,7 @@ private void write10Data(ISessionPool pool, boolean failWhenThrowException) { for (int i = 0; i < 10; i++) { try { pool.insertRecord( - "root.sg1.d1", + "root.db1.d1", i, Collections.singletonList("s" + i), Collections.singletonList(TSDataType.INT64), @@ -381,7 +381,7 @@ public void testClose() { pool.close(); try { pool.insertRecord( - "root.sg1.d1", + "root.db1.d1", 1, Collections.singletonList("s1"), Collections.singletonList(TSDataType.INT64), diff --git a/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/tsfile/ImportTsFileRemotely.java b/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/tsfile/ImportTsFileRemotely.java index efb7f2abdbf1f..aca33ba4dbf3d 100644 --- a/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/tsfile/ImportTsFileRemotely.java +++ b/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/tsfile/ImportTsFileRemotely.java @@ -164,7 +164,7 @@ public void sendHandshake() { "Handshake error with target server ip: %s, port: %s, because: %s.", client.getIpAddress(), client.getPort(), resp.getStatus())); } else { - client.setTimeout(PipeConfig.getInstance().getPipeConnectorTransferTimeoutMs()); + client.setTimeout(PipeConfig.getInstance().getPipeSinkTransferTimeoutMs()); IOT_PRINTER.println( String.format( "Handshake success. Target server ip: %s, port: %s", @@ -232,7 +232,7 @@ public void doTransfer(final File tsFile, final File modFile) throws PipeExcepti private void transferFilePieces(final File file, final boolean isMultiFile) throws PipeException, IOException { - final int readFileBufferSize = PipeConfig.getInstance().getPipeConnectorReadFileBufferSize(); + final int readFileBufferSize = PipeConfig.getInstance().getPipeSinkReadFileBufferSize(); final byte[] readBuffer = new byte[readFileBufferSize]; long position = 0; try (final RandomAccessFile reader = new RandomAccessFile(file, "r")) { @@ -299,10 +299,9 @@ private void initClient() { this.client = new IoTDBSyncClient( new ThriftClientProperty.Builder() - .setConnectionTimeoutMs( - PipeConfig.getInstance().getPipeConnectorHandshakeTimeoutMs()) + .setConnectionTimeoutMs(PipeConfig.getInstance().getPipeSinkHandshakeTimeoutMs()) .setRpcThriftCompressionEnabled( - PipeConfig.getInstance().isPipeConnectorRPCThriftCompressionEnabled()) + PipeConfig.getInstance().isPipeSinkRPCThriftCompressionEnabled()) .build(), getEndPoint().getIp(), getEndPoint().getPort(), diff --git a/iotdb-client/client-cpp/src/main/Session.h b/iotdb-client/client-cpp/src/main/Session.h index 35c05fad22c40..d27e7422277c7 100644 --- a/iotdb-client/client-cpp/src/main/Session.h +++ b/iotdb-client/client-cpp/src/main/Session.h @@ -113,7 +113,7 @@ void safe_cast(const T& value, Target& target) { * A tablet data of one device, the tablet contains multiple measurements of this device that share * the same time column. * - * for example: device root.sg1.d1 + * for example: device root.db1.d1 * * time, m1, m2, m3 * 1, 1, 2, 3 diff --git a/iotdb-client/client-py/iotdb/sqlalchemy/IoTDBSQLCompiler.py b/iotdb-client/client-py/iotdb/sqlalchemy/IoTDBSQLCompiler.py index 008a314e683d4..9138e0b3cfe0e 100644 --- a/iotdb-client/client-py/iotdb/sqlalchemy/IoTDBSQLCompiler.py +++ b/iotdb-client/client-py/iotdb/sqlalchemy/IoTDBSQLCompiler.py @@ -49,8 +49,8 @@ def visit_select( ): """ Override this method to solve two problems - 1. IoTDB does not support querying Time as a measurement name (e.g. select Time from root.storagegroup.device) - 2. IoTDB does not support path.measurement format to determine a column (e.g. select root.storagegroup.device.temperature from root.storagegroup.device) + 1. IoTDB does not support querying Time as a measurement name (e.g. select Time from root.database.device) + 2. IoTDB does not support path.measurement format to determine a column (e.g. select root.database.temperature from root.database.device) """ assert select_wraps_for is None, ( "SQLAlchemy 1.4 requires use of " diff --git a/iotdb-client/client-py/iotdb/utils/NumpyTablet.py b/iotdb-client/client-py/iotdb/utils/NumpyTablet.py index 9a0860d3a43e9..83428fad4430a 100644 --- a/iotdb-client/client-py/iotdb/utils/NumpyTablet.py +++ b/iotdb-client/client-py/iotdb/utils/NumpyTablet.py @@ -41,7 +41,7 @@ def __init__( ): """ creating a numpy tablet for insertion - for example using tree-model, considering device: root.sg1.d1 + for example using tree-model, considering device: root.db1.d1 timestamps, m1, m2, m3 1, 125.3, True, text1 2, 111.6, False, text2 diff --git a/iotdb-client/client-py/iotdb/utils/Tablet.py b/iotdb-client/client-py/iotdb/utils/Tablet.py index 9b241723fe5b7..e2ad7ccebe9cf 100644 --- a/iotdb-client/client-py/iotdb/utils/Tablet.py +++ b/iotdb-client/client-py/iotdb/utils/Tablet.py @@ -50,7 +50,7 @@ def __init__( ): """ creating a tablet for insertion - for example using tree-model, considering device: root.sg1.d1 + for example using tree-model, considering device: root.db1.d1 timestamps, m1, m2, m3 1, 125.3, True, text1 2, 111.6, False, text2 diff --git a/iotdb-client/client-py/session_aligned_timeseries_example.py b/iotdb-client/client-py/session_aligned_timeseries_example.py index 450d69f281883..da87a55993c74 100644 --- a/iotdb-client/client-py/session_aligned_timeseries_example.py +++ b/iotdb-client/client-py/session_aligned_timeseries_example.py @@ -33,12 +33,12 @@ session.open(False) # set and delete databases -session.set_storage_group("root.sg_test_01") -session.set_storage_group("root.sg_test_02") -session.set_storage_group("root.sg_test_03") -session.set_storage_group("root.sg_test_04") -session.delete_storage_group("root.sg_test_02") -session.delete_storage_groups(["root.sg_test_03", "root.sg_test_04"]) +session.set_storage_group("root.db_test_01") +session.set_storage_group("root.db_test_02") +session.set_storage_group("root.db_test_03") +session.set_storage_group("root.db_test_04") +session.delete_storage_group("root.db_test_02") +session.delete_storage_groups(["root.db_test_03", "root.db_test_04"]) # setting aligned time series. measurements_lst_ = [ @@ -54,7 +54,7 @@ encoding_lst_ = [TSEncoding.PLAIN for _ in range(len(data_type_lst_))] compressor_lst_ = [Compressor.SNAPPY for _ in range(len(data_type_lst_))] session.create_aligned_time_series( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_lst_, data_type_lst_, encoding_lst_, @@ -81,7 +81,7 @@ encoding_lst_ = [TSEncoding.PLAIN for _ in range(len(data_type_lst_))] compressor_lst_ = [Compressor.SNAPPY for _ in range(len(data_type_lst_))] session.create_aligned_time_series( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_lst_, data_type_lst_, encoding_lst_, @@ -91,20 +91,20 @@ # delete time series session.delete_time_series( [ - "root.sg_test_01.d_02.s_07", - "root.sg_test_01.d_02.s_08", - "root.sg_test_01.d_02.s_09", + "root.db_test_01.d_02.s_07", + "root.db_test_01.d_02.s_08", + "root.db_test_01.d_02.s_09", ] ) # checking time series print( "s_07 expecting False, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_02.s_07"), + session.check_time_series_exists("root.db_test_01.d_02.s_07"), ) print( "s_03 expecting True, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_02.s_03"), + session.check_time_series_exists("root.db_test_01.d_02.s_03"), ) # insert one aligned record into the database. @@ -119,7 +119,7 @@ TSDataType.TEXT, ] session.insert_aligned_record( - "root.sg_test_01.d_02", 1, measurements_, data_types_, values_ + "root.db_test_01.d_02", 1, measurements_, data_types_, values_ ) # insert multiple aligned records into database @@ -132,7 +132,7 @@ [True, 77, 88, 1.25, 8.125, "test_records02"], ] data_type_list_ = [data_types_, data_types_] -device_ids_ = ["root.sg_test_01.d_02", "root.sg_test_01.d_02"] +device_ids_ = ["root.db_test_01.d_02", "root.db_test_01.d_02"] session.insert_aligned_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ ) @@ -146,16 +146,16 @@ ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [4, 5, 6, 7] tablet_ = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_02", measurements_, data_types_, values_, timestamps_ ) session.insert_aligned_tablet(tablet_) # insert multiple aligned tablets into database tablet_01 = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, [8, 9, 10, 11] + "root.db_test_01.d_02", measurements_, data_types_, values_, [8, 9, 10, 11] ) tablet_02 = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, [12, 13, 14, 15] + "root.db_test_01.d_02", measurements_, data_types_, values_, [12, 13, 14, 15] ) session.insert_aligned_tablets([tablet_01, tablet_02]) @@ -168,7 +168,7 @@ ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_02", measurements_, data_types_, values_, timestamps_ ) session.insert_aligned_tablet(tablet_) @@ -187,17 +187,17 @@ values_list = [[False, 22, 33], [True, 1, 23], [False, 15, 26]] session.insert_aligned_records_of_one_device( - "root.sg_test_01.d_02", time_list, measurements_list, data_types_list, values_list + "root.db_test_01.d_02", time_list, measurements_list, data_types_list, values_list ) # execute non-query sql statement session.execute_non_query_statement( - "insert into root.sg_test_01.d_02(timestamp, s_02) aligned values(16, 188)" + "insert into root.db_test_01.d_02(timestamp, s_02) aligned values(16, 188)" ) # execute sql query statement with session.execute_query_statement( - "select * from root.sg_test_01.d_02" + "select * from root.db_test_01.d_02" ) as session_data_set: session_data_set.set_fetch_size(1024) while session_data_set.has_next(): @@ -212,14 +212,14 @@ ] values_list = [["False", "22", "33"], ["True", "1", "23"], ["False", "15", "26"]] session.insert_aligned_string_records_of_one_device( - "root.sg_test_01.d_04", + "root.db_test_01.d_04", time_list, measurements_list, values_list, ) # delete database -session.delete_storage_group("root.sg_test_01") +session.delete_storage_group("root.db_test_01") # close session connection. session.close() diff --git a/iotdb-client/client-py/session_example.py b/iotdb-client/client-py/session_example.py index d0a6a3aba8e37..e30c62b273f0c 100644 --- a/iotdb-client/client-py/session_example.py +++ b/iotdb-client/client-py/session_example.py @@ -42,25 +42,25 @@ session.open(False) # create and delete databases -session.set_storage_group("root.sg_test_01") -session.set_storage_group("root.sg_test_02") -session.set_storage_group("root.sg_test_03") -session.set_storage_group("root.sg_test_04") -session.delete_storage_group("root.sg_test_02") -session.delete_storage_groups(["root.sg_test_03", "root.sg_test_04"]) +session.set_storage_group("root.db_test_01") +session.set_storage_group("root.db_test_02") +session.set_storage_group("root.db_test_03") +session.set_storage_group("root.db_test_04") +session.delete_storage_group("root.db_test_02") +session.delete_storage_groups(["root.db_test_03", "root.db_test_04"]) # setting time series. session.create_time_series( - "root.sg_test_01.d_01.s_01", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY + "root.db_test_01.d_01.s_01", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY ) session.create_time_series( - "root.sg_test_01.d_01.s_02", TSDataType.INT32, TSEncoding.PLAIN, Compressor.SNAPPY + "root.db_test_01.d_01.s_02", TSDataType.INT32, TSEncoding.PLAIN, Compressor.SNAPPY ) session.create_time_series( - "root.sg_test_01.d_01.s_03", TSDataType.INT64, TSEncoding.PLAIN, Compressor.SNAPPY + "root.db_test_01.d_01.s_03", TSDataType.INT64, TSEncoding.PLAIN, Compressor.SNAPPY ) session.create_time_series( - "root.sg_test_01.d_02.s_01", + "root.db_test_01.d_02.s_01", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY, @@ -72,12 +72,12 @@ # setting multiple time series once. ts_path_lst_ = [ - "root.sg_test_01.d_01.s_04", - "root.sg_test_01.d_01.s_05", - "root.sg_test_01.d_01.s_06", - "root.sg_test_01.d_01.s_07", - "root.sg_test_01.d_01.s_08", - "root.sg_test_01.d_01.s_09", + "root.db_test_01.d_01.s_04", + "root.db_test_01.d_01.s_05", + "root.db_test_01.d_01.s_06", + "root.db_test_01.d_01.s_07", + "root.db_test_01.d_01.s_08", + "root.db_test_01.d_01.s_09", ] data_type_lst_ = [ TSDataType.FLOAT, @@ -94,12 +94,12 @@ ) ts_path_lst_ = [ - "root.sg_test_01.d_02.s_04", - "root.sg_test_01.d_02.s_05", - "root.sg_test_01.d_02.s_06", - "root.sg_test_01.d_02.s_07", - "root.sg_test_01.d_02.s_08", - "root.sg_test_01.d_02.s_09", + "root.db_test_01.d_02.s_04", + "root.db_test_01.d_02.s_05", + "root.db_test_01.d_02.s_06", + "root.db_test_01.d_02.s_07", + "root.db_test_01.d_02.s_08", + "root.db_test_01.d_02.s_09", ] data_type_lst_ = [ TSDataType.FLOAT, @@ -127,28 +127,28 @@ # delete time series session.delete_time_series( [ - "root.sg_test_01.d_01.s_07", - "root.sg_test_01.d_01.s_08", - "root.sg_test_01.d_01.s_09", + "root.db_test_01.d_01.s_07", + "root.db_test_01.d_01.s_08", + "root.db_test_01.d_01.s_09", ] ) # checking time series print( "s_07 expecting False, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_01.s_07"), + session.check_time_series_exists("root.db_test_01.d_01.s_07"), ) print( "s_03 expecting True, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_01.s_03"), + session.check_time_series_exists("root.db_test_01.d_01.s_03"), ) print( "d_02.s_01 expecting True, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_02.s_01"), + session.check_time_series_exists("root.db_test_01.d_02.s_01"), ) print( "d_02.s_06 expecting True, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_02.s_06"), + session.check_time_series_exists("root.db_test_01.d_02.s_06"), ) # insert one record into the database. @@ -162,7 +162,7 @@ TSDataType.DOUBLE, TSDataType.TEXT, ] -session.insert_record("root.sg_test_01.d_01", 1, measurements_, data_types_, values_) +session.insert_record("root.db_test_01.d_01", 1, measurements_, data_types_, values_) # insert multiple records into database measurements_list_ = [ @@ -174,7 +174,7 @@ [True, 77, 88, 1.25, 8.125, bytes("test_records02", "utf-8")], ] data_type_list_ = [data_types_, data_types_] -device_ids_ = ["root.sg_test_01.d_01", "root.sg_test_01.d_01"] +device_ids_ = ["root.db_test_01.d_01", "root.db_test_01.d_01"] session.insert_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ ) @@ -188,7 +188,7 @@ ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [4, 5, 6, 7] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) session.insert_tablet(tablet_) @@ -203,7 +203,7 @@ ] np_timestamps_ = np.array([1, 2, 3, 4], TSDataType.INT64.np_dtype()) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_02", measurements_, data_types_, np_values_, np_timestamps_ + "root.db_test_01.d_02", measurements_, data_types_, np_values_, np_timestamps_ ) session.insert_tablet(np_tablet_) @@ -218,7 +218,7 @@ ] np_timestamps_unsorted = np.array([9, 8, 7, 6, 5], np.dtype(">i8")) np_tablet_unsorted = NumpyTablet( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_, data_types_, np_values_unsorted, @@ -244,7 +244,7 @@ np_bitmaps_[4].mark(3) np_bitmaps_[5].mark(3) np_tablet_with_none = NumpyTablet( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_, data_types_, np_values_, @@ -261,10 +261,10 @@ # insert multiple tablets into database tablet_01 = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, [8, 9, 10, 11] + "root.db_test_01.d_01", measurements_, data_types_, values_, [8, 9, 10, 11] ) tablet_02 = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, [12, 13, 14, 15] + "root.db_test_01.d_01", measurements_, data_types_, values_, [12, 13, 14, 15] ) session.insert_tablets([tablet_01, tablet_02]) @@ -277,7 +277,7 @@ ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) session.insert_tablet(tablet_) @@ -296,24 +296,24 @@ values_list = [[False, 22, 33], [True, 1, 23], [False, 15, 26]] session.insert_records_of_one_device( - "root.sg_test_01.d_01", time_list, measurements_list, data_types_list, values_list + "root.db_test_01.d_01", time_list, measurements_list, data_types_list, values_list ) # execute non-query sql statement session.execute_non_query_statement( - "insert into root.sg_test_01.d_01(timestamp, s_02) values(16, 188)" + "insert into root.db_test_01.d_01(timestamp, s_02) values(16, 188)" ) # execute sql query statement with session.execute_query_statement( - "select * from root.sg_test_01.d_01" + "select * from root.db_test_01.d_01" ) as session_data_set: session_data_set.set_fetch_size(1024) while session_data_set.has_next(): print(session_data_set.next()) # execute sql query statement with session.execute_query_statement( - "select s_01, s_02, s_03, s_04, s_05, s_06 from root.sg_test_01.d_02" + "select s_01, s_02, s_03, s_04, s_05, s_06 from root.db_test_01.d_02" ) as session_data_set: session_data_set.set_fetch_size(1024) while session_data_set.has_next(): @@ -321,13 +321,13 @@ # execute statement with session.execute_statement( - "select * from root.sg_test_01.d_01" + "select * from root.db_test_01.d_01" ) as session_data_set: while session_data_set.has_next(): print(session_data_set.next()) session.execute_statement( - "insert into root.sg_test_01.d_01(timestamp, s_02) values(16, 188)" + "insert into root.db_test_01.d_01(timestamp, s_02) values(16, 188)" ) # insert string records of one device @@ -340,21 +340,21 @@ values_list = [["False", "22", "33"], ["True", "1", "23"], ["False", "15", "26"]] session.insert_string_records_of_one_device( - "root.sg_test_01.d_03", + "root.db_test_01.d_03", time_list, measurements_list, values_list, ) with session.execute_raw_data_query( - ["root.sg_test_01.d_03.s_01", "root.sg_test_01.d_03.s_02"], 1, 4 + ["root.db_test_01.d_03.s_01", "root.db_test_01.d_03.s_02"], 1, 4 ) as session_data_set: session_data_set.set_fetch_size(1024) while session_data_set.has_next(): print(session_data_set.next()) with session.execute_last_data_query( - ["root.sg_test_01.d_03.s_01", "root.sg_test_01.d_03.s_02"], 0 + ["root.db_test_01.d_03.s_01", "root.db_test_01.d_03.s_02"], 0 ) as session_data_set: session_data_set.set_fetch_size(1024) while session_data_set.has_next(): @@ -376,7 +376,7 @@ ] timestamps_new_type = [1, 2, 3, 4] tablet_new_type = Tablet( - "root.sg_test_01.d_04", + "root.db_test_01.d_04", measurements_new_type, data_types_new_type, values_new_type, @@ -391,7 +391,7 @@ ] np_timestamps_new_type = np.array([5, 6, 7, 8], TSDataType.INT64.np_dtype()) np_tablet_new_type = NumpyTablet( - "root.sg_test_01.d_04", + "root.db_test_01.d_04", measurements_new_type, data_types_new_type, np_values_new_type, @@ -399,20 +399,20 @@ ) session.insert_tablet(np_tablet_new_type) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: print(dataset.get_column_names()) while dataset.has_next(): print(dataset.next()) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: df = dataset.todf() print(df.to_string()) # delete database -session.delete_storage_group("root.sg_test_01") +session.delete_storage_group("root.db_test_01") # close session connection. session.close() diff --git a/iotdb-client/client-py/tests/integration/tablet_performance_comparison.py b/iotdb-client/client-py/tests/integration/tablet_performance_comparison.py index c22124ec00938..d237857ab4867 100644 --- a/iotdb-client/client-py/tests/integration/tablet_performance_comparison.py +++ b/iotdb-client/client-py/tests/integration/tablet_performance_comparison.py @@ -199,7 +199,7 @@ def performance_test( for i in range(0, col): # if i % 500 == 0: # print(f"insert {i} cols") - device_id = "root.sg%d.%d" % (i % 8, i) + device_id = "root.db%d.%d" % (i % 8, i) if not use_new: # Use the ORIGINAL method to construct tablet timestamps_ = [] diff --git a/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py b/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py index 2c36f9484276e..27a44bbb0cd86 100644 --- a/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py +++ b/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py @@ -52,16 +52,16 @@ def test_aligned_timeseries(): exit(1) # set and delete databases - session.set_storage_group("root.sg_test_01") - session.set_storage_group("root.sg_test_02") - session.set_storage_group("root.sg_test_03") - session.set_storage_group("root.sg_test_04") + session.set_storage_group("root.db_test_01") + session.set_storage_group("root.db_test_02") + session.set_storage_group("root.db_test_03") + session.set_storage_group("root.db_test_04") - if session.delete_storage_group("root.sg_test_02") < 0: + if session.delete_storage_group("root.db_test_02") < 0: test_fail() print_message("delete database failed") - if session.delete_storage_groups(["root.sg_test_03", "root.sg_test_04"]) < 0: + if session.delete_storage_groups(["root.db_test_03", "root.db_test_04"]) < 0: test_fail() print_message("delete databases failed") @@ -79,7 +79,7 @@ def test_aligned_timeseries(): encoding_lst_ = [TSEncoding.PLAIN for _ in range(len(data_type_lst_))] compressor_lst_ = [Compressor.SNAPPY for _ in range(len(data_type_lst_))] session.create_aligned_time_series( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_lst_, data_type_lst_, encoding_lst_, @@ -106,7 +106,7 @@ def test_aligned_timeseries(): encoding_lst_ = [TSEncoding.PLAIN for _ in range(len(data_type_lst_))] compressor_lst_ = [Compressor.SNAPPY for _ in range(len(data_type_lst_))] session.create_aligned_time_series( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_lst_, data_type_lst_, encoding_lst_, @@ -117,9 +117,9 @@ def test_aligned_timeseries(): try: session.delete_time_series( [ - "root.sg_test_01.d_02.s_07", - "root.sg_test_01.d_02.s_08", - "root.sg_test_01.d_02.s_09", + "root.db_test_01.d_02.s_07", + "root.db_test_01.d_02.s_08", + "root.db_test_01.d_02.s_09", ] ) except Exception: @@ -128,14 +128,14 @@ def test_aligned_timeseries(): # checking time series # s_07 expecting False - if session.check_time_series_exists("root.sg_test_01.d_02.s_07"): + if session.check_time_series_exists("root.db_test_01.d_02.s_07"): test_fail() - print_message("root.sg_test_01.d_02.s_07 shouldn't exist") + print_message("root.db_test_01.d_02.s_07 shouldn't exist") # s_03 expecting True - if not session.check_time_series_exists("root.sg_test_01.d_02.s_03"): + if not session.check_time_series_exists("root.db_test_01.d_02.s_03"): test_fail() - print_message("root.sg_test_01.d_02.s_03 should exist") + print_message("root.db_test_01.d_02.s_03 should exist") # insert one record into the database. measurements_ = ["s_01", "s_02", "s_03", "s_04", "s_05", "s_06"] @@ -150,7 +150,7 @@ def test_aligned_timeseries(): ] try: session.insert_aligned_record( - "root.sg_test_01.d_02", 1, measurements_, data_types_, values_ + "root.db_test_01.d_02", 1, measurements_, data_types_, values_ ) except Exception: test_fail() @@ -166,7 +166,7 @@ def test_aligned_timeseries(): [True, 77, 88, 1.25, 8.125, "test_records02"], ] data_type_list_ = [data_types_, data_types_] - device_ids_ = ["root.sg_test_01.d_02", "root.sg_test_01.d_02"] + device_ids_ = ["root.db_test_01.d_02", "root.db_test_01.d_02"] try: session.insert_aligned_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ @@ -184,7 +184,7 @@ def test_aligned_timeseries(): ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [4, 5, 6, 7] tablet_ = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_02", measurements_, data_types_, values_, timestamps_ ) if session.insert_aligned_tablet(tablet_) < 0: test_fail() @@ -192,10 +192,10 @@ def test_aligned_timeseries(): # insert multiple tablets into database tablet_01 = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, [8, 9, 10, 11] + "root.db_test_01.d_02", measurements_, data_types_, values_, [8, 9, 10, 11] ) tablet_02 = Tablet( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_, data_types_, values_, @@ -214,7 +214,7 @@ def test_aligned_timeseries(): ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [20, 21, 22, 23] tablet_ = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_02", measurements_, data_types_, values_, timestamps_ ) if session.insert_aligned_tablet(tablet_) < 0: test_fail() @@ -236,7 +236,7 @@ def test_aligned_timeseries(): if ( session.insert_aligned_records_of_one_device( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", time_list, measurements_list, data_types_list, @@ -250,17 +250,17 @@ def test_aligned_timeseries(): # execute non-query sql statement try: session.execute_non_query_statement( - "insert into root.sg_test_01.d_02(timestamp, s_02) aligned values(16, 188)" + "insert into root.db_test_01.d_02(timestamp, s_02) aligned values(16, 188)" ) except Exception: test_fail() print_message( - "execute 'insert into root.sg_test_01.d_02(timestamp, s_02) aligned values(16, 188)' failed" + "execute 'insert into root.db_test_01.d_02(timestamp, s_02) aligned values(16, 188)' failed" ) # execute sql query statement session_data_set = session.execute_query_statement( - "select * from root.sg_test_01.d_02" + "select * from root.db_test_01.d_02" ) session_data_set.set_fetch_size(1024) expect_count = 20 diff --git a/iotdb-client/client-py/tests/integration/test_new_data_types.py b/iotdb-client/client-py/tests/integration/test_new_data_types.py index e59138fa0359d..e85932d7efb46 100644 --- a/iotdb-client/client-py/tests/integration/test_new_data_types.py +++ b/iotdb-client/client-py/tests/integration/test_new_data_types.py @@ -61,7 +61,7 @@ def session_test(use_session_pool=False): print("can't open session") exit(1) - device_id = "root.sg_test_01.d_04" + device_id = "root.db_test_01.d_04" measurements_new_type = ["s_01", "s_02", "s_03", "s_04"] data_types_new_type = [ TSDataType.DATE, @@ -113,20 +113,20 @@ def session_test(use_session_pool=False): ) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: print(dataset.get_column_names()) while dataset.has_next(): print(dataset.next()) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: df = dataset.todf() print(df.to_string()) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: cnt = 0 while dataset.has_next(): @@ -146,7 +146,7 @@ def session_test(use_session_pool=False): assert cnt == 10 with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: df = dataset.todf() rows, columns = df.shape @@ -172,7 +172,7 @@ def session_test(use_session_pool=False): ) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04 where time > 10" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04 where time > 10" ) as dataset: cnt = 0 while dataset.has_next(): diff --git a/iotdb-client/client-py/tests/integration/test_session.py b/iotdb-client/client-py/tests/integration/test_session.py index 75cdf056113b4..f11413dc756d0 100644 --- a/iotdb-client/client-py/tests/integration/test_session.py +++ b/iotdb-client/client-py/tests/integration/test_session.py @@ -80,44 +80,44 @@ def session_test(use_session_pool=False): exit(1) # set and delete databases - session.set_storage_group("root.sg_test_01") - session.set_storage_group("root.sg_test_02") - session.set_storage_group("root.sg_test_03") - session.set_storage_group("root.sg_test_04") + session.set_storage_group("root.db_test_01") + session.set_storage_group("root.db_test_02") + session.set_storage_group("root.db_test_03") + session.set_storage_group("root.db_test_04") try: - session.delete_storage_group("root.sg_test_02") + session.delete_storage_group("root.db_test_02") except Exception: test_fail() print_message("delete database failed") try: - session.delete_storage_groups(["root.sg_test_03", "root.sg_test_04"]) + session.delete_storage_groups(["root.db_test_03", "root.db_test_04"]) except Exception: test_fail() print_message("delete databases failed") # setting time series. session.create_time_series( - "root.sg_test_01.d_01.s_01", + "root.db_test_01.d_01.s_01", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY, ) session.create_time_series( - "root.sg_test_01.d_01.s_02", + "root.db_test_01.d_01.s_02", TSDataType.INT32, TSEncoding.PLAIN, Compressor.SNAPPY, ) session.create_time_series( - "root.sg_test_01.d_01.s_03", + "root.db_test_01.d_01.s_03", TSDataType.INT64, TSEncoding.PLAIN, Compressor.SNAPPY, ) session.create_time_series( - "root.sg_test_01.d_02.s_01", + "root.db_test_01.d_02.s_01", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY, @@ -129,12 +129,12 @@ def session_test(use_session_pool=False): # setting multiple time series once. ts_path_lst_ = [ - "root.sg_test_01.d_01.s_04", - "root.sg_test_01.d_01.s_05", - "root.sg_test_01.d_01.s_06", - "root.sg_test_01.d_01.s_07", - "root.sg_test_01.d_01.s_08", - "root.sg_test_01.d_01.s_09", + "root.db_test_01.d_01.s_04", + "root.db_test_01.d_01.s_05", + "root.db_test_01.d_01.s_06", + "root.db_test_01.d_01.s_07", + "root.db_test_01.d_01.s_08", + "root.db_test_01.d_01.s_09", ] data_type_lst_ = [ TSDataType.FLOAT, @@ -150,12 +150,12 @@ def session_test(use_session_pool=False): ts_path_lst_, data_type_lst_, encoding_lst_, compressor_lst_ ) ts_path_lst_ = [ - "root.sg_test_01.d_02.s_04", - "root.sg_test_01.d_02.s_05", - "root.sg_test_01.d_02.s_06", - "root.sg_test_01.d_02.s_07", - "root.sg_test_01.d_02.s_08", - "root.sg_test_01.d_02.s_09", + "root.db_test_01.d_02.s_04", + "root.db_test_01.d_02.s_05", + "root.db_test_01.d_02.s_06", + "root.db_test_01.d_02.s_07", + "root.db_test_01.d_02.s_08", + "root.db_test_01.d_02.s_09", ] data_type_lst_ = [ TSDataType.FLOAT, @@ -184,9 +184,9 @@ def session_test(use_session_pool=False): try: session.delete_time_series( [ - "root.sg_test_01.d_01.s_07", - "root.sg_test_01.d_01.s_08", - "root.sg_test_01.d_01.s_09", + "root.db_test_01.d_01.s_07", + "root.db_test_01.d_01.s_08", + "root.db_test_01.d_01.s_09", ] ) except Exception: @@ -195,22 +195,22 @@ def session_test(use_session_pool=False): # checking time series # s_07 expecting False - if session.check_time_series_exists("root.sg_test_01.d_01.s_07"): + if session.check_time_series_exists("root.db_test_01.d_01.s_07"): test_fail() - print_message("root.sg_test_01.d_01.s_07 shouldn't exist") + print_message("root.db_test_01.d_01.s_07 shouldn't exist") # s_03 expecting True - if not session.check_time_series_exists("root.sg_test_01.d_01.s_03"): + if not session.check_time_series_exists("root.db_test_01.d_01.s_03"): test_fail() - print_message("root.sg_test_01.d_01.s_03 should exist") + print_message("root.db_test_01.d_01.s_03 should exist") # d_02.s_01 expecting True - if not session.check_time_series_exists("root.sg_test_01.d_02.s_01"): + if not session.check_time_series_exists("root.db_test_01.d_02.s_01"): test_fail() - print_message("root.sg_test_01.d_02.s_01 should exist") + print_message("root.db_test_01.d_02.s_01 should exist") # d_02.s_06 expecting True - if not session.check_time_series_exists("root.sg_test_01.d_02.s_06"): + if not session.check_time_series_exists("root.db_test_01.d_02.s_06"): test_fail() - print_message("root.sg_test_01.d_02.s_06 should exist") + print_message("root.db_test_01.d_02.s_06 should exist") # insert one record into the database. measurements_ = ["s_01", "s_02", "s_03", "s_04", "s_05", "s_06"] @@ -225,7 +225,7 @@ def session_test(use_session_pool=False): ] try: session.insert_record( - "root.sg_test_01.d_01", 1, measurements_, data_types_, values_ + "root.db_test_01.d_01", 1, measurements_, data_types_, values_ ) except Exception: test_fail() @@ -244,7 +244,7 @@ def session_test(use_session_pool=False): ] try: session.insert_record( - "root.sg_test_01.d_01", 1, measurements_, data_types_, values_ + "root.db_test_01.d_01", 1, measurements_, data_types_, values_ ) except Exception: test_fail() @@ -260,7 +260,7 @@ def session_test(use_session_pool=False): [True, 77, 88, 1.25, 8.125, bytes("test_records02", "utf-8")], ] data_type_list_ = [data_types_, data_types_] - device_ids_ = ["root.sg_test_01.d_01", "root.sg_test_01.d_02"] + device_ids_ = ["root.db_test_01.d_01", "root.db_test_01.d_02"] try: session.insert_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ @@ -279,7 +279,7 @@ def session_test(use_session_pool=False): [None, None, None, None, 8.125, bytes("test_records02", "utf-8")], ] data_type_list_ = [data_types_, data_types_] - device_ids_ = ["root.sg_test_01.d_01", "root.sg_test_01.d_02"] + device_ids_ = ["root.db_test_01.d_01", "root.db_test_01.d_02"] try: session.insert_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ @@ -293,7 +293,7 @@ def session_test(use_session_pool=False): [None, None, None, None, None, None], ] data_type_list_ = [data_types_, data_types_] - device_ids_ = ["root.sg_test_01.d_01", "root.sg_test_01.d_02"] + device_ids_ = ["root.db_test_01.d_01", "root.db_test_01.d_02"] try: session.insert_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ @@ -311,7 +311,7 @@ def session_test(use_session_pool=False): ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [4, 5, 6, 7] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) try: @@ -331,7 +331,7 @@ def session_test(use_session_pool=False): ] np_timestamps_ = np.array([1, 2, 3, 4], np.dtype(">i8")) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_, data_types_, np_values_, @@ -345,10 +345,10 @@ def session_test(use_session_pool=False): # insert multiple tablets into database tablet_01 = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, [8, 9, 10, 11] + "root.db_test_01.d_01", measurements_, data_types_, values_, [8, 9, 10, 11] ) tablet_02 = Tablet( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_, data_types_, values_, @@ -369,7 +369,7 @@ def session_test(use_session_pool=False): ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [20, 21, 22, 23] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) try: session.insert_tablet(tablet_) @@ -396,7 +396,7 @@ def session_test(use_session_pool=False): np_bitmaps_[4].mark(3) np_bitmaps_[5].mark(3) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_01", + "root.db_test_01.d_01", measurements_, data_types_, np_values_, @@ -425,7 +425,7 @@ def session_test(use_session_pool=False): try: session.insert_records_of_one_device( - "root.sg_test_01.d_01", + "root.db_test_01.d_01", time_list, measurements_list, data_types_list, @@ -438,17 +438,17 @@ def session_test(use_session_pool=False): # execute non-query sql statement try: session.execute_non_query_statement( - "insert into root.sg_test_01.d_01(timestamp, s_02) values(16, 188)" + "insert into root.db_test_01.d_01(timestamp, s_02) values(16, 188)" ) except Exception: test_fail() print_message( - "execute 'insert into root.sg_test_01.d_01(timestamp, s_02) values(16, 188)' failed" + "execute 'insert into root.db_test_01.d_01(timestamp, s_02) values(16, 188)' failed" ) # execute sql query statement session_data_set = session.execute_query_statement( - "select * from root.sg_test_01.d_01" + "select * from root.db_test_01.d_01" ) session_data_set.set_fetch_size(1024) expect_count = 20 diff --git a/iotdb-client/client-py/tests/integration/test_tablet.py b/iotdb-client/client-py/tests/integration/test_tablet.py index f91c1bc6dd645..cbad6af98df7b 100644 --- a/iotdb-client/client-py/tests/integration/test_tablet.py +++ b/iotdb-client/client-py/tests/integration/test_tablet.py @@ -30,7 +30,7 @@ def test_tablet_insertion(): db: IoTDBContainer session = Session(db.get_container_host_ip(), db.get_exposed_port(6667)) session.open(False) - session.execute_non_query_statement("CREATE DATABASE root.sg_test_01") + session.execute_non_query_statement("CREATE DATABASE root.db_test_01") measurements_ = ["s_01", "s_02", "s_03", "s_04", "s_05", "s_06"] data_types_ = [ @@ -49,17 +49,17 @@ def test_tablet_insertion(): ] timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) session.insert_tablet(tablet_) columns = [] for measurement in measurements_: - columns.append("root.sg_test_01.d_01." + measurement) + columns.append("root.db_test_01.d_01." + measurement) df_input = pd.DataFrame(values_, columns=columns, dtype=object) df_input.insert(0, "Time", np.array(timestamps_)) session_data_set = session.execute_query_statement( - "select s_01, s_02, s_03, s_04, s_05, s_06 from root.sg_test_01.d_01" + "select s_01, s_02, s_03, s_04, s_05, s_06 from root.db_test_01.d_01" ) df_output = session_data_set.todf() df_output = df_output[df_input.columns.tolist()].replace( @@ -75,7 +75,7 @@ def test_nullable_tablet_insertion(): db: IoTDBContainer session = Session(db.get_container_host_ip(), db.get_exposed_port(6667)) session.open(False) - session.execute_non_query_statement("CREATE DATABASE root.sg_test_01") + session.execute_non_query_statement("CREATE DATABASE root.db_test_01") measurements_ = ["s_01", "s_02", "s_03", "s_04", "s_05", "s_06"] data_types_ = [ @@ -94,17 +94,17 @@ def test_nullable_tablet_insertion(): ] timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) session.insert_tablet(tablet_) columns = [] for measurement in measurements_: - columns.append("root.sg_test_01.d_01." + measurement) + columns.append("root.db_test_01.d_01." + measurement) df_input = pd.DataFrame(values_, columns=columns, dtype=object) df_input.insert(0, "Time", np.array(timestamps_)) session_data_set = session.execute_query_statement( - "select s_01, s_02, s_03, s_04, s_05, s_06 from root.sg_test_01.d_01" + "select s_01, s_02, s_03, s_04, s_05, s_06 from root.db_test_01.d_01" ) df_output = session_data_set.todf() df_output = df_output[df_input.columns.tolist()] diff --git a/iotdb-client/client-py/tests/unit/test_numpy_tablet.py b/iotdb-client/client-py/tests/unit/test_numpy_tablet.py index 217df22ea2d3d..b3b565f5aadb1 100644 --- a/iotdb-client/client-py/tests/unit/test_numpy_tablet.py +++ b/iotdb-client/client-py/tests/unit/test_numpy_tablet.py @@ -43,7 +43,7 @@ def test_numpy_tablet_serialization(): ] timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) np_values_ = [ np.array([False, True, False, True], np.dtype(">?")), @@ -55,7 +55,7 @@ def test_numpy_tablet_serialization(): ] np_timestamps_ = np.array([16, 17, 18, 19], np.dtype(">i8")) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_01", measurements_, data_types_, np_values_, np_timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, np_values_, np_timestamps_ ) assert tablet_.get_binary_timestamps() == np_tablet_.get_binary_timestamps() assert tablet_.get_binary_values() == np_tablet_.get_binary_values() @@ -80,7 +80,7 @@ def test_numpy_tablet_with_none_serialization(): ] timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) np_values_ = [ np.array([False, True, False, True], np.dtype(">?")), @@ -100,7 +100,7 @@ def test_numpy_tablet_with_none_serialization(): np_bitmaps_[4].mark(3) np_bitmaps_[5].mark(3) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_01", + "root.db_test_01.d_01", measurements_, data_types_, np_values_, @@ -131,7 +131,7 @@ def test_sort_numpy_tablet(): ] timestamps_ = [5, 6, 7, 8, 9] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) np_values_unsorted = [ np.array([False, False, False, True, True], np.dtype(">?")), @@ -143,7 +143,7 @@ def test_sort_numpy_tablet(): ] np_timestamps_unsorted = np.array([9, 8, 7, 6, 5], np.dtype(">i8")) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_01", + "root.db_test_01.d_01", measurements_, data_types_, np_values_unsorted, @@ -173,7 +173,7 @@ def test_numpy_tablet_auto_correct_datatype(): ] timestamps_ = [5, 6, 7, 8, 9] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) np_values_unsorted = [ np.array([False, False, False, True, True]), @@ -189,7 +189,7 @@ def test_numpy_tablet_auto_correct_datatype(): for i in range(1, 4): assert np_values_unsorted[i].dtype != data_types_[i].np_dtype() np_tablet_ = NumpyTablet( - "root.sg_test_01.d_01", + "root.db_test_01.d_01", measurements_, data_types_, np_values_unsorted, diff --git a/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBJDBCResultSet.java b/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBJDBCResultSet.java index 3157b6c98c42a..9ff633083f90d 100644 --- a/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBJDBCResultSet.java +++ b/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBJDBCResultSet.java @@ -79,7 +79,7 @@ public class IoTDBJDBCResultSet implements ResultSet { protected IoTDBTracingInfo ioTDBRpcTracingInfo; private String operationType = ""; private List columns = null; - private List sgColumns = null; + private List dbColumns = null; private Charset charset = TSFileConfig.STRING_CHARSET; private String timeFormat = RpcUtils.DEFAULT_TIME_FORMAT; @@ -552,14 +552,14 @@ public ResultSetMetaData getMetaData() { try { if (statement.getResultSet() != null) { operationTypeColumn = ((IoTDBJDBCResultSet) statement.getResultSet()).getOperationType(); - this.sgColumns = ((IoTDBJDBCResultSet) statement.getResultSet()).getSgColumns(); + this.dbColumns = ((IoTDBJDBCResultSet) statement.getResultSet()).getDbColumns(); } } catch (SQLException throwables) { LOGGER.error("get meta data error: {}", throwables.getMessage()); } return new IoTDBResultMetadata( nonAlign, - sgColumns, + dbColumns, operationTypeColumn, ioTDBRpcDataSet.getColumnNameList(), ioTDBRpcDataSet.getColumnTypeList(), @@ -1320,8 +1320,8 @@ public List getColumns() { return this.columns; } - public List getSgColumns() { - return sgColumns; + public List getDbColumns() { + return dbColumns; } public TSDataType getColumnTypeByIndex(int columnIndex) { diff --git a/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBResultMetadata.java b/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBResultMetadata.java index 83bdc26133cd6..c2cc6af54ff29 100644 --- a/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBResultMetadata.java +++ b/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBResultMetadata.java @@ -31,7 +31,7 @@ public class IoTDBResultMetadata implements ResultSetMetaData { private List columnInfoList; private List columnTypeList; private boolean ignoreTimestamp; - private List sgColumns; + private List dbColumns; private String operationType = ""; private boolean nonAlign = false; @@ -53,12 +53,12 @@ public class IoTDBResultMetadata implements ResultSetMetaData { /** Constructor of IoTDBResultMetadata. */ public IoTDBResultMetadata( Boolean nonAlign, - List sgColumns, + List dbColumns, String operationType, List columnInfoList, List columnTypeList, boolean ignoreTimestamp) { - this.sgColumns = sgColumns; + this.dbColumns = dbColumns; this.operationType = operationType; this.columnInfoList = columnInfoList; this.columnTypeList = columnTypeList; @@ -134,9 +134,9 @@ public String getCatalogName(int column) throws SQLException { return systemNull; } if (nonAlign) { - return sgColumns.get(column - 1); + return dbColumns.get(column - 1); } else { - return sgColumns.get(column - 2); + return dbColumns.get(column - 2); } } diff --git a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBJDBCDataSet.java b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBJDBCDataSet.java index 5bba6d0ea718d..affea1aab77cd 100644 --- a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBJDBCDataSet.java +++ b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBJDBCDataSet.java @@ -213,7 +213,7 @@ public IoTDBJDBCDataSet( TSQueryDataSet queryDataSet, int fetchSize, long timeout, - List sgList, + List dbList, BitSet aliasColumnMap, ZoneId zoneId) { this.sessionId = sessionId; @@ -248,10 +248,10 @@ public IoTDBJDBCDataSet( } for (int i = 0; i < columnNameList.size(); i++) { String name = ""; - if (sgList != null - && !sgList.isEmpty() + if (dbList != null + && !dbList.isEmpty() && (aliasColumnMap == null || !aliasColumnMap.get(i))) { - name = sgList.get(i) + "." + columnNameList.get(i); + name = dbList.get(i) + "." + columnNameList.get(i); } else { name = columnNameList.get(i); } diff --git a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java index 40268a54cd340..50b312a7f6776 100644 --- a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java +++ b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java @@ -69,13 +69,13 @@ public class SessionCacheLeaderTest { // just for simulation public static TEndPoint getDeviceIdBelongedEndpoint(String deviceId) { - if (deviceId.startsWith("root.sg1")) { + if (deviceId.startsWith("root.db1")) { return endpoints.get(0); - } else if (deviceId.startsWith("root.sg2")) { + } else if (deviceId.startsWith("root.db2")) { return endpoints.get(1); - } else if (deviceId.startsWith("root.sg3")) { + } else if (deviceId.startsWith("root.db3")) { return endpoints.get(2); - } else if (deviceId.startsWith("root.sg4")) { + } else if (deviceId.startsWith("root.db4")) { return endpoints.get(3); } @@ -104,7 +104,7 @@ public void testInsertRecord() throws IoTDBConnectionException, StatementExecuti assertNull(session.deviceIdToEndpoint); assertNull(session.endPointToSessionConnection); - String deviceId = "root.sg2.d1"; + String deviceId = "root.db2.d1"; List measurements = new ArrayList<>(); List types = new ArrayList<>(); measurements.add("s1"); @@ -154,7 +154,7 @@ public void testInsertStringRecord() assertNull(session.deviceIdToEndpoint); assertNull(session.endPointToSessionConnection); - String deviceId = "root.sg2.d1"; + String deviceId = "root.db2.d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -202,10 +202,10 @@ public void testInsertRecords() throws IoTDBConnectionException, StatementExecut List allDeviceIds = new ArrayList() { { - add("root.sg1.d1"); - add("root.sg2.d1"); - add("root.sg3.d1"); - add("root.sg4.d1"); + add("root.db1.d1"); + add("root.db2.d1"); + add("root.db3.d1"); + add("root.db4.d1"); } }; List measurements = new ArrayList<>(); @@ -303,10 +303,10 @@ public void testInsertStringRecords() List allDeviceIds = new ArrayList() { { - add("root.sg1.d1"); - add("root.sg2.d1"); - add("root.sg3.d1"); - add("root.sg4.d1"); + add("root.db1.d1"); + add("root.db2.d1"); + add("root.db3.d1"); + add("root.db4.d1"); } }; List measurements = new ArrayList<>(); @@ -386,7 +386,7 @@ public void testInsertRecordsOfOneDevice() assertNull(session.deviceIdToEndpoint); assertNull(session.endPointToSessionConnection); - String deviceId = "root.sg2.d2"; + String deviceId = "root.db2.d2"; List times = new ArrayList<>(); List> measurements = new ArrayList<>(); List> datatypes = new ArrayList<>(); @@ -454,7 +454,7 @@ public void testInsertTablet() throws IoTDBConnectionException, StatementExecuti assertNull(session.deviceIdToEndpoint); assertNull(session.endPointToSessionConnection); - String deviceId = "root.sg2.d2"; + String deviceId = "root.db2.d2"; List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT64)); @@ -527,10 +527,10 @@ public void testInsertTablets() throws IoTDBConnectionException, StatementExecut List allDeviceIds = new ArrayList() { { - add("root.sg1.d1"); - add("root.sg2.d1"); - add("root.sg3.d1"); - add("root.sg4.d1"); + add("root.db1.d1"); + add("root.db2.d1"); + add("root.db3.d1"); + add("root.db4.d1"); } }; List schemaList = new ArrayList<>(); @@ -721,10 +721,10 @@ public void testInsertRecordsWithSessionBroken() throws StatementExecutionExcept List allDeviceIds = new ArrayList() { { - add("root.sg1.d1"); - add("root.sg2.d1"); - add("root.sg3.d1"); - add("root.sg4.d1"); + add("root.db1.d1"); + add("root.db2.d1"); + add("root.db3.d1"); + add("root.db4.d1"); } }; List measurements = new ArrayList<>(); @@ -830,7 +830,7 @@ public void testInsertRecordsWithSessionBroken() throws StatementExecutionExcept // ((MockSession) session).getLastConstructedSessionConnection(), the session's endpoint has // been changed to TEndPoint(ip:127.0.0.1, port:55561) Assert.assertEquals( - "MockSessionConnection{ endPoint=TEndPoint(ip:127.0.0.1, port:55561)}", + "MockSessionConnection{ endPoint=TEndPoint(ip:127.0.0.1, port:55562)}", ((MockSession) session).getLastConstructedSessionConnection().toString()); ((MockSession) session).getLastConstructedSessionConnection().setConnectionBroken(true); try { @@ -867,10 +867,10 @@ public void testInsertTabletsWithSessionBroken() throws StatementExecutionExcept List allDeviceIds = new ArrayList() { { - add("root.sg1.d1"); - add("root.sg2.d1"); - add("root.sg3.d1"); - add("root.sg4.d1"); + add("root.db1.d1"); + add("root.db2.d1"); + add("root.db3.d1"); + add("root.db4.d1"); } }; List schemaList = new ArrayList<>(); diff --git a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionConnectionTest.java b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionConnectionTest.java index a10d9b1d6f4da..7c3335131eb7e 100644 --- a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionConnectionTest.java +++ b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionConnectionTest.java @@ -348,7 +348,7 @@ public void testInsertRecord() sessionConnection.testInsertTablet(new TSInsertTabletReq()); sessionConnection.insertTablets(new TSInsertTabletsReq()); sessionConnection.testInsertTablets(new TSInsertTabletsReq()); - sessionConnection.deleteTimeseries(Arrays.asList("root.sg1.d1.s1")); + sessionConnection.deleteTimeseries(Arrays.asList("root.db1.d1.s1")); } @Test diff --git a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionTest.java b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionTest.java index e4d2dbbb41dc8..54fa7f432639c 100644 --- a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionTest.java +++ b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionTest.java @@ -78,7 +78,7 @@ public void setUp() throws IoTDBConnectionException, StatementExecutionException .build(); Whitebox.setInternalState(session, "defaultSessionConnection", sessionConnection); TSQueryTemplateResp resp = new TSQueryTemplateResp(); - resp.setMeasurements(Arrays.asList("root.sg1.d1.s1")); + resp.setMeasurements(Arrays.asList("root.db1.d1.s1")); Mockito.when(sessionConnection.querySchemaTemplate(any())).thenReturn(resp); HashMap deviceIdToEndpoint = new HashMap<>(); deviceIdToEndpoint.put("device1", new TEndPoint()); @@ -145,34 +145,34 @@ public void testTimeZone() throws IoTDBConnectionException, StatementExecutionEx @Test public void testSetStorageGroup() throws IoTDBConnectionException, StatementExecutionException { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); } @Test public void testDeleteStorageGroup() throws IoTDBConnectionException, StatementExecutionException { - session.deleteStorageGroup("root.sg1"); + session.deleteStorageGroup("root.db1"); } @Test public void testDeleteStorageGroups() throws IoTDBConnectionException, StatementExecutionException { - session.deleteStorageGroups(Arrays.asList("root.sg1")); + session.deleteStorageGroups(Arrays.asList("root.db1")); } @Test public void testCreateDatabase() throws IoTDBConnectionException, StatementExecutionException { - session.createDatabase("root.sg1"); + session.createDatabase("root.db1"); } @Test public void testDeleteDatabase() throws IoTDBConnectionException, StatementExecutionException { - session.deleteDatabase("root.sg1"); + session.deleteDatabase("root.db1"); } @Test public void testDeleteDatabases() throws IoTDBConnectionException, StatementExecutionException { - session.deleteDatabases(Arrays.asList("root.sg1")); + session.deleteDatabases(Arrays.asList("root.db1")); } @Test @@ -214,7 +214,7 @@ public void testCreateMultiTimeseries() @Test public void testCheckTimeseriesExists() throws IoTDBConnectionException, StatementExecutionException { - session.checkTimeseriesExists("root.sg1.d1.s1"); + session.checkTimeseriesExists("root.db1.d1.s1"); } @Test @@ -229,18 +229,18 @@ public void testSetAndGetQueryTimeout() { public void testInsertRecord() throws IoTDBConnectionException, StatementExecutionException { List measurements = Arrays.asList("s1", "s2"); List types = Arrays.asList(TSDataType.TEXT, TSDataType.FLOAT); - session.insertRecord("root.sg1.d1", 1691999031779l, measurements, types, "测试", 22.3f); + session.insertRecord("root.db1.d1", 1691999031779l, measurements, types, "测试", 22.3f); } @Test public void testDeleteTimeseries() throws IoTDBConnectionException, StatementExecutionException { - session.deleteTimeseries("root.sg1.d1.s1"); + session.deleteTimeseries("root.db1.d1.s1"); } @Test public void testDeleteTimeseriesList() throws IoTDBConnectionException, StatementExecutionException { - session.deleteTimeseries(Arrays.asList("root.sg1.d1.s1")); + session.deleteTimeseries(Arrays.asList("root.db1.d1.s1")); } @Test @@ -249,13 +249,13 @@ public void testInsertAlignedRecord() List measurements = Arrays.asList("s1", "s2"); List types = Arrays.asList(TSDataType.TEXT, TSDataType.FLOAT); List values = Arrays.asList("测试", 22.3f); - session.insertAlignedRecord("root.sg1.d1", 1691999031779l, measurements, types, values); + session.insertAlignedRecord("root.db1.d1", 1691999031779l, measurements, types, values); List values0 = Arrays.asList(null, 22.3f); - session.insertAlignedRecord("root.sg1.d1", 1691999031779l, measurements, types, values0); + session.insertAlignedRecord("root.db1.d1", 1691999031779l, measurements, types, values0); List values1 = Arrays.asList("测试", "22.3f"); - session.insertAlignedRecord("root.sg1.d1", 1691999031779l, measurements, values1); + session.insertAlignedRecord("root.db1.d1", 1691999031779l, measurements, values1); List values2 = Arrays.asList("测试"); - session.insertAlignedRecord("root.sg1.d1", 1691999031779l, measurements, values2); + session.insertAlignedRecord("root.db1.d1", 1691999031779l, measurements, values2); } @Test @@ -280,35 +280,35 @@ public void testExecuteNonQueryStatement() @Test public void testExecuteRawDataQuery() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); session.executeRawDataQuery(paths, 2l, 10l, 500l); } @Test public void testExecuteLastDataQuery() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); session.executeLastDataQuery(paths, 10l); } @Test public void testExecuteLastDataQueryTimeout() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); session.executeLastDataQuery(paths, 10l, 500l); } @Test public void testExecuteLastDataQueryWithPaths() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); session.executeLastDataQuery(paths); } @Test public void testExecuteAggregationQuery() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List aggregations = Arrays.asList(TAggregationType.LAST_VALUE, TAggregationType.MAX_VALUE); session.executeAggregationQuery(paths, aggregations); @@ -317,7 +317,7 @@ public void testExecuteAggregationQuery() @Test public void testExecuteAggregationQueryWithStartTimeEndTime() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List aggregations = Arrays.asList(TAggregationType.LAST_VALUE, TAggregationType.MAX_VALUE); session.executeAggregationQuery(paths, aggregations, 2l, 10l); @@ -326,7 +326,7 @@ public void testExecuteAggregationQueryWithStartTimeEndTime() @Test public void testExecuteAggregationQueryWithInterval() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List aggregations = Arrays.asList(TAggregationType.LAST_VALUE, TAggregationType.MAX_VALUE); session.executeAggregationQuery(paths, aggregations, 2l, 10000l, 5000); @@ -335,7 +335,7 @@ public void testExecuteAggregationQueryWithInterval() @Test public void testExecuteAggregationQueryWithIntervalSlidingStep() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List aggregations = Arrays.asList(TAggregationType.LAST_VALUE, TAggregationType.MAX_VALUE); session.executeAggregationQuery(paths, aggregations, 2l, 100000l, 5000, 5000); @@ -786,20 +786,20 @@ public void testTestInsertRecordWithDataTypeException() @Test public void testDeleteDataException() throws IoTDBConnectionException, StatementExecutionException { - session.deleteData("root.sg1.d1.s1", System.currentTimeMillis()); + session.deleteData("root.db1.d1.s1", System.currentTimeMillis()); } @Test public void testDeleteDataListException() throws IoTDBConnectionException, StatementExecutionException { - session.deleteData(Arrays.asList("root.sg1.d1.s1"), System.currentTimeMillis()); + session.deleteData(Arrays.asList("root.db1.d1.s1"), System.currentTimeMillis()); } @Test public void testDeleteDataListWithStartTimeAndEndTimeException() throws IoTDBConnectionException, StatementExecutionException { session.deleteData( - Arrays.asList("root.sg1.d1.s1"), + Arrays.asList("root.db1.d1.s1"), System.currentTimeMillis() - 1000 * 60 * 20, System.currentTimeMillis()); } @@ -1091,7 +1091,7 @@ public void testAddAlignedMeasurementsInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { session.addAlignedMeasurementsInTemplate( "template1", - Arrays.asList("root.sg1.d1.s1"), + Arrays.asList("root.db1.d1.s1"), Arrays.asList(TSDataType.INT64), Arrays.asList(TSEncoding.PLAIN), Arrays.asList(CompressionType.SNAPPY)); @@ -1101,7 +1101,7 @@ public void testAddAlignedMeasurementsInTemplate() public void testAddAlignedMeasurementInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { session.addAlignedMeasurementInTemplate( - "template1", "root.sg1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); + "template1", "root.db1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); } @Test @@ -1109,7 +1109,7 @@ public void testAddUnalignedMeasurementsInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { session.addUnalignedMeasurementsInTemplate( "template1", - Arrays.asList("root.sg1.d1.s1"), + Arrays.asList("root.db1.d1.s1"), Arrays.asList(TSDataType.INT64), Arrays.asList(TSEncoding.PLAIN), Arrays.asList(CompressionType.SNAPPY)); @@ -1119,13 +1119,13 @@ public void testAddUnalignedMeasurementsInTemplate() public void testAddUnalignedMeasurementInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { session.addUnalignedMeasurementInTemplate( - "template1", "root.sg1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); + "template1", "root.db1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); } @Test public void testDeleteNodeInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { - session.deleteNodeInTemplate("template1", "root.sg1.d1.s1"); + session.deleteNodeInTemplate("template1", "root.db1.d1.s1"); } @Test @@ -1137,13 +1137,13 @@ public void testCountMeasurementsInTemplate() @Test public void testIsMeasurementInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { - session.isMeasurementInTemplate("template1", "root.sg1.d1.s1"); + session.isMeasurementInTemplate("template1", "root.db1.d1.s1"); } @Test public void testIsPathExistInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { - session.isPathExistInTemplate("template1", "root.sg1.d1.s1"); + session.isPathExistInTemplate("template1", "root.db1.d1.s1"); } @Test @@ -1155,7 +1155,7 @@ public void testShowMeasurementsInTemplate() @Test public void testShowMeasurementsInTemplatePattern() throws IoTDBConnectionException, StatementExecutionException { - session.showMeasurementsInTemplate("template1", "root.sg1.**"); + session.showMeasurementsInTemplate("template1", "root.db1.**"); } @Test @@ -1178,7 +1178,7 @@ public void testShowPathsTemplateUsingOn() @Test public void testUnsetSchemaTemplate() throws IoTDBConnectionException, StatementExecutionException { - session.unsetSchemaTemplate("root.sg1.d1.**", "template1"); + session.unsetSchemaTemplate("root.db1.d1.**", "template1"); } @Test @@ -1190,7 +1190,7 @@ public void testDropSchemaTemplate() @Test public void testCreateTimeseriesUsingSchemaTemplate() throws IoTDBConnectionException, StatementExecutionException { - session.createTimeseriesUsingSchemaTemplate(Arrays.asList("root.sg1.d1", "root.sg1.d2")); + session.createTimeseriesUsingSchemaTemplate(Arrays.asList("root.db1.d1", "root.db1.d2")); } @Test diff --git a/iotdb-client/session/src/test/java/org/apache/iotdb/session/TabletTest.java b/iotdb-client/session/src/test/java/org/apache/iotdb/session/TabletTest.java index bc9469e57a4a4..13b12586b0e4d 100644 --- a/iotdb-client/session/src/test/java/org/apache/iotdb/session/TabletTest.java +++ b/iotdb-client/session/src/test/java/org/apache/iotdb/session/TabletTest.java @@ -50,7 +50,7 @@ public void testSortTablet() { schemaList.add(new MeasurementSchema("s9", TSDataType.STRING)); ; // insert three rows data - Tablet tablet = new Tablet("root.sg1.d1", schemaList, 3); + Tablet tablet = new Tablet("root.db1.d1", schemaList, 3); Object[] values = tablet.getValues(); /* diff --git a/iotdb-client/session/src/test/java/org/apache/iotdb/session/pool/SessionPoolTest.java b/iotdb-client/session/src/test/java/org/apache/iotdb/session/pool/SessionPoolTest.java index ce48172af2b87..72e2ce02e937e 100644 --- a/iotdb-client/session/src/test/java/org/apache/iotdb/session/pool/SessionPoolTest.java +++ b/iotdb-client/session/src/test/java/org/apache/iotdb/session/pool/SessionPoolTest.java @@ -827,8 +827,8 @@ public void testDeleteStorageGroup() @Test public void testDeleteStorageGroups() throws IoTDBConnectionException, StatementExecutionException { - List sgs = Arrays.asList("root.device2", "root.device3"); - sessionPool.deleteStorageGroups(sgs); + List dbs = Arrays.asList("root.device2", "root.device3"); + sessionPool.deleteStorageGroups(dbs); assertEquals( 1, ((ConcurrentLinkedDeque) Whitebox.getInternalState(sessionPool, "queue")).size()); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java index b2bef37fbcf6a..ada13e705127c 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java @@ -28,18 +28,18 @@ public class CountDatabasePlan extends ConfigPhysicalReadPlan { - private final String[] storageGroupPattern; + private final String[] databasePattern; private final PathPatternTree scope; private final boolean isTableModel; private final boolean canSeeAuditDB; public CountDatabasePlan( - final List storageGroupPattern, + final List databasePattern, final PathPatternTree scope, final boolean isTableModel, final boolean canSeeAuditDB) { super(ConfigPhysicalPlanType.CountDatabase); - this.storageGroupPattern = storageGroupPattern.toArray(new String[0]); + this.databasePattern = databasePattern.toArray(new String[0]); this.scope = scope; this.isTableModel = isTableModel; this.canSeeAuditDB = canSeeAuditDB; @@ -47,19 +47,19 @@ public CountDatabasePlan( public CountDatabasePlan( final ConfigPhysicalPlanType type, - final List storageGroupPattern, + final List databasePattern, final PathPatternTree scope, final boolean isTableModel, final boolean canSeeAuditDB) { super(type); - this.storageGroupPattern = storageGroupPattern.toArray(new String[0]); + this.databasePattern = databasePattern.toArray(new String[0]); this.scope = scope; this.isTableModel = isTableModel; this.canSeeAuditDB = canSeeAuditDB; } public String[] getDatabasePattern() { - return storageGroupPattern; + return databasePattern; } public PathPatternTree getScope() { @@ -83,11 +83,11 @@ public boolean equals(final Object o) { return false; } final CountDatabasePlan that = (CountDatabasePlan) o; - return Arrays.equals(storageGroupPattern, that.storageGroupPattern); + return Arrays.equals(databasePattern, that.databasePattern); } @Override public int hashCode() { - return Arrays.hashCode(storageGroupPattern); + return Arrays.hashCode(databasePattern); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java index dc90c6e3ba540..3e0491730c19f 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java @@ -28,14 +28,14 @@ public class GetDatabasePlan extends CountDatabasePlan { private final boolean isShowDatabasePlan; public GetDatabasePlan( - final List storageGroupPathPattern, + final List databasePathPattern, final PathPatternTree scope, final boolean isTableModel, final boolean isShowDatabasePlan, final boolean canSeeAuditDB) { super( ConfigPhysicalPlanType.GetDatabase, - storageGroupPathPattern, + databasePathPattern, scope, isTableModel, canSeeAuditDB); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java index cce8e14611490..f243716cb2bc6 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java @@ -32,7 +32,7 @@ /** Get or create DataPartition by the specific partitionSlotsMap. */ public class GetDataPartitionPlan extends ConfigPhysicalReadPlan { - // Map>> + // Map>> protected Map> partitionSlotsMap; public GetDataPartitionPlan(final ConfigPhysicalPlanType configPhysicalPlanType) { diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java index 8bfccd18a1c62..93640d304645b 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java @@ -30,9 +30,9 @@ /** Get or create SchemaPartition by the specific partitionSlotsMap. */ public class GetSchemaPartitionPlan extends ConfigPhysicalReadPlan { - // Map> + // Map> // Get all SchemaPartitions when the partitionSlotsMap is empty - // Get all exists SchemaPartitions in one StorageGroup when the SeriesPartitionSlot is empty + // Get all exists SchemaPartitions in one Database when the SeriesPartitionSlot is empty protected Map> partitionSlotsMap; public GetSchemaPartitionPlan(final ConfigPhysicalPlanType configPhysicalPlanType) { diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/AdjustMaxRegionGroupNumPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/AdjustMaxRegionGroupNumPlan.java index 42b98cc30d03b..ca4ebb46152d6 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/AdjustMaxRegionGroupNumPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/AdjustMaxRegionGroupNumPlan.java @@ -34,7 +34,7 @@ public class AdjustMaxRegionGroupNumPlan extends ConfigPhysicalPlan { - // Map> + // Map> public final Map> maxRegionGroupNumMap; public AdjustMaxRegionGroupNumPlan() { @@ -42,8 +42,8 @@ public AdjustMaxRegionGroupNumPlan() { this.maxRegionGroupNumMap = new HashMap<>(); } - public void putEntry(final String storageGroup, final Pair maxRegionGroupNum) { - maxRegionGroupNumMap.put(storageGroup, maxRegionGroupNum); + public void putEntry(final String database, final Pair maxRegionGroupNum) { + maxRegionGroupNumMap.put(database, maxRegionGroupNum); } public Map> getMaxRegionGroupNumMap() { @@ -65,14 +65,14 @@ protected void serializeImpl(final DataOutputStream stream) throws IOException { @Override protected void deserializeImpl(final ByteBuffer buffer) throws IOException { - final int storageGroupNum = buffer.getInt(); + final int databaseNum = buffer.getInt(); - for (int i = 0; i < storageGroupNum; i++) { - final String storageGroup = ReadWriteIOUtils.readString(buffer); + for (int i = 0; i < databaseNum; i++) { + final String database = ReadWriteIOUtils.readString(buffer); final int maxSchemaRegionGroupNum = buffer.getInt(); final int maxDataRegionGroupNum = buffer.getInt(); maxRegionGroupNumMap.put( - storageGroup, new Pair<>(maxSchemaRegionGroupNum, maxDataRegionGroupNum)); + database, new Pair<>(maxSchemaRegionGroupNum, maxDataRegionGroupNum)); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/SetTimePartitionIntervalPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/SetTimePartitionIntervalPlan.java index 69fcd910c651c..7afc98296d54f 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/SetTimePartitionIntervalPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/SetTimePartitionIntervalPlan.java @@ -30,7 +30,7 @@ public class SetTimePartitionIntervalPlan extends ConfigPhysicalPlan { - private String storageGroup; + private String database; private long timePartitionInterval; @@ -38,14 +38,14 @@ public SetTimePartitionIntervalPlan() { super(ConfigPhysicalPlanType.SetTimePartitionInterval); } - public SetTimePartitionIntervalPlan(String storageGroup, long timePartitionInterval) { + public SetTimePartitionIntervalPlan(String database, long timePartitionInterval) { this(); - this.storageGroup = storageGroup; + this.database = database; this.timePartitionInterval = timePartitionInterval; } public String getDatabase() { - return storageGroup; + return database; } public long getTimePartitionInterval() { @@ -56,13 +56,13 @@ public long getTimePartitionInterval() { protected void serializeImpl(DataOutputStream stream) throws IOException { stream.writeShort(getType().getPlanType()); - BasicStructureSerDeUtil.write(storageGroup, stream); + BasicStructureSerDeUtil.write(database, stream); stream.writeLong(timePartitionInterval); } @Override protected void deserializeImpl(ByteBuffer buffer) throws IOException { - storageGroup = BasicStructureSerDeUtil.readString(buffer); + database = BasicStructureSerDeUtil.readString(buffer); timePartitionInterval = buffer.getLong(); } @@ -75,12 +75,11 @@ public boolean equals(Object o) { return false; } SetTimePartitionIntervalPlan that = (SetTimePartitionIntervalPlan) o; - return timePartitionInterval == that.timePartitionInterval - && storageGroup.equals(that.storageGroup); + return timePartitionInterval == that.timePartitionInterval && database.equals(that.database); } @Override public int hashCode() { - return Objects.hash(storageGroup, timePartitionInterval); + return Objects.hash(database, timePartitionInterval); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateDataPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateDataPartitionPlan.java index 89612da48df7c..985a9830ba600 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateDataPartitionPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateDataPartitionPlan.java @@ -76,8 +76,8 @@ protected void serializeImpl(DataOutputStream stream) throws IOException { protected void deserializeImpl(ByteBuffer buffer) throws IOException { assignedDataPartition = new HashMap<>(); - int storageGroupNum = buffer.getInt(); - for (int i = 0; i < storageGroupNum; i++) { + int databaseNum = buffer.getInt(); + for (int i = 0; i < databaseNum; i++) { String storageGroup = BasicStructureSerDeUtil.readString(buffer); DataPartitionTable dataPartitionTable = new DataPartitionTable(); dataPartitionTable.deserialize(buffer); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateSchemaPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateSchemaPartitionPlan.java index 5aee476ef2296..2a26ceea53a09 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateSchemaPartitionPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateSchemaPartitionPlan.java @@ -78,12 +78,12 @@ protected void serializeImpl(DataOutputStream stream) throws IOException { protected void deserializeImpl(ByteBuffer buffer) throws IOException { assignedSchemaPartition = new HashMap<>(); - int storageGroupNum = buffer.getInt(); - for (int i = 0; i < storageGroupNum; i++) { - String storageGroup = BasicStructureSerDeUtil.readString(buffer); + int databaseNum = buffer.getInt(); + for (int i = 0; i < databaseNum; i++) { + String database = BasicStructureSerDeUtil.readString(buffer); SchemaPartitionTable schemaPartitionTable = new SchemaPartitionTable(); schemaPartitionTable.deserialize(buffer); - assignedSchemaPartition.put(storageGroup, schemaPartitionTable); + assignedSchemaPartition.put(database, schemaPartitionTable); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/CountDatabaseResp.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/CountDatabaseResp.java index b034c07c4bbb3..0c9d9577bc96d 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/CountDatabaseResp.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/CountDatabaseResp.java @@ -46,7 +46,7 @@ public void setCount(int count) { this.count = count; } - public void convertToRPCCountStorageGroupResp(TCountDatabaseResp resp) { + public void convertToRPCCountDatabaseResp(TCountDatabaseResp resp) { resp.setStatus(status); if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { resp.setCount(count); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/DatabaseSchemaResp.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/DatabaseSchemaResp.java index 52407277fbb3c..4cd3431e80d17 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/DatabaseSchemaResp.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/DatabaseSchemaResp.java @@ -50,7 +50,7 @@ public void setSchemaMap(Map schemaMap) { this.schemaMap = schemaMap; } - public TDatabaseSchemaResp convertToRPCStorageGroupSchemaResp() { + public TDatabaseSchemaResp convertToRPCDatabaseSchemaResp() { TDatabaseSchemaResp resp = new TDatabaseSchemaResp(); resp.setStatus(status); if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java index 5d4b09adfc710..1a5a38fbdfd5f 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java @@ -825,15 +825,15 @@ private List calculateRelatedSlot( if (path.getFullPath().contains(IoTDBConstant.MULTI_LEVEL_PATH_WILDCARD)) { return new ArrayList<>(); } - // with database = root.sg, path = root.*.d1 - // convert path = root.sg.d1 + // with database = root.db, path = root.*.d1 + // convert path = root.db.d1 final List innerPathList = path.alterPrefixPath(database); if (innerPathList.isEmpty()) { return new ArrayList<>(); } final String[] devicePath = Arrays.copyOf(innerPathList.get(0).getNodes(), innerPathList.get(0).getNodeLength() - 1); - // root.sg1.*.d1 + // root.db1.*.d1 for (final String node : devicePath) { if (node.contains(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD)) { return Collections.emptyList(); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java index 576d805c78624..b3c67277a25c8 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java @@ -192,8 +192,7 @@ public SchemaPartitionResp getSchemaPartition(final GetSchemaPartitionPlan req) /** * Thread-safely get DataPartition * - * @param req DataPartitionPlan with Map> + * @param req DataPartitionPlan with Map> * @return DataPartitionDataSet that contains only existing DataPartition */ public DataPartitionResp getDataPartition(final GetDataPartitionPlan req) { @@ -211,9 +210,10 @@ public DataPartitionResp getDataPartition(final GetDataPartitionPlan req) { * Get SchemaPartition and create a new one if it does not exist. * * @param req SchemaPartitionPlan with partitionSlotsMap - * @return SchemaPartitionResp with DataPartition and TSStatus. SUCCESS_STATUS if all process - * finish. NOT_ENOUGH_DATA_NODE if the DataNodes is not enough to create new Regions. - * STORAGE_GROUP_NOT_EXIST if some StorageGroup don't exist. + * @return SchemaPartitionResp with DataPartition and TSStatus. {@link + * TSStatusCode#SUCCESS_STATUS} if all process finish. {@link TSStatusCode#NO_ENOUGH_DATANODE} + * if the DataNodes is not enough to create new Regions. {@link + * TSStatusCode#DATABASE_NOT_EXIST} if some Databases don't exist. */ public SchemaPartitionResp getOrCreateSchemaPartition(final GetOrCreateSchemaPartitionPlan req) { // Check if the related Databases exist @@ -269,15 +269,15 @@ public SchemaPartitionResp getOrCreateSchemaPartition(final GetOrCreateSchemaPar final Map> unassignedSchemaPartitionSlotsMap = partitionInfo.filterUnassignedSchemaPartitionSlots(req.getPartitionSlotsMap()); - // Here we ensure that each StorageGroup has at least one SchemaRegion. - // And if some StorageGroups own too many slots, extend SchemaRegion for them. + // Here we ensure that each Database has at least one SchemaRegion. + // And if some Databases own too many slots, extend SchemaRegion for them. - // Map + // Map final Map unassignedSchemaPartitionSlotsCountMap = new ConcurrentHashMap<>(); unassignedSchemaPartitionSlotsMap.forEach( - (storageGroup, unassignedSchemaPartitionSlots) -> + (database, unassignedSchemaPartitionSlots) -> unassignedSchemaPartitionSlotsCountMap.put( - storageGroup, unassignedSchemaPartitionSlots.size())); + database, unassignedSchemaPartitionSlots.size())); TSStatus status = extendRegionGroupIfNecessary( unassignedSchemaPartitionSlotsCountMap, TConsensusGroupType.SchemaRegion); @@ -352,7 +352,7 @@ public SchemaPartitionResp getOrCreateSchemaPartition(final GetOrCreateSchemaPar /** * Get DataPartition and create a new one if it does not exist. * - * @param req DataPartitionPlan with Map{@literal <}StorageGroupName, Map{@literal + * @param req DataPartitionPlan with Map{@literal <}DatabaseName, Map{@literal * <}SeriesPartitionSlot, List{@literal <}TimePartitionSlot{@literal >}{@literal >}{@literal * >} * @return DataPartitionResp with DataPartition and {@link TSStatus}. {@link @@ -414,15 +414,15 @@ public DataPartitionResp getOrCreateDataPartition(final GetOrCreateDataPartition Map> unassignedDataPartitionSlotsMap = partitionInfo.filterUnassignedDataPartitionSlots(req.getPartitionSlotsMap()); - // Here we ensure that each StorageGroup has at least one DataRegion. - // And if some StorageGroups own too many slots, extend DataRegion for them. + // Here we ensure that each Database has at least one DataRegion. + // And if some Databases own too many slots, extend DataRegion for them. - // Map + // Map Map unassignedDataPartitionSlotsCountMap = new ConcurrentHashMap<>(); unassignedDataPartitionSlotsMap.forEach( - (storageGroup, unassignedDataPartitionSlots) -> + (database, unassignedDataPartitionSlots) -> unassignedDataPartitionSlotsCountMap.put( - storageGroup, unassignedDataPartitionSlots.size())); + database, unassignedDataPartitionSlots.size())); TSStatus status = extendRegionGroupIfNecessary( unassignedDataPartitionSlotsCountMap, TConsensusGroupType.DataRegion); @@ -534,12 +534,14 @@ private TSStatus consensusWritePartitionResult(ConfigPhysicalPlan plan) { // ====================================================== /** - * Allocate more RegionGroup to the specified StorageGroups if necessary. + * Allocate more RegionGroup to the specified Databases if necessary. * - * @param unassignedPartitionSlotsCountMap Map + * @param unassignedPartitionSlotsCountMap Map{@literal <}Database, unassigned Partition + * count{@literal >} * @param consensusGroupType SchemaRegion or DataRegion - * @return SUCCESS_STATUS when RegionGroup extension successful; NOT_ENOUGH_DATA_NODE when there - * are not enough DataNodes; STORAGE_GROUP_NOT_EXIST when some StorageGroups don't exist + * @return {@link TSStatusCode#SUCCESS_STATUS} when RegionGroup extension successful; {@link + * TSStatusCode#NO_ENOUGH_DATANODE} when there are not enough DataNodes; {@link + * TSStatusCode#DATABASE_NOT_EXIST} when some Databases don't exist */ private TSStatus extendRegionGroupIfNecessary( final Map unassignedPartitionSlotsCountMap, @@ -939,9 +941,9 @@ public long getAssignedTimePartitionSlotsCount(String database) { * * @param database DatabaseName * @param type SchemaRegion or DataRegion - * @return The specific StorageGroup's Regions that sorted by the number of allocated slots - * @throws NoAvailableRegionGroupException When all RegionGroups within the specified StorageGroup - * are unavailable currently + * @return The specific Database's Regions that sorted by the number of allocated slots + * @throws NoAvailableRegionGroupException When all RegionGroups within the specified Database are + * unavailable currently */ public List> getSortedRegionGroupSlotsCounter( final String database, final TConsensusGroupType type) @@ -1343,7 +1345,7 @@ public void maintainRegionReplicas() { schemaRegionCreateTask.getRegionId().getId(), new TCreateSchemaRegionReq( schemaRegionCreateTask.getRegionReplicaSet(), - schemaRegionCreateTask.getStorageGroup())); + schemaRegionCreateTask.getDatabase())); createSchemaRegionHandler.putNodeLocation( schemaRegionCreateTask.getRegionId().getId(), schemaRegionCreateTask.getTargetDataNode()); @@ -1379,7 +1381,7 @@ public void maintainRegionReplicas() { dataRegionCreateTask.getRegionId().getId(), new TCreateDataRegionReq( dataRegionCreateTask.getRegionReplicaSet(), - dataRegionCreateTask.getStorageGroup())); + dataRegionCreateTask.getDatabase())); createDataRegionHandler.putNodeLocation( dataRegionCreateTask.getRegionId().getId(), dataRegionCreateTask.getTargetDataNode()); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/plugin/PipeConfigNodePluginAgent.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/plugin/PipeConfigNodePluginAgent.java index 8ddbb73398c5c..44e5675402cec 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/plugin/PipeConfigNodePluginAgent.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/plugin/PipeConfigNodePluginAgent.java @@ -32,7 +32,7 @@ public PipeConfigNodePluginAgent(PipePluginMetaKeeper pipePluginMetaKeeper) { } @Override - protected PipeSourceConstructor createPipeExtractorConstructor( + protected PipeSourceConstructor createPipeSourceConstructor( PipePluginMetaKeeper pipePluginMetaKeeper) { return new PipeConfigRegionSourceConstructor(); } @@ -44,7 +44,7 @@ protected PipeProcessorConstructor createPipeProcessorConstructor( } @Override - protected PipeSinkConstructor createPipeConnectorConstructor( + protected PipeSinkConstructor createPipeSinkConstructor( PipePluginMetaKeeper pipePluginMetaKeeper) { return new PipeConfigRegionSinkConstructor(); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/task/PipeConfigNodeSubtask.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/task/PipeConfigNodeSubtask.java index 2403e353b56e3..22d8f3d768100 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/task/PipeConfigNodeSubtask.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/task/PipeConfigNodeSubtask.java @@ -87,14 +87,14 @@ public PipeConfigNodeSubtask( private void initSource(final Map sourceAttributes) throws Exception { final PipeParameters sourceParameters = new PipeParameters(sourceAttributes); - // 1. Construct extractor + // 1. Construct source source = PipeConfigNodeAgent.plugin().reflectSource(sourceParameters); try { - // 2. Validate extractor parameters + // 2. Validate source parameters source.validate(new PipeParameterValidator(sourceParameters)); - // 3. Customize extractor + // 3. Customize source final PipeTaskRuntimeConfiguration runtimeConfiguration = new PipeTaskRuntimeConfiguration( new PipeTaskSourceRuntimeEnvironment( @@ -105,8 +105,7 @@ private void initSource(final Map sourceAttributes) throws Excep source.close(); } catch (Exception closeException) { LOGGER.warn( - "Failed to close extractor after failed to initialize extractor. " - + "Ignore this exception.", + "Failed to close source after failed to initialize source. " + "Ignore this exception.", closeException); } throw e; @@ -134,14 +133,14 @@ private void initProcessor(final Map processorAttributes) { private void initSink(final Map sinkAttributes) throws Exception { final PipeParameters sinkParameters = new PipeParameters(sinkAttributes); - // 1. Construct connector + // 1. Construct sink outputPipeSink = PipeConfigNodeAgent.plugin().reflectSink(sinkParameters); try { - // 2. Validate connector parameters + // 2. Validate sink parameters outputPipeSink.validate(new PipeParameterValidator(sinkParameters)); - // 3. Customize connector + // 3. Customize sink final PipeTaskRuntimeConfiguration runtimeConfiguration = new PipeTaskRuntimeConfiguration( new PipeTaskSinkRuntimeEnvironment(pipeName, creationTime, CONFIG_REGION_ID.getId())); @@ -241,7 +240,7 @@ public void close() { } catch (final Exception e) { LOGGER.info("Error occurred during closing PipeConnector.", e); } finally { - // Should be after connector.close() + // Should be after sink.close() super.close(); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/task/PipeConfigNodeTaskStage.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/task/PipeConfigNodeTaskStage.java index 670062be6ba61..b5fba6c004b49 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/task/PipeConfigNodeTaskStage.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/task/PipeConfigNodeTaskStage.java @@ -32,9 +32,9 @@ public class PipeConfigNodeTaskStage extends PipeTaskStage { public PipeConfigNodeTaskStage( final String pipeName, final long creationTime, - final Map extractorAttributes, + final Map sourceAttributes, final Map processorAttributes, - final Map connectorAttributes, + final Map sinkAttributes, final PipeTaskMeta pipeTaskMeta) { try { @@ -42,9 +42,9 @@ public PipeConfigNodeTaskStage( new PipeConfigNodeSubtask( pipeName, creationTime, - extractorAttributes, + sourceAttributes, processorAttributes, - connectorAttributes, + sinkAttributes, pipeTaskMeta); } catch (final Exception e) { throw new PipeException( diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/overview/PipeConfigNodeRemainingTimeMetrics.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/overview/PipeConfigNodeRemainingTimeMetrics.java index bd4f42042a1e4..54342990998ed 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/overview/PipeConfigNodeRemainingTimeMetrics.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/overview/PipeConfigNodeRemainingTimeMetrics.java @@ -99,16 +99,16 @@ private void removeAutoGauge(final String pipeID) { //////////////////////////// register & deregister (pipe integration) //////////////////////////// - public void register(final IoTDBConfigRegionSource extractor) { + public void register(final IoTDBConfigRegionSource source) { // The metric is global thus the regionId is omitted - final String pipeID = extractor.getPipeName() + "_" + extractor.getCreationTime(); + final String pipeID = source.getPipeName() + "_" + source.getCreationTime(); remainingTimeOperatorMap .computeIfAbsent( pipeID, k -> new PipeConfigNodeRemainingTimeOperator( - extractor.getPipeName(), extractor.getCreationTime())) - .register(extractor); + source.getPipeName(), source.getCreationTime())) + .register(source); if (Objects.nonNull(metricService)) { createMetrics(pipeID); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/sink/PipeConfigRegionSinkMetrics.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/sink/PipeConfigRegionSinkMetrics.java index aa3661440fa1a..db0a5bb83f6db 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/sink/PipeConfigRegionSinkMetrics.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/sink/PipeConfigRegionSinkMetrics.java @@ -76,8 +76,7 @@ private void createRate(final String taskID) { public void unbindFrom(final AbstractMetricService metricService) { ImmutableSet.copyOf(subtaskMap.keySet()).forEach(this::deregister); if (!subtaskMap.isEmpty()) { - LOGGER.warn( - "Failed to unbind from pipe config region connector metrics, connector map not empty"); + LOGGER.warn("Failed to unbind from pipe config region sink metrics, sink map not empty"); } } @@ -111,7 +110,7 @@ public void register(final PipeConfigNodeSubtask pipeConfigNodeSubtask) { public void deregister(final String taskID) { if (!subtaskMap.containsKey(taskID)) { LOGGER.warn( - "Failed to deregister pipe config region connector metrics, PipeConfigNodeSubtask({}) does not exist", + "Failed to deregister pipe config region sink metrics, PipeConfigNodeSubtask({}) does not exist", taskID); return; } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/source/PipeConfigRegionSourceMetrics.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/source/PipeConfigRegionSourceMetrics.java index 7219dcac67fea..53cfb1b2116a8 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/source/PipeConfigRegionSourceMetrics.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/source/PipeConfigRegionSourceMetrics.java @@ -41,14 +41,14 @@ public class PipeConfigRegionSourceMetrics implements IMetricSet { private volatile AbstractMetricService metricService; - private final Map extractorMap = new ConcurrentHashMap<>(); + private final Map sourceMap = new ConcurrentHashMap<>(); //////////////////////////// bindTo & unbindFrom (metric framework) //////////////////////////// @Override public void bindTo(final AbstractMetricService metricService) { this.metricService = metricService; - ImmutableSet.copyOf(extractorMap.keySet()).forEach(this::createMetrics); + ImmutableSet.copyOf(sourceMap.keySet()).forEach(this::createMetrics); } private void createMetrics(final String taskID) { @@ -56,24 +56,23 @@ private void createMetrics(final String taskID) { } private void createAutoGauge(final String taskID) { - final IoTDBConfigRegionSource extractor = extractorMap.get(taskID); + final IoTDBConfigRegionSource source = sourceMap.get(taskID); metricService.createAutoGauge( Metric.UNTRANSFERRED_CONFIG_COUNT.toString(), MetricLevel.IMPORTANT, - extractorMap.get(taskID), + sourceMap.get(taskID), IoTDBConfigRegionSource::getUnTransferredEventCount, Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); } @Override public void unbindFrom(final AbstractMetricService metricService) { - ImmutableSet.copyOf(extractorMap.keySet()).forEach(this::deregister); - if (!extractorMap.isEmpty()) { - LOGGER.warn( - "Failed to unbind from pipe config region extractor metrics, extractor map not empty"); + ImmutableSet.copyOf(sourceMap.keySet()).forEach(this::deregister); + if (!sourceMap.isEmpty()) { + LOGGER.warn("Failed to unbind from pipe config region source metrics, source map not empty"); } } @@ -82,50 +81,50 @@ private void removeMetrics(final String taskID) { } private void removeAutoGauge(final String taskID) { - final IoTDBConfigRegionSource extractor = extractorMap.get(taskID); + final IoTDBConfigRegionSource source = sourceMap.get(taskID); // Pending event count metricService.remove( MetricType.AUTO_GAUGE, Metric.UNTRANSFERRED_CONFIG_COUNT.toString(), Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); } //////////////////////////// pipe integration //////////////////////////// - public void register(final IoTDBConfigRegionSource extractor) { - final String taskID = extractor.getTaskID(); - extractorMap.putIfAbsent(taskID, extractor); + public void register(final IoTDBConfigRegionSource source) { + final String taskID = source.getTaskID(); + sourceMap.putIfAbsent(taskID, source); if (Objects.nonNull(metricService)) { createMetrics(taskID); } } public void deregister(final String taskID) { - if (!extractorMap.containsKey(taskID)) { + if (!sourceMap.containsKey(taskID)) { LOGGER.warn( - "Failed to deregister pipe config region extractor metrics, IoTDBConfigRegionExtractor({}) does not exist", + "Failed to deregister pipe config region source metrics, IoTDBConfigRegionExtractor({}) does not exist", taskID); return; } if (Objects.nonNull(metricService)) { removeMetrics(taskID); } - extractorMap.remove(taskID); + sourceMap.remove(taskID); } //////////////////////////// Show pipes //////////////////////////// public long getRemainingEventCount(final String pipeName, final long creationTime) { final String taskID = pipeName + "_" + creationTime; - final IoTDBConfigRegionSource extractor = extractorMap.get(taskID); - // Do not print log to allow collection when config region extractor does not exists - if (Objects.isNull(extractor)) { + final IoTDBConfigRegionSource source = sourceMap.get(taskID); + // Do not print log to allow collection when config region source does not exists + if (Objects.isNull(source)) { return 0; } - return extractor.getUnTransferredEventCount(); + return source.getUnTransferredEventCount(); } //////////////////////////// singleton //////////////////////////// diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java index b907527416bda..d04870fdb52f7 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java @@ -642,11 +642,11 @@ public TSStatus removeRegionLocation(RemoveRegionLocationPlan req) { * @return database name */ public String getRegionDatabase(TConsensusGroupId regionId) { - Optional sgPartitionTableOptional = + Optional dbPartitionTableOptional = databasePartitionTables.values().stream() .filter(s -> s.containRegionGroup(regionId)) .findFirst(); - return sgPartitionTableOptional.map(DatabasePartitionTable::getDatabaseName).orElse(null); + return dbPartitionTableOptional.map(DatabasePartitionTable::getDatabaseName).orElse(null); } // ====================================================== @@ -1117,10 +1117,10 @@ public DataSet getTimeSlotList(GetTimeSlotListPlan plan) { return new GetTimeSlotListResp( new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()), new ArrayList<>()); } else { - DatabasePartitionTable sgPartitionTable = databasePartitionTables.get(plan.getDatabase()); + DatabasePartitionTable dbPartitionTable = databasePartitionTables.get(plan.getDatabase()); return new GetTimeSlotListResp( new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()), - sgPartitionTable + dbPartitionTable .getTimeSlotList( plan.getSeriesSlotId(), plan.getRegionId(), @@ -1156,10 +1156,10 @@ public DataSet countTimeSlotList(CountTimeSlotListPlan plan) { return new CountTimeSlotListResp( new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()), 0); } else { - DatabasePartitionTable sgPartitionTable = databasePartitionTables.get(plan.getDatabase()); + DatabasePartitionTable dbPartitionTable = databasePartitionTables.get(plan.getDatabase()); return new CountTimeSlotListResp( new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()), - sgPartitionTable + dbPartitionTable .getTimeSlotList( plan.getSeriesSlotId(), plan.getRegionId(), @@ -1190,10 +1190,10 @@ public DataSet getSeriesSlotList(GetSeriesSlotListPlan plan) { return new GetSeriesSlotListResp( new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()), new ArrayList<>()); } - DatabasePartitionTable sgPartitionTable = databasePartitionTables.get(plan.getDatabase()); + DatabasePartitionTable dbPartitionTable = databasePartitionTables.get(plan.getDatabase()); return new GetSeriesSlotListResp( new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()), - sgPartitionTable.getSeriesSlotList(plan.getPartitionType())); + dbPartitionTable.getSeriesSlotList(plan.getPartitionType())); } public void getSchemaRegionIds( diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/maintainer/RegionCreateTask.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/maintainer/RegionCreateTask.java index e7b8981c03b4c..8d571d9071156 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/maintainer/RegionCreateTask.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/maintainer/RegionCreateTask.java @@ -37,7 +37,7 @@ public class RegionCreateTask extends RegionMaintainTask { - private String storageGroup; + private String database; private TRegionReplicaSet regionReplicaSet; public RegionCreateTask() { @@ -45,15 +45,15 @@ public RegionCreateTask() { } public RegionCreateTask( - TDataNodeLocation targetDataNode, String storageGroup, TRegionReplicaSet regionReplicaSet) { + TDataNodeLocation targetDataNode, String database, TRegionReplicaSet regionReplicaSet) { super(RegionMaintainType.CREATE); this.targetDataNode = targetDataNode; - this.storageGroup = storageGroup; + this.database = database; this.regionReplicaSet = regionReplicaSet; } - public String getStorageGroup() { - return storageGroup; + public String getDatabase() { + return database; } public TRegionReplicaSet getRegionReplicaSet() { @@ -70,14 +70,14 @@ public void serialize(DataOutputStream stream) throws IOException { stream.writeInt(RegionMaintainType.CREATE.ordinal()); ThriftCommonsSerDeUtils.serializeTDataNodeLocation(targetDataNode, stream); - ReadWriteIOUtils.write(storageGroup, stream); + ReadWriteIOUtils.write(database, stream); ThriftCommonsSerDeUtils.serializeTRegionReplicaSet(regionReplicaSet, stream); } @Override protected void deserialize(ByteBuffer buffer) throws IOException { this.targetDataNode = ThriftCommonsSerDeUtils.deserializeTDataNodeLocation(buffer); - this.storageGroup = ReadWriteIOUtils.readString(buffer); + this.database = ReadWriteIOUtils.readString(buffer); this.regionReplicaSet = ThriftCommonsSerDeUtils.deserializeTRegionReplicaSet(buffer); } @@ -87,7 +87,7 @@ public void serialize(OutputStream outputStream, TProtocol protocol) ReadWriteIOUtils.write(RegionMaintainType.CREATE.ordinal(), outputStream); this.targetDataNode.write(protocol); - ReadWriteIOUtils.write(storageGroup, outputStream); + ReadWriteIOUtils.write(database, outputStream); this.regionReplicaSet.write(protocol); } @@ -96,7 +96,7 @@ protected void deserialize(InputStream inputStream, TProtocol protocol) throws TException, IOException { this.targetDataNode = new TDataNodeLocation(); this.targetDataNode.read(protocol); - this.storageGroup = ReadWriteIOUtils.readString(inputStream); + this.database = ReadWriteIOUtils.readString(inputStream); this.regionReplicaSet = new TRegionReplicaSet(); this.regionReplicaSet.read(protocol); } @@ -107,11 +107,11 @@ public boolean equals(Object o) { if (!(o instanceof RegionCreateTask)) return false; if (!super.equals(o)) return false; RegionCreateTask that = (RegionCreateTask) o; - return storageGroup.equals(that.storageGroup) && regionReplicaSet.equals(that.regionReplicaSet); + return database.equals(that.database) && regionReplicaSet.equals(that.regionReplicaSet); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), storageGroup, regionReplicaSet); + return Objects.hash(super.hashCode(), database, regionReplicaSet); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java index 36c4ccc2f05e5..6cd36e0a7e93c 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java @@ -142,7 +142,7 @@ public void setStorageGroup(final PartialPath path) throws MetadataException { } IConfigMNode cur = root; int i = 1; - // e.g., path = root.a.b.sg, create internal nodes for a, b + // e.g., path = root.a.b.db, create internal nodes for a, b while (i < nodeNames.length - 1) { final IConfigMNode temp = store.getChild(cur, nodeNames[i]); if (temp == null) { @@ -159,7 +159,7 @@ public void setStorageGroup(final PartialPath path) throws MetadataException { // only write operations on mtree will be synchronized synchronized (this) { if (store.hasChild(cur, nodeNames[i])) { - // node b has child sg + // node b has child db throw store.getChild(cur, nodeNames[i]).isDatabase() ? new DatabaseAlreadySetException(path.getFullPath()) : new DatabaseConflictException(path.getFullPath(), true); @@ -180,11 +180,11 @@ public void setStorageGroup(final PartialPath path) throws MetadataException { public void deleteDatabase(final PartialPath path) throws MetadataException { final IDatabaseMNode databaseMNode = getDatabaseNodeByDatabasePath(path); IConfigMNode cur = databaseMNode.getParent(); - // Suppose current system has root.a.b.sg1, root.a.sg2, and delete root.a.b.sg1 - // delete the database node sg1 + // Suppose current system has root.a.b.db1, root.a.db2, and delete root.a.b.db1 + // delete the database node db1 store.deleteChild(cur, databaseMNode.getName()); - // delete node a while retain root.a.sg2 + // delete node a while retain root.a.db2 while (cur.getParent() != null && cur.getChildren().isEmpty()) { cur.getParent().deleteChild(cur.getName()); cur = cur.getParent(); @@ -194,9 +194,9 @@ public void deleteDatabase(final PartialPath path) throws MetadataException { /** * Get the database that given path pattern matches or belongs to. * - *

Suppose we have (root.sg1.d1.s1, root.sg2.d2.s2), refer the following cases: 1. given path - * "root.sg1", ("root.sg1") will be returned. 2. given path "root.*", ("root.sg1", "root.sg2") - * will be returned. 3. given path "root.*.d1.s1", ("root.sg1", "root.sg2") will be returned. + *

Suppose we have (root.db1.d1.s1, root.db2.d2.s2), refer the following cases: 1. given path + * "root.db1", ("root.db1") will be returned. 2. given path "root.*", ("root.db1", "root.db2") + * will be returned. 3. given path "root.*.d1.s1", ("root.db1", "root.db2") will be returned. * * @param pathPattern a path pattern or a full path * @return a list contains all databases related to given path @@ -289,7 +289,7 @@ public int getDatabaseNum( } /** - * E.g., root.sg is database given [root, sg], if the give path is not a database, throw exception + * E.g., root.db is database given [root, db], if the give path is not a database, throw exception */ public IDatabaseMNode getDatabaseNodeByDatabasePath(final PartialPath databasePath) throws MetadataException { @@ -320,8 +320,8 @@ public IDatabaseMNode getDatabaseNodeByDatabasePath(final PartialP } /** - * E.g., root.sg is database given [root, sg], return the MNode of root.sg given [root, sg, - * device], return the MNode of root.sg Get database node, the give path don't need to be database + * E.g., root.db is database given [root, db], return the MNode of root.db given [root, db, + * device], return the MNode of root.db Get database node, the give path don't need to be database * path. */ public IDatabaseMNode getDatabaseNodeByPath(final PartialPath path) @@ -450,7 +450,7 @@ protected Void collectMNode(IConfigMNode node) { * *

give pathPattern and the child nodes is those matching pathPattern.* * - *

e.g., MTree has [root.a.sg1.d1.s1, root.b.sg1.d1.s2, root.c.sg1.d2.s1] given path = root + *

e.g., MTree has [root.a.db1.d1.s1, root.b.db1.d1.s2, root.c.db1.d2.s1] given path = root * return [root.a, root.b] * * @param pathPattern The given path diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/impl/ConfigBasicInternalMNode.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/impl/ConfigBasicInternalMNode.java index b61d5570a6088..a2098c3f6d48f 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/impl/ConfigBasicInternalMNode.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/impl/ConfigBasicInternalMNode.java @@ -146,7 +146,7 @@ public int estimateSize() { @Override public MNodeType getMNodeType() { - return MNodeType.SG_INTERNAL; + return MNodeType.DB_INTERNAL; } @Override diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/impl/ConfigTableNode.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/impl/ConfigTableNode.java index 0bb306e3f3f03..59f2b9cc8c067 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/impl/ConfigTableNode.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/impl/ConfigTableNode.java @@ -135,7 +135,7 @@ public PartialPath getPartialPath() { @Override public MNodeType getMNodeType() { - return MNodeType.SG_INTERNAL; + return MNodeType.DB_INTERNAL; } @Override diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java index 960d0a7977f51..390f418e464af 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java @@ -426,10 +426,10 @@ public Map doRegionCreation( new DataNodeAsyncRequestContext<>(CnToDnAsyncRequestType.CREATE_SCHEMA_REGION); int requestId = 0; - for (Map.Entry> sgRegionsEntry : + for (Map.Entry> dbRegionsEntry : createRegionGroupsPlan.getRegionGroupMap().entrySet()) { - String storageGroup = sgRegionsEntry.getKey(); - List regionReplicaSets = sgRegionsEntry.getValue(); + String storageGroup = dbRegionsEntry.getKey(); + List regionReplicaSets = dbRegionsEntry.getValue(); for (TRegionReplicaSet regionReplicaSet : regionReplicaSets) { for (TDataNodeLocation dataNodeLocation : regionReplicaSet.getDataNodeLocations()) { clientHandler.putRequest( @@ -449,10 +449,10 @@ public Map doRegionCreation( new DataNodeAsyncRequestContext<>(CnToDnAsyncRequestType.CREATE_DATA_REGION); int requestId = 0; - for (Map.Entry> sgRegionsEntry : + for (Map.Entry> dbRegionsEntry : createRegionGroupsPlan.getRegionGroupMap().entrySet()) { - String storageGroup = sgRegionsEntry.getKey(); - List regionReplicaSets = sgRegionsEntry.getValue(); + String storageGroup = dbRegionsEntry.getKey(); + List regionReplicaSets = dbRegionsEntry.getValue(); for (TRegionReplicaSet regionReplicaSet : regionReplicaSets) { for (TDataNodeLocation dataNodeLocation : regionReplicaSet.getDataNodeLocations()) { clientHandler.putRequest( diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java index a5463439f66cf..b4f84e1601644 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java @@ -113,7 +113,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final SetTempl LOGGER.info("Pre set schemaengine template {} on path {}", templateName, templateSetPath); preSetTemplate(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Pre release schemaengine template {} set on path {}", templateName, templateSetPath); preReleaseTemplate(env); @@ -129,9 +129,9 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final SetTempl LOGGER.info( "Commit set schemaengine template {} on path {}", templateName, templateSetPath); commitSetTemplate(env); - setNextState(SetTemplateState.COMMIT_RELEASE); + setNextState(SetTemplateState.COMMIT_UPDATE_DATANODE_CACHE); break; - case COMMIT_RELEASE: + case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info( "Commit release schemaengine template {} set on path {}", templateName, @@ -184,7 +184,7 @@ private void preSetTemplate(final ConfigNodeProcedureEnv env) { status.setMessage(e.getMessage()); } if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - setNextState(SetTemplateState.PRE_RELEASE); + setNextState(SetTemplateState.PRE_UPDATE_DATANODE_CACHE); } else { LOGGER.warn( "Failed to pre set template {} on path {} due to {}", @@ -359,7 +359,7 @@ private void commitSetTemplate(final ConfigNodeProcedureEnv env) { status.setMessage(e.getMessage()); } if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - setNextState(SetTemplateState.COMMIT_RELEASE); + setNextState(SetTemplateState.COMMIT_UPDATE_DATANODE_CACHE); } else { LOGGER.warn( "Failed to commit set template {} on path {} due to {}", @@ -430,7 +430,7 @@ protected void rollbackState(final ConfigNodeProcedureEnv env, final SetTemplate templateSetPath); rollbackPreSet(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Start rollback pre release schemaengine template {} on path {}", templateName, diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java index fe92c802ce687..6b61f26ddc3d3 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java @@ -85,11 +85,12 @@ public String getQueryId() { return queryId; } - protected void preRelease(final ConfigNodeProcedureEnv env) { - preRelease(env, null); + protected void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + preUpdateDataNodeCache(env, null); } - protected void preRelease(final ConfigNodeProcedureEnv env, final @Nullable String oldName) { + protected void preUpdateDataNodeCache( + final ConfigNodeProcedureEnv env, final @Nullable String oldName) { final Map failedResults = SchemaUtils.preReleaseTable(database, table, env.getConfigManager(), oldName); @@ -107,11 +108,12 @@ protected void preRelease(final ConfigNodeProcedureEnv env, final @Nullable Stri } } - protected void commitRelease(final ConfigNodeProcedureEnv env) { - commitRelease(env, null); + protected void commitUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + commitUpdateDataNodeCache(env, null); } - protected void commitRelease(final ConfigNodeProcedureEnv env, final @Nullable String oldName) { + protected void commitUpdateDataNodeCache( + final ConfigNodeProcedureEnv env, final @Nullable String oldName) { final Map failedResults = SchemaUtils.commitReleaseTable( database, table.getTableName(), env.getConfigManager(), oldName); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java index d5b99942721bb..2e0c879003b94 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java @@ -74,17 +74,17 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final AddTable LOGGER.info("Column check for table {}.{} when adding column", database, tableName); columnCheck(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release info of table {}.{} when adding column", database, tableName); - preRelease(env); + preUpdateDataNodeCache(env); break; case ADD_COLUMN: LOGGER.info("Add column to table {}.{}", database, tableName); addColumn(env); break; - case COMMIT_RELEASE: + case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info("Commit release info of table {}.{} when adding column", database, tableName); - commitRelease(env); + commitUpdateDataNodeCache(env); return Flow.NO_MORE_STATE; default: setFailure(new ProcedureException("Unrecognized AddTableColumnState " + state)); @@ -114,15 +114,15 @@ protected void columnCheck(final ConfigNodeProcedureEnv env) { return; } table = result.getRight(); - setNextState(AddTableColumnState.PRE_RELEASE); + setNextState(AddTableColumnState.PRE_UPDATE_DATANODE_CACHE); } catch (final MetadataException e) { setFailure(new ProcedureException(e)); } } @Override - protected void preRelease(final ConfigNodeProcedureEnv env) { - super.preRelease(env); + protected void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + super.preUpdateDataNodeCache(env); setNextState(AddTableColumnState.ADD_COLUMN); } @@ -138,7 +138,7 @@ private void addColumn(final ConfigNodeProcedureEnv env) { if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { setFailure(new ProcedureException(new IoTDBException(status))); } else { - setNextState(AddTableColumnState.COMMIT_RELEASE); + setNextState(AddTableColumnState.COMMIT_UPDATE_DATANODE_CACHE); } } @@ -160,7 +160,7 @@ protected void rollbackState(final ConfigNodeProcedureEnv env, final AddTableCol table.getTableName()); rollbackAddColumn(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Start rollback pre release info of table {}.{}", database, table.getTableName()); rollbackPreRelease(env); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java index d0fbdb605d12f..26d1e8483e2de 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java @@ -83,17 +83,17 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final CreateTa LOGGER.info("Pre create table {}.{}", database, table.getTableName()); preCreateTable(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release table {}.{}", database, table.getTableName()); - preReleaseTable(env); + preUpdateDataNodeCache(env); break; case COMMIT_CREATE: LOGGER.info("Commit create table {}.{}", database, table.getTableName()); commitCreateTable(env); break; - case COMMIT_RELEASE: + case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info("Commit release table {}.{}", database, table.getTableName()); - commitReleaseTable(env); + commitUpdateDataNodeCache(env); return Flow.NO_MORE_STATE; default: setFailure(new ProcedureException("Unrecognized CreateTableState " + state)); @@ -140,13 +140,13 @@ protected void preCreateTable(final ConfigNodeProcedureEnv env) { final TSStatus status = SchemaUtils.executeInConsensusLayer(new PreCreateTablePlan(database, table), env, LOGGER); if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - setNextState(CreateTableState.PRE_RELEASE); + setNextState(CreateTableState.PRE_UPDATE_DATANODE_CACHE); } else { setFailure(new ProcedureException(new IoTDBException(status))); } } - private void preReleaseTable(final ConfigNodeProcedureEnv env) { + private void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { final Map failedResults = SchemaUtils.preReleaseTable(database, table, env.getConfigManager(), null); @@ -173,13 +173,13 @@ private void commitCreateTable(final ConfigNodeProcedureEnv env) { env, LOGGER); if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - setNextState(CreateTableState.COMMIT_RELEASE); + setNextState(CreateTableState.COMMIT_UPDATE_DATANODE_CACHE); } else { setFailure(new ProcedureException(new IoTDBException(status))); } } - private void commitReleaseTable(final ConfigNodeProcedureEnv env) { + private void commitUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { final Map failedResults = SchemaUtils.commitReleaseTable( database, table.getTableName(), env.getConfigManager(), null); @@ -208,7 +208,7 @@ protected void rollbackState(final ConfigNodeProcedureEnv env, final CreateTable LOGGER.info("Start rollback pre create table {}.{}", database, table.getTableName()); rollbackCreate(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Start rollback pre release table {}.{}", database, table.getTableName()); rollbackPreRelease(env); break; diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java index da51dad267266..76d3505dffe9a 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java @@ -76,18 +76,18 @@ protected Flow executeFromState( LOGGER.info("Column check for table {}.{} when renaming column", database, tableName); columnCheck(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release info of table {}.{} when renaming column", database, tableName); - preRelease(env); + preUpdateDataNodeCache(env); break; case RENAME_COLUMN: LOGGER.info("Rename column to table {}.{} on config node", database, tableName); renameColumn(env); break; - case COMMIT_RELEASE: + case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info( "Commit release info of table {}.{} when renaming column", database, tableName); - commitRelease(env); + commitUpdateDataNodeCache(env); return Flow.NO_MORE_STATE; default: setFailure(new ProcedureException("Unrecognized RenameTableColumnState " + state)); @@ -117,15 +117,15 @@ private void columnCheck(final ConfigNodeProcedureEnv env) { return; } table = result.getRight(); - setNextState(RenameTableColumnState.PRE_RELEASE); + setNextState(RenameTableColumnState.PRE_UPDATE_DATANODE_CACHE); } catch (final MetadataException e) { setFailure(new ProcedureException(e)); } } @Override - protected void preRelease(final ConfigNodeProcedureEnv env) { - super.preRelease(env); + protected void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + super.preUpdateDataNodeCache(env); setNextState(RenameTableColumnState.RENAME_COLUMN); } @@ -141,7 +141,7 @@ private void renameColumn(final ConfigNodeProcedureEnv env) { if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { setFailure(new ProcedureException(new IoTDBException(status))); } else { - setNextState(RenameTableColumnState.COMMIT_RELEASE); + setNextState(RenameTableColumnState.COMMIT_UPDATE_DATANODE_CACHE); } } @@ -158,7 +158,7 @@ protected void rollbackState(final ConfigNodeProcedureEnv env, final RenameTable table.getTableName()); rollbackRenameColumn(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Start rollback pre release info of table {}.{}", database, table.getTableName()); rollbackPreRelease(env); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java index 93d1035a7615c..5ddba53cbf59f 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java @@ -69,18 +69,18 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final RenameTa LOGGER.info("Column check for table {}.{} when renaming table", database, tableName); tableCheck(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release info of table {}.{} when renaming table", database, tableName); - preRelease(env); + preUpdateDataNodeCache(env); break; case RENAME_TABLE: LOGGER.info("Rename column to table {}.{} on config node", database, tableName); renameTable(env); break; - case COMMIT_RELEASE: + case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info( "Commit release info of table {}.{} when renaming table", database, tableName); - commitRelease(env, tableName); + commitUpdateDataNodeCache(env, tableName); return Flow.NO_MORE_STATE; default: setFailure(new ProcedureException("Unrecognized RenameTableState " + state)); @@ -110,15 +110,15 @@ private void tableCheck(final ConfigNodeProcedureEnv env) { return; } table = result.getRight(); - setNextState(RenameTableState.PRE_RELEASE); + setNextState(RenameTableState.PRE_UPDATE_DATANODE_CACHE); } catch (final MetadataException e) { setFailure(new ProcedureException(e)); } } @Override - protected void preRelease(final ConfigNodeProcedureEnv env) { - super.preRelease(env, tableName); + protected void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + super.preUpdateDataNodeCache(env, tableName); setNextState(RenameTableState.RENAME_TABLE); } @@ -134,7 +134,7 @@ private void renameTable(final ConfigNodeProcedureEnv env) { if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { setFailure(new ProcedureException(new IoTDBException(status))); } else { - setNextState(RenameTableState.COMMIT_RELEASE); + setNextState(RenameTableState.COMMIT_UPDATE_DATANODE_CACHE); } } @@ -149,7 +149,7 @@ protected void rollbackState(final ConfigNodeProcedureEnv env, final RenameTable "Start rollback Renaming table {}.{} on configNode", database, table.getTableName()); rollbackRenameTable(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Start rollback pre release info of table {}.{}", database, table.getTableName()); rollbackPreRelease(env, tableName); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java index eedbf7fdb3d0a..d0749a396aef9 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java @@ -44,8 +44,8 @@ import java.util.Map; import java.util.Objects; -import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.COMMIT_RELEASE; -import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.PRE_RELEASE; +import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.COMMIT_UPDATE_DATANODE_CACHE; +import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.PRE_UPDATE_DATANODE_CACHE; import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.SET_PROPERTIES; import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.VALIDATE_TABLE; @@ -88,8 +88,8 @@ protected Flow executeFromState( return Flow.NO_MORE_STATE; } break; - case PRE_RELEASE: - preRelease(env); + case PRE_UPDATE_DATANODE_CACHE: + preUpdateDataNodeCache(env); LOGGER.info( "Pre release info for table {}.{} when setting properties", database, tableName); break; @@ -97,8 +97,8 @@ protected Flow executeFromState( setProperties(env); LOGGER.info("Set properties to table {}.{}", database, tableName); break; - case COMMIT_RELEASE: - commitRelease(env); + case COMMIT_UPDATE_DATANODE_CACHE: + commitUpdateDataNodeCache(env); LOGGER.info( "Commit release info of table {}.{} when setting properties", database, tableName); return Flow.NO_MORE_STATE; @@ -134,15 +134,15 @@ private void validateTable(final ConfigNodeProcedureEnv env) { return; } table = result.getRight(); - setNextState(PRE_RELEASE); + setNextState(PRE_UPDATE_DATANODE_CACHE); } catch (final MetadataException e) { setFailure(new ProcedureException(e)); } } @Override - protected void preRelease(final ConfigNodeProcedureEnv env) { - super.preRelease(env); + protected void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + super.preUpdateDataNodeCache(env); setNextState(SET_PROPERTIES); } @@ -158,7 +158,7 @@ private void setProperties(final ConfigNodeProcedureEnv env) { if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { setFailure(new ProcedureException(new IoTDBException(status))); } else { - setNextState(COMMIT_RELEASE); + setNextState(COMMIT_UPDATE_DATANODE_CACHE); } } @@ -174,7 +174,7 @@ protected void rollbackState( final long startTime = System.currentTimeMillis(); try { switch (state) { - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Start rollback pre release info for table {}.{} when setting properties", database, diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/view/CreateTableViewProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/view/CreateTableViewProcedure.java index b7fb458c8bb01..4fd3a4aceaa10 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/view/CreateTableViewProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/view/CreateTableViewProcedure.java @@ -121,7 +121,7 @@ protected void preCreateTable(final ConfigNodeProcedureEnv env) { SchemaUtils.executeInConsensusLayer( new PreCreateTableViewPlan(database, table, TableNodeStatus.PRE_CREATE), env, LOGGER); if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - setNextState(CreateTableState.PRE_RELEASE); + setNextState(CreateTableState.PRE_UPDATE_DATANODE_CACHE); } else { setFailure(new ProcedureException(new IoTDBException(status))); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AddTableColumnState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AddTableColumnState.java index cdcea88aa3c69..5e0346e9fc369 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AddTableColumnState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AddTableColumnState.java @@ -21,7 +21,7 @@ public enum AddTableColumnState { COLUMN_CHECK, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, ADD_COLUMN, - COMMIT_RELEASE + COMMIT_UPDATE_DATANODE_CACHE } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AlterDatabaseState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AlterDatabaseState.java deleted file mode 100644 index ca5a50c22654d..0000000000000 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AlterDatabaseState.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.confignode.procedure.state.schema; - -public enum AlterDatabaseState { - CHECK_ALTERED_TABLES, - PRE_RELEASE, - ALTER_DATABASE, - COMMIT_RELEASE -} diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/CreateTableState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/CreateTableState.java index be765853ed05f..2810d58d8f7ee 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/CreateTableState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/CreateTableState.java @@ -22,7 +22,7 @@ public enum CreateTableState { CHECK_TABLE_EXISTENCE, PRE_CREATE, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, COMMIT_CREATE, - COMMIT_RELEASE, + COMMIT_UPDATE_DATANODE_CACHE, } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableColumnState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableColumnState.java index 398ef64222440..77d3a835042ec 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableColumnState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableColumnState.java @@ -21,7 +21,7 @@ public enum RenameTableColumnState { COLUMN_CHECK, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, RENAME_COLUMN, - COMMIT_RELEASE + COMMIT_UPDATE_DATANODE_CACHE } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableState.java index 1c71cb50182ed..4aa6e0d290913 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableState.java @@ -21,7 +21,7 @@ public enum RenameTableState { COLUMN_CHECK, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, RENAME_TABLE, - COMMIT_RELEASE + COMMIT_UPDATE_DATANODE_CACHE } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTablePropertiesState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTablePropertiesState.java index 45a1b8b654a3b..0d8a4f71b5cba 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTablePropertiesState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTablePropertiesState.java @@ -21,7 +21,7 @@ public enum SetTablePropertiesState { VALIDATE_TABLE, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, SET_PROPERTIES, - COMMIT_RELEASE + COMMIT_UPDATE_DATANODE_CACHE } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTemplateState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTemplateState.java index cc43259a55ec7..1d72dbe8e6759 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTemplateState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTemplateState.java @@ -22,8 +22,8 @@ public enum SetTemplateState { VALIDATE_TEMPLATE_EXISTENCE, PRE_SET, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, VALIDATE_TIMESERIES_EXISTENCE, COMMIT_SET, - COMMIT_RELEASE, + COMMIT_UPDATE_DATANODE_CACHE, } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java index 59ce7352312f0..16c6a5c2ccdcd 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java @@ -531,7 +531,7 @@ public TCountDatabaseResp countMatchedDatabases(final TGetDatabaseReq req) { (CountDatabaseResp) configManager.countMatchedDatabases(plan); final TCountDatabaseResp resp = new TCountDatabaseResp(); - countDatabaseResp.convertToRPCCountStorageGroupResp(resp); + countDatabaseResp.convertToRPCCountDatabaseResp(resp); return resp; } @@ -551,7 +551,7 @@ public TDatabaseSchemaResp getMatchedDatabaseSchemas(final TGetDatabaseReq req) final DatabaseSchemaResp databaseSchemaResp = (DatabaseSchemaResp) configManager.getMatchedDatabaseSchemas(plan); - return databaseSchemaResp.convertToRPCStorageGroupSchemaResp(); + return databaseSchemaResp.convertToRPCDatabaseSchemaResp(); } @Override @@ -984,7 +984,7 @@ public TSStatus flush(final TFlushReq req) throws TException { configManager.getPartitionManager().filterUnExistDatabases(req.storageGroups); if (!noExistSg.isEmpty()) { final StringBuilder sb = new StringBuilder(); - noExistSg.forEach(storageGroup -> sb.append(storageGroup).append(",")); + noExistSg.forEach(database -> sb.append(database).append(",")); return RpcUtils.getStatus( TSStatusCode.DATABASE_NOT_EXIST, "Database " + sb.subSequence(0, sb.length() - 1) + " does not exist"); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java index 4381c120cb445..806dc44e73fde 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java @@ -258,7 +258,7 @@ public void CreateDatabasePlanTest() throws IOException { new DatabaseSchemaPlan( ConfigPhysicalPlanType.CreateDatabase, new TDatabaseSchema() - .setName("sg") + .setName("db") .setSchemaReplicationFactor(3) .setDataReplicationFactor(3) .setTimePartitionInterval(604800)); @@ -273,7 +273,7 @@ public void AlterDatabasePlanTest() throws IOException { new DatabaseSchemaPlan( ConfigPhysicalPlanType.AlterDatabase, new TDatabaseSchema() - .setName("sg") + .setName("db") .setSchemaReplicationFactor(3) .setDataReplicationFactor(3) .setTimePartitionInterval(604800) @@ -289,7 +289,7 @@ public void AlterDatabasePlanTest() throws IOException { @Test public void DeleteStorageGroupPlanTest() throws IOException { // TODO: Add serialize and deserialize test - DeleteDatabasePlan req0 = new DeleteDatabasePlan("root.sg"); + DeleteDatabasePlan req0 = new DeleteDatabasePlan("root.db"); DeleteDatabasePlan req1 = (DeleteDatabasePlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer()); Assert.assertEquals(req0, req1); @@ -297,14 +297,14 @@ public void DeleteStorageGroupPlanTest() throws IOException { @Test public void SetTTLPlanTest() throws IOException { - SetTTLPlan req0 = new SetTTLPlan(Arrays.asList("root", "sg0"), Long.MAX_VALUE); + SetTTLPlan req0 = new SetTTLPlan(Arrays.asList("root", "db0"), Long.MAX_VALUE); SetTTLPlan req1 = (SetTTLPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer()); Assert.assertEquals(req0, req1); } @Test public void SetSchemaReplicationFactorPlanTest() throws IOException { - SetSchemaReplicationFactorPlan req0 = new SetSchemaReplicationFactorPlan("root.sg0", 3); + SetSchemaReplicationFactorPlan req0 = new SetSchemaReplicationFactorPlan("root.db0", 3); SetSchemaReplicationFactorPlan req1 = (SetSchemaReplicationFactorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer()); @@ -313,7 +313,7 @@ public void SetSchemaReplicationFactorPlanTest() throws IOException { @Test public void SetDataReplicationFactorPlanTest() throws IOException { - SetDataReplicationFactorPlan req0 = new SetDataReplicationFactorPlan("root.sg0", 3); + SetDataReplicationFactorPlan req0 = new SetDataReplicationFactorPlan("root.db0", 3); SetDataReplicationFactorPlan req1 = (SetDataReplicationFactorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer()); @@ -322,7 +322,7 @@ public void SetDataReplicationFactorPlanTest() throws IOException { @Test public void SetTimePartitionIntervalPlanTest() throws IOException { - SetTimePartitionIntervalPlan req0 = new SetTimePartitionIntervalPlan("root.sg0", 6048000L); + SetTimePartitionIntervalPlan req0 = new SetTimePartitionIntervalPlan("root.db0", 6048000L); SetTimePartitionIntervalPlan req1 = (SetTimePartitionIntervalPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer()); @@ -333,7 +333,7 @@ public void SetTimePartitionIntervalPlanTest() throws IOException { public void AdjustMaxRegionGroupCountPlanTest() throws IOException { AdjustMaxRegionGroupNumPlan req0 = new AdjustMaxRegionGroupNumPlan(); for (int i = 0; i < 3; i++) { - req0.putEntry("root.sg" + i, new Pair<>(i, i)); + req0.putEntry("root.db" + i, new Pair<>(i, i)); } AdjustMaxRegionGroupNumPlan req1 = @@ -356,11 +356,11 @@ public void CreateRegionsPlanTest() throws IOException { TRegionReplicaSet dataRegionSet = new TRegionReplicaSet(); dataRegionSet.setRegionId(new TConsensusGroupId(TConsensusGroupType.DataRegion, 0)); dataRegionSet.setDataNodeLocations(Collections.singletonList(dataNodeLocation)); - req0.addRegionGroup("root.sg0", dataRegionSet); + req0.addRegionGroup("root.db0", dataRegionSet); TRegionReplicaSet schemaRegionSet = new TRegionReplicaSet(); schemaRegionSet.setRegionId(new TConsensusGroupId(TConsensusGroupType.SchemaRegion, 1)); schemaRegionSet.setDataNodeLocations(Collections.singletonList(dataNodeLocation)); - req0.addRegionGroup("root.sg1", schemaRegionSet); + req0.addRegionGroup("root.db1", schemaRegionSet); CreateRegionGroupsPlan req1 = (CreateRegionGroupsPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer()); @@ -383,9 +383,9 @@ public void OfferRegionMaintainTasksPlanTest() throws IOException { OfferRegionMaintainTasksPlan plan0 = new OfferRegionMaintainTasksPlan(); plan0.appendRegionMaintainTask( - new RegionCreateTask(dataNodeLocation, "root.sg", regionReplicaSet)); + new RegionCreateTask(dataNodeLocation, "root.db", regionReplicaSet)); plan0.appendRegionMaintainTask( - new RegionCreateTask(dataNodeLocation, "root.sg", regionReplicaSet)); + new RegionCreateTask(dataNodeLocation, "root.db", regionReplicaSet)); plan0.appendRegionMaintainTask( new RegionDeleteTask( dataNodeLocation, new TConsensusGroupId(TConsensusGroupType.SchemaRegion, 2))); @@ -415,7 +415,7 @@ public void CreateSchemaPartitionPlanTest() throws IOException { dataNodeLocation.setDataRegionConsensusEndPoint(new TEndPoint("0.0.0.0", 10760)); dataNodeLocation.setSchemaRegionConsensusEndPoint(new TEndPoint("0.0.0.0", 10750)); - String storageGroup = "root.sg0"; + String storageGroup = "root.db0"; TSeriesPartitionSlot seriesPartitionSlot = new TSeriesPartitionSlot(10); TConsensusGroupId consensusGroupId = new TConsensusGroupId(TConsensusGroupType.SchemaRegion, 0); @@ -441,7 +441,7 @@ public void CreateDataPartitionPlanTest() throws IOException { dataNodeLocation.setDataRegionConsensusEndPoint(new TEndPoint("0.0.0.0", 10760)); dataNodeLocation.setSchemaRegionConsensusEndPoint(new TEndPoint("0.0.0.0", 10750)); - String storageGroup = "root.sg0"; + String storageGroup = "root.db0"; TSeriesPartitionSlot seriesPartitionSlot = new TSeriesPartitionSlot(10); TTimePartitionSlot timePartitionSlot = new TTimePartitionSlot(100); TRegionReplicaSet regionReplicaSet = new TRegionReplicaSet(); @@ -703,7 +703,7 @@ public void removeConfigNodePlanTest() throws IOException { public void updateProcedureTest() throws IOException { // test procedure equals DeleteStorageGroupProcedure DeleteDatabaseProcedure deleteDatabaseProcedure = new DeleteDatabaseProcedure(false); - deleteDatabaseProcedure.setDeleteDatabaseSchema(new TDatabaseSchema("root.sg")); + deleteDatabaseProcedure.setDeleteDatabaseSchema(new TDatabaseSchema("root.db")); UpdateProcedurePlan updateProcedurePlan0 = new UpdateProcedurePlan(); updateProcedurePlan0.setProcedure(deleteDatabaseProcedure); UpdateProcedurePlan updateProcedurePlan1 = @@ -731,11 +731,11 @@ public void updateProcedureTest() throws IOException { failedRegions.put(dataRegionGroupId, dataRegionSet); failedRegions.put(schemaRegionGroupId, schemaRegionSet); CreateRegionGroupsPlan createRegionGroupsPlan = new CreateRegionGroupsPlan(); - createRegionGroupsPlan.addRegionGroup("root.sg0", dataRegionSet); - createRegionGroupsPlan.addRegionGroup("root.sg1", schemaRegionSet); + createRegionGroupsPlan.addRegionGroup("root.db0", dataRegionSet); + createRegionGroupsPlan.addRegionGroup("root.db1", schemaRegionSet); CreateRegionGroupsPlan persistPlan = new CreateRegionGroupsPlan(); - persistPlan.addRegionGroup("root.sg0", dataRegionSet); - persistPlan.addRegionGroup("root.sg1", schemaRegionSet); + persistPlan.addRegionGroup("root.db0", dataRegionSet); + persistPlan.addRegionGroup("root.db1", schemaRegionSet); CreateRegionGroupsProcedure procedure0 = new CreateRegionGroupsProcedure( TConsensusGroupType.DataRegion, createRegionGroupsPlan, persistPlan, failedRegions); @@ -752,7 +752,7 @@ public void UpdateProcedurePlanTest() throws IOException { UpdateProcedurePlan req0 = new UpdateProcedurePlan(); DeleteDatabaseProcedure deleteDatabaseProcedure = new DeleteDatabaseProcedure(false); TDatabaseSchema tDatabaseSchema = new TDatabaseSchema(); - tDatabaseSchema.setName("root.sg"); + tDatabaseSchema.setName("root.db"); deleteDatabaseProcedure.setDeleteDatabaseSchema(tDatabaseSchema); req0.setProcedure(deleteDatabaseProcedure); UpdateProcedurePlan req1 = @@ -807,7 +807,7 @@ public void ExtendSchemaTemplatePlanTest() throws IOException { @Test public void SetSchemaTemplatePlanTest() throws IOException { final SetSchemaTemplatePlan setSchemaTemplatePlanPlan0 = - new SetSchemaTemplatePlan("template_name_test", "root.in.sg.dw"); + new SetSchemaTemplatePlan("template_name_test", "root.in.db.dw"); final SetSchemaTemplatePlan setSchemaTemplatePlanPlan1 = (SetSchemaTemplatePlan) ConfigPhysicalPlan.Factory.create(setSchemaTemplatePlanPlan0.serializeToByteBuffer()); @@ -1618,8 +1618,8 @@ public void AddCQPlanTest() throws IOException { 1000, 0, (byte) 0, - "select s1 into root.backup.d1.s1 from root.sg.d1", - "create cq testCq1 BEGIN select s1 into root.backup.d1.s1 from root.sg.d1 END", + "select s1 into root.backup.d1.s1 from root.db.d1", + "create cq testCq1 BEGIN select s1 into root.backup.d1.s1 from root.db.d1 END", "Asia", "root"), "testCq1_md5", @@ -1783,7 +1783,7 @@ public void DropFunctionPlanTest() throws IOException { @Test public void PreUnsetSchemaTemplatePlanTest() throws IllegalPathException, IOException { - PreUnsetSchemaTemplatePlan plan = new PreUnsetSchemaTemplatePlan(1, new PartialPath("root.sg")); + PreUnsetSchemaTemplatePlan plan = new PreUnsetSchemaTemplatePlan(1, new PartialPath("root.db")); PreUnsetSchemaTemplatePlan deserializedPlan = (PreUnsetSchemaTemplatePlan) ConfigPhysicalPlan.Factory.create(plan.serializeToByteBuffer()); @@ -1794,7 +1794,7 @@ public void PreUnsetSchemaTemplatePlanTest() throws IllegalPathException, IOExce @Test public void RollbackPreUnsetSchemaTemplatePlanTest() throws IllegalPathException, IOException { RollbackPreUnsetSchemaTemplatePlan plan = - new RollbackPreUnsetSchemaTemplatePlan(1, new PartialPath("root.sg")); + new RollbackPreUnsetSchemaTemplatePlan(1, new PartialPath("root.db")); RollbackPreUnsetSchemaTemplatePlan deserializedPlan = (RollbackPreUnsetSchemaTemplatePlan) ConfigPhysicalPlan.Factory.create(plan.serializeToByteBuffer()); @@ -1804,7 +1804,7 @@ public void RollbackPreUnsetSchemaTemplatePlanTest() throws IllegalPathException @Test public void UnsetSchemaTemplatePlanTest() throws IllegalPathException, IOException { - UnsetSchemaTemplatePlan plan = new UnsetSchemaTemplatePlan(1, new PartialPath("root.sg")); + UnsetSchemaTemplatePlan plan = new UnsetSchemaTemplatePlan(1, new PartialPath("root.db")); UnsetSchemaTemplatePlan deserializedPlan = (UnsetSchemaTemplatePlan) ConfigPhysicalPlan.Factory.create(plan.serializeToByteBuffer()); Assert.assertEquals(plan.getTemplateId(), deserializedPlan.getTemplateId()); @@ -1834,7 +1834,7 @@ public void setSpaceQuotaPlanTest() throws IOException { spaceQuota.setTimeserieNum(3); spaceQuota.setDiskSize(1024); SetSpaceQuotaPlan plan = - new SetSpaceQuotaPlan(Collections.singletonList("root.sg"), spaceQuota); + new SetSpaceQuotaPlan(Collections.singletonList("root.db"), spaceQuota); SetSpaceQuotaPlan deserializedPlan = (SetSpaceQuotaPlan) ConfigPhysicalPlan.Factory.create(plan.serializeToByteBuffer()); Assert.assertEquals(plan.getPrefixPathList(), deserializedPlan.getPrefixPathList()); @@ -1878,7 +1878,7 @@ public void pipeEnrichedPlanTest() throws IOException { new DatabaseSchemaPlan( ConfigPhysicalPlanType.CreateDatabase, new TDatabaseSchema() - .setName("sg") + .setName("db") .setTTL(Long.MAX_VALUE) .setSchemaReplicationFactor(3) .setDataReplicationFactor(3) @@ -1889,7 +1889,7 @@ public void pipeEnrichedPlanTest() throws IOException { @Test public void pipeUnsetSchemaTemplatePlanTest() throws IOException { final PipeUnsetSchemaTemplatePlan pipeUnsetSchemaTemplatePlan = - new PipeUnsetSchemaTemplatePlan("template0", "root.sg"); + new PipeUnsetSchemaTemplatePlan("template0", "root.db"); Assert.assertEquals( pipeUnsetSchemaTemplatePlan, ConfigPhysicalPlan.Factory.create(pipeUnsetSchemaTemplatePlan.serializeToByteBuffer())); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/hash/DeviceGroupHashExecutorManualTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/hash/DeviceGroupHashExecutorManualTest.java index 628cc02524c5d..b678d760fbd50 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/hash/DeviceGroupHashExecutorManualTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/hash/DeviceGroupHashExecutorManualTest.java @@ -32,13 +32,13 @@ import java.util.Random; /** - * This is a not active test class, which can be used for general index testing when there is a new + * This is not an active test class, which can be used for general index testing when there is a new * DeviceGroup hash algorithm */ public class DeviceGroupHashExecutorManualTest { private static final int deviceGroupCount = 10_000; - private static final String sg = "root.SGGroup."; + private static final String DB = "root.DB."; private static final int batchCount = 10_000; private static final int batchSize = 10_000; private static final String chars = @@ -51,7 +51,7 @@ private List genBatchDevices() { int deviceLength = random.nextInt(5) + 5; for (int i = 0; i < batchSize; i++) { - StringBuilder curDevice = new StringBuilder(sg); + StringBuilder curDevice = new StringBuilder(DB); for (int j = 0; j < fatherLength; j++) { curDevice.append(chars.charAt(random.nextInt(chars.length()))); } diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/IoTDBConfigRegionSourceTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/IoTDBConfigRegionSourceTest.java index 15051d436d8b2..3a072301bfa28 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/IoTDBConfigRegionSourceTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/IoTDBConfigRegionSourceTest.java @@ -43,7 +43,7 @@ public void testIoTDBConfigExtractor() { Boolean.TRUE.toString()); put( PipeSourceConstant.EXTRACTOR_REALTIME_MODE_KEY, - PipeSourceConstant.EXTRACTOR_REALTIME_MODE_HYBRID_VALUE); + PipeSourceConstant.SOURCE_REALTIME_MODE_HYBRID_VALUE); put( PipeSourceConstant.EXTRACTOR_INCLUSION_KEY, PipeSourceConstant.EXTRACTOR_INCLUSION_DEFAULT_VALUE); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java index 151307e280d8c..c91b407495ebc 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java @@ -544,7 +544,7 @@ public void testMultiPathsPermission() throws AuthException, IllegalPathExceptio List userPaths = new ArrayList<>(); userPaths.add(new PartialPath("root.ln.**")); - userPaths.add(new PartialPath("root.sg.**")); + userPaths.add(new PartialPath("root.db.**")); List rolePaths = new ArrayList<>(); rolePaths.add(new PartialPath("root.role_1.**")); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java index b9d453d317cec..76de6304c579f 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java @@ -322,11 +322,11 @@ public void databaseWithoutTemplateGeneratorTest() throws Exception { setupTTLInfo(); final Set answerSet = new HashSet<>(); final Set storageGroupPathList = new TreeSet<>(); - storageGroupPathList.add("root.sg"); + storageGroupPathList.add("root.db"); storageGroupPathList.add("root.ln"); - storageGroupPathList.add("root.a.sg"); - storageGroupPathList.add("root.a.b.sg"); - storageGroupPathList.add("root.a.a.a.b.sg"); + storageGroupPathList.add("root.a.db"); + storageGroupPathList.add("root.a.b.db"); + storageGroupPathList.add("root.a.a.a.b.db"); int i = 0; for (String path : storageGroupPathList) { @@ -441,10 +441,10 @@ public void templateAndDatabaseCompletedTest() throws Exception { setupTTLInfo(); final Set answerSet = new HashSet<>(); final Set storageGroupPathList = new TreeSet<>(); - storageGroupPathList.add("root.sg"); - storageGroupPathList.add("root.a.sg"); - storageGroupPathList.add("root.a.b.sg"); - storageGroupPathList.add("root.a.a.a.b.sg"); + storageGroupPathList.add("root.db"); + storageGroupPathList.add("root.a.db"); + storageGroupPathList.add("root.a.b.db"); + storageGroupPathList.add("root.a.a.a.b.db"); int i = 0; for (String path : storageGroupPathList) { @@ -487,13 +487,13 @@ public void templateAndDatabaseCompletedTest() throws Exception { answerSet.add(plan2.hashCode()); final PreSetSchemaTemplatePlan preSetSchemaTemplatePlan1 = - new PreSetSchemaTemplatePlan("t1", "root.sg"); + new PreSetSchemaTemplatePlan("t1", "root.db"); final PreSetSchemaTemplatePlan preSetSchemaTemplatePlan2 = - new PreSetSchemaTemplatePlan("t2", "root.a.sg.t1"); + new PreSetSchemaTemplatePlan("t2", "root.a.db.t1"); final CommitSetSchemaTemplatePlan setSchemaTemplatePlan1 = - new CommitSetSchemaTemplatePlan("t1", "root.sg"); + new CommitSetSchemaTemplatePlan("t1", "root.db"); final CommitSetSchemaTemplatePlan setSchemaTemplatePlan2 = - new CommitSetSchemaTemplatePlan("t2", "root.a.sg.t1"); + new CommitSetSchemaTemplatePlan("t2", "root.a.db.t1"); clusterSchemaInfo.preSetSchemaTemplate(preSetSchemaTemplatePlan1); clusterSchemaInfo.preSetSchemaTemplate(preSetSchemaTemplatePlan2); clusterSchemaInfo.commitSetSchemaTemplate(setSchemaTemplatePlan1); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CQInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CQInfoTest.java index 4b409d6cf0cd2..87d88cf3d144d 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CQInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CQInfoTest.java @@ -66,8 +66,8 @@ public void testSnapshot() throws TException, IOException { 1000, 0, (byte) 0, - "select s1 into root.backup.d1.s1 from root.sg.d1", - "create cq testCq1 BEGIN select s1 into root.backup.d1.s1 from root.sg.d1 END", + "select s1 into root.backup.d1.s1 from root.db.d1", + "create cq testCq1 BEGIN select s1 into root.backup.d1.s1 from root.db.d1 END", "Asia", "root"), "testCq1_md5", @@ -85,8 +85,8 @@ public void testSnapshot() throws TException, IOException { 1000, 0, (byte) 1, - "select s1 into root.backup.d2.s1 from root.sg.d2", - "create cq testCq2 BEGIN select s1 into root.backup.d2.s1 from root.sg.d2 END", + "select s1 into root.backup.d2.s1 from root.db.d2", + "create cq testCq2 BEGIN select s1 into root.backup.d2.s1 from root.db.d2 END", "Asia", "root"), "testCq2_md5", diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/PartitionInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/PartitionInfoTest.java index afccb0c0eba12..6251da56bd910 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/PartitionInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/PartitionInfoTest.java @@ -302,9 +302,9 @@ private OfferRegionMaintainTasksPlan generateOfferRegionMaintainTasksPlan() { OfferRegionMaintainTasksPlan offerPlan = new OfferRegionMaintainTasksPlan(); offerPlan.appendRegionMaintainTask( - new RegionCreateTask(dataNodeLocation, "root.sg", regionReplicaSet)); + new RegionCreateTask(dataNodeLocation, "root.db", regionReplicaSet)); offerPlan.appendRegionMaintainTask( - new RegionCreateTask(dataNodeLocation, "root.sg", regionReplicaSet)); + new RegionCreateTask(dataNodeLocation, "root.db", regionReplicaSet)); offerPlan.appendRegionMaintainTask( new RegionDeleteTask( dataNodeLocation, new TConsensusGroupId(TConsensusGroupType.SchemaRegion, 2))); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/QuotaInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/QuotaInfoTest.java index 88f06f602e25f..5c45772f33b04 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/QuotaInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/QuotaInfoTest.java @@ -65,7 +65,7 @@ public void cleanup() throws IOException { private void prepareSpaceQuotaInfo() { List prefixPathList = new ArrayList<>(); - prefixPathList.add("root.sg"); + prefixPathList.add("root.db"); prefixPathList.add("root.ln"); TSpaceQuota spaceQuota = new TSpaceQuota(); spaceQuota.setTimeserieNum(10000); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/TTLInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/TTLInfoTest.java index 42a23d35cb9f4..ca40638cbf345 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/TTLInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/TTLInfoTest.java @@ -215,7 +215,7 @@ public void testUnsetNonExistTTL() throws IllegalPathException { ttlInfo.unsetTTL(new SetTTLPlan(-1, "root")).getCode()); assertEquals( TSStatusCode.PATH_NOT_EXIST.getStatusCode(), - ttlInfo.unsetTTL(new SetTTLPlan(-1, "root", "sg100", "f10", "d1")).getCode()); + ttlInfo.unsetTTL(new SetTTLPlan(-1, "root", "db100", "f10", "d1")).getCode()); PartialPath path = new PartialPath("root.test.db1.group1.group2.d1"); ttlInfo.setTTL(new SetTTLPlan(Arrays.asList(path.getNodes()), 11111222L)); @@ -232,12 +232,12 @@ public void testTooManyTTL() { final int tTlRuleCapacity = CommonDescriptor.getInstance().getConfig().getTTlRuleCapacity(); for (int i = 0; i < tTlRuleCapacity - 1; i++) { SetTTLPlan setTTLPlan = - new SetTTLPlan(PathNodesGenerator.splitPathToNodes("root.sg1.d" + i + ".**"), 1000); + new SetTTLPlan(PathNodesGenerator.splitPathToNodes("root.db1.d" + i + ".**"), 1000); assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), ttlInfo.setTTL(setTTLPlan).code); } SetTTLPlan setTTLPlan = new SetTTLPlan( - PathNodesGenerator.splitPathToNodes("root.sg1.d" + tTlRuleCapacity + ".**"), 1000); + PathNodesGenerator.splitPathToNodes("root.db1.d" + tTlRuleCapacity + ".**"), 1000); final TSStatus status = ttlInfo.setTTL(setTTLPlan); assertEquals(TSStatusCode.OVERSIZE_TTL.getStatusCode(), status.code); assertEquals( diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfoTest.java index 0d9bdf26a982a..6d33b2f75eea1 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfoTest.java @@ -85,10 +85,10 @@ public void cleanup() throws IOException { @Test public void testSnapshot() throws IOException, IllegalPathException { Set storageGroupPathList = new TreeSet<>(); - storageGroupPathList.add("root.sg"); - storageGroupPathList.add("root.a.sg"); - storageGroupPathList.add("root.a.b.sg"); - storageGroupPathList.add("root.a.a.a.b.sg"); + storageGroupPathList.add("root.db"); + storageGroupPathList.add("root.a.db"); + storageGroupPathList.add("root.a.b.db"); + storageGroupPathList.add("root.a.a.a.b.db"); Map testMap = new TreeMap<>(); int i = 0; diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTreeTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTreeTest.java index 0e887886dcc46..1937fa54bd667 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTreeTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTreeTest.java @@ -186,21 +186,21 @@ public void testCheckStorageExistOfPath() { @Test public void testIllegalStorageGroup() { try { - root.setStorageGroup(new PartialPath("root.\"sg.ln\"")); + root.setStorageGroup(new PartialPath("root.\"db.ln\"")); } catch (final MetadataException e) { - Assert.assertEquals("root.\"sg.ln\" is not a legal path", e.getMessage()); + Assert.assertEquals("root.\"db.ln\" is not a legal path", e.getMessage()); } } @Test public void testCountStorageGroup() throws MetadataException { - root.setStorageGroup(new PartialPath("root.sg1")); - root.setStorageGroup(new PartialPath("root.a.sg1")); - root.setStorageGroup(new PartialPath("root.a.b.sg1")); - root.setStorageGroup(new PartialPath("root.sg2")); - root.setStorageGroup(new PartialPath("root.a.sg2")); - root.setStorageGroup(new PartialPath("root.sg3")); - root.setStorageGroup(new PartialPath("root.a.b.sg3")); + root.setStorageGroup(new PartialPath("root.db1")); + root.setStorageGroup(new PartialPath("root.a.db1")); + root.setStorageGroup(new PartialPath("root.a.b.db1")); + root.setStorageGroup(new PartialPath("root.db2")); + root.setStorageGroup(new PartialPath("root.a.db2")); + root.setStorageGroup(new PartialPath("root.db3")); + root.setStorageGroup(new PartialPath("root.a.b.db3")); assertEquals(7, root.getDatabaseNum(new PartialPath("root.**"), ALL_MATCH_SCOPE, false, false)); assertEquals(3, root.getDatabaseNum(new PartialPath("root.*"), ALL_MATCH_SCOPE, false, false)); @@ -209,20 +209,20 @@ public void testCountStorageGroup() throws MetadataException { assertEquals( 2, root.getDatabaseNum(new PartialPath("root.*.*.*"), ALL_MATCH_SCOPE, false, false)); assertEquals( - 1, root.getDatabaseNum(new PartialPath("root.*.sg1"), ALL_MATCH_SCOPE, false, false)); + 1, root.getDatabaseNum(new PartialPath("root.*.db1"), ALL_MATCH_SCOPE, false, false)); assertEquals( - 2, root.getDatabaseNum(new PartialPath("root.**.sg1"), ALL_MATCH_SCOPE, false, false)); + 2, root.getDatabaseNum(new PartialPath("root.**.db1"), ALL_MATCH_SCOPE, false, false)); assertEquals( - 1, root.getDatabaseNum(new PartialPath("root.sg3"), ALL_MATCH_SCOPE, false, false)); + 1, root.getDatabaseNum(new PartialPath("root.db3"), ALL_MATCH_SCOPE, false, false)); assertEquals( 2, root.getDatabaseNum(new PartialPath("root.*.b.*"), ALL_MATCH_SCOPE, false, false)); } @Test public void testGetNodeListInLevel() throws MetadataException { - root.setStorageGroup(new PartialPath("root.sg1")); + root.setStorageGroup(new PartialPath("root.db1")); - root.setStorageGroup(new PartialPath("root.sg2")); + root.setStorageGroup(new PartialPath("root.db2")); Pair, Set> result = root.getNodesListInGivenLevel(new PartialPath("root.**"), 3, false, ALL_MATCH_SCOPE); @@ -243,16 +243,16 @@ public void testGetNodeListInLevel() throws MetadataException { root.setStorageGroup(new PartialPath("root.test.`001.002.003`")); root.setStorageGroup(new PartialPath("root.test.g_0.s_0_b001")); - root.setStorageGroup(new PartialPath("root.sg")); + root.setStorageGroup(new PartialPath("root.db")); root.setStorageGroup(new PartialPath("root.ln")); result = root.getNodesListInGivenLevel(new PartialPath("root.*.*.s1"), 2, true, ALL_MATCH_SCOPE); Assert.assertEquals(0, result.left.size()); Assert.assertEquals(5, result.right.size()); - Assert.assertTrue(result.right.contains(new PartialPath("root.sg1"))); - Assert.assertTrue(result.right.contains(new PartialPath("root.sg2"))); - Assert.assertTrue(result.right.contains(new PartialPath("root.sg"))); + Assert.assertTrue(result.right.contains(new PartialPath("root.db1"))); + Assert.assertTrue(result.right.contains(new PartialPath("root.db2"))); + Assert.assertTrue(result.right.contains(new PartialPath("root.db"))); Assert.assertTrue(result.right.contains(new PartialPath("root.ln"))); Assert.assertTrue(result.right.contains(new PartialPath("root.test.`001.002.003`"))); } @@ -261,10 +261,10 @@ public void testGetNodeListInLevel() throws MetadataException { public void testSerialization() throws Exception { final PartialPath[] pathList = new PartialPath[] { - new PartialPath("root.sg"), - new PartialPath("root.a.sg"), - new PartialPath("root.a.b.sg"), - new PartialPath("root.a.a.b.sg") + new PartialPath("root.db"), + new PartialPath("root.a.db"), + new PartialPath("root.a.b.db"), + new PartialPath("root.a.a.b.db") }; for (int i = 0; i < pathList.length; i++) { root.setStorageGroup(pathList[i]); @@ -295,22 +295,22 @@ public void testSerialization() throws Exception { assertEquals( 3, - newTree.getMatchedDatabases(new PartialPath("root.**.sg"), ALL_MATCH_SCOPE, false).size()); + newTree.getMatchedDatabases(new PartialPath("root.**.db"), ALL_MATCH_SCOPE, false).size()); assertEquals( 2, newTree - .getMatchedDatabases(new PartialPath("root.**.b.sg"), ALL_MATCH_SCOPE, false) + .getMatchedDatabases(new PartialPath("root.**.b.db"), ALL_MATCH_SCOPE, false) .size()); assertEquals( 1, - newTree.getMatchedDatabases(new PartialPath("root.*.*.sg"), ALL_MATCH_SCOPE, false).size()); + newTree.getMatchedDatabases(new PartialPath("root.*.*.db"), ALL_MATCH_SCOPE, false).size()); assertEquals( 3, newTree.getMatchedDatabases(new PartialPath("root.a"), ALL_MATCH_SCOPE, true).size()); assertEquals( 1, newTree.getMatchedDatabases(new PartialPath("root.a.b"), ALL_MATCH_SCOPE, true).size()); assertEquals( 1, - newTree.getMatchedDatabases(new PartialPath("root.a.b.sg"), ALL_MATCH_SCOPE, true).size()); + newTree.getMatchedDatabases(new PartialPath("root.a.b.db"), ALL_MATCH_SCOPE, true).size()); } @Test @@ -319,10 +319,10 @@ public void testTableSerialization() throws Exception { final PartialPath[] pathList = new PartialPath[] { - new PartialPath("root.sg"), - new PartialPath("root.a.sg"), - new PartialPath("root.a.b.sg"), - new PartialPath("root.a.a.b.sg") + new PartialPath("root.db"), + new PartialPath("root.a.db"), + new PartialPath("root.a.b.db"), + new PartialPath("root.a.a.b.db") }; for (int i = 0; i < pathList.length; i++) { @@ -369,22 +369,22 @@ public void testTableSerialization() throws Exception { assertEquals( 3, - newTree.getMatchedDatabases(new PartialPath("root.**.sg"), ALL_MATCH_SCOPE, false).size()); + newTree.getMatchedDatabases(new PartialPath("root.**.db"), ALL_MATCH_SCOPE, false).size()); assertEquals( 2, newTree - .getMatchedDatabases(new PartialPath("root.**.b.sg"), ALL_MATCH_SCOPE, false) + .getMatchedDatabases(new PartialPath("root.**.b.db"), ALL_MATCH_SCOPE, false) .size()); assertEquals( 1, - newTree.getMatchedDatabases(new PartialPath("root.*.*.sg"), ALL_MATCH_SCOPE, false).size()); + newTree.getMatchedDatabases(new PartialPath("root.*.*.db"), ALL_MATCH_SCOPE, false).size()); assertEquals( 3, newTree.getMatchedDatabases(new PartialPath("root.a"), ALL_MATCH_SCOPE, true).size()); assertEquals( 1, newTree.getMatchedDatabases(new PartialPath("root.a.b"), ALL_MATCH_SCOPE, true).size()); assertEquals( 1, - newTree.getMatchedDatabases(new PartialPath("root.a.b.sg"), ALL_MATCH_SCOPE, true).size()); + newTree.getMatchedDatabases(new PartialPath("root.a.b.db"), ALL_MATCH_SCOPE, true).size()); for (int i = 0; i < pathList.length; i++) { final List tables = newTree.getAllUsingTablesUnderSpecificDatabase(pathList[i]); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateCQProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateCQProcedureTest.java index d0e92b3281666..40efc2b8c315c 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateCQProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateCQProcedureTest.java @@ -46,7 +46,7 @@ public void serializeDeserializeTest() { PublicBAOS byteArrayOutputStream = new PublicBAOS(); DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); - String sql = "create cq testCq1 BEGIN select s1 into root.backup.d1(s1) from root.sg.d1 END"; + String sql = "create cq testCq1 BEGIN select s1 into root.backup.d1(s1) from root.db.d1 END"; TCreateCQReq req = new TCreateCQReq( @@ -56,7 +56,7 @@ public void serializeDeserializeTest() { 1000, 0, (byte) 0, - "select s1 into root.backup.d1(s1) from root.sg.d1", + "select s1 into root.backup.d1(s1) from root.db.d1", sql, "Asia", "root"); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateRegionGroupsProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateRegionGroupsProcedureTest.java index 6269953736100..9423729e55d0b 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateRegionGroupsProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateRegionGroupsProcedureTest.java @@ -91,12 +91,12 @@ public void serializeDeserializeTest() { assertEquals(failedRegions0, failedRegions1); CreateRegionGroupsPlan createRegionGroupsPlan = new CreateRegionGroupsPlan(); - createRegionGroupsPlan.addRegionGroup("root.sg0", dataRegionSet); - createRegionGroupsPlan.addRegionGroup("root.sg1", schemaRegionSet); + createRegionGroupsPlan.addRegionGroup("root.db0", dataRegionSet); + createRegionGroupsPlan.addRegionGroup("root.db1", schemaRegionSet); CreateRegionGroupsPlan persistPlan = new CreateRegionGroupsPlan(); - persistPlan.addRegionGroup("root.sg0", dataRegionSet); - persistPlan.addRegionGroup("root.sg1", schemaRegionSet); + persistPlan.addRegionGroup("root.db0", dataRegionSet); + persistPlan.addRegionGroup("root.db1", schemaRegionSet); CreateRegionGroupsProcedure procedure0 = new CreateRegionGroupsProcedure( diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java index 3893dff1607e2..59302a18aa774 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java @@ -94,7 +94,7 @@ public class PipeEnrichedProcedureTest { public void deleteDatabaseTest() { PublicBAOS byteArrayOutputStream = new PublicBAOS(); DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); - DeleteDatabaseProcedure p1 = new DeleteDatabaseProcedure(new TDatabaseSchema("root.sg"), true); + DeleteDatabaseProcedure p1 = new DeleteDatabaseProcedure(new TDatabaseSchema("root.db"), true); try { p1.serialize(outputStream); @@ -114,8 +114,8 @@ public void deleteDatabaseTest() { public void deleteTimeseriesTest() throws IllegalPathException, IOException { String queryId = "1"; PathPatternTree patternTree = new PathPatternTree(); - patternTree.appendPathPattern(new PartialPath("root.sg1.**")); - patternTree.appendPathPattern(new PartialPath("root.sg2.*.s1")); + patternTree.appendPathPattern(new PartialPath("root.db1.**")); + patternTree.appendPathPattern(new PartialPath("root.db2.*.s1")); patternTree.constructTree(); DeleteTimeSeriesProcedure deleteTimeSeriesProcedure = new DeleteTimeSeriesProcedure(queryId, patternTree, true, false); @@ -154,8 +154,8 @@ public void deactivateTemplateTest() throws IllegalPathException, IOException { new TSEncoding[] {TSEncoding.BITMAP, TSEncoding.PLAIN}, new CompressionType[] {CompressionType.GZIP, CompressionType.UNCOMPRESSED}); - templateSetInfo.put(new PartialPath("root.sg1.**"), Arrays.asList(t1, t2)); - templateSetInfo.put(new PartialPath("root.sg2.**"), Arrays.asList(t2, t1)); + templateSetInfo.put(new PartialPath("root.db1.**"), Arrays.asList(t1, t2)); + templateSetInfo.put(new PartialPath("root.db2.**"), Arrays.asList(t2, t1)); DeactivateTemplateProcedure deactivateTemplateProcedure = new DeactivateTemplateProcedure(queryId, templateSetInfo, true); @@ -183,7 +183,7 @@ public void unsetTemplateTest() throws IllegalPathException, IOException { new TSDataType[] {TSDataType.INT32, TSDataType.FLOAT}, new TSEncoding[] {TSEncoding.PLAIN, TSEncoding.BITMAP}, new CompressionType[] {CompressionType.UNCOMPRESSED, CompressionType.GZIP}); - PartialPath path = new PartialPath("root.sg"); + PartialPath path = new PartialPath("root.db"); UnsetTemplateProcedure unsetTemplateProcedure = new UnsetTemplateProcedure(queryId, template, path, true); @@ -202,7 +202,7 @@ public void unsetTemplateTest() throws IllegalPathException, IOException { @Test public void setTemplateTest() throws IOException { SetTemplateProcedure setTemplateProcedure = - new SetTemplateProcedure("1", "t1", "root.sg", true); + new SetTemplateProcedure("1", "t1", "root.db", true); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream); @@ -224,7 +224,7 @@ public void alterLogicalViewTest() throws IllegalPathException, IOException { new HashMap() { { put( - new PartialPath("root.sg"), + new PartialPath("root.db"), new ConstantViewOperand(TSDataType.BOOLEAN, "true")); } }, @@ -359,7 +359,7 @@ public void setTTLTest() throws IOException, IllegalPathException { final DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); // test1 - PartialPath path = new PartialPath("root.test.sg1.group1.group1.**"); + PartialPath path = new PartialPath("root.test.db1.group1.group1.**"); SetTTLPlan setTTLPlan = new SetTTLPlan(Arrays.asList(path.getNodes()), 1928300234200L); SetTTLProcedure proc = new SetTTLProcedure(setTTLPlan, true); @@ -766,8 +766,8 @@ public void setViewPropertiesTest() throws IOException { public void alterEncodingCompressorTest() throws IllegalPathException, IOException { final String queryId = "1"; final PathPatternTree patternTree = new PathPatternTree(); - patternTree.appendPathPattern(new PartialPath("root.sg1.**")); - patternTree.appendPathPattern(new PartialPath("root.sg2.*.s1")); + patternTree.appendPathPattern(new PartialPath("root.db1.**")); + patternTree.appendPathPattern(new PartialPath("root.db2.*.s1")); patternTree.constructTree(); final AlterEncodingCompressorProcedure alterEncodingCompressorProcedure = new AlterEncodingCompressorProcedure( diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterEncodingCompressorProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterEncodingCompressorProcedureTest.java index b6f2541b21580..e71dc9748e03a 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterEncodingCompressorProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterEncodingCompressorProcedureTest.java @@ -37,8 +37,8 @@ public class AlterEncodingCompressorProcedureTest { public void serializeDeserializeTest() throws IllegalPathException, IOException { final String queryId = "1"; final PathPatternTree patternTree = new PathPatternTree(); - patternTree.appendPathPattern(new PartialPath("root.sg1.**")); - patternTree.appendPathPattern(new PartialPath("root.sg2.*.s1")); + patternTree.appendPathPattern(new PartialPath("root.db1.**")); + patternTree.appendPathPattern(new PartialPath("root.db2.*.s1")); patternTree.constructTree(); final AlterEncodingCompressorProcedure alterEncodingCompressorProcedure = new AlterEncodingCompressorProcedure( diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedureTest.java index 6f690c492a721..4974f70b37e1b 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedureTest.java @@ -44,7 +44,7 @@ public void serializeDeserializeTest() throws IllegalPathException, IOException new HashMap() { { put( - new PartialPath("root.sg"), + new PartialPath("root.db"), new ConstantViewOperand(TSDataType.BOOLEAN, "true")); } }, diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeactivateTemplateProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeactivateTemplateProcedureTest.java index 87efb7a937464..e1f14185724bf 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeactivateTemplateProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeactivateTemplateProcedureTest.java @@ -63,8 +63,8 @@ public void serializeDeserializeTest() throws IllegalPathException, IOException new TSEncoding[] {TSEncoding.BITMAP, TSEncoding.PLAIN}, new CompressionType[] {CompressionType.GZIP, CompressionType.UNCOMPRESSED}); - templateSetInfo.put(new PartialPath("root.sg1.**"), Arrays.asList(t1, t2)); - templateSetInfo.put(new PartialPath("root.sg2.**"), Arrays.asList(t2, t1)); + templateSetInfo.put(new PartialPath("root.db1.**"), Arrays.asList(t1, t2)); + templateSetInfo.put(new PartialPath("root.db2.**"), Arrays.asList(t2, t1)); DeactivateTemplateProcedure deactivateTemplateProcedure = new DeactivateTemplateProcedure(queryId, templateSetInfo, false); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteDatabaseProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteDatabaseProcedureTest.java index b12f49d9bd7da..9c95bafee9098 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteDatabaseProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteDatabaseProcedureTest.java @@ -38,7 +38,7 @@ public void serializeDeserializeTest() { PublicBAOS byteArrayOutputStream = new PublicBAOS(); DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); - DeleteDatabaseProcedure p1 = new DeleteDatabaseProcedure(new TDatabaseSchema("root.sg"), false); + DeleteDatabaseProcedure p1 = new DeleteDatabaseProcedure(new TDatabaseSchema("root.db"), false); try { p1.serialize(outputStream); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedureTest.java index 8223cac998e66..d4e04557b6b43 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedureTest.java @@ -39,8 +39,8 @@ public class DeleteTimeSeriesProcedureTest { public void serializeDeserializeTest() throws IllegalPathException, IOException { String queryId = "1"; PathPatternTree patternTree = new PathPatternTree(); - patternTree.appendPathPattern(new PartialPath("root.sg1.**")); - patternTree.appendPathPattern(new PartialPath("root.sg2.*.s1")); + patternTree.appendPathPattern(new PartialPath("root.db1.**")); + patternTree.appendPathPattern(new PartialPath("root.db2.*.s1")); patternTree.constructTree(); DeleteTimeSeriesProcedure deleteTimeSeriesProcedure = new DeleteTimeSeriesProcedure(queryId, patternTree, false, false); @@ -61,7 +61,7 @@ public void serializeDeserializeTest() throws IllegalPathException, IOException List pathList = deserializedProcedure.getPatternTree().getAllPathPatterns(); pathList.sort(PartialPath::compareTo); - Assert.assertEquals("root.sg1.**", pathList.get(0).getFullPath()); - Assert.assertEquals("root.sg2.*.s1", pathList.get(1).getFullPath()); + Assert.assertEquals("root.db1.**", pathList.get(0).getFullPath()); + Assert.assertEquals("root.db2.*.s1", pathList.get(1).getFullPath()); } } diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedureTest.java index 5042eb1dd0f13..7ade87d3e98ac 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedureTest.java @@ -41,7 +41,7 @@ public void serializeDeserializeTest() throws IOException, IllegalPathException DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); // test1 - PartialPath path = new PartialPath("root.test.sg1.group1.group1.**"); + PartialPath path = new PartialPath("root.test.db1.group1.group1.**"); SetTTLPlan setTTLPlan = new SetTTLPlan(Arrays.asList(path.getNodes()), 1928300234200L); SetTTLProcedure proc = new SetTTLProcedure(setTTLPlan, false); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedureTest.java index 53b9fd2dd0f01..945fb68960a85 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedureTest.java @@ -33,7 +33,7 @@ public class SetTemplateProcedureTest { @Test public void serializeDeserializeTest() throws IOException { SetTemplateProcedure setTemplateProcedure = - new SetTemplateProcedure("1", "t1", "root.sg", false); + new SetTemplateProcedure("1", "t1", "root.db", false); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedureTest.java index b288418e1b561..860541c4984be 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedureTest.java @@ -48,7 +48,7 @@ public void serializeDeserializeTest() throws IllegalPathException, IOException new TSDataType[] {TSDataType.INT32, TSDataType.FLOAT}, new TSEncoding[] {TSEncoding.PLAIN, TSEncoding.BITMAP}, new CompressionType[] {CompressionType.UNCOMPRESSED, CompressionType.GZIP}); - PartialPath path = new PartialPath("root.sg"); + PartialPath path = new PartialPath("root.db"); UnsetTemplateProcedure unsetTemplateProcedure = new UnsetTemplateProcedure(queryId, template, path, false); diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/PipeConsensusConfig.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/PipeConsensusConfig.java index da06c60a624dc..4fb2bfbf3850a 100644 --- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/PipeConsensusConfig.java +++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/PipeConsensusConfig.java @@ -241,9 +241,9 @@ public RPC build() { } public static class Pipe { - private final String extractorPluginName; + private final String sourcePluginName; private final String processorPluginName; - private final String connectorPluginName; + private final String sinkPluginName; private final ConsensusPipeDispatcher consensusPipeDispatcher; private final ConsensusPipeGuardian consensusPipeGuardian; private final ConsensusPipeSelector consensusPipeSelector; @@ -252,18 +252,18 @@ public static class Pipe { private final long consensusPipeGuardJobIntervalInSeconds; public Pipe( - String extractorPluginName, + String sourcePluginName, String processorPluginName, - String connectorPluginName, + String sinkPluginName, ConsensusPipeDispatcher consensusPipeDispatcher, ConsensusPipeGuardian consensusPipeGuardian, ConsensusPipeSelector consensusPipeSelector, ReplicateProgressManager replicateProgressManager, ConsensusPipeReceiver consensusPipeReceiver, long consensusPipeGuardJobIntervalInSeconds) { - this.extractorPluginName = extractorPluginName; + this.sourcePluginName = sourcePluginName; this.processorPluginName = processorPluginName; - this.connectorPluginName = connectorPluginName; + this.sinkPluginName = sinkPluginName; this.consensusPipeDispatcher = consensusPipeDispatcher; this.consensusPipeGuardian = consensusPipeGuardian; this.consensusPipeSelector = consensusPipeSelector; @@ -272,16 +272,16 @@ public Pipe( this.consensusPipeGuardJobIntervalInSeconds = consensusPipeGuardJobIntervalInSeconds; } - public String getExtractorPluginName() { - return extractorPluginName; + public String getSourcePluginName() { + return sourcePluginName; } public String getProcessorPluginName() { return processorPluginName; } - public String getConnectorPluginName() { - return connectorPluginName; + public String getSinkPluginName() { + return sinkPluginName; } public ConsensusPipeDispatcher getConsensusPipeDispatcher() { @@ -313,10 +313,10 @@ public static Pipe.Builder newBuilder() { } public static class Builder { - private String extractorPluginName = BuiltinPipePlugin.IOTDB_EXTRACTOR.getPipePluginName(); + private String sourcePluginName = BuiltinPipePlugin.IOTDB_EXTRACTOR.getPipePluginName(); private String processorPluginName = BuiltinPipePlugin.PIPE_CONSENSUS_PROCESSOR.getPipePluginName(); - private String connectorPluginName = + private String sinkPluginName = BuiltinPipePlugin.PIPE_CONSENSUS_ASYNC_CONNECTOR.getPipePluginName(); private ConsensusPipeDispatcher consensusPipeDispatcher = null; private ConsensusPipeGuardian consensusPipeGuardian = null; @@ -325,8 +325,8 @@ public static class Builder { private ConsensusPipeReceiver consensusPipeReceiver = null; private long consensusPipeGuardJobIntervalInSeconds = 180L; - public Pipe.Builder setExtractorPluginName(String extractorPluginName) { - this.extractorPluginName = extractorPluginName; + public Pipe.Builder setSourcePluginName(String sourcePluginName) { + this.sourcePluginName = sourcePluginName; return this; } @@ -335,8 +335,8 @@ public Pipe.Builder setProcessorPluginName(String processorPluginName) { return this; } - public Pipe.Builder setConnectorPluginName(String connectorPluginName) { - this.connectorPluginName = connectorPluginName; + public Pipe.Builder setSinkPluginName(String sinkPluginName) { + this.sinkPluginName = sinkPluginName; return this; } @@ -375,9 +375,9 @@ public Pipe.Builder setConsensusPipeGuardJobIntervalInSeconds( public Pipe build() { return new Pipe( - extractorPluginName, + sourcePluginName, processorPluginName, - connectorPluginName, + sinkPluginName, consensusPipeDispatcher, consensusPipeGuardian, consensusPipeSelector, diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeDispatcher.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeDispatcher.java index 568f68bb577e4..b3e75cef35ace 100644 --- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeDispatcher.java +++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeDispatcher.java @@ -24,9 +24,9 @@ public interface ConsensusPipeDispatcher { void createPipe( String pipeName, - Map extractorAttributes, + Map sourceAttributes, Map processorAttributes, - Map connectorAttributes, + Map sinkAttributes, boolean needManuallyStart) throws Exception; diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeManager.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeManager.java index c1aef74a4b43a..7167961951e80 100644 --- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeManager.java +++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeManager.java @@ -99,7 +99,7 @@ public void createConsensusPipe(Peer senderPeer, Peer receiverPeer, boolean need final ConsensusPipeName consensusPipeName = new ConsensusPipeName(senderPeer, receiverPeer); return new ImmutableTriple<>( ImmutableMap.builder() - .put(EXTRACTOR_KEY, config.getExtractorPluginName()) + .put(EXTRACTOR_KEY, config.getSourcePluginName()) .put(EXTRACTOR_INCLUSION_KEY, CONSENSUS_EXTRACTOR_INCLUSION_VALUE) .put( EXTRACTOR_CONSENSUS_GROUP_ID_KEY, @@ -121,7 +121,7 @@ public void createConsensusPipe(Peer senderPeer, Peer receiverPeer, boolean need .put(PROCESSOR_KEY, config.getProcessorPluginName()) .build(), ImmutableMap.builder() - .put(CONNECTOR_KEY, config.getConnectorPluginName()) + .put(CONNECTOR_KEY, config.getSinkPluginName()) .put( CONNECTOR_CONSENSUS_GROUP_ID_KEY, String.valueOf(consensusPipeName.getConsensusGroupId().getId())) diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java index bd9a2fd73d365..86ff40cf91bdb 100644 --- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java +++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java @@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock; /** - * This class is used to aggregate the write progress of all Connectors to calculate the minimum + * This class is used to aggregate the write progress of all Sinks to calculate the minimum * synchronization progress of all follower copies, thereby calculating syncLag. * *

Note: every consensusGroup/dataRegion has and only has 1 instance of this class. @@ -36,7 +36,7 @@ public class PipeConsensusSyncLagManager { long syncLag = Long.MIN_VALUE; ReentrantLock lock = new ReentrantLock(); - Map consensusPipe2ConnectorMap = new ConcurrentHashMap<>(); + Map consensusPipe2SinkMap = new ConcurrentHashMap<>(); /** * pinnedCommitIndex - currentReplicateProgress. If res <= 0, indicating that replication is @@ -44,7 +44,7 @@ public class PipeConsensusSyncLagManager { */ public long getSyncLagForRegionMigration( ConsensusPipeName consensusPipeName, long pinnedCommitIndex) { - return Optional.ofNullable(consensusPipe2ConnectorMap.get(consensusPipeName)) + return Optional.ofNullable(consensusPipe2SinkMap.get(consensusPipeName)) .map( consensusPipeSink -> Math.max(pinnedCommitIndex - consensusPipeSink.getFollowerApplyProgress(), 0L)) @@ -56,7 +56,7 @@ public long getSyncLagForRegionMigration( * finished. */ public long getSyncLagForSpecificConsensusPipe(ConsensusPipeName consensusPipeName) { - return Optional.ofNullable(consensusPipe2ConnectorMap.get(consensusPipeName)) + return Optional.ofNullable(consensusPipe2SinkMap.get(consensusPipeName)) .map( consensusPipeSink -> { long userWriteProgress = consensusPipeSink.getLeaderReplicateProgress(); @@ -67,25 +67,25 @@ public long getSyncLagForSpecificConsensusPipe(ConsensusPipeName consensusPipeNa } public long getCurrentLeaderReplicateIndex(ConsensusPipeName consensusPipeName) { - return Optional.ofNullable(consensusPipe2ConnectorMap.get(consensusPipeName)) + return Optional.ofNullable(consensusPipe2SinkMap.get(consensusPipeName)) .map(ConsensusPipeSink::getLeaderReplicateProgress) .orElse(0L); } - public void addConsensusPipeConnector( + public void addConsensusPipeSink( ConsensusPipeName consensusPipeName, ConsensusPipeSink consensusPipeSink) { lock.lock(); try { - consensusPipe2ConnectorMap.put(consensusPipeName, consensusPipeSink); + consensusPipe2SinkMap.put(consensusPipeName, consensusPipeSink); } finally { lock.unlock(); } } - public void removeConsensusPipeConnector(ConsensusPipeName consensusPipeName) { + public void removeConsensusPipeSink(ConsensusPipeName consensusPipeName) { lock.lock(); try { - consensusPipe2ConnectorMap.remove(consensusPipeName); + consensusPipe2SinkMap.remove(consensusPipeName); } finally { lock.unlock(); } @@ -100,12 +100,12 @@ public long calculateSyncLag() { lock.lock(); try { // if there isn't a consensus pipe task, the syncLag is 0 - if (consensusPipe2ConnectorMap.isEmpty()) { + if (consensusPipe2SinkMap.isEmpty()) { return 0; } // else we find the biggest gap between leader and replicas in all consensus pipe task. syncLag = Long.MIN_VALUE; - consensusPipe2ConnectorMap + consensusPipe2SinkMap .keySet() .forEach( consensusPipeName -> @@ -118,7 +118,7 @@ public long calculateSyncLag() { } public void clear() { - this.consensusPipe2ConnectorMap.clear(); + this.consensusPipe2SinkMap.clear(); } private PipeConsensusSyncLagManager() { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java index b0b0c08322936..13c17c6e87d99 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java @@ -89,8 +89,8 @@ public class IoTDBConfig { new String[] {"SequenceStrategy", "MaxDiskUsableSpaceFirstStrategy"}; private static final String DEFAULT_MULTI_DIR_STRATEGY = "SequenceStrategy"; - private static final String STORAGE_GROUP_MATCHER = "([a-zA-Z0-9`_.\\-\\u2E80-\\u9FFF]+)"; - public static final Pattern DATABASE_PATTERN = Pattern.compile(STORAGE_GROUP_MATCHER); + private static final String DATABASE_MATCHER = "([a-zA-Z0-9`_.\\-\\u2E80-\\u9FFF]+)"; + public static final Pattern DATABASE_PATTERN = Pattern.compile(DATABASE_MATCHER); // e.g., a31+/$%#&[]{}3e4, "a.b", 'a.b' private static final String NODE_NAME_MATCHER = "([^\n\t]+)"; @@ -3432,8 +3432,8 @@ public String getConfigMessage() { String[] notShowArray = { "NODE_NAME_MATCHER", "PARTIAL_NODE_MATCHER", - "STORAGE_GROUP_MATCHER", - "STORAGE_GROUP_PATTERN", + "DATABASE_MATCHER", + "DATABASE_PATTERN", "NODE_MATCHER", "NODE_PATTERN" }; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java index 2649f8de7af4a..cc6dde0431309 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java @@ -175,11 +175,11 @@ private static ConsensusConfig buildConsensusConfig() { .build()) .setPipe( PipeConsensusConfig.Pipe.newBuilder() - .setExtractorPluginName( + .setSourcePluginName( BuiltinPipePlugin.IOTDB_EXTRACTOR.getPipePluginName()) .setProcessorPluginName( BuiltinPipePlugin.PIPE_CONSENSUS_PROCESSOR.getPipePluginName()) - .setConnectorPluginName( + .setSinkPluginName( BuiltinPipePlugin.PIPE_CONSENSUS_ASYNC_CONNECTOR.getPipePluginName()) // name .setConsensusPipeDispatcher(new ConsensusPipeDataNodeDispatcher()) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/StorageGroupNotReadyException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/StorageGroupNotReadyException.java index 36a0d1bf77c01..e34f1be3e151f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/StorageGroupNotReadyException.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/StorageGroupNotReadyException.java @@ -22,6 +22,6 @@ public class StorageGroupNotReadyException extends StorageEngineException { public StorageGroupNotReadyException(String storageGroup, int errorCode) { - super("the sg " + storageGroup + " may not ready now, please wait and retry later", errorCode); + super("the db " + storageGroup + " may not ready now, please wait and retry later", errorCode); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/PipeDataNodePluginAgent.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/PipeDataNodePluginAgent.java index 11c1edafccb13..fada15dc87644 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/PipeDataNodePluginAgent.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/PipeDataNodePluginAgent.java @@ -207,14 +207,12 @@ public void deregister(String pluginName, boolean needToDeleteJar) throws PipeEx // TODO: validate pipe plugin attributes for config node public void validate( String pipeName, - Map extractorAttributes, + Map sourceAttributes, Map processorAttributes, - Map connectorAttributes) + Map sinkAttributes) throws Exception { - dataRegionAgent.validate( - pipeName, extractorAttributes, processorAttributes, connectorAttributes); - schemaRegionAgent.validate( - pipeName, extractorAttributes, processorAttributes, connectorAttributes); + dataRegionAgent.validate(pipeName, sourceAttributes, processorAttributes, sinkAttributes); + schemaRegionAgent.validate(pipeName, sourceAttributes, processorAttributes, sinkAttributes); } public boolean checkIfPluginSameType(final String oldPluginName, final String newPluginName) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/dataregion/PipeDataRegionPluginAgent.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/dataregion/PipeDataRegionPluginAgent.java index ae27a7eff33d2..658d41f1d9713 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/dataregion/PipeDataRegionPluginAgent.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/dataregion/PipeDataRegionPluginAgent.java @@ -42,7 +42,7 @@ public PipeDataRegionPluginAgent(DataNodePipePluginMetaKeeper pipePluginMetaKeep } @Override - protected PipeSourceConstructor createPipeExtractorConstructor( + protected PipeSourceConstructor createPipeSourceConstructor( PipePluginMetaKeeper pipePluginMetaKeeper) { return new PipeDataRegionSourceConstructor((DataNodePipePluginMetaKeeper) pipePluginMetaKeeper); } @@ -55,7 +55,7 @@ protected PipeProcessorConstructor createPipeProcessorConstructor( } @Override - protected PipeSinkConstructor createPipeConnectorConstructor( + protected PipeSinkConstructor createPipeSinkConstructor( PipePluginMetaKeeper pipePluginMetaKeeper) { return new PipeDataRegionSinkConstructor((DataNodePipePluginMetaKeeper) pipePluginMetaKeeper); } @@ -63,40 +63,39 @@ protected PipeSinkConstructor createPipeConnectorConstructor( @Override public void validate( String pipeName, - Map extractorAttributes, + Map sourceAttributes, Map processorAttributes, - Map connectorAttributes) + Map sinkAttributes) throws Exception { - PipeExtractor temporaryExtractor = validateExtractor(extractorAttributes); + PipeExtractor temporaryExtractor = validateSource(sourceAttributes); PipeProcessor temporaryProcessor = validateProcessor(processorAttributes); - PipeConnector temporaryConnector = validateConnector(pipeName, connectorAttributes); + PipeConnector temporarySink = validateSink(pipeName, sinkAttributes); // validate visibility // TODO: validate visibility for schema region and config region Visibility pipeVisibility = - VisibilityUtils.calculateFromExtractorParameters(new PipeParameters(extractorAttributes)); - Visibility extractorVisibility = + VisibilityUtils.calculateFromExtractorParameters(new PipeParameters(sourceAttributes)); + Visibility sourceVisibility = VisibilityUtils.calculateFromPluginClass(temporaryExtractor.getClass()); Visibility processorVisibility = VisibilityUtils.calculateFromPluginClass(temporaryProcessor.getClass()); - Visibility connectorVisibility = - VisibilityUtils.calculateFromPluginClass(temporaryConnector.getClass()); + Visibility sinkVisibility = VisibilityUtils.calculateFromPluginClass(temporarySink.getClass()); if (!VisibilityUtils.isCompatible( - pipeVisibility, extractorVisibility, processorVisibility, connectorVisibility)) { + pipeVisibility, sourceVisibility, processorVisibility, sinkVisibility)) { throw new PipeParameterNotValidException( String.format( - "The visibility of the pipe (%s, %s) is not compatible with the visibility of the extractor (%s, %s, %s), processor (%s, %s, %s), and connector (%s, %s, %s).", + "The visibility of the pipe (%s, %s) is not compatible with the visibility of the source (%s, %s, %s), processor (%s, %s, %s), and sink (%s, %s, %s).", pipeName, pipeVisibility, - extractorAttributes, + sourceAttributes, temporaryExtractor.getClass().getName(), - extractorVisibility, + sourceVisibility, processorAttributes, temporaryProcessor.getClass().getName(), processorVisibility, - connectorAttributes, - temporaryConnector.getClass().getName(), - connectorVisibility)); + sinkAttributes, + temporarySink.getClass().getName(), + sinkVisibility)); } } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/schemaregion/PipeSchemaRegionPluginAgent.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/schemaregion/PipeSchemaRegionPluginAgent.java index 549030073b1ee..cd4293c6ac0de 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/schemaregion/PipeSchemaRegionPluginAgent.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/schemaregion/PipeSchemaRegionPluginAgent.java @@ -32,7 +32,7 @@ public PipeSchemaRegionPluginAgent(PipePluginMetaKeeper pipePluginMetaKeeper) { } @Override - protected PipeSourceConstructor createPipeExtractorConstructor( + protected PipeSourceConstructor createPipeSourceConstructor( PipePluginMetaKeeper pipePluginMetaKeeper) { return new PipeSchemaRegionSourceConstructor(); } @@ -44,7 +44,7 @@ protected PipeProcessorConstructor createPipeProcessorConstructor( } @Override - protected PipeSinkConstructor createPipeConnectorConstructor( + protected PipeSinkConstructor createPipeSinkConstructor( PipePluginMetaKeeper pipePluginMetaKeeper) { return new PipeSchemaRegionSinkConstructor(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/schemaregion/PipeSchemaRegionSinkConstructor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/schemaregion/PipeSchemaRegionSinkConstructor.java index 160ecf54c0158..8427bb0094b9e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/schemaregion/PipeSchemaRegionSinkConstructor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/plugin/schemaregion/PipeSchemaRegionSinkConstructor.java @@ -24,7 +24,7 @@ import org.apache.iotdb.commons.pipe.agent.plugin.constructor.PipeSinkConstructor; import org.apache.iotdb.db.pipe.sink.protocol.airgap.IoTDBSchemaRegionAirGapSink; import org.apache.iotdb.db.pipe.sink.protocol.thrift.sync.IoTDBSchemaRegionSink; -import org.apache.iotdb.pipe.api.PipeConnector; +import org.apache.iotdb.pipe.api.PipeSink; class PipeSchemaRegionSinkConstructor extends PipeSinkConstructor { @@ -62,8 +62,8 @@ protected void initConstructors() { } @Override - public PipeConnector reflectPluginByKey(String pluginKey) { + public PipeSink reflectPluginByKey(String pluginKey) { // TODO: support constructing plugin by reflection - return (PipeConnector) pluginConstructors.getOrDefault(pluginKey, DoNothingSink::new).get(); + return (PipeSink) pluginConstructors.getOrDefault(pluginKey, DoNothingSink::new).get(); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeDataNodeRuntimeAgent.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeDataNodeRuntimeAgent.java index d9a2347acecf9..310800acfa52d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeDataNodeRuntimeAgent.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeDataNodeRuntimeAgent.java @@ -79,7 +79,7 @@ public class PipeDataNodeRuntimeAgent implements IService { public synchronized void preparePipeResources( final ResourcesInformationHolder resourcesInformationHolder) throws StartupException { - // Clean sender (connector) hardlink file dir and snapshot dir + // Clean sender (sink) hardlink file dir and snapshot dir PipeDataNodeHardlinkOrCopiedFileDirStartupCleaner.clean(); // Clean receiver file dir diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTask.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTask.java index d33ec44a86e53..0d0b955c2109d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTask.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTask.java @@ -32,32 +32,32 @@ public class PipeDataNodeTask implements PipeTask { private final String pipeName; private final int regionId; - private final PipeTaskStage extractorStage; + private final PipeTaskStage sourceStage; private final PipeTaskStage processorStage; - private final PipeTaskStage connectorStage; + private final PipeTaskStage sinkStage; private volatile boolean isCompleted = false; public PipeDataNodeTask( final String pipeName, final int regionId, - final PipeTaskStage extractorStage, + final PipeTaskStage sourceStage, final PipeTaskStage processorStage, - final PipeTaskStage connectorStage) { + final PipeTaskStage sinkStage) { this.pipeName = pipeName; this.regionId = regionId; - this.extractorStage = extractorStage; + this.sourceStage = sourceStage; this.processorStage = processorStage; - this.connectorStage = connectorStage; + this.sinkStage = sinkStage; } @Override public void create() { final long startTime = System.currentTimeMillis(); - extractorStage.create(); + sourceStage.create(); processorStage.create(); - connectorStage.create(); + sinkStage.create(); LOGGER.info( "Create pipe DN task {} successfully within {} ms", this, @@ -67,9 +67,9 @@ public void create() { @Override public void drop() { final long startTime = System.currentTimeMillis(); - extractorStage.drop(); + sourceStage.drop(); processorStage.drop(); - connectorStage.drop(); + sinkStage.drop(); LOGGER.info( "Drop pipe DN task {} successfully within {} ms", this, @@ -79,9 +79,9 @@ public void drop() { @Override public void start() { final long startTime = System.currentTimeMillis(); - extractorStage.start(); + sourceStage.start(); processorStage.start(); - connectorStage.start(); + sinkStage.start(); LOGGER.info( "Start pipe DN task {} successfully within {} ms", this, @@ -91,9 +91,9 @@ public void start() { @Override public void stop() { final long startTime = System.currentTimeMillis(); - extractorStage.stop(); + sourceStage.stop(); processorStage.stop(); - connectorStage.stop(); + sinkStage.stop(); LOGGER.info( "Stop pipe DN task {} successfully within {} ms", this, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java index 438dfa3f2334e..e0fc44c7ed3bc 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java @@ -111,7 +111,6 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATH_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_END_TIME_KEY; @@ -120,6 +119,7 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATH_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATTERN_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_START_TIME_KEY; @@ -594,7 +594,7 @@ public boolean isFullSync(final PipeParameters parameters) { final boolean isRealtimeEnable = parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE); + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE); return isHistoryEnable && isRealtimeEnable; } @@ -742,7 +742,7 @@ private void calculateInsertNodeQueueMemory(final PipeParameters sourceParameter // Realtime source is enabled by default, so we only need to check the source realtime if (!sourceParameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE)) { + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { return; } @@ -751,8 +751,8 @@ private void calculateInsertNodeQueueMemory(final PipeParameters sourceParameter sourceParameters.getStringByKeys( PipeSourceConstant.EXTRACTOR_REALTIME_MODE_KEY, PipeSourceConstant.SOURCE_REALTIME_MODE_KEY); - if (PipeSourceConstant.EXTRACTOR_REALTIME_MODE_BATCH_MODE_VALUE.equals(realtimeMode) - || PipeSourceConstant.EXTRACTOR_REALTIME_MODE_FILE_VALUE.equals(realtimeMode)) { + if (PipeSourceConstant.SOURCE_REALTIME_MODE_BATCH_MODE_VALUE.equals(realtimeMode) + || PipeSourceConstant.SOURCE_REALTIME_MODE_FILE_VALUE.equals(realtimeMode)) { return; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeBuilder.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeBuilder.java index b55704a3da408..46a10135d8865 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeBuilder.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeBuilder.java @@ -63,18 +63,18 @@ public Map buildTasksWithInternalSource() throws IllegalPathE final PipeTaskMeta pipeTaskMeta = consensusGroupIdToPipeTaskMeta.getValue(); if (pipeTaskMeta.getLeaderNodeId() == CONFIG.getDataNodeId()) { - final PipeParameters extractorParameters = pipeStaticMeta.getSourceParameters(); + final PipeParameters sourceParameters = pipeStaticMeta.getSourceParameters(); final DataRegionId dataRegionId = new DataRegionId(consensusGroupId); final boolean needConstructDataRegionTask = dataRegionIds.contains(dataRegionId) && DataRegionListeningFilter.shouldDataRegionBeListened( - extractorParameters, dataRegionId); + sourceParameters, dataRegionId); final boolean needConstructSchemaRegionTask = schemaRegionIds.contains(new SchemaRegionId(consensusGroupId)) && SchemaRegionListeningFilter.shouldSchemaRegionBeListened( - consensusGroupId, extractorParameters); + consensusGroupId, sourceParameters); - // Advance the extractor parameters parsing logic to avoid creating un-relevant pipeTasks + // Advance the source parameters parsing logic to avoid creating un-relevant pipeTasks if (needConstructDataRegionTask || needConstructSchemaRegionTask) { consensusGroupIdToPipeTaskMap.put( consensusGroupId, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java index 038420527fd4a..f2adce77ea18f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java @@ -51,8 +51,8 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSinkConstant.CONNECTOR_FORMAT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSinkConstant.CONNECTOR_FORMAT_TABLET_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSinkConstant.SINK_FORMAT_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_KEY; public class PipeDataNodeTaskBuilder { @@ -115,7 +115,7 @@ public PipeDataNodeTask build() { sinkParameters, regionId, pipeType.equals(PipeType.USER) - ? PipeSubtaskExecutorManager.getInstance().getConnectorExecutorSupplier() + ? PipeSubtaskExecutorManager.getInstance().getSinkExecutorSupplier() : PipeSubtaskExecutorManager.getInstance()::getConsensusExecutor); } @@ -127,7 +127,7 @@ public PipeDataNodeTask build() { blendUserAndSystemParameters(pipeStaticMeta.getProcessorParameters()), regionId, sourceStage.getEventSupplier(), - sinkStage.getPipeConnectorPendingQueue(), + sinkStage.getPipeSinkPendingQueue(), PROCESSOR_EXECUTOR, pipeTaskMeta, pipeStaticMeta @@ -204,7 +204,7 @@ private void checkConflict( final boolean isRealtimeEnabled = sourceParameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE); + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE); if (isRealtimeEnabled && !shouldTerminatePipeOnAllHistoricalEventsConsumed) { final Boolean enableSendTsFileLimit = diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java index f119070c891d3..a16de8bc18f69 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java @@ -221,7 +221,7 @@ private void collectEvent(final Event event) { } if (event instanceof PipeHeartbeatEvent) { - ((PipeHeartbeatEvent) event).recordConnectorQueueSize(pendingQueue); + ((PipeHeartbeatEvent) event).recordSinkQueueSize(pendingQueue); } pendingQueue.directOffer(event); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/execution/PipeSubtaskExecutorManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/execution/PipeSubtaskExecutorManager.java index bed009d37c937..dc4780fd96fc9 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/execution/PipeSubtaskExecutorManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/execution/PipeSubtaskExecutorManager.java @@ -32,15 +32,15 @@ */ public class PipeSubtaskExecutorManager { private final PipeProcessorSubtaskExecutor processorExecutor; - private final Supplier connectorExecutorSupplier; + private final Supplier sinkExecutorSupplier; private final SubscriptionSubtaskExecutor subscriptionExecutor; public PipeProcessorSubtaskExecutor getProcessorExecutor() { return processorExecutor; } - public Supplier getConnectorExecutorSupplier() { - return connectorExecutorSupplier; + public Supplier getSinkExecutorSupplier() { + return sinkExecutorSupplier; } public PipeConsensusSubtaskExecutor getConsensusExecutor() { @@ -56,7 +56,7 @@ public SubscriptionSubtaskExecutor getSubscriptionExecutor() { private PipeSubtaskExecutorManager() { processorExecutor = new PipeProcessorSubtaskExecutor(); - connectorExecutorSupplier = PipeSinkSubtaskExecutor::new; + sinkExecutorSupplier = PipeSinkSubtaskExecutor::new; subscriptionExecutor = SubscriptionConfig.getInstance().getSubscriptionEnabled() ? new SubscriptionSubtaskExecutor() diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskProcessorStage.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskProcessorStage.java index 2e887f74bf023..5e26edcd12d03 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskProcessorStage.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskProcessorStage.java @@ -36,9 +36,9 @@ import org.apache.iotdb.db.pipe.agent.task.subtask.processor.PipeProcessorSubtask; import org.apache.iotdb.db.storageengine.StorageEngine; import org.apache.iotdb.db.storageengine.dataregion.DataRegion; -import org.apache.iotdb.pipe.api.PipeConnector; import org.apache.iotdb.pipe.api.PipeExtractor; import org.apache.iotdb.pipe.api.PipeProcessor; +import org.apache.iotdb.pipe.api.PipeSink; import org.apache.iotdb.pipe.api.customizer.configuration.PipeProcessorRuntimeConfiguration; import org.apache.iotdb.pipe.api.customizer.parameter.PipeParameterValidator; import org.apache.iotdb.pipe.api.customizer.parameter.PipeParameters; @@ -56,8 +56,8 @@ public class PipeTaskProcessorStage extends PipeTaskStage { * @param creationTime pipe creation time * @param pipeProcessorParameters used to create {@link PipeProcessor} * @param regionId {@link DataRegion} id - * @param pipeExtractorInputEventSupplier used to input {@link Event}s from {@link PipeExtractor} - * @param pipeConnectorOutputPendingQueue used to output {@link Event}s to {@link PipeConnector} + * @param pipeSourceInputEventSupplier used to input {@link Event}s from {@link PipeExtractor} + * @param pipeSinkOutputPendingQueue used to output {@link Event}s to {@link PipeSink} * @throws PipeException if failed to {@link PipeProcessor#validate(PipeParameterValidator)} or * {@link PipeProcessor#customize(PipeParameters, PipeProcessorRuntimeConfiguration)}} */ @@ -66,8 +66,8 @@ public PipeTaskProcessorStage( final long creationTime, final PipeParameters pipeProcessorParameters, final int regionId, - final EventSupplier pipeExtractorInputEventSupplier, - final UnboundedBlockingPendingQueue pipeConnectorOutputPendingQueue, + final EventSupplier pipeSourceInputEventSupplier, + final UnboundedBlockingPendingQueue pipeSinkOutputPendingQueue, final PipeProcessorSubtaskExecutor executor, final PipeTaskMeta pipeTaskMeta, final boolean forceTabletFormat, @@ -103,9 +103,9 @@ public PipeTaskProcessorStage( // old one, so we need creationTime to make their hash code different in the map. final String taskId = pipeName + "_" + regionId + "_" + creationTime; final boolean isUsedForConsensusPipe = pipeName.contains(PipeStaticMeta.CONSENSUS_PIPE_PREFIX); - final PipeEventCollector pipeConnectorOutputEventCollector = + final PipeEventCollector pipeSinkOutputEventCollector = new PipeEventCollector( - pipeConnectorOutputPendingQueue, + pipeSinkOutputPendingQueue, creationTime, regionId, forceTabletFormat, @@ -117,9 +117,9 @@ public PipeTaskProcessorStage( pipeName, creationTime, regionId, - pipeExtractorInputEventSupplier, + pipeSourceInputEventSupplier, pipeProcessor, - pipeConnectorOutputEventCollector); + pipeSinkOutputEventCollector); this.executor = executor; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSinkStage.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSinkStage.java index c24db53e6106a..88eac560cde2b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSinkStage.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSinkStage.java @@ -34,21 +34,21 @@ public class PipeTaskSinkStage extends PipeTaskStage { protected final String pipeName; protected final long creationTime; - protected final PipeParameters pipeConnectorParameters; + protected final PipeParameters pipeSinkParameters; protected final int regionId; protected final Supplier executor; - protected String connectorSubtaskId; + protected String sinkSubtaskId; public PipeTaskSinkStage( String pipeName, long creationTime, - PipeParameters pipeConnectorParameters, + PipeParameters pipeSinkParameters, int regionId, Supplier executor) { this.pipeName = pipeName; this.creationTime = creationTime; - this.pipeConnectorParameters = pipeConnectorParameters; + this.pipeSinkParameters = pipeSinkParameters; this.regionId = regionId; this.executor = executor; @@ -56,11 +56,11 @@ public PipeTaskSinkStage( } protected void registerSubtask() { - this.connectorSubtaskId = + this.sinkSubtaskId = PipeSinkSubtaskManager.instance() .register( executor, - pipeConnectorParameters, + pipeSinkParameters, new PipeTaskSinkRuntimeEnvironment(pipeName, creationTime, regionId)); } @@ -71,21 +71,20 @@ public void createSubtask() throws PipeException { @Override public void startSubtask() throws PipeException { - PipeSinkSubtaskManager.instance().start(connectorSubtaskId); + PipeSinkSubtaskManager.instance().start(sinkSubtaskId); } @Override public void stopSubtask() throws PipeException { - PipeSinkSubtaskManager.instance().stop(connectorSubtaskId); + PipeSinkSubtaskManager.instance().stop(sinkSubtaskId); } @Override public void dropSubtask() throws PipeException { - PipeSinkSubtaskManager.instance() - .deregister(pipeName, creationTime, regionId, connectorSubtaskId); + PipeSinkSubtaskManager.instance().deregister(pipeName, creationTime, regionId, sinkSubtaskId); } - public UnboundedBlockingPendingQueue getPipeConnectorPendingQueue() { - return PipeSinkSubtaskManager.instance().getPipeConnectorPendingQueue(connectorSubtaskId); + public UnboundedBlockingPendingQueue getPipeSinkPendingQueue() { + return PipeSinkSubtaskManager.instance().getPipeSinkPendingQueue(sinkSubtaskId); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSourceStage.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSourceStage.java index 57a804df0d382..9fc8a2650015b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSourceStage.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSourceStage.java @@ -40,38 +40,37 @@ public class PipeTaskSourceStage extends PipeTaskStage { private static final Logger LOGGER = LoggerFactory.getLogger(PipeTaskSourceStage.class); - private final PipeExtractor pipeExtractor; + private final PipeExtractor pipeSource; public PipeTaskSourceStage( String pipeName, long creationTime, - PipeParameters extractorParameters, + PipeParameters sourceParameters, int regionId, PipeTaskMeta pipeTaskMeta) { - pipeExtractor = + pipeSource = StorageEngine.getInstance().getAllDataRegionIds().contains(new DataRegionId(regionId)) || PipeRuntimeMeta.isSourceExternal(regionId) - ? PipeDataNodeAgent.plugin().dataRegion().reflectSource(extractorParameters) - : PipeDataNodeAgent.plugin().schemaRegion().reflectSource(extractorParameters); + ? PipeDataNodeAgent.plugin().dataRegion().reflectSource(sourceParameters) + : PipeDataNodeAgent.plugin().schemaRegion().reflectSource(sourceParameters); - // Validate and customize should be called before createSubtask. this allows extractor exposing + // Validate and customize should be called before createSubtask. this allows source exposing // exceptions in advance. try { - // 1. Validate extractor parameters - pipeExtractor.validate(new PipeParameterValidator(extractorParameters)); + // 1. Validate source parameters + pipeSource.validate(new PipeParameterValidator(sourceParameters)); - // 2. Customize extractor + // 2. Customize source final PipeTaskRuntimeConfiguration runtimeConfiguration = new PipeTaskRuntimeConfiguration( new PipeTaskSourceRuntimeEnvironment(pipeName, creationTime, regionId, pipeTaskMeta)); - pipeExtractor.customize(extractorParameters, runtimeConfiguration); + pipeSource.customize(sourceParameters, runtimeConfiguration); } catch (Exception e) { try { - pipeExtractor.close(); + pipeSource.close(); } catch (Exception closeException) { LOGGER.warn( - "Failed to close extractor after failed to initialize extractor. " - + "Ignore this exception.", + "Failed to close source after failed to initialize source. " + "Ignore this exception.", closeException); } throw new PipeException(e.getMessage(), e); @@ -86,7 +85,7 @@ public void createSubtask() throws PipeException { @Override public void startSubtask() throws PipeException { try { - pipeExtractor.start(); + pipeSource.start(); } catch (Exception e) { throw new PipeException(e.getMessage(), e); } @@ -94,19 +93,19 @@ public void startSubtask() throws PipeException { @Override public void stopSubtask() throws PipeException { - // Extractor continuously extracts data, so do nothing in stop + // Source continuously extracts data, so do nothing in stop } @Override public void dropSubtask() throws PipeException { try { - pipeExtractor.close(); + pipeSource.close(); } catch (Exception e) { throw new PipeException(e.getMessage(), e); } } public EventSupplier getEventSupplier() { - return pipeExtractor::supply; + return pipeSource::supply; } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/processor/PipeProcessorSubtask.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/processor/PipeProcessorSubtask.java index a574712cbbdcd..7c9794275a9a3 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/processor/PipeProcessorSubtask.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/processor/PipeProcessorSubtask.java @@ -187,11 +187,11 @@ protected boolean executeOnce() throws Exception { !isClosed.get() // If an event does not generate any events except itself at this stage, it is divided // into two categories: - // 1. If the event is collected and passed to the connector, the reference count of - // the event may eventually be zero in the processor (the connector reduces the + // 1. If the event is collected and passed to the sink, the reference count of + // the event may eventually be zero in the processor (the sink reduces the // reference count first, and then the processor reduces the reference count), at this // time, the progress of the event needs to be reported. - // 2. If the event is not collected (not passed to the connector), the reference count + // 2. If the event is not collected (not passed to the sink), the reference count // of the event must be zero in the processor stage, at this time, the progress of the // event needs to be reported. && outputEventCollector.hasNoGeneratedEvent() @@ -203,10 +203,10 @@ protected boolean executeOnce() throws Exception { if (shouldReport && event instanceof EnrichedEvent && outputEventCollector.hasNoCollectInvocationAfterReset()) { - // An event should be reported here when it is not passed to the connector stage, and it - // does not generate any new events to be passed to the connector. In our system, before + // An event should be reported here when it is not passed to the sink stage, and it + // does not generate any new events to be passed to the sink. In our system, before // reporting an event, we need to enrich a commitKey and commitId, which is done in the - // collector stage. But for the event that not passed to the connector and not generate any + // collector stage. But for the event that not passed to the sink and not generate any // new events, the collector stage is not triggered, so we need to enrich the commitKey and // commitId here. PipeEventCommitManager.getInstance() diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtask.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtask.java index 308ddfb90d23d..8dd274eedcab6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtask.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtask.java @@ -57,9 +57,9 @@ public class PipeSinkSubtask extends PipeAbstractSinkSubtask { // Record these variables to provide corresponding value to tag key of monitoring metrics private final String attributeSortedString; - private final int connectorIndex; + private final int sinkIndex; - // Now parallel connectors run the same time, thus the heartbeat events are not sure + // Now parallel sinks run the same time, thus the heartbeat events are not sure // to trigger the general event transfer function, causing potentially such as // the random delay of the batch transmission. Therefore, here we inject cron events // when no event can be pulled. @@ -70,12 +70,12 @@ public PipeSinkSubtask( final String taskID, final long creationTime, final String attributeSortedString, - final int connectorIndex, + final int sinkIndex, final UnboundedBlockingPendingQueue inputPendingQueue, - final PipeConnector outputPipeConnector) { - super(taskID, creationTime, outputPipeConnector); + final PipeConnector outputPipeSink) { + super(taskID, creationTime, outputPipeSink); this.attributeSortedString = attributeSortedString; - this.connectorIndex = connectorIndex; + this.sinkIndex = sinkIndex; this.inputPendingQueue = inputPendingQueue; if (!attributeSortedString.startsWith("schema_")) { @@ -140,7 +140,7 @@ protected boolean executeOnce() { throw e; } else { LOGGER.info( - "{} in pipe transfer, ignored because the connector subtask is dropped.", + "{} in pipe transfer, ignored because the sink subtask is dropped.", e.getClass().getSimpleName(), e); clearReferenceCountAndReleaseLastEvent(event); @@ -158,8 +158,7 @@ protected boolean executeOnce() { ErrorHandlingUtils.getRootCause(e).getMessage()), e); } else { - LOGGER.info( - "Exception in pipe transfer, ignored because the connector subtask is dropped.", e); + LOGGER.info("Exception in pipe transfer, ignored because the sink subtask is dropped.", e); clearReferenceCountAndReleaseLastEvent(event); } } @@ -178,7 +177,7 @@ private void transferHeartbeatEvent(final PipeHeartbeatEvent event) { outputPipeSink.transfer(event); } catch (final Exception e) { throw new PipeConnectionException( - "PipeConnector: " + "PipeSink: " + outputPipeSink.getClass().getName() + "(id: " + taskID @@ -205,27 +204,27 @@ public void close() { final long startTime = System.currentTimeMillis(); outputPipeSink.close(); LOGGER.info( - "Pipe: connector subtask {} ({}) was closed within {} ms", + "Pipe: sink subtask {} ({}) was closed within {} ms", taskID, outputPipeSink, System.currentTimeMillis() - startTime); } catch (final Exception e) { LOGGER.info( - "Exception occurred when closing pipe connector subtask {}, root cause: {}", + "Exception occurred when closing pipe sink subtask {}, root cause: {}", taskID, ErrorHandlingUtils.getRootCause(e).getMessage(), e); } finally { inputPendingQueue.discardAllEvents(); - // Should be called after outputPipeConnector.close() + // Should be called after outputPipeSink.close() super.close(); } } /** - * When a pipe is dropped, the connector maybe reused and will not be closed. So we just discard - * its queued events in the output pipe connector. + * When a pipe is dropped, the sink maybe reused and will not be closed. So we just discard its + * queued events in the output pipe sink. */ public void discardEventsOfPipe(final String pipeNameToDrop, int regionId) { // Try to remove the events as much as possible @@ -285,8 +284,8 @@ public String getAttributeSortedString() { return attributeSortedString; } - public int getConnectorIndex() { - return connectorIndex; + public int getSinkIndex() { + return sinkIndex; } public int getTsFileInsertionEventCount() { @@ -304,7 +303,7 @@ public int getPipeHeartbeatEventCount() { + (lastEvent instanceof PipeHeartbeatEvent ? 1 : 0); } - public int getAsyncConnectorRetryEventQueueSize() { + public int getAsyncSinkRetryEventQueueSize() { return outputPipeSink instanceof IoTDBDataRegionAsyncSink ? ((IoTDBDataRegionAsyncSink) outputPipeSink).getRetryEventQueueSize() : 0; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtaskLifeCycle.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtaskLifeCycle.java index 0df3a773b9c15..754c5f4d5a9dd 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtaskLifeCycle.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtaskLifeCycle.java @@ -67,7 +67,7 @@ public synchronized void register() { executor.register(subtask); runningTaskCount = 0; - PipeDataNodeResourceManager.compaction().registerPipeConnectorSubtaskLifeCycle(this); + PipeDataNodeResourceManager.compaction().registerPipeSinkSubtaskLifeCycle(this); } registeredTaskCount++; @@ -84,7 +84,7 @@ public synchronized void register() { * *

Note that this method should be called after the {@link PipeSinkSubtask} is stopped. * Otherwise, the {@link PipeSinkSubtaskLifeCycle#runningTaskCount} might be inconsistent with the - * {@link PipeSinkSubtaskLifeCycle#registeredTaskCount} because of parallel connector scheduling. + * {@link PipeSinkSubtaskLifeCycle#registeredTaskCount} because of parallel sink scheduling. * * @param pipeNameToDeregister pipe name * @param regionId region id @@ -160,6 +160,6 @@ public synchronized void stop() { public synchronized void close() { executor.deregister(subtask.getTaskID()); - PipeDataNodeResourceManager.compaction().deregisterPipeConnectorSubtaskLifeCycle(this); + PipeDataNodeResourceManager.compaction().deregisterPipeSinkSubtaskLifeCycle(this); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtaskManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtaskManager.java index b249ed7b1e936..c7b00832119ea 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtaskManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/sink/PipeSinkSubtaskManager.java @@ -57,17 +57,17 @@ public class PipeSinkSubtaskManager { private static final Logger LOGGER = LoggerFactory.getLogger(PipeSinkSubtaskManager.class); private static final String FAILED_TO_DEREGISTER_EXCEPTION_MESSAGE = - "Failed to deregister PipeConnectorSubtask. No such subtask: "; + "Failed to deregister PipeSinkSubtask. No such subtask: "; private final Map> attributeSortedString2SubtaskLifeCycleMap = new HashMap<>(); public synchronized String register( final Supplier executorSupplier, - final PipeParameters pipeConnectorParameters, + final PipeParameters pipeSinkParameters, final PipeTaskSinkRuntimeEnvironment environment) { - final String connectorKey = - pipeConnectorParameters + final String sinkKey = + pipeSinkParameters .getStringOrDefault( Arrays.asList(PipeSinkConstant.CONNECTOR_KEY, PipeSinkConstant.SINK_KEY), BuiltinPipePlugin.IOTDB_THRIFT_CONNECTOR.getPipePluginName()) @@ -79,43 +79,42 @@ public synchronized String register( environment.getPipeName(), environment.getCreationTime(), environment.getRegionId(), - connectorKey); + sinkKey); - final boolean isDataRegionConnector = + final boolean isDataRegionSink = StorageEngine.getInstance() .getAllDataRegionIds() .contains(new DataRegionId(environment.getRegionId())) || PipeRuntimeMeta.isSourceExternal(environment.getRegionId()); - final int connectorNum; + final int sinkNum; boolean realTimeFirst = false; - String attributeSortedString = generateAttributeSortedString(pipeConnectorParameters); - if (isDataRegionConnector) { - connectorNum = - pipeConnectorParameters.getIntOrDefault( + String attributeSortedString = generateAttributeSortedString(pipeSinkParameters); + if (isDataRegionSink) { + sinkNum = + pipeSinkParameters.getIntOrDefault( Arrays.asList( PipeSinkConstant.CONNECTOR_IOTDB_PARALLEL_TASKS_KEY, PipeSinkConstant.SINK_IOTDB_PARALLEL_TASKS_KEY), PipeSinkConstant.CONNECTOR_IOTDB_PARALLEL_TASKS_DEFAULT_VALUE); realTimeFirst = - pipeConnectorParameters.getBooleanOrDefault( + pipeSinkParameters.getBooleanOrDefault( Arrays.asList( PipeSinkConstant.CONNECTOR_REALTIME_FIRST_KEY, PipeSinkConstant.SINK_REALTIME_FIRST_KEY), PipeSinkConstant.CONNECTOR_REALTIME_FIRST_DEFAULT_VALUE); attributeSortedString = "data_" + attributeSortedString; } else { - // Do not allow parallel tasks for schema region connectors + // Do not allow parallel tasks for schema region sinks // to avoid the potential disorder of the schema region data transfer - connectorNum = 1; + sinkNum = 1; attributeSortedString = "schema_" + attributeSortedString; } environment.setAttributeSortedString(attributeSortedString); if (!attributeSortedString2SubtaskLifeCycleMap.containsKey(attributeSortedString)) { final PipeSinkSubtaskExecutor executor = executorSupplier.get(); - final List pipeSinkSubtaskLifeCycleList = - new ArrayList<>(connectorNum); + final List pipeSinkSubtaskLifeCycleList = new ArrayList<>(sinkNum); AtomicInteger counter = new AtomicInteger(0); // Shared pending queue for all subtasks @@ -128,52 +127,48 @@ public synchronized String register( ((PipeRealtimePriorityBlockingQueue) pendingQueue).setOfferTsFileCounter(counter); } - for (int connectorIndex = 0; connectorIndex < connectorNum; connectorIndex++) { - final PipeConnector pipeConnector = - isDataRegionConnector - ? PipeDataNodeAgent.plugin().dataRegion().reflectSink(pipeConnectorParameters) - : PipeDataNodeAgent.plugin().schemaRegion().reflectSink(pipeConnectorParameters); - // 1. Construct, validate and customize PipeConnector, and then handshake (create + for (int sinkIndex = 0; sinkIndex < sinkNum; sinkIndex++) { + final PipeConnector pipeSink = + isDataRegionSink + ? PipeDataNodeAgent.plugin().dataRegion().reflectSink(pipeSinkParameters) + : PipeDataNodeAgent.plugin().schemaRegion().reflectSink(pipeSinkParameters); + // 1. Construct, validate and customize PipeSink, and then handshake (create // connection) with the target try { - if (pipeConnector instanceof IoTDBDataRegionAsyncSink) { - ((IoTDBDataRegionAsyncSink) pipeConnector).setTransferTsFileCounter(counter); + if (pipeSink instanceof IoTDBDataRegionAsyncSink) { + ((IoTDBDataRegionAsyncSink) pipeSink).setTransferTsFileCounter(counter); } - pipeConnector.validate(new PipeParameterValidator(pipeConnectorParameters)); - pipeConnector.customize( - pipeConnectorParameters, new PipeTaskRuntimeConfiguration(environment)); - pipeConnector.handshake(); + pipeSink.validate(new PipeParameterValidator(pipeSinkParameters)); + pipeSink.customize(pipeSinkParameters, new PipeTaskRuntimeConfiguration(environment)); + pipeSink.handshake(); } catch (final Exception e) { try { - pipeConnector.close(); + pipeSink.close(); } catch (final Exception closeException) { LOGGER.warn( - "Failed to close connector after failed to initialize connector. " - + "Ignore this exception.", + "Failed to close sink after failed to initialize sink. " + "Ignore this exception.", closeException); } - throw new PipeException( - "Failed to construct PipeConnector, because of " + e.getMessage(), e); + throw new PipeException("Failed to construct PipeSink, because of " + e.getMessage(), e); } - // 2. Construct PipeConnectorSubtaskLifeCycle to manage PipeConnectorSubtask's life cycle + // 2. Construct PipeSinkSubtaskLifeCycle to manage PipeSinkSubtask's life cycle final PipeSinkSubtask pipeSinkSubtask = new PipeSinkSubtask( String.format( - "%s_%s_%s", - attributeSortedString, environment.getCreationTime(), connectorIndex), + "%s_%s_%s", attributeSortedString, environment.getCreationTime(), sinkIndex), environment.getCreationTime(), attributeSortedString, - connectorIndex, + sinkIndex, pendingQueue, - pipeConnector); + pipeSink); final PipeSinkSubtaskLifeCycle pipeSinkSubtaskLifeCycle = new PipeSinkSubtaskLifeCycle(executor, pipeSinkSubtask, pendingQueue); pipeSinkSubtaskLifeCycleList.add(pipeSinkSubtaskLifeCycle); } LOGGER.info( - "Pipe connector subtasks with attributes {} is bounded with connectorExecutor {} and callbackExecutor {}.", + "Pipe sink subtasks with attributes {} is bounded with sinkExecutor {} and callbackExecutor {}.", attributeSortedString, executor.getWorkingThreadName(), executor.getCallbackThreadName()); @@ -243,7 +238,7 @@ public synchronized void stop(final String attributeSortedString) { } } - public UnboundedBlockingPendingQueue getPipeConnectorPendingQueue( + public UnboundedBlockingPendingQueue getPipeSinkPendingQueue( final String attributeSortedString) { if (!attributeSortedString2SubtaskLifeCycleMap.containsKey(attributeSortedString)) { throw new PipeException( @@ -257,9 +252,9 @@ public UnboundedBlockingPendingQueue getPipeConnectorPendingQueue( .getPendingQueue(); } - private String generateAttributeSortedString(final PipeParameters pipeConnectorParameters) { + private String generateAttributeSortedString(final PipeParameters pipeSinkParameters) { final TreeMap sortedStringSourceMap = - new TreeMap<>(pipeConnectorParameters.getAttribute()); + new TreeMap<>(pipeSinkParameters.getAttribute()); sortedStringSourceMap.remove(SystemConstant.RESTART_OR_NEWLY_ADDED_KEY); return sortedStringSourceMap.toString(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/ConsensusPipeDataNodeDispatcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/ConsensusPipeDataNodeDispatcher.java index 02179a29f569a..39688e2a4b4ce 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/ConsensusPipeDataNodeDispatcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/ConsensusPipeDataNodeDispatcher.java @@ -49,9 +49,9 @@ public class ConsensusPipeDataNodeDispatcher implements ConsensusPipeDispatcher @Override public void createPipe( String pipeName, - Map extractorAttributes, + Map sourceAttributes, Map processorAttributes, - Map connectorAttributes, + Map sinkAttributes, boolean needManuallyStart) throws Exception { try (ConfigNodeClient configNodeClient = @@ -60,9 +60,9 @@ public void createPipe( new TCreatePipeReq() .setPipeName(pipeName) .setNeedManuallyStart(needManuallyStart) - .setExtractorAttributes(extractorAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes) - .setConnectorAttributes(connectorAttributes); + .setConnectorAttributes(sinkAttributes); TSStatus status = configNodeClient.createPipe(req); if (TSStatusCode.SUCCESS_STATUS.getStatusCode() != status.getCode()) { LOGGER.warn("Failed to create consensus pipe-{}, status: {}", pipeName, status); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/metric/PipeConsensusSinkMetrics.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/metric/PipeConsensusSinkMetrics.java index b2a78edfeeaea..226b4a1353bf4 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/metric/PipeConsensusSinkMetrics.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/metric/PipeConsensusSinkMetrics.java @@ -31,36 +31,36 @@ import org.apache.iotdb.metrics.utils.MetricType; public class PipeConsensusSinkMetrics implements IMetricSet { - private final PipeConsensusAsyncSink pipeConsensusAsyncConnector; + private final PipeConsensusAsyncSink pipeConsensusAsyncSink; - private Timer connectorEnqueueTimer = DoNothingMetricManager.DO_NOTHING_TIMER; - private Timer connectorWALTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; - private Timer connectorTsFileTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; - private Timer connectorTsFilePieceTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; + private Timer sinkEnqueueTimer = DoNothingMetricManager.DO_NOTHING_TIMER; + private Timer sinkWALTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; + private Timer sinkTsFileTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; + private Timer sinkTsFilePieceTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; private Timer retryWALTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; private Timer retryTsFileTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; private Counter retryCounter = DoNothingMetricManager.DO_NOTHING_COUNTER; - private static final String CONNECTOR = "pipeConsensusAsyncConnector"; + private static final String CONNECTOR = "pipeConsensusAsyncSink"; - public PipeConsensusSinkMetrics(PipeConsensusAsyncSink pipeConsensusAsyncConnector) { - this.pipeConsensusAsyncConnector = pipeConsensusAsyncConnector; + public PipeConsensusSinkMetrics(PipeConsensusAsyncSink pipeConsensusAsyncSink) { + this.pipeConsensusAsyncSink = pipeConsensusAsyncSink; } - public void recordConnectorEnqueueTimer(long costTimeInNanos) { - connectorEnqueueTimer.updateNanos(costTimeInNanos); + public void recordSinkEnqueueTimer(long costTimeInNanos) { + sinkEnqueueTimer.updateNanos(costTimeInNanos); } - public void recordConnectorWalTransferTimer(long costTimeInNanos) { - connectorWALTransferTimer.updateNanos(costTimeInNanos); + public void recordSinkWalTransferTimer(long costTimeInNanos) { + sinkWALTransferTimer.updateNanos(costTimeInNanos); } - public void recordConnectorTsFileTransferTimer(long costTimeInNanos) { - connectorTsFileTransferTimer.updateNanos(costTimeInNanos); + public void recordSinkTsFileTransferTimer(long costTimeInNanos) { + sinkTsFileTransferTimer.updateNanos(costTimeInNanos); } - public void recordConnectorTsFilePieceTransferTimer(long costTimeInNanos) { - connectorTsFilePieceTransferTimer.updateNanos(costTimeInNanos); + public void recordSinkTsFilePieceTransferTimer(long costTimeInNanos) { + sinkTsFilePieceTransferTimer.updateNanos(costTimeInNanos); } public void recordRetryWALTransferTimer(long costTimeInNanos) { @@ -97,7 +97,7 @@ private void bindCounter(AbstractMetricService metricService) { Tag.NAME.toString(), CONNECTOR, Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr(), + pipeConsensusAsyncSink.getConsensusGroupIdStr(), Tag.TYPE.toString(), "pipeConsensusRetryCount"); } @@ -106,68 +106,68 @@ private void bindAutoGauge(AbstractMetricService metricService) { metricService.createAutoGauge( Metric.PIPE_SEND_EVENT.toString(), MetricLevel.IMPORTANT, - pipeConsensusAsyncConnector, + pipeConsensusAsyncSink, PipeConsensusAsyncSink::getTransferBufferSize, Tag.NAME.toString(), CONNECTOR, Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr(), + pipeConsensusAsyncSink.getConsensusGroupIdStr(), Tag.TYPE.toString(), "transferBufferSize"); metricService.createAutoGauge( Metric.PIPE_SEND_EVENT.toString(), MetricLevel.IMPORTANT, - pipeConsensusAsyncConnector, + pipeConsensusAsyncSink, PipeConsensusAsyncSink::getRetryBufferSize, Tag.NAME.toString(), CONNECTOR, Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr(), + pipeConsensusAsyncSink.getConsensusGroupIdStr(), Tag.TYPE.toString(), "retryBufferSize"); } private void bindTimer(AbstractMetricService metricService) { - connectorEnqueueTimer = + sinkEnqueueTimer = metricService.getOrCreateTimer( Metric.PIPE_SEND_EVENT.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), CONNECTOR, Tag.TYPE.toString(), - "connectorEnqueue", + "sinkEnqueue", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); - connectorTsFilePieceTransferTimer = + pipeConsensusAsyncSink.getConsensusGroupIdStr()); + sinkTsFilePieceTransferTimer = metricService.getOrCreateTimer( Metric.PIPE_SEND_EVENT.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), CONNECTOR, Tag.TYPE.toString(), - "connectorTsFilePieceTransfer", + "sinkTsFilePieceTransfer", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); - connectorTsFileTransferTimer = + pipeConsensusAsyncSink.getConsensusGroupIdStr()); + sinkTsFileTransferTimer = metricService.getOrCreateTimer( Metric.PIPE_SEND_EVENT.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), CONNECTOR, Tag.TYPE.toString(), - "connectorTsFileTransfer", + "sinkTsFileTransfer", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); - connectorWALTransferTimer = + pipeConsensusAsyncSink.getConsensusGroupIdStr()); + sinkWALTransferTimer = metricService.getOrCreateTimer( Metric.PIPE_SEND_EVENT.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), CONNECTOR, Tag.TYPE.toString(), - "connectorWALTransfer", + "sinkWALTransfer", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); + pipeConsensusAsyncSink.getConsensusGroupIdStr()); retryWALTransferTimer = metricService.getOrCreateTimer( Metric.PIPE_RETRY_SEND_EVENT.toString(), @@ -177,7 +177,7 @@ private void bindTimer(AbstractMetricService metricService) { Tag.TYPE.toString(), "retryWALTransfer", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); + pipeConsensusAsyncSink.getConsensusGroupIdStr()); retryTsFileTransferTimer = metricService.getOrCreateTimer( Metric.PIPE_RETRY_SEND_EVENT.toString(), @@ -187,7 +187,7 @@ private void bindTimer(AbstractMetricService metricService) { Tag.TYPE.toString(), "retryTsFileTransfer", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); + pipeConsensusAsyncSink.getConsensusGroupIdStr()); } private void unbindCounter(AbstractMetricService metricService) { @@ -199,7 +199,7 @@ private void unbindCounter(AbstractMetricService metricService) { Tag.NAME.toString(), CONNECTOR, Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr(), + pipeConsensusAsyncSink.getConsensusGroupIdStr(), Tag.TYPE.toString(), "pipeConsensusRetryCount"); } @@ -211,7 +211,7 @@ private void unbindAutoGauge(AbstractMetricService metricService) { Tag.NAME.toString(), CONNECTOR, Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr(), + pipeConsensusAsyncSink.getConsensusGroupIdStr(), Tag.TYPE.toString(), "transferBufferSize"); metricService.remove( @@ -220,16 +220,16 @@ private void unbindAutoGauge(AbstractMetricService metricService) { Tag.NAME.toString(), CONNECTOR, Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr(), + pipeConsensusAsyncSink.getConsensusGroupIdStr(), Tag.TYPE.toString(), "retryBufferSize"); } private void unbindTimer(AbstractMetricService metricService) { - connectorEnqueueTimer = DoNothingMetricManager.DO_NOTHING_TIMER; - connectorWALTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; - connectorTsFileTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; - connectorTsFilePieceTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; + sinkEnqueueTimer = DoNothingMetricManager.DO_NOTHING_TIMER; + sinkWALTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; + sinkTsFileTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; + sinkTsFilePieceTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; retryWALTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; retryTsFileTransferTimer = DoNothingMetricManager.DO_NOTHING_TIMER; @@ -239,36 +239,36 @@ private void unbindTimer(AbstractMetricService metricService) { Tag.NAME.toString(), CONNECTOR, Tag.TYPE.toString(), - "connectorTsFileTransfer", + "sinkTsFileTransfer", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); + pipeConsensusAsyncSink.getConsensusGroupIdStr()); metricService.remove( MetricType.TIMER, Metric.PIPE_SEND_EVENT.toString(), Tag.NAME.toString(), CONNECTOR, Tag.TYPE.toString(), - "connectorTsFilePieceTransfer", + "sinkTsFilePieceTransfer", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); + pipeConsensusAsyncSink.getConsensusGroupIdStr()); metricService.remove( MetricType.TIMER, Metric.PIPE_SEND_EVENT.toString(), Tag.NAME.toString(), CONNECTOR, Tag.TYPE.toString(), - "connectorTsFileTransfer", + "sinkTsFileTransfer", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); + pipeConsensusAsyncSink.getConsensusGroupIdStr()); metricService.remove( MetricType.TIMER, Metric.PIPE_SEND_EVENT.toString(), Tag.NAME.toString(), CONNECTOR, Tag.TYPE.toString(), - "connectorWALTransfer", + "sinkWALTransfer", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); + pipeConsensusAsyncSink.getConsensusGroupIdStr()); metricService.remove( MetricType.TIMER, Metric.PIPE_RETRY_SEND_EVENT.toString(), @@ -277,7 +277,7 @@ private void unbindTimer(AbstractMetricService metricService) { Tag.TYPE.toString(), "retryWALTransfer", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); + pipeConsensusAsyncSink.getConsensusGroupIdStr()); metricService.remove( MetricType.TIMER, Metric.PIPE_RETRY_SEND_EVENT.toString(), @@ -286,6 +286,6 @@ private void unbindTimer(AbstractMetricService metricService) { Tag.TYPE.toString(), "retryTsFileTransfer", Tag.REGION.toString(), - pipeConsensusAsyncConnector.getConsensusGroupIdStr()); + pipeConsensusAsyncSink.getConsensusGroupIdStr()); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/heartbeat/PipeHeartbeatEvent.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/heartbeat/PipeHeartbeatEvent.java index 468292b8ecc4e..86949e758b5d6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/heartbeat/PipeHeartbeatEvent.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/heartbeat/PipeHeartbeatEvent.java @@ -52,13 +52,13 @@ public class PipeHeartbeatEvent extends EnrichedEvent { // The disruptor is usually nearly empty. private int disruptorSize; - private int extractorQueueTabletSize; - private int extractorQueueTsFileSize; - private int extractorQueueSize; + private int sourceQueueTabletSize; + private int sourceQueueTsFileSize; + private int sourceQueueSize; - private int connectorQueueTabletSize; - private int connectorQueueTsFileSize; - private int connectorQueueSize; + private int sinkQueueTabletSize; + private int sinkQueueTsFileSize; + private int sinkQueueSize; private final boolean shouldPrintMessage; @@ -104,7 +104,7 @@ public boolean internallyIncreaseResourceReferenceCount(final String holderMessa @Override public boolean internallyDecreaseResourceReferenceCount(final String holderMessage) { // PipeName == null indicates that the event is the raw event at disruptor, - // not the event copied and passed to the extractor + // not the event copied and passed to the source if (Objects.nonNull(pipeName)) { PipeDataNodeSinglePipeMetrics.getInstance() .decreaseHeartbeatEventCount(pipeName, creationTime); @@ -208,17 +208,17 @@ public void recordDisruptorSize(final RingBuffer ringBuffer) { public void recordExtractorQueueSize(final UnboundedBlockingPendingQueue pendingQueue) { if (shouldPrintMessage) { - extractorQueueTabletSize = pendingQueue.getTabletInsertionEventCount(); - extractorQueueTsFileSize = pendingQueue.getTsFileInsertionEventCount(); - extractorQueueSize = pendingQueue.size(); + sourceQueueTabletSize = pendingQueue.getTabletInsertionEventCount(); + sourceQueueTsFileSize = pendingQueue.getTsFileInsertionEventCount(); + sourceQueueSize = pendingQueue.size(); } } - public void recordConnectorQueueSize(final UnboundedBlockingPendingQueue pendingQueue) { + public void recordSinkQueueSize(final UnboundedBlockingPendingQueue pendingQueue) { if (shouldPrintMessage) { - connectorQueueTabletSize = pendingQueue.getTabletInsertionEventCount(); - connectorQueueTsFileSize = pendingQueue.getTsFileInsertionEventCount(); - connectorQueueSize = pendingQueue.size(); + sinkQueueTabletSize = pendingQueue.getTabletInsertionEventCount(); + sinkQueueTsFileSize = pendingQueue.getTsFileInsertionEventCount(); + sinkQueueSize = pendingQueue.size(); } } @@ -259,19 +259,19 @@ public String toString() { final String disruptorSizeMessage = Integer.toString(disruptorSize); - final String extractorQueueTabletSizeMessage = - timeAssigned != 0 ? Integer.toString(extractorQueueTabletSize) : unknownMessage; - final String extractorQueueTsFileSizeMessage = - timeAssigned != 0 ? Integer.toString(extractorQueueTsFileSize) : unknownMessage; - final String extractorQueueSizeMessage = - timeAssigned != 0 ? Integer.toString(extractorQueueSize) : unknownMessage; + final String sourceQueueTabletSizeMessage = + timeAssigned != 0 ? Integer.toString(sourceQueueTabletSize) : unknownMessage; + final String sourceQueueTsFileSizeMessage = + timeAssigned != 0 ? Integer.toString(sourceQueueTsFileSize) : unknownMessage; + final String sourceQueueSizeMessage = + timeAssigned != 0 ? Integer.toString(sourceQueueSize) : unknownMessage; - final String connectorQueueTabletSizeMessage = - timeProcessed != 0 ? Integer.toString(connectorQueueTabletSize) : unknownMessage; - final String connectorQueueTsFileSizeMessage = - timeProcessed != 0 ? Integer.toString(connectorQueueTsFileSize) : unknownMessage; - final String connectorQueueSizeMessage = - timeProcessed != 0 ? Integer.toString(connectorQueueSize) : unknownMessage; + final String sinkQueueTabletSizeMessage = + timeProcessed != 0 ? Integer.toString(sinkQueueTabletSize) : unknownMessage; + final String sinkQueueTsFileSizeMessage = + timeProcessed != 0 ? Integer.toString(sinkQueueTsFileSize) : unknownMessage; + final String sinkQueueSizeMessage = + timeProcessed != 0 ? Integer.toString(sinkQueueSize) : unknownMessage; return "PipeHeartbeatEvent{" + "pipeName='" @@ -290,18 +290,18 @@ public String toString() { + totalTimeMessage + ", disruptorSize=" + disruptorSizeMessage - + ", extractorQueueTabletSize=" - + extractorQueueTabletSizeMessage - + ", extractorQueueTsFileSize=" - + extractorQueueTsFileSizeMessage - + ", extractorQueueSize=" - + extractorQueueSizeMessage - + ", connectorQueueTabletSize=" - + connectorQueueTabletSizeMessage - + ", connectorQueueTsFileSize=" - + connectorQueueTsFileSizeMessage - + ", connectorQueueSize=" - + connectorQueueSizeMessage + + ", sourceQueueTabletSize=" + + sourceQueueTabletSizeMessage + + ", sourceQueueTsFileSize=" + + sourceQueueTsFileSizeMessage + + ", sourceQueueSize=" + + sourceQueueSizeMessage + + ", sinkQueueTabletSize=" + + sinkQueueTabletSizeMessage + + ", sinkQueueTsFileSize=" + + sinkQueueTsFileSizeMessage + + ", sinkQueueSize=" + + sinkQueueSizeMessage + "}"; } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/realtime/PipeRealtimeEvent.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/realtime/PipeRealtimeEvent.java index 9ee89189e1384..27649c4002f4f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/realtime/PipeRealtimeEvent.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/realtime/PipeRealtimeEvent.java @@ -122,7 +122,7 @@ public boolean increaseReferenceCount(final String holderMessage) { // This method must be overridden, otherwise during the real-time data extraction stage, the // current PipeRealtimeEvent rather than the member variable EnrichedEvent will increase // the reference count, resulting in errors in the reference count of the EnrichedEvent - // contained in this PipeRealtimeEvent during the processor and connector stages. + // contained in this PipeRealtimeEvent during the processor and sink stages. return event.increaseReferenceCount(holderMessage); } @@ -136,7 +136,7 @@ public boolean decreaseReferenceCount(final String holderMessage, final boolean // This method must be overridden, otherwise during the real-time data extraction stage, the // current PipeRealtimeEvent rather than the member variable EnrichedEvent will decrease // the reference count, resulting in errors in the reference count of the EnrichedEvent - // contained in this PipeRealtimeEvent during the processor and connector stages. + // contained in this PipeRealtimeEvent during the processor and sink stages. return event.decreaseReferenceCount(holderMessage, shouldReport); } @@ -145,7 +145,7 @@ public boolean clearReferenceCount(final String holderMessage) { // This method must be overridden, otherwise during the real-time data extraction stage, the // current PipeRealtimeEvent rather than the member variable EnrichedEvent will clear // the reference count, resulting in errors in the reference count of the EnrichedEvent - // contained in this PipeRealtimeEvent during the processor and connector stages. + // contained in this PipeRealtimeEvent during the processor and sink stages. return event.clearReferenceCount(holderMessage); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/schema/PipeSchemaRegionSinkMetrics.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/schema/PipeSchemaRegionSinkMetrics.java index c6e8ad5295070..4c15118f8504d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/schema/PipeSchemaRegionSinkMetrics.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/schema/PipeSchemaRegionSinkMetrics.java @@ -43,7 +43,7 @@ public class PipeSchemaRegionSinkMetrics implements IMetricSet { @SuppressWarnings("java:S3077") private volatile AbstractMetricService metricService; - private final ConcurrentMap connectorMap = new ConcurrentHashMap<>(); + private final ConcurrentMap sinkMap = new ConcurrentHashMap<>(); private final ConcurrentMap schemaRateMap = new ConcurrentHashMap<>(); //////////////////////////// bindTo & unbindFrom (metric framework) //////////////////////////// @@ -51,7 +51,7 @@ public class PipeSchemaRegionSinkMetrics implements IMetricSet { @Override public void bindTo(final AbstractMetricService metricService) { this.metricService = metricService; - ImmutableSet.copyOf(connectorMap.keySet()).forEach(this::createMetrics); + ImmutableSet.copyOf(sinkMap.keySet()).forEach(this::createMetrics); } private void createMetrics(final String taskID) { @@ -59,7 +59,7 @@ private void createMetrics(final String taskID) { } private void createRate(final String taskID) { - final PipeSinkSubtask connector = connectorMap.get(taskID); + final PipeSinkSubtask sink = sinkMap.get(taskID); // Transfer event rate schemaRateMap.put( taskID, @@ -67,17 +67,16 @@ private void createRate(final String taskID) { Metric.PIPE_CONNECTOR_SCHEMA_TRANSFER.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime()))); + String.valueOf(sink.getCreationTime()))); } @Override public void unbindFrom(final AbstractMetricService metricService) { - ImmutableSet.copyOf(connectorMap.keySet()).forEach(this::deregister); - if (!connectorMap.isEmpty()) { - LOGGER.warn( - "Failed to unbind from pipe schema region connector metrics, connector map not empty"); + ImmutableSet.copyOf(sinkMap.keySet()).forEach(this::deregister); + if (!sinkMap.isEmpty()) { + LOGGER.warn("Failed to unbind from pipe schema region sink metrics, sink map not empty"); } } @@ -86,15 +85,15 @@ private void removeMetrics(final String taskID) { } private void removeRate(final String taskID) { - final PipeSinkSubtask connector = connectorMap.get(taskID); + final PipeSinkSubtask sink = sinkMap.get(taskID); // Transfer event rate metricService.remove( MetricType.RATE, Metric.PIPE_CONNECTOR_SCHEMA_TRANSFER.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); schemaRateMap.remove(taskID); } @@ -102,23 +101,23 @@ private void removeRate(final String taskID) { public void register(final PipeSinkSubtask pipeSinkSubtask) { final String taskID = pipeSinkSubtask.getTaskID(); - connectorMap.putIfAbsent(taskID, pipeSinkSubtask); + sinkMap.putIfAbsent(taskID, pipeSinkSubtask); if (Objects.nonNull(metricService)) { createMetrics(taskID); } } public void deregister(final String taskID) { - if (!connectorMap.containsKey(taskID)) { + if (!sinkMap.containsKey(taskID)) { LOGGER.warn( - "Failed to deregister pipe schema region connector metrics, PipeConnectorSubtask({}) does not exist", + "Failed to deregister pipe schema region sink metrics, PipeSinkSubtask({}) does not exist", taskID); return; } if (Objects.nonNull(metricService)) { removeMetrics(taskID); } - connectorMap.remove(taskID); + sinkMap.remove(taskID); } public void markSchemaEvent(final String taskID) { @@ -128,7 +127,7 @@ public void markSchemaEvent(final String taskID) { final Rate rate = schemaRateMap.get(taskID); if (rate == null) { LOGGER.info( - "Failed to mark pipe schema region write plan event, PipeConnectorSubtask({}) does not exist", + "Failed to mark pipe schema region write plan event, PipeSinkSubtask({}) does not exist", taskID); return; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/sink/PipeDataRegionSinkMetrics.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/sink/PipeDataRegionSinkMetrics.java index 7eef4a03aa5d9..2502c385e5c03 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/sink/PipeDataRegionSinkMetrics.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/sink/PipeDataRegionSinkMetrics.java @@ -46,7 +46,7 @@ public class PipeDataRegionSinkMetrics implements IMetricSet { @SuppressWarnings("java:S3077") private volatile AbstractMetricService metricService; - private final Map connectorMap = new HashMap<>(); + private final Map sinkMap = new HashMap<>(); private final Map tabletRateMap = new ConcurrentHashMap<>(); @@ -61,7 +61,7 @@ public class PipeDataRegionSinkMetrics implements IMetricSet { @Override public void bindTo(final AbstractMetricService metricService) { this.metricService = metricService; - final ImmutableSet taskIDs = ImmutableSet.copyOf(connectorMap.keySet()); + final ImmutableSet taskIDs = ImmutableSet.copyOf(sinkMap.keySet()); for (String taskID : taskIDs) { createMetrics(taskID); } @@ -75,91 +75,91 @@ private void createMetrics(final String taskID) { } private void createAutoGauge(final String taskID) { - final PipeSinkSubtask connector = connectorMap.get(taskID); + final PipeSinkSubtask sink = sinkMap.get(taskID); // Pending event count metricService.createAutoGauge( Metric.UNTRANSFERRED_TABLET_COUNT.toString(), MetricLevel.IMPORTANT, - connector, + sink, PipeSinkSubtask::getTabletInsertionEventCount, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.createAutoGauge( Metric.UNTRANSFERRED_TSFILE_COUNT.toString(), MetricLevel.IMPORTANT, - connector, + sink, PipeSinkSubtask::getTsFileInsertionEventCount, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.createAutoGauge( Metric.UNTRANSFERRED_HEARTBEAT_COUNT.toString(), MetricLevel.IMPORTANT, - connector, + sink, PipeSinkSubtask::getPipeHeartbeatEventCount, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); - // Metrics related to IoTDBThriftAsyncConnector + String.valueOf(sink.getCreationTime())); + // Metrics related to IoTDBThriftAsyncSink metricService.createAutoGauge( Metric.PIPE_ASYNC_CONNECTOR_RETRY_EVENT_QUEUE_SIZE.toString(), MetricLevel.IMPORTANT, - connector, - PipeSinkSubtask::getAsyncConnectorRetryEventQueueSize, + sink, + PipeSinkSubtask::getAsyncSinkRetryEventQueueSize, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.createAutoGauge( Metric.PIPE_PENDING_HANDLERS_SIZE.toString(), MetricLevel.IMPORTANT, - connector, + sink, PipeSinkSubtask::getPendingHandlersSize, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); - // Metrics related to IoTDB connector + String.valueOf(sink.getCreationTime())); + // Metrics related to IoTDB sink metricService.createAutoGauge( Metric.PIPE_TOTAL_UNCOMPRESSED_SIZE.toString(), MetricLevel.IMPORTANT, - connector, + sink, PipeSinkSubtask::getTotalUncompressedSize, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.createAutoGauge( Metric.PIPE_TOTAL_COMPRESSED_SIZE.toString(), MetricLevel.IMPORTANT, - connector, + sink, PipeSinkSubtask::getTotalCompressedSize, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); } private void createRate(final String taskID) { - final PipeSinkSubtask connector = connectorMap.get(taskID); + final PipeSinkSubtask sink = sinkMap.get(taskID); // Transfer event rate tabletRateMap.put( taskID, @@ -167,109 +167,108 @@ private void createRate(final String taskID) { Metric.PIPE_CONNECTOR_TABLET_TRANSFER.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime()))); + String.valueOf(sink.getCreationTime()))); tsFileRateMap.put( taskID, metricService.getOrCreateRate( Metric.PIPE_CONNECTOR_TSFILE_TRANSFER.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime()))); + String.valueOf(sink.getCreationTime()))); pipeHeartbeatRateMap.put( taskID, metricService.getOrCreateRate( Metric.PIPE_CONNECTOR_HEARTBEAT_TRANSFER.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime()))); + String.valueOf(sink.getCreationTime()))); } private void createTimer(final String taskID) { - final PipeSinkSubtask connector = connectorMap.get(taskID); + final PipeSinkSubtask sink = sinkMap.get(taskID); compressionTimerMap.putIfAbsent( - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), metricService.getOrCreateTimer( Metric.PIPE_COMPRESSION_TIME.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime()))); + String.valueOf(sink.getCreationTime()))); } private void createHistogram(final String taskID) { - final PipeSinkSubtask connector = connectorMap.get(taskID); + final PipeSinkSubtask sink = sinkMap.get(taskID); final Histogram tabletBatchSizeHistogram = metricService.getOrCreateHistogram( Metric.PIPE_INSERT_NODE_BATCH_SIZE.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); - connector.setTabletBatchSizeHistogram(tabletBatchSizeHistogram); + String.valueOf(sink.getCreationTime())); + sink.setTabletBatchSizeHistogram(tabletBatchSizeHistogram); final Histogram tsFileBatchSizeHistogram = metricService.getOrCreateHistogram( Metric.PIPE_TSFILE_BATCH_SIZE.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); - connector.setTsFileBatchSizeHistogram(tsFileBatchSizeHistogram); + String.valueOf(sink.getCreationTime())); + sink.setTsFileBatchSizeHistogram(tsFileBatchSizeHistogram); final Histogram tabletBatchTimeIntervalHistogram = metricService.getOrCreateHistogram( Metric.PIPE_INSERT_NODE_BATCH_TIME_COST.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); - connector.setTabletBatchTimeIntervalHistogram(tabletBatchTimeIntervalHistogram); + String.valueOf(sink.getCreationTime())); + sink.setTabletBatchTimeIntervalHistogram(tabletBatchTimeIntervalHistogram); final Histogram tsFileBatchTimeIntervalHistogram = metricService.getOrCreateHistogram( Metric.PIPE_TSFILE_BATCH_TIME_COST.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); - connector.setTsFileBatchTimeIntervalHistogram(tsFileBatchTimeIntervalHistogram); + String.valueOf(sink.getCreationTime())); + sink.setTsFileBatchTimeIntervalHistogram(tsFileBatchTimeIntervalHistogram); Histogram eventSizeHistogram = metricService.getOrCreateHistogram( Metric.PIPE_CONNECTOR_BATCH_SIZE.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - connector.getAttributeSortedString()); - connector.setEventSizeHistogram(eventSizeHistogram); + sink.getAttributeSortedString()); + sink.setEventSizeHistogram(eventSizeHistogram); } @Override public void unbindFrom(final AbstractMetricService metricService) { - final ImmutableSet taskIDs = ImmutableSet.copyOf(connectorMap.keySet()); + final ImmutableSet taskIDs = ImmutableSet.copyOf(sinkMap.keySet()); for (final String taskID : taskIDs) { deregister(taskID); } - if (!connectorMap.isEmpty()) { - LOGGER.warn( - "Failed to unbind from pipe data region connector metrics, connector map not empty"); + if (!sinkMap.isEmpty()) { + LOGGER.warn("Failed to unbind from pipe data region sink metrics, sink map not empty"); } } @@ -281,181 +280,181 @@ private void removeMetrics(final String taskID) { } private void removeAutoGauge(final String taskID) { - final PipeSinkSubtask connector = connectorMap.get(taskID); + final PipeSinkSubtask sink = sinkMap.get(taskID); // Pending event count metricService.remove( MetricType.AUTO_GAUGE, Metric.UNTRANSFERRED_TABLET_COUNT.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.remove( MetricType.AUTO_GAUGE, Metric.UNTRANSFERRED_TSFILE_COUNT.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.remove( MetricType.AUTO_GAUGE, Metric.UNTRANSFERRED_HEARTBEAT_COUNT.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); - // Metrics related to IoTDBThriftAsyncConnector + String.valueOf(sink.getCreationTime())); + // Metrics related to IoTDBThriftAsyncSink metricService.remove( MetricType.AUTO_GAUGE, Metric.PIPE_ASYNC_CONNECTOR_RETRY_EVENT_QUEUE_SIZE.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.remove( MetricType.AUTO_GAUGE, Metric.PIPE_PENDING_HANDLERS_SIZE.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); - // Metrics related to IoTDB connector + String.valueOf(sink.getCreationTime())); + // Metrics related to IoTDB sink metricService.remove( MetricType.AUTO_GAUGE, Metric.PIPE_TOTAL_UNCOMPRESSED_SIZE.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.remove( MetricType.AUTO_GAUGE, Metric.PIPE_TOTAL_COMPRESSED_SIZE.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); } private void removeRate(final String taskID) { - final PipeSinkSubtask connector = connectorMap.get(taskID); + final PipeSinkSubtask sink = sinkMap.get(taskID); // Transfer event rate metricService.remove( MetricType.RATE, Metric.PIPE_CONNECTOR_TABLET_TRANSFER.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.remove( MetricType.RATE, Metric.PIPE_CONNECTOR_TSFILE_TRANSFER.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.remove( MetricType.RATE, Metric.PIPE_CONNECTOR_HEARTBEAT_TRANSFER.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.INDEX.toString(), - String.valueOf(connector.getConnectorIndex()), + String.valueOf(sink.getSinkIndex()), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); tabletRateMap.remove(taskID); tsFileRateMap.remove(taskID); pipeHeartbeatRateMap.remove(taskID); } private void removeTimer(final String taskID) { - final PipeSinkSubtask connector = connectorMap.get(taskID); + final PipeSinkSubtask sink = sinkMap.get(taskID); metricService.remove( MetricType.TIMER, Metric.PIPE_COMPRESSION_TIME.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); - compressionTimerMap.remove(connector.getAttributeSortedString()); + String.valueOf(sink.getCreationTime())); + compressionTimerMap.remove(sink.getAttributeSortedString()); } private void removeHistogram(final String taskID) { - final PipeSinkSubtask connector = connectorMap.get(taskID); + final PipeSinkSubtask sink = sinkMap.get(taskID); metricService.remove( MetricType.HISTOGRAM, Metric.PIPE_INSERT_NODE_BATCH_SIZE.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.remove( MetricType.HISTOGRAM, Metric.PIPE_TSFILE_BATCH_SIZE.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.remove( MetricType.HISTOGRAM, Metric.PIPE_INSERT_NODE_BATCH_TIME_COST.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.remove( MetricType.HISTOGRAM, Metric.PIPE_TSFILE_BATCH_TIME_COST.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString(), + sink.getAttributeSortedString(), Tag.CREATION_TIME.toString(), - String.valueOf(connector.getCreationTime())); + String.valueOf(sink.getCreationTime())); metricService.remove( MetricType.HISTOGRAM, Metric.PIPE_CONNECTOR_BATCH_SIZE.toString(), Tag.NAME.toString(), - connector.getAttributeSortedString()); + sink.getAttributeSortedString()); } //////////////////////////// register & deregister (pipe integration) //////////////////////////// public void register(final PipeSinkSubtask pipeSinkSubtask) { final String taskID = pipeSinkSubtask.getTaskID(); - connectorMap.putIfAbsent(taskID, pipeSinkSubtask); + sinkMap.putIfAbsent(taskID, pipeSinkSubtask); if (Objects.nonNull(metricService)) { createMetrics(taskID); } } public void deregister(final String taskID) { - if (!connectorMap.containsKey(taskID)) { + if (!sinkMap.containsKey(taskID)) { LOGGER.warn( - "Failed to deregister pipe data region connector metrics, PipeConnectorSubtask({}) does not exist", + "Failed to deregister pipe data region sink metrics, PipeSinkSubtask({}) does not exist", taskID); return; } if (Objects.nonNull(metricService)) { removeMetrics(taskID); } - connectorMap.remove(taskID); + sinkMap.remove(taskID); } public void markTabletEvent(final String taskID) { @@ -465,7 +464,7 @@ public void markTabletEvent(final String taskID) { final Rate rate = tabletRateMap.get(taskID); if (rate == null) { LOGGER.info( - "Failed to mark pipe data region connector tablet event, PipeConnectorSubtask({}) does not exist", + "Failed to mark pipe data region sink tablet event, PipeSinkSubtask({}) does not exist", taskID); return; } @@ -479,7 +478,7 @@ public void markTsFileEvent(final String taskID) { final Rate rate = tsFileRateMap.get(taskID); if (rate == null) { LOGGER.info( - "Failed to mark pipe data region connector tsfile event, PipeConnectorSubtask({}) does not exist", + "Failed to mark pipe data region sink tsfile event, PipeSinkSubtask({}) does not exist", taskID); return; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/source/PipeDataRegionSourceMetrics.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/source/PipeDataRegionSourceMetrics.java index 918445b57e7f2..99f848ff3b75b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/source/PipeDataRegionSourceMetrics.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/source/PipeDataRegionSourceMetrics.java @@ -45,7 +45,7 @@ public class PipeDataRegionSourceMetrics implements IMetricSet { @SuppressWarnings("java:S3077") private volatile AbstractMetricService metricService; - private final Map extractorMap = new ConcurrentHashMap<>(); + private final Map sourceMap = new ConcurrentHashMap<>(); private final Map tabletRateMap = new ConcurrentHashMap<>(); @@ -56,7 +56,7 @@ public class PipeDataRegionSourceMetrics implements IMetricSet { private final Map recentProcessedTsFileEpochStateMap = new ConcurrentHashMap<>(); public Map getExtractorMap() { - return extractorMap; + return sourceMap; } //////////////////////////// bindTo & unbindFrom (metric framework) //////////////////////////// @@ -64,7 +64,7 @@ public Map getExtractorMap() { @Override public void bindTo(final AbstractMetricService metricService) { this.metricService = metricService; - final ImmutableSet taskIDs = ImmutableSet.copyOf(extractorMap.keySet()); + final ImmutableSet taskIDs = ImmutableSet.copyOf(sourceMap.keySet()); for (final String taskID : taskIDs) { createMetrics(taskID); } @@ -77,56 +77,56 @@ private void createMetrics(final String taskID) { } private void createAutoGauge(final String taskID) { - final IoTDBDataRegionSource extractor = extractorMap.get(taskID); + final IoTDBDataRegionSource source = sourceMap.get(taskID); // Pending event count metricService.createAutoGauge( Metric.UNPROCESSED_HISTORICAL_TSFILE_COUNT.toString(), MetricLevel.IMPORTANT, - extractor, + source, IoTDBDataRegionSource::getHistoricalTsFileInsertionEventCount, Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); metricService.createAutoGauge( Metric.UNPROCESSED_REALTIME_TSFILE_COUNT.toString(), MetricLevel.IMPORTANT, - extractor, + source, IoTDBDataRegionSource::getRealtimeTsFileInsertionEventCount, Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); metricService.createAutoGauge( Metric.UNPROCESSED_TABLET_COUNT.toString(), MetricLevel.IMPORTANT, - extractor, + source, IoTDBDataRegionSource::getTabletInsertionEventCount, Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); metricService.createAutoGauge( Metric.UNPROCESSED_HEARTBEAT_COUNT.toString(), MetricLevel.IMPORTANT, - extractor, + source, IoTDBDataRegionSource::getPipeHeartbeatEventCount, Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); } private void createRate(final String taskID) { - final IoTDBDataRegionSource extractor = extractorMap.get(taskID); + final IoTDBDataRegionSource source = sourceMap.get(taskID); // Supply event rate tabletRateMap.put( taskID, @@ -134,37 +134,37 @@ private void createRate(final String taskID) { Metric.PIPE_EXTRACTOR_TABLET_SUPPLY.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime()))); + String.valueOf(source.getCreationTime()))); tsFileRateMap.put( taskID, metricService.getOrCreateRate( Metric.PIPE_EXTRACTOR_TSFILE_SUPPLY.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime()))); + String.valueOf(source.getCreationTime()))); pipeHeartbeatRateMap.put( taskID, metricService.getOrCreateRate( Metric.PIPE_EXTRACTOR_HEARTBEAT_SUPPLY.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime()))); + String.valueOf(source.getCreationTime()))); } private void createGauge(final String taskID) { - final IoTDBDataRegionSource extractor = extractorMap.get(taskID); + final IoTDBDataRegionSource source = sourceMap.get(taskID); // Tsfile epoch state recentProcessedTsFileEpochStateMap.put( taskID, @@ -172,21 +172,21 @@ private void createGauge(final String taskID) { Metric.PIPE_EXTRACTOR_TSFILE_EPOCH_STATE.toString(), MetricLevel.IMPORTANT, Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime()))); + String.valueOf(source.getCreationTime()))); } @Override public void unbindFrom(final AbstractMetricService metricService) { - final ImmutableSet taskIDs = ImmutableSet.copyOf(extractorMap.keySet()); + final ImmutableSet taskIDs = ImmutableSet.copyOf(sourceMap.keySet()); for (final String taskID : taskIDs) { deregister(taskID); } - if (!extractorMap.isEmpty()) { - LOGGER.warn("Failed to unbind from pipe extractor metrics, extractor map not empty"); + if (!sourceMap.isEmpty()) { + LOGGER.warn("Failed to unbind from pipe source metrics, source map not empty"); } } @@ -197,116 +197,116 @@ private void removeMetrics(final String taskID) { } private void removeAutoGauge(final String taskID) { - final IoTDBDataRegionSource extractor = extractorMap.get(taskID); + final IoTDBDataRegionSource source = sourceMap.get(taskID); // pending event count metricService.remove( MetricType.AUTO_GAUGE, Metric.UNPROCESSED_HISTORICAL_TSFILE_COUNT.toString(), Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); metricService.remove( MetricType.AUTO_GAUGE, Metric.UNPROCESSED_REALTIME_TSFILE_COUNT.toString(), Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); metricService.remove( MetricType.AUTO_GAUGE, Metric.UNPROCESSED_TABLET_COUNT.toString(), Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); metricService.remove( MetricType.AUTO_GAUGE, Metric.UNPROCESSED_HEARTBEAT_COUNT.toString(), Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); } private void removeRate(final String taskID) { - final IoTDBDataRegionSource extractor = extractorMap.get(taskID); + final IoTDBDataRegionSource source = sourceMap.get(taskID); // supply event rate metricService.remove( MetricType.RATE, Metric.PIPE_EXTRACTOR_TABLET_SUPPLY.toString(), Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); metricService.remove( MetricType.RATE, Metric.PIPE_EXTRACTOR_TSFILE_SUPPLY.toString(), Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); metricService.remove( MetricType.RATE, Metric.PIPE_EXTRACTOR_HEARTBEAT_SUPPLY.toString(), Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); tabletRateMap.remove(taskID); tsFileRateMap.remove(taskID); pipeHeartbeatRateMap.remove(taskID); } private void removeGauge(final String taskID) { - final IoTDBDataRegionSource extractor = extractorMap.get(taskID); + final IoTDBDataRegionSource source = sourceMap.get(taskID); // Tsfile epoch state metricService.remove( MetricType.GAUGE, Metric.PIPE_EXTRACTOR_TSFILE_EPOCH_STATE.toString(), Tag.NAME.toString(), - extractor.getPipeName(), + source.getPipeName(), Tag.REGION.toString(), - String.valueOf(extractor.getRegionId()), + String.valueOf(source.getRegionId()), Tag.CREATION_TIME.toString(), - String.valueOf(extractor.getCreationTime())); + String.valueOf(source.getCreationTime())); } //////////////////////////// register & deregister (pipe integration) //////////////////////////// - public void register(final IoTDBDataRegionSource extractor) { - final String taskID = extractor.getTaskID(); - extractorMap.putIfAbsent(taskID, extractor); + public void register(final IoTDBDataRegionSource source) { + final String taskID = source.getTaskID(); + sourceMap.putIfAbsent(taskID, source); if (Objects.nonNull(metricService)) { createMetrics(taskID); } } public void deregister(final String taskID) { - if (!extractorMap.containsKey(taskID)) { + if (!sourceMap.containsKey(taskID)) { LOGGER.warn( - "Failed to deregister pipe data region extractor metrics, IoTDBDataRegionExtractor({}) does not exist", + "Failed to deregister pipe data region source metrics, IoTDBDataRegionExtractor({}) does not exist", taskID); return; } if (Objects.nonNull(metricService)) { removeMetrics(taskID); } - extractorMap.remove(taskID); + sourceMap.remove(taskID); } public void markTabletEvent(final String taskID) { @@ -316,7 +316,7 @@ public void markTabletEvent(final String taskID) { final Rate rate = tabletRateMap.get(taskID); if (rate == null) { LOGGER.info( - "Failed to mark pipe data region extractor tablet event, IoTDBDataRegionExtractor({}) does not exist", + "Failed to mark pipe data region source tablet event, IoTDBDataRegionExtractor({}) does not exist", taskID); return; } @@ -330,7 +330,7 @@ public void markTsFileEvent(final String taskID) { final Rate rate = tsFileRateMap.get(taskID); if (rate == null) { LOGGER.info( - "Failed to mark pipe data region extractor tsfile event, IoTDBDataRegionExtractor({}) does not exist", + "Failed to mark pipe data region source tsfile event, IoTDBDataRegionExtractor({}) does not exist", taskID); return; } @@ -344,7 +344,7 @@ public void markPipeHeartbeatEvent(final String taskID) { final Rate rate = pipeHeartbeatRateMap.get(taskID); if (rate == null) { LOGGER.info( - "Failed to mark pipe data region extractor heartbeat event, IoTDBDataRegionExtractor({}) does not exist", + "Failed to mark pipe data region source heartbeat event, IoTDBDataRegionExtractor({}) does not exist", taskID); return; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/twostage/exchange/sender/TwoStageAggregateSender.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/twostage/exchange/sender/TwoStageAggregateSender.java index bac357368c037..3c36559a300e6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/twostage/exchange/sender/TwoStageAggregateSender.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/twostage/exchange/sender/TwoStageAggregateSender.java @@ -208,9 +208,8 @@ private IoTDBSyncClient reconstructIoTDBSyncClient(TEndPoint endPoint) private IoTDBSyncClient constructIoTDBSyncClient(TEndPoint endPoint) throws TTransportException { return new IoTDBSyncClient( new ThriftClientProperty.Builder() - .setConnectionTimeoutMs(PIPE_CONFIG.getPipeConnectorHandshakeTimeoutMs()) - .setRpcThriftCompressionEnabled( - PIPE_CONFIG.isPipeConnectorRPCThriftCompressionEnabled()) + .setConnectionTimeoutMs(PIPE_CONFIG.getPipeSinkHandshakeTimeoutMs()) + .setRpcThriftCompressionEnabled(PIPE_CONFIG.isPipeSinkRPCThriftCompressionEnabled()) .build(), endPoint.getIp(), endPoint.getPort(), diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/airgap/IoTDBAirGapReceiver.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/airgap/IoTDBAirGapReceiver.java index 3cea6c998f87c..610b9e5fe1a0a 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/airgap/IoTDBAirGapReceiver.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/airgap/IoTDBAirGapReceiver.java @@ -70,7 +70,7 @@ public IoTDBAirGapReceiver(final Socket socket, final long receiverId) { @Override public void runMayThrow() throws Throwable { - socket.setSoTimeout(PipeConfig.getInstance().getPipeConnectorTransferTimeoutMs()); + socket.setSoTimeout(PipeConfig.getInstance().getPipeSinkTransferTimeoutMs()); socket.setKeepAlive(true); LOGGER.info("Pipe air gap receiver {} started. Socket: {}", receiverId, socket); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java index b250046d5c046..b7941876a117d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java @@ -1310,8 +1310,8 @@ private void releaseTsFileWriter( } /** - * An executor component to ensure all events sent from connector can be loaded in sequence, - * although events can arrive receiver in a random sequence. + * An executor component to ensure all events sent from sink can be loaded in sequence, although + * events can arrive receiver in a random sequence. */ private class RequestExecutor { private static final String MSG_NODE_RESTART_INDEX_STALE = @@ -1331,7 +1331,7 @@ private class RequestExecutor { private final AtomicInteger WALEventCount = new AtomicInteger(0); private final AtomicInteger tsFileEventCount = new AtomicInteger(0); private volatile long onSyncedReplicateIndex = 0; - private volatile int connectorRebootTimes = 0; + private volatile int sinkRebootTimes = 0; private volatile int pipeTaskRestartTimes = 0; public RequestExecutor( @@ -1357,16 +1357,16 @@ private TPipeConsensusTransferResp preCheck(TCommitId tCommitId) { // receives // the request with incremental rebootTimes, the {3} sent before the leader restart needs to // be discarded. - if (tCommitId.getDataNodeRebootTimes() < connectorRebootTimes) { + if (tCommitId.getDataNodeRebootTimes() < sinkRebootTimes) { return deprecatedResp(MSG_NODE_RESTART_INDEX_STALE, tCommitId); } // Similarly, check pipeTask restartTimes - if (tCommitId.getDataNodeRebootTimes() == connectorRebootTimes + if (tCommitId.getDataNodeRebootTimes() == sinkRebootTimes && tCommitId.getPipeTaskRestartTimes() < pipeTaskRestartTimes) { return deprecatedResp(MSG_PIPE_RESTART_INDEX_STALE, tCommitId); } // Similarly, check replicationIndex - if (tCommitId.getDataNodeRebootTimes() == connectorRebootTimes + if (tCommitId.getDataNodeRebootTimes() == sinkRebootTimes && tCommitId.getPipeTaskRestartTimes() == pipeTaskRestartTimes && tCommitId.getReplicateIndex() < onSyncedReplicateIndex + 1) { return deprecatedResp(MSG_STALE_REPLICATE_INDEX, tCommitId); @@ -1400,9 +1400,9 @@ private TPipeConsensusTransferResp onRequest( "PipeConsensus-PipeName-{}: start to receive no.{} event", consensusPipeName, tCommitId); - // Judge whether connector has rebooted or not, if the rebootTimes increases compared to - // connectorRebootTimes, need to reset receiver because connector has been restarted. - if (tCommitId.getDataNodeRebootTimes() > connectorRebootTimes) { + // Judge whether sink has rebooted or not, if the rebootTimes increases compared to + // sinkRebootTimes, need to reset receiver because sink has been restarted. + if (tCommitId.getDataNodeRebootTimes() > sinkRebootTimes) { resetWithNewestRebootTime(tCommitId.getDataNodeRebootTimes()); } // Similarly, check pipeTask restartTimes @@ -1481,7 +1481,7 @@ private TPipeConsensusTransferResp onRequest( } else { // if the req is not supposed to be processed and reqBuffer is not full, current thread // should wait until reqBuffer is full, which indicates the receiver has received all - // the requests from the connector without duplication or leakage. + // the requests from the sink without duplication or leakage. try { boolean timeout = !condition.await( @@ -1566,18 +1566,18 @@ private TPipeConsensusTransferResp onRequest( } /** - * Reset all data to initial status and set connectorRebootTimes properly. This method is called - * when receiver identifies connector has rebooted. + * Reset all data to initial status and set sinkRebootTimes properly. This method is called when + * receiver identifies sink has rebooted. */ - private void resetWithNewestRebootTime(int connectorRebootTimes) { + private void resetWithNewestRebootTime(int sinkRebootTimes) { LOGGER.info( "PipeConsensus-PipeName-{}: receiver detected an newer rebootTimes, which indicates the leader has rebooted. receiver will reset all its data.", consensusPipeName); // since pipe task will resend all data that hasn't synchronized after dataNode reboots, it's // safe to clear all events in buffer. clear(true, false); - // sync the follower's connectorRebootTimes with connector's actual rebootTimes. - this.connectorRebootTimes = connectorRebootTimes; + // sync the follower's sinkRebootTimes with sink's actual rebootTimes. + this.sinkRebootTimes = sinkRebootTimes; this.pipeTaskRestartTimes = 0; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeCompactionManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeCompactionManager.java index 0a4f7cb97af0d..a1456bbdef694 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeCompactionManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeCompactionManager.java @@ -35,12 +35,12 @@ public class PipeCompactionManager { private final Set pipeSinkSubtaskLifeCycles = new CopyOnWriteArraySet<>(); - public void registerPipeConnectorSubtaskLifeCycle( + public void registerPipeSinkSubtaskLifeCycle( final PipeSinkSubtaskLifeCycle pipeSinkSubtaskLifeCycle) { pipeSinkSubtaskLifeCycles.add(pipeSinkSubtaskLifeCycle); } - public void deregisterPipeConnectorSubtaskLifeCycle( + public void deregisterPipeSinkSubtaskLifeCycle( final PipeSinkSubtaskLifeCycle pipeSinkSubtaskLifeCycle) { pipeSinkSubtaskLifeCycles.remove(pipeSinkSubtaskLifeCycle); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/client/IoTDBDataNodeAsyncClientManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/client/IoTDBDataNodeAsyncClientManager.java index 5ee7f22bc0711..73e2213eea616 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/client/IoTDBDataNodeAsyncClientManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/client/IoTDBDataNodeAsyncClientManager.java @@ -312,7 +312,7 @@ public void onError(final Exception e) { PipeTransferHandshakeConstant.HANDSHAKE_KEY_SKIP_IF, Boolean.toString(skipIfNoPrivileges)); - client.setTimeoutDynamically(PipeConfig.getInstance().getPipeConnectorHandshakeTimeoutMs()); + client.setTimeoutDynamically(PipeConfig.getInstance().getPipeSinkHandshakeTimeoutMs()); client.pipeTransfer(PipeTransferDataNodeHandshakeV2Req.toTPipeTransferReq(params), callback); waitHandshakeFinished(isHandshakeFinished); @@ -331,7 +331,7 @@ public void onError(final Exception e) { resp.set(null); exception.set(null); - client.setTimeoutDynamically(PipeConfig.getInstance().getPipeConnectorHandshakeTimeoutMs()); + client.setTimeoutDynamically(PipeConfig.getInstance().getPipeSinkHandshakeTimeoutMs()); client.pipeTransfer( PipeTransferDataNodeHandshakeV1Req.toTPipeTransferReq( CommonDescriptor.getInstance().getConfig().getTimestampPrecision()), diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/airgap/IoTDBDataRegionAirGapSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/airgap/IoTDBDataRegionAirGapSink.java index 5e2dfb6f9a0b3..f2ced49f1365c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/airgap/IoTDBDataRegionAirGapSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/airgap/IoTDBDataRegionAirGapSink.java @@ -88,7 +88,7 @@ public void transfer(final TabletInsertionEvent tabletInsertionEvent) throws Exc if (!(tabletInsertionEvent instanceof PipeInsertNodeTabletInsertionEvent) && !(tabletInsertionEvent instanceof PipeRawTabletInsertionEvent)) { LOGGER.warn( - "IoTDBDataRegionAirGapConnector only support " + "IoTDBDataRegionAirGapSink only support " + "PipeInsertNodeTabletInsertionEvent and PipeRawTabletInsertionEvent. " + "Ignore {}.", tabletInsertionEvent); @@ -120,7 +120,7 @@ public void transfer(final TsFileInsertionEvent tsFileInsertionEvent) throws Exc // PipeProcessor can change the type of tsFileInsertionEvent if (!(tsFileInsertionEvent instanceof PipeTsFileInsertionEvent)) { LOGGER.warn( - "IoTDBDataRegionAirGapConnector only support PipeTsFileInsertionEvent. Ignore {}.", + "IoTDBDataRegionAirGapSink only support PipeTsFileInsertionEvent. Ignore {}.", tsFileInsertionEvent); return; } @@ -159,8 +159,7 @@ public void transfer(final Event event) throws Exception { doTransferWrapper(socket, (PipeDeleteDataNodeEvent) event); } else if (!(event instanceof PipeHeartbeatEvent || event instanceof PipeTerminateEvent)) { LOGGER.warn( - "IoTDBDataRegionAirGapConnector does not support transferring generic event: {}.", - event); + "IoTDBDataRegionAirGapSink does not support transferring generic event: {}.", event); } } catch (final IOException e) { isSocketAlive.set(socketIndex, false); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/airgap/IoTDBSchemaRegionAirGapSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/airgap/IoTDBSchemaRegionAirGapSink.java index 3634b2396a432..07a2e2d561c50 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/airgap/IoTDBSchemaRegionAirGapSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/airgap/IoTDBSchemaRegionAirGapSink.java @@ -52,13 +52,13 @@ public class IoTDBSchemaRegionAirGapSink extends IoTDBDataNodeAirGapSink { @Override public void transfer(final TabletInsertionEvent tabletInsertionEvent) throws Exception { throw new UnsupportedOperationException( - "IoTDBSchemaRegionAirGapConnector can't transfer TabletInsertionEvent."); + "IoTDBSchemaRegionAirGapSink can't transfer TabletInsertionEvent."); } @Override public void transfer(final TsFileInsertionEvent tsFileInsertionEvent) throws Exception { throw new UnsupportedOperationException( - "IoTDBSchemaRegionAirGapConnector can't transfer TsFileInsertionEvent."); + "IoTDBSchemaRegionAirGapSink can't transfer TsFileInsertionEvent."); } @Override @@ -73,8 +73,7 @@ public void transfer(final Event event) throws Exception { doTransferWrapper(socket, (PipeSchemaRegionSnapshotEvent) event); } else if (!(event instanceof PipeHeartbeatEvent)) { LOGGER.warn( - "IoTDBSchemaRegionAirGapConnector does not support transferring generic event: {}.", - event); + "IoTDBSchemaRegionAirGapSink does not support transferring generic event: {}.", event); } } catch (final IOException e) { isSocketAlive.set(socketIndex, false); @@ -206,7 +205,7 @@ protected void mayLimitRateAndRecordIO(final long requiredBytes) { protected byte[] getTransferSingleFilePieceBytes( final String fileName, final long position, final byte[] payLoad) { throw new UnsupportedOperationException( - "The schema region air gap connector does not support transferring single file piece bytes."); + "The schema region air gap sink does not support transferring single file piece bytes."); } @Override diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/legacy/IoTDBLegacyPipeSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/legacy/IoTDBLegacyPipeSink.java index c07d379232abb..d114d0b19c30c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/legacy/IoTDBLegacyPipeSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/legacy/IoTDBLegacyPipeSink.java @@ -106,7 +106,7 @@ public class IoTDBLegacyPipeSink implements PipeConnector { private String user; private String password; - private String syncConnectorVersion; + private String syncSinkVersion; private String pipeName; private String databaseName; @@ -190,7 +190,7 @@ public void customize( Arrays.asList(CONNECTOR_IOTDB_PASSWORD_KEY, SINK_IOTDB_PASSWORD_KEY), CONNECTOR_IOTDB_PASSWORD_DEFAULT_VALUE); - syncConnectorVersion = + syncSinkVersion = parameters.getStringOrDefault( Arrays.asList( CONNECTOR_IOTDB_SYNC_CONNECTOR_VERSION_KEY, SINK_IOTDB_SYNC_CONNECTOR_VERSION_KEY), @@ -226,7 +226,7 @@ public void handshake() throws Exception { trustStorePwd); final TSyncIdentityInfo identityInfo = new TSyncIdentityInfo( - pipeName, System.currentTimeMillis(), syncConnectorVersion, databaseName); + pipeName, System.currentTimeMillis(), syncSinkVersion, databaseName); final TSStatus status = client.handshake(identityInfo); if (status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { final String errorMsg = @@ -267,7 +267,7 @@ public void transfer(final TabletInsertionEvent tabletInsertionEvent) throws Exc doTransferWrapper((PipeRawTabletInsertionEvent) tabletInsertionEvent); } else { throw new NotImplementedException( - "IoTDBLegacyPipeConnector only support " + "IoTDBLegacyPipeSink only support " + "PipeInsertNodeInsertionEvent and PipeTabletInsertionEvent."); } } @@ -276,7 +276,7 @@ public void transfer(final TabletInsertionEvent tabletInsertionEvent) throws Exc public void transfer(final TsFileInsertionEvent tsFileInsertionEvent) throws Exception { if (!(tsFileInsertionEvent instanceof PipeTsFileInsertionEvent)) { throw new NotImplementedException( - "IoTDBLegacyPipeConnector only support PipeTsFileInsertionEvent."); + "IoTDBLegacyPipeSink only support PipeTsFileInsertionEvent."); } if (!((PipeTsFileInsertionEvent) tsFileInsertionEvent).waitForTsFileClose()) { @@ -300,8 +300,7 @@ public void transfer(final TsFileInsertionEvent tsFileInsertionEvent) throws Exc @Override public void transfer(final Event event) throws Exception { if (!(event instanceof PipeHeartbeatEvent || event instanceof PipeTerminateEvent)) { - LOGGER.warn( - "IoTDBLegacyPipeConnector does not support transferring generic event: {}.", event); + LOGGER.warn("IoTDBLegacyPipeSink does not support transferring generic event: {}.", event); } } @@ -385,7 +384,7 @@ private void transportSingleFilePieceByPiece(final File file) throws IOException long position = 0; // Try small piece to rebase the file position. - final byte[] buffer = new byte[PipeConfig.getInstance().getPipeConnectorReadFileBufferSize()]; + final byte[] buffer = new byte[PipeConfig.getInstance().getPipeSinkReadFileBufferSize()]; try (final RandomAccessFile randomAccessFile = new RandomAccessFile(file, "r")) { while (true) { final int dataLength = randomAccessFile.read(buffer); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaSink.java index 2c6f40d769b72..ef662251540e4 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaSink.java @@ -251,7 +251,7 @@ public static void transferByTablet( if (!(tabletInsertionEvent instanceof PipeInsertNodeTabletInsertionEvent) && !(tabletInsertionEvent instanceof PipeRawTabletInsertionEvent)) { logger.warn( - "This Connector only support " + "This Sink only support " + "PipeInsertNodeTabletInsertionEvent and PipeRawTabletInsertionEvent. " + "Ignore {}.", tabletInsertionEvent); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusAsyncSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusAsyncSink.java index a481f7cde0d54..cf36f8d94f5f7 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusAsyncSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusAsyncSink.java @@ -89,7 +89,7 @@ public class PipeConsensusAsyncSink extends IoTDBSink implements ConsensusPipeSink { private static final Logger LOGGER = LoggerFactory.getLogger(PipeConsensusAsyncSink.class); private static final String ENQUEUE_EXCEPTION_MSG = - "Timeout: PipeConsensusConnector offers an event into transferBuffer failed, because transferBuffer is full."; + "Timeout: PipeConsensusSink offers an event into transferBuffer failed, because transferBuffer is full."; private static final String THRIFT_ERROR_FORMATTER_WITHOUT_ENDPOINT = "Failed to borrow client from client pool or exception occurred " + "when sending to receiver."; @@ -112,7 +112,7 @@ public class PipeConsensusAsyncSink extends IoTDBSink implements ConsensusPipeSi private PipeConsensusSinkMetrics pipeConsensusSinkMetrics; private String consensusPipeName; private int consensusGroupId; - private PipeConsensusSyncSink retryConnector; + private PipeConsensusSyncSink retrySink; private IClientManager asyncTransferClientManager; private PipeConsensusAsyncBatchReqBuilder tabletBatchBuilder; private volatile long currentReplicateProgress = 0; @@ -144,16 +144,16 @@ public void customize(PipeParameters parameters, PipeConnectorRuntimeConfigurati // initialize metric components pipeConsensusSinkMetrics = new PipeConsensusSinkMetrics(this); PipeConsensusSyncLagManager.getInstance(getConsensusGroupIdStr()) - .addConsensusPipeConnector(new ConsensusPipeName(consensusPipeName), this); + .addConsensusPipeSink(new ConsensusPipeName(consensusPipeName), this); MetricService.getInstance().addMetricSet(this.pipeConsensusSinkMetrics); - // In PipeConsensus, one pipeConsensusTask corresponds to a pipeConsensusConnector. Thus, + // In PipeConsensus, one pipeConsensusTask corresponds to a pipeConsensusSink. Thus, // `nodeUrls` here actually is a singletonList that contains one peer's TEndPoint. But here we // retain the implementation of list to cope with possible future expansion - retryConnector = + retrySink = new PipeConsensusSyncSink( nodeUrls, consensusGroupId, thisDataNodeId, pipeConsensusSinkMetrics); - retryConnector.customize(parameters, configuration); + retrySink.customize(parameters, configuration); asyncTransferClientManager = IoTV2GlobalComponentContainer.getInstance().getGlobalAsyncClientManager(); @@ -178,7 +178,7 @@ private boolean addEvent2Buffer(EnrichedEvent event) { try { if (LOGGER.isDebugEnabled()) { LOGGER.debug( - "PipeConsensus-ConsensusGroup-{}: no.{} event-{} added to connector buffer", + "PipeConsensus-ConsensusGroup-{}: no.{} event-{} added to sink buffer", consensusGroupId, event.getReplicateIndexForIoTV2(), event); @@ -193,19 +193,19 @@ private boolean addEvent2Buffer(EnrichedEvent event) { transferBuffer.offer( event, PIPE_CONSENSUS_EVENT_ENQUEUE_TIMEOUT_IN_MS, TimeUnit.MILLISECONDS); long duration = System.nanoTime() - currentTime; - pipeConsensusSinkMetrics.recordConnectorEnqueueTimer(duration); + pipeConsensusSinkMetrics.recordSinkEnqueueTimer(duration); // add reference if (result) { event.increaseReferenceCount(PipeConsensusAsyncSink.class.getName()); } - // if connector is closed when executing this method, need to clear this event's reference + // if sink is closed when executing this method, need to clear this event's reference // count to avoid unnecessarily pinning some resource such as WAL. if (isClosed.get()) { event.clearReferenceCount(PipeConsensusAsyncSink.class.getName()); } return result; } catch (InterruptedException e) { - LOGGER.info("PipeConsensusConnector transferBuffer queue offer is interrupted.", e); + LOGGER.info("PipeConsensusSink transferBuffer queue offer is interrupted.", e); Thread.currentThread().interrupt(); return false; } @@ -226,7 +226,7 @@ public synchronized void removeEventFromBuffer(EnrichedEvent event) { } if (transferBuffer.isEmpty()) { LOGGER.info( - "PipeConsensus-ConsensusGroup-{}: try to remove event-{} after pipeConsensusAsyncConnector being closed. Ignore it.", + "PipeConsensus-ConsensusGroup-{}: try to remove event-{} after pipeConsensusAsyncSink being closed. Ignore it.", consensusGroupId, event); return; @@ -355,7 +355,7 @@ public void transfer(TsFileInsertionEvent tsFileInsertionEvent) throws Exception if (!(tsFileInsertionEvent instanceof PipeTsFileInsertionEvent)) { LOGGER.warn( - "PipeConsensusAsyncConnector only support PipeTsFileInsertionEvent. Current event: {}.", + "PipeConsensusAsyncSink only support PipeTsFileInsertionEvent. Current event: {}.", tsFileInsertionEvent); return; } @@ -446,8 +446,7 @@ public void transfer(Event event) throws Exception { } if (!(event instanceof PipeHeartbeatEvent)) { - LOGGER.warn( - "PipeConsensusAsyncConnector does not support transferring generic event: {}.", event); + LOGGER.warn("PipeConsensusAsyncSink does not support transferring generic event: {}.", event); } } @@ -550,7 +549,7 @@ private void asyncTransferQueuedEventsIfNecessary() { } else { if (LOGGER.isWarnEnabled()) { LOGGER.warn( - "PipeConsensusAsyncConnector does not support transfer generic event: {}.", + "PipeConsensusAsyncSink does not support transfer generic event: {}.", peekedEvent); } } @@ -681,18 +680,18 @@ private void logOnClientException( } private TEndPoint getFollowerUrl() { - // In current pipeConsensus design, one connector corresponds to one follower, so the peers is + // In current pipeConsensus design, one sink corresponds to one follower, so the peers is // actually a singleton list return nodeUrls.get(0); } - // synchronized to avoid close connector when transfer event + // synchronized to avoid close sink when transfer event @Override public synchronized void close() { super.close(); isClosed.set(true); - retryConnector.close(); + retrySink.close(); clearRetryEventsReferenceCount(); clearTransferBufferReferenceCount(); @@ -701,7 +700,7 @@ public synchronized void close() { } PipeConsensusSyncLagManager.getInstance(getConsensusGroupIdStr()) - .removeConsensusPipeConnector(new ConsensusPipeName(consensusPipeName)); + .removeConsensusPipeSink(new ConsensusPipeName(consensusPipeName)); MetricService.getInstance().removeMetricSet(this.pipeConsensusSinkMetrics); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusSyncSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusSyncSink.java index bb0dcf2dc0962..a356c17f378d1 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusSyncSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusSyncSink.java @@ -67,7 +67,7 @@ import java.util.List; import java.util.stream.Collectors; -/** This connector is used for PipeConsensus to transfer queued event. */ +/** This sink is used for PipeConsensus to transfer queued event. */ @TreeModel @TableModel public class PipeConsensusSyncSink extends IoTDBSink { @@ -90,7 +90,7 @@ public PipeConsensusSyncSink( final int consensusGroupId, final int thisDataNodeId, final PipeConsensusSinkMetrics pipeConsensusSinkMetrics) { - // In PipeConsensus, one pipeConsensusTask corresponds to a pipeConsensusConnector. Thus, + // In PipeConsensus, one pipeConsensusTask corresponds to a pipeConsensusSink. Thus, // `peers` here actually is a singletonList that contains one peer's TEndPoint. But here we // retain the implementation of list to cope with possible future expansion this.peers = peers; @@ -133,7 +133,7 @@ public void heartbeat() throws Exception { public void transfer(final TabletInsertionEvent tabletInsertionEvent) throws Exception { // Note: here we don't need to do type judgment here, because PipeConsensus uses // PIPE_CONSENSUS_PROCESSOR and will not change the event type like - // org.apache.iotdb.db.pipe.connector.protocol.thrift.sync.IoTDBDataRegionSyncConnector + // org.apache.iotdb.db.pipe.sink.protocol.thrift.sync.IoTDBDataRegionSyncSink try { if (isTabletBatchModeEnabled) { if (tabletBatchBuilder.onEvent(tabletInsertionEvent)) { @@ -158,7 +158,7 @@ public void transfer(final TabletInsertionEvent tabletInsertionEvent) throws Exc public void transfer(final TsFileInsertionEvent tsFileInsertionEvent) throws Exception { // Note: here we don't need to do type judgment here, because PipeConsensus uses DO_NOTHING // processor and will not change the event type like - // org.apache.iotdb.db.pipe.connector.protocol.thrift.sync.IoTDBDataRegionSyncConnector + // org.apache.iotdb.db.pipe.sink.protocol.thrift.sync.IoTDBDataRegionSyncSink try { final long startTime = System.nanoTime(); // In order to commit in order @@ -446,7 +446,7 @@ protected void transferFilePieces( final TCommitId tCommitId, final TConsensusGroupId tConsensusGroupId) throws PipeException, IOException { - final int readFileBufferSize = PipeConfig.getInstance().getPipeConnectorReadFileBufferSize(); + final int readFileBufferSize = PipeConfig.getInstance().getPipeSinkReadFileBufferSize(); final byte[] readBuffer = new byte[readFileBufferSize]; long position = 0; try (final RandomAccessFile reader = new RandomAccessFile(file, "r")) { @@ -490,7 +490,7 @@ protected void transferFilePieces( position += readLength; final TSStatus status = resp.getStatus(); - // This case only happens when the connection is broken, and the connector is reconnected + // This case only happens when the connection is broken, and the sink is reconnected // to the receiver, then the receiver will redirect the file position to the last position if (status.getCode() == TSStatusCode.PIPE_CONSENSUS_TRANSFER_FILE_OFFSET_RESET.getStatusCode()) { @@ -513,12 +513,12 @@ protected void transferFilePieces( } private TEndPoint getFollowerUrl() { - // In current pipeConsensus design, one connector corresponds to one follower, so the peers is + // In current pipeConsensus design, one sink corresponds to one follower, so the peers is // actually a singleton list return peers.get(0); } - // synchronized to avoid close connector when transfer event + // synchronized to avoid close sink when transfer event @Override public synchronized void close() { super.close(); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusDeleteEventHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusDeleteEventHandler.java index 6f4e93ba445bd..e27334caaef2e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusDeleteEventHandler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusDeleteEventHandler.java @@ -44,7 +44,7 @@ public class PipeConsensusDeleteEventHandler private final TPipeConsensusTransferReq req; - private final PipeConsensusAsyncSink connector; + private final PipeConsensusAsyncSink sink; private final PipeConsensusSinkMetrics metric; @@ -53,11 +53,11 @@ public class PipeConsensusDeleteEventHandler public PipeConsensusDeleteEventHandler( PipeDeleteDataNodeEvent event, TPipeConsensusTransferReq req, - PipeConsensusAsyncSink connector, + PipeConsensusAsyncSink sink, PipeConsensusSinkMetrics metric) { this.event = event; this.req = req; - this.connector = connector; + this.sink = sink; this.metric = metric; this.createTime = System.nanoTime(); } @@ -79,7 +79,7 @@ public void onComplete(TPipeConsensusTransferResp response) { // Only handle the failed statuses to avoid string format performance overhead if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode() && status.getCode() != TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) { - connector.statusHandler().handle(status, status.getMessage(), event.toString()); + sink.statusHandler().handle(status, status.getMessage(), event.toString()); } event.decreaseReferenceCount(PipeConsensusDeleteEventHandler.class.getName(), true); @@ -90,10 +90,10 @@ public void onComplete(TPipeConsensusTransferResp response) { } // if code flow reach here, meaning the file will not be resent and will be ignored. // events that don't need to be retried will be removed from the buffer - connector.removeEventFromBuffer(event); + sink.removeEventFromBuffer(event); long duration = System.nanoTime() - createTime; - metric.recordConnectorWalTransferTimer(duration); + metric.recordSinkWalTransferTimer(duration); } catch (Exception e) { onError(e); } @@ -117,7 +117,7 @@ public void onError(Exception e) { } } // IoTV2 ensures that only use PipeInsertionEvent, which is definitely EnrichedEvent. - connector.addFailureEventToRetryQueue(event); + sink.addFailureEventToRetryQueue(event); metric.recordRetryCounter(); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletBatchEventHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletBatchEventHandler.java index 1acc92841b05a..abf44f5d02243 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletBatchEventHandler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletBatchEventHandler.java @@ -48,12 +48,12 @@ public class PipeConsensusTabletBatchEventHandler private final List requestCommitIds; private final List events; private final TPipeConsensusBatchTransferReq req; - private final PipeConsensusAsyncSink connector; + private final PipeConsensusAsyncSink sink; private final PipeConsensusSinkMetrics pipeConsensusSinkMetrics; public PipeConsensusTabletBatchEventHandler( final PipeConsensusAsyncBatchReqBuilder batchBuilder, - final PipeConsensusAsyncSink connector, + final PipeConsensusAsyncSink sink, final PipeConsensusSinkMetrics pipeConsensusSinkMetrics) throws IOException { // Deep copy to keep Ids' and events' reference @@ -62,7 +62,7 @@ public PipeConsensusTabletBatchEventHandler( req = batchBuilder.toTPipeConsensusBatchTransferReq(); this.pipeConsensusSinkMetrics = pipeConsensusSinkMetrics; - this.connector = connector; + this.sink = sink; } public void transfer(final AsyncPipeConsensusServiceClient client) throws TException { @@ -91,16 +91,14 @@ public void onComplete(final TPipeConsensusBatchTransferResp response) { .forEach( tsStatus -> { pipeConsensusSinkMetrics.recordRetryCounter(); - connector - .statusHandler() - .handle(tsStatus, tsStatus.getMessage(), events.toString()); + sink.statusHandler().handle(tsStatus, tsStatus.getMessage(), events.toString()); }); // if any events failed, we will resend it all. - connector.addFailureEventsToRetryQueue(events); + sink.addFailureEventsToRetryQueue(events); } // if all events success, remove them from transferBuffer else { - events.forEach(event -> connector.removeEventFromBuffer((EnrichedEvent) event)); + events.forEach(sink::removeEventFromBuffer); } for (final Event event : events) { @@ -128,6 +126,6 @@ public void onError(final Exception exception) { .collect(Collectors.toSet()), exception); - connector.addFailureEventsToRetryQueue(events); + sink.addFailureEventsToRetryQueue(events); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletInsertNodeEventHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletInsertNodeEventHandler.java index 0b701fc264bb8..a4aa8eb5461a2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletInsertNodeEventHandler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletInsertNodeEventHandler.java @@ -34,9 +34,9 @@ public class PipeConsensusTabletInsertNodeEventHandler public PipeConsensusTabletInsertNodeEventHandler( PipeInsertNodeTabletInsertionEvent event, TPipeConsensusTransferReq req, - PipeConsensusAsyncSink connector, + PipeConsensusAsyncSink sink, PipeConsensusSinkMetrics metric) { - super(event, req, connector, metric); + super(event, req, sink, metric); } @Override diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletInsertionEventHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletInsertionEventHandler.java index 643b9728a344b..755c4064068e7 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletInsertionEventHandler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletInsertionEventHandler.java @@ -46,7 +46,7 @@ public abstract class PipeConsensusTabletInsertionEventHandler PipeConfig.getInstance().getPipeAsyncConnectorMaxRetryExecutionTimeMsPerCall()) { + > PipeConfig.getInstance().getPipeAsyncSinkMaxRetryExecutionTimeMsPerCall()) { if (retryEventQueueEventCounter.getTabletInsertionEventCount() < PipeConfig.getInstance().getPipeAsyncSinkForcedRetryTabletEventQueueSize() && retryEventQueueEventCounter.getTsFileInsertionEventCount() @@ -754,7 +752,7 @@ public synchronized void discardEventsOfPipe(final String pipeNameToDrop, final } @Override - // synchronized to avoid close connector when transfer event + // synchronized to avoid close sink when transfer event public synchronized void close() { isClosed.set(true); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletBatchEventHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletBatchEventHandler.java index 89baaa0279443..2a9650b47e87f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletBatchEventHandler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletBatchEventHandler.java @@ -54,22 +54,22 @@ public class PipeTransferTabletBatchEventHandler extends PipeTransferTrackableHa private final double reqCompressionRatio; public PipeTransferTabletBatchEventHandler( - final PipeTabletEventPlainBatch batch, final IoTDBDataRegionAsyncSink connector) + final PipeTabletEventPlainBatch batch, final IoTDBDataRegionAsyncSink sink) throws IOException { - super(connector); + super(sink); // Deep copy to keep events' reference events = batch.deepCopyEvents(); pipeName2BytesAccumulated = batch.deepCopyPipeName2BytesAccumulated(); final TPipeTransferReq uncompressedReq = batch.toTPipeTransferReq(); - req = connector.compressIfNeeded(uncompressedReq); + req = sink.compressIfNeeded(uncompressedReq); reqCompressionRatio = (double) req.getBody().length / uncompressedReq.getBody().length; } public void transfer(final AsyncPipeDataTransferServiceClient client) throws TException { for (final Map.Entry, Long> entry : pipeName2BytesAccumulated.entrySet()) { - connector.rateLimitIfNeeded( + sink.rateLimitIfNeeded( entry.getKey().getLeft(), entry.getKey().getRight(), client.getEndPoint(), @@ -92,13 +92,11 @@ protected boolean onCompleteInternal(final TPipeTransferResp response) { // Only handle the failed statuses to avoid string format performance overhead if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode() && status.getCode() != TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) { - connector - .statusHandler() - .handle(status, response.getStatus().getMessage(), events.toString()); + sink.statusHandler().handle(status, response.getStatus().getMessage(), events.toString()); } for (final Pair redirectPair : LeaderCacheUtils.parseRecommendedRedirections(status)) { - connector.updateLeaderCache(redirectPair.getLeft(), redirectPair.getRight()); + sink.updateLeaderCache(redirectPair.getLeft(), redirectPair.getRight()); } events.forEach( @@ -123,7 +121,7 @@ protected void onErrorInternal(final Exception exception) { events.size(), events.stream().map(EnrichedEvent::getPipeName).collect(Collectors.toSet())); } finally { - connector.addFailureEventsToRetryQueue(events); + sink.addFailureEventsToRetryQueue(events); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletInsertNodeEventHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletInsertNodeEventHandler.java index 70ba7f4cfc5b7..6d4adf42240ca 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletInsertNodeEventHandler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletInsertNodeEventHandler.java @@ -33,8 +33,8 @@ public class PipeTransferTabletInsertNodeEventHandler public PipeTransferTabletInsertNodeEventHandler( final PipeInsertNodeTabletInsertionEvent event, final TPipeTransferReq req, - final IoTDBDataRegionAsyncSink connector) { - super(event, req, connector); + final IoTDBDataRegionAsyncSink sink) { + super(event, req, sink); } @Override @@ -46,7 +46,7 @@ protected void doTransfer( @Override protected void updateLeaderCache(final TSStatus status) { - connector.updateLeaderCache( + sink.updateLeaderCache( ((PipeInsertNodeTabletInsertionEvent) event).getDeviceId(), status.getRedirectNode()); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletInsertionEventHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletInsertionEventHandler.java index df26325a5ca6d..b8ee1ff496cd9 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletInsertionEventHandler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletInsertionEventHandler.java @@ -44,15 +44,15 @@ public abstract class PipeTransferTabletInsertionEventHandler extends PipeTransf protected PipeTransferTabletInsertionEventHandler( final PipeInsertionEvent event, final TPipeTransferReq req, - final IoTDBDataRegionAsyncSink connector) { - super(connector); + final IoTDBDataRegionAsyncSink sink) { + super(sink); this.event = event; this.req = req; } public void transfer(final AsyncPipeDataTransferServiceClient client) throws TException { - connector.rateLimitIfNeeded( + sink.rateLimitIfNeeded( event.getPipeName(), event.getCreationTime(), client.getEndPoint(), req.getBody().length); tryTransfer(client, req); @@ -71,8 +71,7 @@ protected boolean onCompleteInternal(final TPipeTransferResp response) { // Only handle the failed statuses to avoid string format performance overhead if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode() && status.getCode() != TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) { - connector - .statusHandler() + sink.statusHandler() .handle(response.getStatus(), response.getStatus().getMessage(), event.toString()); } event.decreaseReferenceCount(PipeTransferTabletInsertionEventHandler.class.getName(), true); @@ -98,7 +97,7 @@ protected void onErrorInternal(final Exception exception) { event.getCommitterKey(), event.getCommitId()); } finally { - connector.addFailureEventToRetryQueue(event); + sink.addFailureEventToRetryQueue(event); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletRawEventHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletRawEventHandler.java index ff1daa05c2859..b64e446827aff 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletRawEventHandler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTabletRawEventHandler.java @@ -32,8 +32,8 @@ public class PipeTransferTabletRawEventHandler extends PipeTransferTabletInserti public PipeTransferTabletRawEventHandler( final PipeRawTabletInsertionEvent event, final TPipeTransferReq req, - final IoTDBDataRegionAsyncSink connector) { - super(event, req, connector); + final IoTDBDataRegionAsyncSink sink) { + super(event, req, sink); } @Override @@ -45,7 +45,7 @@ protected void doTransfer( @Override protected void updateLeaderCache(final TSStatus status) { - connector.updateLeaderCache( + sink.updateLeaderCache( ((PipeRawTabletInsertionEvent) event).getDeviceId(), status.getRedirectNode()); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTrackableHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTrackableHandler.java index d0d6d0542990b..96a8788844bfb 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTrackableHandler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTrackableHandler.java @@ -36,18 +36,18 @@ public abstract class PipeTransferTrackableHandler implements AsyncMethodCallback, AutoCloseable { private static final Logger LOGGER = LoggerFactory.getLogger(PipeTransferTsFileHandler.class); - protected final IoTDBDataRegionAsyncSink connector; + protected final IoTDBDataRegionAsyncSink sink; protected volatile AsyncPipeDataTransferServiceClient client; - public PipeTransferTrackableHandler(final IoTDBDataRegionAsyncSink connector) { - this.connector = connector; + public PipeTransferTrackableHandler(final IoTDBDataRegionAsyncSink sink) { + this.sink = sink; } @Override public void onComplete(final TPipeTransferResp response) { - if (connector.isClosed()) { + if (sink.isClosed()) { clearEventsReferenceCount(); - connector.eliminateHandler(this, true); + sink.eliminateHandler(this, true); return; } @@ -56,7 +56,7 @@ public void onComplete(final TPipeTransferResp response) { // completed // NOTE: We should not clear the reference count of events, as this would cause the // `org.apache.iotdb.pipe.it.dual.tablemodel.manual.basic.IoTDBPipeDataSinkIT#testSinkTsFileFormat3` test to fail. - connector.eliminateHandler(this, false); + sink.eliminateHandler(this, false); } } @@ -66,14 +66,14 @@ public void onError(final Exception exception) { ThriftClient.resolveException(exception, client); } - if (connector.isClosed()) { + if (sink.isClosed()) { clearEventsReferenceCount(); - connector.eliminateHandler(this, true); + sink.eliminateHandler(this, true); return; } onErrorInternal(exception); - connector.eliminateHandler(this, false); + sink.eliminateHandler(this, false); } /** @@ -81,8 +81,8 @@ public void onError(final Exception exception) { * * @param client the client used for data transfer * @param req the request containing transfer details - * @return {@code true} if the transfer was initiated successfully, {@code false} if the connector - * is closed + * @return {@code true} if the transfer was initiated successfully, {@code false} if the sink is + * closed * @throws TException if an error occurs during the transfer */ protected boolean tryTransfer( @@ -91,11 +91,11 @@ protected boolean tryTransfer( if (Objects.isNull(this.client)) { this.client = client; } - // track handler before checking if connector is closed - connector.trackHandler(this); - if (connector.isClosed()) { + // track handler before checking if sink is closed + sink.trackHandler(this); + if (sink.isClosed()) { clearEventsReferenceCount(); - connector.eliminateHandler(this, true); + sink.eliminateHandler(this, true); client.setShouldReturnSelf(true); try { client.returnSelf(); @@ -133,7 +133,7 @@ public void closeClient() { client.invalidateAll(); } catch (final Exception e) { LOGGER.warn( - "Failed to close or invalidate client when connector is closed. Client: {}, Exception: {}", + "Failed to close or invalidate client when sink is closed. Client: {}, Exception: {}", client, e.getMessage(), e); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTsFileHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTsFileHandler.java index 3cdb2abda1568..cd03d2eeb8cea 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTsFileHandler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/handler/PipeTransferTsFileHandler.java @@ -92,7 +92,7 @@ public class PipeTransferTsFileHandler extends PipeTransferTrackableHandler { private IoTDBDataNodeAsyncClientManager clientManager; public PipeTransferTsFileHandler( - final IoTDBDataRegionAsyncSink connector, + final IoTDBDataRegionAsyncSink sink, final Map, Double> pipeName2WeightMap, final List events, final AtomicInteger eventsReferenceCount, @@ -102,7 +102,7 @@ public PipeTransferTsFileHandler( final boolean transferMod, final String dataBaseName) throws InterruptedException { - super(connector); + super(sink); this.pipeName2WeightMap = pipeName2WeightMap; @@ -126,7 +126,7 @@ public PipeTransferTsFileHandler( readFileBufferSize = (int) Math.min( - PipeConfig.getInstance().getPipeConnectorReadFileBufferSize(), + PipeConfig.getInstance().getPipeSinkReadFileBufferSize(), transferMod ? Math.max(tsFile.length(), modFile.length()) : tsFile.length()); position = 0; @@ -146,7 +146,7 @@ public void transfer( memoryBlock = PipeDataNodeResourceManager.memory() .forceAllocateForTsFileWithRetry( - PipeConfig.getInstance().isPipeConnectorReadFileBufferMemoryControlEnabled() + PipeConfig.getInstance().isPipeSinkReadFileBufferMemoryControlEnabled() ? readFileBufferSize : 0); readBuffer = new byte[readFileBufferSize]; @@ -165,7 +165,7 @@ public void transfer( if (client == null) { LOGGER.warn( "Client has been returned to the pool. Current handler status is {}. Will not transfer {}.", - connector.isClosed() ? "CLOSED" : "NOT CLOSED", + sink.isClosed() ? "CLOSED" : "NOT CLOSED", tsFile); return; } @@ -174,7 +174,7 @@ public void transfer( client.setTimeoutDynamically(clientManager.getConnectionTimeout()); PipeResourceMetrics.getInstance().recordDiskIO(readFileBufferSize); - if (connector.isEnableSendTsFileLimit()) { + if (sink.isEnableSendTsFileLimit()) { TsFileSendRateLimiter.getInstance().acquire(readFileBufferSize); } final int readLength = reader.read(readBuffer); @@ -203,11 +203,11 @@ public void transfer( dataBaseName) : PipeTransferTsFileSealWithModReq.toTPipeTransferReq( tsFile.getName(), tsFile.length(), dataBaseName); - final TPipeTransferReq req = connector.compressIfNeeded(uncompressedReq); + final TPipeTransferReq req = sink.compressIfNeeded(uncompressedReq); pipeName2WeightMap.forEach( (pipePair, weight) -> - connector.rateLimitIfNeeded( + sink.rateLimitIfNeeded( pipePair.getLeft(), pipePair.getRight(), client.getEndPoint(), @@ -230,11 +230,11 @@ public void transfer( currentFile.getName(), position, payload) : PipeTransferTsFilePieceReq.toTPipeTransferReq( currentFile.getName(), position, payload); - final TPipeTransferReq req = connector.compressIfNeeded(uncompressedReq); + final TPipeTransferReq req = sink.compressIfNeeded(uncompressedReq); pipeName2WeightMap.forEach( (pipePair, weight) -> - connector.rateLimitIfNeeded( + sink.rateLimitIfNeeded( pipePair.getLeft(), pipePair.getRight(), client.getEndPoint(), @@ -252,7 +252,7 @@ public void onComplete(final TPipeTransferResp response) { try { super.onComplete(response); } finally { - if (connector.isClosed()) { + if (sink.isClosed()) { returnClientIfNecessary(); } } @@ -266,8 +266,7 @@ protected boolean onCompleteInternal(final TPipeTransferResp response) { // Only handle the failed statuses to avoid string format performance overhead if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode() && status.getCode() != TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) { - connector - .statusHandler() + sink.statusHandler() .handle( status, String.format( @@ -328,7 +327,7 @@ protected boolean onCompleteInternal(final TPipeTransferResp response) { final PipeTransferFilePieceResp resp = PipeTransferFilePieceResp.fromTPipeTransferResp(response); - // This case only happens when the connection is broken, and the connector is reconnected + // This case only happens when the connection is broken, and the sink is reconnected // to the receiver, then the receiver will redirect the file position to the last position final long code = resp.getStatus().getCode(); @@ -341,9 +340,7 @@ protected boolean onCompleteInternal(final TPipeTransferResp response) { // Only handle the failed statuses to avoid string format performance overhead if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode() && status.getCode() != TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) { - connector - .statusHandler() - .handle(status, response.getStatus().getMessage(), tsFile.getName()); + sink.statusHandler().handle(status, response.getStatus().getMessage(), tsFile.getName()); } } @@ -415,7 +412,7 @@ protected void onErrorInternal(final Exception exception) { returnClientIfNecessary(); } finally { if (eventsHadBeenAddedToRetryQueue.compareAndSet(false, true)) { - connector.addFailureEventsToRetryQueue(events); + sink.addFailureEventsToRetryQueue(events); } } } @@ -426,7 +423,7 @@ private void returnClientIfNecessary() { return; } - if (connector.isClosed()) { + if (sink.isClosed()) { closeClient(); } @@ -447,7 +444,7 @@ protected void doTransfer( if (client == null) { LOGGER.warn( "Client has been returned to the pool. Current handler status is {}. Will not transfer {}.", - connector.isClosed() ? "CLOSED" : "NOT CLOSED", + sink.isClosed() ? "CLOSED" : "NOT CLOSED", tsFile); return; } @@ -474,7 +471,7 @@ public void close() { * @param timeoutMs CAN NOT BE UNLIMITED, otherwise it may cause deadlock. */ private void waitForResourceEnough4Slicing(final long timeoutMs) throws InterruptedException { - if (!PipeConfig.getInstance().isPipeConnectorReadFileBufferMemoryControlEnabled()) { + if (!PipeConfig.getInstance().isPipeSinkReadFileBufferMemoryControlEnabled()) { return; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/sync/IoTDBDataRegionSyncSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/sync/IoTDBDataRegionSyncSink.java index 27ad636db3865..2284bc1517ccf 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/sync/IoTDBDataRegionSyncSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/sync/IoTDBDataRegionSyncSink.java @@ -133,7 +133,7 @@ public void transfer(final TabletInsertionEvent tabletInsertionEvent) throws Exc if (!(tabletInsertionEvent instanceof PipeInsertNodeTabletInsertionEvent) && !(tabletInsertionEvent instanceof PipeRawTabletInsertionEvent)) { LOGGER.warn( - "IoTDBThriftSyncConnector only support " + "IoTDBThriftSyncSink only support " + "PipeInsertNodeTabletInsertionEvent and PipeRawTabletInsertionEvent. " + "Ignore {}.", tabletInsertionEvent); @@ -165,7 +165,7 @@ public void transfer(final TsFileInsertionEvent tsFileInsertionEvent) throws Exc // PipeProcessor can change the type of tsFileInsertionEvent if (!(tsFileInsertionEvent instanceof PipeTsFileInsertionEvent)) { LOGGER.warn( - "IoTDBThriftSyncConnector only support PipeTsFileInsertionEvent. Ignore {}.", + "IoTDBThriftSyncSink only support PipeTsFileInsertionEvent. Ignore {}.", tsFileInsertionEvent); return; } @@ -200,8 +200,7 @@ public void transfer(final Event event) throws Exception { } if (!(event instanceof PipeHeartbeatEvent || event instanceof PipeTerminateEvent)) { - LOGGER.warn( - "IoTDBThriftSyncConnector does not support transferring generic event: {}.", event); + LOGGER.warn("IoTDBThriftSyncSink does not support transferring generic event: {}.", event); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/sync/IoTDBSchemaRegionSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/sync/IoTDBSchemaRegionSink.java index e1e1e7868d703..eb8a478284848 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/sync/IoTDBSchemaRegionSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/sync/IoTDBSchemaRegionSink.java @@ -57,13 +57,13 @@ public class IoTDBSchemaRegionSink extends IoTDBDataNodeSyncSink { @Override public void transfer(final TabletInsertionEvent tabletInsertionEvent) throws Exception { throw new UnsupportedOperationException( - "IoTDBSchemaRegionConnector can't transfer TabletInsertionEvent."); + "IoTDBSchemaRegionSink can't transfer TabletInsertionEvent."); } @Override public void transfer(final TsFileInsertionEvent tsFileInsertionEvent) throws Exception { throw new UnsupportedOperationException( - "IoTDBSchemaRegionConnector can't transfer TsFileInsertionEvent."); + "IoTDBSchemaRegionSink can't transfer TsFileInsertionEvent."); } @Override @@ -73,8 +73,7 @@ public void transfer(final Event event) throws Exception { } else if (event instanceof PipeSchemaRegionSnapshotEvent) { doTransferWrapper((PipeSchemaRegionSnapshotEvent) event); } else if (!(event instanceof PipeHeartbeatEvent)) { - LOGGER.warn( - "IoTDBSchemaRegionConnector does not support transferring generic event: {}.", event); + LOGGER.warn("IoTDBSchemaRegionSink does not support transferring generic event: {}.", event); } } @@ -236,7 +235,7 @@ private void doTransfer(final PipeSchemaRegionSnapshotEvent snapshotEvent) protected PipeTransferFilePieceReq getTransferSingleFilePieceReq( final String fileName, final long position, final byte[] payLoad) { throw new UnsupportedOperationException( - "The schema region connector does not support transferring single file piece req."); + "The schema region sink does not support transferring single file piece req."); } @Override diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/websocket/WebSocketSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/websocket/WebSocketSink.java index 4e593e673fd56..c50f3f2e21bf9 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/websocket/WebSocketSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/websocket/WebSocketSink.java @@ -46,7 +46,7 @@ public class WebSocketSink implements PipeConnector { private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketSink.class); private Integer port; - private WebSocketConnectorServer server; + private WebSocketSinkServer server; private String pipeName; @Override @@ -60,7 +60,7 @@ public void validate(PipeParameterValidator validator) throws Exception { PipeSinkConstant.SINK_WEBSOCKET_PORT_KEY), PipeSinkConstant.CONNECTOR_WEBSOCKET_PORT_DEFAULT_VALUE); - server = WebSocketConnectorServer.getOrCreateInstance(port); + server = WebSocketSinkServer.getOrCreateInstance(port); if (server.getPort() != port) { throw new PipeException( String.format( @@ -78,11 +78,11 @@ public void customize( @Override public void handshake() { - server = WebSocketConnectorServer.getOrCreateInstance(port); + server = WebSocketSinkServer.getOrCreateInstance(port); server.register(this); if (!server.isStarted()) { - synchronized (WebSocketConnectorServer.class) { + synchronized (WebSocketSinkServer.class) { if (!server.isStarted()) { server.start(); } @@ -100,7 +100,7 @@ public void transfer(final TabletInsertionEvent tabletInsertionEvent) { if (!(tabletInsertionEvent instanceof PipeInsertNodeTabletInsertionEvent) && !(tabletInsertionEvent instanceof PipeRawTabletInsertionEvent)) { LOGGER.warn( - "WebsocketConnector only support PipeInsertNodeTabletInsertionEvent and PipeRawTabletInsertionEvent. " + "WebsocketSink only support PipeInsertNodeTabletInsertionEvent and PipeRawTabletInsertionEvent. " + "Current event: {}.", tabletInsertionEvent); return; @@ -123,7 +123,7 @@ public void transfer(final TabletInsertionEvent tabletInsertionEvent) { if (!((EnrichedEvent) tabletInsertionEvent) .increaseReferenceCount(WebSocketSink.class.getName())) { LOGGER.warn( - "WebsocketConnector failed to increase the reference count of the event. Ignore it. Current event: {}.", + "WebsocketSink failed to increase the reference count of the event. Ignore it. Current event: {}.", tabletInsertionEvent); return; } @@ -135,7 +135,7 @@ public void transfer(final TabletInsertionEvent tabletInsertionEvent) { public void transfer(TsFileInsertionEvent tsFileInsertionEvent) throws Exception { if (!(tsFileInsertionEvent instanceof PipeTsFileInsertionEvent)) { LOGGER.warn( - "WebsocketConnector only support PipeTsFileInsertionEvent. Current event: {}.", + "WebsocketSink only support PipeTsFileInsertionEvent. Current event: {}.", tsFileInsertionEvent); return; } @@ -148,7 +148,7 @@ public void transfer(TsFileInsertionEvent tsFileInsertionEvent) throws Exception ((PipeTsFileInsertionEvent) tsFileInsertionEvent).skipReportOnCommit(); transfer(event); }, - "WebSocketConnector::transfer"); + "WebSocketSink::transfer"); } finally { tsFileInsertionEvent.close(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/websocket/WebSocketConnectorServer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/websocket/WebSocketSinkServer.java similarity index 84% rename from iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/websocket/WebSocketConnectorServer.java rename to iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/websocket/WebSocketSinkServer.java index 240de912f6fe3..91e68ad54daa9 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/websocket/WebSocketConnectorServer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/websocket/WebSocketSinkServer.java @@ -43,45 +43,44 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; -public class WebSocketConnectorServer extends WebSocketServer { +public class WebSocketSinkServer extends WebSocketServer { - private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketConnectorServer.class); + private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketSinkServer.class); private final AtomicLong eventIdGenerator = new AtomicLong(0); - // Map>> + // Map>> private final ConcurrentHashMap> eventsWaitingForTransfer = new ConcurrentHashMap<>(); - // Map>> + // Map>> private final ConcurrentHashMap> eventsWaitingForAck = new ConcurrentHashMap<>(); private final BidiMap router = new DualTreeBidiMap(null, Comparator.comparing(Object::hashCode)) {}; - private static final AtomicReference instance = new AtomicReference<>(); + private static final AtomicReference instance = new AtomicReference<>(); private static final AtomicBoolean isStarted = new AtomicBoolean(false); - private WebSocketConnectorServer(int port) { + private WebSocketSinkServer(int port) { super(new InetSocketAddress(port)); new TransferThread(this).start(); } - public static synchronized WebSocketConnectorServer getOrCreateInstance(int port) { + public static synchronized WebSocketSinkServer getOrCreateInstance(int port) { if (null == instance.get()) { - instance.set(new WebSocketConnectorServer(port)); + instance.set(new WebSocketSinkServer(port)); } return instance.get(); } - public synchronized void register(WebSocketSink connector) { + public synchronized void register(WebSocketSink sink) { eventsWaitingForTransfer.putIfAbsent( - connector.getPipeName(), - new PriorityBlockingQueue<>(11, Comparator.comparing(o -> o.eventId))); - eventsWaitingForAck.putIfAbsent(connector.getPipeName(), new ConcurrentHashMap<>()); + sink.getPipeName(), new PriorityBlockingQueue<>(11, Comparator.comparing(o -> o.eventId))); + eventsWaitingForAck.putIfAbsent(sink.getPipeName(), new ConcurrentHashMap<>()); } - public synchronized void unregister(WebSocketSink connector) { - final String pipeName = connector.getPipeName(); + public synchronized void unregister(WebSocketSink sink) { + final String pipeName = sink.getPipeName(); // close invoked in validation stage if (pipeName == null) { return; @@ -94,7 +93,7 @@ public synchronized void unregister(WebSocketSink connector) { (eventWrapper) -> { if (eventWrapper.event instanceof EnrichedEvent) { ((EnrichedEvent) eventWrapper.event) - .decreaseReferenceCount(WebSocketConnectorServer.class.getName(), false); + .decreaseReferenceCount(WebSocketSinkServer.class.getName(), false); } }); eventTransferQueue.clear(); @@ -111,7 +110,7 @@ public synchronized void unregister(WebSocketSink connector) { (eventId, eventWrapper) -> { if (eventWrapper.event instanceof EnrichedEvent) { ((EnrichedEvent) eventWrapper.event) - .decreaseReferenceCount(WebSocketConnectorServer.class.getName(), false); + .decreaseReferenceCount(WebSocketSinkServer.class.getName(), false); } }); } @@ -235,7 +234,7 @@ private void handleAck(WebSocket webSocket, long eventId) { return; } - eventWrapper.connector.commit( + eventWrapper.sink.commit( eventWrapper.event instanceof EnrichedEvent ? (EnrichedEvent) eventWrapper.event : null); } @@ -271,7 +270,7 @@ private synchronized void handleError(WebSocket webSocket, long eventId) { LOGGER.warn( "The tablet of commitId: {} can't be parsed by client, it will be retried later.", eventId); eventTransferQueue.put( - new EventWaitingForTransfer(eventId, eventWrapper.connector, eventWrapper.event)); + new EventWaitingForTransfer(eventId, eventWrapper.sink, eventWrapper.event)); } @Override @@ -291,15 +290,14 @@ public void onError(WebSocket webSocket, Exception e) { } } - public void addEvent(Event event, WebSocketSink connector) { + public void addEvent(Event event, WebSocketSink sink) { final PriorityBlockingQueue queue = - eventsWaitingForTransfer.get(connector.getPipeName()); + eventsWaitingForTransfer.get(sink.getPipeName()); if (queue == null) { - LOGGER.warn("The pipe {} was dropped so the event {} will be dropped.", connector, event); + LOGGER.warn("The pipe {} was dropped so the event {} will be dropped.", sink, event); if (event instanceof EnrichedEvent) { - ((EnrichedEvent) event) - .decreaseReferenceCount(WebSocketConnectorServer.class.getName(), false); + ((EnrichedEvent) event).decreaseReferenceCount(WebSocketSinkServer.class.getName(), false); } return; } @@ -315,20 +313,19 @@ public void addEvent(Event event, WebSocketSink connector) { } } - queue.put( - new EventWaitingForTransfer(eventIdGenerator.incrementAndGet(), connector, event)); + queue.put(new EventWaitingForTransfer(eventIdGenerator.incrementAndGet(), sink, event)); return; } } - queue.put(new EventWaitingForTransfer(eventIdGenerator.incrementAndGet(), connector, event)); + queue.put(new EventWaitingForTransfer(eventIdGenerator.incrementAndGet(), sink, event)); } private class TransferThread extends Thread { - private final WebSocketConnectorServer server; + private final WebSocketSinkServer server; - public TransferThread(WebSocketConnectorServer server) { + public TransferThread(WebSocketSinkServer server) { this.server = server; } @@ -363,7 +360,7 @@ public void run() { private void transfer(String pipeName, EventWaitingForTransfer element) { final Long eventId = element.eventId; final Event event = element.event; - final WebSocketSink connector = element.connector; + final WebSocketSink sink = element.sink; try { ByteBuffer tabletBuffer; @@ -371,12 +368,12 @@ private void transfer(String pipeName, EventWaitingForTransfer element) { tabletBuffer = ((PipeRawTabletInsertionEvent) event).convertToTablet().serialize(); } else { throw new NotImplementedException( - "IoTDBCDCConnector only support " + "IoTDBCDCSink only support " + "PipeInsertNodeTabletInsertionEvent and PipeRawTabletInsertionEvent."); } if (tabletBuffer == null) { - connector.commit((EnrichedEvent) event); + sink.commit((EnrichedEvent) event); return; } @@ -394,7 +391,7 @@ private void transfer(String pipeName, EventWaitingForTransfer element) { "The pipe {} was dropped so the event ack {} will be ignored.", pipeName, eventId); return; } - eventId2EventMap.put(eventId, new EventWaitingForAck(connector, event)); + eventId2EventMap.put(eventId, new EventWaitingForAck(sink, event)); } catch (Exception e) { synchronized (server) { final PriorityBlockingQueue queue = @@ -404,14 +401,14 @@ private void transfer(String pipeName, EventWaitingForTransfer element) { "The pipe {} was dropped so the event {} will be dropped.", pipeName, eventId); if (event instanceof EnrichedEvent) { ((EnrichedEvent) event) - .decreaseReferenceCount(WebSocketConnectorServer.class.getName(), false); + .decreaseReferenceCount(WebSocketSinkServer.class.getName(), false); } return; } LOGGER.warn( "The event {} can't be transferred to client, it will be retried later.", eventId, e); - queue.put(new EventWaitingForTransfer(eventId, connector, event)); + queue.put(new EventWaitingForTransfer(eventId, sink, event)); } } } @@ -434,23 +431,23 @@ private boolean sleepIfNecessary() { private static class EventWaitingForTransfer { private final Long eventId; - private final WebSocketSink connector; + private final WebSocketSink sink; private final Event event; - public EventWaitingForTransfer(Long eventId, WebSocketSink connector, Event event) { + public EventWaitingForTransfer(Long eventId, WebSocketSink sink, Event event) { this.eventId = eventId; - this.connector = connector; + this.sink = sink; this.event = event; } } private static class EventWaitingForAck { - private final WebSocketSink connector; + private final WebSocketSink sink; private final Event event; - public EventWaitingForAck(WebSocketSink connector, Event event) { - this.connector = connector; + public EventWaitingForAck(WebSocketSink sink, Event event) { + this.sink = sink; this.event = event; } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java index 225616e88fa93..ec95cf78b3eea 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java @@ -173,14 +173,14 @@ public void customize( treeSession.setClientVersion(IoTDBConstant.ClientVersion.V_1_0); treeSession.setZoneId(ZoneId.systemDefault()); - final String connectorSkipIfValue = + final String sinkSkipIfValue = parameters .getStringOrDefault( Arrays.asList(CONNECTOR_SKIP_IF_KEY, SINK_SKIP_IF_KEY), WRITE_BACK_CONNECTOR_SKIP_IF_DEFAULT_VALUE) .trim(); final Set skipIfOptionSet = - Arrays.stream(connectorSkipIfValue.split(",")) + Arrays.stream(sinkSkipIfValue.split(",")) .map(String::trim) .filter(s -> !s.isEmpty()) .map(String::toLowerCase) @@ -213,7 +213,7 @@ public void transfer(final TabletInsertionEvent tabletInsertionEvent) throws Exc if (!(tabletInsertionEvent instanceof PipeInsertNodeTabletInsertionEvent) && !(tabletInsertionEvent instanceof PipeRawTabletInsertionEvent)) { LOGGER.warn( - "WriteBackConnector only support " + "WriteBackSink only support " + "PipeInsertNodeTabletInsertionEvent and PipeRawTabletInsertionEvent. " + "Ignore {}.", tabletInsertionEvent); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java index 4e69b47cc8df2..b78d370eee784 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java @@ -69,7 +69,6 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_SNAPSHOT_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STREAMING_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STREAMING_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STRICT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_KEY; @@ -79,16 +78,9 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_PREFIX_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_BATCH_MODE_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_FILE_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_FORCED_LOG_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_HYBRID_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_LOG_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_STREAM_MODE_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_TABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_TABLE_NAME_KEY; @@ -103,6 +95,7 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_SNAPSHOT_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STREAMING_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STREAMING_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STRICT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODS_ENABLE_KEY; @@ -110,9 +103,16 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATH_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATTERN_FORMAT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATTERN_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_BATCH_MODE_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_FILE_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_FORCED_LOG_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_HYBRID_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_LOG_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_STREAM_MODE_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_TABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_TABLE_NAME_KEY; @@ -173,7 +173,7 @@ public void validate(final PipeParameterValidator validator) throws Exception { Arrays.asList( PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY, PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_KEY), - PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE); + PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE); final boolean isTreeModelDataAllowedToBeCaptured = isDoubleLiving || isCaptureTree; final boolean isTableModelDataAllowedToBeCaptured = isDoubleLiving || isCaptureTable; if (!isTreeModelDataAllowedToBeCaptured @@ -257,14 +257,14 @@ public void validate(final PipeParameterValidator validator) throws Exception { .getParameters() .getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE)); + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)); // Validate source.realtime.mode if (validator .getParameters() .getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE) + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE) || validator .getParameters() .hasAnyAttributes( @@ -277,12 +277,12 @@ public void validate(final PipeParameterValidator validator) throws Exception { ? EXTRACTOR_REALTIME_MODE_KEY : SOURCE_REALTIME_MODE_KEY, true, - EXTRACTOR_REALTIME_MODE_FILE_VALUE, - EXTRACTOR_REALTIME_MODE_HYBRID_VALUE, - EXTRACTOR_REALTIME_MODE_LOG_VALUE, - EXTRACTOR_REALTIME_MODE_FORCED_LOG_VALUE, - EXTRACTOR_REALTIME_MODE_STREAM_MODE_VALUE, - EXTRACTOR_REALTIME_MODE_BATCH_MODE_VALUE); + SOURCE_REALTIME_MODE_FILE_VALUE, + SOURCE_REALTIME_MODE_HYBRID_VALUE, + SOURCE_REALTIME_MODE_LOG_VALUE, + SOURCE_REALTIME_MODE_FORCED_LOG_VALUE, + SOURCE_REALTIME_MODE_STREAM_MODE_VALUE, + SOURCE_REALTIME_MODE_BATCH_MODE_VALUE); } checkInvalidParameters(validator); @@ -388,7 +388,7 @@ private void checkInvalidParameters(final PipeParameterValidator validator) { // Check if specifying mode.snapshot or mode.streaming when disable realtime source if (!parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE)) { + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { if (parameters.hasAnyAttributes(EXTRACTOR_REALTIME_MODE_KEY, SOURCE_REALTIME_MODE_KEY)) { LOGGER.warn( "When '{}' ('{}') is set to false, specifying {} and {} is invalid.", @@ -431,7 +431,7 @@ private void constructRealtimeExtractor(final PipeParameters parameters) { // Use heartbeat only source if disable realtime source if (!parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE)) { + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { realtimeExtractor = new PipeRealtimeDataRegionHeartbeatSource(); LOGGER.info( "Pipe: '{}' ('{}') is set to false, use heartbeat realtime source.", @@ -464,7 +464,7 @@ private void constructRealtimeExtractor(final PipeParameters parameters) { final boolean isStreamingMode = parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_MODE_STREAMING_KEY, SOURCE_MODE_STREAMING_KEY), - EXTRACTOR_MODE_STREAMING_DEFAULT_VALUE); + SOURCE_MODE_STREAMING_DEFAULT_VALUE); if (isStreamingMode) { realtimeExtractor = new PipeRealtimeDataRegionHybridSource(); } else { @@ -474,16 +474,16 @@ private void constructRealtimeExtractor(final PipeParameters parameters) { } switch (parameters.getStringByKeys(EXTRACTOR_REALTIME_MODE_KEY, SOURCE_REALTIME_MODE_KEY)) { - case EXTRACTOR_REALTIME_MODE_FILE_VALUE: - case EXTRACTOR_REALTIME_MODE_BATCH_MODE_VALUE: + case SOURCE_REALTIME_MODE_FILE_VALUE: + case SOURCE_REALTIME_MODE_BATCH_MODE_VALUE: realtimeExtractor = new PipeRealtimeDataRegionTsFileSource(); break; - case EXTRACTOR_REALTIME_MODE_HYBRID_VALUE: - case EXTRACTOR_REALTIME_MODE_LOG_VALUE: - case EXTRACTOR_REALTIME_MODE_STREAM_MODE_VALUE: + case SOURCE_REALTIME_MODE_HYBRID_VALUE: + case SOURCE_REALTIME_MODE_LOG_VALUE: + case SOURCE_REALTIME_MODE_STREAM_MODE_VALUE: realtimeExtractor = new PipeRealtimeDataRegionHybridSource(); break; - case EXTRACTOR_REALTIME_MODE_FORCED_LOG_VALUE: + case SOURCE_REALTIME_MODE_FORCED_LOG_VALUE: realtimeExtractor = new PipeRealtimeDataRegionLogSource(); break; default: diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java index 3112c3220fe8c..17fff27da39c2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java @@ -92,7 +92,6 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_LOOSE_RANGE_PATH_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_LOOSE_RANGE_TIME_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_START_TIME_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STRICT_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STRICT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_DEFAULT_VALUE; @@ -104,6 +103,7 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_END_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_LOOSE_RANGE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_START_TIME_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STRICT_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STRICT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODS_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODS_KEY; @@ -177,7 +177,7 @@ public void validate(final PipeParameterValidator validator) { final boolean isStrictMode = parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_MODE_STRICT_KEY, SOURCE_MODE_STRICT_KEY), - EXTRACTOR_MODE_STRICT_DEFAULT_VALUE); + SOURCE_MODE_STRICT_DEFAULT_VALUE); sloppyTimeRange = !isStrictMode; sloppyPattern = !isStrictMode; } else { @@ -378,7 +378,7 @@ public void customize( Arrays.asList( PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY, PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_KEY), - PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE); + PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE); if (isDoubleLiving) { isForwardingPipeRequests = false; } else { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionHybridSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionHybridSource.java index 7cf476a66cbe4..0168e86e0dd28 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionHybridSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionHybridSource.java @@ -61,7 +61,7 @@ protected void doExtract(final PipeRealtimeEvent event) { } else { throw new UnsupportedOperationException( String.format( - "Unsupported event type %s for hybrid realtime extractor %s", + "Unsupported event type %s for hybrid realtime source %s", eventToExtract.getClass(), this)); } } @@ -134,7 +134,7 @@ private void extractTabletInsertion(final PipeRealtimeEvent event) { default: throw new UnsupportedOperationException( String.format( - "Unsupported state %s for hybrid realtime extractor %s", + "Unsupported state %s for hybrid realtime source %s", state, PipeRealtimeDataRegionHybridSource.class.getName())); } } @@ -194,7 +194,7 @@ private void extractTsFileInsertion(final PipeRealtimeEvent event) { default: throw new UnsupportedOperationException( String.format( - "Unsupported state %s for hybrid realtime extractor %s", + "Unsupported state %s for hybrid realtime source %s", state, PipeRealtimeDataRegionHybridSource.class.getName())); } } @@ -247,7 +247,7 @@ public Event supply() { } else { throw new UnsupportedOperationException( String.format( - "Unsupported event type %s for hybrid realtime extractor %s to supply.", + "Unsupported event type %s for hybrid realtime source %s to supply.", eventToSupply.getClass(), this)); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java index cd00e2975a0aa..4c40bff90b330 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java @@ -72,16 +72,16 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_ALL_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_PATH_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_TIME_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_END_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODS_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODS_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_ALL_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_PATH_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_TIME_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.source.IoTDBSource.getSkipIfNoPrivileges; @@ -178,10 +178,9 @@ public void validate(final PipeParameterValidator validator) throws Exception { parameters .getStringOrDefault( Arrays.asList(EXTRACTOR_REALTIME_LOOSE_RANGE_KEY, SOURCE_REALTIME_LOOSE_RANGE_KEY), - EXTRACTOR_REALTIME_LOOSE_RANGE_DEFAULT_VALUE) + SOURCE_REALTIME_LOOSE_RANGE_DEFAULT_VALUE) .trim(); - if (EXTRACTOR_REALTIME_LOOSE_RANGE_ALL_VALUE.equalsIgnoreCase( - extractorRealtimeLooseRangeValue)) { + if (SOURCE_REALTIME_LOOSE_RANGE_ALL_VALUE.equalsIgnoreCase(extractorRealtimeLooseRangeValue)) { sloppyTimeRange = true; sloppyPattern = true; } else { @@ -191,8 +190,8 @@ public void validate(final PipeParameterValidator validator) throws Exception { .filter(s -> !s.isEmpty()) .map(String::toLowerCase) .collect(Collectors.toSet()); - sloppyTimeRange = sloppyOptionSet.remove(EXTRACTOR_REALTIME_LOOSE_RANGE_TIME_VALUE); - sloppyPattern = sloppyOptionSet.remove(EXTRACTOR_REALTIME_LOOSE_RANGE_PATH_VALUE); + sloppyTimeRange = sloppyOptionSet.remove(SOURCE_REALTIME_LOOSE_RANGE_TIME_VALUE); + sloppyPattern = sloppyOptionSet.remove(SOURCE_REALTIME_LOOSE_RANGE_PATH_VALUE); if (!sloppyOptionSet.isEmpty()) { throw new PipeParameterNotValidException( String.format( @@ -255,7 +254,7 @@ public void customize( Arrays.asList( PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY, PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_KEY), - PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE); + PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE); if (isDoubleLiving) { isForwardingPipeRequests = false; } else { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/assigner/PipeDataRegionAssigner.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/assigner/PipeDataRegionAssigner.java index 8ea973fbf0a3a..00855b935e8a8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/assigner/PipeDataRegionAssigner.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/assigner/PipeDataRegionAssigner.java @@ -58,12 +58,12 @@ public class PipeDataRegionAssigner implements Closeable { private static final Logger LOGGER = LoggerFactory.getLogger(PipeDataRegionAssigner.class); /** - * The {@link PipeDataRegionMatcher} is used to match the event with the extractor based on the + * The {@link PipeDataRegionMatcher} is used to match the event with the source based on the * pattern. */ private final PipeDataRegionMatcher matcher; - /** The {@link DisruptorQueue} is used to assign the event to the extractor. */ + /** The {@link DisruptorQueue} is used to assign the event to the source. */ private final DisruptorQueue disruptor; private final String dataRegionId; @@ -78,7 +78,7 @@ public String getDataRegionId() { public PipeDataRegionAssigner(final String dataRegionId) { this.matcher = new CachedSchemaPatternMatcher(); - this.disruptor = new DisruptorQueue(this::assignToExtractor, this::onAssignedHook); + this.disruptor = new DisruptorQueue(this::assignToSource, this::onAssignedHook); this.dataRegionId = dataRegionId; PipeAssignerMetrics.getInstance().register(this); @@ -128,7 +128,7 @@ private void onAssignedHook(final PipeRealtimeEvent realtimeEvent) { eventCounter.decreaseEventCount(innerEvent); } - private void assignToExtractor( + private void assignToSource( final PipeRealtimeEvent event, final long sequence, final boolean endOfBatch) { if (disruptor.isClosed()) { return; @@ -140,17 +140,15 @@ private void assignToExtractor( matchedAndUnmatched .getLeft() .forEach( - extractor -> { + source -> { if (disruptor.isClosed()) { return; } - if (event.getEvent().isGeneratedByPipe() && !extractor.isForwardingPipeRequests()) { + if (event.getEvent().isGeneratedByPipe() && !source.isForwardingPipeRequests()) { final ProgressReportEvent reportEvent = new ProgressReportEvent( - extractor.getPipeName(), - extractor.getCreationTime(), - extractor.getPipeTaskMeta()); + source.getPipeName(), source.getCreationTime(), source.getPipeTaskMeta()); reportEvent.bindProgressIndex(event.getProgressIndex()); if (!reportEvent.increaseReferenceCount(PipeDataRegionAssigner.class.getName())) { LOGGER.warn( @@ -158,33 +156,33 @@ private void assignToExtractor( reportEvent); return; } - extractor.extract(PipeRealtimeEventFactory.createRealtimeEvent(reportEvent)); + source.extract(PipeRealtimeEventFactory.createRealtimeEvent(reportEvent)); return; } final PipeRealtimeEvent copiedEvent = event.shallowCopySelfAndBindPipeTaskMetaForProgressReport( - extractor.getPipeName(), - extractor.getCreationTime(), - extractor.getPipeTaskMeta(), - extractor.getTreePattern(), - extractor.getTablePattern(), - String.valueOf(extractor.getUserId()), - extractor.getUserName(), - extractor.getCliHostname(), - extractor.isSkipIfNoPrivileges(), - extractor.getRealtimeDataExtractionStartTime(), - extractor.getRealtimeDataExtractionEndTime()); + source.getPipeName(), + source.getCreationTime(), + source.getPipeTaskMeta(), + source.getTreePattern(), + source.getTablePattern(), + String.valueOf(source.getUserId()), + source.getUserName(), + source.getCliHostname(), + source.isSkipIfNoPrivileges(), + source.getRealtimeDataExtractionStartTime(), + source.getRealtimeDataExtractionEndTime()); final EnrichedEvent innerEvent = copiedEvent.getEvent(); // if using IoTV2, assign a replicateIndex for this realtime event if (DataRegionConsensusImpl.getInstance() instanceof PipeConsensus && PipeConsensusProcessor.isShouldReplicate(innerEvent)) { innerEvent.setReplicateIndexForIoTV2( ReplicateProgressDataNodeManager.assignReplicateIndexForIoTV2( - extractor.getPipeName())); + source.getPipeName())); LOGGER.debug( "[{}]Set {} for realtime event {}", - extractor.getPipeName(), + source.getPipeName(), innerEvent.getReplicateIndexForIoTV2(), innerEvent); } @@ -192,15 +190,14 @@ private void assignToExtractor( if (innerEvent instanceof PipeTsFileInsertionEvent) { final PipeTsFileInsertionEvent tsFileInsertionEvent = (PipeTsFileInsertionEvent) innerEvent; - tsFileInsertionEvent.disableMod4NonTransferPipes( - extractor.isShouldTransferModFile()); + tsFileInsertionEvent.disableMod4NonTransferPipes(source.isShouldTransferModFile()); } if (innerEvent instanceof PipeDeleteDataNodeEvent) { final PipeDeleteDataNodeEvent deleteDataNodeEvent = (PipeDeleteDataNodeEvent) innerEvent; final DeletionResourceManager manager = - DeletionResourceManager.getInstance(extractor.getDataRegionId()); + DeletionResourceManager.getInstance(source.getDataRegionId()); // increase deletion resource's reference and bind real deleteEvent if (Objects.nonNull(manager) && DeletionResource.isDeleteNodeGeneratedInLocalByIoTV2( @@ -217,13 +214,13 @@ private void assignToExtractor( copiedEvent); return; } - extractor.extract(copiedEvent); + source.extract(copiedEvent); }); matchedAndUnmatched .getRight() .forEach( - extractor -> { + source -> { if (disruptor.isClosed()) { return; } @@ -233,9 +230,7 @@ private void assignToExtractor( || innerEvent instanceof TsFileInsertionEvent) { final ProgressReportEvent reportEvent = new ProgressReportEvent( - extractor.getPipeName(), - extractor.getCreationTime(), - extractor.getPipeTaskMeta()); + source.getPipeName(), source.getCreationTime(), source.getPipeTaskMeta()); reportEvent.bindProgressIndex(event.getProgressIndex()); if (!reportEvent.increaseReferenceCount(PipeDataRegionAssigner.class.getName())) { LOGGER.warn( @@ -243,24 +238,24 @@ private void assignToExtractor( reportEvent); return; } - extractor.extract(PipeRealtimeEventFactory.createRealtimeEvent(reportEvent)); + source.extract(PipeRealtimeEventFactory.createRealtimeEvent(reportEvent)); } }); } - public void startAssignTo(final PipeRealtimeDataRegionSource extractor) { - matcher.register(extractor); + public void startAssignTo(final PipeRealtimeDataRegionSource source) { + matcher.register(source); } - public void stopAssignTo(final PipeRealtimeDataRegionSource extractor) { - matcher.deregister(extractor); + public void stopAssignTo(final PipeRealtimeDataRegionSource source) { + matcher.deregister(source); } public void invalidateCache() { matcher.invalidateCache(); } - public boolean notMoreExtractorNeededToBeAssigned() { + public boolean notMoreSourceNeededToBeAssigned() { return matcher.getRegisterCount() == 0; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/listener/PipeInsertionDataNodeListener.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/listener/PipeInsertionDataNodeListener.java index 8c49dd0a3dd8d..9263e6f7dfd2e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/listener/PipeInsertionDataNodeListener.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/listener/PipeInsertionDataNodeListener.java @@ -86,7 +86,7 @@ public synchronized void stopListenAndAssign( listenToInsertNodeExtractorCount.decrementAndGet(); } - if (assigner.notMoreExtractorNeededToBeAssigned()) { + if (assigner.notMoreSourceNeededToBeAssigned()) { // The removed assigner will is the same as the one referenced by the variable `assigner` dataRegionId2Assigner.remove(dataRegionId); // This will help to release the memory occupied by the assigner diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java index cc857b7295cf1..0092ba4d02cb5 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java @@ -35,10 +35,10 @@ import java.util.List; /** - * The JSON payload formatter. two json format supported: { "device":"root.sg.d1", + * The JSON payload formatter. two json format supported: { "device":"root.db.d1", * "timestamp":1586076045524, "measurements":["s1","s2"], "values":[0.530635,0.530635] } * - *

{ "device":"root.sg.d1", "timestamps":[1586076045524,1586076065526], + *

{ "device":"root.db.d1", "timestamps":[1586076045524,1586076065526], * "measurements":["s1","s2"], "values":[[0.530635,0.530635], [0.530655,0.530695]] } */ public class JSONPayloadFormatter implements PayloadFormatter { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/OperationType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/OperationType.java index e461f0cc45d16..21685e1122501 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/OperationType.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/OperationType.java @@ -41,8 +41,8 @@ public enum OperationType { DELETE_DATA("deleteData"), INSERT_TABLET("insertTablet"), INSERT_TABLETS("insertTablets"), - SET_STORAGE_GROUP("setStorageGroup"), - DELETE_STORAGE_GROUPS("deleteStorageGroup"), + SET_DATABASE("setDatabase"), + DELETE_DATABASE("deleteDatabase"), CREATE_TIMESERIES("createTimeseries"), CREATE_ALIGNED_TIMESERIES("createAlignedTimeseries"), CREATE_MULTI_TIMESERIES("createMultiTimeseries"), diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java index 5655758f1694e..64180502c1b86 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java @@ -1529,10 +1529,10 @@ public TSStatus setStorageGroup(long sessionId, String storageGroup) { return result.status; } catch (IoTDBException e) { - return onIoTDBException(e, OperationType.SET_STORAGE_GROUP, e.getErrorCode()); + return onIoTDBException(e, OperationType.SET_DATABASE, e.getErrorCode()); } catch (Exception e) { return onQueryException( - e, OperationType.SET_STORAGE_GROUP.getName(), TSStatusCode.EXECUTE_STATEMENT_ERROR); + e, OperationType.SET_DATABASE.getName(), TSStatusCode.EXECUTE_STATEMENT_ERROR); } } @@ -1764,10 +1764,10 @@ public TSStatus deleteStorageGroups(long sessionId, List storageGroups) return result.status; } catch (IoTDBException e) { - return onIoTDBException(e, OperationType.DELETE_STORAGE_GROUPS, e.getErrorCode()); + return onIoTDBException(e, OperationType.DELETE_DATABASE, e.getErrorCode()); } catch (Exception e) { return onQueryException( - e, OperationType.DELETE_STORAGE_GROUPS.getName(), TSStatusCode.EXECUTE_STATEMENT_ERROR); + e, OperationType.DELETE_DATABASE.getName(), TSStatusCode.EXECUTE_STATEMENT_ERROR); } finally { SESSION_MANAGER.updateIdleTime(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java index dcc62fcd3c8f1..2a16d86ed8d11 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java @@ -2344,7 +2344,7 @@ public TSStatus merge() throws TException { @Override public TSStatus startRepairData() throws TException { if (!storageEngine.isReadyForNonReadWriteFunctions()) { - return RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR, "not all sg is ready"); + return RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR, "not all db is ready"); } if (!CompactionTaskManager.getInstance().isInit()) { return RpcUtils.getStatus( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/header/DatasetHeaderFactory.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/header/DatasetHeaderFactory.java index a9e737ac06e66..1a64e6b085be9 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/header/DatasetHeaderFactory.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/header/DatasetHeaderFactory.java @@ -27,8 +27,8 @@ private DatasetHeaderFactory() { // forbidding instantiation } - public static DatasetHeader getCountStorageGroupHeader() { - return new DatasetHeader(ColumnHeaderConstant.countStorageGroupColumnHeaders, true); + public static DatasetHeader getCountDatabaseHeader() { + return new DatasetHeader(ColumnHeaderConstant.countDatabaseColumnHeaders, true); } public static DatasetHeader getCountNodesHeader() { @@ -56,7 +56,7 @@ public static DatasetHeader getShowDevicesHeader() { } public static DatasetHeader getShowDevicesWithSgHeader() { - return new DatasetHeader(ColumnHeaderConstant.showDevicesWithSgColumnHeaders, true); + return new DatasetHeader(ColumnHeaderConstant.showDevicesWithDbColumnHeaders, true); } public static DatasetHeader getShowDatabaseHeader(final boolean isDetailed) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java index 05932e78b95a3..59da4d8cd313f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java @@ -649,7 +649,7 @@ public static ClusterSchemaTree deserialize(InputStream inputStream) throws IOEx /** * Get database name by device path * - *

e.g., root.sg1 is a database and device path = root.sg1.d1, return root.sg1 + *

e.g., root.db1 is a database and device path = root.db1.d1, return root.db1 * * @param deviceID only full device path, cannot be path pattern * @return database in the given path diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java index 543991a6ff72c..edca7adc0c12f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java @@ -64,7 +64,7 @@ Pair, Integer> searchMeasurementPaths( /** * Get database name by device path * - *

e.g., root.sg1 is a database and device path = root.sg1.d1, return root.sg1 + *

e.g., root.db1 is a database and device path = root.db1.d1, return root.db1 * * @param pathName only full device path, cannot be path pattern * @return database in the given path diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/DeviceSchemaSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/DeviceSchemaSource.java index a274c36402e2a..f2bce1b0f05a2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/DeviceSchemaSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/DeviceSchemaSource.java @@ -89,7 +89,7 @@ public ISchemaReader getSchemaReader(ISchemaRegion schemaRegi @Override public List getInfoQueryColumnHeaders() { return hasSgCol - ? ColumnHeaderConstant.showDevicesWithSgColumnHeaders + ? ColumnHeaderConstant.showDevicesWithDbColumnHeaders : ColumnHeaderConstant.showDevicesColumnHeaders; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/FileLoaderUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/FileLoaderUtils.java index 35d8a1705ab00..3c2c55a81926f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/FileLoaderUtils.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/FileLoaderUtils.java @@ -174,8 +174,8 @@ public static TimeseriesMetadata loadTimeSeriesMetadata( * Load AlignedTimeSeriesMetadata for aligned time series. * * @param resource corresponding TsFileResource - * @param alignedPath instance of VectorPartialPath, vector's full path, e.g. (root.sg1.d1.vector, - * [root.sg1.d1.vector.s1, root.sg1.d1.vector.s2]) + * @param alignedPath instance of VectorPartialPath, vector's full path, e.g. (root.db1.d1.vector, + * [root.db1.d1.vector.s1, root.db1.d1.vector.s2]) * @throws IOException IOException may be thrown while reading it from disk. */ public static AbstractAlignedTimeSeriesMetadata loadAlignedTimeSeriesMetadata( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java index 9235bc350889a..740df5dc55ee6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java @@ -138,10 +138,10 @@ public class Analysis implements IAnalysis { /* tag values -> (grouped expression -> output expressions) For different combination of tag keys, the grouped expression may be different. Let's say there - are 3 timeseries root.sg.d1.temperature, root.sg.d1.status, root.sg.d2.temperature, and their + are 3 timeseries root.db.d1.temperature, root.db.d1.status, root.db.d2.temperature, and their tags are [k1=v1], [k1=v1] and [k1=v2] respectively. For query "SELECT last_value(**) FROM root GROUP BY k1", timeseries are grouped by their tags into 2 buckets. Bucket [v1] has - [root.sg.d1.temperature, root.sg.d1.status], while bucket [v2] has [root.sg.d2.temperature]. + [root.db.d1.temperature, root.db.d1.status], while bucket [v2] has [root.db.d2.temperature]. Thus, the aggregation results of bucket [v1] and [v2] are different. Bucket [v1] has 2 aggregation results last_value(temperature) and last_value(status), whereas bucket [v2] only has [last_value(temperature)]. @@ -215,7 +215,7 @@ aggregation results last_value(temperature) and last_value(status), whereas buck // The expressions in order by clause // In align by device orderByExpression is the deviceView of expression which doesn't have // device-prefix - // for example, in device root.sg1.d1, [root.sg1.d1.s1] is expression and [s1] is the device-view + // for example, in device root.db1.d1, [root.db1.d1.s1] is expression and [s1] is the device-view // one. private Set orderByExpressions; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java index 34a289b76c9da..eefb36862799c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java @@ -2246,19 +2246,19 @@ private DataPartition fetchDataPartitionByDevices( CONFIG.getSeriesPartitionExecutorClass(), CONFIG.getSeriesPartitionSlotNum()); } - Map> sgNameToQueryParamsMap = new HashMap<>(); + Map> dbNameToQueryParamsMap = new HashMap<>(); for (IDeviceID deviceID : deviceSet) { DataPartitionQueryParam queryParam = new DataPartitionQueryParam(deviceID, res.left, res.right.left, res.right.right); - sgNameToQueryParamsMap + dbNameToQueryParamsMap .computeIfAbsent(schemaTree.getBelongedDatabase(deviceID), key -> new ArrayList<>()) .add(queryParam); } if (res.right.left || res.right.right) { - return partitionFetcher.getDataPartitionWithUnclosedTimeRange(sgNameToQueryParamsMap); + return partitionFetcher.getDataPartitionWithUnclosedTimeRange(dbNameToQueryParamsMap); } else { - return partitionFetcher.getDataPartition(sgNameToQueryParamsMap); + return partitionFetcher.getDataPartition(dbNameToQueryParamsMap); } } finally { long partitionFetchCost = System.nanoTime() - startTime; @@ -2517,8 +2517,8 @@ private void analyzeInto( /** * Check datatype consistency in ALIGN BY DEVICE. * - *

an inconsistent example: select s0 from root.sg1.d1, root.sg1.d2 align by device, return - * false while root.sg1.d1.s0 is INT32 and root.sg1.d2.s0 is FLOAT. + *

an inconsistent example: select s0 from root.db1.d1, root.db1.d2 align by device, return + * false while root.db1.d1.s0 is INT32 and root.db1.d2.s0 is FLOAT. */ private void checkDataTypeConsistencyInAlignByDevice( Analysis analysis, List expressions) { @@ -3275,7 +3275,7 @@ public Analysis visitShowDevices( analysis.setSchemaPartitionInfo(schemaPartitionInfo); } analysis.setRespDatasetHeader( - showDevicesStatement.hasSgCol() + showDevicesStatement.hasDbCol() ? DatasetHeaderFactory.getShowDevicesWithSgHeader() : DatasetHeaderFactory.getShowDevicesHeader()); return analysis; @@ -3299,7 +3299,7 @@ public Analysis visitCountDatabase( CountDatabaseStatement countDatabaseStatement, MPPQueryContext context) { Analysis analysis = new Analysis(); analysis.setRealStatement(countDatabaseStatement); - analysis.setRespDatasetHeader(DatasetHeaderFactory.getCountStorageGroupHeader()); + analysis.setRespDatasetHeader(DatasetHeaderFactory.getCountDatabaseHeader()); return analysis; } @@ -3574,18 +3574,18 @@ public Analysis visitDeleteData( analysis.setSchemaTree(schemaTree); context.setReleaseSchemaTreeAfterAnalyzing(false); - Map> sgNameToQueryParamsMap = new HashMap<>(); + Map> dbNameToQueryParamsMap = new HashMap<>(); deduplicatedDeviceIDs.forEach( deviceID -> { DataPartitionQueryParam queryParam = new DataPartitionQueryParam(); queryParam.setDeviceID(deviceID); - sgNameToQueryParamsMap + dbNameToQueryParamsMap .computeIfAbsent(schemaTree.getBelongedDatabase(deviceID), key -> new ArrayList<>()) .add(queryParam); }); - DataPartition dataPartition = partitionFetcher.getDataPartition(sgNameToQueryParamsMap); + DataPartition dataPartition = partitionFetcher.getDataPartition(dbNameToQueryParamsMap); analysis.setDataPartitionInfo(dataPartition); analysis.setFinishQueryAfterAnalyze(dataPartition.isEmpty()); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java index 8c54fd640f88c..918ebd68c2528 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java @@ -103,9 +103,9 @@ public SchemaPartition getSchemaPartition( final PathPatternTree patternTree, String userName, boolean needAuditDB) { patternTree.constructTree(); final List deviceIDs = patternTree.getAllDevicePatterns(); - final Map> storageGroupToDeviceMap = + final Map> database2DeviceMap = partitionCache.getDatabaseToDevice(deviceIDs, true, false, userName); - SchemaPartition schemaPartition = partitionCache.getSchemaPartition(storageGroupToDeviceMap); + SchemaPartition schemaPartition = partitionCache.getSchemaPartition(database2DeviceMap); if (null == schemaPartition) { try (final ConfigNodeClient client = configNodeClientManager.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) { @@ -147,9 +147,9 @@ public SchemaPartition getOrCreateSchemaPartition( final PathPatternTree patternTree, final String userName) { patternTree.constructTree(); final List deviceIDs = patternTree.getAllDevicePatterns(); - final Map> storageGroupToDeviceMap = + final Map> database2DeviceMap = partitionCache.getDatabaseToDevice(deviceIDs, true, true, userName); - SchemaPartition schemaPartition = partitionCache.getSchemaPartition(storageGroupToDeviceMap); + SchemaPartition schemaPartition = partitionCache.getSchemaPartition(database2DeviceMap); if (null == schemaPartition) { try (final ConfigNodeClient client = configNodeClientManager.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) { @@ -195,13 +195,13 @@ public SchemaNodeManagementPartition getSchemaNodeManagementPartitionWithLevel( @Override public DataPartition getDataPartition( - final Map> sgNameToQueryParamsMap) { - DataPartition dataPartition = partitionCache.getDataPartition(sgNameToQueryParamsMap); + final Map> dbNameToQueryParamsMap) { + DataPartition dataPartition = partitionCache.getDataPartition(dbNameToQueryParamsMap); if (null == dataPartition) { try (ConfigNodeClient client = configNodeClientManager.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) { final TDataPartitionTableResp dataPartitionTableResp = - client.getDataPartitionTable(constructDataPartitionReqForQuery(sgNameToQueryParamsMap)); + client.getDataPartitionTable(constructDataPartitionReqForQuery(dbNameToQueryParamsMap)); if (dataPartitionTableResp.getStatus().getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { dataPartition = parseDataPartitionResp(dataPartitionTableResp); @@ -221,14 +221,14 @@ public DataPartition getDataPartition( @Override public DataPartition getDataPartitionWithUnclosedTimeRange( - final Map> sgNameToQueryParamsMap) { + final Map> dbNameToQueryParamsMap) { // In this method, we must fetch from config node because it contains -oo or +oo // and there is no need to update cache because since we will never fetch it from cache, the // update operation will be only time waste try (final ConfigNodeClient client = configNodeClientManager.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) { final TDataPartitionTableResp dataPartitionTableResp = - client.getDataPartitionTable(constructDataPartitionReqForQuery(sgNameToQueryParamsMap)); + client.getDataPartitionTable(constructDataPartitionReqForQuery(dbNameToQueryParamsMap)); if (dataPartitionTableResp.getStatus().getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { return parseDataPartitionResp(dataPartitionTableResp); @@ -245,14 +245,14 @@ public DataPartition getDataPartitionWithUnclosedTimeRange( @Override public DataPartition getOrCreateDataPartition( - final Map> sgNameToQueryParamsMap) { - DataPartition dataPartition = partitionCache.getDataPartition(sgNameToQueryParamsMap); + final Map> dbNameToQueryParamsMap) { + DataPartition dataPartition = partitionCache.getDataPartition(dbNameToQueryParamsMap); if (null == dataPartition) { // Do not use data partition cache try (final ConfigNodeClient client = configNodeClientManager.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) { final TDataPartitionTableResp dataPartitionTableResp = - client.getOrCreateDataPartitionTable(constructDataPartitionReq(sgNameToQueryParamsMap)); + client.getOrCreateDataPartitionTable(constructDataPartitionReq(dbNameToQueryParamsMap)); if (dataPartitionTableResp.getStatus().getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { dataPartition = parseDataPartitionResp(dataPartitionTableResp); @@ -450,11 +450,11 @@ private void putTimeSlot(final List slotList) { } private TDataPartitionReq constructDataPartitionReq( - final Map> sgNameToQueryParamsMap) { + final Map> dbNameToQueryParamsMap) { final Map> partitionSlotsMap = new HashMap<>(); for (final Map.Entry> entry : - sgNameToQueryParamsMap.entrySet()) { - // for each sg + dbNameToQueryParamsMap.entrySet()) { + // for each db final Map deviceToTimePartitionMap = new HashMap<>(); final Map seriesSlotTimePartitionMap = @@ -482,12 +482,12 @@ private TDataPartitionReq constructDataPartitionReq( /** For query, DataPartitionQueryParam is shared by each device */ private TDataPartitionReq constructDataPartitionReqForQuery( - final Map> sgNameToQueryParamsMap) { + final Map> dbNameToQueryParamsMap) { final Map> partitionSlotsMap = new HashMap<>(); TTimeSlotList sharedTTimeSlotList = null; for (final Map.Entry> entry : - sgNameToQueryParamsMap.entrySet()) { - // for each sg + dbNameToQueryParamsMap.entrySet()) { + // for each db final Map deviceToTimePartitionMap = new HashMap<>(); for (final DataPartitionQueryParam queryParam : entry.getValue()) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/GroupByLevelHelper.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/GroupByLevelHelper.java index a220fdf2883d3..024fc73f5bad4 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/GroupByLevelHelper.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/GroupByLevelHelper.java @@ -44,10 +44,10 @@ public class GroupByLevelHelper { private final int[] levels; - /** count(root.sg.d1.s1) with level = 1 -> { count(root.*.d1.s1) : count(root.sg.d1.s1) } */ + /** count(root.db.d1.s1) with level = 1 -> { count(root.*.d1.s1) : count(root.db.d1.s1) } */ private final Map> groupedAggregationExpressionToRawExpressionsMap; - /** count(root.sg.d1.s1) with level = 1 -> { root.sg.d1.s1 : root.sg.*.s1 } */ + /** count(root.db.d1.s1) with level = 1 -> { root.db.d1.s1 : root.db.*.s1 } */ private final RawPathToGroupedPathMap rawPathToGroupedPathMap; /** count(root.*.d1.s1) -> alias */ @@ -80,7 +80,7 @@ public Expression applyLevels( Expression outputExpression = ExpressionAnalyzer.replaceSubTreeWithView(expression, analysis); // construct output expression - // e.g. count(root.sg.d1.s1) -> count(root.sg.*.s1) + // e.g. count(root.db.d1.s1) -> count(root.db.*.s1) Expression groupedOutputExpression = ExpressionAnalyzer.replaceRawPathWithGroupedPath( outputExpression, @@ -148,7 +148,7 @@ private void checkAliasAndUpdateAliasMap(String alias, String groupedExpressionS /** * Transform an originalPath to a partial path that satisfies given level. Path nodes don't * satisfy the given level will be replaced by "*" except the sensor level, e.g. - * transformPathByLevels("root.sg.dh.d1.s1", 2) will return "root.*.dh.*.s1". + * transformPathByLevels("root.db.dh.d1.s1", 2) will return "root.*.dh.*.s1". * *

Especially, if count(*), then the sensor level will be replaced by "*" too. * diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/IPartitionFetcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/IPartitionFetcher.java index 0549ec3964743..1a5b38e70e715 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/IPartitionFetcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/IPartitionFetcher.java @@ -55,27 +55,27 @@ default SchemaPartition getSchemaPartition( /** * Get data partition, used in query scenarios. * - * @param sgNameToQueryParamsMap database name -> the list of DataPartitionQueryParams + * @param dbNameToQueryParamsMap database name -> the list of DataPartitionQueryParams */ - DataPartition getDataPartition(Map> sgNameToQueryParamsMap); + DataPartition getDataPartition(Map> dbNameToQueryParamsMap); /** * Get data partition, used in query scenarios which contains time filter like: time < XX or time * > XX * - * @return sgNameToQueryParamsMap database name -> the list of DataPartitionQueryParams + * @return dbNameToQueryParamsMap database name -> the list of DataPartitionQueryParams */ DataPartition getDataPartitionWithUnclosedTimeRange( - Map> sgNameToQueryParamsMap); + Map> dbNameToQueryParamsMap); /** * Get or create data partition, used in standalone write scenarios. if enableAutoCreateSchema is * true and database/series/time slots not exists, then automatically create. * - * @param sgNameToQueryParamsMap database name -> the list of DataPartitionQueryParams + * @param dbNameToQueryParamsMap database name -> the list of DataPartitionQueryParams */ DataPartition getOrCreateDataPartition( - Map> sgNameToQueryParamsMap); + Map> dbNameToQueryParamsMap); /** * Get or create data partition, used in cluster write scenarios. if enableAutoCreateSchema is diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/TemplatedAnalyze.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/TemplatedAnalyze.java index 4a4fc073410b7..fdc4bca90752f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/TemplatedAnalyze.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/TemplatedAnalyze.java @@ -401,19 +401,19 @@ private static DataPartition fetchDataPartitionByDevices( CONFIG.getSeriesPartitionExecutorClass(), CONFIG.getSeriesPartitionSlotNum()); } - Map> sgNameToQueryParamsMap = new HashMap<>(); + Map> dbNameToQueryParamsMap = new HashMap<>(); for (IDeviceID deviceID : deviceSet) { DataPartitionQueryParam queryParam = new DataPartitionQueryParam(deviceID, res.left, res.right.left, res.right.right); - sgNameToQueryParamsMap + dbNameToQueryParamsMap .computeIfAbsent(schemaTree.getBelongedDatabase(deviceID), key -> new ArrayList<>()) .add(queryParam); } if (res.right.left || res.right.right) { - return partitionFetcher.getDataPartitionWithUnclosedTimeRange(sgNameToQueryParamsMap); + return partitionFetcher.getDataPartitionWithUnclosedTimeRange(dbNameToQueryParamsMap); } else { - return partitionFetcher.getDataPartition(sgNameToQueryParamsMap); + return partitionFetcher.getDataPartition(dbNameToQueryParamsMap); } } finally { QueryPlanCostMetricSet.getInstance() diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetcher.java index 49e2995b3a800..a0b3e45cd4ca7 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetcher.java @@ -122,7 +122,7 @@ public ClusterSchemaTree fetchSchema( boolean isAllCached = true; ClusterSchemaTree cachedSchema; - Set storageGroupSet = new HashSet<>(); + Set databaseSet = new HashSet<>(); if (!explicitDevicePatternList.isEmpty()) { for (PartialPath explicitDevicePattern : explicitDevicePatternList) { cachedSchema = schemaCache.getMatchedTemplateSchema(explicitDevicePattern); @@ -131,7 +131,7 @@ public ClusterSchemaTree fetchSchema( break; } else { schemaTree.mergeSchemaTree(cachedSchema); - storageGroupSet.addAll(cachedSchema.getDatabases()); + databaseSet.addAll(cachedSchema.getDatabases()); } } } @@ -150,13 +150,13 @@ public ClusterSchemaTree fetchSchema( break; } else { schemaTree.mergeSchemaTree(cachedSchema); - storageGroupSet.addAll(cachedSchema.getDatabases()); + databaseSet.addAll(cachedSchema.getDatabases()); } } } if (isAllCached) { - schemaTree.setDatabases(storageGroupSet); + schemaTree.setDatabases(databaseSet); return schemaTree; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java index b617bac5f5461..551b37dee3bcb 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java @@ -1338,7 +1338,7 @@ public SettableFuture startRepairData(boolean onCluster) { if (!StorageEngine.getInstance().isReadyForNonReadWriteFunctions()) { future.setException( new IoTDBException( - "not all sg is ready", TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode())); + "not all db is ready", TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode())); return future; } if (!CompactionTaskManager.getInstance().isInit()) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java index aef4a199c390e..f7755bd02d3b8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java @@ -64,9 +64,9 @@ public class FunctionExpression extends Expression { private final LinkedHashMap functionAttributes; /** - * example: select udf(a, b, udf(c)) from root.sg.d; + * example: select udf(a, b, udf(c)) from root.db.d; * - *

3 expressions [root.sg.d.a, root.sg.d.b, udf(root.sg.d.c)] will be in this field. + *

3 expressions [root.db.d.a, root.db.d.b, udf(root.db.d.c)] will be in this field. */ private List expressions; @@ -329,9 +329,9 @@ public String getExpressionStringInternal() { * *

Example: * - *

Full column name -> udf(root.sg.d.s1, sin(root.sg.d.s1), 'key1'='value1', 'key2'='value2') + *

Full column name -> udf(root.db.d.s1, sin(root.db.d.s1), 'key1'='value1', 'key2'='value2') * - *

The parameter part -> root.sg.d.s1, sin(root.sg.d.s1), 'key1'='value1', 'key2'='value2' + *

The parameter part -> root.db.d.s1, sin(root.db.d.s1), 'key1'='value1', 'key2'='value2' */ private String getParametersString() { if (parametersString == null) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java index be30b4e1b37f8..49df3f9227773 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java @@ -851,7 +851,7 @@ public Statement visitShowDevices(IoTDBSqlParser.ShowDevicesContext ctx) { } // show devices with database if (ctx.WITH() != null) { - showDevicesStatement.setSgCol(true); + showDevicesStatement.setDbCol(true); } return showDevicesStatement; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java index fa39b3ba7dcef..fff4f1dfe9612 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java @@ -630,7 +630,7 @@ public PlanNode visitShowDevices( limit, offset, showDevicesStatement.isPrefixPath(), - showDevicesStatement.hasSgCol(), + showDevicesStatement.hasDbCol(), showDevicesStatement.getSchemaFilter(), showDevicesStatement.getAuthorityScope()) .planSchemaQueryMerge(false); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java index 581641591837b..54cfc508ceecf 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java @@ -934,7 +934,7 @@ public Operator visitDevicesSchemaScan( node.isPrefixPath(), node.getLimit(), node.getOffset(), - node.isHasSgCol(), + node.isHasDbCol(), node.getSchemaFilter(), node.getScope())); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/read/DevicesSchemaScanNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/read/DevicesSchemaScanNode.java index e7c5067c4e3d4..d76e74d9d7adf 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/read/DevicesSchemaScanNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/read/DevicesSchemaScanNode.java @@ -40,7 +40,7 @@ public class DevicesSchemaScanNode extends SchemaQueryScanNode { - private final boolean hasSgCol; + private final boolean hasDbCol; private final SchemaFilter schemaFilter; public DevicesSchemaScanNode( @@ -49,16 +49,16 @@ public DevicesSchemaScanNode( long limit, long offset, boolean isPrefixPath, - boolean hasSgCol, + boolean hasDbCol, SchemaFilter schemaFilter, PathPatternTree scope) { super(id, path, limit, offset, isPrefixPath, scope); - this.hasSgCol = hasSgCol; + this.hasDbCol = hasDbCol; this.schemaFilter = schemaFilter; } - public boolean isHasSgCol() { - return hasSgCol; + public boolean isHasDbCol() { + return hasDbCol; } public SchemaFilter getSchemaFilter() { @@ -73,13 +73,13 @@ public PlanNodeType getType() { @Override public PlanNode clone() { return new DevicesSchemaScanNode( - getPlanNodeId(), path, limit, offset, isPrefixPath, hasSgCol, schemaFilter, scope); + getPlanNodeId(), path, limit, offset, isPrefixPath, hasDbCol, schemaFilter, scope); } @Override public List getOutputColumnNames() { - if (hasSgCol) { - return ColumnHeaderConstant.showDevicesWithSgColumnHeaders.stream() + if (hasDbCol) { + return ColumnHeaderConstant.showDevicesWithDbColumnHeaders.stream() .map(ColumnHeader::getColumnName) .collect(Collectors.toList()); } @@ -96,7 +96,7 @@ protected void serializeAttributes(ByteBuffer byteBuffer) { ReadWriteIOUtils.write(limit, byteBuffer); ReadWriteIOUtils.write(offset, byteBuffer); ReadWriteIOUtils.write(isPrefixPath, byteBuffer); - ReadWriteIOUtils.write(hasSgCol, byteBuffer); + ReadWriteIOUtils.write(hasDbCol, byteBuffer); SchemaFilter.serialize(schemaFilter, byteBuffer); } @@ -108,7 +108,7 @@ protected void serializeAttributes(DataOutputStream stream) throws IOException { ReadWriteIOUtils.write(limit, stream); ReadWriteIOUtils.write(offset, stream); ReadWriteIOUtils.write(isPrefixPath, stream); - ReadWriteIOUtils.write(hasSgCol, stream); + ReadWriteIOUtils.write(hasDbCol, stream); SchemaFilter.serialize(schemaFilter, stream); } @@ -143,12 +143,12 @@ public boolean equals(Object o) { return false; } DevicesSchemaScanNode that = (DevicesSchemaScanNode) o; - return hasSgCol == that.hasSgCol && Objects.equals(schemaFilter, that.schemaFilter); + return hasDbCol == that.hasDbCol && Objects.equals(schemaFilter, that.schemaFilter); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), hasSgCol, schemaFilter); + return Objects.hash(super.hashCode(), hasDbCol, schemaFilter); } @Override diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByLevelNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByLevelNode.java index ddfaed455a74d..e82f8119e2348 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByLevelNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByLevelNode.java @@ -46,10 +46,10 @@ * and belong to one bucket. Here, that two columns belong to one bucket means the partial paths of * device after rolling up in specific level are the same. * - *

For example, let's say there are two columns `root.sg.d1.s1` and `root.sg.d2.s1`. + *

For example, let's say there are two columns `root.db.d1.s1` and `root.db.d2.s1`. * *

If the group by level parameter is [0, 1], then these two columns will belong to one bucket - * and the bucket name is `root.sg.*.s1`. + * and the bucket name is `root.db.*.s1`. * *

If the group by level parameter is [0, 2], then these two columns will not belong to one * bucket. And the total buckets are `root.*.d1.s1` and `root.*.d2.s1` diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByTagNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByTagNode.java index 50b64e029c0bf..6a53a309b94c3 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByTagNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByTagNode.java @@ -221,19 +221,19 @@ public List getTagKeys() { *

e.g. we have following timeseries: * *

    - *
  • root.sg.d1.s1(k1=v1) - *
  • root.sg.d1.s2(k1=v1) - *
  • root.sg.d2.s1(k1=v2) - *
  • root.sg.d3.s1(k1=v2) + *
  • root.db.d1.s1(k1=v1) + *
  • root.db.d1.s2(k1=v1) + *
  • root.db.d2.s1(k1=v2) + *
  • root.db.d3.s1(k1=v2) *
* * Then the query - * SELECT avg(s1), avg(s2) FROM root.sg.** GROUP BY TAGS(k1) + * SELECT avg(s1), avg(s2) FROM root.db.** GROUP BY TAGS(k1) * will generate a {@link GroupByTagNode} with the TagValuesToAggregationDescriptors * as below: * { - * ["v1"]: [["avg(root.sg.d1.s1)"], ["avg(root.sg.d1.s2)"]], - * ["v2"]: [["avg(root.sg.d2.s1)","avg(root.sg.d3.s1)"], null], + * ["v1"]: [["avg(root.db.d1.s1)"], ["avg(root.db.d1.s2)"]], + * ["v2"]: [["avg(root.db.d2.s1)","avg(root.db.d3.s1)"], null], * } * * diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/DeleteDataNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/DeleteDataNode.java index cfba72d66db62..a741becefd3d2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/DeleteDataNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/DeleteDataNode.java @@ -326,8 +326,8 @@ public List splitByPartition(IAnalysis analysis) { new DeleteDataNode( getPlanNodeId(), // Pick the smaller path list to execute the deletion. - // E.g. There is only one path(root.sg.**) in pathList and two paths(root.sg.d1, - // root.sg.d2) in a map entry in regionToPatternMap. Choose the original path is + // E.g. There is only one path(root.db.**) in pathList and two paths(root.db.d1, + // root.db.d2) in a map entry in regionToPatternMap. Choose the original path is // better. this.pathList.size() < regionToPatternMap.get(o).size() ? this.pathList diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/AggregationDescriptor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/AggregationDescriptor.java index ac30dcf505afd..b589b9fdd5275 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/AggregationDescriptor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/AggregationDescriptor.java @@ -59,9 +59,9 @@ public class AggregationDescriptor { * Input of aggregation function. Currently, we only support one series in the aggregation * function. * - *

example: select sum(s1) from root.sg.d1; expression [root.sg.d1.s1] will be in this field. + *

example: select sum(s1) from root.db.d1; expression [root.db.d1.s1] will be in this field. * - *

example: select sum(s1) from root.** group by level = 1; expression [root.sg.*.s1] may be in + *

example: select sum(s1) from root.** group by level = 1; expression [root.db.*.s1] may be in * this field if the data is in different DataRegion */ protected List inputExpressions; @@ -210,9 +210,9 @@ public List getActualAggregationNames(boolean isPartial) { * *

Example: * - *

Full column name -> udf(root.sg.d.s1, sin(root.sg.d.s1)) + *

Full column name -> udf(root.db.d.s1, sin(root.db.d.s1)) * - *

The parameter part -> root.sg.d.s1, sin(root.sg.d.s1) + *

The parameter part -> root.db.d.s1, sin(root.db.d.s1) */ public String getParametersString() { if (parametersString == null) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/CrossSeriesAggregationDescriptor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/CrossSeriesAggregationDescriptor.java index d986baf2faa3c..b41eec9a67aaa 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/CrossSeriesAggregationDescriptor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/CrossSeriesAggregationDescriptor.java @@ -152,11 +152,11 @@ public List getInputExpressionsAsStringList() { /** * For an aggregate function that takes two inputs, the inputExpressions may be like - * [root.sg.d1.s1, root.sg.d1.s2, root.sg.d2.s1, root.sg.d2.s2]. The inputExpressions is a + * [root.db.d1.s1, root.db.d1.s2, root.db.d2.s1, root.db.d2.s2]. The inputExpressions is a * one-dimensional List, but it is split by expressionNumOfOneInput. The split result is stored in - * groupedInputExpressions So the returned map of this method is : <"root.sg.d1.s1, - * root.sg.d1.s2", [root.sg.d1.s1, root.sg.d1.s2]> <"root.sg.d2.s1, root.sg.d2.s2", - * [root.sg.d2.s1, root.sg.d2.s2]> + * groupedInputExpressions So the returned map of this method is : <"root.db.d1.s1, + * root.db.d1.s2", [root.db.d1.s1, root.db.d1.s2]> <"root.db.d2.s1, root.db.d2.s2", + * [root.db.d2.s1, root.db.d2.s2]> */ public Map> getGroupedInputStringToExpressionsMap() { Map> map = new HashMap<>(); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/Metadata.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/Metadata.java index aadc2a25e1693..a81711255741f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/Metadata.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/Metadata.java @@ -185,20 +185,20 @@ SchemaPartition getOrCreateSchemaPartition( * Get data partition, used in query scenarios. * * @param database a user-provided db name, the database shall start with "root.". - * @param sgNameToQueryParamsMap database name -> the list of DataPartitionQueryParams + * @param dbNameToQueryParamsMap database name -> the list of DataPartitionQueryParams */ DataPartition getDataPartition( - final String database, final List sgNameToQueryParamsMap); + final String database, final List dbNameToQueryParamsMap); /** * Get data partition, used in query scenarios which contains time filter like: time < XX or time * > XX * * @param database a user-provided db name, the database shall start with "root.". - * @return sgNameToQueryParamsMap database name -> the list of DataPartitionQueryParams + * @return dbNameToQueryParamsMap database name -> the list of DataPartitionQueryParams */ DataPartition getDataPartitionWithUnclosedTimeRange( - final String database, final List sgNameToQueryParamsMap); + final String database, final List dbNameToQueryParamsMap); TableFunction getTableFunction(final String functionName); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java index f83e527113856..6dd6654110de7 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java @@ -1428,16 +1428,16 @@ public SchemaPartition getSchemaPartition(final String database) { @Override public DataPartition getDataPartition( - String database, List sgNameToQueryParamsMap) { + String database, List dbNameToQueryParamsMap) { return partitionFetcher.getDataPartition( - Collections.singletonMap(database, sgNameToQueryParamsMap)); + Collections.singletonMap(database, dbNameToQueryParamsMap)); } @Override public DataPartition getDataPartitionWithUnclosedTimeRange( - String database, List sgNameToQueryParamsMap) { + String database, List dbNameToQueryParamsMap) { return partitionFetcher.getDataPartitionWithUnclosedTimeRange( - Collections.singletonMap(database, sgNameToQueryParamsMap)); + Collections.singletonMap(database, dbNameToQueryParamsMap)); } @Override diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java index d75e2e09b7c28..f53b61a2e209b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java @@ -51,8 +51,8 @@ public enum StatementType { REVOKE_WATERMARK_EMBEDDING, RENAME_USER, - STORAGE_GROUP_SCHEMA, - DELETE_STORAGE_GROUP, + DATABASE_SCHEMA, + DELETE_DATABASE, CREATE_TIME_SERIES, CREATE_ALIGNED_TIME_SERIES, CREATE_MULTI_TIME_SERIES, @@ -109,7 +109,7 @@ public enum StatementType { MNODE, MEASUREMENT_MNODE, - STORAGE_GROUP_MNODE, + DATABASE_MNODE, AUTO_CREATE_DEVICE_MNODE, TTL, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/component/ResultColumn.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/component/ResultColumn.java index f97391330811e..8da242955449b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/component/ResultColumn.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/component/ResultColumn.java @@ -28,37 +28,37 @@ * This class is used to represent a result column of a query. * *

Assume that we have time series in db as follows:
- * [ root.sg.d.a, root.sg.d.b, root.sg.e.a, root.sg.e.b ] + * [ root.db.d.a, root.db.d.b, root.db.e.a, root.db.e.b ] * *

    - * Example 1: select a, a + b, udf(udf(b)) from root.sg.d, root.sg.e; + * Example 1: select a, a + b, udf(udf(b)) from root.db.d, root.db.e; *
  • Step 1: constructed by sql visitor in logical operator:
    * result columns:
    * [a, a + b, udf(udf(b))] *
  • Step 2: concatenated with prefix paths in logical optimizer:
    * result columns:
    - * [root.sg.d.a, root.sg.e.a, root.sg.d.a + root.sg.d.b, root.sg.d.a + root.sg.e.b, - * root.sg.e.a + root.sg.d.b, root.sg.e.a + root.sg.e.b, udf(udf(root.sg.d.b)), - * udf(udf(root.sg.e.b))] + * [root.db.d.a, root.db.e.a, root.db.d.a + root.db.d.b, root.db.d.a + root.db.e.b, + * root.db.e.a + root.db.d.b, root.db.e.a + root.db.e.b, udf(udf(root.db.d.b)), + * udf(udf(root.db.e.b))] *
  • Step 3: remove wildcards in logical optimizer:
    * result columns:
    - * [root.sg.d.a, root.sg.e.a, root.sg.d.a + root.sg.d.b, root.sg.d.a + root.sg.e.b, - * root.sg.e.a + root.sg.d.b, root.sg.e.a + root.sg.e.b, udf(udf(root.sg.d.b)), - * udf(udf(root.sg.e.b))] + * [root.db.d.a, root.db.e.a, root.db.d.a + root.db.d.b, root.db.d.a + root.db.e.b, + * root.db.e.a + root.db.d.b, root.db.e.a + root.db.e.b, udf(udf(root.db.d.b)), + * udf(udf(root.db.e.b))] *
* *
    - * Example 2: select *, a + *, udf(udf(*)) from root.sg.d; + * Example 2: select *, a + *, udf(udf(*)) from root.db.d; *
  • Step 1: constructed by sql visitor in logical operator:
    * result columns:
    * [*, a + * , udf(udf(*))] *
  • Step 2: concatenated with prefix paths in logical optimizer:
    * result columns:
    - * [root.sg.d.*, root.sg.d.a + root.sg.d.*, udf(udf(root.sg.d.*))] + * [root.db.d.*, root.db.d.a + root.db.d.*, udf(udf(root.db.d.*))] *
  • Step 3: remove wildcards in logical optimizer:
    * result columns:
    - * [root.sg.d.a, root.sg.d.b, root.sg.d.a + root.sg.d.a, root.sg.d.a + root.sg.d.b, - * udf(udf(root.sg.d.a)), udf(udf(root.sg.d.b))] + * [root.db.d.a, root.db.d.b, root.db.d.a + root.db.d.a, root.db.d.a + root.db.d.b, + * udf(udf(root.db.d.a)), udf(udf(root.db.d.b))] *
*/ public class ResultColumn extends StatementNode { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DatabaseSchemaStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DatabaseSchemaStatement.java index 53ff33e2437cb..005740924da3f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DatabaseSchemaStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DatabaseSchemaStatement.java @@ -47,7 +47,7 @@ public class DatabaseSchemaStatement extends Statement implements IConfigStateme public DatabaseSchemaStatement(final DatabaseSchemaStatementType subType) { super(); this.subType = subType; - statementType = StatementType.STORAGE_GROUP_SCHEMA; + statementType = StatementType.DATABASE_SCHEMA; } public DatabaseSchemaStatementType getSubType() { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DeleteDatabaseStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DeleteDatabaseStatement.java index 6b538267555f2..2d08c10219700 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DeleteDatabaseStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DeleteDatabaseStatement.java @@ -41,7 +41,7 @@ public class DeleteDatabaseStatement extends Statement implements IConfigStateme public DeleteDatabaseStatement() { super(); - statementType = StatementType.DELETE_STORAGE_GROUP; + statementType = StatementType.DELETE_DATABASE; } @Override diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/ShowDevicesStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/ShowDevicesStatement.java index 75f33c7b4a1cb..18cdd379d8523 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/ShowDevicesStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/ShowDevicesStatement.java @@ -37,7 +37,7 @@ public class ShowDevicesStatement extends ShowStatement { private final PartialPath pathPattern; - private boolean hasSgCol; + private boolean hasDbCol; private SchemaFilter schemaFilter; private WhereCondition timeCondition; @@ -58,12 +58,12 @@ public PartialPath getPathPattern() { return pathPattern; } - public void setSgCol(boolean hasSgCol) { - this.hasSgCol = hasSgCol; + public void setDbCol(boolean hasDbCol) { + this.hasDbCol = hasDbCol; } - public boolean hasSgCol() { - return hasSgCol; + public boolean hasDbCol() { + return hasDbCol; } public void setTimeCondition(WhereCondition timeCondition) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java index 3f59f9edf68ed..a789c0ddc1204 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java @@ -135,23 +135,23 @@ public void init() { public static Map> getLocalSchemaRegionInfo() { final File schemaDir = new File(config.getSchemaDir()); - final File[] sgDirList = schemaDir.listFiles(); + final File[] dbDirList = schemaDir.listFiles(); final Map> localSchemaPartitionTable = new HashMap<>(); - if (sgDirList == null) { + if (dbDirList == null) { return localSchemaPartitionTable; } - for (File file : sgDirList) { + for (File file : dbDirList) { if (!file.isDirectory()) { continue; } - final File sgDir = new File(config.getSchemaDir(), file.getName()); + final File dbDir = new File(config.getSchemaDir(), file.getName()); - if (!sgDir.exists()) { + if (!dbDir.exists()) { continue; } - final File[] schemaRegionDirs = sgDir.listFiles(); + final File[] schemaRegionDirs = dbDir.listFiles(); if (schemaRegionDirs == null) { continue; } @@ -320,10 +320,10 @@ public synchronized void deleteSchemaRegion(SchemaRegionId schemaRegionId) schemaMetricManager.removeSchemaRegionMetric(schemaRegionId.getId()); schemaRegionMap.remove(schemaRegionId); - // check whether the sg dir is empty - File sgDir = new File(config.getSchemaDir(), schemaRegion.getDatabaseFullPath()); + // check whether the db dir is empty + File dbDir = new File(config.getSchemaDir(), schemaRegion.getDatabaseFullPath()); File[] regionDirList = - sgDir.listFiles( + dbDir.listFiles( (dir, name) -> { try { Integer.parseInt(name); @@ -332,10 +332,10 @@ public synchronized void deleteSchemaRegion(SchemaRegionId schemaRegionId) return false; } }); - // remove the empty sg dir + // remove the empty db dir if (regionDirList == null || regionDirList.length == 0) { - if (sgDir.exists()) { - FileUtils.deleteFileOrDirectory(sgDir); + if (dbDir.exists()) { + FileUtils.deleteFileOrDirectory(dbDir); } } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionUtils.java index 651b154666ba1..614901beef49e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionUtils.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionUtils.java @@ -38,12 +38,12 @@ private SchemaRegionUtils() { public static void deleteSchemaRegionFolder(String schemaRegionDirPath, Logger logger) throws MetadataException { File schemaRegionDir = SystemFileFactory.INSTANCE.getFile(schemaRegionDirPath); - File[] sgFiles = schemaRegionDir.listFiles(); - if (sgFiles == null) { + File[] dbFiles = schemaRegionDir.listFiles(); + if (dbFiles == null) { throw new MetadataException( String.format("Can't get files in schema region dir %s", schemaRegionDirPath)); } - for (File file : sgFiles) { + for (File file : dbFiles) { try { Files.delete(file.toPath()); logger.info("Delete schema region file {}", file.getAbsolutePath()); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java index 9b125f4f11142..9f21ab9d3d7b8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java @@ -302,12 +302,12 @@ public synchronized void init() throws MetadataException { } private void initDir() throws SchemaDirCreationFailureException { - final File sgSchemaFolder = SystemFileFactory.INSTANCE.getFile(databaseDirPath); - if (!sgSchemaFolder.exists()) { - if (sgSchemaFolder.mkdirs()) { + final File dbSchemaFolder = SystemFileFactory.INSTANCE.getFile(databaseDirPath); + if (!dbSchemaFolder.exists()) { + if (dbSchemaFolder.mkdirs()) { logger.info("create database schema folder {}", databaseDirPath); } else { - if (!sgSchemaFolder.exists()) { + if (!dbSchemaFolder.exists()) { logger.error("create database schema folder {} failed.", databaseDirPath); throw new SchemaDirCreationFailureException(databaseDirPath); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java index a39b881fe1f4f..d17c7fb170e5a 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java @@ -164,9 +164,9 @@ public class SchemaRegionPBTreeImpl implements ISchemaRegion { private volatile boolean initialized = false; private boolean isClearing = false; - private final String storageGroupDirPath; + private final String databaseDirPath; private final String schemaRegionDirPath; - private final String storageGroupFullPath; + private final String databaseFullPath; private final SchemaRegionId schemaRegionId; // the log file writer @@ -186,11 +186,11 @@ public class SchemaRegionPBTreeImpl implements ISchemaRegion { // region Interfaces and Implementation of initialization、snapshot、recover and clear public SchemaRegionPBTreeImpl(ISchemaRegionParams schemaRegionParams) throws MetadataException { - storageGroupFullPath = schemaRegionParams.getDatabase(); + databaseFullPath = schemaRegionParams.getDatabase(); this.schemaRegionId = schemaRegionParams.getSchemaRegionId(); - storageGroupDirPath = config.getSchemaDir() + File.separator + storageGroupFullPath; - schemaRegionDirPath = storageGroupDirPath + File.separator + schemaRegionId.getId(); + databaseDirPath = config.getSchemaDir() + File.separator + databaseFullPath; + schemaRegionDirPath = databaseDirPath + File.separator + schemaRegionId.getId(); this.regionStatistics = new CachedSchemaRegionStatistics( schemaRegionId.getId(), schemaRegionParams.getSchemaEngineStatistics()); @@ -225,7 +225,7 @@ public synchronized void init() throws MetadataException { tagManager = new TagManager(schemaRegionDirPath, regionStatistics); mtree = new MTreeBelowSGCachedImpl( - new PartialPath(storageGroupFullPath), + new PartialPath(databaseFullPath), tagManager::readTags, tagManager::readAttributes, this::flushCallback, @@ -248,7 +248,7 @@ public synchronized void init() throws MetadataException { } catch (IOException e) { logger.error( "Cannot recover all MTree from {} file, we try to recover as possible as we can", - storageGroupFullPath, + databaseFullPath, e); } initialized = true; @@ -269,7 +269,7 @@ private Consumer> measurementInitProcess() { } catch (IOException e) { logger.error( "Failed to recover tagIndex for {} in schemaRegion {}.", - storageGroupFullPath + PATH_SEPARATOR + measurementMNode.getFullPath(), + databaseFullPath + PATH_SEPARATOR + measurementMNode.getFullPath(), schemaRegionId); } }; @@ -300,14 +300,14 @@ private void flushCallback() { } private void initDir() throws SchemaDirCreationFailureException { - File sgSchemaFolder = SystemFileFactory.INSTANCE.getFile(storageGroupDirPath); - if (!sgSchemaFolder.exists()) { - if (sgSchemaFolder.mkdirs()) { - logger.info("create database schema folder {}", storageGroupDirPath); + File dbSchemaFolder = SystemFileFactory.INSTANCE.getFile(databaseDirPath); + if (!dbSchemaFolder.exists()) { + if (dbSchemaFolder.mkdirs()) { + logger.info("create database schema folder {}", databaseDirPath); } else { - if (!sgSchemaFolder.exists()) { - logger.error("create database schema folder {} failed.", storageGroupDirPath); - throw new SchemaDirCreationFailureException(storageGroupDirPath); + if (!dbSchemaFolder.exists()) { + logger.error("create database schema folder {} failed.", databaseDirPath); + throw new SchemaDirCreationFailureException(databaseDirPath); } } } @@ -405,9 +405,9 @@ private void initFromLog() throws IOException { logger.debug( "spend {} ms to deserialize {} mtree from mlog.bin", System.currentTimeMillis() - time, - storageGroupFullPath); + databaseFullPath); } catch (Exception e) { - throw new IOException("Failed to parse " + storageGroupFullPath + " mlog.bin", e); + throw new IOException("Failed to parse " + databaseFullPath + " mlog.bin", e); } } } @@ -476,7 +476,7 @@ public synchronized void clear() { @Override public String getDatabaseFullPath() { - return storageGroupFullPath; + return databaseFullPath; } @Override @@ -558,7 +558,7 @@ public void loadSnapshot(File latestSnapshotRootDir) { mtree = MTreeBelowSGCachedImpl.loadFromSnapshot( latestSnapshotRootDir, - storageGroupFullPath, + databaseFullPath, schemaRegionId.getId(), regionStatistics, metric, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/MetadataOperationType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/MetadataOperationType.java deleted file mode 100644 index 3e08745bb7240..0000000000000 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/MetadataOperationType.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.iotdb.db.schemaengine.schemaregion.logfile; - -public class MetadataOperationType { - - private MetadataOperationType() { - // allowed to do nothing - } - - public static final String CREATE_TIMESERIES = "0"; - public static final String DELETE_TIMESERIES = "1"; - public static final String SET_STORAGE_GROUP = "2"; - public static final String CREATE_ALIGNED_TIMESERIES = "3"; - public static final String AUTO_CREATE_DEVICE_MNODE = "4"; - public static final String SET_TTL = "10"; - public static final String DELETE_STORAGE_GROUP = "11"; - public static final String CREATE_INDEX = "31"; - public static final String DROP_INDEX = "32"; - public static final String CHANGE_OFFSET = "12"; - public static final String CHANGE_ALIAS = "13"; - public static final String CREATE_CONTINUOUS_QUERY = "14"; - public static final String DROP_CONTINUOUS_QUERY = "15"; - public static final String AUTO_CREATE_DEVICE = "4"; - public static final String CREATE_TEMPLATE = "5"; - public static final String SET_TEMPLATE = "6"; - public static final String UNSET_TEMPLATE = "69"; - public static final String SET_USING_TEMPLATE = "61"; - public static final String APPEND_TEMPLATE = "51"; - public static final String PRUNE_TEMPLATE = "52"; - public static final String DROP_TEMPLATE = "59"; -} diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java index 5931023b3cf90..96b4e97eee7ac 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java @@ -426,7 +426,7 @@ private IMemMNode checkAndAutoCreateInternalPath(final PartialPath devicePath) IMemMNode cur = databaseMNode; IMemMNode child; String childName; - // e.g, path = root.sg.d1.s1, create internal nodes and set cur to sg node, parent of d1 + // e.g, path = root.db.d1.s1, create internal nodes and set cur to db node, parent of d1 for (int i = levelOfSG + 1; i < nodeNames.length - 1; i++) { childName = nodeNames[i]; child = cur.getChild(childName); @@ -446,7 +446,7 @@ private IMemMNode checkAndAutoCreateDeviceNode( final String deviceName, final IMemMNode deviceParent) throws PathAlreadyExistException, ExceedQuotaException { if (deviceParent == null) { - // device is sg + // device is db return databaseMNode; } IMemMNode device = store.getChild(deviceParent, deviceName); @@ -753,7 +753,7 @@ public void setAlias(final IMeasurementMNode measurementMNode, final /** * Add an interval path to MTree. This is only used for automatically creating schema * - *

e.g., get root.sg.d1, get or create all internal nodes and return the node of d1 + *

e.g., get root.db.d1, get or create all internal nodes and return the node of d1 */ public IMemMNode getDeviceNodeWithAutoCreating(final PartialPath deviceId) throws MetadataException { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java index 71d78712afb72..f4c01ef368ed9 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java @@ -56,14 +56,14 @@ import java.util.function.BiConsumer; import java.util.function.Consumer; +import static org.apache.iotdb.commons.schema.SchemaConstant.DATABASE_ENTITY_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.DATABASE_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.ENTITY_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.INTERNAL_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.LOGICAL_VIEW_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.MEASUREMENT_MNODE_TYPE; -import static org.apache.iotdb.commons.schema.SchemaConstant.STORAGE_GROUP_ENTITY_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.TABLE_MNODE_TYPE; -import static org.apache.iotdb.commons.schema.SchemaConstant.isStorageGroupType; +import static org.apache.iotdb.commons.schema.SchemaConstant.isDatabaseType; public class MemMTreeSnapshotUtil { @@ -258,7 +258,7 @@ private static void deserializeMNode( node = deserializer.deserializeEntityMNode(inputStream); deviceProcess.accept(node.getAsDeviceMNode()); break; - case STORAGE_GROUP_ENTITY_MNODE_TYPE: + case DATABASE_ENTITY_MNODE_TYPE: childrenNum = ReadWriteIOUtils.readInt(inputStream); node = deserializer.deserializeStorageGroupEntityMNode(inputStream); deviceProcess.accept(node.getAsDeviceMNode()); @@ -300,7 +300,7 @@ private static void deserializeMNode( } // Storage type means current node is root node, so it must be returned. - if (childrenNum > 0 || isStorageGroupType(type)) { + if (childrenNum > 0 || isDatabaseType(type)) { ancestors.push(node); restChildrenNum.push(childrenNum); } @@ -344,7 +344,7 @@ public Boolean visitDatabaseMNode( AbstractDatabaseMNode> node, OutputStream outputStream) { try { if (node.isDevice()) { - ReadWriteIOUtils.write(STORAGE_GROUP_ENTITY_MNODE_TYPE, outputStream); + ReadWriteIOUtils.write(DATABASE_ENTITY_MNODE_TYPE, outputStream); serializeBasicMNode(node.getBasicMNode(), outputStream); IDeviceMNode deviceMNode = node.getAsDeviceMNode(); ReadWriteIOUtils.write(deviceMNode.getSchemaTemplateIdWithState(), outputStream); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java index 5127cd9e65532..beb1160a8c6e4 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java @@ -119,7 +119,7 @@ public class MTreeBelowSGCachedImpl { private final CachedMTreeStore store; @SuppressWarnings("java:S3077") - private volatile ICachedMNode storageGroupMNode; + private volatile ICachedMNode databaseMNode; private final ICachedMNode rootNode; private final Function, Map> tagGetter; @@ -131,7 +131,7 @@ public class MTreeBelowSGCachedImpl { // region MTree initialization, clear and serialization public MTreeBelowSGCachedImpl( - PartialPath storageGroupPath, + PartialPath databasePath, Function, Map> tagGetter, Function, Map> attributeGetter, Runnable flushCallback, @@ -147,17 +147,17 @@ public MTreeBelowSGCachedImpl( store = PBTreeFactory.getInstance() .createNewCachedMTreeStore( - storageGroupPath, schemaRegionId, regionStatistics, metric, flushCallback); - this.storageGroupMNode = store.getRoot(); - this.storageGroupMNode.setParent(storageGroupMNode.getParent()); - this.rootNode = store.generatePrefix(storageGroupPath); - levelOfSG = storageGroupPath.getNodeLength() - 1; + databasePath, schemaRegionId, regionStatistics, metric, flushCallback); + this.databaseMNode = store.getRoot(); + this.databaseMNode.setParent(databaseMNode.getParent()); + this.rootNode = store.generatePrefix(databasePath); + levelOfSG = databasePath.getNodeLength() - 1; // recover MNode try (MNodeCollector collector = new MNodeCollector( this.rootNode, - new PartialPath(storageGroupMNode.getFullPath()), + new PartialPath(databaseMNode.getFullPath()), this.store, true, SchemaConstant.ALL_MATCH_SCOPE) { @@ -177,7 +177,7 @@ protected Void collectMNode(ICachedMNode node) { /** Only used for load snapshot */ private MTreeBelowSGCachedImpl( - PartialPath storageGroupPath, + PartialPath databasePath, CachedMTreeStore store, Consumer> measurementProcess, Consumer> deviceProcess, @@ -187,9 +187,9 @@ private MTreeBelowSGCachedImpl( throws MetadataException { this.store = store; this.regionStatistics = regionStatistics; - this.storageGroupMNode = store.getRoot(); - this.rootNode = store.generatePrefix(storageGroupPath); - levelOfSG = storageGroupMNode.getPartialPath().getNodeLength() - 1; + this.databaseMNode = store.getRoot(); + this.rootNode = store.generatePrefix(databasePath); + levelOfSG = databaseMNode.getPartialPath().getNodeLength() - 1; this.tagGetter = tagGetter; this.attributeGetter = attributeGetter; @@ -197,7 +197,7 @@ private MTreeBelowSGCachedImpl( try (MNodeCollector collector = new MNodeCollector( this.rootNode, - new PartialPath(storageGroupMNode.getFullPath()), + new PartialPath(databaseMNode.getFullPath()), this.store, true, SchemaConstant.ALL_MATCH_SCOPE) { @@ -217,7 +217,7 @@ protected Void collectMNode(ICachedMNode node) { public void clear() { store.clear(); - storageGroupMNode = null; + databaseMNode = null; } public boolean createSnapshot(File snapshotDir) { @@ -226,7 +226,7 @@ public boolean createSnapshot(File snapshotDir) { public static MTreeBelowSGCachedImpl loadFromSnapshot( File snapshotDir, - String storageGroupFullPath, + String databaseFullPath, int schemaRegionId, CachedSchemaRegionStatistics regionStatistics, SchemaRegionCachedMetric metric, @@ -237,11 +237,11 @@ public static MTreeBelowSGCachedImpl loadFromSnapshot( Runnable flushCallback) throws IOException, MetadataException { return new MTreeBelowSGCachedImpl( - new PartialPath(storageGroupFullPath), + new PartialPath(databaseFullPath), PBTreeFactory.getInstance() .createCachedMTreeStoreFromSnapshot( snapshotDir, - storageGroupFullPath, + databaseFullPath, schemaRegionId, regionStatistics, metric, @@ -593,11 +593,11 @@ private ICachedMNode checkAndAutoCreateInternalPath(PartialPath devicePath) if (nodeNames.length == levelOfSG + 1) { return null; } - ICachedMNode cur = storageGroupMNode; + ICachedMNode cur = databaseMNode; ICachedMNode child; String childName; try { - // e.g, path = root.sg.d1.s1, create internal nodes and set cur to sg node, parent of d1 + // e.g, path = root.db.d1.s1, create internal nodes and set cur to db node, parent of d1 for (int i = levelOfSG + 1; i < nodeNames.length - 1; i++) { childName = nodeNames[i]; child = store.getChild(cur, childName); @@ -620,9 +620,9 @@ private ICachedMNode checkAndAutoCreateInternalPath(PartialPath devicePath) private ICachedMNode checkAndAutoCreateDeviceNode(String deviceName, ICachedMNode deviceParent) throws MetadataException { if (deviceParent == null) { - // device is sg - pinMNode(storageGroupMNode); - return storageGroupMNode; + // device is db + pinMNode(databaseMNode); + return databaseMNode; } ICachedMNode device = store.getChild(deviceParent, deviceName); if (device == null) { @@ -666,7 +666,7 @@ public IMeasurementMNode deleteTimeseries(PartialPath path) * Used when delete timeseries or deactivate template. The last survived ancestor will be * unpinned. * - * @param entityMNode delete empty InternalMNode from entityMNode to storageGroupMNode + * @param entityMNode delete empty InternalMNode from entityMNode to databaseMNode */ private void deleteAndUnpinEmptyInternalMNode(IDeviceMNode entityMNode) throws MetadataException { @@ -825,12 +825,12 @@ public void setAlias(IMeasurementMNode measurementMNode, String al /** * Add an interval path to MTree. This is only used for automatically creating schema * - *

e.g., get root.sg.d1, get or create all internal nodes and return the node of d1 + *

e.g., get root.db.d1, get or create all internal nodes and return the node of d1 */ public ICachedMNode getDeviceNodeWithAutoCreating(PartialPath deviceId) throws MetadataException { String[] nodeNames = deviceId.getNodes(); MetaFormatUtils.checkTimeseries(deviceId); - ICachedMNode cur = storageGroupMNode; + ICachedMNode cur = databaseMNode; ICachedMNode child; try { for (int i = levelOfSG + 1; i < nodeNames.length; i++) { @@ -983,7 +983,7 @@ protected Void collectEntity(IDeviceMNode node) { */ public ICachedMNode getNodeByPath(PartialPath path) throws MetadataException { String[] nodes = path.getNodes(); - ICachedMNode cur = storageGroupMNode; + ICachedMNode cur = databaseMNode; ICachedMNode next; try { for (int i = levelOfSG + 1; i < nodes.length; i++) { @@ -1164,7 +1164,7 @@ public void alterLogicalView(PartialPath path, ViewExpression expression) public void activateTemplate(PartialPath activatePath, Template template) throws MetadataException { String[] nodes = activatePath.getNodes(); - ICachedMNode cur = storageGroupMNode; + ICachedMNode cur = databaseMNode; ICachedMNode child; IDeviceMNode entityMNode; @@ -1211,7 +1211,7 @@ public void activateTemplate(PartialPath activatePath, Template template) public void activateTemplateWithoutCheck( PartialPath activatePath, int templateId, boolean isAligned) throws MetadataException { String[] nodes = activatePath.getNodes(); - ICachedMNode cur = storageGroupMNode; + ICachedMNode cur = databaseMNode; ICachedMNode child; IDeviceMNode entityMNode; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/buffer/NodeBuffer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/buffer/NodeBuffer.java index 546d1df726b99..f920c17b6c0ee 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/buffer/NodeBuffer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/buffer/NodeBuffer.java @@ -93,7 +93,7 @@ private void addNonVolatileAncestorToBuffer(ICachedMNode node) { CacheEntry cacheEntry = parent.getCacheEntry(); // make sure that the nodeBuffer contains all the root node of volatile subTree - // give that root.sg.d.s, if sg and d have been persisted and s are volatile, then d + // give that root.db.d.s, if db and d have been persisted and s are volatile, then d // will be added to nodeBuffer synchronized (cacheEntry) { // the cacheEntry may be set to volatile concurrently, the unVolatile node should not be diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/ISchemaFile.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/ISchemaFile.java index 477c14148aa69..f2efb435bcf84 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/ISchemaFile.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/ISchemaFile.java @@ -38,10 +38,10 @@ public interface ISchemaFile { /** * Modify header of pbtree file corresponding to the database node synchronously * - * @param sgNode node to be updated + * @param dbNode node to be updated * @return true if success */ - boolean updateDatabaseNode(IDatabaseMNode sgNode) throws IOException; + boolean updateDatabaseNode(IDatabaseMNode dbNode) throws IOException; /** * Only database node along with its descendents could be flushed into pbtree file. diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java index 45fe9015b1a48..2b2b38b3ba408 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java @@ -61,9 +61,9 @@ public ICachedMNode init() { } @Override - public synchronized boolean updateDatabaseNode(IDatabaseMNode sgNode) + public synchronized boolean updateDatabaseNode(IDatabaseMNode dbNode) throws IOException { - this.storageGroupMNode = cloneMNode(sgNode.getAsMNode()).getAsDatabaseMNode(); + this.storageGroupMNode = cloneMNode(dbNode.getAsMNode()).getAsDatabaseMNode(); return true; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/SchemaFile.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/SchemaFile.java index 692736474bad1..6264cbb9d6897 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/SchemaFile.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/SchemaFile.java @@ -69,11 +69,11 @@ public class SchemaFile implements ISchemaFile { // TODO: Useless private long dataTTL; private boolean isEntity; - private int sgNodeTemplateIdWithState; + private int dbNodeTemplateIdWithState; private ByteBuffer headerContent; private int lastPageIndex; // last page index of the file, boundary to grow - private long lastSGAddr; // last segment of database node + private long lastDBAddr; // last segment of database node private IPageManager pageManager; @@ -84,10 +84,10 @@ public class SchemaFile implements ISchemaFile { private final IMNodeFactory nodeFactory = MNodeFactoryLoader.getInstance().getCachedMNodeIMNodeFactory(); - private static String getDirPath(String sgName, int schemaRegionId) { + private static String getDirPath(String dbName, int schemaRegionId) { return SchemaFileConfig.SCHEMA_FOLDER + File.separator - + sgName + + dbName + File.separator + schemaRegionId; } @@ -97,10 +97,10 @@ private static String getDirPath(String sgName, int schemaRegionId) { // todo refactor constructor for schema file in Jan. @SuppressWarnings("java:S899") private SchemaFile( - String sgName, int schemaRegionId, boolean override, long ttl, boolean isEntity) + String dbName, int schemaRegionId, boolean override, long ttl, boolean isEntity) throws IOException, MetadataException { - String dirPath = getDirPath(sgName, schemaRegionId); - this.storageGroupName = sgName; + String dirPath = getDirPath(dbName, schemaRegionId); + this.storageGroupName = dbName; this.filePath = dirPath + File.separator + SchemaConstant.PBTREE_FILE_NAME; this.logPath = dirPath + File.separator + SchemaConstant.PBTREE_LOG_FILE_NAME; @@ -126,7 +126,7 @@ private SchemaFile( // will be overwritten if to init this.dataTTL = ttl; this.isEntity = isEntity; - this.sgNodeTemplateIdWithState = -1; + this.dbNodeTemplateIdWithState = -1; initFileHeader(); } @@ -148,13 +148,13 @@ private SchemaFile(File file) throws IOException, MetadataException { } // load or init - public static SchemaFile initSchemaFile(String sgName, int schemaRegionId) + public static SchemaFile initSchemaFile(String dbName, int schemaRegionId) throws IOException, MetadataException { File pmtFile = SystemFileFactory.INSTANCE.getFile( - getDirPath(sgName, schemaRegionId) + File.separator + SchemaConstant.PBTREE_FILE_NAME); + getDirPath(dbName, schemaRegionId) + File.separator + SchemaConstant.PBTREE_FILE_NAME); return new SchemaFile( - sgName, + dbName, schemaRegionId, !pmtFile.exists() || IoTDBDescriptor.getInstance() @@ -165,9 +165,9 @@ public static SchemaFile initSchemaFile(String sgName, int schemaRegionId) false); } - public static SchemaFile loadSchemaFile(String sgName, int schemaRegionId) + public static SchemaFile loadSchemaFile(String dbName, int schemaRegionId) throws IOException, MetadataException { - return new SchemaFile(sgName, schemaRegionId, false, -1L, false); + return new SchemaFile(dbName, schemaRegionId, false, -1L, false); } public static SchemaFile loadSchemaFile(File file) throws IOException, MetadataException { @@ -182,21 +182,21 @@ public static SchemaFile loadSchemaFile(File file) throws IOException, MetadataE @Override public ICachedMNode init() throws MetadataException { ICachedMNode resNode; - String[] sgPathNodes = + String[] dbPathNodes = storageGroupName == null ? new String[] {"noName"} : PathUtils.splitPathToDetachedNodes(storageGroupName); if (isEntity) { resNode = setNodeAddress( - nodeFactory.createDatabaseDeviceMNode(null, sgPathNodes[sgPathNodes.length - 1]), 0L); - resNode.getAsDeviceMNode().setSchemaTemplateId(sgNodeTemplateIdWithState); - resNode.getAsDeviceMNode().setUseTemplate(sgNodeTemplateIdWithState > -1); + nodeFactory.createDatabaseDeviceMNode(null, dbPathNodes[dbPathNodes.length - 1]), 0L); + resNode.getAsDeviceMNode().setSchemaTemplateId(dbNodeTemplateIdWithState); + resNode.getAsDeviceMNode().setUseTemplate(dbNodeTemplateIdWithState > -1); } else { resNode = setNodeAddress( nodeFactory - .createDatabaseMNode(null, sgPathNodes[sgPathNodes.length - 1]) + .createDatabaseMNode(null, dbPathNodes[dbPathNodes.length - 1]) .getAsMNode(), 0L); } @@ -205,10 +205,10 @@ public ICachedMNode init() throws MetadataException { } @Override - public boolean updateDatabaseNode(IDatabaseMNode sgNode) throws IOException { - this.isEntity = sgNode.isDevice(); - if (sgNode.isDevice()) { - this.sgNodeTemplateIdWithState = sgNode.getAsDeviceMNode().getSchemaTemplateIdWithState(); + public boolean updateDatabaseNode(IDatabaseMNode dbNode) throws IOException { + this.isEntity = dbNode.isDevice(); + if (dbNode.isDevice()) { + this.dbNodeTemplateIdWithState = dbNode.getAsDeviceMNode().getSchemaTemplateIdWithState(); } updateHeaderBuffer(); return true; @@ -230,7 +230,7 @@ public void writeMNode(ICachedMNode node) throws MetadataException, IOException if (node.isDatabase()) { isEntity = node.isDevice(); - setNodeAddress(node, lastSGAddr); + setNodeAddress(node, lastDBAddr); } else { if (curSegAddr < 0L) { if (node.isDevice() && node.getAsDeviceMNode().isUseTemplate()) { @@ -311,9 +311,9 @@ public String inspect(PrintWriter pw) throws MetadataException, IOException { + "== Internal/Entity presents as (name, is_aligned, child_segment_address)\n" + "== Measurement presents as (name, data_type, encoding, compressor, alias_if_exist)\n" + "=============================\n" - + "Belong to StorageGroup: [%s], segment of SG:%s, total pages:%d\n", + + "Belong to StorageGroup: [%s], segment of DB:%s, total pages:%d\n", storageGroupName == null ? "NOT SPECIFIED" : storageGroupName, - Long.toHexString(lastSGAddr), + Long.toHexString(lastDBAddr), lastPageIndex + 1); if (pw == null) { pw = new PrintWriter(System.out); @@ -334,13 +334,13 @@ public String inspect(PrintWriter pw) throws MetadataException, IOException { * *

    *
  • 1 int (4 bytes): last page index {@link #lastPageIndex} - *
  • var length: root(SG) node info + *
  • var length: root(DB) node info *
      - *
    • a. var length string (less than 200 bytes): path to root(SG) node + *
    • a. var length string (less than 200 bytes): path to root(DB) node *
    • a. 1 long (8 bytes): dataTTL {@link #dataTTL} *
    • b. 1 bool (1 byte): isEntityStorageGroup {@link #isEntity} - *
    • c. 1 int (4 bytes): hash code of template name {@link #sgNodeTemplateIdWithState} - *
    • d. 1 long (8 bytes): last segment address of database {@link #lastSGAddr} + *
    • c. 1 int (4 bytes): hash code of template name {@link #dbNodeTemplateIdWithState} + *
    • d. 1 long (8 bytes): last segment address of database {@link #lastDBAddr} *
    • e. 1 int (4 bytes): version of pbtree file {@linkplain * SchemaFileConfig#SCHEMA_FILE_VERSION} *
    @@ -355,9 +355,9 @@ private void initFileHeader() throws IOException, MetadataException { ReadWriteIOUtils.write(lastPageIndex, headerContent); ReadWriteIOUtils.write(dataTTL, headerContent); ReadWriteIOUtils.write(isEntity, headerContent); - ReadWriteIOUtils.write(sgNodeTemplateIdWithState, headerContent); + ReadWriteIOUtils.write(dbNodeTemplateIdWithState, headerContent); ReadWriteIOUtils.write(SchemaFileConfig.SCHEMA_FILE_VERSION, headerContent); - lastSGAddr = 0L; + lastDBAddr = 0L; pageManager = new BTreePageManager(channel, pmtFile, -1, logPath); } else { channel.read(headerContent); @@ -365,8 +365,8 @@ private void initFileHeader() throws IOException, MetadataException { lastPageIndex = ReadWriteIOUtils.readInt(headerContent); dataTTL = ReadWriteIOUtils.readLong(headerContent); isEntity = ReadWriteIOUtils.readBool(headerContent); - sgNodeTemplateIdWithState = ReadWriteIOUtils.readInt(headerContent); - lastSGAddr = ReadWriteIOUtils.readLong(headerContent); + dbNodeTemplateIdWithState = ReadWriteIOUtils.readInt(headerContent); + lastDBAddr = ReadWriteIOUtils.readLong(headerContent); if (ReadWriteIOUtils.readInt(headerContent) != SchemaFileConfig.SCHEMA_FILE_VERSION) { channel.close(); @@ -383,8 +383,8 @@ private void updateHeaderBuffer() throws IOException { ReadWriteIOUtils.write(pageManager.getLastPageIndex(), headerContent); ReadWriteIOUtils.write(dataTTL, headerContent); ReadWriteIOUtils.write(isEntity, headerContent); - ReadWriteIOUtils.write(sgNodeTemplateIdWithState, headerContent); - ReadWriteIOUtils.write(lastSGAddr, headerContent); + ReadWriteIOUtils.write(dbNodeTemplateIdWithState, headerContent); + ReadWriteIOUtils.write(lastDBAddr, headerContent); ReadWriteIOUtils.write(SchemaFileConfig.SCHEMA_FILE_VERSION, headerContent); headerContent.flip(); @@ -478,7 +478,7 @@ public boolean createSnapshot(File snapshotDir) { } } - public static SchemaFile loadSnapshot(File snapshotDir, String sgName, int schemaRegionId) + public static SchemaFile loadSnapshot(File snapshotDir, String dbName, int schemaRegionId) throws IOException, MetadataException { File snapshot = SystemFileFactory.INSTANCE.getFile(snapshotDir, SchemaConstant.PBTREE_SNAPSHOT); if (!snapshot.exists()) { @@ -486,7 +486,7 @@ public static SchemaFile loadSnapshot(File snapshotDir, String sgName, int schem } File schemaFile = SystemFileFactory.INSTANCE.getFile( - getDirPath(sgName, schemaRegionId), SchemaConstant.PBTREE_FILE_NAME); + getDirPath(dbName, schemaRegionId), SchemaConstant.PBTREE_FILE_NAME); Files.deleteIfExists(schemaFile.toPath()); if (!IoTDBDescriptor.getInstance() @@ -496,12 +496,12 @@ public static SchemaFile loadSnapshot(File snapshotDir, String sgName, int schem // schemaFileLog disabled with RATIS consensus File schemaLogFile = SystemFileFactory.INSTANCE.getFile( - getDirPath(sgName, schemaRegionId), SchemaConstant.PBTREE_LOG_FILE_NAME); + getDirPath(dbName, schemaRegionId), SchemaConstant.PBTREE_LOG_FILE_NAME); Files.deleteIfExists(schemaLogFile.toPath()); } Files.copy(snapshot.toPath(), schemaFile.toPath()); - return new SchemaFile(sgName, schemaRegionId, false, Long.MAX_VALUE, false); + return new SchemaFile(dbName, schemaRegionId, false, Long.MAX_VALUE, false); } // endregion diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/Traverser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/Traverser.java index 211f9e1999911..c04e8072443cc 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/Traverser.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/Traverser.java @@ -82,7 +82,7 @@ public abstract class Traverser> extends AbstractTreeVisi protected Traverser() {} /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/DatabaseTraverser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/DatabaseTraverser.java index 46d1365a2c456..7ffb3a8388198 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/DatabaseTraverser.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/DatabaseTraverser.java @@ -31,7 +31,7 @@ public abstract class DatabaseTraverser> extends Traverse protected boolean collectInternal = false; /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/EntityTraverser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/EntityTraverser.java index 740f6133a549c..715975df1537d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/EntityTraverser.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/EntityTraverser.java @@ -32,7 +32,7 @@ public abstract class EntityTraverser> extends Traverser< private int schemaTemplateId = -1; /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MNodeTraverser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MNodeTraverser.java index 97dba7fc4108c..79de82e9c24c0 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MNodeTraverser.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MNodeTraverser.java @@ -33,12 +33,12 @@ */ public abstract class MNodeTraverser> extends Traverser { - // Level query option started from 0. For example, level of root.sg.d1.s1 is 3. + // Level query option started from 0. For example, level of root.db.d1.s1 is 3. protected int targetLevel = -1; protected N lastVisitNode = null; /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MeasurementTraverser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MeasurementTraverser.java index 4996e3f0c8b36..675ba200fac89 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MeasurementTraverser.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MeasurementTraverser.java @@ -28,7 +28,7 @@ public abstract class MeasurementTraverser> extends Traverser { /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/EntityUpdater.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/EntityUpdater.java index 4641bffcf93f0..94a54aec3a0bc 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/EntityUpdater.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/EntityUpdater.java @@ -30,7 +30,7 @@ public abstract class EntityUpdater> extends EntityTraverser implements Updater { /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/MeasurementUpdater.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/MeasurementUpdater.java index d8b6ef036210b..ee07da07fde7d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/MeasurementUpdater.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/MeasurementUpdater.java @@ -29,7 +29,7 @@ public abstract class MeasurementUpdater> extends MeasurementTraverser implements Updater { /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/tag/TagManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/tag/TagManager.java index 86e2a65631434..c0e0740ecf1c8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/tag/TagManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/tag/TagManager.java @@ -80,9 +80,9 @@ public class TagManager { private final MemSchemaRegionStatistics regionStatistics; - public TagManager(String sgSchemaDirPath, MemSchemaRegionStatistics regionStatistics) + public TagManager(String dbSchemaDirPath, MemSchemaRegionStatistics regionStatistics) throws IOException { - tagLogFile = new TagLogFile(sgSchemaDirPath, SchemaConstant.TAG_LOG); + tagLogFile = new TagLogFile(dbSchemaDirPath, SchemaConstant.TAG_LOG); this.regionStatistics = regionStatistics; } @@ -127,18 +127,18 @@ public synchronized boolean createSnapshot(final File targetDir) { } public static TagManager loadFromSnapshot( - File snapshotDir, String sgSchemaDirPath, MemSchemaRegionStatistics regionStatistics) + File snapshotDir, String dbSchemaDirPath, MemSchemaRegionStatistics regionStatistics) throws IOException { File tagSnapshot = SystemFileFactory.INSTANCE.getFile(snapshotDir, SchemaConstant.TAG_LOG_SNAPSHOT); - File tagFile = SystemFileFactory.INSTANCE.getFile(sgSchemaDirPath, SchemaConstant.TAG_LOG); + File tagFile = SystemFileFactory.INSTANCE.getFile(dbSchemaDirPath, SchemaConstant.TAG_LOG); if (tagFile.exists() && !tagFile.delete()) { logger.warn("Failed to delete existing {} when loading snapshot.", tagFile.getName()); } try { org.apache.tsfile.external.commons.io.FileUtils.copyFile(tagSnapshot, tagFile); - return new TagManager(sgSchemaDirPath, regionStatistics); + return new TagManager(dbSchemaDirPath, regionStatistics); } catch (IOException e) { if (!tagFile.delete()) { logger.warn( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/MetaUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/MetaUtils.java index 11b41b238a340..5801ec6c2238d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/MetaUtils.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/MetaUtils.java @@ -64,7 +64,7 @@ public static PartialPath getDatabasePathByLevel(PartialPath path, int level) String[] nodeNames = path.getNodes(); if (nodeNames.length <= level) { throw new IllegalPathException( - path.getFullPath(), "it is no longer than default sg level: " + level); + path.getFullPath(), "it is no longer than default db level: " + level); } if (!nodeNames[0].equals(IoTDBConstant.PATH_ROOT)) { throw new IllegalPathException( @@ -77,8 +77,8 @@ public static PartialPath getDatabasePathByLevel(PartialPath path, int level) /** * PartialPath of aligned time series will be organized to one AlignedPath. BEFORE this method, - * all the aligned time series is NOT united. For example, given root.sg.d1.vector1[s1] and - * root.sg.d1.vector1[s2], they will be organized to root.sg.d1.vector1 [s1,s2] + * all the aligned time series is NOT united. For example, given root.db.d1.vector1[s1] and + * root.db.d1.vector1[s2], they will be organized to root.db.d1.vector1 [s1,s2] * * @param fullPaths full path list without uniting the sub measurement under the same aligned time * series. The list has been sorted by the alphabetical order, so all the aligned time series @@ -111,8 +111,8 @@ public static List groupAlignedPaths(List fullPaths) { /** * PartialPath of aligned time series will be organized to one AlignedPath. BEFORE this method, - * all the aligned time series is NOT united. For example, given root.sg.d1.vector1[s1] and - * root.sg.d1.vector1[s2], they will be organized to root.sg.d1.vector1 [s1,s2] + * all the aligned time series is NOT united. For example, given root.db.d1.vector1[s1] and + * root.db.d1.vector1[s2], they will be organized to root.db.d1.vector1 [s1,s2] * * @param fullPaths full path list without uniting the sub measurement under the same aligned time * series. The list has been sorted by the alphabetical order, so all the aligned time series diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/template/ClusterTemplateManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/template/ClusterTemplateManager.java index ac89c86b819d9..5f7c042700179 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/template/ClusterTemplateManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/template/ClusterTemplateManager.java @@ -397,14 +397,14 @@ public List