Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed ID->TAG, MEASUREMENT->FIELD in create/desc table sql #14540

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c895f84
Rename table concept
HTHou Dec 24, 2024
74ab1ae
Rename table concept
HTHou Dec 24, 2024
b9c0586
Fix IT
HTHou Dec 24, 2024
0910937
Main
Caideyipi Dec 24, 2024
670a74f
Update IoTDBTableAggregationIT.java
Caideyipi Dec 24, 2024
f3cefad
Update sessionRelationalIT.cpp
Caideyipi Dec 24, 2024
102231f
Py fix
Caideyipi Dec 24, 2024
b315433
Update test_tablemodel_insert.py
Caideyipi Dec 24, 2024
0041f50
Fix1
Caideyipi Dec 24, 2024
3d1fb40
Fix
Caideyipi Dec 24, 2024
7eb2e60
re-trigger CI
Caideyipi Dec 24, 2024
763e99b
Fix IT
HTHou Dec 25, 2024
8d4e7cd
Partial Fix
Caideyipi Dec 25, 2024
7ec81dd
Merge branch 'master' of https://github.com/apache/iotdb into renaming
Caideyipi Dec 25, 2024
52f9214
Update IoTDBSessionRelationalIT.java
Caideyipi Dec 25, 2024
e95f006
Update IoTDBQueryWithComplexValueFilterTableIT.java
Caideyipi Dec 25, 2024
6ce7b59
Merge branch 'master' of github.com:apache/iotdb into rename_table_co…
HTHou Dec 25, 2024
f2553f4
Fix IT
HTHou Dec 25, 2024
84af07a
Fix
Caideyipi Dec 25, 2024
741b0b5
Update SubqueryDataSetUtils.java
Caideyipi Dec 25, 2024
4ec76f6
Update IoTDBCastFunctionTableSpecialIT.java
Caideyipi Dec 25, 2024
9fd5be7
Update IoTDBInsertAlignedValuesTableIT.java
Caideyipi Dec 25, 2024
bf3343b
upload
Caideyipi Dec 25, 2024
10469b5
Update IoTDBRestServiceInsertAlignedValuesIT.java
Caideyipi Dec 25, 2024
de53add
Fix
Caideyipi Dec 25, 2024
65dcca0
Update TableModelUtils.java
Caideyipi Dec 25, 2024
47ef408
Update IoTDBMultiTAGsWithAttributesTableIT.java
Caideyipi Dec 25, 2024
59e1807
Fix
Caideyipi Dec 26, 2024
9e0d5fa
Merge branch 'apache:master' into renaming
Caideyipi Dec 26, 2024
fe5d93b
Merge remote-tracking branch 'upstream/rename_table_concepts' into re…
Caideyipi Dec 26, 2024
203f7ac
Merge branch 'renaming' of https://github.com/Caideyipi/iotdb into re…
Caideyipi Dec 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions example/client-cpp-example/src/TableModelSessionExample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ void insertRelationalTablet() {
make_pair("device_id", TSDataType::TEXT),
make_pair("model", TSDataType::TEXT),
make_pair("temperature", TSDataType::FLOAT),
make_pair("humidity", TSDataType::DOUBLE)
make_pair("humtagity", TSDataType::DOUBLE)
Caideyipi marked this conversation as resolved.
Show resolved Hide resolved
};

