diff --git a/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp b/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp index 2cc04ab3b394..77010951ccf4 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 2803d18976cb..e941d2b30cbb 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 efd944907975..50dfd781d823 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 98d75a398845..4d1ea498ef00 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 421dcd8b7263..5f0427527266 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 ec15ad23567a..c84ead139bed 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 2bd5efdd9daa..3c397e69058a 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 bccc2fd25494..53893da866ee 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 a3dbbceafc7f..2a543d8d62a1 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/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java b/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java index 288bd65ddcb4..529212cf14c3 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 34f529d257db..2e4d052e9314 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 40d3ed12e809..077f49d6c629 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 c9e8d42aacf5..fd422fdfd7c1 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); } } @@ -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 ea5cdccb5970..9827f105fade 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"); @@ -101,13 +101,35 @@ private static void insertRecord() throws StatementExecutionException, IoTDBConn } } + private static void queryByRowRecord() { + for (int i = 0; i < 1; i++) { + service.submit( + () -> { + SessionDataSetWrapper wrapper = null; + try { + wrapper = sessionPool.executeQueryStatement("select * from root.db1.d1"); + System.out.println(wrapper.getColumnNames()); + System.out.println(wrapper.getColumnTypes()); + while (wrapper.hasNext()) { + System.out.println(wrapper.next()); + } + } catch (IoTDBConnectionException | StatementExecutionException e) { + LOGGER.error("Query by row record error", e); + } finally { + // remember to close data set finally! + sessionPool.closeResultSet(wrapper); + } + }); + } + } + private static void queryByIterator() { for (int i = 0; i < 1; i++) { service.submit( () -> { 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 6f4d503bce0f..960b1614da80 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 ada3646fccea..248f2916f836 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 f85dba2215b7..691717a593af 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 540f6bcef5cc..3216b35651a1 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 6d910284e4bb..def7c689946a 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 b6176ffdde9a..7330d476e90c 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 a5c757d8dd36..7bda2a9b7b02 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 959f37d594d5..99ab525fb6f2 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,26 +161,26 @@ 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); + List dbs = Arrays.asList(db0, db1); + deleteDatabasesReq.setPrefixPathList(dbs); TSStatus deleteSgStatus = 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()); } 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 2246ce4314a6..6c05f78cf8eb 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,8 +88,8 @@ private void switchLeader() throws IOException, InterruptedException { @Test public void basicDataInheritIT() throws Exception { - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String sg0 = "root.db0"; + final String sg1 = "root.db1"; final String d00 = sg0 + ".d0.s"; final String d01 = sg0 + ".d1.s"; final String d10 = sg1 + ".d0.s"; 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 64b35875a203..cdf9b2cf17f8 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,7 +62,7 @@ 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 String db = "root.db"; private static final int testSgNum = 2; @Before @@ -96,7 +96,7 @@ public void testCustomRegionGroupExtensionPolicy() throws Exception { (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { for (int i = 0; i < testSgNum; i++) { - String curSg = sg + 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 954f54e01bd0..ce00c24025bd 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 8d6e4a5f8311..717bb6dc0c6a 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 f110d4a8d28f..9b3640c62a79 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 allSg0 = "root.db0.**"; - final String notExistsSg = "root.sg10.**"; + final String notExistsSg = "root.db10.**"; try (SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { @@ -240,8 +240,8 @@ 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 "*", @@ -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,7 +394,7 @@ public void testGetSlots() throws Exception { // Get all RegionIds within database for (int i = 0; i < databaseNum; i++) { - String curSg = sg + i; + String curSg = db + i; getRegionIdReq = new TGetRegionIdReq(TConsensusGroupType.DataRegion); getRegionIdReq.setDatabase(curSg); getRegionIdResp = client.getRegionId(getRegionIdReq); @@ -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 469d6974cb58..ce4e0b97c5ab 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 8e2a954dc91c..a6b1487cda19 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 3dc4468e5269..af39e9c21dd8 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 6112fea7f525..c29547818a56 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 0697a6c674d2..d125c6aaae14 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 ee0ee073c964..53679a9aefe8 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 620043e6c7b7..5f26d3d772d2 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 17ceb9b69625..fc976d5c95f5 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 d51a058ec51d..1afa03a4ec96 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 b8dd88ea9d71..c5ae6b3f8159 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 4fd8c2dee4e3..5f14368a0030 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 fac1175f74e4..e6baf334a62a 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 18c00b125dd1..1e03bbc308e0 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 47f1e8f67dfe..bcd842769dcc 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 62d04de083a7..16b36b9e4788 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 8e82865f8c22..01c01be0ff6d 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 755b3aef7586..949c3802e283 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)); @@ -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.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 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 928c7875b19a..fc3abfc4ae16 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 @@ -98,7 +98,7 @@ public void setUp() throws Exception { @After public void tearDown() throws Exception { - deleteSG(); + deleteDB(); EnvFactory.getEnv().cleanClusterEnvironment(); if (!deleteDir()) { @@ -162,7 +162,7 @@ private String convert2AlignedSQL(final String device, final 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 5472fabec5e1..d6126135dcb7 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 d84a2493cc25..58b4923ec239 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,13 +452,13 @@ 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( @@ -476,13 +476,13 @@ public void insertAndQuery() { 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,13 +546,13 @@ 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( @@ -570,13 +570,13 @@ public void insertAndQuery() { 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( @@ -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 571826307c66..e5d5d3cdea9e 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 96ee0bc30c1c..b9706dc746b5 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 c56c0077f29e..3d57a5ee06b7 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 c21e4e347c4d..43bdb28501eb 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 6da6a3b18030..4448736a1bea 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,14 +184,14 @@ 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()); @@ -204,7 +204,7 @@ public void testStringLiteralIllegalCase() { 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()); @@ -217,7 +217,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(errorMsg2, e.getMessage()); @@ -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()); @@ -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 a0ad94a99444..351243e9d651 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 @@ -163,22 +163,22 @@ public void testTTL() throws SQLException, InterruptedException { } 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 222988de43dc..10397d1f904f 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 524d0770a6c0..785771168f22 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 23f55af0ffd9..5cd0feabd525 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 bb7a2645b0c3..59ade50f2864 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 cf3a5d6cea80..f9ec723f4e88 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 540c8bc66719..6e581f8deb74 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 38f2a9616464..a8a02aa10640 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 82758290dbbc..d560debee81b 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 095783fdd20b..7909a44cf5f7 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 17368548d859..63c03d9d3b4e 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 8d69a09e8972..36f13110e401 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 d16587ac4535..45b7e4fe8bb9 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 514757ccbaca..3944132a6f0f 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 64ef12685312..0e43f359dc0f 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 2242398103fb..acc67bbf529a 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 a8fcf713bcda..a8f1ccfcf1a6 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 f2827a765902..5a7508550712 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 5bcc8e5eb7de..a1ed00dddaca 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 de074bfe88c7..a8dddc4cd4ef 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 7b228b700b81..deb58646555c 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 46b964a78adb..85988127fa7d 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 3461bbb32b2f..1144dfcc28c6 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 530e0189c52e..638fc6b1447b 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 244e86a6d8b0..314c287f83be 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 1ac466653f6b..b23fcc358724 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 0810a0abe595..97ff1ad57577 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 f02e2fd6ec8a..f19c044bae53 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 25b6a2098c9c..3a209b74d723 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 efc2d65dd918..65da25398685 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 eaa134759c38..0ad7c3b39098 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 f9639d3ea2d2..0b0ae45deae9 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 01e9466fcbab..dee36b10de1b 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 5bd02dbacacc..1b8cba96daa7 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 441dd1fdb5c9..cddb2343569b 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 @@ -200,13 +200,13 @@ public void testSetDeleteSG() throws SQLException { 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"); 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()); } @@ -356,23 +356,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)); } } } @@ -883,8 +883,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()); } } @@ -895,19 +895,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); @@ -916,11 +916,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)); @@ -1170,27 +1170,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))); @@ -1204,9 +1204,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 ad34c1cc0b9d..ee548c6ef064 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 2ebdd37758fe..52825f562b36 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 4f17b9b3de2a..bfd3d82b3530 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 b2c02164c31a..e10f3d9be406 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 fb14be551e09..9cd899b4559f 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 12c608562348..c0360027f755 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 15e2d400497c..dc800af5ed2b 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 ea00bbfa646a..ddd06b3cb4cd 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 80acdb140872..2271481919f6 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 c9971af3afb2..43c1a8a6f082 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 399694b5e2ce..ab49cdcd07b7 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 f518749b0325..4bfdd76b07e7 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 92af9934da95..cda9fd8a43c5 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 9d56acf518fb..a2057752896a 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 807ecf6620e3..ec7803921084 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 eb4bfec938f9..81e1c2daa5b4 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 a15991c48768..3899c8f6b5fe 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/IoTDBLeftORightCIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBLeftORightCIT.java index 82e32b314db8..6aa04c304d2b 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 1c69857a3c50..21683fe61f49 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 995367f10ad1..f3e9fe3b8915 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 b69af5ab0172..2ba3b7269127 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 7f84a2df9006..212c11cd3393 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 0ddb6ea2f24c..b34306fb2ff3 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/IoTDBArithmeticIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticIT.java index 6c54b7f18753..ee3a819ea16d 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 a88b89e90b5d..ea98a85088d2 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 45bf938d71f3..e99faac4e8d8 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 a83db53570d1..1ca8f2223fbf 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 8989d8a450c2..97284c18263e 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/IoTDBNullValueFillIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullValueFillIT.java index 3ca0d6bef6bf..b2e8198a7cff 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 198ea449dcc7..dd4b592abf28 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 fa89c6ebc999..c2b45219c1ed 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 1b907a23d13f..629095faebdb 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[] {}; @@ -120,14 +120,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)); } @@ -141,7 +141,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 @@ -181,7 +181,7 @@ public void emptyShowTimeseriesTest() { + "," + ColumnHeaderConstant.VIEW_TYPE + ","; - resultSetEqualTest("show timeseries root.sg1.**", expectedHeader, emptyResultSet); + resultSetEqualTest("show timeseries root.db1.**", expectedHeader, emptyResultSet); } @Test @@ -195,7 +195,7 @@ public void emptyShowDeviceTest() { + "," + ColumnHeaderConstant.COLUMN_TTL + ","; - resultSetEqualTest("show devices root.sg1.**", expectedHeader, emptyResultSet); + resultSetEqualTest("show devices root.db1.**", expectedHeader, emptyResultSet); } @Test @@ -205,20 +205,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(); @@ -248,6 +248,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 ddddf58725f5..8bdfa0916820 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 3fdf6f93d143..c7cb573638cf 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 7ed80f7ab4ad..b8bc752a2dfc 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/IoTDBAlterTimeSeriesTypeIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAlterTimeSeriesTypeIT.java index 3745f832d34e..c62f9e2392b3 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAlterTimeSeriesTypeIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAlterTimeSeriesTypeIT.java @@ -891,13 +891,13 @@ public void testLoadAndAccumulator() } try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - if (!session.checkTimeseriesExists("root.sg1.d1.s1")) { + if (!session.checkTimeseriesExists("root.db1.d1.s1")) { session.createTimeseries( - "root.sg1.d1.s1", TSDataType.DOUBLE, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db1.d1.s1", TSDataType.DOUBLE, 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.DOUBLE, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db1.d1.s2", TSDataType.DOUBLE, TSEncoding.RLE, CompressionType.SNAPPY); } Double firstValue = null; @@ -909,7 +909,7 @@ public void testLoadAndAccumulator() List filesToLoad = new ArrayList<>(); for (int i = 1; i <= 3; i++) { File file = new File("target", "f" + i + ".tsfile"); - List columnNames = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List columnNames = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List columnTypes = Arrays.asList("DOUBLE", "DOUBLE"); if (file.exists()) { @@ -921,7 +921,7 @@ public void testLoadAndAccumulator() Map> deviceColumnIndices = new HashMap<>(); Set alignedDevices = new HashSet<>(); Map> deviceSchemaMap = new LinkedHashMap<>(); - // deviceSchemaMap.put("root.sg1.d1", new ArrayList<>()); + // deviceSchemaMap.put("root.db1.d1", new ArrayList<>()); collectSchemas( session, @@ -972,7 +972,7 @@ public void testLoadAndAccumulator() filesToLoad.clear(); // check load result - SessionDataSet dataSet = session.executeQueryStatement("select count(s1) from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select count(s1) from root.db1.d1"); RowRecord rec; rec = dataSet.next(); assertEquals(3, rec.getFields().get(0).getLongV()); @@ -983,7 +983,7 @@ public void testLoadAndAccumulator() // file4-file6 for (int i = 4; i <= 6; i++) { File file = new File("target", "f" + i + ".tsfile"); - List columnNames = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List columnNames = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List columnTypes = Arrays.asList("INT32", "INT32"); if (file.exists()) { @@ -1034,17 +1034,17 @@ public void testLoadAndAccumulator() } // check load result - dataSet = session.executeQueryStatement("select count(s1) from root.sg1.d1"); + dataSet = session.executeQueryStatement("select count(s1) from root.db1.d1"); rec = dataSet.next(); assertEquals(6, rec.getFields().get(0).getLongV()); assertFalse(dataSet.hasNext()); - dataSet = session.executeQueryStatement("select first_value(s1) from root.sg1.d1"); + dataSet = session.executeQueryStatement("select first_value(s1) from root.db1.d1"); rec = dataSet.next(); assertEquals(firstValue.doubleValue(), rec.getFields().get(0).getDoubleV(), 0.001); assertFalse(dataSet.hasNext()); - dataSet = session.executeQueryStatement("select last_value(s1) from root.sg1.d1"); + dataSet = session.executeQueryStatement("select last_value(s1) from root.db1.d1"); rec = dataSet.next(); assertEquals(lastValue.doubleValue(), rec.getFields().get(0).getDoubleV(), 0.001); assertFalse(dataSet.hasNext()); @@ -1057,7 +1057,7 @@ public void testLoadAndAccumulator() resourceFile.delete(); }); filesToLoad.clear(); - session.executeNonQueryStatement("DELETE TIMESERIES root.sg1.d1.s1"); + session.executeNonQueryStatement("DELETE TIMESERIES root.db1.d1.s1"); } } 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 620411b8c78c..4c325f14fc57 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 5478c7e341e4..7a7e614db60a 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 7b784c034ab6..1536efee97b0 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 8681878d254c..c1d0b06e88e5 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 b2b6f1c1078a..419f75e30a63 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 22572aac6eeb..9359874c7ac4 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 2ade000fbb66..c0f02f111d30 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 4de6b726d44e..11bb3770dce9 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 0866b37836e2..9dfc4c9df11e 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 1b6818d39f0a..8f42063d3bc9 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 822cca2e78ce..9c0171799120 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 e910918e1c48..3afa41b07536 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 8eea7fc04709..dfc3fa1c7b23 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 7b4f5ab78b03..f767f2999c75 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 2f614a4763d9..3f1198161dde 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 124b37323036..5fe7a3ffadb4 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 c0e7673d7d64..8145a3ee5c19 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 a728ac49e699..b07ecccc6905 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 @@ -55,38 +55,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", @@ -103,12 +103,12 @@ 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 : TSDataTypeTestUtils.getSupportedTypes()) { 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)); } } @@ -116,7 +116,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, @@ -170,39 +170,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); } @@ -211,18 +211,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,", @@ -239,7 +239,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); } @@ -247,7 +247,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[] {}); } @@ -255,23 +255,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); } @@ -280,24 +280,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); } @@ -306,17 +306,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,", @@ -332,37 +332,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 ------------------------------------- @@ -371,39 +371,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); } @@ -412,18 +412,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,", @@ -440,13 +440,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[] {}); } @@ -454,23 +454,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); } @@ -479,24 +479,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); } @@ -505,22 +505,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,", @@ -537,24 +537,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 = @@ -574,19 +574,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); } @@ -598,14 +598,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( @@ -621,12 +621,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( @@ -643,112 +643,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,", @@ -765,7 +765,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); } @@ -812,23 +812,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); } @@ -837,21 +837,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 6ccc2d327208..a25b5d057a09 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 c327d6301d0f..c108782d49dc 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 839aea68522e..efe01d6adc36 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 35447f295747..4263cd47474d 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/IoTDBUDAFMiscIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFMiscIT.java index fc4bbf588157..33073173d180 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 82f61879dd77..15428a56d3e0 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 46f0a35a249e..9cee6bec0f29 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 06464debd9ea..7e7b6d65874e 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 c2a2db78b36d..42ed5cecc562 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 e3955df58d60..eb0e2a74b449 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 61de72829ccc..32f97e990160 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 93e7a09bb51a..297c3fe0cbc6 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 798f1b2b889d..9f39b00e2a27 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/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 85f3b93aa763..e88d786473e2 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 c21e6456ef14..e2a679560ca1 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 @@ -87,10 +87,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); @@ -99,7 +99,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 f1a623143aad..292073169cf4 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 @@ -403,15 +403,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 sourceAttributes = new HashMap<>(); @@ -438,7 +438,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 53da5d3f498a..37c1d712a806 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 e3f6b3a95779..50c00d0aa535 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); }); } @@ -228,7 +228,7 @@ private void testInsertNullValueTemplate( if (withParsing) { sourceAttributes.put("start-time", "1970-01-01T08:00:00.000+08:00"); sourceAttributes.put("end-time", "1970-01-01T09:00:00.000+08:00"); - sourceAttributes.put("source.pattern", "root.sg.d1"); + sourceAttributes.put("source.pattern", "root.db.d1"); } final TSStatus status = @@ -250,8 +250,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 76b008166067..ee7775a3e223 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 @@ -220,40 +220,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 5f936cda5161..4731b56a2ce0 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 @@ -284,9 +284,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 sourceAttributes = new HashMap<>(); @@ -315,13 +315,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 faafc5bf9139..79cf22eddc46 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 sourceAttributes = new HashMap<>(); @@ -89,7 +89,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( @@ -99,7 +99,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 89f1c3fb4401..2ec5770f1f68 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/single/IoTDBPipeSingleEnvDemoIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/single/IoTDBPipeSingleEnvDemoIT.java index a8c2990c5f78..4288b189bb6e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/single/IoTDBPipeSingleEnvDemoIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/single/IoTDBPipeSingleEnvDemoIT.java @@ -41,11 +41,11 @@ public class IoTDBPipeSingleEnvDemoIT extends AbstractPipeSingleIT { public void testSingleEnv() throws Exception { try (final SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) env.getLeaderConfigNodeConnection()) { - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); final Map connectorAttributes = new HashMap<>(); - extractorAttributes.put("extractor.realtime.mode", "log"); + sourceAttributes.put("source.realtime.mode", "log"); connectorAttributes.put("connector", "iotdb-thrift-connector"); connectorAttributes.put("connector.ip", "127.0.0.1"); @@ -54,7 +54,7 @@ public void testSingleEnv() throws Exception { final TSStatus status = client.createPipe( new TCreatePipeReq("testPipe", connectorAttributes) - .setExtractorAttributes(extractorAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes)); Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode()); } 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 3f2cab345018..607aa516bfa0 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 @@ -106,14 +106,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 cda57e726ea9..a1d18062153e 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/query/old/IoTDBFilterTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterTableIT.java index 7ecc9673b234..ddde07b8d2a7 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 @@ -201,10 +201,10 @@ public void testMismatchedDataTypes() { 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.");*/ } 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 b97dc4915a1d..02bb1b0bdfe5 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 8ddb2a622324..ed2b382249c7 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 9f4f78011020..138c07d3b75e 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/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java index 27d14c0e1fcc..28b66e941560 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 @@ -73,7 +73,7 @@ public void testAlignByDevice() { // mix test /* expectedHeader = new String[] {DEVICE, count(s1), count(s2)}; - retArray = new String[] {"sg,1,null,", "root.sg.d2,1,1,"}; + retArray = new String[] {"sg,1,null,", "root.db.d2,1,1,"}; tableResultSetEqualTest( "select count(s1), count(s2) from sg where s1>0 order by device", expectedHeader, 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 1f6bacf09717..3eb53acc7f79 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 sg1(device STRING TAG, s1 DOUBLE FIELD, s2 TEXT FIELD) as root.db1.**"); } catch (SQLException throwable) { fail(throwable.getMessage()); 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 91f4998ac537..293203e9b206 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 668cd36a71a0..dcf603603b9a 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 34051a1d2626..daef532c9d6c 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 656f1b24fafe..63cd1ae9b1a8 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 9aa60526da02..5bb2252db758 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 e8a19eb2c59c..fbf700061dba 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/schema/IoTDBAlterColumnTypeIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBAlterColumnTypeIT.java index d2f01f928b8e..614a65279aad 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBAlterColumnTypeIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBAlterColumnTypeIT.java @@ -1096,13 +1096,13 @@ public void testLoadAndAccumulator() } try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - if (!session.checkTimeseriesExists("root.sg1.d1.s1")) { + if (!session.checkTimeseriesExists("root.db1.d1.s1")) { session.createTimeseries( - "root.sg1.d1.s1", TSDataType.DOUBLE, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db1.d1.s1", TSDataType.DOUBLE, 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.DOUBLE, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db1.d1.s2", TSDataType.DOUBLE, TSEncoding.RLE, CompressionType.SNAPPY); } Double firstValue = null; @@ -1114,7 +1114,7 @@ public void testLoadAndAccumulator() List filesToLoad = new ArrayList<>(); for (int i = 1; i <= 3; i++) { File file = new File("target", "f" + i + ".tsfile"); - List columnNames = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List columnNames = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List columnTypes = Arrays.asList("DOUBLE", "DOUBLE"); if (file.exists()) { @@ -1126,7 +1126,7 @@ public void testLoadAndAccumulator() Map> deviceColumnIndices = new HashMap<>(); Set alignedDevices = new HashSet<>(); Map> deviceSchemaMap = new LinkedHashMap<>(); - // deviceSchemaMap.put("root.sg1.d1", new ArrayList<>()); + // deviceSchemaMap.put("root.db1.d1", new ArrayList<>()); collectSchemas( session, @@ -1177,7 +1177,7 @@ public void testLoadAndAccumulator() filesToLoad.clear(); // check load result - SessionDataSet dataSet = session.executeQueryStatement("select count(s1) from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select count(s1) from root.db1.d1"); RowRecord rec; rec = dataSet.next(); assertEquals(3, rec.getFields().get(0).getLongV()); @@ -1188,7 +1188,7 @@ public void testLoadAndAccumulator() // file4-file6 for (int i = 4; i <= 6; i++) { File file = new File("target", "f" + i + ".tsfile"); - List columnNames = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List columnNames = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List columnTypes = Arrays.asList("INT32", "INT32"); if (file.exists()) { @@ -1239,17 +1239,17 @@ public void testLoadAndAccumulator() } // check load result - dataSet = session.executeQueryStatement("select count(s1) from root.sg1.d1"); + dataSet = session.executeQueryStatement("select count(s1) from root.db1.d1"); rec = dataSet.next(); assertEquals(6, rec.getFields().get(0).getLongV()); assertFalse(dataSet.hasNext()); - dataSet = session.executeQueryStatement("select first_value(s1) from root.sg1.d1"); + dataSet = session.executeQueryStatement("select first_value(s1) from root.db1.d1"); rec = dataSet.next(); assertEquals(firstValue.doubleValue(), rec.getFields().get(0).getDoubleV(), 0.001); assertFalse(dataSet.hasNext()); - dataSet = session.executeQueryStatement("select last_value(s1) from root.sg1.d1"); + dataSet = session.executeQueryStatement("select last_value(s1) from root.db1.d1"); rec = dataSet.next(); assertEquals(lastValue.doubleValue(), rec.getFields().get(0).getDoubleV(), 0.001); assertFalse(dataSet.hasNext()); @@ -1262,7 +1262,7 @@ public void testLoadAndAccumulator() resourceFile.delete(); }); filesToLoad.clear(); - session.executeNonQueryStatement("DELETE TIMESERIES root.sg1.d1.s1"); + session.executeNonQueryStatement("DELETE TIMESERIES root.db1.d1.s1"); } } 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 2340cf3f326b..351457957db2 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 a456a05d0229..8fa8a64fabec 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 a24e2c20c261..d16349bc0acd 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 5fdf733578f7..e1f73463c6ed 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 ba5c22ab9969..54ebef938868 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 ef7bffdb9f06..b0dc9aced720 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 38f6345bae5d..822cbf90c444 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 @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + package org.apache.iotdb.session.it; import org.apache.iotdb.common.rpc.thrift.TAggregationType; @@ -92,7 +93,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 +125,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 +164,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 +218,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 +226,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 +247,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 +263,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 +294,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 +325,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 +352,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 +369,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 +390,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 +458,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 +505,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 +538,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 +559,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 +589,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 +611,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 +647,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 +669,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 +695,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 +730,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 +758,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 +786,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 +802,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 +817,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 +878,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 +915,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 +1018,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 +1072,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 +1125,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 +1141,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 +1154,7 @@ public void insertRecordsWithDuplicatedMeasurementsTest() { TSDataType.INT32, 1, 2); - devices.add("root.sg.d2"); + devices.add("root.db.d2"); addLine( times, measurements, @@ -1166,7 +1167,7 @@ public void insertRecordsWithDuplicatedMeasurementsTest() { TSDataType.INT32, 3, 4); - devices.add("root.sg.d3"); + devices.add("root.db.d3"); addLine( times, measurements, @@ -1196,7 +1197,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 +1210,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 +1235,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 +1245,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 +1331,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 +1352,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 +1372,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 +1385,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 +1520,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(); @@ -1569,7 +1570,7 @@ public void insertIllegalPathTest() { 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 +1580,7 @@ public void insertIllegalPathTest() { msg, TSStatusCode.ILLEGAL_PATH, OperationType.CREATE_TIMESERIES, - "root.sg..d1.s1"))); + "root.db..d1.s1"))); } try { @@ -1607,7 +1608,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 +1625,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 +1639,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 +1652,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 +1699,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 +1727,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 +1759,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 +1771,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 +1844,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 +1853,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 +1863,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 +1931,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 +2116,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 +2140,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 +2169,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 ac65c6be784e..aaad7923cf2d 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 52638352ee37..12fdc979a27c 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 d8fb9bb4c507..03963088f150 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 efb7f2abdbf1..aca33ba4dbf3 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 4b901d5b20fe..9deaac77da8b 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/utils/NumpyTablet.py b/iotdb-client/client-py/iotdb/utils/NumpyTablet.py index 9a0860d3a43e..83428fad4430 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 9b241723fe5b..e2ad7ccebe9c 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 450d69f28188..da87a55993c7 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 d0a6a3aba8e3..e30c62b273f0 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 c22124ec0093..d237857ab486 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 2c36f9484276..27a44bbb0cd8 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 e59138fa0359..e85932d7efb4 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 75cdf056113b..f11413dc756d 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 f91c1bc6dd64..cbad6af98df7 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 217df22ea2d3..b3b565f5aadb 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/service-rpc/src/main/java/org/apache/iotdb/rpc/subscription/config/TopicConfig.java b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/subscription/config/TopicConfig.java index f71980d629f1..8308837e90d4 100644 --- a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/subscription/config/TopicConfig.java +++ b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/subscription/config/TopicConfig.java @@ -95,7 +95,7 @@ public boolean isTableTopic() { attributes.getOrDefault(SQL_DIALECT_KEY, SQL_DIALECT_TREE_VALUE)); } - /////////////////////////////// extractor attributes mapping /////////////////////////////// + /////////////////////////////// source attributes mapping /////////////////////////////// public Map getAttributeWithSqlDialect() { return Collections.singletonMap( 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 40268a54cd34..b8cbb1bd37ad 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<>(); @@ -828,9 +828,9 @@ public void testInsertRecordsWithSessionBroken() throws StatementExecutionExcept // set connection as broken, due to we enable the cache leader, when we called // ((MockSession) session).getLastConstructedSessionConnection(), the session's endpoint has - // been changed to TEndPoint(ip:127.0.0.1, port:55561) + // been changed to TEndPoint(ip:127.0.0.1, port:55562) 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 a10d9b1d6f4d..7c3335131eb7 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 e4d2dbbb41dc..54fa7f432639 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 bc9469e57a4a..13b12586b0e4 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-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 3c3d23041950..d06521e997b8 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 @@ -801,15 +801,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 576d805c7862..d2ef36dceaf7 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 @@ -211,9 +211,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 StorageGroup don't exist. */ public SchemaPartitionResp getOrCreateSchemaPartition(final GetOrCreateSchemaPartitionPlan req) { // Check if the related Databases exist diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/runtime/PipeConfigNodeRuntimeAgent.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/runtime/PipeConfigNodeRuntimeAgent.java index e8cc16a1edf7..151214964090 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/runtime/PipeConfigNodeRuntimeAgent.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/runtime/PipeConfigNodeRuntimeAgent.java @@ -59,7 +59,7 @@ public synchronized void start() { // PipeTasks will not be started here and will be started by "HandleLeaderChange" // procedure when the consensus layer notify leader ready - // Clean sender (connector) hardlink snapshot dir + // Clean sender (sink) hardlink snapshot dir PipeConfigNodeCopiedFileDirStartupCleaner.clean(); // Clean receiver file dir 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 e922c23321a6..28676342c143 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 @@ -89,14 +89,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( @@ -107,8 +107,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; @@ -136,14 +135,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())); @@ -245,7 +244,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/PipeConfigNodeTaskAgent.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/task/PipeConfigNodeTaskAgent.java index 4f90d147e264..36d11bda4090 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/task/PipeConfigNodeTaskAgent.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/agent/task/PipeConfigNodeTaskAgent.java @@ -86,7 +86,7 @@ protected void createPipeTask( final PipeStaticMeta pipeStaticMeta, final PipeTaskMeta pipeTaskMeta) throws IllegalPathException { - // 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 (consensusGroupId == Integer.MIN_VALUE && pipeTaskMeta.getLeaderNodeId() == ConfigNodeDescriptor.getInstance().getConf().getConfigNodeId() diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/coordinator/runtime/heartbeat/PipeHeartbeatParser.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/coordinator/runtime/heartbeat/PipeHeartbeatParser.java index ace07f5e2d3d..b781bd51e703 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/coordinator/runtime/heartbeat/PipeHeartbeatParser.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/coordinator/runtime/heartbeat/PipeHeartbeatParser.java @@ -263,7 +263,7 @@ private void parseHeartbeatAndSaveMetaChangeLocally( runtimeMeta -> !runtimeMeta.getStatus().get().equals(PipeStatus.STOPPED)) .forEach( runtimeMeta -> { - // Record the connector exception for each pipe affected + // Record the sink exception for each pipe affected Map exceptionMap = runtimeMeta.getNodeId2PipeRuntimeExceptionMap(); if (!exceptionMap.containsKey(nodeId) 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 bd4f42042a1e..54342990998e 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/overview/PipeConfigNodeRemainingTimeOperator.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/overview/PipeConfigNodeRemainingTimeOperator.java index c27e4cd898b0..45f7951f343f 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/overview/PipeConfigNodeRemainingTimeOperator.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/metric/overview/PipeConfigNodeRemainingTimeOperator.java @@ -94,8 +94,8 @@ class PipeConfigNodeRemainingTimeOperator extends PipeRemainingOperator { //////////////////////////// Register & deregister (pipe integration) //////////////////////////// - void register(final IoTDBConfigRegionSource extractor) { - configRegionExtractors.add(extractor); + void register(final IoTDBConfigRegionSource source) { + configRegionExtractors.add(source); } //////////////////////////// Rate //////////////////////////// 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 aa3661440fa1..db0a5bb83f6d 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 7219dcac67fe..53cfb1b2116a 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/manager/pipe/sink/protocol/IoTDBConfigRegionAirGapSink.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/sink/protocol/IoTDBConfigRegionAirGapSink.java index 882c33cb6573..e2d605ea888c 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/sink/protocol/IoTDBConfigRegionAirGapSink.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/sink/protocol/IoTDBConfigRegionAirGapSink.java @@ -106,7 +106,7 @@ protected boolean mayNeedHandshakeWhenFail() { protected byte[] getTransferSingleFilePieceBytes( final String fileName, final long position, final byte[] payLoad) { throw new UnsupportedOperationException( - "The config region air gap connector does not support transferring single file piece bytes."); + "The config region air gap sink does not support transferring single file piece bytes."); } @Override diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/sink/protocol/IoTDBConfigRegionSink.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/sink/protocol/IoTDBConfigRegionSink.java index 5ce03f025980..777cd30d82bf 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/sink/protocol/IoTDBConfigRegionSink.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/sink/protocol/IoTDBConfigRegionSink.java @@ -97,7 +97,7 @@ protected IoTDBSyncClientManager constructClient( protected PipeTransferFilePieceReq getTransferSingleFilePieceReq( final String fileName, final long position, final byte[] payLoad) { throw new UnsupportedOperationException( - "The config region connector does not support transferring single file piece req."); + "The config region sink does not support transferring single file piece req."); } @Override diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java index 51007f10236e..aad1dd49deaa 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java @@ -172,7 +172,7 @@ public void checkPipePluginExistence( if (!pipePluginMetaKeeper.containsPipePlugin(sourcePluginName)) { final String exceptionMessage = String.format( - "Failed to create or alter pipe, the pipe extractor plugin %s does not exist", + "Failed to create or alter pipe, the pipe source plugin %s does not exist", sourcePluginName); LOGGER.warn(exceptionMessage); throw new PipeException(exceptionMessage); @@ -199,7 +199,7 @@ public void checkPipePluginExistence( if (!pipePluginMetaKeeper.containsPipePlugin(sinkPluginName)) { final String exceptionMessage = String.format( - "Failed to create or alter pipe, the pipe connector plugin %s does not exist", + "Failed to create or alter pipe, the pipe sink plugin %s does not exist", sinkPluginName); LOGGER.warn(exceptionMessage); throw new PipeException(exceptionMessage); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipeTaskInfo.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipeTaskInfo.java index 0b3acb4058ed..ba78dbe76c69 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipeTaskInfo.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipeTaskInfo.java @@ -398,12 +398,12 @@ public void validatePipePluginUsageByPipe(String pluginName) { private void validatePipePluginUsageByPipeInternal(String pluginName) { Iterable pipeMetas = getPipeMetaList(); for (PipeMeta pipeMeta : pipeMetas) { - PipeParameters extractorParameters = pipeMeta.getStaticMeta().getSourceParameters(); - final String extractorPluginName = - extractorParameters.getStringOrDefault( + PipeParameters sourceParameters = pipeMeta.getStaticMeta().getSourceParameters(); + final String sourcePluginName = + sourceParameters.getStringOrDefault( Arrays.asList(PipeSourceConstant.EXTRACTOR_KEY, PipeSourceConstant.SOURCE_KEY), BuiltinPipePlugin.IOTDB_EXTRACTOR.getPipePluginName()); - if (pluginName.equals(extractorPluginName)) { + if (pluginName.equals(sourcePluginName)) { String exceptionMessage = String.format( "PipePlugin '%s' is already used by Pipe '%s' as a source.", diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java index e3ce7d7c29db..1e5ea88b8db6 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java @@ -679,17 +679,17 @@ public int getMinRegionGroupNum( final String database, final TConsensusGroupType consensusGroupType) { databaseReadWriteLock.readLock().lock(); try { - final TDatabaseSchema storageGroupSchema = + final TDatabaseSchema databaseSchema = (PathUtils.isTableModelDatabase(database) ? tableModelMTree : treeModelMTree) .getDatabaseNodeByDatabasePath(getQualifiedDatabasePartialPath(database)) .getAsMNode() .getDatabaseSchema(); switch (consensusGroupType) { case SchemaRegion: - return storageGroupSchema.getMinSchemaRegionGroupNum(); + return databaseSchema.getMinSchemaRegionGroupNum(); case DataRegion: default: - return storageGroupSchema.getMinDataRegionGroupNum(); + return databaseSchema.getMinDataRegionGroupNum(); } } catch (final MetadataException e) { LOGGER.warn(ERROR_NAME, e); @@ -710,17 +710,17 @@ public int getMaxRegionGroupNum( final String database, final TConsensusGroupType consensusGroupType) { databaseReadWriteLock.readLock().lock(); try { - final TDatabaseSchema storageGroupSchema = + final TDatabaseSchema databaseSchema = (PathUtils.isTableModelDatabase(database) ? tableModelMTree : treeModelMTree) .getDatabaseNodeByDatabasePath(getQualifiedDatabasePartialPath(database)) .getAsMNode() .getDatabaseSchema(); switch (consensusGroupType) { case SchemaRegion: - return storageGroupSchema.getMaxSchemaRegionGroupNum(); + return databaseSchema.getMaxSchemaRegionGroupNum(); case DataRegion: default: - return storageGroupSchema.getMaxDataRegionGroupNum(); + return databaseSchema.getMaxDataRegionGroupNum(); } } catch (final MetadataException e) { LOGGER.warn(ERROR_NAME, e); 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 0f1007a65c42..4f0ba78e71a0 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 @@ -144,7 +144,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) { @@ -161,7 +161,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); @@ -182,11 +182,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(); @@ -196,9 +196,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 @@ -291,7 +291,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 { @@ -322,8 +322,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) @@ -1118,15 +1118,15 @@ private void serializeChildren(final IConfigMNode node, final OutputStream outpu } private void serializeDatabaseNode( - final IDatabaseMNode storageGroupNode, final OutputStream outputStream) + final IDatabaseMNode databaseNode, final OutputStream outputStream) throws IOException { - serializeChildren(storageGroupNode.getAsMNode(), outputStream); + serializeChildren(databaseNode.getAsMNode(), outputStream); ReadWriteIOUtils.write(DATABASE_MNODE_TYPE, outputStream); - ReadWriteIOUtils.write(storageGroupNode.getName(), outputStream); - ReadWriteIOUtils.write(storageGroupNode.getAsMNode().getSchemaTemplateId(), outputStream); + ReadWriteIOUtils.write(databaseNode.getName(), outputStream); + ReadWriteIOUtils.write(databaseNode.getAsMNode().getSchemaTemplateId(), outputStream); ThriftConfigNodeSerDeUtils.serializeTDatabaseSchema( - storageGroupNode.getAsMNode().getDatabaseSchema(), outputStream); + databaseNode.getAsMNode().getDatabaseSchema(), outputStream); } private void serializeTableNode(final ConfigTableNode tableNode, final OutputStream outputStream) 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 b61d5570a608..6038f91ad876 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 @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + package org.apache.iotdb.confignode.persistence.schema.mnode.impl; import org.apache.iotdb.commons.schema.node.MNodeType; @@ -146,7 +147,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 b95b50ff0bef..1efdfa7697b3 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 @@ -150,7 +150,7 @@ public PartialPath getPartialPath() { @Override public MNodeType getMNodeType() { - return MNodeType.SG_INTERNAL; + return MNodeType.DB_INTERNAL; } @Override 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 109e3c0d337d..8a2060c4659c 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 @@ -261,7 +261,7 @@ public void CreateDatabasePlanTest() throws IOException { new DatabaseSchemaPlan( ConfigPhysicalPlanType.CreateDatabase, new TDatabaseSchema() - .setName("sg") + .setName("db") .setSchemaReplicationFactor(3) .setDataReplicationFactor(3) .setTimePartitionInterval(604800)); @@ -276,7 +276,7 @@ public void AlterDatabasePlanTest() throws IOException { new DatabaseSchemaPlan( ConfigPhysicalPlanType.AlterDatabase, new TDatabaseSchema() - .setName("sg") + .setName("db") .setSchemaReplicationFactor(3) .setDataReplicationFactor(3) .setTimePartitionInterval(604800) @@ -292,7 +292,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); @@ -300,7 +300,7 @@ 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); } @@ -309,7 +309,7 @@ public void SetTTLPlanTest() throws IOException { public void PipeAlterTimeSeriesPlanTest() throws IOException { PipeAlterTimeSeriesPlan req0 = new PipeAlterTimeSeriesPlan( - new MeasurementPath(new String[] {"root", "sg0", "d1", "s1"}), + new MeasurementPath(new String[] {"root", "db0", "d1", "s1"}), (byte) 0, TSDataType.DOUBLE); PipeAlterTimeSeriesPlan req1 = @@ -319,7 +319,7 @@ public void PipeAlterTimeSeriesPlanTest() throws IOException { @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()); @@ -328,7 +328,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()); @@ -337,7 +337,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()); @@ -348,7 +348,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 = @@ -371,11 +371,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()); @@ -398,9 +398,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))); @@ -430,7 +430,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); @@ -456,7 +456,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(); @@ -718,7 +718,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 = @@ -746,11 +746,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); @@ -767,7 +767,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 = @@ -822,7 +822,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()); @@ -926,18 +926,17 @@ public void SetPipeStatusPlanTest() throws IOException { @Test public void CreatePipePlanV2Test() throws IOException { - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); - extractorAttributes.put("extractor", "org.apache.iotdb.pipe.extractor.DefaultExtractor"); + final Map sinkAttributes = new HashMap<>(); + sourceAttributes.put("source", "org.apache.iotdb.pipe.source.DefaultExtractor"); processorAttributes.put("processor", "org.apache.iotdb.pipe.processor.SDTFilterProcessor"); - connectorAttributes.put("connector", "org.apache.iotdb.pipe.protocol.ThriftTransporter"); + sinkAttributes.put("sink", "org.apache.iotdb.pipe.protocol.ThriftTransporter"); final PipeTaskMeta pipeTaskMeta = new PipeTaskMeta(MinimumProgressIndex.INSTANCE, 1); ConcurrentMap pipeTasks = new ConcurrentHashMap<>(); pipeTasks.put(1, pipeTaskMeta); final PipeStaticMeta pipeStaticMeta = - new PipeStaticMeta( - "testPipe", 121, extractorAttributes, processorAttributes, connectorAttributes); + new PipeStaticMeta("testPipe", 121, sourceAttributes, processorAttributes, sinkAttributes); final PipeRuntimeMeta pipeRuntimeMeta = new PipeRuntimeMeta(pipeTasks); final CreatePipePlanV2 createPipePlanV2 = new CreatePipePlanV2(pipeStaticMeta, pipeRuntimeMeta); final CreatePipePlanV2 createPipePlanV21 = @@ -951,18 +950,17 @@ public void CreatePipePlanV2Test() throws IOException { @Test public void AlterPipePlanV2Test() throws IOException { - final Map extractorAttributes = new HashMap<>(); + final Map sourceAttributes = new HashMap<>(); final Map processorAttributes = new HashMap<>(); - final Map connectorAttributes = new HashMap<>(); - extractorAttributes.put("pattern", "root.db"); + final Map sinkAttributes = new HashMap<>(); + sourceAttributes.put("pattern", "root.db"); processorAttributes.put("processor", "do-nothing-processor"); - connectorAttributes.put("batch.enable", "false"); + sinkAttributes.put("batch.enable", "false"); final PipeTaskMeta pipeTaskMeta = new PipeTaskMeta(MinimumProgressIndex.INSTANCE, 1); final ConcurrentMap pipeTasks = new ConcurrentHashMap<>(); pipeTasks.put(1, pipeTaskMeta); final PipeStaticMeta pipeStaticMeta = - new PipeStaticMeta( - "testPipe", 121, extractorAttributes, processorAttributes, connectorAttributes); + new PipeStaticMeta("testPipe", 121, sourceAttributes, processorAttributes, sinkAttributes); final PipeRuntimeMeta pipeRuntimeMeta = new PipeRuntimeMeta(pipeTasks); final AlterPipePlanV2 alterPipePlanV2 = new AlterPipePlanV2(pipeStaticMeta, pipeRuntimeMeta); final AlterPipePlanV2 alterPipePlanV21 = @@ -1093,7 +1091,7 @@ public void pipeHandleMetaChangePlanTest() throws IOException { 123L, new HashMap() { { - put("extractor-key", "extractor-value"); + put("source-key", "source-value"); } }, new HashMap() { @@ -1651,8 +1649,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", @@ -1816,7 +1814,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()); @@ -1827,7 +1825,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()); @@ -1837,7 +1835,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()); @@ -1867,7 +1865,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()); @@ -1911,7 +1909,7 @@ public void pipeEnrichedPlanTest() throws IOException { new DatabaseSchemaPlan( ConfigPhysicalPlanType.CreateDatabase, new TDatabaseSchema() - .setName("sg") + .setName("db") .setTTL(Long.MAX_VALUE) .setSchemaReplicationFactor(3) .setDataReplicationFactor(3) @@ -1922,7 +1920,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/consensus/response/pipe/PipeTableRespTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/response/pipe/PipeTableRespTest.java index 94189a19d997..bc83e2454a95 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/response/pipe/PipeTableRespTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/response/pipe/PipeTableRespTest.java @@ -44,11 +44,11 @@ public PipeTableResp constructPipeTableResp() { List pipeMetaList = new ArrayList<>(); // PipeMeta 1 - Map extractorAttributes = new HashMap<>(); + Map sourceAttributes = new HashMap<>(); Map processorAttributes = new HashMap<>(); Map connectorAttributes = new HashMap<>(); - extractorAttributes.put("extractor", "iotdb-extractor"); + sourceAttributes.put("extractor", "iotdb-extractor"); processorAttributes.put("processor", "do-nothing-processor"); connectorAttributes.put("connector", "iotdb-thrift-connector"); connectorAttributes.put("host", "127.0.0.1"); @@ -59,16 +59,16 @@ public PipeTableResp constructPipeTableResp() { pipeTasks.put(1, pipeTaskMeta); PipeStaticMeta pipeStaticMeta = new PipeStaticMeta( - "testPipe", 121, extractorAttributes, processorAttributes, connectorAttributes); + "testPipe", 121, sourceAttributes, processorAttributes, connectorAttributes); PipeRuntimeMeta pipeRuntimeMeta = new PipeRuntimeMeta(pipeTasks); pipeMetaList.add(new PipeMeta(pipeStaticMeta, pipeRuntimeMeta)); // PipeMeta 2 - Map extractorAttributes1 = new HashMap<>(); + Map sourceAttributes1 = new HashMap<>(); Map processorAttributes1 = new HashMap<>(); Map connectorAttributes1 = new HashMap<>(); - extractorAttributes1.put("extractor", "iotdb-extractor"); + sourceAttributes1.put("source", "iotdb-extractor"); processorAttributes1.put("processor", "do-nothing-processor"); connectorAttributes1.put("connector", "iotdb-thrift-connector"); connectorAttributes1.put("host", "127.0.0.1"); @@ -79,16 +79,16 @@ public PipeTableResp constructPipeTableResp() { pipeTasks1.put(1, pipeTaskMeta1); PipeStaticMeta pipeStaticMeta1 = new PipeStaticMeta( - "testPipe1", 122, extractorAttributes1, processorAttributes1, connectorAttributes1); + "testPipe1", 122, sourceAttributes1, processorAttributes1, connectorAttributes1); PipeRuntimeMeta pipeRuntimeMeta1 = new PipeRuntimeMeta(pipeTasks1); pipeMetaList.add(new PipeMeta(pipeStaticMeta1, pipeRuntimeMeta1)); // PipeMeta 3 - Map extractorAttributes2 = new HashMap<>(); + Map sourceAttributes2 = new HashMap<>(); Map processorAttributes2 = new HashMap<>(); Map connectorAttributes2 = new HashMap<>(); - extractorAttributes2.put("extractor", "iotdb-extractor"); + sourceAttributes2.put("extractor", "iotdb-extractor"); processorAttributes2.put("processor", "do-nothing-processor"); connectorAttributes2.put("connector", "iotdb-thrift-connector"); connectorAttributes2.put("host", "172.30.30.30"); @@ -99,7 +99,7 @@ public PipeTableResp constructPipeTableResp() { pipeTasks2.put(1, pipeTaskMeta2); PipeStaticMeta pipeStaticMeta2 = new PipeStaticMeta( - "testPipe2", 123, extractorAttributes2, processorAttributes2, connectorAttributes2); + "testPipe2", 123, sourceAttributes2, processorAttributes2, connectorAttributes2); PipeRuntimeMeta pipeRuntimeMeta2 = new PipeRuntimeMeta(pipeTasks2); pipeMetaList.add(new PipeMeta(pipeStaticMeta2, pipeRuntimeMeta2)); 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 628cc02524c5..8e777827887a 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 @@ -38,7 +38,7 @@ public class DeviceGroupHashExecutorManualTest { private static final int deviceGroupCount = 10_000; - private static final String sg = "root.SGGroup."; + private static final String db = "root.DBGroup."; 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 15051d436d8b..46a4cc7076c7 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 @@ -31,8 +31,8 @@ public class IoTDBConfigRegionSourceTest { @Test public void testIoTDBConfigExtractor() { - try (final IoTDBConfigRegionSource extractor = new IoTDBConfigRegionSource()) { - extractor.validate( + try (final IoTDBConfigRegionSource source = new IoTDBConfigRegionSource()) { + source.validate( new PipeParameterValidator( new PipeParameters( new HashMap() { 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 151307e280d8..c91b407495eb 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 b1b5f569f42a..08325927efa1 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 4b409d6cf0cd..87d88cf3d144 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 afccb0c0eba1..6251da56bd91 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/PipeInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/PipeInfoTest.java index 0d50abfbeadf..44753d964d18 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/PipeInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/PipeInfoTest.java @@ -78,11 +78,11 @@ public void cleanup() throws IOException { @Test public void testSnapshot() throws TException, IOException { // Create pipe test pipe - Map extractorAttributes = new HashMap<>(); + Map sourceAttributes = new HashMap<>(); Map processorAttributes = new HashMap<>(); Map connectorAttributes = new HashMap<>(); - extractorAttributes.put("extractor", "iotdb-extractor"); + sourceAttributes.put("extractor", "iotdb-extractor"); processorAttributes.put("processor", "do-nothing-processor"); connectorAttributes.put("connector", "iotdb-thrift-connector"); connectorAttributes.put("host", "127.0.0.1"); @@ -93,7 +93,7 @@ public void testSnapshot() throws TException, IOException { pipeTasks.put(1, pipeTaskMeta); PipeStaticMeta pipeStaticMeta = new PipeStaticMeta( - pipeName, 121, extractorAttributes, processorAttributes, connectorAttributes); + pipeName, 121, sourceAttributes, processorAttributes, connectorAttributes); PipeRuntimeMeta pipeRuntimeMeta = new PipeRuntimeMeta(pipeTasks); CreatePipePlanV2 createPipePlanV2 = new CreatePipePlanV2(pipeStaticMeta, pipeRuntimeMeta); pipeInfo.getPipeTaskInfo().createPipe(createPipePlanV2); @@ -117,10 +117,10 @@ public void testSnapshot() throws TException, IOException { @Test public void testManagement() { // Create pipe test pipe - Map extractorAttributes = new HashMap<>(); + Map sourceAttributes = new HashMap<>(); Map processorAttributes = new HashMap<>(); Map connectorAttributes = new HashMap<>(); - extractorAttributes.put("extractor", "org.apache.iotdb.pipe.extractor.DefaultExtractor"); + sourceAttributes.put("extractor", "org.apache.iotdb.pipe.extractor.DefaultExtractor"); processorAttributes.put("processor", "org.apache.iotdb.pipe.processor.SDTFilterProcessor"); connectorAttributes.put("connector", "org.apache.iotdb.pipe.protocol.ThriftTransporter"); PipeTaskMeta pipeTaskMeta = new PipeTaskMeta(MinimumProgressIndex.INSTANCE, 1); @@ -128,7 +128,7 @@ public void testManagement() { pipeTasks.put(1, pipeTaskMeta); PipeStaticMeta pipeStaticMeta = new PipeStaticMeta( - pipeName, 121, extractorAttributes, processorAttributes, connectorAttributes); + pipeName, 121, sourceAttributes, processorAttributes, connectorAttributes); PipeRuntimeMeta pipeRuntimeMeta = new PipeRuntimeMeta(pipeTasks); CreatePipePlanV2 createPipePlanV2 = new CreatePipePlanV2(pipeStaticMeta, pipeRuntimeMeta); pipeInfo.getPipeTaskInfo().createPipe(createPipePlanV2); 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 88f06f602e25..5c45772f33b0 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 42a23d35cb9f..56fed6dd4ca4 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 @@ -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 1cf0b2913a83..5fb4aa2a67f4 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 7e5f2d5c2396..55febbc931ab 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("1")); + 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`"))); } @@ -262,17 +262,17 @@ public void testSerialization() throws Exception { final PartialPath[] pathList = new PartialPath[] { new PartialPath("root.`root`"), - new PartialPath("root.a.sg"), - new PartialPath("root.a.b.sg"), - new PartialPath("root.a.a.b.sg") + 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]); - final IDatabaseMNode storageGroupMNode = + final IDatabaseMNode databaseMNode = root.getDatabaseNodeByDatabasePath(pathList[i]); - storageGroupMNode.getAsMNode().getDatabaseSchema().setDataReplicationFactor(i); - storageGroupMNode.getAsMNode().getDatabaseSchema().setSchemaReplicationFactor(i); - storageGroupMNode.getAsMNode().getDatabaseSchema().setTimePartitionInterval(i); + databaseMNode.getAsMNode().getDatabaseSchema().setDataReplicationFactor(i); + databaseMNode.getAsMNode().getDatabaseSchema().setSchemaReplicationFactor(i); + databaseMNode.getAsMNode().getDatabaseSchema().setTimePartitionInterval(i); root.getNodeWithAutoCreate(pathList[i].concatNode("a")).setSchemaTemplateId(i); } @@ -284,33 +284,33 @@ public void testSerialization() throws Exception { newTree.deserialize(inputStream); for (int i = 0; i < pathList.length; i++) { - final TDatabaseSchema storageGroupSchema = + final TDatabaseSchema databaseSchema = newTree.getDatabaseNodeByDatabasePath(pathList[i]).getAsMNode().getDatabaseSchema(); - Assert.assertEquals(i, storageGroupSchema.getSchemaReplicationFactor()); - Assert.assertEquals(i, storageGroupSchema.getDataReplicationFactor()); - Assert.assertEquals(i, storageGroupSchema.getTimePartitionInterval()); + Assert.assertEquals(i, databaseSchema.getSchemaReplicationFactor()); + Assert.assertEquals(i, databaseSchema.getDataReplicationFactor()); + Assert.assertEquals(i, databaseSchema.getTimePartitionInterval()); assertEquals( i, newTree.getNodeWithAutoCreate(pathList[i].concatNode("a")).getSchemaTemplateId()); } 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,26 +319,26 @@ 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++) { root.setStorageGroup(pathList[i]); - final IDatabaseMNode storageGroupMNode = + final IDatabaseMNode databaseMNode = root.getDatabaseNodeByDatabasePath(pathList[i]); - storageGroupMNode + databaseMNode .getAsMNode() .getDatabaseSchema() .setName( PathUtils.unQualifyDatabaseName( - storageGroupMNode.getAsMNode().getDatabaseSchema().getName())); - storageGroupMNode.getAsMNode().getDatabaseSchema().setDataReplicationFactor(i); - storageGroupMNode.getAsMNode().getDatabaseSchema().setSchemaReplicationFactor(i); - storageGroupMNode.getAsMNode().getDatabaseSchema().setTimePartitionInterval(i); - storageGroupMNode.getAsMNode().getDatabaseSchema().setIsTableModel(true); + databaseMNode.getAsMNode().getDatabaseSchema().getName())); + databaseMNode.getAsMNode().getDatabaseSchema().setDataReplicationFactor(i); + databaseMNode.getAsMNode().getDatabaseSchema().setSchemaReplicationFactor(i); + databaseMNode.getAsMNode().getDatabaseSchema().setTimePartitionInterval(i); + databaseMNode.getAsMNode().getDatabaseSchema().setIsTableModel(true); final String tableName = "table" + i; final TsTable table = new TsTable(tableName); @@ -360,31 +360,31 @@ public void testTableSerialization() throws Exception { newTree.deserialize(inputStream); for (int i = 0; i < pathList.length; i++) { - final TDatabaseSchema storageGroupSchema = + final TDatabaseSchema databaseSchema = newTree.getDatabaseNodeByDatabasePath(pathList[i]).getAsMNode().getDatabaseSchema(); - Assert.assertEquals(i, storageGroupSchema.getSchemaReplicationFactor()); - Assert.assertEquals(i, storageGroupSchema.getDataReplicationFactor()); - Assert.assertEquals(i, storageGroupSchema.getTimePartitionInterval()); + Assert.assertEquals(i, databaseSchema.getSchemaReplicationFactor()); + Assert.assertEquals(i, databaseSchema.getDataReplicationFactor()); + Assert.assertEquals(i, databaseSchema.getTimePartitionInterval()); } 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 d0e92b328166..40efc2b8c315 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 626995373610..9423729e55d0 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 ae61fcfc0cf4..28ebc716e4fc 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")); } }, @@ -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/pipe/task/AlterPipeProcedureV2Test.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/AlterPipeProcedureV2Test.java index cf51ad987800..17de509dc213 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/AlterPipeProcedureV2Test.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/AlterPipeProcedureV2Test.java @@ -40,7 +40,7 @@ public void serializeDeserializeTest() { PublicBAOS byteArrayOutputStream = new PublicBAOS(); DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); - Map extractorAttributes = new HashMap<>(); + Map sourceAttributes = new HashMap<>(); Map processorAttributes = new HashMap<>(); Map connectorAttributes = new HashMap<>(); @@ -51,7 +51,7 @@ public void serializeDeserializeTest() { TAlterPipeReq req = new TAlterPipeReq("testPipe", processorAttributes, connectorAttributes, false, true); - req.setExtractorAttributes(extractorAttributes); + req.setExtractorAttributes(sourceAttributes); req.setIsReplaceAllExtractorAttributes(false); AlterPipeProcedureV2 proc = new AlterPipeProcedureV2(req, ProcedureType.ALTER_PIPE_PROCEDURE_V2); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/AlterPipeProcedureV3Test.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/AlterPipeProcedureV3Test.java index 3e1c460f8556..0635845398a5 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/AlterPipeProcedureV3Test.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/AlterPipeProcedureV3Test.java @@ -40,12 +40,12 @@ public void serializeDeserializeTest() { PublicBAOS byteArrayOutputStream = new PublicBAOS(); DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); - Map extractorAttributes = new HashMap<>(); + Map sourceAttributes = new HashMap<>(); Map processorAttributes = new HashMap<>(); Map connectorAttributes = new HashMap<>(); - extractorAttributes.put("source", "iotdb-source"); - extractorAttributes.put("source.pattern", "root.test1.wf01"); + sourceAttributes.put("source", "iotdb-source"); + sourceAttributes.put("source.pattern", "root.test1.wf01"); processorAttributes.put("processor", "do-nothing-processor"); connectorAttributes.put("connector", "iotdb-thrift-connector"); connectorAttributes.put("host", "127.0.0.1"); @@ -53,7 +53,7 @@ public void serializeDeserializeTest() { TAlterPipeReq req = new TAlterPipeReq("testPipe", processorAttributes, connectorAttributes, false, true); - req.setExtractorAttributes(extractorAttributes); + req.setExtractorAttributes(sourceAttributes); req.setIsReplaceAllExtractorAttributes(false); AlterPipeProcedureV2 proc = new AlterPipeProcedureV2(req); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/CreatePipeProcedureV2Test.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/CreatePipeProcedureV2Test.java index 6c095de98529..4e16db4b9173 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/CreatePipeProcedureV2Test.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/task/CreatePipeProcedureV2Test.java @@ -39,10 +39,10 @@ public void serializeDeserializeTest() { PublicBAOS byteArrayOutputStream = new PublicBAOS(); DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); - Map extractorAttributes = new HashMap<>(); + Map sourceAttributes = new HashMap<>(); Map processorAttributes = new HashMap<>(); Map connectorAttributes = new HashMap<>(); - extractorAttributes.put("extractor", "iotdb-extractor"); + sourceAttributes.put("source", "iotdb-source"); processorAttributes.put("processor", "do-nothing-processor"); connectorAttributes.put("connector", "iotdb-thrift-connector"); connectorAttributes.put("host", "127.0.0.1"); @@ -52,7 +52,7 @@ public void serializeDeserializeTest() { new CreatePipeProcedureV2( new TCreatePipeReq() .setPipeName("testPipe") - .setExtractorAttributes(extractorAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes) .setConnectorAttributes(connectorAttributes)); 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 b6f2541b2158..e71dc9748e03 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 6f690c492a72..4974f70b37e1 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 a872b3a63d1a..d76fa85cd18c 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 b12f49d9bd7d..9c95bafee909 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 8223cac998e6..d4e04557b6b4 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/SetTemplateProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedureTest.java index 53b9fd2dd0f0..945fb68960a8 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 be9900ee90ca..d404935fb771 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 da06c60a624d..32e796d57ec7 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 setExtractorPluginName(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 setConnectorPluginName(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 568f68bb577e..b3e75cef35ac 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 c1aef74a4b43..7167961951e8 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 bd9a2fd73d36..86ff40cf91bd 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/exception/StorageGroupNotReadyException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/StorageGroupNotReadyException.java index 36a0d1bf77c0..e34f1be3e151 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 11c1edafccb1..fada15dc8764 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 ae27a7eff33d..54943ed5a564 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 @@ -63,40 +63,40 @@ 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 = validateExtractor(sourceAttributes); PipeProcessor temporaryProcessor = validateProcessor(processorAttributes); - PipeConnector temporaryConnector = validateConnector(pipeName, connectorAttributes); + PipeConnector temporaryConnector = validateConnector(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 = + Visibility sinkVisibility = VisibilityUtils.calculateFromPluginClass(temporaryConnector.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, + sinkAttributes, temporaryConnector.getClass().getName(), - connectorVisibility)); + sinkVisibility)); } } } 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 d9a2347acecf..310800acfa52 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 d33ec44a86e5..0d0b955c2109 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/builder/PipeDataNodeBuilder.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeBuilder.java index b55704a3da40..46a10135d886 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/connection/PipeEventCollector.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java index 1dec3582f854..b1ed82dc9ace 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 @@ -235,7 +235,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 bed009d37c93..b3f5fafac7f3 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,7 +32,7 @@ */ public class PipeSubtaskExecutorManager { private final PipeProcessorSubtaskExecutor processorExecutor; - private final Supplier connectorExecutorSupplier; + private final Supplier sinkExecutorSupplier; private final SubscriptionSubtaskExecutor subscriptionExecutor; public PipeProcessorSubtaskExecutor getProcessorExecutor() { @@ -40,7 +40,7 @@ public PipeProcessorSubtaskExecutor getProcessorExecutor() { } public Supplier getConnectorExecutorSupplier() { - return connectorExecutorSupplier; + 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/PipeTaskSinkStage.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSinkStage.java index c24db53e6106..af757b82eb8e 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 @@ -38,7 +38,7 @@ public class PipeTaskSinkStage extends PipeTaskStage { protected final int regionId; protected final Supplier executor; - protected String connectorSubtaskId; + protected String sinkSubtaskId; public PipeTaskSinkStage( String pipeName, @@ -56,7 +56,7 @@ public PipeTaskSinkStage( } protected void registerSubtask() { - this.connectorSubtaskId = + this.sinkSubtaskId = PipeSinkSubtaskManager.instance() .register( executor, @@ -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); + return PipeSinkSubtaskManager.instance().getPipeConnectorPendingQueue(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 57a804df0d38..5f774ceb379b 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 @@ -45,33 +45,32 @@ public class PipeTaskSourceStage extends PipeTaskStage { public PipeTaskSourceStage( String pipeName, long creationTime, - PipeParameters extractorParameters, + PipeParameters sourceParameters, int regionId, PipeTaskMeta pipeTaskMeta) { pipeExtractor = 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 + pipeExtractor.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); + pipeExtractor.customize(sourceParameters, runtimeConfiguration); } catch (Exception e) { try { pipeExtractor.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); 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 d8fbac9e44e0..3ff84f09338a 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 @@ -189,11 +189,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() @@ -205,10 +205,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 dba2269b281c..e180ce804cd5 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 @@ -58,9 +58,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. @@ -71,12 +71,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); this.attributeSortedString = attributeSortedString; - this.connectorIndex = connectorIndex; + this.sinkIndex = sinkIndex; this.inputPendingQueue = inputPendingQueue; if (!attributeSortedString.startsWith("schema_")) { @@ -142,7 +142,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.getMessage() != null ? " Message: " + e.getMessage() : ""); clearReferenceCountAndReleaseLastEvent(event); @@ -208,13 +208,13 @@ 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); @@ -227,8 +227,8 @@ public void 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 @@ -289,7 +289,7 @@ public String getAttributeSortedString() { } public int getConnectorIndex() { - return connectorIndex; + return sinkIndex; } public int getTsFileInsertionEventCount() { 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 0df3a773b9c1..48aaed27549b 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 @@ -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 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 b249ed7b1e93..9bc0f0a8eec5 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 @@ -66,7 +66,7 @@ public synchronized String register( final Supplier executorSupplier, final PipeParameters pipeConnectorParameters, final PipeTaskSinkRuntimeEnvironment environment) { - final String connectorKey = + final String sinkKey = pipeConnectorParameters .getStringOrDefault( Arrays.asList(PipeSinkConstant.CONNECTOR_KEY, PipeSinkConstant.SINK_KEY), @@ -79,7 +79,7 @@ public synchronized String register( environment.getPipeName(), environment.getCreationTime(), environment.getRegionId(), - connectorKey); + sinkKey); final boolean isDataRegionConnector = StorageEngine.getInstance() @@ -87,11 +87,11 @@ public synchronized String register( .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 = + sinkNum = pipeConnectorParameters.getIntOrDefault( Arrays.asList( PipeSinkConstant.CONNECTOR_IOTDB_PARALLEL_TASKS_KEY, @@ -105,17 +105,16 @@ public synchronized String register( 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,7 +127,7 @@ public synchronized String register( ((PipeRealtimePriorityBlockingQueue) pendingQueue).setOfferTsFileCounter(counter); } - for (int connectorIndex = 0; connectorIndex < connectorNum; connectorIndex++) { + for (int sinkIndex = 0; sinkIndex < sinkNum; sinkIndex++) { final PipeConnector pipeConnector = isDataRegionConnector ? PipeDataNodeAgent.plugin().dataRegion().reflectSink(pipeConnectorParameters) @@ -148,8 +147,7 @@ public synchronized String register( pipeConnector.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( @@ -160,11 +158,10 @@ public synchronized String register( 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); final PipeSinkSubtaskLifeCycle pipeSinkSubtaskLifeCycle = @@ -173,7 +170,7 @@ public synchronized String register( } 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()); @@ -217,7 +214,7 @@ public synchronized void deregister( PipeEventCommitManager.getInstance().deregister(pipeName, creationTime, regionId); // Reset IoTV2 replicate index to prevent index jumps. Do this when a consensus pipe no longer - // replicates data, since extractor and processor are already dropped now. + // replicates data, since source and processor are already dropped now. ReplicateProgressDataNodeManager.resetReplicateIndexForIoTV2(pipeName); } 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 02179a29f569..05f8a8531403 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,7 +49,7 @@ public class ConsensusPipeDataNodeDispatcher implements ConsensusPipeDispatcher @Override public void createPipe( String pipeName, - Map extractorAttributes, + Map sourceAttributes, Map processorAttributes, Map connectorAttributes, boolean needManuallyStart) @@ -60,7 +60,7 @@ public void createPipe( new TCreatePipeReq() .setPipeName(pipeName) .setNeedManuallyStart(needManuallyStart) - .setExtractorAttributes(extractorAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes) .setConnectorAttributes(connectorAttributes); TSStatus status = configNodeClient.createPipe(req); 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 468292b8ecc4..5eb0c14298bb 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); @@ -206,19 +206,19 @@ public void recordDisruptorSize(final RingBuffer ringBuffer) { } } - public void recordExtractorQueueSize(final UnboundedBlockingPendingQueue pendingQueue) { + public void recordSourceQueueSize(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/common/tsfile/PipeTsFileInsertionEvent.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java index d3d601d5754d..3f74e72fb23c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java @@ -168,7 +168,7 @@ public PipeTsFileInsertionEvent( this.resource = resource; - // For events created at assigner or historical extractor, the tsFile is get from the resource + // For events created at assigner or historical source, the tsFile is get from the resource // For events created for source, the tsFile is inherited from the assigner, because the // original tsFile may be gone, and we need to get the assigner's hard-linked tsFile to // hard-link it to each pipe dir 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 9ee89189e138..6fd39d2fcfde 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 @@ -33,8 +33,7 @@ /** * {@link PipeRealtimeEvent} is an event that decorates the {@link EnrichedEvent} with the - * information of {@link TsFileEpoch} and schema info. It only exists in the realtime event - * extractor. + * information of {@link TsFileEpoch} and schema info. It only exists in the realtime event source. */ public class PipeRealtimeEvent extends EnrichedEvent { @@ -76,7 +75,7 @@ public PipeRealtimeEvent( final long startTime, final long endTime) { // PipeTaskMeta is used to report the progress of the event, the PipeRealtimeEvent - // is only used in the realtime event extractor, which does not need to report the progress + // is only used in the realtime event source, which does not need to report the progress // of the event, so the pipeTaskMeta is always null. super( event != null ? event.getPipeName() : null, @@ -112,8 +111,8 @@ public void gcSchemaInfo() { device2Measurements = null; } - public boolean mayExtractorUseTablets(final PipeRealtimeDataRegionSource extractor) { - final TsFileEpoch.State state = tsFileEpoch.getState(extractor); + public boolean mayExtractorUseTablets(final PipeRealtimeDataRegionSource source) { + final TsFileEpoch.State state = tsFileEpoch.getState(source); return state.equals(TsFileEpoch.State.EMPTY) || state.equals(TsFileEpoch.State.USING_TABLET); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeDataNodeRemainingEventAndTimeOperator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeDataNodeRemainingEventAndTimeOperator.java index f54e8bcfccb2..408f69761e0d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeDataNodeRemainingEventAndTimeOperator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeDataNodeRemainingEventAndTimeOperator.java @@ -42,7 +42,7 @@ public class PipeDataNodeRemainingEventAndTimeOperator extends PipeRemainingOperator { - // Calculate from schema region extractors directly for it requires less computation + // Calculate from schema region sources directly for it requires less computation private final Set schemaRegionExtractors = Collections.newSetFromMap(new ConcurrentHashMap<>()); @@ -192,8 +192,8 @@ public double getRemainingTime() { //////////////////////////// Register & deregister (pipe integration) //////////////////////////// - void register(final IoTDBSchemaRegionSource extractor) { - schemaRegionExtractors.add(extractor); + void register(final IoTDBSchemaRegionSource source) { + schemaRegionExtractors.add(source); } //////////////////////////// Rate //////////////////////////// diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeDataNodeSinglePipeMetrics.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeDataNodeSinglePipeMetrics.java index 8c1ef90f97ff..acedfb71946f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeDataNodeSinglePipeMetrics.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeDataNodeSinglePipeMetrics.java @@ -195,29 +195,29 @@ private void removeAutoGauge(final String pipeID) { //////////////////////////// register & deregister (pipe integration) //////////////////////////// - public void register(final IoTDBDataRegionSource extractor) { + public void register(final IoTDBDataRegionSource source) { // The metric is global thus the regionId is omitted - final String pipeID = extractor.getPipeName() + "_" + extractor.getCreationTime(); + final String pipeID = source.getPipeName() + "_" + source.getCreationTime(); remainingEventAndTimeOperatorMap.computeIfAbsent( pipeID, k -> new PipeDataNodeRemainingEventAndTimeOperator( - extractor.getPipeName(), extractor.getCreationTime())); + source.getPipeName(), source.getCreationTime())); if (Objects.nonNull(metricService)) { createMetrics(pipeID); } } - public void register(final IoTDBSchemaRegionSource extractor) { + public void register(final IoTDBSchemaRegionSource source) { // The metric is global thus the regionId is omitted - final String pipeID = extractor.getPipeName() + "_" + extractor.getCreationTime(); + final String pipeID = source.getPipeName() + "_" + source.getCreationTime(); remainingEventAndTimeOperatorMap .computeIfAbsent( pipeID, k -> new PipeDataNodeRemainingEventAndTimeOperator( - extractor.getPipeName(), extractor.getCreationTime())) - .register(extractor); + source.getPipeName(), source.getCreationTime())) + .register(source); if (Objects.nonNull(metricService)) { createMetrics(pipeID); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeTsFileToTabletsMetrics.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeTsFileToTabletsMetrics.java index f9436377bb3c..d7d4f072099c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeTsFileToTabletsMetrics.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeTsFileToTabletsMetrics.java @@ -148,8 +148,8 @@ private void removeMetrics(final String pipeID) { //////////////////////////// register & deregister //////////////////////////// - public void register(final IoTDBDataRegionSource extractor) { - final String pipeID = extractor.getPipeName() + "_" + extractor.getCreationTime(); + public void register(final IoTDBDataRegionSource source) { + final String pipeID = source.getPipeName() + "_" + source.getCreationTime(); pipe.add(pipeID); if (Objects.nonNull(metricService)) { createMetrics(pipeID); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/schema/PipeSchemaRegionSourceMetrics.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/schema/PipeSchemaRegionSourceMetrics.java index 9c752d9753f0..65c86aaf2b30 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/schema/PipeSchemaRegionSourceMetrics.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/schema/PipeSchemaRegionSourceMetrics.java @@ -42,14 +42,14 @@ public class PipeSchemaRegionSourceMetrics implements IMetricSet { @SuppressWarnings("java:S3077") 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) { @@ -57,26 +57,25 @@ private void createMetrics(final String taskID) { } private void createAutoGauge(final String taskID) { - final IoTDBSchemaRegionSource extractor = extractorMap.get(taskID); + final IoTDBSchemaRegionSource source = sourceMap.get(taskID); metricService.createAutoGauge( Metric.UNTRANSFERRED_SCHEMA_COUNT.toString(), MetricLevel.IMPORTANT, - extractorMap.get(taskID), + sourceMap.get(taskID), IoTDBSchemaRegionSource::getUnTransferredEventCount, 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) { - ImmutableSet.copyOf(extractorMap.keySet()).forEach(this::deregister); - if (!extractorMap.isEmpty()) { - LOGGER.warn( - "Failed to unbind from pipe schema region extractor metrics, extractor map not empty"); + ImmutableSet.copyOf(sourceMap.keySet()).forEach(this::deregister); + if (!sourceMap.isEmpty()) { + LOGGER.warn("Failed to unbind from pipe schema region source metrics, source map not empty"); } } @@ -85,40 +84,40 @@ private void removeMetrics(final String taskID) { } private void removeAutoGauge(final String taskID) { - final IoTDBSchemaRegionSource extractor = extractorMap.get(taskID); + final IoTDBSchemaRegionSource source = sourceMap.get(taskID); // pending event count metricService.remove( MetricType.AUTO_GAUGE, Metric.UNTRANSFERRED_SCHEMA_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())); } //////////////////////////// register & deregister (pipe integration) //////////////////////////// - public void register(final IoTDBSchemaRegionSource extractor) { - final String taskID = extractor.getTaskID(); - extractorMap.putIfAbsent(taskID, extractor); + public void register(final IoTDBSchemaRegionSource 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 schema region extractor metrics, IoTDBSchemaRegionExtractor({}) does not exist", + "Failed to deregister pipe schema region source metrics, IoTDBSchemaRegionExtractor({}) does not exist", taskID); return; } if (Objects.nonNull(metricService)) { removeMetrics(taskID); } - extractorMap.remove(taskID); + sourceMap.remove(taskID); } //////////////////////////// singleton //////////////////////////// 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 918445b57e7f..99f848ff3b75 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 bac357368c03..3c36559a300e 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 3cea6c998f87..610b9e5fe1a0 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/resource/tsfile/PipeTsFileResourceManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeTsFileResourceManager.java index c1e4ff9ddf1b..d08344c84f6e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeTsFileResourceManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeTsFileResourceManager.java @@ -76,10 +76,10 @@ public File increaseFileReference( * @param file tsfile, resource file or mod file. can be original file or hardlink/copy of * original file * @param isTsFile {@code true} to create hardlink, {@code false} to copy file - * @param pipeName Nonnull if the pipe is from historical or assigner -> extractors, null if is + * @param pipeName Nonnull if the pipe is from historical or assigner -> sources, null if is * dataRegion -> assigner - * @param sourceFile for inner use, historical extractor will use this to create hardlink from - * pipe tsFile -> common tsFile + * @param sourceFile for inner use, historical source will use this to create hardlink from pipe + * tsFile -> common tsFile * @return the hardlink or copied file * @throws IOException when create hardlink or copy file failed */ 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 5ee7f22bc071..73e2213eea61 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 5e2dfb6f9a0b..f2ced49f1365 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 e4d39b49523e..ae33eebdd1f9 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); @@ -208,7 +207,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 eefa5e739d5b..2771ae17dd41 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 @@ -107,7 +107,7 @@ public class IoTDBLegacyPipeSink implements PipeConnector { private String user; private String password; - private String syncConnectorVersion; + private String syncSinkVersion; private String pipeName; private String databaseName; @@ -191,7 +191,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), @@ -227,7 +227,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 = @@ -268,7 +268,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."); } } @@ -277,7 +277,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()) { @@ -301,8 +301,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); } } @@ -386,7 +385,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 071db688dd8b..7cc9e24279ed 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 @@ -465,7 +465,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 a481f7cde0d5..d2365921f0ff 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 @@ -144,7 +144,7 @@ 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, @@ -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); @@ -198,7 +198,7 @@ private boolean addEvent2Buffer(EnrichedEvent event) { 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()); @@ -681,12 +681,12 @@ 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(); @@ -701,7 +701,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 bb0dcf2dc096..c675bb644555 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 { @@ -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.IoTDBDataRegionSyncConnector 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.IoTDBDataRegionSyncConnector 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/PipeConsensusTabletBatchEventHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/handler/PipeConsensusTabletBatchEventHandler.java index 1acc92841b05..20bf1765700d 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(event -> sink.removeEventFromBuffer((EnrichedEvent) event)); } 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 0b701fc264bb..a4aa8eb5461a 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 643b9728a344..ff19ea535017 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 +754,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 89baaa027944..2a9650b47e87 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 70ba7f4cfc5b..6d4adf42240c 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 df26325a5ca6..b8ee1ff496cd 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 ff1daa05c285..b64e446827af 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 21f7c144bed2..7f42b6bf64fe 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); } } @@ -67,14 +67,14 @@ public void onError(final Exception exception) { client.setPrintLogWhenEncounterException(false); } - 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); } /** @@ -82,8 +82,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( @@ -92,11 +92,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); client.returnSelf( (e) -> { @@ -137,7 +137,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 3ef46034554a..5d74caefbc07 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(); } @@ -450,7 +447,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; } @@ -477,7 +474,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 016f787afaa2..a2231288fc23 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 15a72d1193ae..13ec477c0480 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 4e593e673fd5..c50f3f2e21bf 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 240de912f6fe..91e68ad54daa 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 612d41d7f47d..84e786991c6b 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 @@ -164,14 +164,14 @@ public void customize( session.setClientVersion(IoTDBConstant.ClientVersion.V_1_0); session.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) 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 7cf476a66cbe..0168e86e0dd2 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/PipeRealtimeDataRegionLogSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionLogSource.java index 35a2c7190c82..4b700dba76e2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionLogSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionLogSource.java @@ -55,7 +55,7 @@ protected void doExtract(PipeRealtimeEvent event) { } else { throw new UnsupportedOperationException( String.format( - "Unsupported event type %s for log realtime extractor %s", + "Unsupported event type %s for log realtime source %s", eventToExtract.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 cd00e2975a0a..5fffe507ce31 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 @@ -174,19 +174,18 @@ public void validate(final PipeParameterValidator validator) throws Exception { throw new PipeParameterNotValidException(e.getMessage()); } - final String extractorRealtimeLooseRangeValue = + final String sourceRealtimeLooseRangeValue = parameters .getStringOrDefault( Arrays.asList(EXTRACTOR_REALTIME_LOOSE_RANGE_KEY, SOURCE_REALTIME_LOOSE_RANGE_KEY), EXTRACTOR_REALTIME_LOOSE_RANGE_DEFAULT_VALUE) .trim(); - if (EXTRACTOR_REALTIME_LOOSE_RANGE_ALL_VALUE.equalsIgnoreCase( - extractorRealtimeLooseRangeValue)) { + if (EXTRACTOR_REALTIME_LOOSE_RANGE_ALL_VALUE.equalsIgnoreCase(sourceRealtimeLooseRangeValue)) { sloppyTimeRange = true; sloppyPattern = true; } else { final Set sloppyOptionSet = - Arrays.stream(extractorRealtimeLooseRangeValue.split(",")) + Arrays.stream(sourceRealtimeLooseRangeValue.split(",")) .map(String::trim) .filter(s -> !s.isEmpty()) .map(String::toLowerCase) @@ -302,7 +301,7 @@ public void customize( if (LOGGER.isInfoEnabled()) { LOGGER.info( - "Pipe {}@{}: realtime data region extractor is initialized with parameters: {}.", + "Pipe {}@{}: realtime data region source is initialized with parameters: {}.", pipeName, dataRegionId, parameters); @@ -331,7 +330,7 @@ public void close() throws Exception { private void clearPendingQueue() { final List eventsToDrop = new ArrayList<>(pendingQueue.size()); - // processor stage is closed later than extractor stage, {@link supply()} may be called after + // processor stage is closed later than source stage, {@link supply()} may be called after // processor stage is closed. To avoid concurrent issues, we should clear the pending queue // before clearing all the reference count of the events in the pending queue. pendingQueue.forEach(eventsToDrop::add); @@ -407,7 +406,7 @@ public final void extract(final PipeRealtimeEvent event) { protected void extractHeartbeat(final PipeRealtimeEvent event) { // Record the pending queue size before trying to put heartbeatEvent into queue - ((PipeHeartbeatEvent) event.getEvent()).recordExtractorQueueSize(pendingQueue); + ((PipeHeartbeatEvent) event.getEvent()).recordSourceQueueSize(pendingQueue); final Event lastEvent = pendingQueue.peekLast(); if (lastEvent instanceof PipeRealtimeEvent 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 8ea973fbf0a3..6ae2a12cf342 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; @@ -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,17 +238,17 @@ 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() { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/epoch/TsFileEpoch.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/epoch/TsFileEpoch.java index 940086bb8d64..e1297a8a38a7 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/epoch/TsFileEpoch.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/epoch/TsFileEpoch.java @@ -42,13 +42,12 @@ public TsFileEpoch(final TsFileResource resource) { this.insertNodeMinTime = new AtomicLong(Long.MAX_VALUE); } - public TsFileEpoch.State getState(final PipeRealtimeDataRegionSource extractor) { - AtomicReference stateRef = dataRegionExtractor2State.get(extractor); + public TsFileEpoch.State getState(final PipeRealtimeDataRegionSource source) { + AtomicReference stateRef = dataRegionExtractor2State.get(source); if (stateRef == null) { - dataRegionExtractor2State.putIfAbsent( - extractor, stateRef = new AtomicReference<>(State.EMPTY)); - extractor.increaseExtractEpochSize(); + dataRegionExtractor2State.putIfAbsent(source, stateRef = new AtomicReference<>(State.EMPTY)); + source.increaseExtractEpochSize(); setExtractorsRecentProcessedTsFileEpochState(); } @@ -56,13 +55,12 @@ public TsFileEpoch.State getState(final PipeRealtimeDataRegionSource extractor) } public void migrateState( - final PipeRealtimeDataRegionSource extractor, final TsFileEpochStateMigrator visitor) { - AtomicReference stateRef = dataRegionExtractor2State.get(extractor); + final PipeRealtimeDataRegionSource source, final TsFileEpochStateMigrator visitor) { + AtomicReference stateRef = dataRegionExtractor2State.get(source); if (stateRef == null) { - dataRegionExtractor2State.putIfAbsent( - extractor, stateRef = new AtomicReference<>(State.EMPTY)); - extractor.increaseExtractEpochSize(); + dataRegionExtractor2State.putIfAbsent(source, stateRef = new AtomicReference<>(State.EMPTY)); + source.increaseExtractEpochSize(); setExtractorsRecentProcessedTsFileEpochState(); } @@ -73,21 +71,21 @@ public void migrateState( } } - public void clearState(final PipeRealtimeDataRegionSource extractor) { - if (dataRegionExtractor2State.containsKey(extractor)) { - extractor.decreaseExtractEpochSize(); + public void clearState(final PipeRealtimeDataRegionSource source) { + if (dataRegionExtractor2State.containsKey(source)) { + source.decreaseExtractEpochSize(); } - if (extractor.extractEpochSizeIsEmpty()) { + if (source.extractEpochSizeIsEmpty()) { PipeDataRegionSourceMetrics.getInstance() - .setRecentProcessedTsFileEpochState(extractor.getTaskID(), State.EMPTY); + .setRecentProcessedTsFileEpochState(source.getTaskID(), State.EMPTY); } } public void setExtractorsRecentProcessedTsFileEpochState() { dataRegionExtractor2State.forEach( - (extractor, state) -> + (source, state) -> PipeDataRegionSourceMetrics.getInstance() - .setRecentProcessedTsFileEpochState(extractor.getTaskID(), state.get())); + .setRecentProcessedTsFileEpochState(source.getTaskID(), state.get())); } public void updateInsertNodeMinTime(final long newComingMinTime) { 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 8c49dd0a3dd8..638977920e3e 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 @@ -57,32 +57,32 @@ public class PipeInsertionDataNodeListener { //////////////////////////// start & stop //////////////////////////// public synchronized void startListenAndAssign( - final String dataRegionId, final PipeRealtimeDataRegionSource extractor) { + final String dataRegionId, final PipeRealtimeDataRegionSource source) { dataRegionId2Assigner .computeIfAbsent(dataRegionId, o -> new PipeDataRegionAssigner(dataRegionId)) - .startAssignTo(extractor); + .startAssignTo(source); - if (extractor.isNeedListenToTsFile()) { + if (source.isNeedListenToTsFile()) { listenToTsFileExtractorCount.incrementAndGet(); } - if (extractor.isNeedListenToInsertNode()) { + if (source.isNeedListenToInsertNode()) { listenToInsertNodeExtractorCount.incrementAndGet(); } } public synchronized void stopListenAndAssign( - final String dataRegionId, final PipeRealtimeDataRegionSource extractor) { + final String dataRegionId, final PipeRealtimeDataRegionSource source) { final PipeDataRegionAssigner assigner = dataRegionId2Assigner.get(dataRegionId); if (assigner == null) { return; } - assigner.stopAssignTo(extractor); + assigner.stopAssignTo(source); - if (extractor.isNeedListenToTsFile()) { + if (source.isNeedListenToTsFile()) { listenToTsFileExtractorCount.decrementAndGet(); } - if (extractor.isNeedListenToInsertNode()) { + if (source.isNeedListenToInsertNode()) { listenToInsertNodeExtractorCount.decrementAndGet(); } @@ -102,7 +102,7 @@ public void listenToTsFile( final TsFileResource tsFileResource, final boolean isLoaded) { // We don't judge whether listenToTsFileExtractorCount.get() == 0 here on purpose - // because extractors may use tsfile events when some exceptions occur in the + // because sources may use tsfile events when some exceptions occur in the // insert nodes listening process. final PipeDataRegionAssigner assigner = dataRegionId2Assigner.get(dataRegionId); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/listener/PipeTimePartitionListener.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/listener/PipeTimePartitionListener.java index c5e98cd1b2ce..f09a631897a0 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/listener/PipeTimePartitionListener.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/listener/PipeTimePartitionListener.java @@ -40,27 +40,25 @@ public class PipeTimePartitionListener { //////////////////////////// start & stop //////////////////////////// - public synchronized void startListen( - String dataRegionId, PipeRealtimeDataRegionSource extractor) { + public synchronized void startListen(String dataRegionId, PipeRealtimeDataRegionSource source) { dataRegionId2Extractors .computeIfAbsent(dataRegionId, o -> new HashMap<>()) - .put(extractor.getTaskID(), extractor); - // Assign the previously recorded upper and lower bounds of time partition to the extractor that + .put(source.getTaskID(), source); + // Assign the previously recorded upper and lower bounds of time partition to the source that // has just started listening to the growth of time partition. Pair timePartitionIdBound = dataRegionId2TimePartitionIdBound.get(dataRegionId); if (Objects.nonNull(timePartitionIdBound)) { - extractor.setDataRegionTimePartitionIdBound(timePartitionIdBound); + source.setDataRegionTimePartitionIdBound(timePartitionIdBound); } } - public synchronized void stopListen(String dataRegionId, PipeRealtimeDataRegionSource extractor) { - Map extractors = - dataRegionId2Extractors.get(dataRegionId); - if (Objects.isNull(extractors)) { + public synchronized void stopListen(String dataRegionId, PipeRealtimeDataRegionSource source) { + Map sources = dataRegionId2Extractors.get(dataRegionId); + if (Objects.isNull(sources)) { return; } - extractors.remove(extractor.getTaskID()); - if (extractors.isEmpty()) { + sources.remove(source.getTaskID()); + if (sources.isEmpty()) { dataRegionId2Extractors.remove(dataRegionId); } } @@ -86,14 +84,13 @@ public synchronized void listenToTimePartitionGrow( } if (shouldBroadcastTimePartitionChange) { - Map extractors = - dataRegionId2Extractors.get(dataRegionId); - if (Objects.isNull(extractors)) { + Map sources = dataRegionId2Extractors.get(dataRegionId); + if (Objects.isNull(sources)) { return; } Pair timePartitionIdBound = dataRegionId2TimePartitionIdBound.get(dataRegionId); - extractors.forEach( - (id, extractor) -> extractor.setDataRegionTimePartitionIdBound(timePartitionIdBound)); + sources.forEach( + (id, source) -> source.setDataRegionTimePartitionIdBound(timePartitionIdBound)); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/matcher/PipeDataRegionMatcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/matcher/PipeDataRegionMatcher.java index a8b6147ef466..0bc4de6246af 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/matcher/PipeDataRegionMatcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/matcher/PipeDataRegionMatcher.java @@ -29,30 +29,30 @@ public interface PipeDataRegionMatcher { /** - * Register a extractor. If the extractor's pattern matches the event's schema info, the event - * will be assigned to the extractor. + * Register a source. If the source's pattern matches the event's schema info, the event will be + * assigned to the source. */ - void register(PipeRealtimeDataRegionSource extractor); + void register(PipeRealtimeDataRegionSource source); - /** Deregister a extractor. */ - void deregister(PipeRealtimeDataRegionSource extractor); + /** Deregister a source. */ + void deregister(PipeRealtimeDataRegionSource source); /** Invalidate cache */ void invalidateCache(); - /** Get the number of registered extractors in this matcher. */ + /** Get the number of registered sources in this matcher. */ int getRegisterCount(); /** - * Match the event's schema info with the registered extractors' patterns. If the event's schema - * info matches the pattern of an extractor, the extractor will be returned. + * Match the event's schema info with the registered sources' patterns. If the event's schema info + * matches the pattern of an source, the source will be returned. * * @param event the event to be matched - * @return pair of matched extractors and unmatched extractors. + * @return pair of matched sources and unmatched sources. */ Pair, Set> match( PipeRealtimeEvent event); - /** Clear all the registered extractors and internal data structures. */ + /** Clear all the registered sources and internal data structures. */ void clear(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/schemaregion/IoTDBSchemaRegionSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/schemaregion/IoTDBSchemaRegionSource.java index b70ff4b7d8d0..69db67f81840 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/schemaregion/IoTDBSchemaRegionSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/schemaregion/IoTDBSchemaRegionSource.java @@ -174,7 +174,7 @@ public synchronized EnrichedEvent supply() throws Exception { @Override protected long getMaxBlockingTimeMs() { // The dataNode processor can sleep if it supplies null - // Here we return immediately to be consistent with the data region extractor + // Here we return immediately to be consistent with the data region source return 0; } 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 cc857b7295cf..0092ba4d02cb 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/impl/DataNodeInternalRPCServiceImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java index acdef794fa39..0568aa13cabf 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 @@ -2376,7 +2376,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/schematree/ClusterSchemaTree.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java index 54a7f6fc8c78..29c475f96841 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 5b18b0474b60..0b8f7fa0ddb6 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/source/FileLoaderUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/FileLoaderUtils.java index d34abd609465..0f4ba6dc3a24 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 @@ -183,8 +183,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 37603ee2dbca..53d2869c0f1b 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 4cae2c0f2884..d04715a3ead7 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 @@ -2403,8 +2403,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) { 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 2274762341b5..23e1c669bebc 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 @@ -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); @@ -454,11 +454,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 = @@ -486,12 +486,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 a220fdf2883d..024fc73f5bad 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/execution/config/executor/ClusterConfigTaskExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java index 4675c9b9e009..9b485c372a92 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 @@ -1371,7 +1371,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()) { @@ -2174,7 +2174,7 @@ public SettableFuture createPipe( .setPipeName(createPipeStatement.getPipeName() + "_realtime") // NOTE: set if not exists always to true to handle partial failure .setIfNotExistsCondition(true) - // Use extractor parameters for real-time data + // Use source parameters for real-time data .setExtractorAttributes( sourcePipeParameters .addOrReplaceEquivalentAttributesWithClone( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/sys/pipe/PipeFunctionSupport.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/sys/pipe/PipeFunctionSupport.java index 0edc18c3f001..121946568dac 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/sys/pipe/PipeFunctionSupport.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/sys/pipe/PipeFunctionSupport.java @@ -32,27 +32,27 @@ public class PipeFunctionSupport { private static final Logger LOGGER = LoggerFactory.getLogger(PipeFunctionSupport.class); public static void applyNowFunctionToExtractorAttributes( - final Map extractorAttributes, + final Map sourceAttributes, final String sourceKey, final String extractorKey, final long currentTime) { final Pair pair = - getExtractorAttributesKeyAndValue(extractorAttributes, sourceKey, extractorKey); + getExtractorAttributesKeyAndValue(sourceAttributes, sourceKey, extractorKey); if (pair == null) { return; } if (isNowFunction(pair.right)) { - extractorAttributes.replace(pair.left, String.valueOf(currentTime)); + sourceAttributes.replace(pair.left, String.valueOf(currentTime)); } } private static Pair getExtractorAttributesKeyAndValue( - final Map extractorAttributes, + final Map sourceAttributes, final String sourceKey, final String extractorKey) { String key = sourceKey; - String value = extractorAttributes.get(key); + String value = sourceAttributes.get(key); if (value != null) { return new Pair<>(key, value); } @@ -60,7 +60,7 @@ private static Pair getExtractorAttributesKeyAndValue( // "source.".length() == 7 try { key = sourceKey.substring(7); - value = extractorAttributes.get(key); + value = sourceAttributes.get(key); } catch (Exception e) { LOGGER.warn( "The prefix of sourceKey is not 'source.'. Please check the parameters passed in: {}", @@ -72,7 +72,7 @@ private static Pair getExtractorAttributesKeyAndValue( } key = extractorKey; - value = extractorAttributes.get(key); + value = sourceAttributes.get(key); if (value != null) { return new Pair<>(key, value); } 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 aef4a199c390..f7755bd02d3b 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/planner/SubPlanTypeExtractor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/SubPlanTypeExtractor.java index 48e592631dd7..ec1f9053d767 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/SubPlanTypeExtractor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/SubPlanTypeExtractor.java @@ -46,7 +46,7 @@ public class SubPlanTypeExtractor { private SubPlanTypeExtractor() {} - public static TypeProvider extractor(PlanNode root, TypeProvider allTypes) { + public static TypeProvider source(PlanNode root, TypeProvider allTypes) { TypeProvider typeProvider = new TypeProvider(allTypes.getTreeModelTypeMap(), allTypes.getTemplatedInfo()); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/PlanFragment.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/PlanFragment.java index a178c5c1f6cd..72ec355fb4ee 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/PlanFragment.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/PlanFragment.java @@ -95,7 +95,7 @@ public void setTypeProvider(TypeProvider typeProvider) { } public void generateTypeProvider(TypeProvider allTypes) { - this.typeProvider = SubPlanTypeExtractor.extractor(planNodeTree, allTypes); + this.typeProvider = SubPlanTypeExtractor.source(planNodeTree, allTypes); } public void generateTableModelTypeProvider(TypeProvider allTypes) { 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 ddfaed455a74..e82f8119e234 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 50b64e029c0b..6a53a309b94c 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 cfba72d66db6..a741becefd3d 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 ac30dcf505af..b589b9fdd527 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 d986baf2faa3..b41eec9a67aa 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/statement/component/ResultColumn.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/component/ResultColumn.java index f97391330811..8da242955449 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/schemaengine/SchemaEngine.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java index 3f59f9edf68e..a789c0ddc120 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/attribute/update/GeneralRegionAttributeSecurityService.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/GeneralRegionAttributeSecurityService.java index 1bff56500ead..408cc1215900 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/GeneralRegionAttributeSecurityService.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/GeneralRegionAttributeSecurityService.java @@ -102,9 +102,7 @@ protected void executeTask() { // UpdateClearContainer and version / TEndPoint are not calculated final AtomicInteger limit = new AtomicInteger( - CommonDescriptor.getInstance() - .getConfig() - .getPipeConnectorRequestSliceThresholdBytes()); + CommonDescriptor.getInstance().getConfig().getPipeSinkRequestSliceThresholdBytes()); final AtomicBoolean hasRemaining = new AtomicBoolean(false); final Map>> attributeUpdateCommitMap = 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 230ed8330ca1..9744e0aae1ca 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 @@ -92,7 +92,7 @@ import org.apache.iotdb.db.schemaengine.schemaregion.logfile.SchemaLogWriter; import org.apache.iotdb.db.schemaengine.schemaregion.logfile.visitor.SchemaRegionPlanDeserializer; import org.apache.iotdb.db.schemaengine.schemaregion.logfile.visitor.SchemaRegionPlanSerializer; -import org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.mem.MTreeBelowSGMemoryImpl; +import org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.mem.MTreeBelowDBMemoryImpl; import org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.mem.mnode.IMemMNode; import org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.mem.mnode.info.TableDeviceInfo; import org.apache.iotdb.db.schemaengine.schemaregion.read.req.IShowDevicesPlan; @@ -215,7 +215,7 @@ public class SchemaRegionMemoryImpl implements ISchemaRegion { private final DataNodeSchemaQuotaManager schemaQuotaManager = DataNodeSchemaQuotaManager.getInstance(); - private MTreeBelowSGMemoryImpl mTree; + private MTreeBelowDBMemoryImpl mTree; private TagManager tagManager; private IDeviceAttributeStore deviceAttributeStore; private DeviceAttributeCacheUpdater deviceAttributeCacheUpdater; @@ -275,7 +275,7 @@ public synchronized void init() throws MetadataException { regionStatistics, PathUtils.unQualifyDatabaseName(databaseFullPath)); tagManager = new TagManager(schemaRegionDirPath, regionStatistics); mTree = - new MTreeBelowSGMemoryImpl( + new MTreeBelowDBMemoryImpl( PartialPath.getQualifiedDatabasePartialPath(databaseFullPath), tagManager::readTags, tagManager::readAttributes, @@ -402,7 +402,7 @@ private int initFromLog() throws IOException { databaseFullPath); return idx; } catch (final Exception e) { - throw new IOException("Failed to parse " + databaseFullPath + " mlog.bin", e); + throw new IOException("Failed to parse " + databaseFullPath + " mlog.bin for err:" + e); } } else { return 0; @@ -591,7 +591,7 @@ public void loadSnapshot(final File latestSnapshotRootDir) { snapshotStartTime = System.currentTimeMillis(); mTree = - MTreeBelowSGMemoryImpl.loadFromSnapshot( + MTreeBelowDBMemoryImpl.loadFromSnapshot( latestSnapshotRootDir, databaseFullPath, regionStatistics, 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/MTreeBelowDBMemoryImpl.java similarity index 99% rename from iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java rename to iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowDBMemoryImpl.java index 9aec147ace1f..f958e20ac602 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/MTreeBelowDBMemoryImpl.java @@ -134,9 +134,9 @@ *
  • Interfaces and Implementation for Template check * */ -public class MTreeBelowSGMemoryImpl { +public class MTreeBelowDBMemoryImpl { - private static final Logger LOGGER = LoggerFactory.getLogger(MTreeBelowSGMemoryImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(MTreeBelowDBMemoryImpl.class); // this implementation is based on memory, thus only MTree write operation must invoke MTreeStore private final MemMTreeStore store; @@ -153,7 +153,7 @@ public class MTreeBelowSGMemoryImpl { private final MemSchemaRegionStatistics regionStatistics; // region MTree initialization, clear and serialization - public MTreeBelowSGMemoryImpl( + public MTreeBelowDBMemoryImpl( final PartialPath databasePath, final Function, Map> tagGetter, final Function, Map> attributeGetter, @@ -168,7 +168,7 @@ public MTreeBelowSGMemoryImpl( this.attributeGetter = attributeGetter; } - private MTreeBelowSGMemoryImpl( + private MTreeBelowDBMemoryImpl( final PartialPath databasePath, final MemMTreeStore store, final Function, Map> tagGetter, @@ -192,7 +192,7 @@ public synchronized boolean createSnapshot(final File snapshotDir) { return store.createSnapshot(snapshotDir); } - public static MTreeBelowSGMemoryImpl loadFromSnapshot( + public static MTreeBelowDBMemoryImpl loadFromSnapshot( final File snapshotDir, final String databaseFullPath, final MemSchemaRegionStatistics regionStatistics, @@ -203,7 +203,7 @@ public static MTreeBelowSGMemoryImpl loadFromSnapshot( final Function, Map> tagGetter, final Function, Map> attributeGetter) throws IOException, IllegalPathException { - return new MTreeBelowSGMemoryImpl( + return new MTreeBelowDBMemoryImpl( PartialPath.getQualifiedDatabasePartialPath(databaseFullPath), MemMTreeStore.loadFromSnapshot( snapshotDir, @@ -427,7 +427,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); @@ -447,7 +447,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); @@ -798,7 +798,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/pbtree/MTreeBelowSGCachedImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java index 6ff965f112f6..eb61cebccaf7 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 @@ -597,7 +597,7 @@ private ICachedMNode checkAndAutoCreateInternalPath(PartialPath devicePath) 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,7 +620,7 @@ private ICachedMNode checkAndAutoCreateInternalPath(PartialPath devicePath) private ICachedMNode checkAndAutoCreateDeviceNode(String deviceName, ICachedMNode deviceParent) throws MetadataException { if (deviceParent == null) { - // device is sg + // device is db pinMNode(storageGroupMNode); return storageGroupMNode; } @@ -825,7 +825,7 @@ 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(); 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 546d1df726b9..f920c17b6c0e 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/SchemaFile.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/SchemaFile.java index 692736474bad..2d68acd18f4b 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 @@ -73,7 +73,7 @@ public class SchemaFile implements ISchemaFile { 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; @@ -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} + *
      • 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} *
      @@ -357,7 +357,7 @@ private void initFileHeader() throws IOException, MetadataException { ReadWriteIOUtils.write(isEntity, headerContent); ReadWriteIOUtils.write(sgNodeTemplateIdWithState, headerContent); ReadWriteIOUtils.write(SchemaFileConfig.SCHEMA_FILE_VERSION, headerContent); - lastSGAddr = 0L; + lastDBAddr = 0L; pageManager = new BTreePageManager(channel, pmtFile, -1, logPath); } else { channel.read(headerContent); @@ -366,7 +366,7 @@ private void initFileHeader() throws IOException, MetadataException { dataTTL = ReadWriteIOUtils.readLong(headerContent); isEntity = ReadWriteIOUtils.readBool(headerContent); sgNodeTemplateIdWithState = ReadWriteIOUtils.readInt(headerContent); - lastSGAddr = ReadWriteIOUtils.readLong(headerContent); + lastDBAddr = ReadWriteIOUtils.readLong(headerContent); if (ReadWriteIOUtils.readInt(headerContent) != SchemaFileConfig.SCHEMA_FILE_VERSION) { channel.close(); @@ -384,7 +384,7 @@ private void updateHeaderBuffer() throws IOException { ReadWriteIOUtils.write(dataTTL, headerContent); ReadWriteIOUtils.write(isEntity, headerContent); ReadWriteIOUtils.write(sgNodeTemplateIdWithState, headerContent); - ReadWriteIOUtils.write(lastSGAddr, headerContent); + ReadWriteIOUtils.write(lastDBAddr, headerContent); ReadWriteIOUtils.write(SchemaFileConfig.SCHEMA_FILE_VERSION, headerContent); headerContent.flip(); 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 24b7e93939e0..a83af6855f32 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 46d1365a2c45..7ffb3a838819 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 740f6133a549..715975df1537 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 97dba7fc4108..79de82e9c24c 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 4996e3f0c8b3..675ba200fac8 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 4641bffcf93f..94a54aec3a0b 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 d8b6ef036210..ee07da07fde7 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/utils/MetaUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/MetaUtils.java index 11b41b238a34..5801ec6c2238 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 857db6570773..2297f080e505 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 @@ -398,14 +398,14 @@ public List