Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ Import-CSV supports specify data type and no need quotation for text value
* [GITHUB-3339] Try to fix sg dead lock
* [GITHUB-3329] Fix upgrade NPE and DeadLock
* [GITHUB-3319] Fix upgrade tool cannot close file reader
* [IOTDB-1212] Fix The given error message is not right when executing select sin(non_existence) from root.sg1.d1
* [IOTDB-1212] Fix The given error message is not right when executing select sin(non_existence) from root.db1.d1
* [IOTDB-1219] Fix a potential NPE issue in UDF module
* [IOTDB-1286] Fix 4 C++ mem-leak points
* [IOTDB-1294] Fix delete operation become invalid after compaction
Expand Down
46 changes: 23 additions & 23 deletions example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Session *session;
#define DEFAULT_ROW_NUMBER 1000000

void createAlignedTimeseries() {
string alignedDeviceId = "root.sg1.d1";
string alignedDeviceId = "root.db1.d1";
vector<string> measurements = {"s1", "s2", "s3"};
vector<string> alignedTimeseries = {"root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3"};
vector<string> alignedTimeseries = {"root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3"};
vector<TSDataType::TSDataType> dataTypes = {TSDataType::INT32, TSDataType::DOUBLE, TSDataType::BOOLEAN};
vector<TSEncoding::TSEncoding> encodings = {TSEncoding::PLAIN, TSEncoding::GORILLA, TSEncoding::RLE};
vector<CompressionType::CompressionType> compressors = {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -101,7 +101,7 @@ void showTimeseries() {
}

void insertAlignedRecord() {
string deviceId = "root.sg1.d1";
string deviceId = "root.db1.d1";
vector<string> measurements;
measurements.emplace_back("s1");
measurements.emplace_back("s2");
Expand All @@ -117,7 +117,7 @@ void insertAlignedRecord() {
}

void insertAlignedRecords() {
string deviceId = "root.sg1.d1";
string deviceId = "root.db1.d1";
vector<string> measurements;
measurements.emplace_back("s1");
measurements.emplace_back("s2");
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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<string, Tablet *> 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++;
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -291,7 +291,7 @@ void insertNullableTabletWithAlignedTimeseries() {
}

void query() {
unique_ptr<SessionDataSet> dataSet = session->executeQueryStatement("select * from root.sg1.**");
unique_ptr<SessionDataSet> dataSet = session->executeQueryStatement("select * from root.db1.**");
cout << "timestamp" << " ";
for (const string &name: dataSet->getColumnNames()) {
cout << name << " ";
Expand All @@ -315,11 +315,11 @@ void deleteData() {

void deleteTimeseries() {
vector<string> paths;
vector<string> 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<string> 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 &timeseries: alignedTimeseries) {
if (session->checkTimeseriesExists(timeseries)) {
paths.push_back(timeseries);
Expand All @@ -330,8 +330,8 @@ void deleteTimeseries() {

void deleteStorageGroups() {
vector<string> storageGroups;
storageGroups.emplace_back("root.sg1");
storageGroups.emplace_back("root.sg2");
storageGroups.emplace_back("root.db1");
storageGroups.emplace_back("root.db2");
session->deleteStorageGroups(storageGroups);
}

Expand All @@ -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());
Expand Down
68 changes: 34 additions & 34 deletions example/client-cpp-example/src/SessionExample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> tags;
tags["tag1"] = "v1";
map<string, string> 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<string> 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<TSDataType::TSDataType> tsDataTypes;
tsDataTypes.push_back(TSDataType::INT64);
tsDataTypes.push_back(TSDataType::DOUBLE);
Expand Down Expand Up @@ -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() {
Expand All @@ -129,7 +129,7 @@ void showTimeseries() {
}

void insertRecord() {
string deviceId = "root.sg2.d1";
string deviceId = "root.db2.d1";
vector<string> measurements;
measurements.emplace_back("s1");
measurements.emplace_back("s2");
Expand All @@ -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++;
Expand Down Expand Up @@ -180,7 +180,7 @@ void insertTablet() {
}

void insertRecords() {
string deviceId = "root.sg2.d1";
string deviceId = "root.db2.d1";
vector<string> measurements;
measurements.emplace_back("s1");
measurements.emplace_back("s2");
Expand Down Expand Up @@ -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<string, Tablet *> 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++;
Expand Down Expand Up @@ -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++;
Expand All @@ -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() {
Expand All @@ -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<string> paths;
vector<string> 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<string> 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);
Expand All @@ -353,8 +353,8 @@ void deleteTimeseries() {

void deleteStorageGroups() {
vector<string> storageGroups;
storageGroups.emplace_back("root.sg1");
storageGroups.emplace_back("root.sg2");
storageGroups.emplace_back("root.db1");
storageGroups.emplace_back("root.db2");
session->deleteStorageGroups(storageGroups);
}

Expand All @@ -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());
Expand All @@ -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());
Expand Down
18 changes: 9 additions & 9 deletions example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
}
}
Loading
Loading