vector<ColumnCategory> columnTypes = {
ColumnCategory::ID,
ColumnCategory::ID,
ColumnCategory::ID,
ColumnCategory::TAG,
ColumnCategory::TAG,
ColumnCategory::TAG,
ColumnCategory::ATTRIBUTE,
ColumnCategory::MEASUREMENT,
ColumnCategory::MEASUREMENT
Expand All @@ -54,7 +54,7 @@ void insertRelationalTablet() {
tablet.addValue("device_id", rowIndex, "3");
tablet.addValue("model", rowIndex, "A");
tablet.addValue("temperature", rowIndex, 37.6F);
tablet.addValue("humidity", rowIndex, 111.1);
tablet.addValue("humtagity", rowIndex, 111.1);
if (tablet.rowSize == tablet.maxRowNumber) {
session->insert(tablet);
tablet.reset();
Expand Down Expand Up @@ -101,8 +101,8 @@ int main() {

cout << "Create Table table1,table2" << endl;
try {
session->executeNonQueryStatement("create table db1.table1(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT) with (TTL=3600000)");
session->executeNonQueryStatement("create table db2.table2(region_id STRING ID, plant_id STRING ID, color STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, speed DOUBLE MEASUREMENT) with (TTL=6600000)");
session->executeNonQueryStatement(" db1.table1(region_id STRING TAG, plant_id STRING TAG, device_id STRING TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humtagity DOUBLE FIELD) with (TTL=3600000)");
session->executeNonQueryStatement("create table db2.table2(region_id STRING TAG, plant_id STRING TAG, color STRING ATTRIBUTE, temperature FLOAT FIELD, speed DOUBLE FIELD) with (TTL=6600000)");
} catch (IoTDBException &e) {
cout << e.what() << endl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public static void main(String[] args) {

// or use full qualified table name
session.executeNonQueryStatement(
"create table test1.table1(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT) with (TTL=3600000)");
"create table test1.table1(region_id STRING TAG, plant_id STRING TAG, device_id STRING TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD) with (TTL=3600000)");

session.executeNonQueryStatement(
"create table table2(region_id STRING ID, plant_id STRING ID, color STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, speed DOUBLE MEASUREMENT) with (TTL=6600000)");
"create table table2(region_id STRING TAG, plant_id STRING TAG, color STRING ATTRIBUTE, temperature FLOAT FIELD, speed DOUBLE FIELD) with (TTL=6600000)");

// show tables from current database
try (SessionDataSet dataSet = session.executeQueryStatement("SHOW TABLES")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@ public static void main(String[] args) {
// or use full qualified table name
session.executeNonQueryStatement(
"create table test1.table1("
+ "region_id STRING ID, "
+ "plant_id STRING ID, "
+ "device_id STRING ID, "
+ "region_id STRING TAG, "
+ "plant_id STRING TAG, "
+ "device_id STRING TAG, "
+ "model STRING ATTRIBUTE, "
+ "temperature FLOAT MEASUREMENT, "
+ "humidity DOUBLE MEASUREMENT) with (TTL=3600000)");
+ "temperature FLOAT FIELD, "
+ "humidity DOUBLE FIELD) with (TTL=3600000)");

session.executeNonQueryStatement(
"create table table2("
+ "region_id STRING ID, "
+ "plant_id STRING ID, "
+ "region_id STRING TAG, "
+ "plant_id STRING TAG, "
+ "color STRING ATTRIBUTE, "
+ "temperature FLOAT MEASUREMENT, "
+ "speed DOUBLE MEASUREMENT) with (TTL=6600000)");
+ "temperature FLOAT FIELD, "
+ "speed DOUBLE FIELD) with (TTL=6600000)");

// show tables from current database
try (SessionDataSet dataSet = session.executeQueryStatement("SHOW TABLES")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*
* <p>USE test;
*
* <p>CREATE TABLE t1(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT);
* <p>CREATE TABLE t1(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD);
*
* <p>INSERT INTO t1(time, device_id, s1, s2) VALUES (1, 'd1', 'a', 1), (2, 'd1', null, 2), (3,
* 'd2', 'c', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ScalarFunctionExample implements ScalarFunction {
*
* <p>USE test;
*
* <p>CREATE TABLE t1(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT);
* <p>CREATE TABLE t1(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD);
*
* <p>INSERT INTO t1(time, device_id, s1, s2) VALUES (1, 'd1', 'a', 1), (2, 'd1', null, 2), (3,
* 'd1', 'c', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void testReceiverNotLoadDeletedTimeseries() throws Exception {
}
}

// Test that receiver will not load data when table exists but ID columns mismatch
// Test that receiver will not load data when table exists but TAG columns mismatch
@Test
public void testReceiverNotLoadWhenIdColumnMismatch() throws Exception {
final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
Expand Down Expand Up @@ -161,9 +161,9 @@ public void testReceiverNotLoadWhenIdColumnMismatch() throws Exception {
statement.execute("create database if not exists db");
statement.execute("use db");
statement.execute(
"create table if not exists t1(id1 STRING ID, id2 STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT)");
statement.execute("INSERT INTO t1(time,id1,id2,s1,s2) values(1, 'd1', 'd2', 'red', 1)");
statement.execute("INSERT INTO t1(time,id1,id2,s1,s2) values(2, 'd1', 'd2', 'blue', 2)");
"create table if not exists t1(tag1 STRING TAG, tag2 STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD)");
statement.execute("INSERT INTO t1(time,tag1,tag2,s1,s2) values(1, 'd1', 'd2', 'red', 1)");
statement.execute("INSERT INTO t1(time,tag1,tag2,s1,s2) values(2, 'd1', 'd2', 'blue', 2)");
statement.execute("flush");
} catch (Exception e) {
fail(e.getMessage());
Expand All @@ -174,9 +174,10 @@ public void testReceiverNotLoadWhenIdColumnMismatch() throws Exception {
statement.execute("create database if not exists db");
statement.execute("use db");
statement.execute(
"create table if not exists t1(id3 STRING ID, id4 STRING ID, s3 TEXT MEASUREMENT, s4 INT32 MEASUREMENT)");
statement.execute("INSERT INTO t1(time,id3,id4,s3,s4) values(1, 'd3', 'd4', 'red2', 10)");
statement.execute("INSERT INTO t1(time,id3,id4,s3,s4) values(2, 'd3', 'd4', 'blue2', 20)");
"create table if not exists t1(tag3 STRING TAG, tag4 STRING TAG, s3 TEXT FIELD, s4 INT32 FIELD)");
statement.execute("INSERT INTO t1(time,tag3,tag4,s3,s4) values(1, 'd3', 'd4', 'red2', 10)");
statement.execute(
"INSERT INTO t1(time,tag3,tag4,s3,s4) values(2, 'd3', 'd4', 'blue2', 20)");
statement.execute("flush");
} catch (Exception e) {
fail(e.getMessage());
Expand Down Expand Up @@ -205,15 +206,15 @@ public void testReceiverNotLoadWhenIdColumnMismatch() throws Exception {
TestUtils.assertDataEventuallyOnEnv(
receiverEnv,
"select * from t1",
"time,id3,id4,s3,s4,",
"time,tag3,tag4,s3,s4,",
expectedResSet,
"db",
handleFailure);
}
}

// Test that receiver can load data when table exists and existing ID columns are the prefix of
// incoming ID columns
// Test that receiver can load data when table exists and existing TAG columns are the prefix of
// incoming TAG columns
@Test
public void testReceiverAutoExtendIdColumn() throws Exception {
final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
Expand Down Expand Up @@ -243,11 +244,11 @@ public void testReceiverAutoExtendIdColumn() throws Exception {
statement.execute("create database if not exists db");
statement.execute("use db");
statement.execute(
"create table if not exists t1(id1 STRING ID, id2 STRING ID, id3 STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT)");
"create table if not exists t1(tag1 STRING TAG, tag2 STRING TAG, tag3 STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD)");
statement.execute(
"INSERT INTO t1(time,id1,id2,id3,s1,s2) values(1, 'd1', 'd2', 'd3', 'red', 1)");
"INSERT INTO t1(time,tag1,tag2,tag3,s1,s2) values(1, 'd1', 'd2', 'd3', 'red', 1)");
statement.execute(
"INSERT INTO t1(time,id1,id2,id3,s1,s2) values(2, 'd1', 'd2', 'd3', 'blue', 2)");
"INSERT INTO t1(time,tag1,tag2,tag3,s1,s2) values(2, 'd1', 'd2', 'd3', 'blue', 2)");
statement.execute("flush");
} catch (Exception e) {
fail(e.getMessage());
Expand All @@ -258,9 +259,10 @@ public void testReceiverAutoExtendIdColumn() throws Exception {
statement.execute("create database if not exists db");
statement.execute("use db");
statement.execute(
"create table if not exists t1(id1 STRING ID, id2 STRING ID, s3 TEXT MEASUREMENT, s4 INT32 MEASUREMENT)");
statement.execute("INSERT INTO t1(time,id1,id2,s3,s4) values(1, 'd1', 'd2', 'red2', 10)");
statement.execute("INSERT INTO t1(time,id1,id2,s3,s4) values(2, 'd1', 'd2', 'blue2', 20)");
"create table if not exists t1(tag1 STRING TAG, tag2 STRING TAG, s3 TEXT FIELD, s4 INT32 FIELD)");
statement.execute("INSERT INTO t1(time,tag1,tag2,s3,s4) values(1, 'd1', 'd2', 'red2', 10)");
statement.execute(
"INSERT INTO t1(time,tag1,tag2,s3,s4) values(2, 'd1', 'd2', 'blue2', 20)");
statement.execute("flush");
} catch (Exception e) {
fail(e.getMessage());
Expand All @@ -280,19 +282,19 @@ public void testReceiverAutoExtendIdColumn() throws Exception {
expectedResSet.add("1970-01-01T00:00:00.002Z,d1,d2,null,null,d3,blue,2,");
expectedResSet.add("1970-01-01T00:00:00.001Z,d1,d2,red2,10,null,null,null,");
expectedResSet.add("1970-01-01T00:00:00.002Z,d1,d2,blue2,20,null,null,null,");
// make sure data are transferred and column "id3" is auto extended
// make sure data are transferred and column "tag3" is auto extended
TestUtils.assertDataEventuallyOnEnv(
receiverEnv,
"select * from t1",
"time,id1,id2,s3,s4,id3,s1,s2,",
"time,tag1,tag2,s3,s4,tag3,s1,s2,",
expectedResSet,
"db",
handleFailure);
}
}

// Test that receiver can load data when table exists and incoming ID columns are the prefix of
// existing ID columns
// Test that receiver can load data when table exists and incoming TAG columns are the prefix of
// existing TAG columns
@Test
public void testLoadWhenIncomingIdColumnsArePrefixOfExisting() throws Exception {
final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
Expand Down Expand Up @@ -322,9 +324,9 @@ public void testLoadWhenIncomingIdColumnsArePrefixOfExisting() throws Exception
statement.execute("create database if not exists db");
statement.execute("use db");
statement.execute(
"create table if not exists t1(id1 STRING ID, id2 STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT)");
statement.execute("INSERT INTO t1(time,id1,id2,s1,s2) values(1, 'd1', 'd2', 'red', 1)");
statement.execute("INSERT INTO t1(time,id1,id2,s1,s2) values(2, 'd1', 'd2', 'blue', 2)");
"create table if not exists t1(tag1 STRING TAG, tag2 STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD)");
statement.execute("INSERT INTO t1(time,tag1,tag2,s1,s2) values(1, 'd1', 'd2', 'red', 1)");
statement.execute("INSERT INTO t1(time,tag1,tag2,s1,s2) values(2, 'd1', 'd2', 'blue', 2)");
statement.execute("flush");
} catch (Exception e) {
fail(e.getMessage());
Expand All @@ -335,11 +337,11 @@ public void testLoadWhenIncomingIdColumnsArePrefixOfExisting() throws Exception
statement.execute("create database if not exists db");
statement.execute("use db");
statement.execute(
"create table if not exists t1(id1 STRING ID, id2 STRING ID, id3 STRING ID,s3 TEXT MEASUREMENT, s4 INT32 MEASUREMENT)");
"create table if not exists t1(tag1 STRING TAG, tag2 STRING TAG, tag3 STRING TAG,s3 TEXT FIELD, s4 INT32 FIELD)");
statement.execute(
"INSERT INTO t1(time,id1,id2,id3,s3,s4) values(1, 'd1', 'd2', 'd3', 'red2', 10)");
"INSERT INTO t1(time,tag1,tag2,tag3,s3,s4) values(1, 'd1', 'd2', 'd3', 'red2', 10)");
statement.execute(
"INSERT INTO t1(time,id1,id2,id3,s3,s4) values(2, 'd1', 'd2', 'd3', 'blue2', 20)");
"INSERT INTO t1(time,tag1,tag2,tag3,s3,s4) values(2, 'd1', 'd2', 'd3', 'blue2', 20)");
statement.execute("flush");
} catch (Exception e) {
fail(e.getMessage());
Expand All @@ -359,11 +361,11 @@ public void testLoadWhenIncomingIdColumnsArePrefixOfExisting() throws Exception
expectedResSet.add("1970-01-01T00:00:00.002Z,d1,d2,d3,blue2,20,null,null,");
expectedResSet.add("1970-01-01T00:00:00.001Z,d1,d2,null,null,null,red,1,");
expectedResSet.add("1970-01-01T00:00:00.002Z,d1,d2,null,null,null,blue,2,");
// make sure data are transferred and column "id3" is null in transferred data
// make sure data are transferred and column "tag3" is null in transferred data
TestUtils.assertDataEventuallyOnEnv(
receiverEnv,
"select * from t1",
"time,id1,id2,id3,s3,s4,s1,s2,",
"time,tag1,tag2,tag3,s3,s4,s1,s2,",
expectedResSet,
10,
"db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
* Please note that the Table pattern defined by this class is fixed, and it is recommended to use
* all methods together to ensure data consistency and integrity.
*
* <p>This class provides a structured approach to inserting data, suitable for scenarios where
* <p>This class provtages a structured approach to inserting data, suitable for scenarios where
* batch data insertion is required. Due to the fixed pattern, users should ensure that the data
* format matches the pattern defined by the class.
*/
Expand All @@ -72,7 +72,7 @@ public static void createDataBaseAndTable(BaseEnv baseEnv, String table, String
statement.execute(
"CREATE TABLE "
+ table
+ "(s0 string id, s1 int64 measurement, s2 float measurement, s3 string measurement, s4 timestamp measurement, s5 int32 measurement, s6 double measurement, s7 date measurement, s8 text measurement )");
+ "(s0 string tag, s1 int64 field, s2 float field, s3 string field, s4 timestamp field, s5 int32 field, s6 double field, s7 date field, s8 text field )");
} catch (Exception e) {
fail(e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public class IoTDBCaseWhenThenTableIT {
// normal cases
"CREATE DATABASE " + DATABASE,
"Use " + DATABASE,
"CREATE table table1 (device_id STRING ID, s1 INT32 MEASUREMENT, s5 BOOLEAN MEASUREMENT, s6 TEXT MEASUREMENT)",
"CREATE table table2 (device_id STRING ID, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT)",
"CREATE table table3 (device_id STRING ID, s2 INT64 MEASUREMENT)",
"CREATE table table1 (device_id STRING TAG, s1 INT32 FIELD, s5 BOOLEAN FIELD, s6 TEXT FIELD)",
"CREATE table table2 (device_id STRING TAG, s3 FLOAT FIELD, s4 DOUBLE FIELD)",
"CREATE table table3 (device_id STRING TAG, s2 INT64 FIELD)",
"INSERT INTO table1(time, device_id, s1) values(100, 'd1', 0)",
"INSERT INTO table1(time, device_id, s1) values(200, 'd1', 11)",
"INSERT INTO table1(time, device_id, s1) values(300, 'd1', 22)",
Expand Down
Loading
Loading