diff --git a/example/client-cpp-example/src/TableModelSessionExample.cpp b/example/client-cpp-example/src/TableModelSessionExample.cpp index 276dfe99df1b..d2e76a410178 100644 --- a/example/client-cpp-example/src/TableModelSessionExample.cpp +++ b/example/client-cpp-example/src/TableModelSessionExample.cpp @@ -36,9 +36,9 @@ void insertRelationalTablet() { }; vector columnTypes = { - ColumnCategory::ID, - ColumnCategory::ID, - ColumnCategory::ID, + ColumnCategory::TAG, + ColumnCategory::TAG, + ColumnCategory::TAG, ColumnCategory::ATTRIBUTE, ColumnCategory::MEASUREMENT, ColumnCategory::MEASUREMENT @@ -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, humidity 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; } diff --git a/example/session/src/main/java/org/apache/iotdb/TableModelSessionExample.java b/example/session/src/main/java/org/apache/iotdb/TableModelSessionExample.java index 7f2203f2e43f..0bc12128181c 100644 --- a/example/session/src/main/java/org/apache/iotdb/TableModelSessionExample.java +++ b/example/session/src/main/java/org/apache/iotdb/TableModelSessionExample.java @@ -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")) { @@ -90,12 +90,12 @@ public static void main(String[] args) { List columnTypeList = new ArrayList<>( Arrays.asList( - Tablet.ColumnCategory.ID, - Tablet.ColumnCategory.ID, - Tablet.ColumnCategory.ID, + Tablet.ColumnCategory.TAG, + Tablet.ColumnCategory.TAG, + Tablet.ColumnCategory.TAG, Tablet.ColumnCategory.ATTRIBUTE, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT)); + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD)); Tablet tablet = new Tablet("test1", columnNameList, dataTypeList, columnTypeList, 100); for (long timestamp = 0; timestamp < 100; timestamp++) { int rowIndex = tablet.getRowSize(); diff --git a/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java b/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java index 88ae7a916927..7b126670e172 100644 --- a/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java +++ b/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java @@ -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")) { @@ -108,12 +108,12 @@ public static void main(String[] args) { List columnTypeList = new ArrayList<>( Arrays.asList( - ColumnCategory.ID, - ColumnCategory.ID, - ColumnCategory.ID, + ColumnCategory.TAG, + ColumnCategory.TAG, + ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT)); + ColumnCategory.FIELD, + ColumnCategory.FIELD)); Tablet tablet = new Tablet("test1", columnNameList, dataTypeList, columnTypeList, 100); for (long timestamp = 0; timestamp < 100; timestamp++) { int rowIndex = tablet.getRowSize(); diff --git a/example/udf/src/main/java/org/apache/iotdb/udf/AggregateFunctionExample.java b/example/udf/src/main/java/org/apache/iotdb/udf/AggregateFunctionExample.java index 62ed28956e18..40a13a6d205b 100644 --- a/example/udf/src/main/java/org/apache/iotdb/udf/AggregateFunctionExample.java +++ b/example/udf/src/main/java/org/apache/iotdb/udf/AggregateFunctionExample.java @@ -38,7 +38,7 @@ * *

USE test; * - *

CREATE TABLE t1(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT); + *

CREATE TABLE t1(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD); * *

INSERT INTO t1(time, device_id, s1, s2) VALUES (1, 'd1', 'a', 1), (2, 'd1', null, 2), (3, * 'd2', 'c', null); diff --git a/example/udf/src/main/java/org/apache/iotdb/udf/ScalarFunctionExample.java b/example/udf/src/main/java/org/apache/iotdb/udf/ScalarFunctionExample.java index 7d45f249641c..ab6367f7810c 100644 --- a/example/udf/src/main/java/org/apache/iotdb/udf/ScalarFunctionExample.java +++ b/example/udf/src/main/java/org/apache/iotdb/udf/ScalarFunctionExample.java @@ -34,7 +34,7 @@ public class ScalarFunctionExample implements ScalarFunction { * *

USE test; * - *

CREATE TABLE t1(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT); + *

CREATE TABLE t1(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD); * *

INSERT INTO t1(time, device_id, s1, s2) VALUES (1, 'd1', 'a', 1), (2, 'd1', null, 2), (3, * 'd1', 'c', null); diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeTypeConversionISessionIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeTypeConversionISessionIT.java index f79ab8c73008..6d6d22fafce8 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeTypeConversionISessionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeTypeConversionISessionIT.java @@ -750,7 +750,7 @@ private Tablet generateTabletAndMeasurementSchema( for (int i = 0; i < objects.length; i++) { MeasurementSchema schema = pairs.get(i).left; measurementSchemas.add(schema); - columnTypes.add(Tablet.ColumnCategory.MEASUREMENT); + columnTypes.add(Tablet.ColumnCategory.FIELD); switch (schema.getType()) { case INT64: objects[i] = createTestDataForInt64(); diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/IoTDBPipeTypeConversionISessionIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/IoTDBPipeTypeConversionISessionIT.java index f5ba1f99364a..4145fc9a5d2a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/IoTDBPipeTypeConversionISessionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/IoTDBPipeTypeConversionISessionIT.java @@ -38,6 +38,7 @@ import org.apache.tsfile.utils.DateUtils; import org.apache.tsfile.utils.Pair; import org.apache.tsfile.write.record.Tablet; +import org.apache.tsfile.write.record.Tablet.ColumnCategory; import org.apache.tsfile.write.schema.IMeasurementSchema; import org.apache.tsfile.write.schema.MeasurementSchema; import org.junit.Test; @@ -454,12 +455,12 @@ private Tablet generateTabletAndMeasurementSchema( private List generateTabletColumnCategory(int size) { List columnTypes = new ArrayList<>(size); - columnTypes.add(Tablet.ColumnCategory.ID); - columnTypes.add(Tablet.ColumnCategory.ID); - columnTypes.add(Tablet.ColumnCategory.ID); - columnTypes.add(Tablet.ColumnCategory.ID); + columnTypes.add(Tablet.ColumnCategory.TAG); + columnTypes.add(Tablet.ColumnCategory.TAG); + columnTypes.add(Tablet.ColumnCategory.TAG); + columnTypes.add(Tablet.ColumnCategory.TAG); for (int i = 0; i < size - 4; i++) { - columnTypes.add(Tablet.ColumnCategory.MEASUREMENT); + columnTypes.add(ColumnCategory.FIELD); } return columnTypes; } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/IoTDBPipeWithLoadIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/IoTDBPipeWithLoadIT.java index 26f4ca9a9487..9ac09b2199a2 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/IoTDBPipeWithLoadIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/IoTDBPipeWithLoadIT.java @@ -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); @@ -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()); @@ -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()); @@ -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); @@ -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()); @@ -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()); @@ -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); @@ -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()); @@ -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()); @@ -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", diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/TableModelUtils.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/TableModelUtils.java index ce33dc3e6a53..0d74e2e89201 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/TableModelUtils.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/TableModelUtils.java @@ -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()); } @@ -382,15 +382,15 @@ public static Tablet generateTablet( final List columnTypes = Arrays.asList( - Tablet.ColumnCategory.ID, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT); + Tablet.ColumnCategory.TAG, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD); Tablet tablet = new Tablet( tableName, 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 f747bc645398..1470546f4f84 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 @@ -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)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDeletionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDeletionTableIT.java index fd0a23c97b17..99d80f8a08af 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDeletionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDeletionTableIT.java @@ -59,7 +59,7 @@ public class IoTDBDeletionTableIT { new String[] { "CREATE DATABASE IF NOT EXISTS test", "USE test", - "CREATE TABLE IF NOT EXISTS vehicle0(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)", + "CREATE TABLE IF NOT EXISTS vehicle0(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)", }; private String insertTemplate = @@ -97,7 +97,7 @@ public void testUnsupportedValueFilter() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("use test"); statement.execute( - "CREATE TABLE vehicle1(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)"); + "CREATE TABLE vehicle1(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)"); statement.execute("insert into vehicle1(time, deviceId, s0) values (10, 'd0', 310)"); statement.execute("insert into vehicle1(time, deviceId, s3) values (10, 'd0','text')"); @@ -107,28 +107,28 @@ public void testUnsupportedValueFilter() throws SQLException { statement.execute("DELETE FROM vehicle1 WHERE s0 <= 300 AND s0 > 0"); fail("should not reach here!"); } catch (SQLException e) { - assertEquals("701: The column 's0' does not exist or is not an id column", e.getMessage()); + assertEquals("701: The column 's0' does not exist or is not an tag column", e.getMessage()); } try { statement.execute("DELETE FROM vehicle1 WHERE s3 = 'text'"); fail("should not reach here!"); } catch (SQLException e) { - assertEquals("701: The column 's3' does not exist or is not an id column", e.getMessage()); + assertEquals("701: The column 's3' does not exist or is not an tag column", e.getMessage()); } try { statement.execute("DELETE FROM vehicle1 WHERE s4 != true"); fail("should not reach here!"); } catch (SQLException e) { - assertEquals("701: The column 's4' does not exist or is not an id column", e.getMessage()); + assertEquals("701: The column 's4' does not exist or is not an tag column", e.getMessage()); } try { statement.execute("DELETE FROM vehicle1 WHERE time < 10 and deviceId > 'd0'"); fail("should not reach here!"); } catch (SQLException e) { - assertEquals("701: The operator of id predicate must be '=' for 'd0'", e.getMessage()); + assertEquals("701: The operator of tag predicate must be '=' for 'd0'", e.getMessage()); } try { @@ -145,7 +145,7 @@ public void testUnsupportedValueFilter() throws SQLException { fail("should not reach here!"); } catch (SQLException e) { assertEquals( - "701: The right hand value of id predicate cannot be null with '=' operator, please use 'IS NULL' instead", + "701: The right hand value of tag predicate cannot be null with '=' operator, please use 'IS NULL' instead", e.getMessage()); } @@ -238,7 +238,7 @@ public void testDelAfterFlush() throws SQLException { statement.execute("use ln3"); statement.execute( String.format( - "CREATE TABLE vehicle3(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)")); + "CREATE TABLE vehicle3(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)")); statement.execute( "INSERT INTO vehicle3(time, deviceId, s4) " + "values(1509465600000, 'd0', true)"); @@ -332,7 +332,7 @@ public void testDeleteWithSpecificDevice() throws SQLException { assertEquals(250, cnt); } - // invalid deletion, d1 not exists + // Invalid deletion, d1 not exists statement.execute("DELETE FROM vehicle6 WHERE time <= 200 and deviceId = 'd1'"); try (ResultSet set = statement.executeQuery("SELECT s0 FROM vehicle6")) { int cnt = 0; @@ -354,7 +354,7 @@ public void testDelFlushingMemtable() throws SQLException { statement.execute("use test"); statement.execute( String.format( - "CREATE TABLE vehicle%d(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)", + "CREATE TABLE vehicle%d(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)", testNum)); for (int i = 1; i <= 10000; i++) { @@ -384,7 +384,7 @@ public void testDelMultipleFlushingMemtable() throws SQLException { statement.execute("use test"); statement.execute( String.format( - "CREATE TABLE vehicle%d(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)", + "CREATE TABLE vehicle%d(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)", testNum)); for (int i = 1; i <= 1000; i++) { @@ -423,7 +423,7 @@ public void testDeleteAll() throws SQLException { statement.execute("use test"); statement.execute( String.format( - "CREATE TABLE vehicle%d(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)", + "CREATE TABLE vehicle%d(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)", 9)); statement.execute("insert into vehicle9(time, deviceId, s2) values(9,'d0',9.8)"); @@ -456,11 +456,11 @@ public void testDeleteDataFromEmptyTable() throws SQLException { statement.execute("use test"); statement.execute( String.format( - "CREATE TABLE vehicle%d_1(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)", + "CREATE TABLE vehicle%d_1(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)", 10)); statement.execute( String.format( - "CREATE TABLE vehicle%d_2(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)", + "CREATE TABLE vehicle%d_2(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)", 10)); statement.execute( @@ -484,7 +484,7 @@ public void testDelSeriesWithSpecialSymbol() throws SQLException { statement.execute("use test"); statement.execute( String.format( - "CREATE TABLE vehicle%d(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)", + "CREATE TABLE vehicle%d(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)", 11)); statement.execute("INSERT INTO vehicle11(time, deviceId, s4) VALUES(300, 'device,1', true)"); @@ -538,7 +538,7 @@ public void testDeleteTable() throws SQLException { statement.execute( String.format( - "CREATE TABLE vehicle%d(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)", + "CREATE TABLE vehicle%d(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)", testNum)); try (ResultSet set = statement.executeQuery("SELECT * FROM vehicle" + testNum)) { @@ -597,14 +597,14 @@ public void testDeviceIdWithNull() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("use test"); statement.execute( - "create table t" + testNum + " (id1 string id, id2 string id, s1 int32 measurement)"); - // id1 is null for this record - statement.execute("insert into t" + testNum + " (time, id2, s1) values (1, '1', 1)"); - statement.execute("insert into t" + testNum + " (time, id2, s1) values (2, '', 2)"); - statement.execute("insert into t" + testNum + " (time, id2, s1) values (3, NULL, 3)"); + "create table t" + testNum + " (tag1 string tag, tag2 string tag, s1 int32 field)"); + // tag1 is null for this record + statement.execute("insert into t" + testNum + " (time, tag2, s1) values (1, '1', 1)"); + statement.execute("insert into t" + testNum + " (time, tag2, s1) values (2, '', 2)"); + statement.execute("insert into t" + testNum + " (time, tag2, s1) values (3, NULL, 3)"); statement.execute("flush"); - statement.execute("delete from t" + testNum + " where id1 is NULL and time <= 1"); + statement.execute("delete from t" + testNum + " where tag1 is NULL and time <= 1"); try (ResultSet set = statement.executeQuery("SELECT * FROM t" + testNum + " order by time")) { assertTrue(set.next()); assertEquals(2, set.getLong("time")); @@ -613,7 +613,7 @@ public void testDeviceIdWithNull() throws SQLException { assertFalse(set.next()); } - statement.execute("delete from t" + testNum + " where id2 is NULL"); + statement.execute("delete from t" + testNum + " where tag2 is NULL"); try (ResultSet set = statement.executeQuery("SELECT * FROM t" + testNum + " order by time")) { assertTrue(set.next()); assertEquals(2, set.getLong("time")); @@ -636,14 +636,14 @@ public void testEmptyString() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("use test"); statement.execute( - "create table t" + testNum + " (id1 string id, id2 string id, s1 int32 measurement)"); - // id1 is null for this record - statement.execute("insert into t" + testNum + " (time, id2, s1) values (1, '1', 1)"); - statement.execute("insert into t" + testNum + " (time, id2, s1) values (2, '', 2)"); - statement.execute("insert into t" + testNum + " (time, id2, s1) values (3, NULL, 3)"); + "create table t" + testNum + " (tag1 string tag, tag2 string tag, s1 int32 field)"); + // tag1 is null for this record + statement.execute("insert into t" + testNum + " (time, tag2, s1) values (1, '1', 1)"); + statement.execute("insert into t" + testNum + " (time, tag2, s1) values (2, '', 2)"); + statement.execute("insert into t" + testNum + " (time, tag2, s1) values (3, NULL, 3)"); statement.execute("flush"); - statement.execute("delete from t" + testNum + " where id2 = ''"); + statement.execute("delete from t" + testNum + " where tag2 = ''"); try (ResultSet set = statement.executeQuery("SELECT * FROM t" + testNum + " order by time")) { assertTrue(set.next()); assertEquals(1, set.getLong("time")); @@ -663,7 +663,7 @@ public void testIllegalRange() { Statement statement = connection.createStatement()) { statement.execute("use test"); statement.execute( - "create table t" + testNum + " (id1 string id, id2 string id, s1 int32 measurement)"); + "create table t" + testNum + " (tag1 string tag, tag2 string tag, s1 int32 field)"); statement.execute("delete from t" + testNum + " where time > 10 and time <= 1"); fail("Exception expected"); @@ -679,7 +679,7 @@ public void testMergeDeletion() throws SQLException { statement.execute("create database db1"); statement.execute("use db1"); statement.execute( - "create table t1(country id,region id, city id, device id, ab1 ATTRIBUTE, s1 int32, s2 float, s3 boolean, s4 string)"); + "create table t1(country tag,region tag, city tag, device tag, ab1 ATTRIBUTE, s1 int32, s2 float, s3 boolean, s4 string)"); statement.execute( "INSERT INTO t1(time,country,region,city,device,ab1,s1,s2,s3,s4) values (100,'china','hebei','shijiazhuang','d1','ab1',1,1,1,1),(200,null,'hebei','shijiazhuang','d2','ab2',1,1,1,1),(300,'china','beijing','beijing','d1','ab3',1,1,1,1),(400,'china','tianjin','tianjin','d1','ab4',1,1,1,1),(500,'china','sichuan','chengdu','d1',null,1,1,1,1),(600,'china','zhejiang','hangzhou','d1','ab6',1,1,1,1),(700,'japan','dao','tokyo','d1','ab7',1,1,1,1),(800,'canada','tronto','shijiazhuang','d1','ab8',null,1,1,1),(900,'usa','ca','oldmountain','d1','ab9',1,1,1,1),(1000,'tailand',null,'mangu','d1','ab10',1,1,1,1),(1100,'china','hebei','','d1','ab11',1,1,1,1),(1200,'','hebei','','d1','ab12',1,1,1,1),(1300,'china','','','d1','ab13',1,1,1,1)"); statement.execute("flush"); @@ -731,7 +731,7 @@ public void testDeletionWritePerformance() throws SQLException, IOException { statement.execute("create database if not exists test"); statement.execute("use test"); - statement.execute("create table table1(deviceId STRING ID, s0 INT32 MEASUREMENT)"); + statement.execute("create table table1(deviceId STRING TAG, s0 INT32 FIELD)"); for (int i = 1; i <= fileNumMax; i++) { statement.execute( @@ -783,7 +783,7 @@ public void testDeletionReadPerformance() throws SQLException, IOException { statement.execute("create database if not exists test"); statement.execute("use test"); - statement.execute("create table table1(deviceId STRING ID, s0 INT32 MEASUREMENT)"); + statement.execute("create table table1(deviceId STRING TAG, s0 INT32 FIELD)"); for (int i = 1; i <= fileNumMax; i++) { for (int j = 0; j < pointNumPerFile; j++) { @@ -848,7 +848,7 @@ private void prepareData(int testNum, int deviceNum) throws SQLException { statement.execute("use test"); statement.execute( String.format( - "CREATE TABLE IF NOT EXISTS vehicle%d(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)", + "CREATE TABLE IF NOT EXISTS vehicle%d(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)", testNum)); for (int d = 0; d < deviceNum; d++) { diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDisableDeletionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDisableDeletionTableIT.java index 0f852e576356..42ee6a6881c7 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDisableDeletionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDisableDeletionTableIT.java @@ -68,7 +68,7 @@ public void testDeletionDisabled() throws SQLException { statement.execute("create database test"); statement.execute("use test"); statement.execute( - "CREATE TABLE vehicle1(deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 TEXT MEASUREMENT, s4 BOOLEAN MEASUREMENT)"); + "CREATE TABLE vehicle1(deviceId STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 TEXT FIELD, s4 BOOLEAN FIELD)"); statement.execute("insert into vehicle1(time, deviceId, s0) values (10, 'd0', 310)"); statement.execute("insert into vehicle1(time, deviceId, s3) values (10, 'd0','text')"); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBExecuteBatchTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBExecuteBatchTableIT.java index 98506fb8cd03..a6d71ff52686 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBExecuteBatchTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBExecuteBatchTableIT.java @@ -61,17 +61,17 @@ public void testJDBCExecuteBatch() { statement.setFetchSize(5); statement.addBatch("create database ln"); statement.addBatch("USE \"ln\""); - statement.addBatch("create table wf01 (id1 string id, temprature double measurement)"); + statement.addBatch("create table wf01 (tag1 string tag, temprature double field)"); statement.addBatch( - "insert into wf01(id1,time,temperature) values(\'wt01\', 1509465600000,1.2)"); + "insert into wf01(tag1,time,temperature) values(\'wt01\', 1509465600000,1.2)"); statement.addBatch( - "insert into wf01(id1,time,temperature) values(\'wt01\', 1509465600001,2.3)"); + "insert into wf01(tag1,time,temperature) values(\'wt01\', 1509465600001,2.3)"); statement.addBatch("drop table wf01"); - statement.addBatch("create table wf01 (id1 string id, temprature double measurement)"); + statement.addBatch("create table wf01 (tag1 string tag, temprature double field)"); statement.addBatch( - "insert into wf01(id1,time,temperature) values(\'wt01\', 1509465600002,3.4)"); + "insert into wf01(tag1,time,temperature) values(\'wt01\', 1509465600002,3.4)"); statement.executeBatch(); statement.clearBatch(); ResultSet resultSet = statement.executeQuery("select * from wf01"); @@ -97,21 +97,21 @@ public void testJDBCExecuteBatchForCreateMultiTimeSeriesPlan() { statement.setFetchSize(100); statement.execute("create database ln"); statement.execute("USE \"ln\""); - statement.addBatch("create table wf01 (id1 string id, temprature double measurement)"); + statement.addBatch("create table wf01 (tag1 string tag, temprature double field)"); statement.addBatch( - "insert into wf01(id1,time,temperature) values(\'wt01\', 1509465600000,1.2)"); + "insert into wf01(tag1,time,temperature) values(\'wt01\', 1509465600000,1.2)"); statement.addBatch( - "insert into wf01(id1,time,temperature) values(\'wt01\', 1509465600001,2.3)"); + "insert into wf01(tag1,time,temperature) values(\'wt01\', 1509465600001,2.3)"); statement.addBatch("drop table wf01"); statement.addBatch( - "create table turbine (id1 string id, attr1 string attribute, attr2 string attribute, s1 boolean measurement, s2 float measurement)"); + "create table turbine (tag1 string tag, attr1 string attribute, attr2 string attribute, s1 boolean field, s2 float field)"); - statement.addBatch("create table wf01 (id1 string id, temprature double measurement)"); + statement.addBatch("create table wf01 (tag1 string tag, temprature double field)"); statement.addBatch( - "insert into wf01(id1,time,temperature) values(\'wt01\', 1509465600002,3.4)"); - statement.addBatch("alter table turbine add column s3 boolean measurement"); + "insert into wf01(tag1,time,temperature) values(\'wt01\', 1509465600002,3.4)"); + statement.addBatch("alter table turbine add column s3 boolean field"); statement.executeBatch(); statement.clearBatch(); ResultSet resultSet = statement.executeQuery("select * from wf01"); @@ -128,7 +128,7 @@ public void testJDBCExecuteBatchForCreateMultiTimeSeriesPlan() { String[] keys = {"ColumnName", "DataType", "Category"}; String[][] value_columns = { new String[] {"Time", "TIMESTAMP", "TIME"}, - new String[] {"id1", "STRING", "ID"}, + new String[] {"tag1", "STRING", "TAG"}, new String[] {"attr1", "STRING", "ATTRIBUTE"}, new String[] {"attr2", "STRING", "ATTRIBUTE"}, new String[] {"s1", "BOOLEAN", "MEASUREMENT"}, diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBFlushQueryTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBFlushQueryTableIT.java index 6a1207d91cdf..1ad8427b6f3c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBFlushQueryTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBFlushQueryTableIT.java @@ -50,20 +50,20 @@ public class IoTDBFlushQueryTableIT { new String[] { "CREATE DATABASE test", "USE \"test\"", - "CREATE TABLE vehicle (id1 string id, s0 int32 measurement)", - "insert into vehicle(id1,time,s0) values('d0',1,101)", - "insert into vehicle(id1,time,s0) values('d0',2,198)", - "insert into vehicle(id1,time,s0) values('d0',100,99)", - "insert into vehicle(id1,time,s0) values('d0',101,99)", - "insert into vehicle(id1,time,s0) values('d0',102,80)", - "insert into vehicle(id1,time,s0) values('d0',103,99)", - "insert into vehicle(id1,time,s0) values('d0',104,90)", - "insert into vehicle(id1,time,s0) values('d0',105,99)", - "insert into vehicle(id1,time,s0) values('d0',106,99)", + "CREATE TABLE vehicle (tag1 string tag, s0 int32 field)", + "insert into vehicle(tag1,time,s0) values('d0',1,101)", + "insert into vehicle(tag1,time,s0) values('d0',2,198)", + "insert into vehicle(tag1,time,s0) values('d0',100,99)", + "insert into vehicle(tag1,time,s0) values('d0',101,99)", + "insert into vehicle(tag1,time,s0) values('d0',102,80)", + "insert into vehicle(tag1,time,s0) values('d0',103,99)", + "insert into vehicle(tag1,time,s0) values('d0',104,90)", + "insert into vehicle(tag1,time,s0) values('d0',105,99)", + "insert into vehicle(tag1,time,s0) values('d0',106,99)", "flush", - "insert into vehicle(id1,time,s0) values('d0',2,10000)", - "insert into vehicle(id1,time,s0) values('d0',50,10000)", - "insert into vehicle(id1,time,s0) values('d0',1000,22222)", + "insert into vehicle(tag1,time,s0) values('d0',2,10000)", + "insert into vehicle(tag1,time,s0) values('d0',50,10000)", + "insert into vehicle(tag1,time,s0) values('d0',1000,22222)", }; @BeforeClass @@ -109,7 +109,7 @@ public void selectAllSQLTest() { @Test public void testFlushGivenGroup() { String insertTemplate = - "INSERT INTO vehicle(id1, time, s1, s2, s3) VALUES (%s, %d, %d, %f, %s)"; + "INSERT INTO vehicle(tag1, time, s1, s2, s3) VALUES (%s, %d, %d, %f, %s)"; try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { @@ -120,7 +120,7 @@ public void testFlushGivenGroup() { for (int i = 1; i <= 3; i++) { statement.execute(String.format("USE \"group%d\"", i)); statement.execute( - "CREATE TABLE vehicle (id1 string id, s1 int32 measurement, s2 float measurement, s3 string measurement)"); + "CREATE TABLE vehicle (tag1 string tag, s1 int32 field, s2 float field, s3 string field)"); for (int j = 10; j < 20; j++) { statement.execute(String.format(Locale.CHINA, insertTemplate, i, j, j, j * 0.1, j)); } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertAlignedValuesTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertAlignedValuesTableIT.java index b3d6e9889255..5740e8d42577 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertAlignedValuesTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertAlignedValuesTableIT.java @@ -68,13 +68,13 @@ public void testInsertAlignedValues() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); statement.addBatch( - "create table wf01 (id1 string id, status boolean measurement, temperature float measurement)"); + "create table wf01 (tag1 string tag, status boolean field, temperature float field)"); statement.addBatch( - "insert into wf01(id1, time, status, temperature) values ('wt01', 4000, true, 17.1)"); + "insert into wf01(tag1, time, status, temperature) values ('wt01', 4000, true, 17.1)"); statement.addBatch( - "insert into wf01(id1, time, status, temperature) values ('wt01', 5000, true, 20.1)"); + "insert into wf01(tag1, time, status, temperature) values ('wt01', 5000, true, 20.1)"); statement.addBatch( - "insert into wf01(id1, time, status, temperature) values ('wt01', 6000, true, 22)"); + "insert into wf01(tag1, time, status, temperature) values ('wt01', 6000, true, 22)"); statement.executeBatch(); try (ResultSet resultSet = statement.executeQuery("select time, status from wf01")) { @@ -117,11 +117,11 @@ public void testInsertAlignedNullableValues() throws SQLException { statement.execute("use \"t1\""); statement.addBatch( - "create table wf02 (id1 string id, status boolean measurement, temperature float measurement)"); + "create table wf02 (tag1 string tag, status boolean field, temperature float field)"); statement.addBatch( - "insert into wf02(id1, time, status, temperature) values ('wt01', 4000, true, 17.1)"); - statement.addBatch("insert into wf02(id1, time, status) values ('wt01', 5000, true)"); - statement.addBatch("insert into wf02(id1, time, temperature) values ('wt01', 6000, 22)"); + "insert into wf02(tag1, time, status, temperature) values ('wt01', 4000, true, 17.1)"); + statement.addBatch("insert into wf02(tag1, time, status) values ('wt01', 5000, true)"); + statement.addBatch("insert into wf02(tag1, time, temperature) values ('wt01', 6000, 22)"); statement.executeBatch(); try (ResultSet resultSet = statement.executeQuery("select status from wf02")) { @@ -164,12 +164,12 @@ public void testUpdatingAlignedValues() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); statement.addBatch( - "create table wf03 (id1 string id, status boolean measurement, temperature float measurement)"); + "create table wf03 (tag1 string tag, status boolean field, temperature float field)"); statement.addBatch( - "insert into wf03(id1, time, status, temperature) values ('wt01', 4000, true, 17.1)"); - statement.addBatch("insert into wf03(id1, time, status) values ('wt01', 5000, true)"); - statement.addBatch("insert into wf03(id1, time, temperature)values ('wt01', 5000, 20.1)"); - statement.addBatch("insert into wf03(id1, time, temperature)values ('wt01', 6000, 22)"); + "insert into wf03(tag1, time, status, temperature) values ('wt01', 4000, true, 17.1)"); + statement.addBatch("insert into wf03(tag1, time, status) values ('wt01', 5000, true)"); + statement.addBatch("insert into wf03(tag1, time, temperature)values ('wt01', 5000, 20.1)"); + statement.addBatch("insert into wf03(tag1, time, temperature)values ('wt01', 6000, 22)"); statement.executeBatch(); try (ResultSet resultSet = statement.executeQuery("select time, status from wf03")) { @@ -244,10 +244,9 @@ public void testInsertAlignedValuesWithSameTimestamp() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); - statement.addBatch( - "create table sg3 (id1 string id, s2 double measurement, s1 double measurement)"); - statement.addBatch("insert into sg3(id1,time,s2) values('d1',1,2)"); - statement.addBatch("insert into sg3(id1,time,s1) values('d1',1,2)"); + statement.addBatch("create table sg3 (tag1 string tag, s2 double field, s1 double field)"); + statement.addBatch("insert into sg3(tag1,time,s2) values('d1',1,2)"); + statement.addBatch("insert into sg3(tag1,time,s1) values('d1',1,2)"); statement.executeBatch(); try (ResultSet resultSet = statement.executeQuery("select time, s1, s2 from sg3")) { @@ -279,9 +278,9 @@ public void testInsertWithWrongMeasurementNum1() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); statement.execute( - "create table wf04 (id1 string id, status int32, temperature int32 measurement)"); + "create table wf04 (tag1 string tag, status int32, temperature int32 field)"); statement.execute( - "insert into wf04(id1, time, status, temperature) values('wt01', 11000, 100)"); + "insert into wf04(tag1, time, status, temperature) values('wt01', 11000, 100)"); fail(); } catch (SQLException e) { assertEquals( @@ -295,9 +294,9 @@ public void testInsertWithWrongMeasurementNum2() { Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); statement.execute( - "create table wf05 (id1 string id, status int32, temperature int32 measurement)"); + "create table wf05 (tag1 string tag, status int32, temperature int32 field)"); statement.execute( - "insert into wf05(id1, time, status, temperature) values('wt01', 11000, 100, 300, 400)"); + "insert into wf05(tag1, time, status, temperature) values('wt01', 11000, 100, 300, 400)"); fail(); } catch (SQLException e) { assertEquals( @@ -311,8 +310,8 @@ public void testInsertWithWrongType() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); statement.execute( - "create table dev6 (id1 string id, latitude int32 measurement, longitude int32 measurement)"); - statement.execute("insert into dev6(id1,time,latitude,longitude) values('GPS', 1,1.3,6.7)"); + "create table dev6 (tag1 string tag, latitude int32 field, longitude int32 field)"); + statement.execute("insert into dev6(tag1,time,latitude,longitude) values('GPS', 1,1.3,6.7)"); fail(); } } @@ -322,9 +321,9 @@ public void testInsertWithDuplicatedMeasurements() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); - statement.execute("create table wf07(id1 string id, s3 boolean measurement, status int32)"); + statement.execute("create table wf07(tag1 string tag, s3 boolean field, status int32)"); statement.execute( - "insert into wf07(id1, time, s3, status, status) values('wt01', 100, true, 20.1, 20.2)"); + "insert into wf07(tag1, time, s3, status, status) values('wt01', 100, true, 20.1, 20.2)"); fail(); } catch (SQLException e) { assertTrue( @@ -338,10 +337,9 @@ public void testInsertMultiRows() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); + statement.execute("create table sg8 (tag1 string tag, s1 int32 field, s2 int32 field)"); statement.execute( - "create table sg8 (id1 string id, s1 int32 measurement, s2 int32 measurement)"); - statement.execute( - "insert into sg8(id1, time, s1, s2) values('d1', 10, 2, 2), ('d1', 11, 3, '3'), ('d1', 12,12.11,false)"); + "insert into sg8(tag1, time, s1, s2) values('d1', 10, 2, 2), ('d1', 11, 3, '3'), ('d1', 12,12.11,false)"); fail(); } catch (SQLException e) { assertTrue(e.getMessage(), e.getMessage().contains("data type is not consistent")); @@ -353,14 +351,13 @@ public void testInsertLargeNumber() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); + statement.execute("create table sg9 (tag1 string tag, s98 int64 field, s99 int64 field)"); statement.execute( - "create table sg9 (id1 string id, s98 int64 measurement, s99 int64 measurement)"); - statement.execute( - "insert into sg9(id1, time, s98, s99) values('d1', 10, 2, 271840880000000000000000)"); + "insert into sg9(tag1, time, s98, s99) values('d1', 10, 2, 271840880000000000000000)"); fail("Exception expected"); } catch (SQLException e) { assertEquals( - "700: line 1:58: Invalid numeric literal: 271840880000000000000000", e.getMessage()); + "700: line 1:59: Invalid numeric literal: 271840880000000000000000", e.getMessage()); } } @@ -370,11 +367,11 @@ public void testInsertAlignedWithEmptyPage() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); statement.execute( - "create table dev10 (id1 string id, s1 int32 measurement, s2 int32 measurement, s3 int32 measurement)"); + "create table dev10 (tag1 string tag, s1 int32 field, s2 int32 field, s3 int32 field)"); for (int i = 0; i < 100; i++) { if (i == 99) { statement.addBatch( - "insert into dev10(id1,time,s1,s3) values(" + "insert into dev10(tag1,time,s1,s3) values(" + "'GPS'" + "," + i @@ -385,7 +382,7 @@ public void testInsertAlignedWithEmptyPage() throws SQLException { + ")"); } else { statement.addBatch( - "insert into dev10(id1, time,s1,s2) values(" + "insert into dev10(tag1, time,s1,s2) values(" + "'GPS'" + "," + i @@ -443,14 +440,13 @@ public void testInsertAlignedWithEmptyPage2() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); - statement.execute( - "create table sg11 (id1 string id, s1 string measurement, s2 string measurement)"); + statement.execute("create table sg11 (tag1 string tag, s1 string field, s2 string field)"); - statement.execute("insert into sg11(id1, time, s1, s2) values('d1', 1,'aa','bb')"); - statement.execute("insert into sg11(id1, time, s1, s2) values('d1', 1,'aa','bb')"); - statement.execute("insert into sg11(id1, time, s1, s2) values('d2', 1,'aa','bb')"); + statement.execute("insert into sg11(tag1, time, s1, s2) values('d1', 1,'aa','bb')"); + statement.execute("insert into sg11(tag1, time, s1, s2) values('d1', 1,'aa','bb')"); + statement.execute("insert into sg11(tag1, time, s1, s2) values('d2', 1,'aa','bb')"); statement.execute("flush"); - statement.execute("insert into sg11(id1, time, s1, s2) values('d1', 1,'aa','bb')"); + statement.execute("insert into sg11(tag1, time, s1, s2) values('d1', 1,'aa','bb')"); } } @@ -460,17 +456,16 @@ public void testInsertComplexAlignedValues() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); - statement.addBatch( - "create table sg12 (id1 string id, s1 int32 measurement, s2 int32 measurement)"); - statement.addBatch("insert into sg12(id1, time, s1) values('id1', 3,1)"); - statement.addBatch("insert into sg12(id1, time, s1) values('id1', 3,1)"); - statement.addBatch("insert into sg12(id1, time, s1) values('id1', 1,1)"); - statement.addBatch("insert into sg12(id1, time, s1) values('id1', 2,1)"); - statement.addBatch("insert into sg12(id1, time, s2) values('id1', 2,2)"); - statement.addBatch("insert into sg12(id1, time, s2) values('id1', 1,2)"); - statement.addBatch("insert into sg12(id1, time, s2) values('id1', 3,2)"); - statement.addBatch("insert into sg12(id1, time, s3) values('id1', 1,3)"); - statement.addBatch("insert into sg12(id1, time, s3) values('id1', 3,3)"); + statement.addBatch("create table sg12 (tag1 string tag, s1 int32 field, s2 int32 field)"); + statement.addBatch("insert into sg12(tag1, time, s1) values('tag1', 3,1)"); + statement.addBatch("insert into sg12(tag1, time, s1) values('tag1', 3,1)"); + statement.addBatch("insert into sg12(tag1, time, s1) values('tag1', 1,1)"); + statement.addBatch("insert into sg12(tag1, time, s1) values('tag1', 2,1)"); + statement.addBatch("insert into sg12(tag1, time, s2) values('tag1', 2,2)"); + statement.addBatch("insert into sg12(tag1, time, s2) values('tag1', 1,2)"); + statement.addBatch("insert into sg12(tag1, time, s2) values('tag1', 3,2)"); + statement.addBatch("insert into sg12(tag1, time, s3) values('tag1', 1,3)"); + statement.addBatch("insert into sg12(tag1, time, s3) values('tag1', 3,3)"); statement.executeBatch(); try (ResultSet resultSet = @@ -504,11 +499,11 @@ public void testInsertAlignedWithEmptyPage3() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); statement.execute( - "create table dev13 (id1 string id, s1 int32 measurement, s2 int32 measurement, s3 int32 measurement)"); + "create table dev13 (tag1 string tag, s1 int32 field, s2 int32 field, s3 int32 field)"); for (int i = 0; i < 100; i++) { if (i >= 49) { statement.addBatch( - "insert into dev13(id1,time,s1,s2,s3) values(" + "insert into dev13(tag1,time,s1,s2,s3) values(" + "\'GPS\'" + "," + i @@ -521,7 +516,7 @@ public void testInsertAlignedWithEmptyPage3() throws SQLException { + ")"); } else { statement.addBatch( - "insert into dev13(id1,time,s1,s2) values(" + "insert into dev13(tag1,time,s1,s2) values(" + "\'GPS\'" + "," + i @@ -573,16 +568,15 @@ public void testExtendTextColumn() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"t1\""); - statement.execute( - "create table sg14 (id1 string id, s1 string measurement, s2 string measurement)"); - statement.execute("insert into sg14(id1,time,s1,s2) values('d1',1,'test','test')"); - statement.execute("insert into sg14(id1,time,s1,s2) values('d1',2,'test','test')"); - statement.execute("insert into sg14(id1,time,s1,s2) values('d1',3,'test','test')"); - statement.execute("insert into sg14(id1,time,s1,s2) values('d1',4,'test','test')"); - statement.execute("insert into sg14(id1,time,s1,s3) values('d1',5,'test','test')"); - statement.execute("insert into sg14(id1,time,s1,s2) values('d1',6,'test','test')"); + statement.execute("create table sg14 (tag1 string tag, s1 string field, s2 string field)"); + statement.execute("insert into sg14(tag1,time,s1,s2) values('d1',1,'test','test')"); + statement.execute("insert into sg14(tag1,time,s1,s2) values('d1',2,'test','test')"); + statement.execute("insert into sg14(tag1,time,s1,s2) values('d1',3,'test','test')"); + statement.execute("insert into sg14(tag1,time,s1,s2) values('d1',4,'test','test')"); + statement.execute("insert into sg14(tag1,time,s1,s3) values('d1',5,'test','test')"); + statement.execute("insert into sg14(tag1,time,s1,s2) values('d1',6,'test','test')"); statement.execute("flush"); - statement.execute("insert into sg14(id1,time,s1,s3) values('d1',7,'test','test')"); + statement.execute("insert into sg14(tag1,time,s1,s3) values('d1',7,'test','test')"); fail(); } catch (SQLException ignored) { } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertTableIT.java index 816aba7c183f..71b1eb4a8c0f 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertTableIT.java @@ -85,9 +85,9 @@ public static void setUp() throws Exception { statement.execute("create database if not exists test"); statement.execute("use test"); statement.execute( - "CREATE TABLE sg10(id1 string id, s1 int64 measurement, s2 float measurement, s3 string measurement)"); + "CREATE TABLE sg10(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"); statement.execute( - "CREATE TABLE sg11(id1 string id, s1 int64 measurement, s2 float measurement, s3 string measurement)"); + "CREATE TABLE sg11(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"); } } @@ -101,11 +101,11 @@ public void testInsertMultiPartition() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute("create table sg1 (id1 string id, s1 int32 measurement)"); - statement.execute("insert into sg1(id1,time,s1) values('d1',1,2)"); + statement.execute("create table sg1 (tag1 string tag, s1 int32 field)"); + statement.execute("insert into sg1(tag1,time,s1) values('d1',1,2)"); statement.execute("flush"); - statement.execute("insert into sg1(id1,time,s1) values('d1',2,2)"); - statement.execute("insert into sg1(id1,time,s1) values('d1',604800001,2)"); + statement.execute("insert into sg1(tag1,time,s1) values('d1',2,2)"); + statement.execute("insert into sg1(tag1,time,s1) values('d1',604800001,2)"); statement.execute("flush"); } catch (Exception e) { fail(e.getMessage()); @@ -118,10 +118,10 @@ public void testInsertTimeAtAnyIndex() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("use \"test\""); statement.addBatch( - "create table IF NOT EXISTS db2(id1 string id, s1 int32 measurement, s2 int32 measurement)"); - statement.addBatch("insert into db2(id1, s1, s2, time) values ('d1', 2, 3, 1)"); - statement.addBatch("insert into db2(id1, s1, time, s2) values ('d1', 20, 10, 30)"); - statement.addBatch("insert into db2(id1, \"time\", s1, s2) values ('d1', 100, 200, 300)"); + "create table IF NOT EXISTS db2(tag1 string tag, s1 int32 field, s2 int32 field)"); + statement.addBatch("insert into db2(tag1, s1, s2, time) values ('d1', 2, 3, 1)"); + statement.addBatch("insert into db2(tag1, s1, time, s2) values ('d1', 20, 10, 30)"); + statement.addBatch("insert into db2(tag1, \"time\", s1, s2) values ('d1', 100, 200, 300)"); statement.executeBatch(); try (ResultSet resultSet = statement.executeQuery("select time, s1 from db2")) { @@ -145,9 +145,8 @@ public void testInsertMultiTime() { Statement statement = connection.createStatement()) { try { statement.addBatch("use \"test\""); - statement.addBatch( - "create table t3(id1 string id, s1 int32 measurement, s2 int32 measurement)"); - statement.addBatch("insert into t3(id1, s1, s2, time, time) values ('d1', 2, 3, 1, 1)"); + statement.addBatch("create table t3(tag1 string tag, s1 int32 field, s2 int32 field)"); + statement.addBatch("insert into t3(tag1, s1, s2, time, time) values ('d1', 2, 3, 1, 1)"); statement.executeBatch(); fail(); } catch (SQLException e) { @@ -165,8 +164,8 @@ public void testPartialInsertionAllFailed() throws SQLException { Statement statement = connection.createStatement()) { try { statement.execute("USE \"test\""); - statement.execute("create table sg4 (id1 string id, s0 int32 measurement)"); - statement.execute("INSERT INTO sg4(id1, timestamp, s0) VALUES ('id', 1, 1)"); + statement.execute("create table sg4 (tag1 string tag, s0 int32 field)"); + statement.execute("INSERT INTO sg4(tag1, timestamp, s0) VALUES ('tag', 1, 1)"); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Unknown column category")); @@ -180,18 +179,15 @@ public void testPartialInsertTablet() { session.executeNonQueryStatement("use \"test\""); session.executeNonQueryStatement("SET CONFIGURATION enable_auto_create_schema='false'"); session.executeNonQueryStatement( - "create table sg6 (id1 string id, s1 int64 measurement, s2 int64 measurement)"); + "create table sg6 (tag1 string tag, s1 int64 field, s2 int64 field)"); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s3", TSDataType.INT64)); final List columnTypes = Arrays.asList( - ColumnCategory.ID, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT); + ColumnCategory.TAG, ColumnCategory.FIELD, ColumnCategory.FIELD, ColumnCategory.FIELD); Tablet tablet = new Tablet( "sg6", @@ -239,7 +235,7 @@ public void testPartialInsertTablet() { try (SessionDataSet dataSet = session.executeQueryStatement("SELECT * FROM sg6")) { assertEquals(dataSet.getColumnNames().size(), 4); assertEquals(dataSet.getColumnNames().get(0), "time"); - assertEquals(dataSet.getColumnNames().get(1), "id1"); + assertEquals(dataSet.getColumnNames().get(1), "tag1"); assertEquals(dataSet.getColumnNames().get(2), "s1"); assertEquals(dataSet.getColumnNames().get(3), "s2"); int cnt = 0; @@ -269,10 +265,10 @@ public void testInsertNull() { Statement statement = connection.createStatement()) { statement.execute("use \"test\""); statement.execute( - "CREATE TABLE sg7 (id1 string id, s1 boolean measurement, s2 float measurement, s3 int32 measurement)"); - statement.execute("insert into sg7(id1,time,s1,s2,s3) values('d2',1,null,1.0,1)"); - statement.execute("insert into sg7(id1,time,s1,s2,s3) values('d2',2,true,null,2)"); - statement.execute("insert into sg7(id1,time,s1,s2,s3) values('d2',3,true,3.0,null)"); + "CREATE TABLE sg7 (tag1 string tag, s1 boolean field, s2 float field, s3 int32 field)"); + statement.execute("insert into sg7(tag1,time,s1,s2,s3) values('d2',1,null,1.0,1)"); + statement.execute("insert into sg7(tag1,time,s1,s2,s3) values('d2',2,true,null,2)"); + statement.execute("insert into sg7(tag1,time,s1,s2,s3) values('d2',3,true,3.0,null)"); try (ResultSet resultSet = statement.executeQuery("select * from sg7")) { assertNotNull(resultSet); @@ -280,7 +276,7 @@ public void testInsertNull() { List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, - "time,id1,s1,s2,s3", + "time,tag1,s1,s2,s3", new int[] { Types.TIMESTAMP, Types.VARCHAR, Types.BOOLEAN, Types.FLOAT, Types.INTEGER, }); @@ -316,25 +312,24 @@ public void testInsertNaN() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute( - "CREATE TABLE sg8 (id1 string id, s1 float measurement, s2 double measurement)"); + statement.execute("CREATE TABLE sg8 (tag1 string tag, s1 float field, s2 double field)"); // NaN should be a string literal, i.e., 'NaN', not NaN or "NaN" try { - statement.execute("insert into sg8(id1,time,s1,s2) values('d2',1,NaN,NaN)"); + statement.execute("insert into sg8(tag1,time,s1,s2) values('d2',1,NaN,NaN)"); fail("expected exception"); } catch (SQLException e) { assertEquals( "701: Cannot insert identifier NaN, please use string literal", e.getMessage()); } try { - statement.execute("insert into sg8(id1,time,s1,s2) values('d2',1,\"NaN\",\"NaN\")"); + statement.execute("insert into sg8(tag1,time,s1,s2) values('d2',1,\"NaN\",\"NaN\")"); fail("expected exception"); } catch (SQLException e) { assertEquals( "701: Cannot insert identifier \"NaN\", please use string literal", e.getMessage()); } - statement.execute("insert into sg8(id1,time,s1,s2) values('d2',1,'NaN','NaN')"); + statement.execute("insert into sg8(tag1,time,s1,s2) values('d2',1,'NaN','NaN')"); try (ResultSet resultSet = statement.executeQuery("select * from sg8")) { assertNotNull(resultSet); @@ -360,16 +355,16 @@ public void testInsertWithoutTime() { Statement statement = connection.createStatement()) { statement.execute("USE \"test\""); statement.execute( - "CREATE TABLE sg9(id1 string id, s1 int64 measurement, s2 float measurement, s3 string measurement)"); - statement.execute("insert into sg9(id1, s1, s2, s3) values ('d1',1, 1, '1')"); + "CREATE TABLE sg9(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"); + statement.execute("insert into sg9(tag1, s1, s2, s3) values ('d1',1, 1, '1')"); Thread.sleep(1); - statement.execute("insert into sg9(id1, s2, s1, s3) values ('d1',2, 2, '2')"); + statement.execute("insert into sg9(tag1, s2, s1, s3) values ('d1',2, 2, '2')"); Thread.sleep(1); - statement.execute("insert into sg9(id1, s3, s2, s1) values ('d1','3', 3, 3)"); + statement.execute("insert into sg9(tag1, s3, s2, s1) values ('d1','3', 3, 3)"); Thread.sleep(1); - statement.execute("insert into sg9(id1, s1) values ('d1',1)"); - statement.execute("insert into sg9(id1, s2) values ('d1',2)"); - statement.execute("insert into sg9(id1, s3) values ('d1','3')"); + statement.execute("insert into sg9(tag1, s1) values ('d1',1)"); + statement.execute("insert into sg9(tag1, s2) values ('d1',2)"); + statement.execute("insert into sg9(tag1, s3) values ('d1','3')"); } catch (SQLException | InterruptedException e) { e.printStackTrace(); fail(e.getMessage()); @@ -387,7 +382,7 @@ public void testInsertMultiRow() { "need timestamps when insert multi rows", "test"); assertTableNonQueryTestFail( - "insert into sg10(id1, s1, s2) values ('d1', 1, 1), ('d1', 2, 2)", + "insert into sg10(tag1, s1, s2) values ('d1', 1, 1), ('d1', 2, 2)", "need timestamps when insert multi rows", "test"); } @@ -395,11 +390,11 @@ public void testInsertMultiRow() { @Test public void testInsertWithMultiTimesColumns() { assertTableNonQueryTestFail( - "insert into sg11(id1, time, time) values ('d1', 1, 1)", + "insert into sg11(tag1, time, time) values ('d1', 1, 1)", "One row should only have one time value", "test"); assertTableNonQueryTestFail( - "insert into sg11(id1, time, s1, time) values ('d1', 1, 1, 1)", + "insert into sg11(tag1, time, s1, time) values ('d1', 1, 1, 1)", "One row should only have one time value", "test"); } @@ -411,19 +406,19 @@ public void testInsertMultiRow2() throws SQLException { Statement st0 = connection.createStatement(); st0.execute("use \"test\""); st0.execute( - "create table wf12 (id1 string id, status boolean measurement, temperature float measurement)"); - st0.execute("insert into wf12(id1, time, status) values ('wt01', 1, true)"); + "create table wf12 (tag1 string tag, status boolean field, temperature float field)"); + st0.execute("insert into wf12(tag1, time, status) values ('wt01', 1, true)"); st0.execute( - "insert into wf12(id1, time, status) values ('wt01', 2, true), ('wt01', 3, false)"); + "insert into wf12(tag1, time, status) values ('wt01', 2, true), ('wt01', 3, false)"); st0.execute( - "insert into wf12(id1, time, status) values ('wt01', 4, true), ('wt01', 5, true), ('wt01', 6, false)"); + "insert into wf12(tag1, time, status) values ('wt01', 4, true), ('wt01', 5, true), ('wt01', 6, false)"); st0.execute( - "insert into wf12(id1, time, temperature, status) values ('wt01', 7, 15.3, true)"); + "insert into wf12(tag1, time, temperature, status) values ('wt01', 7, 15.3, true)"); st0.execute( - "insert into wf12(id1, time, temperature, status) values ('wt01', 8, 18.3, false), ('wt01', 9, 23.1, false)"); + "insert into wf12(tag1, time, temperature, status) values ('wt01', 8, 18.3, false), ('wt01', 9, 23.1, false)"); st0.execute( - "insert into wf12(id1, time, temperature, status) values ('wt01', 10, 22.3, true), ('wt01', 11, 18.8, false), ('wt01', 12, 24.4, true)"); + "insert into wf12(tag1, time, temperature, status) values ('wt01', 10, 22.3, true), ('wt01', 11, 18.8, false), ('wt01', 12, 24.4, true)"); st0.close(); Statement st1 = connection.createStatement(); @@ -448,9 +443,9 @@ public void testInsertMultiRowWithMisMatchDataType() throws SQLException { Statement st1 = connection.createStatement(); st1.execute("use \"test\""); st1.execute( - "create table wf13 (id1 string id, status boolean measurement, temperature float measurement)"); + "create table wf13 (tag1 string tag, status boolean field, temperature float field)"); st1.execute( - "insert into wf13(id1, time, status) values('wt01', 1, 1.0), ('wt01', 2, 'hello')"); + "insert into wf13(tag1, time, status) values('wt01', 1, 1.0), ('wt01', 2, 'hello')"); fail(); } catch (SQLException e) { assertTrue( @@ -465,7 +460,7 @@ public void testInsertMultiRowWithNull() throws SQLException { Statement st1 = connection.createStatement()) { st1.execute("use \"test\""); st1.execute( - "create table wf14 (id1 string id, status boolean measurement, temperature float measurement)"); + "create table wf14 (tag1 string tag, status boolean field, temperature float field)"); st1.execute("insert into wt14(time, s1, s2) values(100, null, 1), (101, null, 2)"); fail(); } catch (SQLException e) { @@ -474,8 +469,7 @@ public void testInsertMultiRowWithNull() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT)) { try (Statement st2 = connection.createStatement()) { st2.execute("use \"test\""); - st2.execute( - "CREATE TABLE wf15 (wt string id, s1 double measurement, s2 double measurement)"); + st2.execute("CREATE TABLE wf15 (wt string tag, s1 double field, s2 double field)"); st2.execute( "INSERT INTO wf15(wt, time, s1) VALUES ('1', 6, 10),('1', 7,12),('1', 8,14),('1', 9,160),('1', 10,null),('1', 11,58)"); } catch (SQLException e) { @@ -491,7 +485,7 @@ public void testInsertMultiRowWithWrongTimestampPrecision() throws SQLException try { st1.execute("use \"test\""); st1.execute( - "insert into wf16(id1, time, status) values('wt01', 1618283005586000, true), ('wt01', 1618283005586001, false)"); + "insert into wf16(tag1, time, status) values('wt01', 1618283005586000, true), ('wt01', 1618283005586001, false)"); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("Current system timestamp precision is ms")); @@ -504,10 +498,11 @@ public void testInsertMultiRowWithMultiTimePartition() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement st1 = connection.createStatement()) { st1.execute("use \"test\""); - st1.execute("create table sg17 (id1 string id, s1 int32 measurement)"); - st1.execute("insert into sg17(id1, time, s1) values('d1', 604800010,1)"); + st1.execute("create table sg17 (tag1 string tag, s1 int32 field)"); + st1.execute("insert into sg17(tag1, time, s1) values('d1', 604800010,1)"); st1.execute("flush"); - st1.execute("insert into sg17(id1, time, s1) values('d1', 604799990,1), ('d1', 604800001,1)"); + st1.execute( + "insert into sg17(tag1, time, s1) values('d1', 604799990,1), ('d1', 604800001,1)"); st1.execute("flush"); ResultSet rs1 = st1.executeQuery("select time, s1 from sg17"); @@ -527,9 +522,9 @@ public void testInsertAttributes() throws SQLException { Statement st1 = connection.createStatement()) { st1.execute("use \"test\""); st1.execute( - "create table if not exists sg18 (id1 string id, s1 string attribute, s2 int32 measurement)"); - st1.execute("insert into sg18(id1, s1, s2) values('d1','1', 1)"); - st1.execute("insert into sg18(id1, s1, s2) values('d2', 2, 2)"); + "create table if not exists sg18 (tag1 string tag, s1 string attribute, s2 int32 field)"); + st1.execute("insert into sg18(tag1, s1, s2) values('d1','1', 1)"); + st1.execute("insert into sg18(tag1, s1, s2) values('d2', 2, 2)"); ResultSet rs1 = st1.executeQuery("select time, s1, s2 from sg18 order by s1"); assertTrue(rs1.next()); @@ -548,16 +543,16 @@ public void testInsertCaseSensitivity() Statement st1 = connection.createStatement()) { st1.execute("use \"test\""); st1.execute( - "create table if not exists sg19 (id1 string id, ss1 string attribute, ss2 int32 measurement)"); + "create table if not exists sg19 (tag1 string tag, ss1 string attribute, ss2 int32 field)"); // lower case - st1.execute("insert into sg19(time, id1, ss1, ss2) values(1, 'd1','1', 1)"); - st1.execute("insert into sg19(time, id1, ss1, ss2) values(2, 'd2', 2, 2)"); + st1.execute("insert into sg19(time, tag1, ss1, ss2) values(1, 'd1','1', 1)"); + st1.execute("insert into sg19(time, tag1, ss1, ss2) values(2, 'd2', 2, 2)"); // upper case - st1.execute("insert into sg19(TIME, ID1, SS1, SS2) values(3, 'd3','3', 3)"); - st1.execute("insert into sg19(TIME, ID1, SS1, SS2) values(4, 'd4', 4, 4)"); + st1.execute("insert into sg19(TIME, TAG1, SS1, SS2) values(3, 'd3','3', 3)"); + st1.execute("insert into sg19(TIME, TAG1, SS1, SS2) values(4, 'd4', 4, 4)"); // mixed - st1.execute("insert into sg19(TIme, Id1, Ss1, Ss2) values(5, 'd5','5', 5)"); - st1.execute("insert into sg19(TIme, Id1, sS1, sS2) values(6, 'd6', 6, 6)"); + st1.execute("insert into sg19(TIme, Tag1, Ss1, Ss2) values(5, 'd5','5', 5)"); + st1.execute("insert into sg19(TIme, Tag1, sS1, sS2) values(6, 'd6', 6, 6)"); ResultSet rs1 = st1.executeQuery("select time, ss1, ss2 from sg19 order by time"); for (int i = 1; i <= 6; i++) { @@ -574,11 +569,11 @@ public void testInsertCaseSensitivity() session.executeNonQueryStatement("USE \"test\""); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.ATTRIBUTE, ColumnCategory.MEASUREMENT); + Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, ColumnCategory.FIELD); long timestamp = 0; @@ -592,7 +587,7 @@ public void testInsertCaseSensitivity() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); } @@ -605,7 +600,7 @@ public void testInsertCaseSensitivity() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); cnt++; @@ -617,17 +612,17 @@ public void testInsertCaseSensitivity() try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"test\""); session.executeNonQueryStatement( - "CREATE TABLE tAbLE19_3 (id1 string id, attr1 string attribute, " + "CREATE TABLE tAbLE19_3 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.ATTRIBUTE, ColumnCategory.MEASUREMENT); - List measurementIds = + Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, ColumnCategory.FIELD); + List fieldIds = schemaList.stream() .map(IMeasurementSchema::getMeasurementName) .collect(Collectors.toList()); @@ -645,7 +640,7 @@ public void testInsertCaseSensitivity() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); } @@ -658,7 +653,7 @@ public void testInsertCaseSensitivity() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); cnt++; @@ -671,11 +666,11 @@ public void testInsertCaseSensitivity() session.executeNonQueryStatement("USE \"test\""); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.ATTRIBUTE, ColumnCategory.MEASUREMENT); + Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = @@ -689,7 +684,7 @@ public void testInsertCaseSensitivity() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -709,7 +704,7 @@ public void testInsertCaseSensitivity() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); cnt++; @@ -721,16 +716,16 @@ public void testInsertCaseSensitivity() try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"test\""); session.executeNonQueryStatement( - "CREATE TABLE tAbLE19_5 (id1 string id, attr1 string attribute, " + "CREATE TABLE tAbLE19_5 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.ATTRIBUTE, ColumnCategory.MEASUREMENT); + Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = @@ -744,7 +739,7 @@ public void testInsertCaseSensitivity() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -764,7 +759,7 @@ public void testInsertCaseSensitivity() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); cnt++; @@ -779,18 +774,18 @@ public void testInsertKeyword() throws IoTDBConnectionException, StatementExecut session.executeNonQueryStatement("USE \"test\""); session.executeNonQueryStatement( "create table table20 (" - + "device_id string id," + + "device_id string tag," + "attribute STRING ATTRIBUTE," - + "boolean boolean MEASUREMENT," - + "int32 int32 MEASUREMENT," - + "int64 int64 MEASUREMENT," - + "float float MEASUREMENT," - + "double double MEASUREMENT," - + "text text MEASUREMENT," - + "string string MEASUREMENT," - + "blob blob MEASUREMENT," - + "timestamp01 timestamp MEASUREMENT," - + "date date MEASUREMENT)"); + + "boolean boolean FIELD," + + "int32 int32 FIELD," + + "int64 int64 FIELD," + + "float float FIELD," + + "double double FIELD," + + "text text FIELD," + + "string string FIELD," + + "blob blob FIELD," + + "timestamp01 timestamp FIELD," + + "date date FIELD)"); List schemas = new ArrayList<>(); schemas.add(new MeasurementSchema("device_id", TSDataType.STRING)); @@ -807,18 +802,18 @@ public void testInsertKeyword() throws IoTDBConnectionException, StatementExecut schemas.add(new MeasurementSchema("date", TSDataType.DATE)); final List columnTypes = Arrays.asList( - ColumnCategory.ID, + ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT); + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = @@ -876,9 +871,9 @@ public void testInsertSingleColumn() throws SQLException { Statement st1 = connection.createStatement()) { st1.execute("use \"test\""); st1.execute( - "create table if not exists sg21 (id1 string id, ss1 string attribute, ss2 int32 measurement)"); - // only id - st1.execute("insert into sg21(id1) values('1')"); + "create table if not exists sg21 (tag1 string tag, ss1 string attribute, ss2 int32 field)"); + // only tag + st1.execute("insert into sg21(tag1) values('1')"); // only time try { st1.execute("insert into sg21(time) values(1)"); @@ -889,16 +884,16 @@ public void testInsertSingleColumn() throws SQLException { } // only attribute st1.execute("insert into sg21(ss1) values('1')"); - // only measurement + // only field st1.execute("insert into sg21(ss2) values(1)"); ResultSet rs1 = st1.executeQuery("show devices from sg21"); assertTrue(rs1.next()); // from "insert into sg21(ss2) values(1)" - assertEquals(null, rs1.getString("id1")); + assertEquals(null, rs1.getString("tag1")); assertTrue(rs1.next()); - // from "insert into sg21(id1) values('1')" - assertEquals("1", rs1.getString("id1")); + // from "insert into sg21(tag1) values('1')" + assertEquals("1", rs1.getString("tag1")); assertFalse(rs1.next()); rs1 = st1.executeQuery("select time, ss1, ss2 from sg21 order by time"); @@ -924,11 +919,11 @@ public void testInsertWithTTL() { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute("create table sg22 (id1 string id, s1 int64 measurement)"); + statement.execute("create table sg22 (tag1 string tag, s1 int64 field)"); statement.execute("alter table sg22 set properties TTL=1"); statement.execute( String.format( - "insert into sg22(id1,time,s1) values('d1',%s,2)", + "insert into sg22(tag1,time,s1) values('d1',%s,2)", System.currentTimeMillis() - 10000)); fail(); } catch (Exception e) { @@ -942,14 +937,14 @@ public void testInsertTabletWithTTL() long ttl = 1; try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("use \"test\""); - session.executeNonQueryStatement("create table sg23 (id1 string id, s1 int64 measurement)"); + session.executeNonQueryStatement("create table sg23 (tag1 string tag, s1 int64 field)"); session.executeNonQueryStatement("alter table sg23 set properties TTL=" + ttl); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.MEASUREMENT); + Arrays.asList(ColumnCategory.TAG, ColumnCategory.FIELD); // all expired long timestamp = 0; @@ -964,7 +959,7 @@ public void testInsertTabletWithTTL() for (long row = 0; row < 3; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("s1", rowIndex, row); } try { @@ -980,7 +975,7 @@ public void testInsertTabletWithTTL() for (long row = 0; row < 4; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("s1", rowIndex, row); timestamp += 10000; } @@ -1012,22 +1007,22 @@ public void testInsertUnsequenceData() session.executeNonQueryStatement("USE \"test\""); // the table is missing column "m2" session.executeNonQueryStatement( - "CREATE TABLE table4 (id1 string id, attr1 string attribute, " + "CREATE TABLE table4 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); // the insertion contains "m2" List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("m2", TSDataType.DOUBLE)); final List columnTypes = Arrays.asList( - ColumnCategory.ID, + ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT); + ColumnCategory.FIELD, + ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = @@ -1041,7 +1036,7 @@ public void testInsertUnsequenceData() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); tablet.addValue("m2", rowIndex, row * 1.0); @@ -1052,7 +1047,7 @@ public void testInsertUnsequenceData() // a partial insertion should be reported if (!e.getMessage() .equals( - "507: Fail to insert measurements [m2] caused by [Column m2 does not exists or fails to be created]")) { + "507: Fail to insert fields [m2] caused by [Column m2 does not exists or fails to be created]")) { throw e; } } @@ -1065,7 +1060,7 @@ public void testInsertUnsequenceData() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, 14 - row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); tablet.addValue("m2", rowIndex, row * 1.0); @@ -1075,7 +1070,7 @@ public void testInsertUnsequenceData() } catch (StatementExecutionException e) { if (!e.getMessage() .equals( - "507: Fail to insert measurements [m2] caused by [Column m2 does not exists or fails to be created]")) { + "507: Fail to insert fields [m2] caused by [Column m2 does not exists or fails to be created]")) { throw e; } } @@ -1099,7 +1094,7 @@ public void testInsertAllNullRow() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement st1 = connection.createStatement()) { st1.execute("use \"test\""); - st1.execute("create table table5(d1 string id, s1 int32 measurement, s2 int32 measurement)"); + st1.execute("create table table5(d1 string tag, s1 int32 field, s2 int32 field)"); st1.execute("insert into table5(time, d1,s1,s2) values(1,'a',1,null)"); // insert all null row diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiDeviceTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiDeviceTableIT.java index 02f71129f3fa..16d92c213436 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiDeviceTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiDeviceTableIT.java @@ -80,38 +80,38 @@ private static void insertData() { statement.addBatch("CREATE DATABASE test"); statement.addBatch("USE \"test\""); statement.addBatch( - "create table t (id1 string id, id2 string id, s0 int32 measurement, s1 int32 measurement)"); + "create table t (tag1 string tag, tag2 string tag, s0 int32 field, s1 int32 field)"); // insert of data time range :0-100 into fans for (int time = 0; time < 100; time++) { String sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d0',%s,%s)", time, time % 7); + "insert into t(tag1,tag2,time,s0) values('fans','d0',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d1',%s,%s)", time, time % 4); + "insert into t(tag1,tag2,time,s0) values('fans','d1',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d2',%s,%s)", time, time % 7); + "insert into t(tag1,tag2,time,s0) values('fans','d2',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d3',%s,%s)", time, time % 4); + "insert into t(tag1,tag2,time,s0) values('fans','d3',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d0',%s,%s)", time, time % 7); + "insert into t(tag1, tag2,time,s0) values('car','d0',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d1',%s,%s)", time, time % 4); + "insert into t(tag1, tag2,time,s0) values('car','d1',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d2',%s,%s)", time, time % 4); + "insert into t(tag1, tag2,time,s0) values('car','d2',%s,%s)", time, time % 4); statement.addBatch(sql); } @@ -120,31 +120,31 @@ private static void insertData() { String sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d0',%s,%s)", time, time % 7); + "insert into t(tag1,tag2,time,s0) values('fans','d0',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d1',%s,%s)", time, time % 4); + "insert into t(tag1,tag2,time,s0) values('fans','d1',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d2',%s,%s)", time, time % 7); + "insert into t(tag1,tag2,time,s0) values('fans','d2',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d3',%s,%s)", time, time % 4); + "insert into t(tag1,tag2,time,s0) values('fans','d3',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d0',%s,%s)", time, time % 7); + "insert into t(tag1, tag2,time,s0) values('car','d0',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d1',%s,%s)", time, time % 4); + "insert into t(tag1, tag2,time,s0) values('car','d1',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d2',%s,%s)", time, time % 4); + "insert into t(tag1, tag2,time,s0) values('car','d2',%s,%s)", time, time % 4); statement.addBatch(sql); } @@ -153,31 +153,31 @@ private static void insertData() { // System.out.println("===" + time); String sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d0',%s,%s)", time, time % 7); + "insert into t(tag1,tag2,time,s0) values('fans','d0',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d1',%s,%s)", time, time % 4); + "insert into t(tag1,tag2,time,s0) values('fans','d1',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d2',%s,%s)", time, time % 7); + "insert into t(tag1,tag2,time,s0) values('fans','d2',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d3',%s,%s)", time, time % 4); + "insert into t(tag1,tag2,time,s0) values('fans','d3',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d0',%s,%s)", time, time % 7); + "insert into t(tag1, tag2,time,s0) values('car','d0',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d1',%s,%s)", time, time % 4); + "insert into t(tag1, tag2,time,s0) values('car','d1',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d2',%s,%s)", time, time % 4); + "insert into t(tag1, tag2,time,s0) values('car','d2',%s,%s)", time, time % 4); statement.addBatch(sql); } @@ -188,31 +188,31 @@ private static void insertData() { String sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d0',%s,%s)", time, time % 7); + "insert into t(tag1,tag2,time,s0) values('fans','d0',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d1',%s,%s)", time, time % 4); + "insert into t(tag1,tag2,time,s0) values('fans','d1',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d2',%s,%s)", time, time % 7); + "insert into t(tag1,tag2,time,s0) values('fans','d2',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d3',%s,%s)", time, time % 4); + "insert into t(tag1,tag2,time,s0) values('fans','d3',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d0',%s,%s)", time, time % 7); + "insert into t(tag1, tag2,time,s0) values('car','d0',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d1',%s,%s)", time, time % 4); + "insert into t(tag1, tag2,time,s0) values('car','d1',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d2',%s,%s)", time, time % 4); + "insert into t(tag1, tag2,time,s0) values('car','d2',%s,%s)", time, time % 4); statement.addBatch(sql); } @@ -221,31 +221,31 @@ private static void insertData() { String sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d0',%s,%s)", time, time % 7); + "insert into t(tag1,tag2,time,s0) values('fans','d0',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d1',%s,%s)", time, time % 4); + "insert into t(tag1,tag2,time,s0) values('fans','d1',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d2',%s,%s)", time, time % 7); + "insert into t(tag1,tag2,time,s0) values('fans','d2',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1,id2,time,s0) values('fans','d3',%s,%s)", time, time % 4); + "insert into t(tag1,tag2,time,s0) values('fans','d3',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d0',%s,%s)", time, time % 7); + "insert into t(tag1, tag2,time,s0) values('car','d0',%s,%s)", time, time % 7); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d1',%s,%s)", time, time % 4); + "insert into t(tag1, tag2,time,s0) values('car','d1',%s,%s)", time, time % 4); statement.addBatch(sql); sql = String.format( - "insert into t(id1, id2,time,s0) values('car','d2',%s,%s)", time, time % 4); + "insert into t(tag1, tag2,time,s0) values('car','d2',%s,%s)", time, time % 4); statement.addBatch(sql); } assertTrue(Arrays.stream(statement.executeBatch()).allMatch(i -> i == 200)); @@ -273,13 +273,13 @@ private void testSelectAll() { try (ResultSet resultSet = statement.executeQuery(selectSql)) { int cnt = 0; while (resultSet.next()) { - String id = resultSet.getString("id1") + "_" + resultSet.getString("id2"); - long before = lastTimeMap.getOrDefault(id, -1L); + String tag = resultSet.getString("tag1") + "_" + resultSet.getString("tag2"); + long before = lastTimeMap.getOrDefault(tag, -1L); long cur = resultSet.getTimestamp("time").getTime(); if (cur <= before) { fail("time order wrong!"); } - lastTimeMap.put(id, cur); + lastTimeMap.put(tag, cur); cnt++; } assertEquals(16030, cnt); @@ -297,10 +297,10 @@ private void testSelectAfterDelete() { Statement statement = connection.createStatement()) { statement.execute("USE \"test\""); - statement.execute("DELETE FROM t WHERE id1='fans' and time <= 100"); - statement.execute("DELETE FROM t WHERE id1='car' and time <= 100"); - statement.execute("DELETE FROM t WHERE id1='fans' and time >= 20050 and time < 20100"); - statement.execute("DELETE FROM t WHERE id1='car' and time >= 20050 and time < 20100"); + statement.execute("DELETE FROM t WHERE tag1='fans' and time <= 100"); + statement.execute("DELETE FROM t WHERE tag1='car' and time <= 100"); + statement.execute("DELETE FROM t WHERE tag1='fans' and time >= 20050 and time < 20100"); + statement.execute("DELETE FROM t WHERE tag1='car' and time >= 20050 and time < 20100"); try (ResultSet resultSet = statement.executeQuery(selectSql)) { int cnt = 0; @@ -316,8 +316,8 @@ private void testSelectAfterDelete() { assertEquals(2140, cnt); } - statement.execute("DELETE FROM t WHERE id1 = 'fans' and time <= 20000"); - statement.execute("DELETE FROM t WHERE id1 = 'car' and time <= 20000"); + statement.execute("DELETE FROM t WHERE tag1 = 'fans' and time <= 20000"); + statement.execute("DELETE FROM t WHERE tag1 = 'car' and time <= 20000"); try (ResultSet resultSet = statement.executeQuery(selectSql)) { int cnt = 0; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiIDsWithAttributesTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiTAGsWithAttributesTableIT.java similarity index 97% rename from integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiIDsWithAttributesTableIT.java rename to integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiTAGsWithAttributesTableIT.java index 8bf4728fd182..eb372b9c1f3f 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiIDsWithAttributesTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiTAGsWithAttributesTableIT.java @@ -39,18 +39,18 @@ import static org.apache.iotdb.db.queryengine.plan.relational.planner.optimizations.JoinUtils.FULL_JOIN_ONLY_SUPPORT_EQUI_JOIN; import static org.junit.Assert.fail; -/** In this IT, table has more than one IDs and Attributes. */ +/** In this IT, table has more than one TAGs and Attributes. */ @RunWith(IoTDBTestRunner.class) @Category({TableLocalStandaloneIT.class, TableClusterIT.class}) -public class IoTDBMultiIDsWithAttributesTableIT { +public class IoTDBMultiTAGsWithAttributesTableIT { private static final String DATABASE_NAME = "db"; private static final String[] sql1 = new String[] { "CREATE DATABASE db", "USE db", - "CREATE TABLE table0 (device string id, level string id, attr1 string attribute, attr2 string attribute, num int32 measurement, bigNum int64 measurement, " - + "floatNum FLOAT measurement, str TEXT measurement, bool BOOLEAN measurement, date DATE measurement, blob BLOB measurement, ts TIMESTAMP measurement, stringV STRING measurement, doubleNum DOUBLE measurement)", + "CREATE TABLE table0 (device string tag, level string tag, attr1 string attribute, attr2 string attribute, num int32 field, bigNum int64 field, " + + "floatNum FLOAT field, str TEXT field, bool BOOLEAN field, date DATE field, blob BLOB field, ts TIMESTAMP field, stringV STRING field, doubleNum DOUBLE field)", "insert into table0(device, level, attr1, attr2, time,num,bigNum,floatNum,str,bool) values('d1', 'l1', 'c', 'd', 0,3,2947483648,231.2121,'coconut',FALSE)", "insert into table0(device, level, attr1, attr2, time,num,bigNum,floatNum,str,bool,blob,ts,doubleNum) values('d1', 'l2', 'y', 'z', 20,2,2147483648,434.12,'pineapple',TRUE,X'108DCD62',2024-09-24T06:15:35.000+00:00,6666.8)", "insert into table0(device, level, attr1, attr2, time,num,bigNum,floatNum,str,bool) values('d1', 'l3', 't', 'a', 40,1,2247483648,12.123,'apricot',TRUE)", @@ -91,8 +91,8 @@ public class IoTDBMultiIDsWithAttributesTableIT { private static final String[] sql3 = new String[] { - "CREATE TABLE table1 (device string id, level string id, attr1 string attribute, attr2 string attribute, num int32 measurement, bigNum int64 measurement, " - + "floatNum double measurement, str TEXT measurement, bool BOOLEAN measurement, date DATE measurement, blob BLOB measurement, doubleNum DOUBLE measurement)", + "CREATE TABLE table1 (device string tag, level string tag, attr1 string attribute, attr2 string attribute, num int32 field, bigNum int64 field, " + + "floatNum double field, str TEXT field, bool BOOLEAN field, date DATE field, blob BLOB field, doubleNum DOUBLE field)", "insert into table1(device, level, attr1, attr2, time, num, bigNum, floatNum, str, bool, date, blob) values('d1', 'l1', 'c', 'd', 0, 3, 2947483648,231.2121, 'coconut', FALSE, '2023-01-01', X'100DCD62')", "insert into table1(device, level, attr1, attr2, time, num, bigNum, floatNum, str, bool, blob) values('d1', 'l2', 'y', 'z', 20, 2, 2147483648,434.12, 'pineapple', TRUE, X'101DCD62')", "insert into table1(device, level, attr1, attr2, time, num, bigNum, floatNum, str, bool, blob) values('d1', 'l3', 't', 'a', 40, 1, 2247483648,12.123, 'apricot', TRUE, null)", @@ -116,29 +116,29 @@ public class IoTDBMultiIDsWithAttributesTableIT { private static final String[] sql4 = new String[] { - "create table students(region STRING ID, student_id INT32 MEASUREMENT, name STRING MEASUREMENT, genders text MEASUREMENT, date_of_birth DATE MEASUREMENT)", - "create table teachers(region STRING ID, teacher_id INT32 MEASUREMENT, course_id INT32 MEASUREMENT, age INT32 MEASUREMENT)", - "create table courses(course_id STRING ID, course_name STRING MEASUREMENT, teacher_id INT32 MEASUREMENT)", - "create table grades(grade_id STRING ID, course_id INT32 MEASUREMENT, student_id INT32 MEASUREMENT, score INT32 MEASUREMENT)", - "insert into students(time,region,student_id,name,genders,date_of_birth) values" + "create table students(region STRING TAG, student_tag INT32 FIELD, name STRING FIELD, genders text FIELD, date_of_birth DATE FIELD)", + "create table teachers(region STRING TAG, teacher_tag INT32 FIELD, course_tag INT32 FIELD, age INT32 FIELD)", + "create table courses(course_tag STRING TAG, course_name STRING FIELD, teacher_tag INT32 FIELD)", + "create table grades(grade_tag STRING TAG, course_tag INT32 FIELD, student_tag INT32 FIELD, score INT32 FIELD)", + "insert into students(time,region,student_tag,name,genders,date_of_birth) values" + "(1,'haidian',1,'Lucy','女','2015-10-10'),(2,'haidian',2,'Jack','男','2015-09-24'),(3,'chaoyang',3,'Sam','男','2014-07-20'),(4,'chaoyang',4,'Lily','女','2015-03-28')," + "(5,'xicheng',5,'Helen','女','2016-01-22'),(6,'changping',6,'Nancy','女','2017-12-20'),(7,'changping',7,'Mike','男','2016-11-22'),(8,'shunyi',8,'Bob','男','2016-05-12')", - "insert into teachers(time,region,teacher_id,course_id,age) values" + "insert into teachers(time,region,teacher_tag,course_tag,age) values" + "(1,'haidian',1001,10000001,25),(2,'haidian',1002,10000002,26),(3,'chaoyang',1003,10000003,28)," + "(4,'chaoyang',1004,10000004,27),(5,'xicheng',1005,10000005,26)", - "insert into courses(time,course_id,course_name,teacher_id) values" + "insert into courses(time,course_tag,course_name,teacher_tag) values" + "(1,10000001,'数学',1001),(2,10000002,'语文',1002),(3,10000003,'英语',1003)," + "(4,10000004,'体育',1004),(5,10000005,'历史',1005)", - "insert into grades(time,grade_id,course_id,student_id,score) values" + "insert into grades(time,grade_tag,course_tag,student_tag,score) values" + "(1,1111,10000001,1,99),(2,1112,10000002,2,90),(3,1113,10000003,3,85),(4,1114,10000004,4,89),(5,1115,10000005,5,98)," + "(6,1113,10000003,6,55),(7,1114,10000004,7,60),(8,1115,10000005,8,100),(9,1114,10000001,2,99),(10,1115,10000002,1,95)" }; private static final String[] sql5 = new String[] { - "create table tableA(device STRING ID, value INT32 MEASUREMENT)", - "create table tableB(device STRING ID, value INT32 MEASUREMENT)", - "create table tableC(device STRING ID, value INT32 MEASUREMENT)", + "create table tableA(device STRING TAG, value INT32 FIELD)", + "create table tableB(device STRING TAG, value INT32 FIELD)", + "create table tableC(device STRING TAG, value INT32 FIELD)", "insert into tableA(time,device,value) values('2020-01-01 00:00:01.000', 'd1', 1)", "insert into tableA(time,device,value) values('2020-01-01 00:00:03.000', 'd1', 3)", "flush", @@ -316,7 +316,7 @@ public void sortAttributeTest() { } @Test - public void sortAllIDTimesTest() { + public void sortAllTAGTimesTest() { String[] expectedHeader = new String[] {"time", "level", "attr1", "device", "num"}; String[] retArray = new String[] { @@ -364,7 +364,7 @@ public void sortAllIDTimesTest() { } @Test - public void sortIDWithExpressionTest() { + public void sortTAGWithExpressionTest() { String[] expectedHeader = new String[] {"level", "sum", "attr1", "device", "time"}; String[] retArray = new String[] { @@ -553,7 +553,7 @@ public void aggregationTest() { retArray, DATABASE_NAME); - // ID has null value + // TAG has null value expectedHeader = new String[] { "count_num", @@ -1747,7 +1747,7 @@ public void timeColumnFullOuterJoinTest2() { public void fourTableJoinTest() { expectedHeader = new String[] { - "time", "s_id", "s_name", "s_birth", "t_id", "t_c_id", "c_name", "g_id", "score" + "time", "s_tag", "s_name", "s_birth", "t_tag", "t_c_tag", "c_name", "g_tag", "score" }; retArray = new String[] { @@ -1759,16 +1759,16 @@ public void fourTableJoinTest() { }; sql = "select s.time," - + " s.student_id as s_id, s.name as s_name, s.date_of_birth as s_birth," - + " t.teacher_id as t_id, t.course_id as t_c_id," + + " s.student_tag as s_tag, s.name as s_name, s.date_of_birth as s_birth," + + " t.teacher_tag as t_tag, t.course_tag as t_c_tag," + " c.course_name as c_name," - + " g.grade_id as g_id, g.score as score " + + " g.grade_tag as g_tag, g.score as score " + "from students s, teachers t, courses c, grades g " + "where s.time=t.time AND c.time=g.time AND s.time=c.time " - + "order by s.student_id, t.teacher_id, c.course_id,g.grade_id"; + + "order by s.student_tag, t.teacher_tag, c.course_tag,g.grade_tag"; tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE_NAME); - expectedHeader = new String[] {"region", "name", "teacher_id", "course_name", "score"}; + expectedHeader = new String[] {"region", "name", "teacher_tag", "course_name", "score"}; retArray = new String[] { @@ -1776,11 +1776,11 @@ public void fourTableJoinTest() { }; sql = "select s.region, s.name," - + " t.teacher_id," + + " t.teacher_tag," + " c.course_name," + " g.score " + "from students s, teachers t, courses c, grades g " - + "where s.time=c.time and c.time=g.time and t.teacher_id = 1005 limit 1"; + + "where s.time=c.time and c.time=g.time and t.teacher_tag = 1005 limit 1"; tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE_NAME); } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRecoverTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRecoverTableIT.java index 881027d39474..8a9c9bc4c5b7 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRecoverTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRecoverTableIT.java @@ -61,22 +61,22 @@ public class IoTDBRecoverTableIT { new String[] { "CREATE DATABASE test", "USE \"test\"", - "CREATE TABLE vehicle (id1 string id, s0 int32 measurement, s1 int64 measurement, s2 float measurement, s3 text measurement, s4 boolean measurement)" + "CREATE TABLE vehicle (tag1 string tag, s0 int32 field, s1 int64 field, s2 float field, s3 text field, s4 boolean field)" }; private static final String[] dataSet2 = new String[] { "CREATE DATABASE ln", "USE \"ln\"", - "CREATE TABLE wf01 (id1 string id, status boolean measurement, temperature float measurement, hardware int32 measurement)", - "INSERT INTO wf01(id1, time,temperature,status, hardware) " + "CREATE TABLE wf01 (tag1 string tag, status boolean field, temperature float field, hardware int32 field)", + "INSERT INTO wf01(tag1, time,temperature,status, hardware) " + "values('wt01', 1, 1.1, false, 11)", - "INSERT INTO wf01(id1, time,temperature,status, hardware) " + "INSERT INTO wf01(tag1, time,temperature,status, hardware) " + "values('wt01', 2, 2.2, true, 22)", - "INSERT INTO wf01(id1, time,temperature,status, hardware) " + "INSERT INTO wf01(tag1, time,temperature,status, hardware) " + "values('wt01', 3, 3.3, false, 33 )", - "INSERT INTO wf01(id1, time,temperature,status, hardware) " + "INSERT INTO wf01(tag1, time,temperature,status, hardware) " + "values('wt01', 4, 4.4, false, 44)", - "INSERT INTO wf01(id1, time,temperature,status, hardware) " + "INSERT INTO wf01(tag1, time,temperature,status, hardware) " + "values('wt01',5, 5.5, false, 55)" }; private static final String d0s0 = "s0"; @@ -256,7 +256,7 @@ private static void prepareData() { // prepare BufferWrite file String insertTemplate = - "INSERT INTO vehicle(id1,timestamp,s0,s1,s2,s3,s4)" + " VALUES('d0',%d,%d,%d,%f,%s,%s)"; + "INSERT INTO vehicle(tag1,timestamp,s0,s1,s2,s3,s4)" + " VALUES('d0',%d,%d,%d,%f,%s,%s)"; for (int i = 5000; i < 7000; i++) { statement.addBatch( String.format( diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRecoverUnclosedTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRecoverUnclosedTableIT.java index 033f0e53d708..ce3b4bd91617 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRecoverUnclosedTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRecoverUnclosedTableIT.java @@ -61,22 +61,22 @@ public class IoTDBRecoverUnclosedTableIT { new String[] { "CREATE DATABASE test", "USE \"test\"", - "CREATE TABLE vehicle (id1 string id, s0 int32 measurement, s1 int64 measurement, s2 float measurement, s3 text measurement, s4 boolean measurement)" + "CREATE TABLE vehicle (tag1 string tag, s0 int32 field, s1 int64 field, s2 float field, s3 text field, s4 boolean field)" }; private static final String[] dataSet2 = new String[] { "CREATE DATABASE ln", "USE \"ln\"", - "CREATE TABLE wf01 (id1 string id, status boolean measurement, temperature float measurement, hardware int32 measurement)", - "INSERT INTO wf01(id1, time,temperature,status, hardware) " + "CREATE TABLE wf01 (tag1 string tag, status boolean field, temperature float field, hardware int32 field)", + "INSERT INTO wf01(tag1, time,temperature,status, hardware) " + "values('wt01', 1, 1.1, false, 11)", - "INSERT INTO wf01(id1, time,temperature,status, hardware) " + "INSERT INTO wf01(tag1, time,temperature,status, hardware) " + "values('wt01', 2, 2.2, true, 22)", - "INSERT INTO wf01(id1, time,temperature,status, hardware) " + "INSERT INTO wf01(tag1, time,temperature,status, hardware) " + "values('wt01', 3, 3.3, false, 33 )", - "INSERT INTO wf01(id1, time,temperature,status, hardware) " + "INSERT INTO wf01(tag1, time,temperature,status, hardware) " + "values('wt01', 4, 4.4, false, 44)", - "INSERT INTO wf01(id1, time,temperature,status, hardware) " + "INSERT INTO wf01(tag1, time,temperature,status, hardware) " + "values('wt01',5, 5.5, false, 55)" }; @@ -213,7 +213,7 @@ private void insertMoreData() { // prepare BufferWrite file String insertTemplate = - "INSERT INTO vehicle(id1,timestamp,s0,s1,s2,s3,s4)" + " VALUES('d0',%d,%d,%d,%f,%s,%s)"; + "INSERT INTO vehicle(tag1,timestamp,s0,s1,s2,s3,s4)" + " VALUES('d0',%d,%d,%d,%f,%s,%s)"; for (int i = 5000; i < 7000; i++) { statement.addBatch( String.format( diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRestartTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRestartTableIT.java index a2216e8e4ead..7ac759e1ce70 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRestartTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBRestartTableIT.java @@ -80,8 +80,8 @@ public void testRestart() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("create database test"); statement.execute("use \"test\""); - statement.execute("create table turbine (id1 string id, s1 float measurement)"); - statement.execute("insert into turbine(id1, time,s1) values('d1', 1,1.0)"); + statement.execute("create table turbine (tag1 string tag, s1 float field)"); + statement.execute("insert into turbine(tag1, time,s1) values('d1', 1,1.0)"); statement.execute("flush"); } @@ -94,7 +94,7 @@ public void testRestart() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute("insert into turbine(id1, time,s1) values('d1', 2,1.0)"); + statement.execute("insert into turbine(tag1, time,s1) values('d1', 2,1.0)"); } try { @@ -106,7 +106,7 @@ public void testRestart() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute("insert into turbine(id1, time,s1) values('d1', 3,1.0)"); + statement.execute("insert into turbine(tag1, time,s1) values('d1', 3,1.0)"); String[] exp = new String[] {"1,1.0", "2,1.0", "3,1.0"}; int cnt = 0; @@ -174,10 +174,9 @@ public void testRestartQueryLargerThanEndTime() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("create database \"test\""); statement.execute("use \"test\""); - statement.execute( - "create table turbine (id1 string id, s1 int64 measurement, s2 boolean measurement)"); - statement.execute("insert into turbine(time,id1,s1) values(1,\'d1\',1)"); - statement.execute("insert into turbine(time,id1,s1) values(2,\'d1\',2)"); + statement.execute("create table turbine (tag1 string tag, s1 int64 field, s2 boolean field)"); + statement.execute("insert into turbine(time,tag1,s1) values(1,\'d1\',1)"); + statement.execute("insert into turbine(time,tag1,s1) values(2,\'d1\',2)"); } try { @@ -189,8 +188,8 @@ public void testRestartQueryLargerThanEndTime() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute("insert into turbine(time,id1,s1) values(3,\'d1\',1)"); - statement.execute("insert into turbine(time,id1,s1) values(4,\'d1\',2)"); + statement.execute("insert into turbine(time,tag1,s1) values(3,\'d1\',1)"); + statement.execute("insert into turbine(time,tag1,s1) values(4,\'d1\',2)"); } try { @@ -209,7 +208,7 @@ public void testRestartQueryLargerThanEndTime() throws SQLException { }; int cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT Time, s1 FROM turbine where time > 3 and id1=\'d1\'")) { + statement.executeQuery("SELECT Time, s1 FROM turbine where time > 3 and tag1=\'d1\'")) { assertNotNull(resultSet); while (resultSet.next()) { String result = resultSet.getLong(TIMESTAMP_STR) + "," + resultSet.getString(2); @@ -227,10 +226,9 @@ public void testRestartEndTime() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("create database \"test\""); statement.execute("use \"test\""); - statement.execute( - "create table turbine (id1 string id, s1 int64 measurement, s2 int64 measurement)"); - statement.execute("insert into turbine(time,\"id1\",s1) values(1,\'d1\',1)"); - statement.execute("insert into turbine(time,\"id1\",s1) values(2,\'d1\',2)"); + statement.execute("create table turbine (tag1 string tag, s1 int64 field, s2 int64 field)"); + statement.execute("insert into turbine(time,\"tag1\",s1) values(1,\'d1\',1)"); + statement.execute("insert into turbine(time,\"tag1\",s1) values(2,\'d1\',2)"); } try { @@ -242,8 +240,8 @@ public void testRestartEndTime() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute("insert into turbine(time,id1,s2) values(1,\'d1\',1)"); - statement.execute("insert into turbine(time,id1,s2) values(2,\'d1\',2)"); + statement.execute("insert into turbine(time,tag1,s2) values(1,\'d1\',1)"); + statement.execute("insert into turbine(time,tag1,s2) values(2,\'d1\',2)"); } try { @@ -259,7 +257,7 @@ public void testRestartEndTime() throws SQLException { String[] exp = new String[] {"1,1", "2,2"}; int cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT Time, s2 FROM turbine where id1=\'d1\'")) { + statement.executeQuery("SELECT Time, s2 FROM turbine where tag1=\'d1\'")) { assertNotNull(resultSet); while (resultSet.next()) { String result = resultSet.getLong(TIMESTAMP_STR) + "," + resultSet.getLong(2); @@ -310,7 +308,7 @@ public void testRecoverWALDeleteSchema() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("use \"test\""); - statement.execute("insert into turbine1(time,id1,s1,s2) values(1,\'d1\',1.1,2.2)"); + statement.execute("insert into turbine1(time,tag1,s1,s2) values(1,\'d1\',1.1,2.2)"); statement.execute("delete timeseries root.turbine1.d1.s1"); } @@ -349,11 +347,11 @@ public void testRecoverWALDeleteSchemaCheckResourceTime() throws Exception { statement.execute("create database \"test\""); statement.execute("use \"test\""); statement.execute( - "create table turbine1 (id1 string id, s1 int64 measurement, s2 boolean measurement)"); - statement.execute("insert into turbine1(time,id1,s1) values(1,\'d1\',1)"); - statement.execute("insert into turbine1(time,id1,s1) values(2,\'d1\',2)"); - statement.execute("insert into turbine1(time,id1,s2) values(3,\'d1\',true)"); - statement.execute("insert into turbine1(time,id1,s2) values(4,\'d1\',true)"); + "create table turbine1 (tag1 string tag, s1 int64 field, s2 boolean field)"); + statement.execute("insert into turbine1(time,tag1,s1) values(1,\'d1\',1)"); + statement.execute("insert into turbine1(time,tag1,s1) values(2,\'d1\',2)"); + statement.execute("insert into turbine1(time,tag1,s2) values(3,\'d1\',true)"); + statement.execute("insert into turbine1(time,tag1,s2) values(4,\'d1\',true)"); } TestUtils.restartDataNodes(); @@ -385,9 +383,8 @@ public void testRecoverFromFlushMemTableError() throws Exception { Statement statement = connection.createStatement()) { statement.execute("create database \"test\""); statement.execute("use \"test\""); - statement.execute( - "create table turbine1 (id1 string id, s1 float measurement, s2 double measurement)"); - statement.execute("insert into turbine1(time,id1,s1,s2) values(1,\'d1\',1.1,2.2)"); + statement.execute("create table turbine1 (tag1 string tag, s1 float field, s2 double field)"); + statement.execute("insert into turbine1(time,tag1,s1,s2) values(1,\'d1\',1.1,2.2)"); } TestUtils.restartDataNodes(); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedAggregateFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedAggregateFunctionIT.java index 0a99caff34fa..a8a136ec1f9e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedAggregateFunctionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedAggregateFunctionIT.java @@ -46,7 +46,7 @@ public class IoTDBUserDefinedAggregateFunctionIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE table1(province STRING ID, city STRING ID, region STRING ID, device_id STRING ID, color STRING ATTRIBUTE, type STRING ATTRIBUTE, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT, s5 BOOLEAN MEASUREMENT, s6 TEXT MEASUREMENT, s7 STRING MEASUREMENT, s8 BLOB MEASUREMENT, s9 TIMESTAMP MEASUREMENT, s10 DATE MEASUREMENT)", + "CREATE TABLE table1(province STRING TAG, city STRING TAG, region STRING TAG, device_id STRING TAG, color STRING ATTRIBUTE, type STRING ATTRIBUTE, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 BOOLEAN FIELD, s6 TEXT FIELD, s7 STRING FIELD, s8 BLOB FIELD, s9 TIMESTAMP FIELD, s10 DATE FIELD)", "INSERT INTO table1(time,province,city,region,device_id,color,type,s1,s3,s6,s8,s9) values (2024-09-24T06:15:30.000+00:00,'shanghai','shanghai','huangpu','d01','red','A',30,30.0,'shanghai_huangpu_red_A_d01_30', X'cafebabe30',2024-09-24T06:15:30.000+00:00)", "INSERT INTO table1(time,province,city,region,device_id,color,type,s2,s3,s4,s6,s7,s9,s10) values (2024-09-24T06:15:35.000+00:00,'shanghai','shanghai','huangpu','d01','red','A',35000,35.0,35.0,'shanghai_huangpu_red_A_d01_35','shanghai_huangpu_red_A_d01_35',2024-09-24T06:15:35.000+00:00,'2024-09-24')", "INSERT INTO table1(time,province,city,region,device_id,color,type,s1,s3,s5,s7,s9) values (2024-09-24T06:15:40.000+00:00,'shanghai','shanghai','huangpu','d01','red','A',40,40.0,true,'shanghai_huangpu_red_A_d01_40',2024-09-24T06:15:40.000+00:00)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedScalarFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedScalarFunctionIT.java index 7bb537ccb5cb..17d3170634c8 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedScalarFunctionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/udf/IoTDBUserDefinedScalarFunctionIT.java @@ -51,14 +51,14 @@ public class IoTDBUserDefinedScalarFunctionIT { new String[] { "CREATE DATABASE test", "USE test", - "CREATE TABLE vehicle (device_id string id, s1 INT32 measurement, s2 INT64 measurement, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT, s5 BOOLEAN MEASUREMENT)", + "CREATE TABLE vehicle (device_id string tag, s1 INT32 field, s2 INT64 field, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 BOOLEAN FIELD)", "insert into vehicle(time, device_id, s1, s2, s3, s4, s5) values (1, 'd0', 1, 1, 1.1, 1.1, true)", "insert into vehicle(time, device_id, s1, s2, s3, s4, s5) values (2, 'd0', null, 2, 2.2, 2.2, true)", "insert into vehicle(time, device_id, s1, s2, s3, s4, s5) values (3, 'd0', 3, 3, null, null, false)", "insert into vehicle(time, device_id, s5) values (5, 'd0', true)", "CREATE FUNCTION contain_null as 'org.apache.iotdb.db.query.udf.example.relational.ContainNull'", "CREATE FUNCTION all_sum as 'org.apache.iotdb.db.query.udf.example.relational.AllSum'", - "CREATE TABLE t2 (device_id string id, s1 DATE measurement)", + "CREATE TABLE t2 (device_id string tag, s1 DATE field)", "insert into t2(time, device_id, s1) values (1, 'd0', '2024-02-28')", "insert into t2(time, device_id, s1) values (2, 'd0', '2024-02-29')", "insert into t2(time, device_id, s1) values (3, 'd0', '2024-03-01')", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBDatetimeFormatTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBDatetimeFormatTableIT.java index c9a48c6f1680..08e9ccc8635a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBDatetimeFormatTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBDatetimeFormatTableIT.java @@ -55,7 +55,7 @@ public static void setUp() throws Exception { statement.execute("create database " + DATABASE_NAME); statement.execute("use " + DATABASE_NAME); statement.execute( - "create table table1(device_id STRING ID, s1 INT32 MEASUREMENT, s2 DOUBLE MEASUREMENT)"); + "create table table1(device_id STRING TAG, s1 INT32 FIELD, s2 DOUBLE FIELD)"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterBetweenTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterBetweenTableIT.java index 5c21a3ccb55f..52d4fae12f8b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterBetweenTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterBetweenTableIT.java @@ -66,7 +66,7 @@ private static void generateData(List SQLs) { SQLs.add("CREATE DATABASE " + DATABASE_NAME); SQLs.add("USE " + DATABASE_NAME); SQLs.add( - "CREATE TABLE table1 (device STRING ID, s1 INT32 MEASUREMENT, s2 INT32 MEASUREMENT, s3 TEXT MEASUREMENT)"); + "CREATE TABLE table1 (device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 TEXT FIELD)"); for (int i = 1; i <= ITERATION_TIMES; ++i) { SQLs.add( String.format( diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterNullTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterNullTableIT.java index 2f93773d6765..a86e683fa49a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterNullTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterNullTableIT.java @@ -47,7 +47,7 @@ public class IoTDBFilterNullTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE testNullFilter(device STRING ID, s1 INT32 MEASUREMENT, s2 BOOLEAN MEASUREMENT, s3 DOUBLE MEASUREMENT)", + "CREATE TABLE testNullFilter(device STRING TAG, s1 INT32 FIELD, s2 BOOLEAN FIELD, s3 DOUBLE FIELD)", "INSERT INTO testNullFilter(time,device,s2,s3) " + "values(1, 'd1', false, 11.1)", "INSERT INTO testNullFilter(time,device,s1,s2) " + "values(2, 'd1', 22, true)", "INSERT INTO testNullFilter(time,device,s1,s3) " + "values(3, 'd1', 23, 33.3)", 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 b4be0d024cd4..7ecc9673b234 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 @@ -74,13 +74,11 @@ private static void createTimeSeries() { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE TABLE testNaN(device STRING ID, n1 DOUBLE MEASUREMENT, n2 DOUBLE MEASUREMENT)"); + "CREATE TABLE testNaN(device STRING TAG, n1 DOUBLE FIELD, n2 DOUBLE FIELD)"); statement.execute( - "CREATE TABLE testTimeSeries(device STRING ID, s1 BOOLEAN MEASUREMENT, s2 BOOLEAN MEASUREMENT)"); - statement.execute( - "CREATE TABLE testUDTF(device STRING ID, s1 TEXT MEASUREMENT, s2 DOUBLE MEASUREMENT)"); - statement.execute( - "CREATE TABLE sg1(device STRING ID, s1 DOUBLE MEASUREMENT, s2 TEXT MEASUREMENT)"); + "CREATE TABLE testTimeSeries(device STRING TAG, s1 BOOLEAN FIELD, s2 BOOLEAN FIELD)"); + statement.execute("CREATE TABLE testUDTF(device STRING TAG, s1 TEXT FIELD, s2 DOUBLE FIELD)"); + statement.execute("CREATE TABLE sg1(device STRING TAG, s1 DOUBLE FIELD, s2 TEXT FIELD)"); } catch (SQLException throwable) { fail(throwable.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBNestedQueryTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBNestedQueryTableIT.java index e4cc7f41e3ce..02de78ad0ad2 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBNestedQueryTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBNestedQueryTableIT.java @@ -75,12 +75,12 @@ private static void createTable() { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "create table vehicle1(device_id STRING ID, s1 INT32 MEASUREMENT, s2 INT32 MEASUREMENT, s3 TEXT MEASUREMENT, s4 STRING MEASUREMENT, s5 DATE MEASUREMENT, s6 TIMESTAMP MEASUREMENT)"); + "create table vehicle1(device_id STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 TEXT FIELD, s4 STRING FIELD, s5 DATE FIELD, s6 TIMESTAMP FIELD)"); statement.execute( - "create table vehicle2(device_id STRING ID, s1 FLOAT MEASUREMENT, s2 DOUBLE MEASUREMENT, empty DOUBLE MEASUREMENT)"); + "create table vehicle2(device_id STRING TAG, s1 FLOAT FIELD, s2 DOUBLE FIELD, empty DOUBLE FIELD)"); statement.execute( - "create table likeTest(device_id STRING ID, s1 TEXT MEASUREMENT, s2 STRING MEASUREMENT)"); + "create table likeTest(device_id STRING TAG, s1 TEXT FIELD, s2 STRING FIELD)"); } catch (SQLException throwable) { fail(throwable.getMessage()); } 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 3a93991880ee..e1571b001291 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 @@ -79,15 +79,14 @@ public void testCreateTimeseries1() { statement.setFetchSize(5); statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute("CREATE TABLE table1(device STRING ID, s1 INT32 MEASUREMENT)"); + statement.execute("CREATE TABLE table1(device STRING TAG, s1 INT32 FIELD)"); try (ResultSet resultSet = statement.executeQuery("describe table1")) { if (resultSet.next() && resultSet.getString(ColumnHeaderConstant.COLUMN_NAME).equals("s1")) { assertEquals("INT32", resultSet.getString(ColumnHeaderConstant.DATATYPE).toUpperCase()); assertEquals( - "MEASUREMENT", - resultSet.getString(ColumnHeaderConstant.COLUMN_CATEGORY).toUpperCase()); + "FIELD", resultSet.getString(ColumnHeaderConstant.COLUMN_CATEGORY).toUpperCase()); } } @@ -202,8 +201,7 @@ public void testOrderByTimeDesc() throws Exception { statement.setFetchSize(5); statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute( - "CREATE TABLE table1(device STRING ID, s0 INT32 MEASUREMENT, s1 INT32 MEASUREMENT)"); + statement.execute("CREATE TABLE table1(device STRING TAG, s0 INT32 FIELD, s1 INT32 FIELD)"); statement.execute("INSERT INTO table1(device, time, s0) VALUES ('d0', 1, 1)"); statement.execute("INSERT INTO table1(device, time, s0) VALUES ('d0',2, 2)"); statement.execute("INSERT INTO table1(device, time, s0) VALUES ('d0',3, 3)"); @@ -234,7 +232,7 @@ public void testShowTimeseriesDataSet1() { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE TABLE table1(device STRING ID, s1 INT32 MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT32 MEASUREMENT, s4 INT32 MEASUREMENT, s5 INT32 MEASUREMENT, s6 INT32 MEASUREMENT, s7 INT32 MEASUREMENT, s8 INT32 MEASUREMENT, s9 INT32 MEASUREMENT, s10 INT32 MEASUREMENT)"); + "CREATE TABLE 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)"); statement.execute("flush"); @@ -260,7 +258,7 @@ public void testShowTimeseriesDataSet2() { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE TABLE table1(device STRING ID, s1 INT32 MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT32 MEASUREMENT, s4 INT32 MEASUREMENT, s5 INT32 MEASUREMENT, s6 INT32 MEASUREMENT, s7 INT32 MEASUREMENT, s8 INT32 MEASUREMENT, s9 INT32 MEASUREMENT, s10 INT32 MEASUREMENT)"); + "CREATE TABLE 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)"); statement.execute("flush"); @@ -286,7 +284,7 @@ public void testShowTimeseriesDataSet3() { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE TABLE table1(device STRING ID, s1 INT32 MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT32 MEASUREMENT, s4 INT32 MEASUREMENT, s5 INT32 MEASUREMENT, s6 INT32 MEASUREMENT, s7 INT32 MEASUREMENT, s8 INT32 MEASUREMENT, s9 INT32 MEASUREMENT, s10 INT32 MEASUREMENT)"); + "CREATE TABLE 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)"); statement.execute("flush"); @@ -312,7 +310,7 @@ public void testShowTimeseriesDataSet4() { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE TABLE table1(device STRING ID, s1 INT32 MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT32 MEASUREMENT, s4 INT32 MEASUREMENT, s5 INT32 MEASUREMENT, s6 INT32 MEASUREMENT, s7 INT32 MEASUREMENT, s8 INT32 MEASUREMENT, s9 INT32 MEASUREMENT, s10 INT32 MEASUREMENT)"); + "CREATE TABLE 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)"); statement.execute("flush"); @@ -339,7 +337,7 @@ public void testDescribeWithLimitOffset() throws SQLException { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE TABLE table1(device STRING ID, s1 INT32 MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT32 MEASUREMENT, s4 INT32 MEASUREMENT)"); + "CREATE TABLE table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD)"); Set exps = ImmutableSet.of("device", "s1"); int count = 0; @@ -407,7 +405,7 @@ public void testFirstOverlappedPageFiltered() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute("CREATE TABLE table1(device STRING ID, s0 INT32 MEASUREMENT)"); + statement.execute("CREATE TABLE table1(device STRING TAG, s0 INT32 FIELD)"); // seq chunk : [1,10] statement.execute("INSERT INTO table1(time, device, s0) VALUES (1,'d0',1)"); @@ -444,8 +442,7 @@ public void testPartialInsertion() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute( - "CREATE TABLE table1(device STRING ID, s0 INT32 MEASUREMENT, s1 INT32 MEASUREMENT)"); + statement.execute("CREATE TABLE table1(device STRING TAG, s0 INT32 FIELD, s1 INT32 FIELD)"); try { statement.execute("INSERT INTO table1(time, device, s0, s1) VALUES (1, 'd0', 1, 2.2)"); @@ -469,7 +466,7 @@ public void testOverlappedPagesMerge() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute("CREATE TABLE table1(device STRING ID, s0 INT32 MEASUREMENT)"); + statement.execute("CREATE TABLE table1(device STRING TAG, s0 INT32 FIELD)"); // seq chunk : start-end [1000, 1000] statement.execute("INSERT INTO table1(time, device, s0) VALUES (1000, 'd0', 0)"); @@ -512,7 +509,7 @@ public void testUnseqUnsealedDeleteQuery() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute("CREATE TABLE table1(device STRING ID, s0 INT32 MEASUREMENT)"); + statement.execute("CREATE TABLE table1(device STRING TAG, s0 INT32 FIELD)"); // seq data statement.execute("INSERT INTO table1(time, device, s0) VALUES (1000, 'd0', 1)"); @@ -552,10 +549,10 @@ public void testTimeseriesMetadataCache() { statement.execute("CREATE DATABASE test"); statement.execute("USE " + DATABASE_NAME); StringBuilder createTableBuilder = new StringBuilder(); - createTableBuilder.append("CREATE TABLE table1(device STRING ID,"); + createTableBuilder.append("CREATE TABLE table1(device STRING TAG,"); for (int i = 0; i < 1000; i++) { String columnName = "s" + i; - createTableBuilder.append(columnName).append(" INT32 MEASUREMENT,"); + createTableBuilder.append(columnName).append(" INT32 FIELD,"); } createTableBuilder.deleteCharAt(createTableBuilder.lastIndexOf(",")).append(")"); statement.execute(createTableBuilder.toString()); @@ -575,8 +572,7 @@ public void testUseSameStatement() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE test"); statement.execute("USE " + DATABASE_NAME); - statement.execute( - "CREATE TABLE table1(device STRING ID, s0 INT32 MEASUREMENT, s1 INT32 MEASUREMENT)"); + statement.execute("CREATE TABLE table1(device STRING TAG, s0 INT32 FIELD, s1 INT32 FIELD)"); statement.execute("insert into table1(time,device,s0,s1) values(1,'d0',1,1)"); statement.execute("insert into table1(time,device,s0,s1) values(1000,'d1',1000,1000)"); statement.execute("insert into table1(time,device,s0,s1) values(10,'d0',10,10)"); @@ -643,8 +639,7 @@ public void testEnableAlign() throws Exception { Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE test"); statement.execute("USE " + DATABASE_NAME); - statement.execute( - "CREATE TABLE table1(device STRING ID, s1 INT32 MEASUREMENT, s2 BOOLEAN MEASUREMENT)"); + statement.execute("CREATE TABLE table1(device STRING TAG, s1 INT32 FIELD, s2 BOOLEAN FIELD)"); ResultSet resultSet = statement.executeQuery("select time, s1, s2 from table1"); ResultSetMetaData metaData = resultSet.getMetaData(); int[] types = {Types.TIMESTAMP, Types.INTEGER, Types.BOOLEAN}; @@ -662,7 +657,7 @@ public void testNewDataType() { statement.execute("CREATE DATABASE test"); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE TABLE table1(device STRING ID, s4 DATE MEASUREMENT, s5 TIMESTAMP MEASUREMENT, s6 BLOB MEASUREMENT, s7 STRING MEASUREMENT)"); + "CREATE TABLE table1(device STRING TAG, s4 DATE FIELD, s5 TIMESTAMP FIELD, s6 BLOB FIELD, s7 STRING FIELD)"); for (int i = 1; i <= 10; i++) { statement.execute( diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBAlignByDeviceTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBAlignByDeviceTableIT.java index 98918bd37401..3a882b7118c4 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBAlignByDeviceTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBAlignByDeviceTableIT.java @@ -47,7 +47,7 @@ public class IoTDBAlignByDeviceTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "use " + DATABASE_NAME, - "create table vehicle(device_id STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT, s3 STRING MEASUREMENT, s4 BOOLEAN MEASUREMENT)", + "create table vehicle(device_id STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD, s3 STRING FIELD, s4 BOOLEAN FIELD)", "insert into vehicle(time, device_id, s0) values(1,'d0', 101)", "insert into vehicle(time, device_id, s0) values(2,'d0', 198)", "insert into vehicle(time, device_id, s0) values(100,'d0', 99)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableIT.java index 7e058e422eee..c221dc401670 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableIT.java @@ -49,7 +49,7 @@ public class IoTDBAlignByDeviceWithTemplateTableIT { new String[] { "CREATE database " + DATABASE_NAME, "use " + DATABASE_NAME, - "create table table1(device_id STRING ID, s1 FLOAT MEASUREMENT, s2 BOOLEAN MEASUREMENT, s3 INT32 MEASUREMENT)", + "create table table1(device_id STRING TAG, s1 FLOAT FIELD, s2 BOOLEAN FIELD, s3 INT32 FIELD)", "INSERT INTO table1(Time, device_id, s1, s2, s3) VALUES (1,'d1', 1.1, false, 1), (2, 'd1', 2.2, false, 2), (1,'d2', 11.1, false, 11), (2,'d2', 22.2, false, 22), (1,'d3', 111.1, true, null), (4,'d3', 444.4, true, 44), (1,'d4', 1111.1, true, 1111), (5,'d4', 5555.5, false, 5555)", }; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBOrderByLimitOffsetAlignByDeviceTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBOrderByLimitOffsetAlignByDeviceTableIT.java index 462cff58ef56..dbe72bea2cb6 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBOrderByLimitOffsetAlignByDeviceTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBOrderByLimitOffsetAlignByDeviceTableIT.java @@ -122,13 +122,13 @@ public void orderByCanNotPushLimitTest() { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "create table table1(device_id STRING ID, s1 INT32 MEASUREMENT)", + "create table table1(device_id STRING TAG, s1 INT32 FIELD)", "INSERT INTO table1(Time, device_id, s1) VALUES(1, 'd1', 1), (2, 'd1', 11), (3, 'd1', 111)", "INSERT INTO table1(Time, device_id, s1) VALUES(1, 'd2', 2), (2, 'd2', 22), (3, 'd2', 222)", "INSERT INTO table1(Time, device_id, s1) VALUES(1, 'd3', 3), (2, 'd3', 33), (3, 'd3', 333)", "CREATE DATABASE " + DATABASE_FILL_NAME, "USE " + DATABASE_FILL_NAME, - "create table table1(device_id STRING ID, s1 INT32 MEASUREMENT, s2 FLOAT MEASUREMENT)", + "create table table1(device_id STRING TAG, s1 INT32 FIELD, s2 FLOAT FIELD)", "INSERT INTO table1(Time,device_id,s1,s2) VALUES(1, 'd1', 1, null), (2, 'd1', null, 11), (3, 'd1', 111, 111.1)", "INSERT INTO table1(Time,device_id,s1,s2) VALUES(1, 'd2', 2, null), (2, 'd2', 22, 22.2), (3, 'd2', 222, null)", "INSERT INTO table1(Time,device_id,s1,s2) VALUES(1, 'd3', 3, null), (2, 'd3', 33, null), (3, 'd3', 333, 333.3)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBOrderByWithAlignByDeviceTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBOrderByWithAlignByDeviceTableIT.java index a50aa772066d..5c9ade9530b5 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBOrderByWithAlignByDeviceTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/alignbydevice/IoTDBOrderByWithAlignByDeviceTableIT.java @@ -104,7 +104,7 @@ protected static void insertData() { statement.execute("use " + DATABASE_NAME); statement.execute( - "create table weather(city STRING ID, precipitation INT64 MEASUREMENT, temperature DOUBLE MEASUREMENT)"); + "create table weather(city STRING TAG, precipitation INT64 FIELD, temperature DOUBLE FIELD)"); // insert data long start = startTime; @@ -186,7 +186,7 @@ protected static void insertData2() { try (Connection iotDBConnection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = iotDBConnection.createStatement()) { statement.execute("use " + DATABASE_NAME); - statement.execute("create table overflow(device_id STRING ID, value INT32 MEASUREMENT)"); + statement.execute("create table overflow(device_id STRING TAG, value INT32 FIELD)"); long startTime = 1; for (int i = 0; i < 20; i++) { String insertTime = @@ -1535,7 +1535,7 @@ public static void orderByTimeDeviceTest4(String sql, int count, String[] expect // test the optimized plan public static String[] optimizedSQL = new String[] { - "create table optimize(plant_id STRING ID, device_id STRING ID, temperature DOUBLE MEASUREMENT, status BOOLEAN MEASUREMENT, hardware STRING MEASUREMENT)", + "create table optimize(plant_id STRING TAG, device_id STRING TAG, temperature DOUBLE FIELD, status BOOLEAN FIELD, hardware STRING FIELD)", "insert into optimize(Time, plant_id, device_id, temperature, status) values(2017-11-01T00:00:00.000+08:00, 'wf01', 'wt01', 25.96, true)", "insert into optimize(Time, plant_id, device_id, temperature, status) values(2017-11-01T00:01:00.000+08:00, 'wf01', 'wt01', 24.36, true)", "insert into optimize(Time, plant_id, device_id, status, hardware) values(1970-01-01T08:00:00.001+08:00, 'wf02', 'wt02', true, 'v1')", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedOffsetLimitPushDownTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedOffsetLimitPushDownTableIT.java index d58f4bc14127..739fb71398a5 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedOffsetLimitPushDownTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedOffsetLimitPushDownTableIT.java @@ -54,7 +54,7 @@ public static void setUp() throws Exception { statement.execute("CREATE DATABASE IF NOT EXISTS db"); statement.execute(USE_DB); statement.execute( - "CREATE TABLE table0 (device string id, s1 double measurement, s2 double measurement)"); + "CREATE TABLE table0 (device string tag, s1 double field, s2 double field)"); statement.execute("insert into table0(device,time,s1,s2) values('d1',1,1,1)"); statement.execute("insert into table0(device,time,s1,s2) values('d1',2,2,2)"); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/TableUtils.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/TableUtils.java index eba1ba84fbe0..71f936a0d3b8 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/TableUtils.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/TableUtils.java @@ -47,7 +47,7 @@ public class TableUtils { new String[] { "CREATE DATABASE db", "USE db", - "CREATE TABLE table0 (device string id, s1 FLOAT measurement, s2 INT32 measurement, s3 INT64 measurement, s4 BOOLEAN measurement, s5 TEXT measurement)", + "CREATE TABLE table0 (device string tag, s1 FLOAT field, s2 INT32 field, s3 INT64 field, s4 BOOLEAN field, s5 TEXT field)", "insert into table0(device, time, s1, s2, s3, s4, s5) values('d1', 1, 1.0, 1, 1, TRUE, 'aligned_test1')", "insert into table0(device, time, s1, s2, s3, s5) values('d1', 2, 2.0, 2, 2, 'aligned_test2')", "insert into table0(device, time, s1, s3, s4, s5) values('d1', 3, 3.0, 3, FALSE, 'aligned_test3')", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java index 53db1c1ee77e..ee3bf466688c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java @@ -52,7 +52,7 @@ public class IoTDBCastFunctionTableIT { // normal cases "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "create table normal(device_id STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT, s5 BOOLEAN MEASUREMENT, s6 STRING MEASUREMENT)", + "create table normal(device_id STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 BOOLEAN FIELD, s6 STRING FIELD)", // data for int series "INSERT INTO normal(time, device_id ,s1) values(0, 'd1', 0)", "INSERT INTO normal(time, device_id ,s1) values(1, 'd1', 1)", @@ -86,7 +86,7 @@ public class IoTDBCastFunctionTableIT { "flush", // special cases - "create table special(device_id STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT, s5 BOOLEAN MEASUREMENT, s6 STRING MEASUREMENT)", + "create table special(device_id STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 BOOLEAN FIELD, s6 STRING FIELD)", "INSERT INTO special(Time, device_id ,s2) values(1, 'd1', 2147483648)", "INSERT INTO special(Time, device_id ,s3) values(1, 'd1', 2147483648.0)", "INSERT INTO special(Time, device_id ,s3) values(2, 'd1', 2e38)", @@ -98,7 +98,7 @@ public class IoTDBCastFunctionTableIT { "flush", // special cases for date and timestamp - "create table dateType(device_id STRING ID, s1 DATE MEASUREMENT, s2 TIMESTAMP MEASUREMENT)", + "create table dateType(device_id STRING TAG, s1 DATE FIELD, s2 TIMESTAMP FIELD)", "INSERT INTO dateType(Time,device_id, s1, s2) values(1,'d1', '9999-12-31', 253402271999999)", "INSERT INTO dateType(Time,device_id, s1, s2) values(2,'d1', '1000-01-01', -30610224000000)", }; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableSpecialIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableSpecialIT.java index 336a4ad326af..5620f691924c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableSpecialIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableSpecialIT.java @@ -46,7 +46,7 @@ public class IoTDBCastFunctionTableSpecialIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "create table special(device_id STRING ID, s1 DATE MEASUREMENT)", + "create table special(device_id STRING TAG, s1 DATE FIELD)", "INSERT INTO special(time, device_id, s1) values(1, 'd1', '2262-04-13')", "INSERT INTO special(time, device_id, s1) values(2, 'd1', '1677-09-21')", }; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBDiffFunctionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBDiffFunctionTableIT.java index 59af06c3e92a..6bf1ef8db3e8 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBDiffFunctionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBDiffFunctionTableIT.java @@ -47,7 +47,7 @@ public class IoTDBDiffFunctionTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "use " + DATABASE_NAME, - "create table table1(device_id STRING ID, s1 INT32 MEASUREMENT, s2 FLOAT MEASUREMENT)", + "create table table1(device_id STRING TAG, s1 INT32 FIELD, s2 FLOAT FIELD)", "INSERT INTO table1(time,device_id,s1,s2) values(1, 'd1', 1, 1)", "INSERT INTO table1(time,device_id,s1) values(2, 'd1', 2)", "INSERT INTO table1(time,device_id,s2) values(3, 'd1', 3)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBReplaceFunctionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBReplaceFunctionTableIT.java index 79b8b653774b..210de9565d18 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBReplaceFunctionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBReplaceFunctionTableIT.java @@ -48,7 +48,7 @@ public class IoTDBReplaceFunctionTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "use " + DATABASE_NAME, - "create table table1(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT)", + "create table table1(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD)", "INSERT INTO table1(time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd')", "INSERT INTO table1(time,device_id,s1) values(2, 'd1', 'test\\\\')", "INSERT INTO table1(time,device_id,s1) values(3, 'd1', 'abcd\\\\')", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBRoundFunctionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBRoundFunctionTableIT.java index 5191f95a5a14..8c0c74bf36a9 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBRoundFunctionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBRoundFunctionTableIT.java @@ -49,7 +49,7 @@ public class IoTDBRoundFunctionTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "use " + DATABASE_NAME, - "create table table1(device_id STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 DOUBLE MEASUREMENT, s4 FLOAT MEASUREMENT, s5 BOOLEAN MEASUREMENT, s6 STRING MEASUREMENT)", + "create table table1(device_id STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 DOUBLE FIELD, s4 FLOAT FIELD, s5 BOOLEAN FIELD, s6 STRING FIELD)", "INSERT INTO table1(time,device_id,s1,s2,s3,s4,s5,s6) values(1, 'd1', 2, 3, 0.11234, 101.143445345,true,null)", "INSERT INTO table1(time,device_id,s1,s2,s3,s4,s5,s6) values(2, 'd1', 2, 4, 10.11234, 20.1443465345,true,'sss')", "INSERT INTO table1(time,device_id,s1,s2,s3,s4,s5,s6) values(3, 'd1', 2, 555, 120.161234, 20.61437245345,true,'sss')", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBScalarFunctionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBScalarFunctionTableIT.java index 7be2698d59b0..f6ca8918b1ae 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBScalarFunctionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBScalarFunctionTableIT.java @@ -50,7 +50,7 @@ public class IoTDBScalarFunctionTableIT { "CREATE DATABASE " + DATABASE_NAME, "use " + DATABASE_NAME, // absSQL - "create table absTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table absTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO absTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO absTable(Time,device_id,s2) values(2, 'd1', -1)", "INSERT INTO absTable(Time,device_id,s2) values(3, 'd1', -2)", @@ -61,21 +61,21 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO absTable(Time,device_id,s5) values(2, 'd1', -1.5)", "INSERT INTO absTable(Time,device_id,s5) values(3, 'd1', -2.5)", // acosSQL - "create table acosTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table acosTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO acosTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1, 'abcd', X'abcd')", "INSERT INTO acosTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO acosTable(Time,device_id,s3) values(2, 'd1', 2)", "INSERT INTO acosTable(Time,device_id,s4) values(2, 'd1', 0.5)", "INSERT INTO acosTable(Time,device_id,s5) values(2, 'd1', 0.5)", // asinSQL - "create table asinTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table asinTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO asinTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1, 'abcd', X'abcd')", "INSERT INTO asinTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO asinTable(Time,device_id,s3) values(2, 'd1', 2)", "INSERT INTO asinTable(Time,device_id,s4) values(2, 'd1', 0.5)", "INSERT INTO asinTable(Time,device_id,s5) values(2, 'd1', 0.5)", // atanSQL - "create table atanTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table atanTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO atanTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO atanTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO atanTable(Time,device_id,s2) values(3, 'd1', 3)", @@ -86,7 +86,7 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO atanTable(Time,device_id,s5) values(2, 'd1', 2.5)", "INSERT INTO atanTable(Time,device_id,s5) values(3, 'd1', 3.5)", // ceilSQL - "create table ceilTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table ceilTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO ceilTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO ceilTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO ceilTable(Time,device_id,s2) values(3, 'd1', -2)", @@ -97,7 +97,7 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO ceilTable(Time,device_id,s5) values(2, 'd1', 2.5)", "INSERT INTO ceilTable(Time,device_id,s5) values(3, 'd1', -2.5)", // concatSQL - "create table concatTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table concatTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO concatTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'ab', X'abcd')", "INSERT INTO concatTable(Time,device_id,s1) values(2, 'd1', 'Test')", "INSERT INTO concatTable(Time,device_id,s1) values(3, 'd1', 'efgh')", @@ -106,7 +106,7 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO concatTable(Time,device_id,s9) values(3, 'd1', 'efgh')", "INSERT INTO concatTable(Time,device_id,s9) values(4, 'd1', 'haha')", // cosSQL - "create table cosTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table cosTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO cosTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO cosTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO cosTable(Time,device_id,s2) values(3, 'd1', 3)", @@ -117,7 +117,7 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO cosTable(Time,device_id,s5) values(2, 'd1', 2.5)", "INSERT INTO cosTable(Time,device_id,s5) values(3, 'd1', 3.5)", // coshSQL - "create table coshTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table coshTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO coshTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO coshTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO coshTable(Time,device_id,s2) values(3, 'd1', 3)", @@ -128,7 +128,7 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO coshTable(Time,device_id,s5) values(2, 'd1', 2.5)", "INSERT INTO coshTable(Time,device_id,s5) values(3, 'd1', 3.5)", // degreesSQL - "create table degreesTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table degreesTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO degreesTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO degreesTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO degreesTable(Time,device_id,s2) values(3, 'd1', 3)", @@ -139,14 +139,14 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO degreesTable(Time,device_id,s5) values(2, 'd1', 2.5)", "INSERT INTO degreesTable(Time,device_id,s5) values(3, 'd1', 3.5)", // endsWithSQL - "create table endsWithTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table endsWithTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO endsWithTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'ab', X'abcd')", "INSERT INTO endsWithTable(Time,device_id,s1) values(2, 'd1', 'Test')", "INSERT INTO endsWithTable(Time,device_id,s1) values(3, 'd1', 'efgh')", "INSERT INTO endsWithTable(Time,device_id,s9) values(2, 'd1', 'Test')", "INSERT INTO endsWithTable(Time,device_id,s9) values(3, 'd1', 'efgh')", // expSQL - "create table expTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table expTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO expTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO expTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO expTable(Time,device_id,s2) values(3, 'd1', 3)", @@ -157,7 +157,7 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO expTable(Time,device_id,s5) values(2, 'd1', 2.5)", "INSERT INTO expTable(Time,device_id,s5) values(3, 'd1', 3.5)", // floorSQL - "create table floorTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table floorTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO floorTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO floorTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO floorTable(Time,device_id,s2) values(3, 'd1', -2)", @@ -168,14 +168,14 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO floorTable(Time,device_id,s5) values(2, 'd1', 2.5)", "INSERT INTO floorTable(Time,device_id,s5) values(3, 'd1', -2.5)", // lengthSQL - "create table lengthTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table lengthTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO lengthTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO lengthTable(Time,device_id,s1) values(2, 'd1', 'test')", "INSERT INTO lengthTable(Time,device_id,s1) values(3, 'd1', 'abcdefg')", "INSERT INTO lengthTable(Time,device_id,s9) values(2, 'd1', 'test')", "INSERT INTO lengthTable(Time,device_id,s9) values(3, 'd1', 'abcdefg')", // lnSQL - "create table lnTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table lnTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO lnTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO lnTable(Time,device_id,s2) values(2, 'd1', 0)", "INSERT INTO lnTable(Time,device_id,s2) values(3, 'd1', -3)", @@ -186,7 +186,7 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO lnTable(Time,device_id,s5) values(2, 'd1', 0.0)", "INSERT INTO lnTable(Time,device_id,s5) values(3, 'd1', -3.5)", // log10SQL - "create table log10Table(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table log10Table(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO log10Table(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO log10Table(Time,device_id,s2) values(2, 'd1', 0)", "INSERT INTO log10Table(Time,device_id,s2) values(3, 'd1', -3)", @@ -197,14 +197,14 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO log10Table(Time,device_id,s5) values(2, 'd1', 0.0)", "INSERT INTO log10Table(Time,device_id,s5) values(3, 'd1', -3.5)", // lowerSQL - "create table lowerTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table lowerTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO lowerTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'ABCD', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'ABCD', X'abcd')", "INSERT INTO lowerTable(Time,device_id,s1) values(2, 'd1', 'Test')", "INSERT INTO lowerTable(Time,device_id,s1) values(3, 'd1', 'Abcdefg')", "INSERT INTO lowerTable(Time,device_id,s9) values(2, 'd1', 'Test')", "INSERT INTO lowerTable(Time,device_id,s9) values(3, 'd1', 'Abcdefg')", // radiansSQL - "create table radiansTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table radiansTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO radiansTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO radiansTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO radiansTable(Time,device_id,s2) values(3, 'd1', 3)", @@ -215,14 +215,14 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO radiansTable(Time,device_id,s5) values(2, 'd1', 2.5)", "INSERT INTO radiansTable(Time,device_id,s5) values(3, 'd1', 3.5)", // regexpLikeSQL - "create table regexpLikeTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table regexpLikeTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO regexpLikeTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'ab', X'abcd')", "INSERT INTO regexpLikeTable(Time,device_id,s1) values(2, 'd1', 'Test')", "INSERT INTO regexpLikeTable(Time,device_id,s1) values(3, 'd1', 'efgh')", "INSERT INTO regexpLikeTable(Time,device_id,s9) values(2, 'd1', 'Test')", "INSERT INTO regexpLikeTable(Time,device_id,s9) values(3, 'd1', '[e-g]+')", // signSQL - "create table signTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table signTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO signTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO signTable(Time,device_id,s2) values(2, 'd1', 0)", "INSERT INTO signTable(Time,device_id,s2) values(3, 'd1', -1)", @@ -233,7 +233,7 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO signTable(Time,device_id,s5) values(2, 'd1', 0.0)", "INSERT INTO signTable(Time,device_id,s5) values(3, 'd1', -1.0)", // sinSQL - "create table sinTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table sinTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO sinTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO sinTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO sinTable(Time,device_id,s2) values(3, 'd1', 3)", @@ -244,7 +244,7 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO sinTable(Time,device_id,s5) values(2, 'd1', 2.5)", "INSERT INTO sinTable(Time,device_id,s5) values(3, 'd1', 3.5)", // sinhSQL - "create table sinhTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table sinhTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO sinhTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO sinhTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO sinhTable(Time,device_id,s2) values(3, 'd1', 3)", @@ -255,7 +255,7 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO sinhTable(Time,device_id,s5) values(2, 'd1', 2.5)", "INSERT INTO sinhTable(Time,device_id,s5) values(3, 'd1', 3.5)", // sqrtSQL - "create table sqrtTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table sqrtTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO sqrtTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO sqrtTable(Time,device_id,s2) values(2, 'd1', 0)", "INSERT INTO sqrtTable(Time,device_id,s2) values(3, 'd1', -1)", @@ -266,28 +266,28 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO sqrtTable(Time,device_id,s5) values(2, 'd1', 0.0)", "INSERT INTO sqrtTable(Time,device_id,s5) values(3, 'd1', -1.5)", // startsWithSQL - "create table startsWithTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table startsWithTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO startsWithTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'ab', X'abcd')", "INSERT INTO startsWithTable(Time,device_id,s1) values(2, 'd1', 'Test')", "INSERT INTO startsWithTable(Time,device_id,s1) values(3, 'd1', 'efgh')", "INSERT INTO startsWithTable(Time,device_id,s9) values(2, 'd1', 'Test')", "INSERT INTO startsWithTable(Time,device_id,s9) values(3, 'd1', 'efgh')", // strcmpSQL - "create table strcmpTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table strcmpTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO strcmpTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'ab', X'abcd')", "INSERT INTO strcmpTable(Time,device_id,s1) values(2, 'd1', 'Test')", "INSERT INTO strcmpTable(Time,device_id,s1) values(3, 'd1', 'efgh')", "INSERT INTO strcmpTable(Time,device_id,s9) values(2, 'd1', 'Test')", "INSERT INTO strcmpTable(Time,device_id,s9) values(3, 'd1', 'efgh')", // strposSQL - "create table strposTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table strposTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO strposTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'ab', X'abcd')", "INSERT INTO strposTable(Time,device_id,s1) values(2, 'd1', 'Test')", "INSERT INTO strposTable(Time,device_id,s1) values(3, 'd1', 'efgh')", "INSERT INTO strposTable(Time,device_id,s9) values(2, 'd1', 'Test')", "INSERT INTO strposTable(Time,device_id,s9) values(3, 'd1', 'efgh')", // tanSQL - "create table tanTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table tanTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO tanTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO tanTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO tanTable(Time,device_id,s2) values(3, 'd1', 3)", @@ -298,7 +298,7 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO tanTable(Time,device_id,s5) values(2, 'd1', 1.57079632675)", "INSERT INTO tanTable(Time,device_id,s5) values(3, 'd1', 3.5)", // tanhSQL - "create table tanhTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table tanhTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO tanhTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO tanhTable(Time,device_id,s2) values(2, 'd1', 2)", "INSERT INTO tanhTable(Time,device_id,s2) values(3, 'd1', 3)", @@ -309,24 +309,24 @@ public class IoTDBScalarFunctionTableIT { "INSERT INTO tanhTable(Time,device_id,s5) values(2, 'd1', 2.5)", "INSERT INTO tanhTable(Time,device_id,s5) values(3, 'd1', 3.5)", // trimSQL - "create table trimTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table trimTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO trimTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'ab', X'abcd')", "INSERT INTO trimTable(Time,device_id,s1) values(2, 'd1', 'xyTestxy')", "INSERT INTO trimTable(Time,device_id,s1) values(3, 'd1', ' Test ')", "INSERT INTO trimTable(Time,device_id,s9) values(2, 'd1', 'xy')", "INSERT INTO trimTable(Time,device_id,s9) values(3, 'd1', ' T')", // upperSQL - "create table upperTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table upperTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO upperTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO upperTable(Time,device_id,s1) values(2, 'd1', 'Test')", "INSERT INTO upperTable(Time,device_id,s1) values(3, 'd1', 'Abcdefg')", "INSERT INTO upperTable(Time,device_id,s9) values(2, 'd1', 'Test')", "INSERT INTO upperTable(Time,device_id,s9) values(3, 'd1', 'Abcdefg')", // no args SQL - "create table NoArgTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table NoArgTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO NoArgTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', 0, 0, 0, 0, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", // dateBinSQL use s8 to calculate - "create table dateBinTable(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table dateBinTable(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", // 2024-01-01T00:00:00.000Z "INSERT INTO dateBinTable(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'Test', 1, 1, 1, 1, true, '2024-01-01', 1704067200000, 'abcd', X'abcd')", // 2024-01-01T01:00:00.000Z diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBSubStringFunctionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBSubStringFunctionTableIT.java index ad32738c958b..4cd6d3f5167e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBSubStringFunctionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBSubStringFunctionTableIT.java @@ -48,7 +48,7 @@ public class IoTDBSubStringFunctionTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "use " + DATABASE_NAME, - "create table table1(device_id STRING ID, s1 TEXT MEASUREMENT, s2 INT32 MEASUREMENT, s3 INT64 MEASUREMENT, s4 FLOAT MEASUREMENT, s5 DOUBLE MEASUREMENT, s6 BOOLEAN MEASUREMENT, s7 DATE MEASUREMENT, s8 TIMESTAMP MEASUREMENT, s9 STRING MEASUREMENT, s10 BLOB MEASUREMENT)", + "create table table1(device_id STRING TAG, s1 TEXT FIELD, s2 INT32 FIELD, s3 INT64 FIELD, s4 FLOAT FIELD, s5 DOUBLE FIELD, s6 BOOLEAN FIELD, s7 DATE FIELD, s8 TIMESTAMP FIELD, s9 STRING FIELD, s10 BLOB FIELD)", "INSERT INTO table1(Time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'd1', 'abcd', -1, 3, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', X'abcd')", "INSERT INTO table1(Time,device_id,s1) values(2, 'd1', 'test')", "INSERT INTO table1(Time,device_id,s1) values(3, 'd1', 'abcdefg')", 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 84da55ea3c7c..52a5f80193cf 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 @@ -62,8 +62,8 @@ public class IoTDBOrderByTableIT { new String[] { "CREATE DATABASE db", "USE db", - "CREATE TABLE table0 (device string id, attr1 string attribute, num int32 measurement, bigNum int64 measurement, " - + "floatNum double measurement, str TEXT measurement, bool BOOLEAN measurement)", + "CREATE TABLE table0 (device string tag, attr1 string attribute, num int32 field, bigNum int64 field, " + + "floatNum double field, str TEXT field, bool BOOLEAN field)", "insert into table0(device, attr1, time,num,bigNum,floatNum,str,bool) values('d1', 'high', 0,3,2947483648,231.2121,'coconut',FALSE)", "insert into table0(device, time,num,bigNum,floatNum,str,bool) values('d1', 20,2,2147483648,434.12,'pineapple',TRUE)", "insert into table0(device, time,num,bigNum,floatNum,str,bool) values('d1', 40,1,2247483648,12.123,'apricot',TRUE)", @@ -1477,14 +1477,14 @@ protected static void sessionInsertData1() { schemaList.add(new MeasurementSchema("bool", TSDataType.BOOLEAN)); final List columnTypes = Arrays.asList( - Tablet.ColumnCategory.ID, + Tablet.ColumnCategory.TAG, Tablet.ColumnCategory.ATTRIBUTE, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT); - List measurementIds = IMeasurementSchema.getMeasurementNameList(schemaList); + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD); + List fieldIds = IMeasurementSchema.getMeasurementNameList(schemaList); List dataTypes = IMeasurementSchema.getDataTypeList(schemaList); List values = @@ -1504,7 +1504,7 @@ protected static void sessionInsertData1() { new Object[] {"d1", "a1", 14, 2907483648L, 231.34, "cherry", false}, new Object[] {"d1", "a1", 13, 2107483648L, 54.12, "lychee", true}, new Object[] {"d1", "a1", 15, 3147483648L, 235.213, "watermelon", true}); - Tablet tablet = new Tablet("table0", measurementIds, dataTypes, columnTypes, TIMES.size()); + Tablet tablet = new Tablet("table0", fieldIds, dataTypes, columnTypes, TIMES.size()); for (int i = 0; i < TIMES.size(); i++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, TIMES.get(i)); @@ -1532,14 +1532,14 @@ protected static void sessionInsertData2() { schemaList.add(new MeasurementSchema("bool", TSDataType.BOOLEAN)); final List columnTypes = Arrays.asList( - Tablet.ColumnCategory.ID, + Tablet.ColumnCategory.TAG, Tablet.ColumnCategory.ATTRIBUTE, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT, - Tablet.ColumnCategory.MEASUREMENT); - List measurementIds = IMeasurementSchema.getMeasurementNameList(schemaList); + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD); + List fieldIds = IMeasurementSchema.getMeasurementNameList(schemaList); List dataTypes = IMeasurementSchema.getDataTypeList(schemaList); List values = Arrays.asList( @@ -1558,7 +1558,7 @@ protected static void sessionInsertData2() { new Object[] {"d2", "a2", 14, 2907483648L, 231.34, "cherry", false}, new Object[] {"d2", "a2", 13, 2107483648L, 54.12, "lychee", true}, new Object[] {"d2", "a2", 15, 3147483648L, 235.213, "watermelon", true}); - Tablet tablet = new Tablet("table0", measurementIds, dataTypes, columnTypes, TIMES.size()); + Tablet tablet = new Tablet("table0", fieldIds, dataTypes, columnTypes, TIMES.size()); for (int i = 0; i < TIMES.size(); i++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, TIMES.get(i)); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBArithmeticTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBArithmeticTableIT.java index 20708eef3ac3..9ee662a37279 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBArithmeticTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBArithmeticTableIT.java @@ -73,11 +73,11 @@ public class IoTDBArithmeticTableIT { private static final String[] INSERTION_SQLS = { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE table1 (device STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT, s5 DATE MEASUREMENT, s6 TIMESTAMP MEASUREMENT, s7 BOOLEAN MEASUREMENT, s8 TEXT MEASUREMENT)", + "CREATE TABLE 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)", "insert into table1(device, time, s1, s2, s3, s4, s5, s6, s7, s8) values ('d1', 1, 1, 1, 1.0, 1.0, '2024-01-01', 10, true, 'test')", "insert into table1(device, time, s1, s2, s3, s4, s5, s6, s7, s8) values ('d1', 2, 2, 2, 2.0, 2.0, '2024-02-01', 20, true, 'test')", "insert into table1(device, time, s1, s2, s3, s4, s5, s6, s7, s8) values ('d1', 3, 3, 3, 3.0, 3.0, '2024-03-01', 30, true, 'test')", - "CREATE TABLE table2 (device STRING ID, date DATE MEASUREMENT)", + "CREATE TABLE table2 (device STRING TAG, date DATE FIELD)", "insert into table2(device, time, date) values ('d1', 1, '9999-12-31')", "insert into table2(device, time, date) values ('d1', 2, '1000-01-01')", }; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBFuzzyQueryTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBFuzzyQueryTableIT.java index f3b5ef2ecb2b..4a914c1f9850 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBFuzzyQueryTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBFuzzyQueryTableIT.java @@ -60,7 +60,7 @@ private static void initCreateSQLStatement() { sqls.add("CREATE DATABASE TestFuzzyQuery"); sqls.add("USE TestFuzzyQuery"); sqls.add( - "CREATE TABLE likeTest(device_id STRING ID, s1 TEXT MEASUREMENT, s2 STRING MEASUREMENT, s3 STRING MEASUREMENT)"); + "CREATE TABLE likeTest(device_id STRING TAG, s1 TEXT FIELD, s2 STRING FIELD, s3 STRING FIELD)"); sqls.add( "INSERT INTO likeTest(time, device_id, s1, s2, s3) VALUES(1,'d1', 'abcdef', 'a%', '\\')"); sqls.add( diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBInTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBInTableIT.java index b6c2297abd87..c8ffc4c0f47c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBInTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBInTableIT.java @@ -58,7 +58,7 @@ public class IoTDBInTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE sg(device1 STRING ID, device2 STRING ID, qrcode TEXT MEASUREMENT, date_v DATE MEASUREMENT, blob_v BLOB MEASUREMENT, timestamp_v TIMESTAMP MEASUREMENT)", + "CREATE TABLE sg(device1 STRING TAG, device2 STRING TAG, qrcode TEXT FIELD, date_v DATE FIELD, blob_v BLOB FIELD, timestamp_v TIMESTAMP FIELD)", "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465600000,'d1','s1','qrcode001', '2024-08-01', X'abc0',1509465600000)", "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465660000,'d1','s1','qrcode002', '2024-08-02', X'abc1',1509465660000)", "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465720000,'d1','s1','qrcode003', '2024-08-03', X'abc2',1509465720000)", @@ -71,7 +71,7 @@ public class IoTDBInTableIT { "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465840000,'d2','s1','qrcode003', '2024-08-10', X'abc9',1509465840000)", "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465900000,'d2','s1','qrcode004', '2024-08-11', X'abca',1509465900000)", "insert into sg(time,device1,device2,qrcode,date_v,blob_v,timestamp_v) values(1509465960000,'d2','s1','qrcode005', '2024-08-12', X'abcb',1509465960000)", - "CREATE TABLE table1(device STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT, s5 BOOLEAN MEASUREMENT)", + "CREATE TABLE table1(device STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 BOOLEAN FIELD)", }; @BeforeClass 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 2d7ee87f210f..de0dbea13d9b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java @@ -42,7 +42,7 @@ public class IoTDBNoSelectExpressionAfterAnalyzedTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE sg(device STRING ID, s1 INT32 MEASUREMENT)", + "CREATE TABLE sg(device STRING TAG, s1 INT32 FIELD)", "insert into sg(time,device,s1) values(1,'d1',1)", "insert into sg(time,device,s1,s2) values(1,'d1',1,1)" }; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullOperandTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullOperandTableIT.java index 3db69f899c96..eef6773f03f0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullOperandTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullOperandTableIT.java @@ -43,7 +43,7 @@ public class IoTDBNullOperandTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE sg1(device STRING ID, s1 INT32 MEASUREMENT, s2 INT32 MEASUREMENT, s3 BOOLEAN MEASUREMENT, s4 BOOLEAN MEASUREMENT, s5 TEXT MEASUREMENT)", + "CREATE TABLE sg1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 BOOLEAN FIELD, s4 BOOLEAN FIELD, s5 TEXT FIELD)", "INSERT INTO sg1(time,device,s1,s3,s4) values(1, 'd1', 1, true, false)", "INSERT INTO sg1(time,device,s1,s3) values(2, 'd1', 2, true)", "INSERT INTO sg1(time,device,s1,s4) values(3, 'd1', 3, false)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBPaginationTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBPaginationTableIT.java index bef9fe6f8efb..8aece16bd7db 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBPaginationTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBPaginationTableIT.java @@ -46,7 +46,7 @@ public class IoTDBPaginationTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE vehicle(device STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT, s2 FLOAT MEASUREMENT)", + "CREATE TABLE vehicle(device STRING TAG, s0 INT32 FIELD, s1 INT64 FIELD, s2 FLOAT FIELD)", "insert into vehicle(time,device,s0) values(1,'d1',101)", "insert into vehicle(time,device,s0) values(2,'d1',198)", "insert into vehicle(time,device,s0) values(100,'d1',99)", @@ -78,7 +78,7 @@ public class IoTDBPaginationTableIT { "insert into vehicle(time,device,s2) values(105,'d1',11.11)", "insert into vehicle(time,device,s2) values(1000,'d1',1000.11)", "insert into vehicle(time,device,s1) values(2000-01-01T08:00:00+08:00, 'd1',100)", - "CREATE TABLE db(device STRING ID, s1 INT32 MEASUREMENT)", + "CREATE TABLE db(device STRING TAG, s1 INT32 FIELD)", "insert into db(time,device,s1) values(0,'d1', 0)", "insert into db(time,device,s1) values(1,'d1', 1)", "insert into db(time,device,s1) values(2,'d1', 2)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryDemoTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryDemoTableIT.java index e65ad99bb140..8323558b68a9 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryDemoTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryDemoTableIT.java @@ -55,7 +55,7 @@ public class IoTDBQueryDemoTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE wf(device STRING ID, status BOOLEAN MEASUREMENT, temperature FLOAT MEASUREMENT, hardware TEXT MEASUREMENT)", + "CREATE TABLE wf(device STRING TAG, status BOOLEAN FIELD, temperature FLOAT FIELD, hardware TEXT FIELD)", "insert into wf(time,device,status) values(1509465600000,'wt01',true)", "insert into wf(time,device,status) values(1509465660000,'wt01',true)", "insert into wf(time,device,status) values(1509465720000,'wt01',false)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryWithComplexValueFilterTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryWithComplexValueFilterTableIT.java index 578b7e4d87b8..e5f495cdf46c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryWithComplexValueFilterTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBQueryWithComplexValueFilterTableIT.java @@ -46,7 +46,7 @@ public class IoTDBQueryWithComplexValueFilterTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE sg1(device STRING ID, s1 INT32 MEASUREMENT, s2 DOUBLE MEASUREMENT, s3 STRING MEASUREMENT, s4 DATE MEASUREMENT, s5 TIMESTAMP MEASUREMENT)", + "CREATE TABLE sg1(device STRING TAG, s1 INT32 FIELD, s2 DOUBLE FIELD, s3 STRING FIELD, s4 DATE FIELD, s5 TIMESTAMP FIELD)", "insert into sg1(time,device,s1,s2,s3,s4,s5) values(0,'d1',0,0,'0','2024-01-01',0)", "insert into sg1(time,device,s1,s2,s3,s4,s5) values(1,'d1',1,1,'1','2024-01-02',1)", "insert into sg1(time,device,s1,s2) values(2,'d1',2,2)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBResultSetTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBResultSetTableIT.java index ddd9417f1df7..31a8cb21aa21 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBResultSetTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBResultSetTableIT.java @@ -56,8 +56,8 @@ public class IoTDBResultSetTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE t1(device STRING ID, status BOOLEAN MEASUREMENT, temperature FLOAT MEASUREMENT, type INT32 MEASUREMENT, grade INT64 MEASUREMENT)", - "CREATE TABLE sg(device STRING ID, status FLOAT MEASUREMENT)", + "CREATE TABLE t1(device STRING TAG, status BOOLEAN FIELD, temperature FLOAT FIELD, type INT32 FIELD, grade INT64 FIELD)", + "CREATE TABLE sg(device STRING TAG, status FLOAT FIELD)", }; private static final String[] emptyResultSet = new String[] {}; @@ -161,7 +161,7 @@ public void timeWasNullTest() throws Exception { Statement statement = connection.createStatement()) { statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE TABLE test(device STRING ID, s1 INT64 MEASUREMENT, s2 INT64 MEASUREMENT, s3 INT64 MEASUREMENT)"); + "CREATE TABLE test(device STRING TAG, s1 INT64 FIELD, s2 INT64 FIELD, s3 INT64 FIELD)"); for (int i = 0; i < 10; i++) { statement.addBatch( diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectCompareExpressionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectCompareExpressionTableIT.java index 75b1f4044154..c8f464b6469f 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectCompareExpressionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectCompareExpressionTableIT.java @@ -122,7 +122,7 @@ private static void createTimeSeries() { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE TABLE t1(device STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT, s5 BOOLEAN MEASUREMENT, s6 TEXT MEASUREMENT)"); + "CREATE TABLE t1(device STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 BOOLEAN FIELD, s6 TEXT FIELD)"); } catch (SQLException throwable) { fail(throwable.getMessage()); } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBFillTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBFillTableIT.java index 573ff5764d50..3884b1f2be13 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBFillTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBFillTableIT.java @@ -43,7 +43,7 @@ public class IoTDBFillTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE table1(device_id STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT, s5 BOOLEAN MEASUREMENT, s6 TEXT MEASUREMENT, s7 STRING MEASUREMENT, s8 BLOB MEASUREMENT, s9 TIMESTAMP MEASUREMENT, s10 DATE MEASUREMENT)", + "CREATE TABLE table1(device_id STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 BOOLEAN FIELD, s6 TEXT FIELD, s7 STRING FIELD, s8 BLOB FIELD, s9 TIMESTAMP FIELD, s10 DATE FIELD)", "INSERT INTO table1(time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) " + " values(1, 'd1', 1, 11, 1.1, 11.1, true, 'text1', 'string1', X'cafebabe01', 1, '2024-10-01')", "INSERT INTO table1(time,device_id,s1,s2,s3,s4,s5) " @@ -59,7 +59,7 @@ public class IoTDBFillTableIT { + " values(7, 'd1', 7, 77, 7.7, 77.7, true)", "INSERT INTO table1(time,device_id,s6,s7,s8,s9,s10) " + " values(8, 'd1', 'text8', 'string8', X'cafebabe08', 8, '2024-10-08')", - "CREATE TABLE table2(city STRING ID, device_id STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT)", + "CREATE TABLE table2(city STRING TAG, device_id STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD)", "INSERT INTO table2(time,city,device_id,s2) values(1, 'shanghai', 'd1', 02111)", "INSERT INTO table2(time,city,device_id,s1) values(2, 'shanghai', 'd1', 0212)", "INSERT INTO table2(time,city,device_id,s2) values(1, 'beijing', 'd1', 01011)", @@ -70,7 +70,7 @@ public class IoTDBFillTableIT { "INSERT INTO table2(time,city,device_id,s2) values(2, 'beijing', 'd2', 01022)", "INSERT INTO table2(time,city,device_id,s2) values(3, 'beijing', 'd2', 01033)", "INSERT INTO table2(time,city,device_id,s2) values(4, 'beijing', 'd2', 01044)", - "CREATE TABLE table3(city STRING ID, device_id STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT)", + "CREATE TABLE table3(city STRING TAG, device_id STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD)", "INSERT INTO table3(time,city,device_id,s2) values(1, 'shanghai', 'd1', 02111)", "INSERT INTO table3(time,city,device_id,s1) values(2, 'shanghai', 'd1', 0212)", "INSERT INTO table3(time,city,device_id,s2) values(1, 'beijing', 'd1', 01011)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBGapFillTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBGapFillTableIT.java index 13629f79793c..3c8a6f3af802 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBGapFillTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBGapFillTableIT.java @@ -43,7 +43,7 @@ public class IoTDBGapFillTableIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE table1(city STRING ID, device_id STRING ID, s1 DOUBLE MEASUREMENT, s2 INT64 MEASUREMENT)", + "CREATE TABLE table1(city STRING TAG, device_id STRING TAG, s1 DOUBLE FIELD, s2 INT64 FIELD)", "INSERT INTO table1(time,city,device_id,s2) values(2024-09-24T06:15:46.565+00:00, 'shanghai', 'd1', 2)", "INSERT INTO table1(time,city,device_id,s1) values(2024-09-24T07:16:15.297+00:00, 'shanghai', 'd1', 27.2)", "INSERT INTO table1(time,city,device_id,s1) values(2024-09-24T08:16:21.907+00:00, 'shanghai', 'd1', 27.3)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBNullIdQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBNullIdQueryIT.java index 31d99d6130e8..6f067df19dff 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBNullIdQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBNullIdQueryIT.java @@ -53,9 +53,9 @@ public class IoTDBNullIdQueryIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE testNullId(id1 STRING ID, id2 STRING ID, s1 INT32 MEASUREMENT, s2 BOOLEAN MEASUREMENT, s3 DOUBLE MEASUREMENT)", + "CREATE TABLE testNullId(id1 STRING TAG, id2 STRING TAG, s1 INT32 FIELD, s2 BOOLEAN FIELD, s3 DOUBLE FIELD)", "INSERT INTO testNullId(time,id1,id2,s1,s2,s3) " + "values(1, null, null, 0, false, 11.1)", - "CREATE TABLE table1(device_id STRING ID, color STRING ATTRIBUTE, s1 INT32 MEASUREMENT, s2 BOOLEAN MEASUREMENT, s3 INT64 MEASUREMENT)", + "CREATE TABLE table1(device_id STRING TAG, color STRING ATTRIBUTE, s1 INT32 FIELD, s2 BOOLEAN FIELD, s3 INT64 FIELD)", // in seq disk "INSERT INTO table1(time,device_id,color,s1,s2,s3) " + "values(1, 'd1', 'green', 1, false, 11)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java index 55385c156700..d5cc0796319f 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java @@ -33,7 +33,7 @@ import static org.apache.iotdb.db.it.utils.TestUtils.prepareTableData; import static org.apache.iotdb.db.it.utils.TestUtils.tableAssertTestFail; import static org.apache.iotdb.db.it.utils.TestUtils.tableResultSetEqualTest; -import static org.apache.iotdb.relational.it.db.it.IoTDBMultiIDsWithAttributesTableIT.buildHeaders; +import static org.apache.iotdb.relational.it.db.it.IoTDBMultiTAGsWithAttributesTableIT.buildHeaders; @RunWith(IoTDBTestRunner.class) @Category({TableLocalStandaloneIT.class, TableClusterIT.class}) @@ -43,7 +43,7 @@ public class IoTDBTableAggregationIT { new String[] { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE table1(province STRING ID, city STRING ID, region STRING ID, device_id STRING ID, color STRING ATTRIBUTE, type STRING ATTRIBUTE, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT, s5 BOOLEAN MEASUREMENT, s6 TEXT MEASUREMENT, s7 STRING MEASUREMENT, s8 BLOB MEASUREMENT, s9 TIMESTAMP MEASUREMENT, s10 DATE MEASUREMENT)", + "CREATE TABLE table1(province STRING TAG, city STRING TAG, region STRING TAG, device_id STRING TAG, color STRING ATTRIBUTE, type STRING ATTRIBUTE, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 BOOLEAN FIELD, s6 TEXT FIELD, s7 STRING FIELD, s8 BLOB FIELD, s9 TIMESTAMP FIELD, s10 DATE FIELD)", "INSERT INTO table1(time,province,city,region,device_id,color,type,s1,s3,s6,s8,s9) values (2024-09-24T06:15:30.000+00:00,'shanghai','shanghai','huangpu','d01','red','A',30,30.0,'shanghai_huangpu_red_A_d01_30', X'cafebabe30',2024-09-24T06:15:30.000+00:00)", "INSERT INTO table1(time,province,city,region,device_id,color,type,s2,s3,s4,s6,s7,s9,s10) values (2024-09-24T06:15:35.000+00:00,'shanghai','shanghai','huangpu','d01','red','A',35000,35.0,35.0,'shanghai_huangpu_red_A_d01_35','shanghai_huangpu_red_A_d01_35',2024-09-24T06:15:35.000+00:00,'2024-09-24')", "INSERT INTO table1(time,province,city,region,device_id,color,type,s1,s3,s5,s7,s9) values (2024-09-24T06:15:40.000+00:00,'shanghai','shanghai','huangpu','d01','red','A',40,40.0,true,'shanghai_huangpu_red_A_d01_40',2024-09-24T06:15:40.000+00:00)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/subquery/SubqueryDataSetUtils.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/subquery/SubqueryDataSetUtils.java index 1bd779aac65d..466b0535b52f 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/subquery/SubqueryDataSetUtils.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/subquery/SubqueryDataSetUtils.java @@ -27,7 +27,7 @@ public class SubqueryDataSetUtils { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, // table1 - "CREATE TABLE table1(province STRING ID, city STRING ID, region STRING ID, device_id STRING ID, color STRING ATTRIBUTE, type STRING ATTRIBUTE, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT, s5 BOOLEAN MEASUREMENT, s6 TEXT MEASUREMENT, s7 STRING MEASUREMENT, s8 BLOB MEASUREMENT, s9 TIMESTAMP MEASUREMENT, s10 DATE MEASUREMENT)", + "CREATE TABLE table1(province STRING TAG, city STRING TAG, region STRING TAG, device_id STRING TAG, color STRING ATTRIBUTE, type STRING ATTRIBUTE, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 BOOLEAN FIELD, s6 TEXT FIELD, s7 STRING FIELD, s8 BLOB FIELD, s9 TIMESTAMP FIELD, s10 DATE FIELD)", "INSERT INTO table1(time,province,city,region,device_id,color,type,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values (2024-09-24T06:13:30.000+00:00,'shanghai','shanghai','huangpu','d01','red','A',30,30,30.0,30.0,true,'shanghai_huangpu_red_A_d01_30','shanghai_huangpu_red_A_d01_30',X'cafebabe30',2024-09-24T06:13:00.000+00:00,'2024-09-23')", "INSERT INTO table1(time,province,city,region,device_id,color,type,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values (2024-09-24T06:14:30.000+00:00,'shanghai','shanghai','huangpu','d01','red','A',40,40,40.0,40.0,false,'shanghai_huangpu_red_A_d01_40','shanghai_huangpu_red_A_d01_40',X'cafebabe40',2024-09-24T06:14:00.000+00:00,'2024-09-24')", "INSERT INTO table1(time,province,city,region,device_id,color,type,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values (2024-09-24T06:15:30.000+00:00,'shanghai','shanghai','huangpu','d01','red','A',50,50,50.0,50.0,true,'shanghai_huangpu_red_A_d01_50','shanghai_huangpu_red_A_d01_50',X'cafebabe50',2024-09-24T06:15:00.000+00:00,'2024-09-25')", @@ -93,7 +93,7 @@ public class SubqueryDataSetUtils { "INSERT INTO table1(time,province,city,region,device_id,color,type,s2,s9) values (2024-09-24T06:15:40.000+00:00,'beijing','beijing','haidian','d16','yellow','BBBBBBBBBBBBBBBB',40000,2024-09-24T06:15:40.000+00:00)", "INSERT INTO table1(time,province,city,region,device_id,color,type,s1,s4,s6,s8,s9) values (2024-09-24T06:15:55.000+00:00,'beijing','beijing','haidian','d16','yellow','BBBBBBBBBBBBBBBB',55,55.0,'beijing_haidian_yellow_B_d16_55',X'cafebabe55',2024-09-24T06:15:55.000+00:00)", // table2 - "CREATE TABLE table2(device_id STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT, s5 BOOLEAN MEASUREMENT, s6 TEXT MEASUREMENT, s7 STRING MEASUREMENT, s8 BLOB MEASUREMENT, s9 TIMESTAMP MEASUREMENT, s10 DATE MEASUREMENT)", + "CREATE TABLE table2(device_id STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 BOOLEAN FIELD, s6 TEXT FIELD, s7 STRING FIELD, s8 BLOB FIELD, s9 TIMESTAMP FIELD, s10 DATE FIELD)", "INSERT INTO table2(time,device_id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) " + " values(1, 'd1', 1, 11, 1.1, 11.1, true, 'text1', 'string1', X'cafebabe01', 1, '2024-10-01')", "INSERT INTO table2(time,device_id,s1,s2,s3,s4,s5) " diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceCaseWhenThenIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceCaseWhenThenIT.java index 4e48015e24ef..ccc56c588cd5 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceCaseWhenThenIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceCaseWhenThenIT.java @@ -84,9 +84,9 @@ public void tearDown() throws Exception { new String[] { // normal cases "CREATE DATABASE " + 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)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceFlushQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceFlushQueryIT.java index 0b37fe335009..316473d86407 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceFlushQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceFlushQueryIT.java @@ -84,20 +84,20 @@ public void tearDown() throws Exception { private static final String[] sqls = new String[] { "CREATE DATABASE test", - "CREATE TABLE vehicle (id1 string id, s0 int32 measurement)", - "insert into vehicle(id1,time,s0) values('d0',1,101)", - "insert into vehicle(id1,time,s0) values('d0',2,198)", - "insert into vehicle(id1,time,s0) values('d0',100,99)", - "insert into vehicle(id1,time,s0) values('d0',101,99)", - "insert into vehicle(id1,time,s0) values('d0',102,80)", - "insert into vehicle(id1,time,s0) values('d0',103,99)", - "insert into vehicle(id1,time,s0) values('d0',104,90)", - "insert into vehicle(id1,time,s0) values('d0',105,99)", - "insert into vehicle(id1,time,s0) values('d0',106,99)", + "CREATE TABLE vehicle (tag1 string tag, s0 int32 field)", + "insert into vehicle(tag1,time,s0) values('d0',1,101)", + "insert into vehicle(tag1,time,s0) values('d0',2,198)", + "insert into vehicle(tag1,time,s0) values('d0',100,99)", + "insert into vehicle(tag1,time,s0) values('d0',101,99)", + "insert into vehicle(tag1,time,s0) values('d0',102,80)", + "insert into vehicle(tag1,time,s0) values('d0',103,99)", + "insert into vehicle(tag1,time,s0) values('d0',104,90)", + "insert into vehicle(tag1,time,s0) values('d0',105,99)", + "insert into vehicle(tag1,time,s0) values('d0',106,99)", "flush", - "insert into vehicle(id1,time,s0) values('d0',2,10000)", - "insert into vehicle(id1,time,s0) values('d0',50,10000)", - "insert into vehicle(id1,time,s0) values('d0',1000,22222)", + "insert into vehicle(tag1,time,s0) values('d0',2,10000)", + "insert into vehicle(tag1,time,s0) values('d0',50,10000)", + "insert into vehicle(tag1,time,s0) values('d0',1000,22222)", }; public void ping() { @@ -177,13 +177,13 @@ public void testFlushGivenGroup() { } String insertTemplate = - "INSERT INTO vehicle(id1, time, s1, s2, s3) VALUES (%s, %d, %d, %f, %s)"; + "INSERT INTO vehicle(tag1, time, s1, s2, s3) VALUES (%s, %d, %d, %f, %s)"; for (int i = 1; i <= 3; i++) { nonQuery(sqlHandler("", String.format("USE \"group%d\"", i))); nonQuery( sqlHandler( String.format("group%d", i), - "CREATE TABLE vehicle (id1 string id, s1 int32 measurement, s2 float measurement, s3 string measurement)")); + "CREATE TABLE vehicle (tag1 string tag, s1 int32 field, s2 float field, s3 string field)")); for (int j = 10; j < 20; j++) { nonQuery(String.format(Locale.CHINA, insertTemplate, i, j, j, j * 0.1, j)); @@ -196,7 +196,7 @@ public void testFlushGivenGroup() { nonQuery( sqlHandler( String.format("group%d", i), - "CREATE TABLE vehicle (id1 string id, s1 int32 measurement, s2 float measurement, s3 string measurement)")); + "CREATE TABLE vehicle (tag1 string tag, s1 int32 field, s2 float field, s3 string field)")); } nonQuery(sqlHandler("", "FLUSH group1")); nonQuery(sqlHandler("", "FLUSH group2,group3")); @@ -206,7 +206,7 @@ public void testFlushGivenGroup() { nonQuery( sqlHandler( String.format("group%d", i), - "CREATE TABLE vehicle (id1 string id, s1 int32 measurement, s2 float measurement, s3 string measurement)")); + "CREATE TABLE vehicle (tag1 string tag, s1 int32 field, s2 float field, s3 string field)")); for (int j = 0; j < 30; j++) { nonQuery(String.format(Locale.CHINA, insertTemplate, i, j, j, j * 0.1, j)); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceIT.java index 8d3a3b546848..1a1ebb578d97 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceIT.java @@ -21,9 +21,9 @@ import org.apache.iotdb.it.env.EnvFactory; import org.apache.iotdb.it.env.cluster.node.DataNodeWrapper; import org.apache.iotdb.it.framework.IoTDBTestRunner; -import org.apache.iotdb.itbase.category.ClusterIT; -import org.apache.iotdb.itbase.category.LocalStandaloneIT; import org.apache.iotdb.itbase.category.RemoteIT; +import org.apache.iotdb.itbase.category.TableClusterIT; +import org.apache.iotdb.itbase.category.TableLocalStandaloneIT; import org.apache.iotdb.itbase.env.BaseEnv; import com.google.gson.JsonArray; @@ -50,7 +50,7 @@ import static org.junit.Assert.fail; @RunWith(IoTDBTestRunner.class) -@Category({LocalStandaloneIT.class, ClusterIT.class, RemoteIT.class}) +@Category({TableLocalStandaloneIT.class, TableClusterIT.class, RemoteIT.class}) public class IoTDBRestServiceIT { private int port = 18080; @@ -85,8 +85,8 @@ public void tearDown() throws Exception { new String[] { "create database if not exists test", "use test", - "CREATE TABLE sg10(id1 string id, s1 int64 measurement, s2 float measurement, s3 string measurement)", - "CREATE TABLE sg11(id1 string id, s1 int64 measurement, s2 float measurement, s3 string measurement)" + "CREATE TABLE sg10(tag1 string tag, s1 int64 field, s2 float field, s3 string field)", + "CREATE TABLE sg11(tag1 string tag, s1 int64 field, s2 float field, s3 string field)" }; public void ping() { @@ -151,14 +151,14 @@ public void test() { } public void testQuery() { - String sql = "insert into sg11(id1,s1,s2,s3,time) values('aa',11,1.1,1,1),('aa2',21,2.1,2,2)"; + String sql = "insert into sg11(tag1,s1,s2,s3,time) values('aa',11,1.1,1,1),('aa2',21,2.1,2,2)"; JsonObject result = RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); assertEquals(200, result.get("code").getAsInt()); JsonObject queryResult = RestUtils.query( httpClient, port, - sqlHandler("test", "select id1,s1,s2,s3,time from sg11 order by time")); + sqlHandler("test", "select tag1,s1,s2,s3,time from sg11 order by time")); JsonArray jsonArray = queryResult.get("values").getAsJsonArray(); for (int i = 0; i < jsonArray.size(); i++) { JsonArray jsonArray1 = jsonArray.get(i).getAsJsonArray(); @@ -181,7 +181,9 @@ public void testQuery() { public void testQuery1() { JsonObject result = RestUtils.query( - httpClient, port, sqlHandler(null, "select id1,s1,s2,s3,time from sg11 order by time")); + httpClient, + port, + sqlHandler(null, "select tag1,s1,s2,s3,time from sg11 order by time")); assertEquals(305, result.get("code").getAsInt()); assertEquals("database should not be null", result.get("message").getAsString()); } @@ -199,13 +201,13 @@ public void rightNonQuery() { } public void rightNonQuery2() { - String sql = "insert into sg10(id1,s1,time,s2) values('aa',1,1,1.1)"; + String sql = "insert into sg10(tag1,s1,time,s2) values('aa',1,1,1.1)"; JsonObject result = RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); assertEquals(200, result.get("code").getAsInt()); } public void rightNonQuery4() { - String sql = "insert into sg10(id1,s1,time,s2) values('aa',1,1,1.1),('bb',2,2,2.1)"; + String sql = "insert into sg10(tag1,s1,time,s2) values('aa',1,1,1.1),('bb',2,2,2.1)"; JsonObject result = RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); assertEquals(200, result.get("code").getAsInt()); } @@ -225,7 +227,7 @@ public void errorNonQuery() { public void errorNonQuery1() { String sql = - "CREATE TABLE sg10(id1 string id, s1 int64 measurement, s2 float measurement, s3 string measurement)"; + "CREATE TABLE sg10(tag1 string tag, s1 int64 field, s2 float field, s3 string field)"; JsonObject result = RestUtils.nonQuery(httpClient, port, sqlHandler(null, sql)); assertEquals(305, result.get("code").getAsInt()); assertEquals("database should not be null", result.get("message").getAsString()); @@ -255,11 +257,11 @@ public String sqlHandler(String database, String sql) { public void testInsertMultiPartition() { List sqls = Arrays.asList( - "create table sg1 (id1 string id, s1 int32 measurement)", - "insert into sg1(id1,time,s1) values('d1',1,2)", + "create table sg1 (tag1 string tag, s1 int32 field)", + "insert into sg1(tag1,time,s1) values('d1',1,2)", "flush", - "insert into sg1(id1,time,s1) values('d1',2,2)", - "insert into sg1(id1,time,s1) values('d1',604800001,2)", + "insert into sg1(tag1,time,s1) values('d1',2,2)", + "insert into sg1(tag1,time,s1) values('d1',604800001,2)", "flush"); for (String sql : sqls) { RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); @@ -269,24 +271,24 @@ public void testInsertMultiPartition() { public void testInsertTablet() { List sqls = Collections.singletonList( - "create table sg211 (id1 string id,t1 STRING ATTRIBUTE, s1 FLOAT measurement)"); + "create table sg211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); for (String sql : sqls) { RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); } String json = - "{\"database\":\"test\",\"column_types\":[\"ID\",\"ATTRIBUTE\",\"MEASUREMENT\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"id1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; + "{\"database\":\"test\",\"column_types\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"tag1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; rightInsertTablet(json); } public void testInsertTabletNoDatabase() { List sqls = Collections.singletonList( - "create table sg211 (id1 string id,t1 STRING ATTRIBUTE, s1 FLOAT measurement)"); + "create table sg211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); for (String sql : sqls) { RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); } String json = - "{\"database\":\"\",\"column_types\":[\"ID\",\"ATTRIBUTE\",\"MEASUREMENT\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"id1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; + "{\"database\":\"\",\"column_types\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"tag1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; JsonObject result = RestUtils.insertTablet(httpClient, port, json); assertEquals(305, Integer.parseInt(result.get("code").toString())); } @@ -294,12 +296,12 @@ public void testInsertTabletNoDatabase() { public void testInsertTablet1() { List sqls = Collections.singletonList( - "create table sg211 (id1 string id,t1 STRING ATTRIBUTE, s1 FLOAT measurement)"); + "create table sg211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); for (String sql : sqls) { RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); } String json = - "{\"database\":\"test\",\"column_types\":[\"ATTRIBUTE\",\"MEASUREMENT\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"id1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; + "{\"database\":\"test\",\"column_types\":[\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232173960,1635232183960],\"column_names\":[\"id1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; JsonObject result = RestUtils.insertTablet(httpClient, port, json); assertEquals(305, Integer.parseInt(result.get("code").toString())); assertEquals( @@ -310,12 +312,12 @@ public void testInsertTablet1() { public void testInsertTablet2() { List sqls = Collections.singletonList( - "create table sg211 (id1 string id,t1 STRING ATTRIBUTE, s1 FLOAT measurement)"); + "create table sg211 (tag1 string tag,t1 STRING ATTRIBUTE, s1 FLOAT field)"); for (String sql : sqls) { RestUtils.nonQuery(httpClient, port, sqlHandler("test", sql)); } String json = - "{\"database\":\"test\",\"column_types\":[\"ID\",\"ATTRIBUTE\",\"MEASUREMENT\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232183960],\"column_names\":[\"id1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; + "{\"database\":\"test\",\"column_types\":[\"TAG\",\"ATTRIBUTE\",\"FIELD\"],\"timestamps\":[1635232143960,1635232153960,1635232163960,1635232183960],\"column_names\":[\"tag1\",\"t1\",\"s1\"],\"data_types\":[\"STRING\",\"STRING\",\"FLOAT\"],\"values\":[[\"a11\",\"true\",11],[\"a11\",\"false\",22],[\"a13\",\"false1\",23],[\"a14\",\"false2\",24],[\"a15\",\"false3\",25]],\"table\":\"sg211\"}"; JsonObject result = RestUtils.insertTablet(httpClient, port, json); assertEquals(305, Integer.parseInt(result.get("code").toString())); assertEquals( @@ -327,7 +329,7 @@ public void rightInsertTablet(String json) { assertEquals(200, Integer.parseInt(result.get("code").toString())); JsonObject queryResult = RestUtils.query( - httpClient, port, sqlHandler("test", "select id1,t1,s1 from sg211 order by time")); + httpClient, port, sqlHandler("test", "select tag1,t1,s1 from sg211 order by time")); JsonArray jsonArray = queryResult.get("values").getAsJsonArray(); JsonArray jsonArray1 = jsonArray.get(0).getAsJsonArray(); assertEquals("a11", jsonArray1.get(0).getAsString()); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceInsertAlignedValuesIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceInsertAlignedValuesIT.java index a3b8ca7a8805..5434d7d32bd4 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceInsertAlignedValuesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/rest/it/IoTDBRestServiceInsertAlignedValuesIT.java @@ -148,10 +148,10 @@ public String sqlHandler(String database, String sql) { public void testInsertAlignedValues() { List sqls = Arrays.asList( - "create table wf01 (id1 string id, status boolean measurement, temperature float measurement)", - "insert into wf01(id1, time, status, temperature) values ('wt01', 4000, true, 17.1)", - "insert into wf01(id1, time, status, temperature) values ('wt01', 5000, true, 20.1)", - "insert into wf01(id1, time, status, temperature) values ('wt01', 6000, true, 22)"); + "create table wf01 (tag1 string tag, status boolean field, temperature float field)", + "insert into wf01(tag1, time, status, temperature) values ('wt01', 4000, true, 17.1)", + "insert into wf01(tag1, time, status, temperature) values ('wt01', 5000, true, 20.1)", + "insert into wf01(tag1, time, status, temperature) values ('wt01', 6000, true, 22)"); for (String sql : sqls) { nonQuery(sqlHandler("t1", sql)); } @@ -185,11 +185,11 @@ public void testInsertAlignedValues() { public void testUpdatingAlignedValues() { List sqls = Arrays.asList( - "create table wf03 (id1 string id, status boolean measurement, temperature float measurement)", - "insert into wf03(id1, time, status, temperature) values ('wt01', 4000, true, 17.1)", - "insert into wf03(id1, time, status) values ('wt01', 5000, true)", - "insert into wf03(id1, time, temperature)values ('wt01', 5000, 20.1)", - "insert into wf03(id1, time, temperature)values ('wt01', 6000, 22)"); + "create table wf03 (tag1 string tag, status boolean field, temperature float field)", + "insert into wf03(tag1, time, status, temperature) values ('wt01', 4000, true, 17.1)", + "insert into wf03(tag1, time, status) values ('wt01', 5000, true)", + "insert into wf03(tag1, time, temperature)values ('wt01', 5000, 20.1)", + "insert into wf03(tag1, time, temperature)values ('wt01', 6000, 22)"); for (String sql : sqls) { nonQuery(sqlHandler("t1", sql)); } @@ -227,9 +227,9 @@ public void testUpdatingAlignedValues() { public void testInsertAlignedValuesWithSameTimestamp() { List sqls = Arrays.asList( - "create table sg3 (id1 string id, s2 double measurement, s1 double measurement)", - "insert into sg3(id1,time,s2) values('d1',1,2)", - "insert into sg3(id1,time,s1) values('d1',1,2)"); + "create table sg3 (tag1 string tag, s2 double field, s1 double field)", + "insert into sg3(tag1,time,s2) values('d1',1,2)", + "insert into sg3(tag1,time,s1) values('d1',1,2)"); for (String sql : sqls) { nonQuery(sqlHandler("t1", sql)); } @@ -249,13 +249,12 @@ public void testInsertAlignedValuesWithSameTimestamp() { public void testInsertWithWrongMeasurementNum1() { nonQuery( sqlHandler( - "t1", - "create table wf04 (id1 string id, status int32, temperature int32 measurement)")); + "t1", "create table wf04 (tag1 string tag, status int32, temperature int32 field)")); JsonObject jsonObject = nonQuery( sqlHandler( "t1", - "insert into wf04(id1, time, status, temperature) values('wt01', 11000, 100)")); + "insert into wf04(tag1, time, status, temperature) values('wt01', 11000, 100)")); assertEquals( "701: Inconsistent numbers of non-time column names and values: 3-2", jsonObject.get("code") + ": " + jsonObject.get("message").getAsString()); @@ -264,13 +263,12 @@ public void testInsertWithWrongMeasurementNum1() { public void testInsertWithWrongMeasurementNum2() { nonQuery( sqlHandler( - "t1", - "create table wf04 (id1 string id, status int32, temperature int32 measurement)")); + "t1", "create table wf04 (tag1 string tag, status int32, temperature int32 field)")); JsonObject jsonObject = nonQuery( sqlHandler( "t1", - "insert into wf05(id1, time, status, temperature) values('wt01', 11000, 100, 300, 400)")); + "insert into wf05(tag1, time, status, temperature) values('wt01', 11000, 100, 300, 400)")); assertEquals( "701: Inconsistent numbers of non-time column names and values: 3-4", jsonObject.get("code") + ": " + jsonObject.get("message").getAsString()); @@ -278,12 +276,12 @@ public void testInsertWithWrongMeasurementNum2() { public void testInsertWithDuplicatedMeasurements() { nonQuery( - sqlHandler("t1", "create table wf07(id1 string id, s3 boolean measurement, status int32)")); + sqlHandler("t1", "create table wf07(tag1 string tag, s3 boolean field, status int32)")); JsonObject jsonObject = nonQuery( sqlHandler( "t1", - "insert into wf07(id1, time, s3, status, status) values('wt01', 100, true, 20.1, 20.2)")); + "insert into wf07(tag1, time, s3, status, status) values('wt01', 100, true, 20.1, 20.2)")); assertEquals( "701: Insertion contains duplicated measurement: status", jsonObject.get("code") + ": " + jsonObject.get("message").getAsString()); @@ -291,13 +289,12 @@ public void testInsertWithDuplicatedMeasurements() { public void testInsertMultiRows() { nonQuery( - sqlHandler( - "t1", "create table sg8 (id1 string id, s1 int32 measurement, s2 int32 measurement)")); + sqlHandler("t1", "create table sg8 (tag1 string tag, s1 int32 field, s2 int32 field)")); JsonObject jsonObject = nonQuery( sqlHandler( "t1", - "insert into sg8(id1, time, s1, s2) values('d1', 10, 2, 2), ('d1', 11, 3, '3'), ('d1', 12,12.11,false)")); + "insert into sg8(tag1, time, s1, s2) values('d1', 10, 2, 2), ('d1', 11, 3, '3'), ('d1', 12,12.11,false)")); assertEquals( "507: Fail to insert measurements [s1, s2] caused by [data type is not consistent, input 12.11, registered INT32, data type is not consistent, input false, registered INT32]", jsonObject.get("code") + ": " + jsonObject.get("message").getAsString()); @@ -305,16 +302,14 @@ public void testInsertMultiRows() { public void testInsertLargeNumber() { nonQuery( - sqlHandler( - "t1", - "create table sg9 (id1 string id, s98 int64 measurement, s99 int64 measurement)")); + sqlHandler("t1", "create table sg9 (tag1 string tag, s98 int64 field, s99 int64 field)")); JsonObject jsonObject = nonQuery( sqlHandler( "t1", - "insert into sg9(id1, time, s98, s99) values('d1', 10, 2, 271840880000000000000000)")); + "insert into sg9(tag1, time, s98, s99) values('d1', 10, 2, 271840880000000000000000)")); assertEquals( - "700: line 1:58: Invalid numeric literal: 271840880000000000000000", + "700: line 1:59: Invalid numeric literal: 271840880000000000000000", jsonObject.get("code") + ": " + jsonObject.get("message").getAsString()); } @@ -322,15 +317,15 @@ public void testExtendTextColumn() { List sqls = Arrays.asList( "use t1", - "create table sg14 (id1 string id, s1 string measurement, s2 string measurement)", - "insert into sg14(id1,time,s1,s2) values('d1',1,'test','test')", - "insert into sg14(id1,time,s1,s2) values('d1',3,'test','test')", - "insert into sg14(id1,time,s1,s2) values('d1',3,'test','test')", - "insert into sg14(id1,time,s1,s2) values('d1',4,'test','test')", - "insert into sg14(id1,time,s1,s3) values('d1',5,'test','test')", - "insert into sg14(id1,time,s1,s2) values('d1',6,'test','test')", + "create table sg14 (tag1 string tag, s1 string field, s2 string field)", + "insert into sg14(tag1,time,s1,s2) values('d1',1,'test','test')", + "insert into sg14(tag1,time,s1,s2) values('d1',3,'test','test')", + "insert into sg14(tag1,time,s1,s2) values('d1',3,'test','test')", + "insert into sg14(tag1,time,s1,s2) values('d1',4,'test','test')", + "insert into sg14(tag1,time,s1,s3) values('d1',5,'test','test')", + "insert into sg14(tag1,time,s1,s2) values('d1',6,'test','test')", "flush", - "insert into sg14(id1,time,s1,s3) values('d1',7,'test','test')"); + "insert into sg14(tag1,time,s1,s3) values('d1',7,'test','test')"); try { for (String sql : sqls) { JsonObject jsonObject = new JsonObject(); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java index 6db3ab356f8c..4b3738a07d16 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java @@ -295,7 +295,7 @@ public void testDatabaseWithSpecificCharacters() throws SQLException { statement.execute("use \"````x\""); - statement.execute("create table table0 (a id, b attribute, c int32)"); + statement.execute("create table table0 (a tag, b attribute, c int32)"); statement.execute("desc table0"); statement.execute("desc \"````x\".table0"); @@ -369,7 +369,7 @@ public void testInformationSchema() throws SQLException { "ColumnName,DataType,Category,", new HashSet<>( Arrays.asList( - "database,STRING,ID,", + "database,STRING,TAG,", "ttl(ms),STRING,ATTRIBUTE,", "schema_replication_factor,INT32,ATTRIBUTE,", "data_replication_factor,INT32,ATTRIBUTE,", @@ -381,8 +381,8 @@ public void testInformationSchema() throws SQLException { "ColumnName,DataType,Category,", new HashSet<>( Arrays.asList( - "database,STRING,ID,", - "table_name,STRING,ID,", + "database,STRING,TAG,", + "table_name,STRING,TAG,", "ttl(ms),STRING,ATTRIBUTE,", "status,STRING,ATTRIBUTE,"))); TestUtils.assertResultSetEqual( @@ -390,9 +390,9 @@ public void testInformationSchema() throws SQLException { "ColumnName,DataType,Category,", new HashSet<>( Arrays.asList( - "database,STRING,ID,", - "table_name,STRING,ID,", - "column_name,STRING,ID,", + "database,STRING,TAG,", + "table_name,STRING,TAG,", + "column_name,STRING,TAG,", "datatype,STRING,ATTRIBUTE,", "category,STRING,ATTRIBUTE,", "status,STRING,ATTRIBUTE,"))); @@ -401,7 +401,7 @@ public void testInformationSchema() throws SQLException { "ColumnName,DataType,Category,", new HashSet<>( Arrays.asList( - "query_id,STRING,ID,", + "query_id,STRING,TAG,", "start_time,TIMESTAMP,ATTRIBUTE,", "datanode_id,INT32,ATTRIBUTE,", "elapsed_time,FLOAT,ATTRIBUTE,", @@ -442,7 +442,7 @@ public void testMixedDatabase() throws SQLException { // Test adjustMaxRegionGroupNum statement.execute("use test"); statement.execute( - "create table table2(region_id STRING ID, plant_id STRING ID, color STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, speed DOUBLE MEASUREMENT)"); + "create table table2(region_id STRING TAG, plant_id STRING TAG, color STRING ATTRIBUTE, temperature FLOAT FIELD, speed DOUBLE FIELD)"); statement.execute( "insert into table2(region_id, plant_id, color, temperature, speed) values(1, 1, 1, 1, 1)"); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDeviceIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDeviceIT.java index e1687ff6b269..a7c6f5f3dd94 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDeviceIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDeviceIT.java @@ -63,9 +63,9 @@ public void testDevice() throws SQLException { statement.execute("create database test"); statement.execute("use test"); statement.execute( - "create table table1(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT)"); + "create table table1(region_id STRING TAG, plant_id STRING TAG, device_id STRING TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD)"); statement.execute( - "create table table0(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT)"); + "create table table0(region_id STRING TAG, plant_id STRING TAG, device_id STRING TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD)"); statement.execute( "insert into table0(region_id, plant_id, device_id, model, temperature, humidity) values('1', '木兰', '3', 'A', 37.6, 111.1)"); @@ -168,7 +168,7 @@ public void testDevice() throws SQLException { fail("Show devices shall fail for measurement predicate"); } catch (final Exception e) { assertEquals( - "701: The TIME/MEASUREMENT columns are currently not allowed in devices related operations", + "701: The TIME/FIELD columns are currently not allowed in devices related operations", e.getMessage()); } @@ -198,7 +198,7 @@ public void testDevice() throws SQLException { try { statement.execute("update table0 set device_id = '1'"); - fail("Update shall fail for id"); + fail("Update shall fail for tag"); } catch (final Exception e) { assertEquals("701: Update can only specify attribute columns.", e.getMessage()); } @@ -255,7 +255,7 @@ public void testDevice() throws SQLException { statement.execute("delete devices from table0 where region_id = '1' and plant_id = '木兰'"); TestUtils.assertResultSetSize(statement.executeQuery("show devices from table0"), 1); - // Test successfully invalidate cache + // Test successfully Invalidate cache statement.execute( "insert into table0(region_id, plant_id, device_id, model, temperature, humidity) values('1', '木兰', '3', 'A', 37.6, 111.1)"); TestUtils.assertResultSetSize(statement.executeQuery("show devices from table0"), 2); @@ -266,10 +266,10 @@ public void testDevice() throws SQLException { try { statement.executeQuery("delete devices from table0 where time = 1"); - fail("Delete devices shall fail when specifies non id column"); + fail("Delete devices shall fail when specifies non tag column"); } catch (final Exception e) { assertEquals( - "701: The TIME/MEASUREMENT columns are currently not allowed in devices related operations", + "701: The TIME/FIELD columns are currently not allowed in devices related operations", e.getMessage()); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java index 2294f156509c..2def42f0dcc6 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java @@ -72,7 +72,7 @@ public void testManageTable() { // should specify database before create table try { statement.execute( - "create table table1(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT)"); + "create table table1(region_id STRING TAG, plant_id STRING TAG, device_id STRING TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD)"); fail(); } catch (final SQLException e) { assertEquals("701: database is not specified", e.getMessage()); @@ -91,14 +91,14 @@ public void testManageTable() { // or use full qualified table name // test "TTL=INF" - // "MEASUREMENT" can be omitted when type is specified - // "STRING" can be omitted when id/attribute is specified + // "FIELD" can be omitted when type is specified + // "STRING" can be omitted when tag/attribute is specified statement.execute( - "create table test1.table1(region_id STRING ID, plant_id STRING ID, device_id ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE) with (TTL='INF')"); + "create table test1.table1(region_id STRING TAG, plant_id STRING TAG, device_id TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE) with (TTL='INF')"); try { statement.execute( - "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)"); + "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)"); fail(); } catch (final SQLException e) { assertEquals("551: Table 'test1.table1' already exists.", e.getMessage()); @@ -188,11 +188,11 @@ public void testManageTable() { // Create if not exist statement.execute( - "create table if not exists test1.table1(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT)"); + "create table if not exists test1.table1(region_id STRING TAG, plant_id STRING TAG, device_id STRING TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD)"); try { statement.execute( - "create table table2(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT) with (UNKNOWN=3600000)"); + "create table table2(region_id STRING TAG, plant_id STRING TAG, device_id STRING TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD) with (UNKNOWN=3600000)"); fail(); } catch (final SQLException e) { assertEquals("701: Table property 'unknown' is currently not allowed.", e.getMessage()); @@ -200,7 +200,7 @@ public void testManageTable() { try { statement.execute( - "create table table2(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT) with (TTL=null)"); + "create table table2(region_id STRING TAG, plant_id STRING TAG, device_id STRING TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD) with (TTL=null)"); fail(); } catch (final SQLException e) { assertEquals( @@ -210,7 +210,7 @@ public void testManageTable() { try { statement.execute( - "create table table2(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT) with (TTL=-1)"); + "create table table2(region_id STRING TAG, plant_id STRING TAG, device_id STRING TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD) with (TTL=-1)"); fail(); } catch (final SQLException e) { assertEquals( @@ -219,25 +219,25 @@ public void testManageTable() { try { statement.execute( - "create table table2(region_id TEXT ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT) with (TTL=3600000)"); + "create table table2(region_id TEXT TAG, plant_id STRING TAG, device_id STRING TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD) with (TTL=3600000)"); fail(); } catch (final SQLException e) { assertEquals( - "701: DataType of ID Column should only be STRING, current is TEXT", e.getMessage()); + "701: DataType of TAG Column should only be STRING, current is TEXT", e.getMessage()); } try { statement.execute( - "create table table2(region_id INT32 ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT) with (TTL=3600000)"); + "create table table2(region_id INT32 TAG, plant_id STRING TAG, device_id STRING TAG, model STRING ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD) with (TTL=3600000)"); fail(); } catch (final SQLException e) { assertEquals( - "701: DataType of ID Column should only be STRING, current is INT32", e.getMessage()); + "701: DataType of TAG Column should only be STRING, current is INT32", e.getMessage()); } try { statement.execute( - "create table table2(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model TEXT ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT) with (TTL=3600000)"); + "create table table2(region_id STRING TAG, plant_id STRING TAG, device_id STRING TAG, model TEXT ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD) with (TTL=3600000)"); fail(); } catch (final SQLException e) { assertEquals( @@ -247,7 +247,7 @@ public void testManageTable() { try { statement.execute( - "create table table2(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model DOUBLE ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT) with (TTL=3600000)"); + "create table table2(region_id STRING TAG, plant_id STRING TAG, device_id STRING TAG, model DOUBLE ATTRIBUTE, temperature FLOAT FIELD, humidity DOUBLE FIELD) with (TTL=3600000)"); fail(); } catch (final SQLException e) { assertEquals( @@ -256,25 +256,25 @@ public void testManageTable() { } statement.execute( - "create table table2(region_id STRING ID, plant_id STRING ID, color STRING ATTRIBUTE, temperature FLOAT MEASUREMENT) with (TTL=6600000)"); + "create table table2(region_id STRING TAG, plant_id STRING TAG, color STRING ATTRIBUTE, temperature FLOAT FIELD) with (TTL=6600000)"); - statement.execute("alter table table2 add column speed DOUBLE MEASUREMENT"); + statement.execute("alter table table2 add column speed DOUBLE FIELD"); try { - statement.execute("alter table table2 add column speed DOUBLE MEASUREMENT"); + statement.execute("alter table table2 add column speed DOUBLE FIELD"); } catch (final SQLException e) { assertEquals("552: Column 'speed' already exist", e.getMessage()); } - statement.execute("alter table table2 add column if not exists speed DOUBLE MEASUREMENT"); + statement.execute("alter table table2 add column if not exists speed DOUBLE FIELD"); try { - statement.execute("alter table table3 add column speed DOUBLE MEASUREMENT"); + statement.execute("alter table table3 add column speed DOUBLE FIELD"); } catch (final SQLException e) { assertEquals("550: Table 'test2.table3' does not exist", e.getMessage()); } - statement.execute("alter table if exists table3 add column speed DOUBLE MEASUREMENT"); + statement.execute("alter table if exists table3 add column speed DOUBLE FIELD"); // Test create table with only time column statement.execute("create table table3()"); @@ -347,7 +347,7 @@ public void testManageTable() { String[] dataTypes = new String[] {"TIMESTAMP", "STRING", "STRING", "STRING", "STRING", "FLOAT", "DOUBLE"}; String[] categories = - new String[] {"TIME", "ID", "ID", "ID", "ATTRIBUTE", "MEASUREMENT", "MEASUREMENT"}; + new String[] {"TIME", "TAG", "TAG", "TAG", "ATTRIBUTE", "FIELD", "FIELD"}; try (final ResultSet resultSet = statement.executeQuery("describe test1.table1")) { int cnt = 0; @@ -368,7 +368,7 @@ public void testManageTable() { columnNames = new String[] {"time", "region_id", "plant_id", "color", "temperature", "speed"}; dataTypes = new String[] {"TIMESTAMP", "STRING", "STRING", "STRING", "FLOAT", "DOUBLE"}; - categories = new String[] {"TIME", "ID", "ID", "ATTRIBUTE", "MEASUREMENT", "MEASUREMENT"}; + categories = new String[] {"TIME", "TAG", "TAG", "ATTRIBUTE", "FIELD", "FIELD"}; try (final ResultSet resultSet = statement.executeQuery("desc table2")) { int cnt = 0; @@ -397,7 +397,7 @@ public void testManageTable() { columnNames = new String[] {"time", "region_id", "plant_id", "temperature", "speed"}; dataTypes = new String[] {"TIMESTAMP", "STRING", "STRING", "FLOAT", "DOUBLE"}; - categories = new String[] {"TIME", "ID", "ID", "MEASUREMENT", "MEASUREMENT"}; + categories = new String[] {"TIME", "TAG", "TAG", "FIELD", "FIELD"}; final String[] statuses = new String[] {"USING", "USING", "USING", "USING", "USING"}; try (final ResultSet resultSet = statement.executeQuery("describe table2 details")) { int cnt = 0; @@ -443,7 +443,7 @@ public void testManageTable() { try { statement.execute("alter table table2 drop column time"); } catch (final SQLException e) { - assertEquals("701: Dropping id or time column is not supported.", e.getMessage()); + assertEquals("701: Dropping tag or time column is not supported.", e.getMessage()); } // test data deletion by drop column @@ -462,7 +462,7 @@ public void testManageTable() { assertEquals("550: Table 'test2.table2' does not exist.", e.getMessage()); } statement.execute( - "create table table2(region_id STRING ID, plant_id STRING ID, color STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, speed DOUBLE MEASUREMENT)"); + "create table table2(region_id STRING TAG, plant_id STRING TAG, color STRING ATTRIBUTE, temperature FLOAT FIELD, speed DOUBLE FIELD)"); TestUtils.assertResultSetEqual( statement.executeQuery("count devices from table2"), "count(devices),", @@ -540,7 +540,7 @@ public void testManageTable() { statement.execute("create table test101 (time timestamp time)"); try { - statement.execute("create table test102 (time timestamp id)"); + statement.execute("create table test102 (time timestamp tag)"); fail(); } catch (final SQLException e) { assertEquals( @@ -549,7 +549,7 @@ public void testManageTable() { } try { - statement.execute("create table test102 (time id)"); + statement.execute("create table test102 (time tag)"); fail(); } catch (final SQLException e) { assertEquals("701: The time column's type shall be 'timestamp'.", e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBSessionRelationalIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBSessionRelationalIT.java index a57028dddbf6..50ae3f55b6e6 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBSessionRelationalIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBSessionRelationalIT.java @@ -97,9 +97,9 @@ public static void main(String[] args) session.executeNonQueryStatement("CREATE DATABASE \"db2\""); session.executeNonQueryStatement("USE \"db1\""); session.executeNonQueryStatement( - "CREATE TABLE table10 (id1 string id, attr1 string attribute, " + "CREATE TABLE table10 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); } // insert without db try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { @@ -111,15 +111,15 @@ public static void main(String[] args) () -> session.executeNonQueryStatement( String.format( - "INSERT INTO table10 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - 0, "id:" + 0, "attr:" + 0, 0 * 1.0))); + "INSERT INTO table10 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + 0, "tag:" + 0, "attr:" + 0, 0 * 1.0))); // specify db in sql for (long row = 0; row < 15; row++) { session.executeNonQueryStatement( String.format( - "INSERT INTO db1.table10 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - row, "id:" + row, "attr:" + row, row * 1.0)); + "INSERT INTO db1.table10 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + row, "tag:" + row, "attr:" + row, row * 1.0)); } session.executeNonQueryStatement("FLush"); @@ -127,8 +127,8 @@ public static void main(String[] args) for (long row = 15; row < 30; row++) { session.executeNonQueryStatement( String.format( - "INSERT INTO db1.table10 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - row, "id:" + row, "attr:" + row, row * 1.0)); + "INSERT INTO db1.table10 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + row, "tag:" + row, "attr:" + row, row * 1.0)); } SessionDataSet dataSet = @@ -137,7 +137,7 @@ public static void main(String[] args) while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); cnt++; @@ -151,16 +151,16 @@ private static void insertRelationalTabletPerformanceTest() try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"db1\""); session.executeNonQueryStatement( - "CREATE TABLE table1 (id1 string id, attr1 string attribute, " + "CREATE TABLE table1 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.ATTRIBUTE, ColumnCategory.MEASUREMENT); + Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = @@ -174,7 +174,7 @@ private static void insertRelationalTabletPerformanceTest() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -193,7 +193,7 @@ private static void insertRelationalTabletPerformanceTest() for (long row = 15; row < 30; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -211,7 +211,7 @@ private static void insertRelationalTabletPerformanceTest() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); } @@ -225,17 +225,17 @@ public void insertRelationalSqlTest() try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"db1\""); session.executeNonQueryStatement( - "CREATE TABLE table1 (id1 string id, attr1 string attribute, " + "CREATE TABLE table1 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); long timestamp; for (long row = 0; row < 15; row++) { session.executeNonQueryStatement( String.format( - "INSERT INTO table1 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - row, "id:" + row, "attr:" + row, row * 1.0)); + "INSERT INTO table1 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + row, "tag:" + row, "attr:" + row, row * 1.0)); } session.executeNonQueryStatement("FLush"); @@ -243,8 +243,8 @@ public void insertRelationalSqlTest() for (long row = 15; row < 30; row++) { session.executeNonQueryStatement( String.format( - "INSERT INTO table1 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - row, "id:" + row, "attr:" + row, row * 1.0)); + "INSERT INTO table1 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + row, "tag:" + row, "attr:" + row, row * 1.0)); } // without specifying column name @@ -252,7 +252,7 @@ public void insertRelationalSqlTest() session.executeNonQueryStatement( String.format( "INSERT INTO table1 VALUES (%d, '%s', '%s', %f)", - row, "id:" + row, "attr:" + row, row * 1.0)); + row, "tag:" + row, "attr:" + row, row * 1.0)); } // auto data type conversion @@ -260,7 +260,7 @@ public void insertRelationalSqlTest() session.executeNonQueryStatement( String.format( "INSERT INTO table1 VALUES (%d, '%s', '%s', %d)", - row, "id:" + row, "attr:" + row, row)); + row, "tag:" + row, "attr:" + row, row)); } SessionDataSet dataSet = session.executeQueryStatement("select * from table1 order by time"); @@ -268,7 +268,7 @@ public void insertRelationalSqlTest() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); cnt++; @@ -281,8 +281,8 @@ public void insertRelationalSqlTest() () -> session.executeNonQueryStatement( String.format( - "INSERT INTO table1 (id1, id2, attr1, m1) VALUES ('%s', '%s', '%s', %f)", - "id:" + 100, "id:" + 100, "attr:" + 100, 100 * 1.0))); + "INSERT INTO table1 (tag1, tag2, attr1, m1) VALUES ('%s', '%s', '%s', %f)", + "tag:" + 100, "tag:" + 100, "attr:" + 100, 100 * 1.0))); // fewer columns than defined assertThrows( @@ -299,9 +299,9 @@ public void insertRelationalSqlTest() session.executeNonQueryStatement( String.format( "INSERT INTO table1 VALUES ('%s', '%s', '%s', '%s', %f)", - "id:" + 100, "id:" + 100, "id:" + 100, "attr:" + 100, 100 * 1.0))); + "tag:" + 100, "tag:" + 100, "tag:" + 100, "attr:" + 100, 100 * 1.0))); - // invalid conversion - id column + // Invalid conversion - tag column assertThrows( StatementExecutionException.class, () -> @@ -310,23 +310,23 @@ public void insertRelationalSqlTest() "INSERT INTO table1 VALUES ('%d', '%s', '%s', %f)", 100, 100, "attr:" + 100, 100 * 1.0))); - // invalid conversion - attr column + // Invalid conversion - attr column assertThrows( StatementExecutionException.class, () -> session.executeNonQueryStatement( String.format( "INSERT INTO table1 VALUES ('%d', '%s', '%s', %f)", - 100, "id:" + 100, 100, 100 * 1.0))); + 100, "tag:" + 100, 100, 100 * 1.0))); - // invalid conversion - measurement column + // Invalid conversion - field column assertThrows( StatementExecutionException.class, () -> session.executeNonQueryStatement( String.format( "INSERT INTO table1 VALUES ('%d', '%s', '%s', %s)", - 100, "id:" + 100, "attr:" + 100, "measurement" + (100 * 1.0)))); + 100, "tag:" + 100, "attr:" + 100, "field" + (100 * 1.0)))); } } @@ -341,12 +341,12 @@ public void partialInsertSQLTest() throws IoTDBConnectionException, StatementExe session.executeNonQueryStatement("USE \"db1\""); // the table is missing column "m2" session.executeNonQueryStatement( - "CREATE TABLE table2_2 (id1 string id, attr1 string attribute, " + "CREATE TABLE table2_2 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); try { session.executeNonQueryStatement( - "INSERT INTO table2_2 (time, id1, attr1, m1, m2) values (1, '1', '1', 1.0, 2.0)"); + "INSERT INTO table2_2 (time, tag1, attr1, m1, m2) values (1, '1', '1', 1.0, 2.0)"); fail("Exception expected"); } catch (StatementExecutionException e) { assertEquals( @@ -373,22 +373,22 @@ public void partialInsertRelationalTabletTest() session.executeNonQueryStatement("USE \"db1\""); // the table is missing column "m2" session.executeNonQueryStatement( - "CREATE TABLE table4 (id1 string id, attr1 string attribute, " + "CREATE TABLE table4 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); // the insertion contains "m2" List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("m2", TSDataType.DOUBLE)); final List columnTypes = Arrays.asList( - ColumnCategory.ID, + ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT); + ColumnCategory.FIELD, + ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = @@ -402,7 +402,7 @@ public void partialInsertRelationalTabletTest() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); tablet.addValue("m2", rowIndex, row * 1.0); @@ -437,7 +437,7 @@ public void partialInsertRelationalTabletTest() for (long row = 15; row < 30; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); tablet.addValue("m2", rowIndex, row * 1.0); @@ -473,7 +473,7 @@ public void partialInsertRelationalTabletTest() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); // "m2" should not be present @@ -486,7 +486,7 @@ public void partialInsertRelationalTabletTest() session.executeNonQueryStatement("SET CONFIGURATION enable_partial_insert='false'"); int rowIndex = 0; tablet.addTimestamp(rowIndex, timestamp + rowIndex); - tablet.addValue("id1", rowIndex, "id:" + rowIndex); + tablet.addValue("tag1", rowIndex, "tag:" + rowIndex); tablet.addValue("attr1", rowIndex, "attr:" + rowIndex); tablet.addValue("m1", rowIndex, rowIndex * 1.0); tablet.addValue("m2", rowIndex, rowIndex * 1.0); @@ -513,16 +513,16 @@ public void insertRelationalTabletTest() try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"db1\""); session.executeNonQueryStatement( - "CREATE TABLE table5 (id1 string id, attr1 string attribute, " + "CREATE TABLE table5 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.ATTRIBUTE, ColumnCategory.MEASUREMENT); + Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = @@ -536,7 +536,7 @@ public void insertRelationalTabletTest() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -555,7 +555,7 @@ public void insertRelationalTabletTest() for (long row = 15; row < 30; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -574,7 +574,7 @@ public void insertRelationalTabletTest() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); cnt++; @@ -590,16 +590,16 @@ public void insertRelationalTabletWithCacheLeaderTest() try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"db1\""); session.executeNonQueryStatement( - "CREATE TABLE table5 (id1 string id, attr1 string attribute, " + "CREATE TABLE table5 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.ATTRIBUTE, ColumnCategory.MEASUREMENT); + Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = @@ -613,7 +613,7 @@ public void insertRelationalTabletWithCacheLeaderTest() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -633,7 +633,7 @@ public void insertRelationalTabletWithCacheLeaderTest() int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); // cache leader should work for devices that have inserted before - tablet.addValue("id1", rowIndex, "id:" + (row - 15)); + tablet.addValue("tag1", rowIndex, "tag:" + (row - 15)); tablet.addValue("attr1", rowIndex, "attr:" + (row - 15)); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -653,7 +653,7 @@ public void insertRelationalTabletWithCacheLeaderTest() RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); assertEquals( - "id:" + (timestamp < 15 ? timestamp : timestamp - 15), + "tag:" + (timestamp < 15 ? timestamp : timestamp - 15), rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals( "attr:" + (timestamp < 15 ? timestamp : timestamp - 15), @@ -667,19 +667,19 @@ public void insertRelationalTabletWithCacheLeaderTest() @Test @Category({LocalStandaloneIT.class, ClusterIT.class}) - public void autoCreateNonIdColumnTest() + public void autoCreateNontagColumnTest() throws IoTDBConnectionException, StatementExecutionException { try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"db1\""); // only one column in this table, and others should be auto-created - session.executeNonQueryStatement("CREATE TABLE table7 (id1 string id)"); + session.executeNonQueryStatement("CREATE TABLE table7 (tag1 string tag)"); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.ATTRIBUTE, ColumnCategory.MEASUREMENT); + Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = @@ -693,7 +693,7 @@ public void autoCreateNonIdColumnTest() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -712,7 +712,7 @@ public void autoCreateNonIdColumnTest() for (long row = 15; row < 30; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -731,7 +731,7 @@ public void autoCreateNonIdColumnTest() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); cnt++; @@ -748,11 +748,11 @@ public void autoCreateTableTest() throws IoTDBConnectionException, StatementExec // no table created here List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.ATTRIBUTE, ColumnCategory.MEASUREMENT); + Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = @@ -766,7 +766,7 @@ public void autoCreateTableTest() throws IoTDBConnectionException, StatementExec for (int row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); } @@ -778,7 +778,7 @@ public void autoCreateTableTest() throws IoTDBConnectionException, StatementExec for (int row = 15; row < 30; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id1", rowIndex, "id:" + row); + tablet.addValue("tag1", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); } @@ -790,7 +790,7 @@ public void autoCreateTableTest() throws IoTDBConnectionException, StatementExec while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); cnt++; @@ -801,19 +801,19 @@ public void autoCreateTableTest() throws IoTDBConnectionException, StatementExec @Test @Category({LocalStandaloneIT.class, ClusterIT.class}) - public void autoCreateIdColumnTest() + public void autoCreatetagColumnTest() throws IoTDBConnectionException, StatementExecutionException { try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"db1\""); // only one column in this table, and others should be auto-created - session.executeNonQueryStatement("CREATE TABLE table8 (id1 string id)"); + session.executeNonQueryStatement("CREATE TABLE table8 (tag1 string tag)"); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id2", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag2", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.ATTRIBUTE, ColumnCategory.MEASUREMENT); + Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = @@ -827,7 +827,7 @@ public void autoCreateIdColumnTest() for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id2", rowIndex, "id:" + row); + tablet.addValue("tag2", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -846,7 +846,7 @@ public void autoCreateIdColumnTest() for (long row = 15; row < 30; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id2", rowIndex, "id:" + row); + tablet.addValue("tag2", rowIndex, "tag:" + row); tablet.addValue("attr1", rowIndex, "attr:" + row); tablet.addValue("m1", rowIndex, row * 1.0); if (tablet.getRowSize() == tablet.getMaxRowNumber()) { @@ -865,9 +865,9 @@ public void autoCreateIdColumnTest() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - // id 1 should be null + // tag 1 should be null assertNull(rowRecord.getFields().get(1).getDataType()); - assertEquals("id:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(3).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(4).getDoubleV(), 0.0001); cnt++; @@ -878,38 +878,38 @@ public void autoCreateIdColumnTest() @Test @Category({LocalStandaloneIT.class, ClusterIT.class}) - public void autoAdjustIdTest() throws IoTDBConnectionException, StatementExecutionException { + public void autoAdjusttagTest() throws IoTDBConnectionException, StatementExecutionException { try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"db1\""); - // the id order in the table is (id1, id2) + // the tag order in the table is (tag1, tag2) session.executeNonQueryStatement( - "CREATE TABLE table9 (id1 string id, id2 string id, attr1 string attribute, " + "CREATE TABLE table9 (tag1 string tag, tag2 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); - // the id order in the row is (id2, id1) + // the tag order in the row is (tag2, tag1) List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id2", TSDataType.STRING)); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag2", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = Arrays.asList( - ColumnCategory.ID, - ColumnCategory.ID, + ColumnCategory.TAG, + ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, - ColumnCategory.MEASUREMENT); - List measurementIds = IMeasurementSchema.getMeasurementNameList(schemaList); + ColumnCategory.FIELD); + List fieldtags = IMeasurementSchema.getMeasurementNameList(schemaList); List dataTypes = IMeasurementSchema.getDataTypeList(schemaList); long timestamp = 0; - Tablet tablet = new Tablet("table9", measurementIds, dataTypes, columnTypes, 15); + Tablet tablet = new Tablet("table9", fieldtags, dataTypes, columnTypes, 15); for (long row = 0; row < 15; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id2", rowIndex, "id2:" + row); - tablet.addValue("id1", rowIndex, "id1:" + row); + tablet.addValue("tag2", rowIndex, "tag2:" + row); + tablet.addValue("tag1", rowIndex, "tag1:" + row); tablet.addValue("attr1", rowIndex, "attr1:" + row); tablet.addValue("m1", rowIndex, row * 1.0); } @@ -921,8 +921,8 @@ public void autoAdjustIdTest() throws IoTDBConnectionException, StatementExecuti for (long row = 15; row < 30; row++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, timestamp + row); - tablet.addValue("id2", rowIndex, "id2:" + row); - tablet.addValue("id1", rowIndex, "id1:" + row); + tablet.addValue("tag2", rowIndex, "tag2:" + row); + tablet.addValue("tag1", rowIndex, "tag1:" + row); tablet.addValue("attr1", rowIndex, "attr1:" + row); tablet.addValue("m1", rowIndex, row * 1.0); } @@ -934,8 +934,8 @@ public void autoAdjustIdTest() throws IoTDBConnectionException, StatementExecuti while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id1:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); - assertEquals("id2:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); + assertEquals("tag1:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag2:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals("attr1:" + timestamp, rowRecord.getFields().get(3).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(4).getDoubleV(), 0.0001); cnt++; @@ -951,9 +951,9 @@ public void insertRelationalSqlWithoutDBTest() try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"db1\""); session.executeNonQueryStatement( - "CREATE TABLE table10 (id1 string id, attr1 string attribute, " + "CREATE TABLE table10 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); } // insert without db try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { @@ -963,8 +963,8 @@ public void insertRelationalSqlWithoutDBTest() try { session.executeNonQueryStatement( String.format( - "INSERT INTO table10 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - 0, "id:" + 0, "attr:" + 0, 0 * 1.0)); + "INSERT INTO table10 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + 0, "tag:" + 0, "attr:" + 0, 0 * 1.0)); fail("Exception expected"); } catch (StatementExecutionException e) { assertEquals("701: database is not specified", e.getMessage()); @@ -974,8 +974,8 @@ public void insertRelationalSqlWithoutDBTest() for (long row = 0; row < 15; row++) { session.executeNonQueryStatement( String.format( - "INSERT INTO db1.table10 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - row, "id:" + row, "attr:" + row, row * 1.0)); + "INSERT INTO db1.table10 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + row, "tag:" + row, "attr:" + row, row * 1.0)); } session.executeNonQueryStatement("FLush"); @@ -983,8 +983,8 @@ public void insertRelationalSqlWithoutDBTest() for (long row = 15; row < 30; row++) { session.executeNonQueryStatement( String.format( - "INSERT INTO db1.table10 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - row, "id:" + row, "attr:" + row, row * 1.0)); + "INSERT INTO db1.table10 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + row, "tag:" + row, "attr:" + row, row * 1.0)); } SessionDataSet dataSet = @@ -993,7 +993,7 @@ public void insertRelationalSqlWithoutDBTest() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); cnt++; @@ -1009,9 +1009,9 @@ public void insertRelationalSqlAnotherDBTest() try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"db1\""); session.executeNonQueryStatement( - "CREATE TABLE table11 (id1 string id, attr1 string attribute, " + "CREATE TABLE table11 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)"); + + "field)"); } // use db2 but insert db1 try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { @@ -1022,8 +1022,8 @@ public void insertRelationalSqlAnotherDBTest() for (long row = 0; row < 15; row++) { session.executeNonQueryStatement( String.format( - "INSERT INTO db1.table11 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - row, "id:" + row, "attr:" + row, row * 1.0)); + "INSERT INTO db1.table11 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + row, "tag:" + row, "attr:" + row, row * 1.0)); } session.executeNonQueryStatement("FLush"); @@ -1032,8 +1032,8 @@ public void insertRelationalSqlAnotherDBTest() // check case sensitivity session.executeNonQueryStatement( String.format( - "INSERT INTO DB1.TaBle11 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - row, "id:" + row, "attr:" + row, row * 1.0)); + "INSERT INTO DB1.TaBle11 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + row, "tag:" + row, "attr:" + row, row * 1.0)); } SessionDataSet dataSet = @@ -1042,7 +1042,7 @@ public void insertRelationalSqlAnotherDBTest() while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); timestamp = rowRecord.getFields().get(0).getLongV(); - assertEquals("id:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); + assertEquals("tag:" + timestamp, rowRecord.getFields().get(1).getBinaryV().toString()); assertEquals("attr:" + timestamp, rowRecord.getFields().get(2).getBinaryV().toString()); assertEquals(timestamp * 1.0, rowRecord.getFields().get(3).getDoubleV(), 0.0001); cnt++; @@ -1061,8 +1061,8 @@ public void insertNonExistTableTest() try { session.executeNonQueryStatement( String.format( - "INSERT INTO table13 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - 0, "id:" + 0, "attr:" + 0, 0 * 1.0)); + "INSERT INTO table13 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + 0, "tag:" + 0, "attr:" + 0, 0 * 1.0)); fail("Exception expected"); } catch (StatementExecutionException e) { assertEquals("507: Table table13 does not exist", e.getMessage()); @@ -1071,8 +1071,8 @@ public void insertNonExistTableTest() try { session.executeNonQueryStatement( String.format( - "INSERT INTO db2.table13 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - 0, "id:" + 0, "attr:" + 0, 0 * 1.0)); + "INSERT INTO db2.table13 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + 0, "tag:" + 0, "attr:" + 0, 0 * 1.0)); fail("Exception expected"); } catch (StatementExecutionException e) { assertEquals("507: Table table13 does not exist", e.getMessage()); @@ -1089,8 +1089,8 @@ public void insertNonExistDBTest() throws IoTDBConnectionException, StatementExe try { session.executeNonQueryStatement( String.format( - "INSERT INTO db3.table13 (time, id1, attr1, m1) VALUES (%d, '%s', '%s', %f)", - 0, "id:" + 0, "attr:" + 0, 0 * 1.0)); + "INSERT INTO db3.table13 (time, tag1, attr1, m1) VALUES (%d, '%s', '%s', %f)", + 0, "tag:" + 0, "attr:" + 0, 0 * 1.0)); fail("Exception expected"); } catch (StatementExecutionException e) { assertEquals("507: Table table13 does not exist", e.getMessage()); @@ -1104,7 +1104,7 @@ public void insertWithoutMeasurementTest() throws IoTDBConnectionException, StatementExecutionException { try (ITableSession session = EnvFactory.getEnv().getTableSessionConnection()) { session.executeNonQueryStatement("USE \"db1\""); - session.executeNonQueryStatement("create table tb (a string id, b string measurement)"); + session.executeNonQueryStatement("create table tb (a string tag, b string field)"); session.executeNonQueryStatement("insert into tb(a) values ('w')"); SessionDataSet dataSet = session.executeQueryStatement("select * from tb"); int cnt = 0; @@ -1139,10 +1139,10 @@ private void testOneCastWithTablet( session.executeNonQueryStatement( "CREATE TABLE table" + testNum - + " (id1 string id," + + " (tag1 string tag," + "m1 " + to.toString() - + " measurement)"); + + " field)"); if (partialInsert) { session.executeNonQueryStatement("SET CONFIGURATION enable_partial_insert='true'"); } else { @@ -1151,10 +1151,10 @@ private void testOneCastWithTablet( // insert a tablet with type of "from" List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("m1", from)); final List columnTypes = - Arrays.asList(ColumnCategory.ID, ColumnCategory.MEASUREMENT); + Arrays.asList(ColumnCategory.TAG, ColumnCategory.FIELD); Tablet tablet = new Tablet( "table" + testNum, @@ -1167,12 +1167,12 @@ private void testOneCastWithTablet( tablet.addTimestamp(1, 1); tablet.addValue(0, 0, "d1"); tablet.addValue(1, 0, "d1"); - // the measurement in the first row is null + // the field in the first row is null tablet.addValue("m1", 1, genValue(from, 1)); if (to.isCompatible(from)) { // can cast, insert and check the result session.insert(tablet); - // time, id1, m1 + // time, tag1, m1 SessionDataSet dataSet = session.executeQueryStatement("select * from table" + testNum + " order by time"); RowRecord rec = dataSet.next(); @@ -1205,7 +1205,7 @@ private void testOneCastWithTablet( + "]", e.getMessage()); } - // time, id1, m1 + // time, tag1, m1 SessionDataSet dataSet = session.executeQueryStatement("select * from table" + testNum + " order by time"); RowRecord rec = dataSet.next(); @@ -1242,10 +1242,10 @@ private void testOneCastWithRow( session.executeNonQueryStatement( "CREATE TABLE table" + testNum - + " (id1 string id," + + " (tag1 string tag," + "m1 " + to.toString() - + " measurement)"); + + " field)"); if (partialInsert) { session.executeNonQueryStatement("SET CONFIGURATION enable_partial_insert='true'"); } else { @@ -1257,12 +1257,12 @@ private void testOneCastWithRow( String.format( "INSERT INTO table" + testNum - + " (time, id1, m1) VALUES (0, 'd1', null),(1,'d1', %s)", + + " (time, tag1, m1) VALUES (0, 'd1', null),(1,'d1', %s)", genValue(from, 1)); if (to.isCompatible(from)) { // can cast, insert and check the result session.executeNonQueryStatement(sql); - // time, id1, m1 + // time, tag1, m1 SessionDataSet dataSet = session.executeQueryStatement("select * from table" + testNum + " order by time"); RowRecord rec = dataSet.next(); @@ -1295,7 +1295,7 @@ private void testOneCastWithRow( + "]", e.getMessage()); } - // time, id1, m1 + // time, tag1, m1 SessionDataSet dataSet = session.executeQueryStatement("select * from table" + testNum + " order by time"); RowRecord rec = dataSet.next(); @@ -1383,16 +1383,16 @@ public void deleteTableAndWriteDifferentTypeTest() session.executeNonQueryStatement("USE db1"); session.executeNonQueryStatement( - "CREATE TABLE table" + testNum + " (id1 string id, m1 int32 measurement)"); + "CREATE TABLE table" + testNum + " (tag1 string tag, m1 int32 field)"); session.executeNonQueryStatement( - "INSERT INTO table" + testNum + " (time, id1, m1) VALUES (1, 'd1', 1)"); + "INSERT INTO table" + testNum + " (time, tag1, m1) VALUES (1, 'd1', 1)"); session.executeNonQueryStatement("DROP TABLE table" + testNum); session.executeNonQueryStatement( - "CREATE TABLE table" + testNum + " (id1 string id, m1 double measurement)"); + "CREATE TABLE table" + testNum + " (tag1 string tag, m1 double field)"); session.executeNonQueryStatement( - "INSERT INTO table" + testNum + " (time, id1, m1) VALUES (2, 'd2', 2)"); + "INSERT INTO table" + testNum + " (time, tag1, m1) VALUES (2, 'd2', 2)"); SessionDataSet dataSet = session.executeQueryStatement("select * from table" + testNum + " order by time"); @@ -1413,14 +1413,14 @@ public void dropTableOfTheSameNameTest() session.executeNonQueryStatement("USE db1"); session.executeNonQueryStatement( - "CREATE TABLE db1.table" + testNum + " (id1 string id, m1 int32 measurement)"); + "CREATE TABLE db1.table" + testNum + " (tag1 string tag, m1 int32 field)"); session.executeNonQueryStatement( - "INSERT INTO db1.table" + testNum + " (time, id1, m1) VALUES (1, 'd1', 1)"); + "INSERT INTO db1.table" + testNum + " (time, tag1, m1) VALUES (1, 'd1', 1)"); session.executeNonQueryStatement( - "CREATE TABLE db2.table" + testNum + " (id1 string id, m1 double measurement)"); + "CREATE TABLE db2.table" + testNum + " (tag1 string tag, m1 double field)"); session.executeNonQueryStatement( - "INSERT INTO db2.table" + testNum + " (time, id1, m1) VALUES (2, 'd2', 2)"); + "INSERT INTO db2.table" + testNum + " (time, tag1, m1) VALUES (2, 'd2', 2)"); session.executeNonQueryStatement("DROP TABLE db2.table" + testNum); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBTableModelSessionIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBTableModelSessionIT.java index a8392a80dfc3..b3014ff56ee6 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBTableModelSessionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBTableModelSessionIT.java @@ -69,10 +69,10 @@ public void testUseDatabase() { // 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)"); try (final SessionDataSet dataSet = session.executeQueryStatement("SHOW TABLES")) { int cnt = 0; @@ -126,10 +126,10 @@ public void testCreateSessionWithCapitalDB() { // 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)"); try (final SessionDataSet dataSet = session.executeQueryStatement("SHOW TABLES")) { int cnt = 0; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBInsertTableSessionPoolIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBInsertTableSessionPoolIT.java index 9441bca94b58..c9b281787949 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBInsertTableSessionPoolIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBInsertTableSessionPoolIT.java @@ -75,23 +75,20 @@ public static void tearDown() throws Exception { @Test public void testPartialInsertTablet() { - ITableSessionPool sessionPool = EnvFactory.getEnv().getTableSessionPool(1); + final ITableSessionPool sessionPool = EnvFactory.getEnv().getTableSessionPool(1); try (final ITableSession session = sessionPool.getSession()) { session.executeNonQueryStatement("use \"test\""); session.executeNonQueryStatement("SET CONFIGURATION enable_auto_create_schema='false'"); session.executeNonQueryStatement( - "create table sg6 (id1 string id, s1 int64 measurement, s2 int64 measurement)"); + "create table sg6 (tag1 string tag, s1 int64 field, s2 int64 field)"); List schemaList = new ArrayList<>(); - schemaList.add(new MeasurementSchema("id1", TSDataType.STRING)); + schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING)); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s3", TSDataType.INT64)); final List columnTypes = Arrays.asList( - ColumnCategory.ID, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT); + ColumnCategory.TAG, ColumnCategory.FIELD, ColumnCategory.FIELD, ColumnCategory.FIELD); Tablet tablet = new Tablet( "sg6", @@ -139,7 +136,7 @@ public void testPartialInsertTablet() { try (SessionDataSet dataSet = session.executeQueryStatement("SELECT * FROM sg6")) { assertEquals(4, dataSet.getColumnNames().size()); assertEquals("time", dataSet.getColumnNames().get(0)); - assertEquals("id1", dataSet.getColumnNames().get(1)); + assertEquals("tag1", dataSet.getColumnNames().get(1)); assertEquals("s1", dataSet.getColumnNames().get(2)); assertEquals("s2", dataSet.getColumnNames().get(3)); int cnt = 0; @@ -165,18 +162,18 @@ public void testInsertKeyword() throws IoTDBConnectionException, StatementExecut session.executeNonQueryStatement("USE \"test\""); session.executeNonQueryStatement( "create table table20 (" - + "device_id string id," + + "device_id string tag," + "attribute STRING ATTRIBUTE," - + "boolean boolean MEASUREMENT," - + "int32 int32 MEASUREMENT," - + "int64 int64 MEASUREMENT," - + "float float MEASUREMENT," - + "double double MEASUREMENT," - + "text text MEASUREMENT," - + "string string MEASUREMENT," - + "blob blob MEASUREMENT," - + "timestamp01 timestamp MEASUREMENT," - + "date date MEASUREMENT)"); + + "boolean boolean FIELD," + + "int32 int32 FIELD," + + "int64 int64 FIELD," + + "float float FIELD," + + "double double FIELD," + + "text text FIELD," + + "string string FIELD," + + "blob blob FIELD," + + "timestamp01 timestamp FIELD," + + "date date FIELD)"); List schemas = new ArrayList<>(); schemas.add(new MeasurementSchema("device_id", TSDataType.STRING)); @@ -193,18 +190,18 @@ public void testInsertKeyword() throws IoTDBConnectionException, StatementExecut schemas.add(new MeasurementSchema("date", TSDataType.DATE)); final List columnTypes = Arrays.asList( - ColumnCategory.ID, + ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT, - ColumnCategory.MEASUREMENT); + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD, + ColumnCategory.FIELD); long timestamp = 0; Tablet tablet = diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBTableModelSessionPoolIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBTableModelSessionPoolIT.java index 52103dcc0c9d..3e2cba94c4c7 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBTableModelSessionPoolIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/pool/IoTDBTableModelSessionPoolIT.java @@ -73,10 +73,10 @@ public void testUseDatabase() { // 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)"); try (final SessionDataSet dataSet = session.executeQueryStatement("SHOW TABLES")) { int cnt = 0; diff --git a/iotdb-client/client-cpp/src/test/cpp/sessionRelationalIT.cpp b/iotdb-client/client-cpp/src/test/cpp/sessionRelationalIT.cpp index b0f562f11993..108f025ffc83 100644 --- a/iotdb-client/client-cpp/src/test/cpp/sessionRelationalIT.cpp +++ b/iotdb-client/client-cpp/src/test/cpp/sessionRelationalIT.cpp @@ -25,22 +25,22 @@ using namespace std; extern TableSession *session; -static int global_test_id = 0; +static int global_test_tag = 0; class CaseReporter { public: CaseReporter(const char *caseNameArg) : caseName(caseNameArg) { - test_id = global_test_id++; - std::cout << "Test " << test_id << ": " << caseName << std::endl; + test_tag = global_test_tag++; + std::cout << "Test " << test_tag << ": " << caseName << std::endl; } ~CaseReporter() { - std::cout << "Test " << test_id << ": " << caseName << " Done"<< std::endl << std::endl; + std::cout << "Test " << test_tag << ": " << caseName << " Done"<< std::endl << std::endl; } private: const char *caseName; - int test_id; + int test_tag; }; TEST_CASE("Create table success", "[createTable]") { @@ -51,9 +51,9 @@ TEST_CASE("Create table success", "[createTable]") { session->executeNonQueryStatement("USE \"db1\""); REQUIRE(session->getDatabase() == "db1"); session->executeNonQueryStatement("CREATE TABLE table0 (" - "id1 string id," + "tag1 string tag," "attr1 string attribute," - "m1 double measurement)"); + "m1 double field)"); unique_ptr sessionDataSet = session->executeQueryStatement("SHOW TABLES"); sessionDataSet->setFetchSize(1024); bool tableExist = false; @@ -71,11 +71,11 @@ TEST_CASE("Test insertRelationalTablet", "[testInsertRelationalTablet]") { session->executeNonQueryStatement("CREATE DATABASE IF NOT EXISTS db1"); session->executeNonQueryStatement("USE db1"); session->executeNonQueryStatement("CREATE TABLE table1 (" - "id1 string id," + "tag1 string tag," "attr1 string attribute," - "m1 double measurement)"); + "m1 double field)"); vector> schemaList; - schemaList.push_back(make_pair("id1", TSDataType::TEXT)); + schemaList.push_back(make_pair("tag1", TSDataType::TEXT)); schemaList.push_back(make_pair("attr1", TSDataType::TEXT)); schemaList.push_back(make_pair("m1", TSDataType::DOUBLE)); vector columnTypes = {ColumnCategory::ID, ColumnCategory::ATTRIBUTE, ColumnCategory::MEASUREMENT}; @@ -86,7 +86,7 @@ TEST_CASE("Test insertRelationalTablet", "[testInsertRelationalTablet]") { for (int row = 0; row < 15; row++) { int rowIndex = tablet.rowSize++; tablet.timestamps[rowIndex] = timestamp + row; - string data = "id:"; data += to_string(row); + string data = "tag:"; data += to_string(row); tablet.addValue(0, rowIndex, data); data = "attr:"; data += to_string(row); tablet.addValue(1, rowIndex, data); @@ -108,7 +108,7 @@ TEST_CASE("Test insertRelationalTablet", "[testInsertRelationalTablet]") { unique_ptr sessionDataSet = session->executeQueryStatement("SELECT * FROM table1 order by time"); while (sessionDataSet->hasNext()) { RowRecord *rowRecord = sessionDataSet->next(); - REQUIRE(rowRecord->fields[1].stringV == string("id:") + to_string(cnt)); + REQUIRE(rowRecord->fields[1].stringV == string("tag:") + to_string(cnt)); REQUIRE(rowRecord->fields[2].stringV == string("attr:") + to_string(cnt)); REQUIRE(fabs(rowRecord->fields[3].doubleV - cnt * 1.1) < 0.0001); cnt++; diff --git a/iotdb-client/client-py/tests/integration/test_relational_session.py b/iotdb-client/client-py/tests/integration/test_relational_session.py index 6ae39d0ab1b1..48c3cf307a47 100644 --- a/iotdb-client/client-py/tests/integration/test_relational_session.py +++ b/iotdb-client/client-py/tests/integration/test_relational_session.py @@ -52,13 +52,13 @@ def session_test(use_session_pool=False): session.execute_non_query_statement("CREATE DATABASE IF NOT EXISTS db1") session.execute_non_query_statement('USE "db1"') session.execute_non_query_statement( - "CREATE TABLE table5 (id1 string id, attr1 string attribute, " + "CREATE TABLE table5 (tag1 string tag, attr1 string attribute, " + "m1 double " - + "measurement)" + + "field)" ) column_names = [ - "id1", + "tag1", "attr1", "m1", ] @@ -72,7 +72,7 @@ def session_test(use_session_pool=False): values = [] for row in range(15): timestamps.append(row) - values.append(["id:" + str(row), "attr:" + str(row), row * 1.0]) + values.append(["tag:" + str(row), "attr:" + str(row), row * 1.0]) tablet = Tablet( "table5", column_names, data_types, values, timestamps, column_types ) @@ -82,7 +82,7 @@ def session_test(use_session_pool=False): np_timestamps = np.arange(15, 30, dtype=np.dtype(">i8")) np_values = [ - np.array(["id:{}".format(i) for i in range(15, 30)]), + np.array(["tag:{}".format(i) for i in range(15, 30)]), np.array(["attr:{}".format(i) for i in range(15, 30)]), np.linspace(15.0, 29.0, num=15, dtype=TSDataType.DOUBLE.np_dtype()), ] @@ -105,7 +105,7 @@ def session_test(use_session_pool=False): row_record = dataset.next() timestamp = row_record.get_fields()[0].get_long_value() assert ( - "id:" + str(timestamp) + "tag:" + str(timestamp) == row_record.get_fields()[1].get_string_value() ) assert ( diff --git a/iotdb-client/client-py/tests/integration/test_tablemodel_insert.py b/iotdb-client/client-py/tests/integration/test_tablemodel_insert.py index 05885332f48b..70f9730e2d00 100644 --- a/iotdb-client/client-py/tests/integration/test_tablemodel_insert.py +++ b/iotdb-client/client-py/tests/integration/test_tablemodel_insert.py @@ -42,26 +42,26 @@ def test_insert_use_tablet(): session.execute_non_query_statement("use test_insert_relational_tablet_tablet") session.execute_non_query_statement( "create table table_a(" - '"地区" STRING ID, "厂号" STRING ID, "设备号" STRING ID, ' + '"地区" STRING TAG, "厂号" STRING TAG, "设备号" STRING TAG, ' '"日期" string attribute, "时间" string attribute, "负责人" string attribute,' - '"测点1" BOOLEAN MEASUREMENT, "测点2" INT32 MEASUREMENT, "测点3" INT64 MEASUREMENT, "测点4" FLOAT MEASUREMENT, "测点5" DOUBLE MEASUREMENT,' - '"测点6" TEXT MEASUREMENT, "测点7" TIMESTAMP MEASUREMENT, "测点8" DATE MEASUREMENT, "测点9" BLOB MEASUREMENT, "测点10" STRING MEASUREMENT)' + '"测点1" BOOLEAN FIELD, "测点2" INT32 FIELD, "测点3" INT64 FIELD, "测点4" FLOAT FIELD, "测点5" DOUBLE FIELD,' + '"测点6" TEXT FIELD, "测点7" TIMESTAMP FIELD, "测点8" DATE FIELD, "测点9" BLOB FIELD, "测点10" STRING FIELD)' ) session.execute_non_query_statement( "create table table_b(" - "id1 STRING ID, id2 STRING ID, id3 STRING ID, " + "tag1 STRING TAG, tag2 STRING TAG, tag3 STRING TAG, " "attr1 string attribute, attr2 string attribute, attr3 string attribute," - "BOOLEAN BOOLEAN MEASUREMENT, INT32 INT32 MEASUREMENT, INT64 INT64 MEASUREMENT, FLOAT FLOAT MEASUREMENT, DOUBLE DOUBLE MEASUREMENT," - "TEXT TEXT MEASUREMENT, TIMESTAMP TIMESTAMP MEASUREMENT, DATE DATE MEASUREMENT, BLOB BLOB MEASUREMENT, STRING STRING MEASUREMENT)" + "BOOLEAN BOOLEAN FIELD, INT32 INT32 FIELD, INT64 INT64 FIELD, FLOAT FLOAT FIELD, DOUBLE DOUBLE FIELD," + "TEXT TEXT FIELD, TIMESTAMP TIMESTAMP FIELD, DATE DATE FIELD, BLOB BLOB FIELD, STRING STRING FIELD)" ) # 1、General scenario expect = 10 table_name = "table_b" column_names = [ - "id1", - "id2", - "id3", + "tag1", + "tag2", + "tag3", "attr1", "attr2", "attr3", @@ -118,9 +118,9 @@ def test_insert_use_tablet(): timestamps.append(row_b) values.append( [ - "id1:" + str(row_b), - "id2:" + str(row_b), - "id3:" + str(row_b), + "tag1:" + str(row_b), + "tag2:" + str(row_b), + "tag3:" + str(row_b), "attr1:" + str(row_b), "attr2:" + str(row_b), "attr3:" + str(row_b), @@ -138,9 +138,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_b), - "id2:" + str(row_b), - "id3:" + str(row_b), + "tag1:" + str(row_b), + "tag2:" + str(row_b), + "tag3:" + str(row_b), "attr1:" + str(row_b), "attr2:" + str(row_b), "attr3:" + str(row_b), @@ -158,9 +158,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_b), - "id2:" + str(row_b), - "id3:" + str(row_b), + "tag1:" + str(row_b), + "tag2:" + str(row_b), + "tag3:" + str(row_b), "attr1:" + str(row_b), "attr2:" + str(row_b), "attr3:" + str(row_b), @@ -178,9 +178,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_b), - "id2:" + str(row_b), - "id3:" + str(row_b), + "tag1:" + str(row_b), + "tag2:" + str(row_b), + "tag3:" + str(row_b), "attr1:" + str(row_b), "attr2:" + str(row_b), "attr3:" + str(row_b), @@ -198,9 +198,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_b), - "id2:" + str(row_b), - "id3:" + str(row_b), + "tag1:" + str(row_b), + "tag2:" + str(row_b), + "tag3:" + str(row_b), "attr1:" + str(row_b), "attr2:" + str(row_b), "attr3:" + str(row_b), @@ -218,9 +218,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_b), - "id2:" + str(row_b), - "id3:" + str(row_b), + "tag1:" + str(row_b), + "tag2:" + str(row_b), + "tag3:" + str(row_b), "attr1:" + str(row_b), "attr2:" + str(row_b), "attr3:" + str(row_b), @@ -240,9 +240,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_b), - "id2:" + str(row_b), - "id3:" + str(row_b), + "tag1:" + str(row_b), + "tag2:" + str(row_b), + "tag3:" + str(row_b), "attr1:" + str(row_b), "attr2:" + str(row_b), "attr3:" + str(row_b), @@ -260,9 +260,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_b), - "id2:" + str(row_b), - "id3:" + str(row_b), + "tag1:" + str(row_b), + "tag2:" + str(row_b), + "tag3:" + str(row_b), "attr1:" + str(row_b), "attr2:" + str(row_b), "attr3:" + str(row_b), @@ -280,9 +280,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_b), - "id2:" + str(row_b), - "id3:" + str(row_b), + "tag1:" + str(row_b), + "tag2:" + str(row_b), + "tag3:" + str(row_b), "attr1:" + str(row_b), "attr2:" + str(row_b), "attr3:" + str(row_b), @@ -300,9 +300,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_b), - "id2:" + str(row_b), - "id3:" + str(row_b), + "tag1:" + str(row_b), + "tag2:" + str(row_b), + "tag3:" + str(row_b), "attr1:" + str(row_b), "attr2:" + str(row_b), "attr3:" + str(row_b), @@ -397,9 +397,9 @@ def test_insert_use_tablet(): timestamps.append(row_a) values.append( [ - "id1:" + str(row_a), - "id2:" + str(row_a), - "id3:" + str(row_a), + "tag1:" + str(row_a), + "tag2:" + str(row_a), + "tag3:" + str(row_a), "attr1:" + str(row_a), "attr2:" + str(row_a), "attr3:" + str(row_a), @@ -417,9 +417,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_a), - "id2:" + str(row_a), - "id3:" + str(row_a), + "tag1:" + str(row_a), + "tag2:" + str(row_a), + "tag3:" + str(row_a), "attr1:" + str(row_a), "attr2:" + str(row_a), "attr3:" + str(row_a), @@ -437,9 +437,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_a), - "id2:" + str(row_a), - "id3:" + str(row_a), + "tag1:" + str(row_a), + "tag2:" + str(row_a), + "tag3:" + str(row_a), "attr1:" + str(row_a), "attr2:" + str(row_a), "attr3:" + str(row_a), @@ -457,9 +457,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_a), - "id2:" + str(row_a), - "id3:" + str(row_a), + "tag1:" + str(row_a), + "tag2:" + str(row_a), + "tag3:" + str(row_a), "attr1:" + str(row_a), "attr2:" + str(row_a), "attr3:" + str(row_a), @@ -477,9 +477,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_a), - "id2:" + str(row_a), - "id3:" + str(row_a), + "tag1:" + str(row_a), + "tag2:" + str(row_a), + "tag3:" + str(row_a), "attr1:" + str(row_a), "attr2:" + str(row_a), "attr3:" + str(row_a), @@ -497,9 +497,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_a), - "id2:" + str(row_a), - "id3:" + str(row_a), + "tag1:" + str(row_a), + "tag2:" + str(row_a), + "tag3:" + str(row_a), "attr1:" + str(row_a), "attr2:" + str(row_a), "attr3:" + str(row_a), @@ -519,9 +519,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_a), - "id2:" + str(row_a), - "id3:" + str(row_a), + "tag1:" + str(row_a), + "tag2:" + str(row_a), + "tag3:" + str(row_a), "attr1:" + str(row_a), "attr2:" + str(row_a), "attr3:" + str(row_a), @@ -539,9 +539,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_a), - "id2:" + str(row_a), - "id3:" + str(row_a), + "tag1:" + str(row_a), + "tag2:" + str(row_a), + "tag3:" + str(row_a), "attr1:" + str(row_a), "attr2:" + str(row_a), "attr3:" + str(row_a), @@ -559,9 +559,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_a), - "id2:" + str(row_a), - "id3:" + str(row_a), + "tag1:" + str(row_a), + "tag2:" + str(row_a), + "tag3:" + str(row_a), "attr1:" + str(row_a), "attr2:" + str(row_a), "attr3:" + str(row_a), @@ -579,9 +579,9 @@ def test_insert_use_tablet(): ) values.append( [ - "id1:" + str(row_a), - "id2:" + str(row_a), - "id3:" + str(row_a), + "tag1:" + str(row_a), + "tag2:" + str(row_a), + "tag3:" + str(row_a), "attr1:" + str(row_a), "attr2:" + str(row_a), "attr3:" + str(row_a), @@ -634,26 +634,26 @@ def test_insert_relational_tablet_use_numpy_tablet(): ) session.execute_non_query_statement( "create table table_b(" - "id1 STRING ID, id2 STRING ID, id3 STRING ID, " + "tag1 STRING TAG, tag2 STRING TAG, tag3 STRING TAG, " "attr1 string attribute, attr2 string attribute, attr3 string attribute," - "BOOLEAN BOOLEAN MEASUREMENT, INT32 INT32 MEASUREMENT, INT64 INT64 MEASUREMENT, FLOAT FLOAT MEASUREMENT, DOUBLE DOUBLE MEASUREMENT," - "TEXT TEXT MEASUREMENT, TIMESTAMP TIMESTAMP MEASUREMENT, DATE DATE MEASUREMENT, BLOB BLOB MEASUREMENT, STRING STRING MEASUREMENT)" + "BOOLEAN BOOLEAN FIELD, INT32 INT32 FIELD, INT64 INT64 FIELD, FLOAT FLOAT FIELD, DOUBLE DOUBLE FIELD," + "TEXT TEXT FIELD, TIMESTAMP TIMESTAMP FIELD, DATE DATE FIELD, BLOB BLOB FIELD, STRING STRING FIELD)" ) session.execute_non_query_statement( "create table table_d(" - "id1 STRING ID, id2 STRING ID, id3 STRING ID, " + "tag1 STRING TAG, tag2 STRING TAG, tag3 STRING TAG, " "attr1 string attribute, attr2 string attribute, attr3 string attribute," - "BOOLEAN BOOLEAN MEASUREMENT, INT32 INT32 MEASUREMENT, INT64 INT64 MEASUREMENT, FLOAT FLOAT MEASUREMENT, DOUBLE DOUBLE MEASUREMENT," - "TEXT TEXT MEASUREMENT, TIMESTAMP TIMESTAMP MEASUREMENT, DATE DATE MEASUREMENT, BLOB BLOB MEASUREMENT, STRING STRING MEASUREMENT)" + "BOOLEAN BOOLEAN FIELD, INT32 INT32 FIELD, INT64 INT64 FIELD, FLOAT FLOAT FIELD, DOUBLE DOUBLE FIELD," + "TEXT TEXT FIELD, TIMESTAMP TIMESTAMP FIELD, DATE DATE FIELD, BLOB BLOB FIELD, STRING STRING FIELD)" ) # 1、No null expect = 10 table_name = "table_b" column_names = [ - "id1", - "id2", - "id3", + "tag1", + "tag2", + "tag3", "attr1", "attr2", "attr3", @@ -706,9 +706,9 @@ def test_insert_relational_tablet_use_numpy_tablet(): ] np_timestamps = np.arange(0, 10, dtype=np.dtype(">i8")) np_values = [ - np.array(["id1:{}".format(i) for i in range(0, 10)]), - np.array(["id2:{}".format(i) for i in range(0, 10)]), - np.array(["id3:{}".format(i) for i in range(0, 10)]), + np.array(["tag1:{}".format(i) for i in range(0, 10)]), + np.array(["tag2:{}".format(i) for i in range(0, 10)]), + np.array(["tag3:{}".format(i) for i in range(0, 10)]), np.array(["attr1:{}".format(i) for i in range(0, 10)]), np.array(["attr2:{}".format(i) for i in range(0, 10)]), np.array(["attr3:{}".format(i) for i in range(0, 10)]), @@ -868,9 +868,9 @@ def test_insert_relational_tablet_use_numpy_tablet(): expect = 10 table_name = "table_d" column_names = [ - "id1", - "id2", - "id3", + "tag1", + "tag2", + "tag3", "attr1", "attr2", "attr3", @@ -923,9 +923,9 @@ def test_insert_relational_tablet_use_numpy_tablet(): ] np_timestamps = np.arange(0, 10, dtype=np.dtype(">i8")) np_values = [ - np.array(["id1:{}".format(i) for i in range(0, 10)]), - np.array(["id2:{}".format(i) for i in range(0, 10)]), - np.array(["id3:{}".format(i) for i in range(0, 10)]), + np.array(["tag1:{}".format(i) for i in range(0, 10)]), + np.array(["tag2:{}".format(i) for i in range(0, 10)]), + np.array(["tag3:{}".format(i) for i in range(0, 10)]), np.array(["attr1:{}".format(i) for i in range(0, 10)]), np.array(["attr2:{}".format(i) for i in range(0, 10)]), np.array(["attr3:{}".format(i) for i in range(0, 10)]), @@ -1119,9 +1119,9 @@ def test_insert_relational_tablet_auto_create(): for i in range(1, 10): table_name = "t" + str(i) column_names = [ - "id1", - "id2", - "id3", + "tag1", + "tag2", + "tag3", "attr1", "attr2", "attr3", @@ -1178,9 +1178,9 @@ def test_insert_relational_tablet_auto_create(): timestamps.append(row) values.append( [ - "id1:" + str(row), - "id2:" + str(row), - "id3:" + str(row), + "tag1:" + str(row), + "tag2:" + str(row), + "tag3:" + str(row), "attr1:" + str(row), "attr2:" + str(row), "attr3:" + str(row), @@ -1198,9 +1198,9 @@ def test_insert_relational_tablet_auto_create(): ) values.append( [ - "id1:" + str(row), - "id2:" + str(row), - "id3:" + str(row), + "tag1:" + str(row), + "tag2:" + str(row), + "tag3:" + str(row), "attr1:" + str(row), "attr2:" + str(row), "attr3:" + str(row), @@ -1218,9 +1218,9 @@ def test_insert_relational_tablet_auto_create(): ) values.append( [ - "id1:" + str(row), - "id2:" + str(row), - "id3:" + str(row), + "tag1:" + str(row), + "tag2:" + str(row), + "tag3:" + str(row), "attr1:" + str(row), "attr2:" + str(row), "attr3:" + str(row), @@ -1238,9 +1238,9 @@ def test_insert_relational_tablet_auto_create(): ) values.append( [ - "id1:" + str(row), - "id2:" + str(row), - "id3:" + str(row), + "tag1:" + str(row), + "tag2:" + str(row), + "tag3:" + str(row), "attr1:" + str(row), "attr2:" + str(row), "attr3:" + str(row), @@ -1258,9 +1258,9 @@ def test_insert_relational_tablet_auto_create(): ) values.append( [ - "id1:" + str(row), - "id2:" + str(row), - "id3:" + str(row), + "tag1:" + str(row), + "tag2:" + str(row), + "tag3:" + str(row), "attr1:" + str(row), "attr2:" + str(row), "attr3:" + str(row), @@ -1278,9 +1278,9 @@ def test_insert_relational_tablet_auto_create(): ) values.append( [ - "id1:" + str(row), - "id2:" + str(row), - "id3:" + str(row), + "tag1:" + str(row), + "tag2:" + str(row), + "tag3:" + str(row), "attr1:" + str(row), "attr2:" + str(row), "attr3:" + str(row), @@ -1300,9 +1300,9 @@ def test_insert_relational_tablet_auto_create(): ) values.append( [ - "id1:" + str(row), - "id2:" + str(row), - "id3:" + str(row), + "tag1:" + str(row), + "tag2:" + str(row), + "tag3:" + str(row), "attr1:" + str(row), "attr2:" + str(row), "attr3:" + str(row), @@ -1320,9 +1320,9 @@ def test_insert_relational_tablet_auto_create(): ) values.append( [ - "id1:" + str(row), - "id2:" + str(row), - "id3:" + str(row), + "tag1:" + str(row), + "tag2:" + str(row), + "tag3:" + str(row), "attr1:" + str(row), "attr2:" + str(row), "attr3:" + str(row), @@ -1340,9 +1340,9 @@ def test_insert_relational_tablet_auto_create(): ) values.append( [ - "id1:" + str(row), - "id2:" + str(row), - "id3:" + str(row), + "tag1:" + str(row), + "tag2:" + str(row), + "tag3:" + str(row), "attr1:" + str(row), "attr2:" + str(row), "attr3:" + str(row), @@ -1360,9 +1360,9 @@ def test_insert_relational_tablet_auto_create(): ) values.append( [ - "id1:" + str(row), - "id2:" + str(row), - "id3:" + str(row), + "tag1:" + str(row), + "tag2:" + str(row), + "tag3:" + str(row), "attr1:" + str(row), "attr2:" + str(row), "attr3:" + str(row), @@ -1387,9 +1387,9 @@ def test_insert_relational_tablet_auto_create(): for i in range(1, 10): table_name = "t" + str(i) column_names = [ - "id1", - "id2", - "id3", + "tag1", + "tag2", + "tag3", "attr1", "attr2", "attr3", @@ -1442,9 +1442,9 @@ def test_insert_relational_tablet_auto_create(): ] np_timestamps = np.arange(0, 10, dtype=np.dtype(">i8")) np_values = [ - np.array(["id1:{}".format(i) for i in range(0, 10)]), - np.array(["id2:{}".format(i) for i in range(0, 10)]), - np.array(["id3:{}".format(i) for i in range(0, 10)]), + np.array(["tag1:{}".format(i) for i in range(0, 10)]), + np.array(["tag2:{}".format(i) for i in range(0, 10)]), + np.array(["tag3:{}".format(i) for i in range(0, 10)]), np.array(["attr1:{}".format(i) for i in range(0, 10)]), np.array(["attr2:{}".format(i) for i in range(0, 10)]), np.array(["attr3:{}".format(i) for i in range(0, 10)]), 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 e1af26845fe1..a969c8d0c708 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 @@ -643,9 +643,9 @@ public void testInsertRelationalTablet() dataTypes.add(TSDataType.INT64); dataTypes.add(TSDataType.INT64); List columnTypeList = new ArrayList<>(); - columnTypeList.add(ColumnCategory.ID); - columnTypeList.add(ColumnCategory.MEASUREMENT); - columnTypeList.add(ColumnCategory.MEASUREMENT); + columnTypeList.add(ColumnCategory.TAG); + columnTypeList.add(ColumnCategory.FIELD); + columnTypeList.add(ColumnCategory.FIELD); Tablet tablet = new Tablet(tableName, measurements, dataTypes, columnTypeList, 50); long timestamp = System.currentTimeMillis(); for (long row = 0; row < 100; row++) { @@ -1038,9 +1038,9 @@ public void testInsertRelationalTabletWithSessionBroken() throws StatementExecut schemaList.add(new MeasurementSchema("id", TSDataType.STRING)); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT64)); - columnTypeList.add(ColumnCategory.ID); - columnTypeList.add(ColumnCategory.MEASUREMENT); - columnTypeList.add(ColumnCategory.MEASUREMENT); + columnTypeList.add(ColumnCategory.TAG); + columnTypeList.add(ColumnCategory.FIELD); + columnTypeList.add(ColumnCategory.FIELD); Tablet tablet = new Tablet( tableName, 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 248b9ec2f35c..bb6474258bd0 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 @@ -848,7 +848,7 @@ public boolean preDeleteColumn( throw new ColumnNotExistsException( PathUtils.unQualifyDatabaseName(database.getFullPath()), tableName, columnName); } - if (columnSchema.getColumnCategory() == TsTableColumnCategory.ID + if (columnSchema.getColumnCategory() == TsTableColumnCategory.TAG || columnSchema.getColumnCategory() == TsTableColumnCategory.TIME) { throw new SemanticException("Dropping id or time column is not supported."); } 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 7a94b2a059d9..91913ec1a58b 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 @@ -50,8 +50,8 @@ import org.apache.iotdb.commons.pipe.agent.task.meta.PipeTaskMeta; import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.column.AttributeColumnSchema; -import org.apache.iotdb.commons.schema.table.column.IdColumnSchema; -import org.apache.iotdb.commons.schema.table.column.MeasurementColumnSchema; +import org.apache.iotdb.commons.schema.table.column.FieldColumnSchema; +import org.apache.iotdb.commons.schema.table.column.TagColumnSchema; import org.apache.iotdb.commons.subscription.meta.consumer.ConsumerGroupMeta; import org.apache.iotdb.commons.subscription.meta.consumer.ConsumerMeta; import org.apache.iotdb.commons.subscription.meta.topic.TopicMeta; @@ -1145,7 +1145,7 @@ public void AddTableColumnPlanTest() throws IOException { new AddTableColumnPlan( "database1", "table1", - Collections.singletonList(new IdColumnSchema("Id", TSDataType.STRING)), + Collections.singletonList(new TagColumnSchema("Id", TSDataType.STRING)), false); final AddTableColumnPlan addTableColumnPlan1 = (AddTableColumnPlan) @@ -1173,10 +1173,10 @@ public void CommitCreateTablePlanTest() throws IOException { @Test public void preCreateTablePlanTest() throws IOException { final TsTable table = new TsTable("table1"); - table.addColumnSchema(new IdColumnSchema("Id", TSDataType.STRING)); + table.addColumnSchema(new TagColumnSchema("Id", TSDataType.STRING)); table.addColumnSchema(new AttributeColumnSchema("Attr", TSDataType.STRING)); table.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( "Measurement", TSDataType.DOUBLE, TSEncoding.GORILLA, CompressionType.SNAPPY)); final PreCreateTablePlan preCreateTablePlan0 = new PreCreateTablePlan("database1", table); final PreCreateTablePlan preCreateTablePlan1 = 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 642264a16443..2ea3a0bc434d 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 @@ -25,8 +25,8 @@ import org.apache.iotdb.commons.schema.node.role.IDatabaseMNode; import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.column.AttributeColumnSchema; -import org.apache.iotdb.commons.schema.table.column.IdColumnSchema; -import org.apache.iotdb.commons.schema.table.column.MeasurementColumnSchema; +import org.apache.iotdb.commons.schema.table.column.FieldColumnSchema; +import org.apache.iotdb.commons.schema.table.column.TagColumnSchema; import org.apache.iotdb.commons.utils.PathUtils; import org.apache.iotdb.confignode.persistence.schema.mnode.IConfigMNode; import org.apache.iotdb.confignode.rpc.thrift.TDatabaseSchema; @@ -336,10 +336,10 @@ public void testTableSerialization() throws Exception { final String tableName = "table" + i; final TsTable table = new TsTable(tableName); - table.addColumnSchema(new IdColumnSchema("Id", TSDataType.STRING)); + table.addColumnSchema(new TagColumnSchema("Id", TSDataType.STRING)); table.addColumnSchema(new AttributeColumnSchema("Attr", TSDataType.STRING)); table.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( "Measurement", TSDataType.DOUBLE, TSEncoding.GORILLA, CompressionType.SNAPPY)); root.preCreateTable(pathList[i], table); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedureTest.java index d49f2017d25d..0f1a0d849df5 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedureTest.java @@ -20,7 +20,7 @@ package org.apache.iotdb.confignode.procedure.impl.schema.table; import org.apache.iotdb.commons.exception.IllegalPathException; -import org.apache.iotdb.commons.schema.table.column.IdColumnSchema; +import org.apache.iotdb.commons.schema.table.column.TagColumnSchema; import org.apache.iotdb.confignode.procedure.store.ProcedureType; import org.apache.tsfile.enums.TSDataType; @@ -41,7 +41,7 @@ public void serializeDeserializeTest() throws IllegalPathException, IOException "database1", "table1", "0", - Collections.singletonList(new IdColumnSchema("Id", TSDataType.STRING))); + Collections.singletonList(new TagColumnSchema("Id", TSDataType.STRING))); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedureTest.java index 9a00743f9867..664e7d228512 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedureTest.java @@ -22,8 +22,8 @@ import org.apache.iotdb.commons.exception.IllegalPathException; import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.column.AttributeColumnSchema; -import org.apache.iotdb.commons.schema.table.column.IdColumnSchema; -import org.apache.iotdb.commons.schema.table.column.MeasurementColumnSchema; +import org.apache.iotdb.commons.schema.table.column.FieldColumnSchema; +import org.apache.iotdb.commons.schema.table.column.TagColumnSchema; import org.apache.iotdb.confignode.procedure.store.ProcedureType; import org.apache.tsfile.enums.TSDataType; @@ -41,10 +41,10 @@ public class CreateTableProcedureTest { @Test public void serializeDeserializeTest() throws IllegalPathException, IOException { final TsTable table = new TsTable("table1"); - table.addColumnSchema(new IdColumnSchema("Id", TSDataType.STRING)); + table.addColumnSchema(new TagColumnSchema("Id", TSDataType.STRING)); table.addColumnSchema(new AttributeColumnSchema("Attr", TSDataType.STRING)); table.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( "Measurement", TSDataType.DOUBLE, TSEncoding.GORILLA, CompressionType.SNAPPY)); final CreateTableProcedure createTableProcedure = new CreateTableProcedure("database1", table); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcua/OpcUaNameSpace.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcua/OpcUaNameSpace.java index 8467e5596568..270188005ce4 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcua/OpcUaNameSpace.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcua/OpcUaNameSpace.java @@ -139,7 +139,7 @@ private void transferTabletForClientServerModel(final Tablet tablet, final boole } else { final List columnIndexes = new ArrayList<>(); for (int i = 0; i < schemas.size(); ++i) { - if (tablet.getColumnTypes().get(i) == Tablet.ColumnCategory.MEASUREMENT) { + if (tablet.getColumnTypes().get(i) == Tablet.ColumnCategory.FIELD) { columnIndexes.add(i); newSchemas.add(schemas.get(i)); } @@ -335,7 +335,7 @@ private void transferTabletForPubSubModel(final Tablet tablet, final boolean isT // Use eventNode here because other nodes doesn't support values and times simultaneously for (int columnIndex = 0; columnIndex < tablet.getSchemas().size(); ++columnIndex) { if (isTableModel - && !tablet.getColumnTypes().get(columnIndex).equals(Tablet.ColumnCategory.MEASUREMENT)) { + && !tablet.getColumnTypes().get(columnIndex).equals(Tablet.ColumnCategory.FIELD)) { continue; } final TSDataType dataType = tablet.getSchemas().get(columnIndex).getType(); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/parser/TabletInsertionEventParser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/parser/TabletInsertionEventParser.java index 3eddd7ee6ac1..d6011b054f11 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/parser/TabletInsertionEventParser.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/parser/TabletInsertionEventParser.java @@ -153,7 +153,7 @@ protected void parse(final InsertRowNode insertRowNode) { this.valueColumnTypes[filteredColumnIndex] = originColumnCategories != null && originColumnCategories[i] != null ? originColumnCategories[i].toTsFileColumnType() - : Tablet.ColumnCategory.MEASUREMENT; + : Tablet.ColumnCategory.FIELD; this.valueColumnDataTypes[filteredColumnIndex] = originValueColumnDataTypes[i]; final BitMap bitMap = new BitMap(this.timestampColumn.length); if (Objects.isNull(originValueColumns[i]) @@ -247,7 +247,7 @@ protected void parse(final InsertTabletNode insertTabletNode) { this.valueColumnTypes[filteredColumnIndex] = originColumnCategories != null && originColumnCategories[i] != null ? originColumnCategories[i].toTsFileColumnType() - : Tablet.ColumnCategory.MEASUREMENT; + : Tablet.ColumnCategory.FIELD; this.valueColumnDataTypes[filteredColumnIndex] = originValueColumnDataTypes[i]; final BitMap bitMap = new BitMap(this.timestampColumn.length); if (Objects.isNull(originValueColumns[i]) @@ -330,7 +330,7 @@ protected void parse(final Tablet tablet, final boolean isAligned) { originColumnTypes[i] = tablet.getColumnTypes() != null && tablet.getColumnTypes().get(i) != null ? tablet.getColumnTypes().get(i) - : Tablet.ColumnCategory.MEASUREMENT; + : Tablet.ColumnCategory.FIELD; originValueColumnDataTypes[i] = originMeasurementSchemaList.get(i).getType(); } final Object[] originValueColumns = @@ -354,7 +354,7 @@ protected void parse(final Tablet tablet, final boolean isAligned) { this.measurementSchemaList[filteredColumnIndex] = originMeasurementSchemaList.get(i); this.columnNameStringList[filteredColumnIndex] = originColumnNameStringList[i]; this.valueColumnTypes[filteredColumnIndex] = - originColumnTypes[i] != null ? originColumnTypes[i] : Tablet.ColumnCategory.MEASUREMENT; + originColumnTypes[i] != null ? originColumnTypes[i] : Tablet.ColumnCategory.FIELD; this.valueColumnDataTypes[filteredColumnIndex] = originValueColumnDataTypes[i]; final BitMap bitMap = new BitMap(this.timestampColumn.length); if (Objects.isNull(originValueColumns[i]) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/table/TsFileInsertionEventTableParserTabletIterator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/table/TsFileInsertionEventTableParserTabletIterator.java index 39c109496c57..8aa47cfa5953 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/table/TsFileInsertionEventTableParserTabletIterator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/table/TsFileInsertionEventTableParserTabletIterator.java @@ -133,7 +133,7 @@ private Tablet buildNextTablet() throws IOException { ? row[i] : DateUtils.parseIntToLocalDate((Integer) row[i]); tablet.addValue(columnNames.get(i), rowIndex, value); - if (value != null && columnTypes.get(i) == Tablet.ColumnCategory.MEASUREMENT) { + if (value != null && columnTypes.get(i) == Tablet.ColumnCategory.FIELD) { isAllNull = false; } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java index 2f7b12b27689..46c0ff4e121d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java @@ -514,7 +514,7 @@ private static long sizeOfColumnIndices(final TsTableColumnCategory[] columnCate long size = SIZE_OF_ARRAYLIST; size += NUM_BYTES_ARRAY_HEADER; for (TsTableColumnCategory columnCategory : columnCategories) { - if (columnCategory != null && columnCategory.equals(TsTableColumnCategory.ID)) { + if (columnCategory != null && columnCategory.equals(TsTableColumnCategory.TAG)) { size += SIZE_OF_INT + NUM_BYTES_OBJECT_REF; } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceFetchSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceFetchSource.java index d1b5995bfc42..965d93fdcb23 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceFetchSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceFetchSource.java @@ -83,7 +83,7 @@ public void transformToTsBlockColumns( TsTableColumnSchema columnSchema; for (final ColumnHeader columnHeader : columnHeaderList) { columnSchema = table.getColumnSchema(columnHeader.getColumnName()); - if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.ID)) { + if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.TAG)) { if (pathNodes.length <= idIndex + 3 || pathNodes[idIndex + 3] == null) { builder.getColumnBuilder(resultIndex).appendNull(); } else { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceQuerySource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceQuerySource.java index 919553d2f18d..dfa0cf4baf1f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceQuerySource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceQuerySource.java @@ -224,7 +224,7 @@ public static void transformToTsBlockColumns( TsTableColumnSchema columnSchema; for (final ColumnHeader columnHeader : columnHeaderList) { columnSchema = table.getColumnSchema(columnHeader.getColumnName()); - if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.ID)) { + if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.TAG)) { if (pathNodes.length <= idIndex || pathNodes[idIndex] == null) { builder.getColumnBuilder(resultIndex).appendNull(); } else { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableAggregationTableScanOperator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableAggregationTableScanOperator.java index 8ef9ddbbf04a..47f63fd64680 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableAggregationTableScanOperator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableAggregationTableScanOperator.java @@ -443,7 +443,7 @@ private Column buildValueColumn( switch (columnSchemaCategory) { case TIME: return inputRegion.getTimeColumn(); - case ID: + case TAG: // TODO avoid create deviceStatics multi times; count, sum can use time statistics String id = (String) @@ -460,7 +460,7 @@ private Column buildValueColumn( .getAttributeColumnValues() .get(aggColumnsIndexArray[columnIdx]); return getIdOrAttrColumn(inputRegion.getTimeColumn().getPositionCount(), attr); - case MEASUREMENT: + case FIELD: return inputRegion.getColumn(aggColumnsIndexArray[columnIdx]); default: throw new IllegalStateException("Unsupported column type: " + columnSchemaCategory); @@ -514,7 +514,7 @@ private Statistics buildStatistics( switch (columnSchemaCategory) { case TIME: return timeStatistics; - case ID: + case TAG: // TODO avoid create deviceStatics multi times; count, sum can use time statistics String id = (String) @@ -530,7 +530,7 @@ private Statistics buildStatistics( .getAttributeColumnValues() .get(aggColumnsIndexArray[columnIdx]); return getStatistics(timeStatistics, attr); - case MEASUREMENT: + case FIELD: return valueStatistics[aggColumnsIndexArray[columnIdx]]; default: throw new IllegalStateException("Unsupported column type: " + columnSchemaCategory); @@ -736,7 +736,7 @@ public void appendAggregationResult( if (groupingKeyIndex != null) { for (int i = 0; i < groupKeySize; i++) { - if (TsTableColumnCategory.ID == groupingKeySchemas.get(i).getColumnCategory()) { + if (TsTableColumnCategory.TAG == groupingKeySchemas.get(i).getColumnCategory()) { String id = (String) deviceEntries.get(currentDeviceIndex).getNthSegment(groupingKeyIndex[i] + 1); if (id == null) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableScanOperator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableScanOperator.java index 1c9b7545d2f7..6abf101ab60e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableScanOperator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableScanOperator.java @@ -213,7 +213,7 @@ private void constructResultTsBlock() { Column[] valueColumns = new Column[columnsIndexArray.length]; for (int i = 0; i < columnsIndexArray.length; i++) { switch (columnSchemas.get(i).getColumnCategory()) { - case ID: + case TAG: // +1 for skip the table name segment String idColumnValue = ((String) currentDeviceEntry.getNthSegment(columnsIndexArray[i] + 1)); @@ -229,7 +229,7 @@ private void constructResultTsBlock() { currentDeviceEntry.getAttributeColumnValues().get(columnsIndexArray[i]); valueColumns[i] = getIdOrAttributeValueColumn(attributeColumnValue, positionCount); break; - case MEASUREMENT: + case FIELD: valueColumns[i] = measurementDataBlock.getColumn(columnsIndexArray[i]); break; case TIME: diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/LoadTsFileTableSchemaCache.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/LoadTsFileTableSchemaCache.java index b7070afea49f..dac5f81e66bc 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/LoadTsFileTableSchemaCache.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/LoadTsFileTableSchemaCache.java @@ -276,7 +276,7 @@ private void verifyTableDataTypeAndGenerateIdColumnMapper( int idColumnIndex = 0; for (int i = 0; i < fileSchema.getColumns().size(); i++) { final ColumnSchema fileColumn = fileSchema.getColumns().get(i); - if (fileColumn.getColumnCategory() == TsTableColumnCategory.ID) { + if (fileColumn.getColumnCategory() == TsTableColumnCategory.TAG) { final int realIndex = realSchema.getIndexAmongIdColumns(fileColumn.getName()); if (realIndex != -1) { idColumnMapping.put(idColumnIndex++, realIndex); @@ -286,7 +286,7 @@ private void verifyTableDataTypeAndGenerateIdColumnMapper( "Id column %s in TsFile is not found in IoTDB table %s", fileColumn.getName(), realSchema.getTableName())); } - } else if (fileColumn.getColumnCategory() == TsTableColumnCategory.MEASUREMENT) { + } else if (fileColumn.getColumnCategory() == TsTableColumnCategory.FIELD) { final ColumnSchema realColumn = realSchema.getColumn(fileColumn.getName(), fileColumn.getColumnCategory()); if (!fileColumn.getType().equals(realColumn.getType())) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java index 3873973ca85d..05e31ea4ed91 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java @@ -190,7 +190,7 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.ImmutableList.toImmutableList; import static java.util.Objects.requireNonNull; -import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.MEASUREMENT; +import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.FIELD; import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.TIME; import static org.apache.iotdb.commons.udf.builtin.relational.TableBuiltinAggregationFunction.getAggregationTypeByFuncName; import static org.apache.iotdb.db.queryengine.common.DataNodeEndPoints.isSameNode; @@ -336,14 +336,14 @@ public Operator visitDeviceTableScan( requireNonNull(columnSchemaMap.get(columnName), columnName + " is null"); switch (schema.getColumnCategory()) { - case ID: + case TAG: case ATTRIBUTE: columnsIndexArray[idx++] = requireNonNull( idAndAttributeColumnsIndexMap.get(columnName), columnName + " is null"); columnSchemas.add(schema); break; - case MEASUREMENT: + case FIELD: columnsIndexArray[idx++] = measurementColumnCount; measurementColumnCount++; measurementColumnNames.add(schema.getName()); @@ -365,8 +365,7 @@ public Operator visitDeviceTableScan( Set outputSet = new HashSet<>(outputColumnNames); for (Map.Entry entry : node.getAssignments().entrySet()) { - if (!outputSet.contains(entry.getKey()) - && entry.getValue().getColumnCategory() == MEASUREMENT) { + if (!outputSet.contains(entry.getKey()) && entry.getValue().getColumnCategory() == FIELD) { measurementColumnCount++; measurementColumnNames.add(entry.getValue().getName()); measurementSchemas.add( @@ -1777,12 +1776,12 @@ public Operator visitAggregationTableScan( requireNonNull(node.getAssignments().get(symbol), symbol + " is null"); if (!aggColumnLayout.containsKey(symbol)) { switch (schema.getColumnCategory()) { - case ID: + case TAG: case ATTRIBUTE: aggColumnsIndexArray[channel] = requireNonNull(node.getIdAndAttributeIndexMap().get(symbol), symbol + " is null"); break; - case MEASUREMENT: + case FIELD: aggColumnsIndexArray[channel] = measurementColumnCount; measurementColumnCount++; measurementColumnNames.add(schema.getName()); @@ -1810,7 +1809,7 @@ public Operator visitAggregationTableScan( for (Map.Entry entry : node.getAssignments().entrySet()) { if (!aggColumnLayout.containsKey(entry.getKey()) - && entry.getValue().getColumnCategory() == MEASUREMENT) { + && entry.getValue().getColumnCategory() == FIELD) { measurementColumnCount++; measurementColumnNames.add(entry.getValue().getName()); measurementSchemas.add( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertNode.java index 9161d7ca26ae..06ba52e78b3f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertNode.java @@ -159,15 +159,13 @@ public int measureColumnCnt() { return measurements.length; } return (int) - Arrays.stream(columnCategories) - .filter(col -> col == TsTableColumnCategory.MEASUREMENT) - .count(); + Arrays.stream(columnCategories).filter(col -> col == TsTableColumnCategory.FIELD).count(); } public boolean isValidMeasurement(int i) { return measurementSchemas != null && measurementSchemas[i] != null - && (columnCategories == null || columnCategories[i] == TsTableColumnCategory.MEASUREMENT); + && (columnCategories == null || columnCategories[i] == TsTableColumnCategory.FIELD); } public void setMeasurements(String[] measurements) { @@ -380,7 +378,7 @@ public void setColumnCategories(TsTableColumnCategory[] columnCategories) { if (columnCategories != null) { idColumnIndices = new ArrayList<>(); for (int i = 0; i < columnCategories.length; i++) { - if (columnCategories[i].equals(TsTableColumnCategory.ID)) { + if (columnCategories[i].equals(TsTableColumnCategory.TAG)) { idColumnIndices.add(i); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java index 5ec2fda249ac..53a67acb4731 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java @@ -1580,7 +1580,7 @@ private Scope computeAndAssignOutputScope( Field.newUnqualified( field.map(Identifier::getValue), analysis.getType(expression), - TsTableColumnCategory.MEASUREMENT, + TsTableColumnCategory.FIELD, originTable, originColumn, column.getAlias().isPresent()); // TODO don't use analysis as a side-channel. Use @@ -1975,7 +1975,7 @@ protected Scope visitValues(Values node, Optional scope) { .map( valueType -> Field.newUnqualified( - Optional.empty(), valueType, TsTableColumnCategory.MEASUREMENT)) + Optional.empty(), valueType, TsTableColumnCategory.FIELD)) .collect(toImmutableList()); return createAndAssignScope(node, scope, fields); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/ConvertPredicateToFilterVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/ConvertPredicateToFilterVisitor.java index 627b168724d9..1303584edc9d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/ConvertPredicateToFilterVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/ConvertPredicateToFilterVisitor.java @@ -424,7 +424,7 @@ public Type getType(Symbol symbol) { public boolean isMeasurementColumn(SymbolReference symbolReference) { ColumnSchema schema = schemaMap.get(Symbol.from(symbolReference)); - return schema != null && schema.getColumnCategory() == TsTableColumnCategory.MEASUREMENT; + return schema != null && schema.getColumnCategory() == TsTableColumnCategory.FIELD; } } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/CheckSchemaPredicateVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/CheckSchemaPredicateVisitor.java index 9bcc6f869e32..435d1e4cc0c6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/CheckSchemaPredicateVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/CheckSchemaPredicateVisitor.java @@ -107,9 +107,9 @@ private boolean processColumn(final Expression node, final Context context) { return true; } if (schema.getColumnCategory() == TsTableColumnCategory.TIME - || schema.getColumnCategory() == TsTableColumnCategory.MEASUREMENT) { + || schema.getColumnCategory() == TsTableColumnCategory.FIELD) { throw new SemanticException( - "The TIME/MEASUREMENT columns are currently not allowed in devices related operations"); + "The TIME/FIELD columns are currently not allowed in devices related operations"); } return schema.getColumnCategory().equals(TsTableColumnCategory.ATTRIBUTE); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/ConvertSchemaPredicateToFilterVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/ConvertSchemaPredicateToFilterVisitor.java index 816a546b3907..08f863211813 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/ConvertSchemaPredicateToFilterVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/ConvertSchemaPredicateToFilterVisitor.java @@ -238,7 +238,7 @@ private SchemaFilter wrapIdOrAttributeFilter( .table .getColumnSchema(columnName) .getColumnCategory() - .equals(TsTableColumnCategory.ID) + .equals(TsTableColumnCategory.TAG) ? new IdFilter(filter, context.idColumnIndexMap.get(columnName)) : new AttributeFilter(filter, columnName); } @@ -258,7 +258,7 @@ private Map getIdColumnIndex(final TsTable table) { List columnSchemaList = table.getColumnList(); int idIndex = 0; for (TsTableColumnSchema columnSchema : columnSchemaList) { - if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.ID)) { + if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.TAG)) { map.put(columnSchema.getColumnName(), idIndex); idIndex++; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableSchema.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableSchema.java index f67fed6ca801..df7adc32ad48 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableSchema.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableSchema.java @@ -191,7 +191,7 @@ public String toString() { public List getIdColumns() { return columns.stream() - .filter(c -> c.getColumnCategory() == TsTableColumnCategory.ID) + .filter(c -> c.getColumnCategory() == TsTableColumnCategory.TAG) .collect(Collectors.toList()); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaFetcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaFetcher.java index c6d6fc3a3726..0f0774880c6d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaFetcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableDeviceSchemaFetcher.java @@ -468,7 +468,7 @@ private void constructNodsArrayAndAttributeMap( if (columnSchema == null) { continue; } - if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.ID)) { + if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.TAG)) { if (columns[j].isNull(rowIndex)) { nodes[currentIndex] = null; } else { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableHeaderSchemaValidator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableHeaderSchemaValidator.java index 70850f6712b0..efa8ad2a97b1 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableHeaderSchemaValidator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableHeaderSchemaValidator.java @@ -22,8 +22,8 @@ import org.apache.iotdb.commons.exception.IoTDBException; import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.column.AttributeColumnSchema; -import org.apache.iotdb.commons.schema.table.column.IdColumnSchema; -import org.apache.iotdb.commons.schema.table.column.MeasurementColumnSchema; +import org.apache.iotdb.commons.schema.table.column.FieldColumnSchema; +import org.apache.iotdb.commons.schema.table.column.TagColumnSchema; import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory; import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema; import org.apache.iotdb.db.conf.IoTDBDescriptor; @@ -280,12 +280,12 @@ private void addColumnSchema(final List columnSchemas, final TsTab public static TsTableColumnSchema generateColumnSchema( final TsTableColumnCategory category, final String columnName, final TSDataType dataType) { switch (category) { - case ID: + case TAG: if (!TSDataType.STRING.equals(dataType)) { throw new SemanticException( - "DataType of ID Column should only be STRING, current is " + dataType); + "DataType of TAG Column should only be STRING, current is " + dataType); } - return new IdColumnSchema(columnName, dataType); + return new TagColumnSchema(columnName, dataType); case ATTRIBUTE: if (!TSDataType.STRING.equals(dataType)) { throw new SemanticException( @@ -295,8 +295,8 @@ public static TsTableColumnSchema generateColumnSchema( case TIME: throw new SemanticException( "Create table or add column statement shall not specify column category TIME"); - case MEASUREMENT: - return new MeasurementColumnSchema( + case FIELD: + return new FieldColumnSchema( columnName, dataType, getDefaultEncoding(dataType), @@ -341,11 +341,11 @@ private List parseInputColumnSchema( final List columnSchemaList = new ArrayList<>(inputColumnList.size()); for (final ColumnSchema inputColumn : inputColumnList) { switch (inputColumn.getColumnCategory()) { - case ID: + case TAG: if (!inputColumn.getType().equals(StringType.STRING)) { throw new SemanticException("Id column only support data type STRING."); } - columnSchemaList.add(new IdColumnSchema(inputColumn.getName(), TSDataType.STRING)); + columnSchemaList.add(new TagColumnSchema(inputColumn.getName(), TSDataType.STRING)); break; case ATTRIBUTE: if (!inputColumn.getType().equals(StringType.STRING)) { @@ -353,10 +353,10 @@ private List parseInputColumnSchema( } columnSchemaList.add(new AttributeColumnSchema(inputColumn.getName(), TSDataType.STRING)); break; - case MEASUREMENT: + case FIELD: final TSDataType dataType = InternalTypeManager.getTSDataType(inputColumn.getType()); columnSchemaList.add( - new MeasurementColumnSchema( + new FieldColumnSchema( inputColumn.getName(), dataType, getDefaultEncoding(dataType), diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCache.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCache.java index 5fb056671b26..70012e293740 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCache.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCache.java @@ -246,7 +246,7 @@ public void initOrInvalidateLastCache( /** * Update the last cache in writing or the second push of last cache query. If a measurement is - * with all {@code null}s or is an id/attribute column, its {@link TimeValuePair}[] shall be + * with all {@code null}s or is a tag/attribute column, its {@link TimeValuePair}[] shall be * {@code null}. For correctness, this will put the cache lazily and only update the existing last * caches of measurements. * diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java index 6d97a4ed9d6f..e825245f16e6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java @@ -191,7 +191,7 @@ protected RelationPlan visitTable(Table table, Void context) { symbol, new ColumnSchema( field.getName().orElse(null), field.getType(), field.isHidden(), category)); - if (category == TsTableColumnCategory.ID) { + if (category == TsTableColumnCategory.TAG) { idAndAttributeIndexMap.put(symbol, idIndex++); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java index dbab02fcf2c6..470d616f44da 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java @@ -809,7 +809,7 @@ private void processSortProperty( break; } if (deviceTableScanNode.getAssignments().get(symbol).getColumnCategory() - == TsTableColumnCategory.ID) { + == TsTableColumnCategory.TAG) { // segments[0] is always tableName orderingRules.add(deviceEntry -> (String) deviceEntry.getNthSegment(idx + 1)); } else { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/node/TableScanNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/node/TableScanNode.java index 2fd3764901e1..8c6dcf331295 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/node/TableScanNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/node/TableScanNode.java @@ -43,7 +43,7 @@ import java.util.stream.Collectors; import static com.google.common.base.Preconditions.checkArgument; -import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.MEASUREMENT; +import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.FIELD; import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.TIME; public abstract class TableScanNode extends SourceNode { @@ -125,7 +125,7 @@ public List getIdColumnsInTableStore(Metadata metadata, SessionInfo sess metadata.getTableSchema(session, qualifiedObjectName).orElse(null)) .getColumns() .stream() - .filter(columnSchema -> columnSchema.getColumnCategory() == TsTableColumnCategory.ID) + .filter(columnSchema -> columnSchema.getColumnCategory() == TsTableColumnCategory.TAG) .map(columnSchema -> Symbol.of(columnSchema.getName())) .collect(Collectors.toList()); } @@ -133,8 +133,7 @@ public List getIdColumnsInTableStore(Metadata metadata, SessionInfo sess public boolean isMeasurementOrTimeColumn(Symbol symbol) { ColumnSchema columnSchema = assignments.get(symbol); return columnSchema != null - && (columnSchema.getColumnCategory() == MEASUREMENT - || columnSchema.getColumnCategory() == TIME); + && (columnSchema.getColumnCategory() == FIELD || columnSchema.getColumnCategory() == TIME); } public boolean isTimeColumn(Symbol symbol) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushLimitOffsetIntoTableScan.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushLimitOffsetIntoTableScan.java index a91a34d4a0a4..40995bc094bc 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushLimitOffsetIntoTableScan.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushLimitOffsetIntoTableScan.java @@ -193,8 +193,7 @@ public PlanNode visitSort(SortNode node, Context context) { // order by measurement or expression, can not push down limit if (!tableColumnSchema.containsKey(orderBy) - || tableColumnSchema.get(orderBy).getColumnCategory() - == TsTableColumnCategory.MEASUREMENT) { + || tableColumnSchema.get(orderBy).getColumnCategory() == TsTableColumnCategory.FIELD) { context.enablePushDown = false; return node; } @@ -204,7 +203,7 @@ public PlanNode visitSort(SortNode node, Context context) { boolean pushLimitToEachDevice = false; for (Map.Entry entry : tableColumnSchema.entrySet()) { - if (entry.getValue().getColumnCategory() == TsTableColumnCategory.ID + if (entry.getValue().getColumnCategory() == TsTableColumnCategory.TAG && !sortSymbols.contains(entry.getKey())) { pushLimitToEachDevice = true; break; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java index 420e682f7237..fefdbf6f605b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java @@ -79,7 +79,7 @@ import static com.google.common.collect.ImmutableMap.toImmutableMap; import static java.util.Objects.requireNonNull; import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.ATTRIBUTE; -import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.MEASUREMENT; +import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.FIELD; import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.TIME; import static org.apache.iotdb.db.queryengine.metric.QueryPlanCostMetricSet.PARTITION_FETCHER; import static org.apache.iotdb.db.queryengine.metric.QueryPlanCostMetricSet.SCHEMA_FETCHER; @@ -378,7 +378,7 @@ private SplitExpression splitPredicate(DeviceTableScanNode node, Expression pred if (TIME.equals(columnSchema.getColumnCategory())) { measurementColumnNames.add(columnSymbol.getName()); timeColumnName = columnSymbol.getName(); - } else if (MEASUREMENT.equals(columnSchema.getColumnCategory())) { + } else if (FIELD.equals(columnSchema.getColumnCategory())) { measurementColumnNames.add(columnSymbol.getName()); } else { idOrAttributeColumnNames.add(columnSymbol.getName()); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/TransformAggregationToStreamable.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/TransformAggregationToStreamable.java index 3dd93067a883..340d9ebf5929 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/TransformAggregationToStreamable.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/TransformAggregationToStreamable.java @@ -38,7 +38,7 @@ import java.util.stream.Collectors; import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.ATTRIBUTE; -import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.ID; +import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.TAG; /** * Optimization phase: Logical plan planning. @@ -130,7 +130,7 @@ public List visitDeviceTableScan(DeviceTableScanNode node, GroupContext k -> { ColumnSchema columnSchema = assignments.get(k); if (columnSchema != null) { - return columnSchema.getColumnCategory() == ID + return columnSchema.getColumnCategory() == TAG || columnSchema.getColumnCategory() == ATTRIBUTE; } return false; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/TransformSortToStreamSort.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/TransformSortToStreamSort.java index cd5a5681e6b2..c514a46746b8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/TransformSortToStreamSort.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/TransformSortToStreamSort.java @@ -96,8 +96,7 @@ public PlanNode visitSort(SortNode node, Context context) { int streamSortIndex = -1; for (Symbol orderBy : orderingScheme.getOrderBy()) { if (!tableColumnSchema.containsKey(orderBy) - || tableColumnSchema.get(orderBy).getColumnCategory() - == TsTableColumnCategory.MEASUREMENT + || tableColumnSchema.get(orderBy).getColumnCategory() == TsTableColumnCategory.FIELD || tableColumnSchema.get(orderBy).getColumnCategory() == TsTableColumnCategory.TIME) { break; } else { @@ -152,7 +151,7 @@ public static boolean isOrderByAllIdsAndTime( OrderingScheme orderingScheme, int streamSortIndex) { for (Map.Entry entry : tableColumnSchema.entrySet()) { - if (entry.getValue().getColumnCategory() == TsTableColumnCategory.ID + if (entry.getValue().getColumnCategory() == TsTableColumnCategory.TAG && !orderingScheme.getOrderings().containsKey(entry.getKey())) { return false; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/AbstractQueryDeviceWithCache.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/AbstractQueryDeviceWithCache.java index 2dbf3c7aded0..6617999b4b51 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/AbstractQueryDeviceWithCache.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/AbstractQueryDeviceWithCache.java @@ -77,7 +77,7 @@ public static List getDeviceColumnHeaderList( return DataNodeTableCache.getInstance().getTable(database, tableName).getColumnList().stream() .filter( columnSchema -> - columnSchema.getColumnCategory().equals(TsTableColumnCategory.ID) + columnSchema.getColumnCategory().equals(TsTableColumnCategory.TAG) || columnSchema.getColumnCategory().equals(TsTableColumnCategory.ATTRIBUTE)) .map( columnSchema -> diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/ColumnDefinition.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/ColumnDefinition.java index ad8d4685cf77..4782431165be 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/ColumnDefinition.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/ColumnDefinition.java @@ -63,7 +63,7 @@ public ColumnDefinition( this.name = requireNonNull(name, "name is null"); this.columnCategory = requireNonNull(columnCategory, "columnCategory is null"); if (Objects.isNull(type)) { - if ((columnCategory == TsTableColumnCategory.ID + if ((columnCategory == TsTableColumnCategory.TAG || columnCategory == TsTableColumnCategory.ATTRIBUTE)) { type = new GenericDataType(new Identifier("string"), new ArrayList<>()); } else if (columnCategory == TsTableColumnCategory.TIME) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/WrappedInsertStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/WrappedInsertStatement.java index 60e3dddfa084..43b09decdef0 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/WrappedInsertStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/WrappedInsertStatement.java @@ -171,7 +171,7 @@ public static void validateTableSchema( new SemanticException( "Column " + incoming.getName() + " does not exists or fails to be " + "created", TSStatusCode.COLUMN_NOT_EXISTS.getStatusCode()); - if (incoming.getColumnCategory() != TsTableColumnCategory.MEASUREMENT + if (incoming.getColumnCategory() != TsTableColumnCategory.FIELD || !IoTDBDescriptor.getInstance().getConfig().isEnablePartialInsert()) { // non-measurement columns cannot be partially inserted throw semanticException; @@ -181,8 +181,7 @@ public static void validateTableSchema( return; } } - if (incoming.getType() == null - || incoming.getColumnCategory() != TsTableColumnCategory.MEASUREMENT) { + if (incoming.getType() == null || incoming.getColumnCategory() != TsTableColumnCategory.FIELD) { // sql insertion does not provide type // the type is inferred and can be inconsistent with the existing one innerTreeStatement.setDataType(InternalTypeManager.getTSDataType(real.getType()), i); @@ -195,7 +194,7 @@ public static void validateTableSchema( "Incompatible data type of column %s: %s/%s", incoming.getName(), incoming.getType(), real.getType()), TSStatusCode.DATA_TYPE_MISMATCH.getStatusCode()); - if (incoming.getColumnCategory() != TsTableColumnCategory.MEASUREMENT + if (incoming.getColumnCategory() != TsTableColumnCategory.FIELD || !IoTDBDescriptor.getInstance().getConfig().isEnablePartialInsert()) { // non-measurement columns cannot be partially inserted throw semanticException; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java index 8d0be07798aa..d3b38af0f581 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java @@ -225,8 +225,8 @@ import static java.util.stream.Collectors.toList; import static org.apache.iotdb.commons.schema.table.TsTable.TIME_COLUMN_NAME; import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.ATTRIBUTE; -import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.ID; -import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.MEASUREMENT; +import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.FIELD; +import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.TAG; import static org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory.TIME; import static org.apache.iotdb.commons.udf.builtin.relational.TableBuiltinScalarFunction.DATE_BIN; import static org.apache.iotdb.db.queryengine.plan.execution.config.TableConfigTaskVisitor.DATABASE_NOT_SPECIFIED; @@ -2512,19 +2512,19 @@ private Optional getIdentifierIfPresent(ParserRuleContext context) { return Optional.ofNullable(context).map(c -> (Identifier) visit(c)); } - private static TsTableColumnCategory getColumnCategory(Token category) { + private static TsTableColumnCategory getColumnCategory(final Token category) { if (category == null) { - return MEASUREMENT; + return FIELD; } switch (category.getType()) { - case RelationalSqlLexer.ID: - return ID; + case RelationalSqlLexer.TAG: + return TAG; case RelationalSqlLexer.ATTRIBUTE: return ATTRIBUTE; case RelationalSqlLexer.TIME: return TIME; - case RelationalSqlLexer.MEASUREMENT: - return MEASUREMENT; + case RelationalSqlLexer.FIELD: + return FIELD; default: throw new UnsupportedOperationException( "Unsupported ColumnCategory: " + category.getText()); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java index c9725f26f9e4..eb6da0bc2ffa 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java @@ -305,7 +305,7 @@ public List getIdColumnIndices() { if (idColumnIndices == null && columnCategories != null) { idColumnIndices = new ArrayList<>(); for (int i = 0; i < columnCategories.length; i++) { - if (columnCategories[i].equals(TsTableColumnCategory.ID)) { + if (columnCategories[i].equals(TsTableColumnCategory.TAG)) { idColumnIndices.add(i); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/CompactionTableSchema.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/CompactionTableSchema.java index 5751c4beb824..7aab249022f4 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/CompactionTableSchema.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/CompactionTableSchema.java @@ -48,7 +48,7 @@ public void merge(TableSchema tableSchema) { for (int i = 0; i < otherSchemaColumnCategories.size(); i++) { ColumnCategory columnCategory = otherSchemaColumnCategories.get(i); - if (columnCategory != ColumnCategory.ID) { + if (columnCategory != ColumnCategory.TAG) { continue; } idColumnSchemasToMerge.add(otherSchemaColumnSchemas.get(i)); @@ -72,7 +72,7 @@ public void merge(TableSchema tableSchema) { List newIdColumns = idColumnSchemasToMerge.subList(prefixLength, idColumnSchemasToMerge.size()); for (IMeasurementSchema newIdColumn : newIdColumns) { - columnCategories.add(ColumnCategory.ID); + columnCategories.add(ColumnCategory.TAG); measurementSchemas.add(newIdColumn); } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileWriter.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileWriter.java index fe7bd7ee8cb1..7d89747d2f65 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileWriter.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileWriter.java @@ -160,7 +160,7 @@ private void removeUnusedTableSchema() { while (iterator.hasNext()) { Map.Entry entry = iterator.next(); List columnTypes = entry.getValue().getColumnTypes(); - if (columnTypes.contains(ColumnCategory.MEASUREMENT)) { + if (columnTypes.contains(ColumnCategory.FIELD)) { continue; } iterator.remove(); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java index 19de8cebc9ce..027de99166ba 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java @@ -248,7 +248,7 @@ public int insertAlignedRow(InsertRowNode insertRowNode) { if (measurements[i] == null || values[i] == null || insertRowNode.getColumnCategories() != null - && insertRowNode.getColumnCategories()[i] != TsTableColumnCategory.MEASUREMENT) { + && insertRowNode.getColumnCategories()[i] != TsTableColumnCategory.FIELD) { schemaList.add(null); continue; } @@ -359,7 +359,7 @@ public void writeAlignedTablet( for (int i = 0; i < insertTabletNode.getMeasurementSchemas().length; i++) { if (insertTabletNode.getColumns()[i] == null || (insertTabletNode.getColumnCategories() != null - && insertTabletNode.getColumnCategories()[i] != TsTableColumnCategory.MEASUREMENT)) { + && insertTabletNode.getColumnCategories()[i] != TsTableColumnCategory.FIELD)) { schemaList.add(null); } else { schemaList.add(insertTabletNode.getMeasurementSchemas()[i]); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java index f5c176521aad..3bef961ce793 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java @@ -750,8 +750,7 @@ private long[] checkAlignedMemCostAndAddToTspInfoForRow( // Skip failed Measurements if (dataTypes[i] == null || measurements[i] == null - || (columnCategories != null - && columnCategories[i] != TsTableColumnCategory.MEASUREMENT)) { + || (columnCategories != null && columnCategories[i] != TsTableColumnCategory.FIELD)) { continue; } @@ -810,7 +809,7 @@ private long[] checkAlignedMemCostAndAddToTspInfoForRows(List ins if (dataTypes[i] == null || measurements[i] == null || (insertRowNode.getColumnCategories() != null - && insertRowNode.getColumnCategories()[i] != TsTableColumnCategory.MEASUREMENT)) { + && insertRowNode.getColumnCategories()[i] != TsTableColumnCategory.FIELD)) { continue; } increasingMemTableInfo @@ -834,7 +833,7 @@ private long[] checkAlignedMemCostAndAddToTspInfoForRows(List ins if (dataTypes[i] == null || measurements[i] == null || (insertRowNode.getColumnCategories() != null - && insertRowNode.getColumnCategories()[i] != TsTableColumnCategory.MEASUREMENT)) { + && insertRowNode.getColumnCategories()[i] != TsTableColumnCategory.FIELD)) { continue; } @@ -873,7 +872,7 @@ private long[] checkAlignedMemCostAndAddToTspInfoForRows(List ins if (dataTypes[i] == null || measurements[i] == null || (insertRowNode.getColumnCategories() != null - && insertRowNode.getColumnCategories()[i] != TsTableColumnCategory.MEASUREMENT)) { + && insertRowNode.getColumnCategories()[i] != TsTableColumnCategory.FIELD)) { continue; } // TEXT data mem size @@ -1013,7 +1012,7 @@ private void updateAlignedMemCost( measurementColumnNum = dataTypes.length; } else { for (TsTableColumnCategory columnCategory : columnCategories) { - if (columnCategory == TsTableColumnCategory.MEASUREMENT) { + if (columnCategory == TsTableColumnCategory.FIELD) { measurementColumnNum++; } } @@ -1047,8 +1046,7 @@ private void updateAlignedMemCost( if (dataType == null || column == null || measurement == null - || (columnCategories != null - && columnCategories[i] != TsTableColumnCategory.MEASUREMENT)) { + || (columnCategories != null && columnCategories[i] != TsTableColumnCategory.FIELD)) { continue; } @@ -1086,8 +1084,7 @@ private void updateAlignedMemCost( if (dataType == null || column == null || measurement == null - || (columnCategories != null - && columnCategories[i] != TsTableColumnCategory.MEASUREMENT)) { + || (columnCategories != null && columnCategories[i] != TsTableColumnCategory.FIELD)) { continue; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java index 99f5577b3669..36cd56168208 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java @@ -379,7 +379,7 @@ public static Object createValueColumnOfDataType( break; case TEXT: case STRING: - if (columnCategory.equals(TsTableColumnCategory.MEASUREMENT)) { + if (columnCategory.equals(TsTableColumnCategory.FIELD)) { valueColumn = new Binary[rowNum]; } else { valueColumn = new String[rowNum]; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/MemUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/MemUtils.java index 3f2e5327fec4..843bcdb8937c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/MemUtils.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/MemUtils.java @@ -89,7 +89,7 @@ public static long getAlignedRowRecordSize( for (int i = 0; i < dataTypes.size(); i++) { if (value[i] == null || dataTypes.get(i).isBinary() - || columnCategories != null && columnCategories[i] != TsTableColumnCategory.MEASUREMENT) { + || columnCategories != null && columnCategories[i] != TsTableColumnCategory.FIELD) { continue; } memSize += dataTypes.get(i).getDataTypeSize(); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java index 5d5a6e2b41c9..b146b25c2abd 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java @@ -940,8 +940,7 @@ public static long alignedTvListArrayMemCost( for (int i = 0; i < types.length; i++) { TSDataType type = types[i]; if (type != null - && (columnCategories == null - || columnCategories[i] == TsTableColumnCategory.MEASUREMENT)) { + && (columnCategories == null || columnCategories[i] == TsTableColumnCategory.FIELD)) { size += (long) ARRAY_SIZE * (long) type.getDataTypeSize(); measurementColumnNum++; } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionSimpleRecoverTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionSimpleRecoverTest.java index 25685bd9794a..7ffeda60a791 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionSimpleRecoverTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionSimpleRecoverTest.java @@ -26,7 +26,7 @@ import org.apache.iotdb.commons.schema.filter.impl.values.InFilter; import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.column.AttributeColumnSchema; -import org.apache.iotdb.commons.schema.table.column.IdColumnSchema; +import org.apache.iotdb.commons.schema.table.column.TagColumnSchema; import org.apache.iotdb.consensus.ConsensusFactory; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.queryengine.common.SessionInfo; @@ -283,7 +283,7 @@ public void testRecoverAfterCreateAndUpdateDevice() throws Exception { columnHeaderList.forEach( columnHeader -> testTable.addColumnSchema( - new IdColumnSchema(columnHeader.getColumnName(), columnHeader.getColumnType()))); + new TagColumnSchema(columnHeader.getColumnName(), columnHeader.getColumnType()))); testTable.addColumnSchema(new AttributeColumnSchema(attributeName, TSDataType.STRING)); DataNodeTableCache.getInstance().preUpdateTable(database, testTable); DataNodeTableCache.getInstance().commitUpdateTable(database, tableName); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGeneratorTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGeneratorTest.java index 968db18a0655..9abe74153a0c 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGeneratorTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGeneratorTest.java @@ -215,9 +215,9 @@ public void testInsertRelationalTablet() throws IllegalPathException { List dataTypes = Arrays.asList(TSDataType.TEXT, TSDataType.TEXT, TSDataType.DOUBLE); List tsfileColumnCategories = Arrays.asList( - Tablet.ColumnCategory.ID, + Tablet.ColumnCategory.TAG, Tablet.ColumnCategory.ATTRIBUTE, - Tablet.ColumnCategory.MEASUREMENT); + Tablet.ColumnCategory.FIELD); List columnCategories = tsfileColumnCategories.stream() .map(TsTableColumnCategory::fromTsFileColumnType) @@ -251,7 +251,7 @@ public void testTabletInsertColumn() { ColumnSchema columnSchema = new ColumnSchema( - "s1", TypeFactory.getType(TSDataType.STRING), false, TsTableColumnCategory.ID); + "s1", TypeFactory.getType(TSDataType.STRING), false, TsTableColumnCategory.TAG); insertTabletStatement.insertColumn(insertPos, columnSchema); assertEquals(4, insertTabletStatement.getMeasurements().length); assertEquals(columnSchema.getName(), insertTabletStatement.getMeasurements()[insertPos]); @@ -287,10 +287,7 @@ public void testTabletInsertColumn() { insertPos = 5; columnSchema = new ColumnSchema( - "s3", - TypeFactory.getType(TSDataType.BOOLEAN), - false, - TsTableColumnCategory.MEASUREMENT); + "s3", TypeFactory.getType(TSDataType.BOOLEAN), false, TsTableColumnCategory.FIELD); insertTabletStatement.insertColumn(insertPos, columnSchema); assertEquals(6, insertTabletStatement.getMeasurements().length); assertEquals(columnSchema.getName(), insertTabletStatement.getMeasurements()[insertPos]); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/InsertRowsNodeSerdeTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/InsertRowsNodeSerdeTest.java index 0a8f3bc3939f..1fcc77a3f01c 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/InsertRowsNodeSerdeTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/InsertRowsNodeSerdeTest.java @@ -170,11 +170,11 @@ public void TestSerializeAndDeserializeRelational() throws IllegalPathException }, false, new TsTableColumnCategory[] { - TsTableColumnCategory.ID, + TsTableColumnCategory.TAG, TsTableColumnCategory.ATTRIBUTE, - TsTableColumnCategory.MEASUREMENT, - TsTableColumnCategory.MEASUREMENT, - TsTableColumnCategory.MEASUREMENT + TsTableColumnCategory.FIELD, + TsTableColumnCategory.FIELD, + TsTableColumnCategory.FIELD }), 0); @@ -189,9 +189,9 @@ public void TestSerializeAndDeserializeRelational() throws IllegalPathException new Object[] {2.0, false}, false, new TsTableColumnCategory[] { - TsTableColumnCategory.ID, + TsTableColumnCategory.TAG, TsTableColumnCategory.ATTRIBUTE, - TsTableColumnCategory.MEASUREMENT + TsTableColumnCategory.FIELD }), 1); @@ -236,11 +236,11 @@ public void testSerializeAndDeserializeForWALRelational() throws IOException { }, false, new TsTableColumnCategory[] { - TsTableColumnCategory.ID, + TsTableColumnCategory.TAG, TsTableColumnCategory.ATTRIBUTE, - TsTableColumnCategory.MEASUREMENT, - TsTableColumnCategory.MEASUREMENT, - TsTableColumnCategory.MEASUREMENT + TsTableColumnCategory.FIELD, + TsTableColumnCategory.FIELD, + TsTableColumnCategory.FIELD }), 0); @@ -259,7 +259,7 @@ public void testSerializeAndDeserializeForWALRelational() throws IOException { new Object[] {2.0, false}, false, new TsTableColumnCategory[] { - TsTableColumnCategory.ID, TsTableColumnCategory.ATTRIBUTE + TsTableColumnCategory.TAG, TsTableColumnCategory.ATTRIBUTE }), 1); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/InsertTabletNodeSerdeTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/InsertTabletNodeSerdeTest.java index 69587fbd9d71..420b7e7b73fd 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/InsertTabletNodeSerdeTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/InsertTabletNodeSerdeTest.java @@ -311,11 +311,11 @@ private RelationalInsertTabletNode getRelationalInsertTabletNode(String tableNam columns, times.length, new TsTableColumnCategory[] { - TsTableColumnCategory.ID, - TsTableColumnCategory.MEASUREMENT, + TsTableColumnCategory.TAG, + TsTableColumnCategory.FIELD, TsTableColumnCategory.ATTRIBUTE, - TsTableColumnCategory.ID, - TsTableColumnCategory.MEASUREMENT + TsTableColumnCategory.TAG, + TsTableColumnCategory.FIELD }); return tabletNode; @@ -357,11 +357,11 @@ private RelationalInsertTabletNode getRelationalInsertTabletNodeWithSchema(Strin columns, times.length, new TsTableColumnCategory[] { - TsTableColumnCategory.ID, - TsTableColumnCategory.MEASUREMENT, + TsTableColumnCategory.TAG, + TsTableColumnCategory.FIELD, TsTableColumnCategory.ATTRIBUTE, - TsTableColumnCategory.ID, - TsTableColumnCategory.MEASUREMENT + TsTableColumnCategory.TAG, + TsTableColumnCategory.FIELD }); insertTabletNode.setMeasurementSchemas( new MeasurementSchema[] { diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/WritePlanNodeSplitTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/WritePlanNodeSplitTest.java index e0d3354d2b19..807186c26dae 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/WritePlanNodeSplitTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/WritePlanNodeSplitTest.java @@ -268,7 +268,7 @@ public void testSplitRelationalInsertTablet() throws IllegalPathException { new int[] {-20, -10, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100} }); relationalInsertTabletNode.setColumnCategories( - new TsTableColumnCategory[] {TsTableColumnCategory.ID, TsTableColumnCategory.MEASUREMENT}); + new TsTableColumnCategory[] {TsTableColumnCategory.TAG, TsTableColumnCategory.FIELD}); relationalInsertTabletNode.setRowCount(12); List dataPartitionQueryParamList = new ArrayList<>(); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/TSBSMetadata.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/TSBSMetadata.java index a34129a73f88..0a665fbed048 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/TSBSMetadata.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/TSBSMetadata.java @@ -146,13 +146,13 @@ public Optional getTableSchema(SessionInfo session, QualifiedObject columnSchemas.add( ColumnSchema.builder(TIME_CM).setColumnCategory(TsTableColumnCategory.TIME).build()); columnSchemas.add( - ColumnSchema.builder(NAME_CM).setColumnCategory(TsTableColumnCategory.ID).build()); + ColumnSchema.builder(NAME_CM).setColumnCategory(TsTableColumnCategory.TAG).build()); columnSchemas.add( - ColumnSchema.builder(FLEET_CM).setColumnCategory(TsTableColumnCategory.ID).build()); + ColumnSchema.builder(FLEET_CM).setColumnCategory(TsTableColumnCategory.TAG).build()); columnSchemas.add( - ColumnSchema.builder(DRIVER_CM).setColumnCategory(TsTableColumnCategory.ID).build()); + ColumnSchema.builder(DRIVER_CM).setColumnCategory(TsTableColumnCategory.TAG).build()); columnSchemas.add( - ColumnSchema.builder(MODEL_CM).setColumnCategory(TsTableColumnCategory.ID).build()); + ColumnSchema.builder(MODEL_CM).setColumnCategory(TsTableColumnCategory.TAG).build()); columnSchemas.add( ColumnSchema.builder(DEVICE_VERSION_CM) .setColumnCategory(TsTableColumnCategory.ATTRIBUTE) @@ -173,45 +173,35 @@ public Optional getTableSchema(SessionInfo session, QualifiedObject if (name.getObjectName().equalsIgnoreCase(TABLE_DIAGNOSTICS)) { columnSchemas.add( ColumnSchema.builder(FUEL_STATE_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) + .setColumnCategory(TsTableColumnCategory.FIELD) .build()); columnSchemas.add( ColumnSchema.builder(CURRENT_LOAD_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) + .setColumnCategory(TsTableColumnCategory.FIELD) .build()); columnSchemas.add( - ColumnSchema.builder(STATUS_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) - .build()); + ColumnSchema.builder(STATUS_CM).setColumnCategory(TsTableColumnCategory.FIELD).build()); return Optional.of(new TableSchema(TABLE_DIAGNOSTICS, columnSchemas)); } else if (name.getObjectName().equalsIgnoreCase(TABLE_READINGS)) { columnSchemas.add( - ColumnSchema.builder(LATITUDE_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) - .build()); + ColumnSchema.builder(LATITUDE_CM).setColumnCategory(TsTableColumnCategory.FIELD).build()); columnSchemas.add( ColumnSchema.builder(LONGITUDE_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) + .setColumnCategory(TsTableColumnCategory.FIELD) .build()); columnSchemas.add( ColumnSchema.builder(ELEVATION_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) + .setColumnCategory(TsTableColumnCategory.FIELD) .build()); columnSchemas.add( - ColumnSchema.builder(VELOCITY_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) - .build()); + ColumnSchema.builder(VELOCITY_CM).setColumnCategory(TsTableColumnCategory.FIELD).build()); columnSchemas.add( - ColumnSchema.builder(HEADING_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) - .build()); + ColumnSchema.builder(HEADING_CM).setColumnCategory(TsTableColumnCategory.FIELD).build()); columnSchemas.add( - ColumnSchema.builder(GRADE_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) - .build()); + ColumnSchema.builder(GRADE_CM).setColumnCategory(TsTableColumnCategory.FIELD).build()); columnSchemas.add( ColumnSchema.builder(FUEL_CONSUMPTION_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) + .setColumnCategory(TsTableColumnCategory.FIELD) .build()); return Optional.of(new TableSchema(TABLE_READINGS, columnSchemas)); } else { diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/TestMatadata.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/TestMatadata.java index a26aa6980853..8d2d32cdfcdb 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/TestMatadata.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/TestMatadata.java @@ -146,24 +146,18 @@ public Optional getTableSchema(SessionInfo session, QualifiedObject final List columnSchemas = Arrays.asList( ColumnSchema.builder(TIME_CM).setColumnCategory(TsTableColumnCategory.TIME).build(), - ColumnSchema.builder(TAG1_CM).setColumnCategory(TsTableColumnCategory.ID).build(), - ColumnSchema.builder(TAG2_CM).setColumnCategory(TsTableColumnCategory.ID).build(), - ColumnSchema.builder(TAG3_CM).setColumnCategory(TsTableColumnCategory.ID).build(), + ColumnSchema.builder(TAG1_CM).setColumnCategory(TsTableColumnCategory.TAG).build(), + ColumnSchema.builder(TAG2_CM).setColumnCategory(TsTableColumnCategory.TAG).build(), + ColumnSchema.builder(TAG3_CM).setColumnCategory(TsTableColumnCategory.TAG).build(), ColumnSchema.builder(ATTR1_CM) .setColumnCategory(TsTableColumnCategory.ATTRIBUTE) .build(), ColumnSchema.builder(ATTR2_CM) .setColumnCategory(TsTableColumnCategory.ATTRIBUTE) .build(), - ColumnSchema.builder(S1_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) - .build(), - ColumnSchema.builder(S2_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) - .build(), - ColumnSchema.builder(S3_CM) - .setColumnCategory(TsTableColumnCategory.MEASUREMENT) - .build()); + ColumnSchema.builder(S1_CM).setColumnCategory(TsTableColumnCategory.FIELD).build(), + ColumnSchema.builder(S2_CM).setColumnCategory(TsTableColumnCategory.FIELD).build(), + ColumnSchema.builder(S3_CM).setColumnCategory(TsTableColumnCategory.FIELD).build()); return Optional.of(new TableSchema(TABLE1, columnSchemas)); } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCacheTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCacheTest.java index edd3e67211bf..e04a16a2ff0e 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCacheTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCacheTest.java @@ -22,8 +22,8 @@ import org.apache.iotdb.commons.schema.column.ColumnHeader; import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.column.AttributeColumnSchema; -import org.apache.iotdb.commons.schema.table.column.IdColumnSchema; -import org.apache.iotdb.commons.schema.table.column.MeasurementColumnSchema; +import org.apache.iotdb.commons.schema.table.column.FieldColumnSchema; +import org.apache.iotdb.commons.schema.table.column.TagColumnSchema; import org.apache.iotdb.commons.schema.table.column.TimeColumnSchema; import org.apache.iotdb.db.conf.IoTDBConfig; import org.apache.iotdb.db.conf.IoTDBDescriptor; @@ -87,27 +87,27 @@ public static void prepareEnvironment() { columnHeaderList.forEach( columnHeader -> testTable1.addColumnSchema( - new IdColumnSchema(columnHeader.getColumnName(), columnHeader.getColumnType()))); + new TagColumnSchema(columnHeader.getColumnName(), columnHeader.getColumnType()))); testTable1.addColumnSchema(new AttributeColumnSchema(attributeName1, TSDataType.STRING)); testTable1.addColumnSchema(new AttributeColumnSchema(attributeName2, TSDataType.STRING)); testTable1.addColumnSchema(new TimeColumnSchema("time", TSDataType.INT64)); testTable1.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement1, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); testTable1.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement2, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); testTable1.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement3, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); testTable1.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement4, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); testTable1.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement5, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); testTable1.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement6, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); DataNodeTableCache.getInstance().preUpdateTable(database1, testTable1); DataNodeTableCache.getInstance().commitUpdateTable(database1, table1); @@ -119,27 +119,27 @@ public static void prepareEnvironment() { columnHeaderList.forEach( columnHeader -> testTable2.addColumnSchema( - new IdColumnSchema(columnHeader.getColumnName(), columnHeader.getColumnType()))); + new TagColumnSchema(columnHeader.getColumnName(), columnHeader.getColumnType()))); testTable2.addColumnSchema(new AttributeColumnSchema(attributeName1, TSDataType.STRING)); testTable2.addColumnSchema(new AttributeColumnSchema(attributeName2, TSDataType.STRING)); testTable2.addColumnSchema(new TimeColumnSchema("time", TSDataType.INT64)); testTable2.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement1, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); testTable2.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement2, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); testTable2.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement3, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); testTable2.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement4, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); testTable2.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement5, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); testTable2.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurement6, TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); DataNodeTableCache.getInstance().preUpdateTable(database1, testTable2); DataNodeTableCache.getInstance().commitUpdateTable(database1, table2); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/InsertTabletTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/InsertTabletTest.java index c5ffbf76d102..a78fabeb8658 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/InsertTabletTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/InsertTabletTest.java @@ -47,9 +47,9 @@ public void testWithNull() { new String[] {"deviceId_1", "deviceId_2", "attr1", "attr2", "measurement"}); innerStmt.setColumnCategories( new TsTableColumnCategory[] { - TsTableColumnCategory.ID, TsTableColumnCategory.ID, + TsTableColumnCategory.TAG, TsTableColumnCategory.TAG, TsTableColumnCategory.ATTRIBUTE, TsTableColumnCategory.ATTRIBUTE, - TsTableColumnCategory.MEASUREMENT + TsTableColumnCategory.FIELD }); innerStmt.setDataTypes( new TSDataType[] { diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/InsertStatementTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/InsertStatementTest.java index af0c4f01f6f6..098da8d321c0 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/InsertStatementTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/InsertStatementTest.java @@ -60,11 +60,11 @@ public void setUp() throws Exception { columnSchemas = Arrays.asList( new ColumnSchema( - "id1", TypeFactory.getType(TSDataType.STRING), false, TsTableColumnCategory.ID), + "id1", TypeFactory.getType(TSDataType.STRING), false, TsTableColumnCategory.TAG), new ColumnSchema( - "id2", TypeFactory.getType(TSDataType.STRING), false, TsTableColumnCategory.ID), + "id2", TypeFactory.getType(TSDataType.STRING), false, TsTableColumnCategory.TAG), new ColumnSchema( - "id3", TypeFactory.getType(TSDataType.STRING), false, TsTableColumnCategory.ID), + "id3", TypeFactory.getType(TSDataType.STRING), false, TsTableColumnCategory.TAG), new ColumnSchema( "attr1", TypeFactory.getType(TSDataType.STRING), @@ -76,20 +76,11 @@ public void setUp() throws Exception { false, TsTableColumnCategory.ATTRIBUTE), new ColumnSchema( - "m1", - TypeFactory.getType(TSDataType.DOUBLE), - false, - TsTableColumnCategory.MEASUREMENT), + "m1", TypeFactory.getType(TSDataType.DOUBLE), false, TsTableColumnCategory.FIELD), new ColumnSchema( - "m2", - TypeFactory.getType(TSDataType.DOUBLE), - false, - TsTableColumnCategory.MEASUREMENT), + "m2", TypeFactory.getType(TSDataType.DOUBLE), false, TsTableColumnCategory.FIELD), new ColumnSchema( - "m3", - TypeFactory.getType(TSDataType.INT64), - false, - TsTableColumnCategory.MEASUREMENT)); + "m3", TypeFactory.getType(TSDataType.INT64), false, TsTableColumnCategory.FIELD)); tableSchema = new TableSchema("table1", columnSchemas); when(metadata.validateTableHeaderSchema( any(String.class), @@ -121,11 +112,11 @@ public void testValidate() { }); insertRowStatement.setColumnCategories( new TsTableColumnCategory[] { - TsTableColumnCategory.ID, + TsTableColumnCategory.TAG, TsTableColumnCategory.ATTRIBUTE, - TsTableColumnCategory.MEASUREMENT, - TsTableColumnCategory.MEASUREMENT, - TsTableColumnCategory.ID + TsTableColumnCategory.FIELD, + TsTableColumnCategory.FIELD, + TsTableColumnCategory.TAG }); insertRowStatement.setValues(new String[] {"id2", "attr2", "m1", "m2", "id1"}); InsertRow insertRow = new InsertRow(insertRowStatement, queryContext); @@ -150,11 +141,11 @@ public void testValidate() { insertRowStatement.getDataTypes()); assertArrayEquals( new TsTableColumnCategory[] { - TsTableColumnCategory.ID, - TsTableColumnCategory.ID, - TsTableColumnCategory.ID, - TsTableColumnCategory.MEASUREMENT, - TsTableColumnCategory.MEASUREMENT, + TsTableColumnCategory.TAG, + TsTableColumnCategory.TAG, + TsTableColumnCategory.TAG, + TsTableColumnCategory.FIELD, + TsTableColumnCategory.FIELD, TsTableColumnCategory.ATTRIBUTE }, insertRowStatement.getColumnCategories()); @@ -168,7 +159,7 @@ public void testConflictCategory() { // category is ID in row but ATTRIBUTE in table insertRowStatement.setMeasurements(new String[] {"id1"}); insertRowStatement.setDataTypes(new TSDataType[] {TSDataType.STRING}); - insertRowStatement.setColumnCategories(new TsTableColumnCategory[] {TsTableColumnCategory.ID}); + insertRowStatement.setColumnCategories(new TsTableColumnCategory[] {TsTableColumnCategory.TAG}); insertRowStatement.setValues(new String[] {"id1"}); InsertRow insertRow = new InsertRow(insertRowStatement, null); @@ -201,7 +192,7 @@ public void testMissingIdColumn() { // id1 not in the table insertRowStatement.setMeasurements(new String[] {"id1"}); insertRowStatement.setDataTypes(new TSDataType[] {TSDataType.STRING}); - insertRowStatement.setColumnCategories(new TsTableColumnCategory[] {TsTableColumnCategory.ID}); + insertRowStatement.setColumnCategories(new TsTableColumnCategory[] {TsTableColumnCategory.TAG}); insertRowStatement.setValues(new String[] {"id1"}); InsertRow insertRow = new InsertRow(insertRowStatement, null); @@ -209,7 +200,7 @@ public void testMissingIdColumn() { columnSchemas = Collections.singletonList( new ColumnSchema( - "id2", TypeFactory.getType(TSDataType.STRING), false, TsTableColumnCategory.ID)); + "id2", TypeFactory.getType(TSDataType.STRING), false, TsTableColumnCategory.TAG)); tableSchema = new TableSchema("table1", columnSchemas); when(metadata.validateTableHeaderSchema( any(String.class), diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/StatementTestUtils.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/StatementTestUtils.java index 9392f4163d4a..a80095458a94 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/StatementTestUtils.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/StatementTestUtils.java @@ -22,8 +22,8 @@ import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.column.AttributeColumnSchema; -import org.apache.iotdb.commons.schema.table.column.IdColumnSchema; -import org.apache.iotdb.commons.schema.table.column.MeasurementColumnSchema; +import org.apache.iotdb.commons.schema.table.column.FieldColumnSchema; +import org.apache.iotdb.commons.schema.table.column.TagColumnSchema; import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory; import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeId; import org.apache.iotdb.db.queryengine.plan.planner.plan.node.write.RelationalInsertRowNode; @@ -76,7 +76,7 @@ public static MeasurementSchema[] genMeasurementSchemas() { public static TsTableColumnCategory[] genColumnCategories() { return new TsTableColumnCategory[] { - TsTableColumnCategory.ID, TsTableColumnCategory.ATTRIBUTE, TsTableColumnCategory.MEASUREMENT + TsTableColumnCategory.TAG, TsTableColumnCategory.ATTRIBUTE, TsTableColumnCategory.FIELD }; } @@ -238,16 +238,16 @@ public static TsTable genTsTable() { TsTableColumnCategory[] columnCategories = genColumnCategories(); for (int i = 0; i < columnCategories.length; i++) { switch (columnCategories[i]) { - case ID: - tsTable.addColumnSchema(new IdColumnSchema(measurements[i], dataTypes[i])); + case TAG: + tsTable.addColumnSchema(new TagColumnSchema(measurements[i], dataTypes[i])); break; case ATTRIBUTE: tsTable.addColumnSchema(new AttributeColumnSchema(measurements[i], dataTypes[i])); break; - case MEASUREMENT: + case FIELD: default: tsTable.addColumnSchema( - new MeasurementColumnSchema( + new FieldColumnSchema( measurements[i], dataTypes[i], TSEncoding.PLAIN, CompressionType.UNCOMPRESSED)); break; } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/CompactionTableModelTestFileWriter.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/CompactionTableModelTestFileWriter.java index d1403ed8e8cd..0e5fa29a41af 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/CompactionTableModelTestFileWriter.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/CompactionTableModelTestFileWriter.java @@ -55,7 +55,7 @@ public void registerTableSchema(String tableName, List idColumnNames) { measurementSchemas.add( new MeasurementSchema( idColumnName, TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED)); - columnTypes.add(ColumnCategory.ID); + columnTypes.add(ColumnCategory.TAG); } tableSchema.merge(new TableSchema(tableName, measurementSchemas, columnTypes)); schema.registerTableSchema(tableSchema); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/CompactionTableSchemaCollectorTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/CompactionTableSchemaCollectorTest.java index 9c445916eab4..9a627d27ea9f 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/CompactionTableSchemaCollectorTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/CompactionTableSchemaCollectorTest.java @@ -45,11 +45,11 @@ public void test1() { measurementSchemaList1.add(new MeasurementSchema("s1", TSDataType.INT32)); measurementSchemaList1.add(new MeasurementSchema("s2", TSDataType.INT32)); List columnTypeList1 = new ArrayList<>(); - columnTypeList1.add(ColumnCategory.ID); - columnTypeList1.add(ColumnCategory.ID); - columnTypeList1.add(ColumnCategory.ID); - columnTypeList1.add(ColumnCategory.MEASUREMENT); - columnTypeList1.add(ColumnCategory.MEASUREMENT); + columnTypeList1.add(ColumnCategory.TAG); + columnTypeList1.add(ColumnCategory.TAG); + columnTypeList1.add(ColumnCategory.TAG); + columnTypeList1.add(ColumnCategory.FIELD); + columnTypeList1.add(ColumnCategory.FIELD); TableSchema tableSchema1 = new TableSchema("t1", measurementSchemaList1, columnTypeList1); compactionTableSchema.merge(tableSchema1); Assert.assertEquals(3, compactionTableSchema.getColumnSchemas().size()); @@ -61,11 +61,11 @@ public void test1() { measurementSchemaList2.add(new MeasurementSchema("id3", TSDataType.STRING)); measurementSchemaList2.add(new MeasurementSchema("s2", TSDataType.INT32)); List columnTypeList2 = new ArrayList<>(); - columnTypeList2.add(ColumnCategory.MEASUREMENT); - columnTypeList2.add(ColumnCategory.ID); - columnTypeList2.add(ColumnCategory.ID); - columnTypeList2.add(ColumnCategory.ID); - columnTypeList2.add(ColumnCategory.MEASUREMENT); + columnTypeList2.add(ColumnCategory.FIELD); + columnTypeList2.add(ColumnCategory.TAG); + columnTypeList2.add(ColumnCategory.TAG); + columnTypeList2.add(ColumnCategory.TAG); + columnTypeList2.add(ColumnCategory.FIELD); TableSchema tableSchema2 = new TableSchema("t1", measurementSchemaList2, columnTypeList2); compactionTableSchema.merge(tableSchema2); Assert.assertEquals(3, compactionTableSchema.getColumnSchemas().size()); @@ -78,12 +78,12 @@ public void test1() { measurementSchemaList3.add(new MeasurementSchema("s2", TSDataType.INT32)); measurementSchemaList3.add(new MeasurementSchema("id4", TSDataType.STRING)); List columnTypeList3 = new ArrayList<>(); - columnTypeList3.add(ColumnCategory.MEASUREMENT); - columnTypeList3.add(ColumnCategory.ID); - columnTypeList3.add(ColumnCategory.ID); - columnTypeList3.add(ColumnCategory.ID); - columnTypeList3.add(ColumnCategory.MEASUREMENT); - columnTypeList3.add(ColumnCategory.ID); + columnTypeList3.add(ColumnCategory.FIELD); + columnTypeList3.add(ColumnCategory.TAG); + columnTypeList3.add(ColumnCategory.TAG); + columnTypeList3.add(ColumnCategory.TAG); + columnTypeList3.add(ColumnCategory.FIELD); + columnTypeList3.add(ColumnCategory.TAG); TableSchema tableSchema3 = new TableSchema("t1", measurementSchemaList3, columnTypeList3); compactionTableSchema.merge(tableSchema3); @@ -97,12 +97,12 @@ public void test1() { measurementSchemaList4.add(new MeasurementSchema("s2", TSDataType.INT32)); measurementSchemaList4.add(new MeasurementSchema("id3", TSDataType.STRING)); List columnTypeList4 = new ArrayList<>(); - columnTypeList4.add(ColumnCategory.MEASUREMENT); - columnTypeList4.add(ColumnCategory.ID); - columnTypeList4.add(ColumnCategory.ID); - columnTypeList4.add(ColumnCategory.ID); - columnTypeList4.add(ColumnCategory.MEASUREMENT); - columnTypeList4.add(ColumnCategory.ID); + columnTypeList4.add(ColumnCategory.FIELD); + columnTypeList4.add(ColumnCategory.TAG); + columnTypeList4.add(ColumnCategory.TAG); + columnTypeList4.add(ColumnCategory.TAG); + columnTypeList4.add(ColumnCategory.FIELD); + columnTypeList4.add(ColumnCategory.TAG); TableSchema tableSchema4 = new TableSchema("t1", measurementSchemaList4, columnTypeList4); try { compactionTableSchema.merge(tableSchema4); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/TableModelCompactionWithTTLTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/TableModelCompactionWithTTLTest.java index c5ac8d6a2c9f..c0181944e8a2 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/TableModelCompactionWithTTLTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/tablemodel/TableModelCompactionWithTTLTest.java @@ -21,8 +21,8 @@ import org.apache.iotdb.commons.exception.MetadataException; import org.apache.iotdb.commons.schema.table.TsTable; -import org.apache.iotdb.commons.schema.table.column.IdColumnSchema; -import org.apache.iotdb.commons.schema.table.column.MeasurementColumnSchema; +import org.apache.iotdb.commons.schema.table.column.FieldColumnSchema; +import org.apache.iotdb.commons.schema.table.column.TagColumnSchema; import org.apache.iotdb.db.exception.StorageEngineException; import org.apache.iotdb.db.schemaengine.table.DataNodeTableCache; import org.apache.iotdb.db.storageengine.dataregion.compaction.AbstractCompactionTest; @@ -179,10 +179,9 @@ public void testTableNotExist() throws IOException { public void createTable(String tableName, long ttl) { TsTable tsTable = new TsTable(tableName); - tsTable.addColumnSchema(new IdColumnSchema("id_column", TSDataType.STRING)); + tsTable.addColumnSchema(new TagColumnSchema("id_column", TSDataType.STRING)); tsTable.addColumnSchema( - new MeasurementColumnSchema( - "s1", TSDataType.STRING, TSEncoding.PLAIN, CompressionType.LZ4)); + new FieldColumnSchema("s1", TSDataType.STRING, TSEncoding.PLAIN, CompressionType.LZ4)); tsTable.addProp(TsTable.TTL_PROPERTY, ttl + ""); DataNodeTableCache.getInstance().preUpdateTable(this.COMPACTION_TEST_SG, tsTable); DataNodeTableCache.getInstance().commitUpdateTable(this.COMPACTION_TEST_SG, tableName); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/io/WALFileTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/io/WALFileTest.java index 95263f0ec2c8..762c54ac8d9d 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/io/WALFileTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/io/WALFileTest.java @@ -419,7 +419,7 @@ public static RelationalInsertTabletNode getRelationalInsertTabletNode(String ta columns, times.length, new TsTableColumnCategory[] { - TsTableColumnCategory.ID, TsTableColumnCategory.MEASUREMENT, + TsTableColumnCategory.TAG, TsTableColumnCategory.FIELD, }); } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformerTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformerTest.java index ac8a187d1875..391d27dcd32f 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformerTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/file/UnsealedTsFileRecoverPerformerTest.java @@ -22,7 +22,7 @@ import org.apache.iotdb.commons.path.MeasurementPath; import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.schema.table.TsTable; -import org.apache.iotdb.commons.schema.table.column.MeasurementColumnSchema; +import org.apache.iotdb.commons.schema.table.column.FieldColumnSchema; import org.apache.iotdb.db.conf.IoTDBConfig; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.exception.DataRegionException; @@ -188,7 +188,7 @@ public void testRedoRelationalInsertPlan() throws Exception { // fake table schema final TsTable testTable1 = new TsTable("table1"); testTable1.addColumnSchema( - new MeasurementColumnSchema("m1", TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); + new FieldColumnSchema("m1", TSDataType.INT32, TSEncoding.RLE, CompressionType.GZIP)); DataNodeTableCache.getInstance().preUpdateTable(SG_NAME, testTable1); DataNodeTableCache.getInstance().commitUpdateTable(SG_NAME, "table1"); // generate crashed .tsfile diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/InformationSchema.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/InformationSchema.java index a8b46fd29e89..f2f4e548d4ce 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/InformationSchema.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/InformationSchema.java @@ -21,7 +21,7 @@ import org.apache.iotdb.commons.schema.column.ColumnHeaderConstant; import org.apache.iotdb.commons.schema.table.column.AttributeColumnSchema; -import org.apache.iotdb.commons.schema.table.column.IdColumnSchema; +import org.apache.iotdb.commons.schema.table.column.TagColumnSchema; import org.apache.tsfile.enums.TSDataType; @@ -41,7 +41,7 @@ public class InformationSchema { static { final TsTable queriesTable = new TsTable(QUERIES); queriesTable.addColumnSchema( - new IdColumnSchema(ColumnHeaderConstant.QUERY_ID_TABLE_MODEL, TSDataType.STRING)); + new TagColumnSchema(ColumnHeaderConstant.QUERY_ID_TABLE_MODEL, TSDataType.STRING)); queriesTable.addColumnSchema( new AttributeColumnSchema( ColumnHeaderConstant.QUERY_ID_START_TIME_TABLE_MODEL, TSDataType.TIMESTAMP)); @@ -57,7 +57,7 @@ public class InformationSchema { final TsTable databaseTable = new TsTable(DATABASES); databaseTable.addColumnSchema( - new IdColumnSchema( + new TagColumnSchema( ColumnHeaderConstant.DATABASE.toLowerCase(Locale.ENGLISH), TSDataType.STRING)); databaseTable.addColumnSchema( new AttributeColumnSchema( @@ -82,10 +82,10 @@ public class InformationSchema { final TsTable tableTable = new TsTable(TABLES); tableTable.addColumnSchema( - new IdColumnSchema( + new TagColumnSchema( ColumnHeaderConstant.DATABASE.toLowerCase(Locale.ENGLISH), TSDataType.STRING)); tableTable.addColumnSchema( - new IdColumnSchema(ColumnHeaderConstant.TABLE_NAME_TABLE_MODEL, TSDataType.STRING)); + new TagColumnSchema(ColumnHeaderConstant.TABLE_NAME_TABLE_MODEL, TSDataType.STRING)); tableTable.addColumnSchema( new AttributeColumnSchema( ColumnHeaderConstant.COLUMN_TTL.toLowerCase(Locale.ENGLISH), TSDataType.STRING)); @@ -97,12 +97,12 @@ public class InformationSchema { final TsTable columnTable = new TsTable(COLUMNS); columnTable.addColumnSchema( - new IdColumnSchema( + new TagColumnSchema( ColumnHeaderConstant.DATABASE.toLowerCase(Locale.ENGLISH), TSDataType.STRING)); columnTable.addColumnSchema( - new IdColumnSchema(ColumnHeaderConstant.TABLE_NAME_TABLE_MODEL, TSDataType.STRING)); + new TagColumnSchema(ColumnHeaderConstant.TABLE_NAME_TABLE_MODEL, TSDataType.STRING)); columnTable.addColumnSchema( - new IdColumnSchema(ColumnHeaderConstant.COLUMN_NAME_TABLE_MODEL, TSDataType.STRING)); + new TagColumnSchema(ColumnHeaderConstant.COLUMN_NAME_TABLE_MODEL, TSDataType.STRING)); columnTable.addColumnSchema( new AttributeColumnSchema( ColumnHeaderConstant.DATATYPE.toLowerCase(Locale.ENGLISH), TSDataType.STRING)); diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java index 40a4bdbb2fef..905620f4613c 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java @@ -114,7 +114,7 @@ public List getIdColumnSchemaList() { try { final List idColumnSchemaList = new ArrayList<>(); for (final TsTableColumnSchema columnSchema : columnSchemaMap.values()) { - if (TsTableColumnCategory.ID.equals(columnSchema.getColumnCategory())) { + if (TsTableColumnCategory.TAG.equals(columnSchema.getColumnCategory())) { idColumnSchemaList.add(columnSchema); } } @@ -128,10 +128,10 @@ public void addColumnSchema(final TsTableColumnSchema columnSchema) { readWriteLock.writeLock().lock(); try { columnSchemaMap.put(columnSchema.getColumnName(), columnSchema); - if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.ID)) { + if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.TAG)) { idNums++; idColumnIndexMap.put(columnSchema.getColumnName(), idNums - 1); - } else if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.MEASUREMENT)) { + } else if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.FIELD)) { measurementNum++; } } finally { @@ -157,11 +157,11 @@ public void removeColumnSchema(final String columnName) { try { final TsTableColumnSchema columnSchema = columnSchemaMap.get(columnName); if (columnSchema != null - && columnSchema.getColumnCategory().equals(TsTableColumnCategory.ID)) { + && columnSchema.getColumnCategory().equals(TsTableColumnCategory.TAG)) { throw new SchemaExecutionException("Cannot remove an id column: " + columnName); } else if (columnSchema != null) { columnSchemaMap.remove(columnName); - if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.MEASUREMENT)) { + if (columnSchema.getColumnCategory().equals(TsTableColumnCategory.FIELD)) { measurementNum--; } } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/MeasurementColumnSchema.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/FieldColumnSchema.java similarity index 85% rename from iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/MeasurementColumnSchema.java rename to iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/FieldColumnSchema.java index b5ff592dff66..c2728fb47e8b 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/MeasurementColumnSchema.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/FieldColumnSchema.java @@ -32,20 +32,20 @@ import java.nio.ByteBuffer; import java.util.Map; -public class MeasurementColumnSchema extends TsTableColumnSchema { +public class FieldColumnSchema extends TsTableColumnSchema { private final TSEncoding encoding; private final CompressionType compressor; // Only for information schema - public MeasurementColumnSchema(final String columnName, final TSDataType dataType) { + public FieldColumnSchema(final String columnName, final TSDataType dataType) { super(columnName, dataType); this.encoding = TSEncoding.PLAIN; this.compressor = CompressionType.UNCOMPRESSED; } - public MeasurementColumnSchema( + public FieldColumnSchema( final String columnName, final TSDataType dataType, final TSEncoding encoding, @@ -55,7 +55,7 @@ public MeasurementColumnSchema( this.compressor = compressor; } - public MeasurementColumnSchema( + public FieldColumnSchema( final String columnName, final TSDataType dataType, final TSEncoding encoding, @@ -68,7 +68,7 @@ public MeasurementColumnSchema( @Override public TsTableColumnCategory getColumnCategory() { - return TsTableColumnCategory.MEASUREMENT; + return TsTableColumnCategory.FIELD; } public TSEncoding getEncoding() { @@ -92,21 +92,21 @@ void serialize(final OutputStream outputStream) throws IOException { ReadWriteIOUtils.write(props, outputStream); } - static MeasurementColumnSchema deserialize(final InputStream stream) throws IOException { + static FieldColumnSchema deserialize(final InputStream stream) throws IOException { final String columnName = ReadWriteIOUtils.readString(stream); final TSDataType dataType = ReadWriteIOUtils.readDataType(stream); final TSEncoding encoding = ReadWriteIOUtils.readEncoding(stream); final CompressionType compressor = ReadWriteIOUtils.readCompressionType(stream); final Map props = ReadWriteIOUtils.readMap(stream); - return new MeasurementColumnSchema(columnName, dataType, encoding, compressor, props); + return new FieldColumnSchema(columnName, dataType, encoding, compressor, props); } - static MeasurementColumnSchema deserialize(final ByteBuffer buffer) { + static FieldColumnSchema deserialize(final ByteBuffer buffer) { final String columnName = ReadWriteIOUtils.readString(buffer); final TSDataType dataType = ReadWriteIOUtils.readDataType(buffer); final TSEncoding encoding = ReadWriteIOUtils.readEncoding(buffer); final CompressionType compressor = ReadWriteIOUtils.readCompressionType(buffer); final Map props = ReadWriteIOUtils.readMap(buffer); - return new MeasurementColumnSchema(columnName, dataType, encoding, compressor, props); + return new FieldColumnSchema(columnName, dataType, encoding, compressor, props); } } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/IdColumnSchema.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TagColumnSchema.java similarity index 78% rename from iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/IdColumnSchema.java rename to iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TagColumnSchema.java index 87b2f3c77fed..83c7bde36b17 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/IdColumnSchema.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TagColumnSchema.java @@ -27,32 +27,32 @@ import java.nio.ByteBuffer; import java.util.Map; -public class IdColumnSchema extends TsTableColumnSchema { - public IdColumnSchema(final String columnName, final TSDataType dataType) { +public class TagColumnSchema extends TsTableColumnSchema { + public TagColumnSchema(final String columnName, final TSDataType dataType) { super(columnName, dataType); } - public IdColumnSchema( + public TagColumnSchema( final String columnName, final TSDataType dataType, final Map props) { super(columnName, dataType, props); } @Override public TsTableColumnCategory getColumnCategory() { - return TsTableColumnCategory.ID; + return TsTableColumnCategory.TAG; } - static IdColumnSchema deserialize(final InputStream stream) throws IOException { + static TagColumnSchema deserialize(final InputStream stream) throws IOException { String columnName = ReadWriteIOUtils.readString(stream); TSDataType dataType = ReadWriteIOUtils.readDataType(stream); Map props = ReadWriteIOUtils.readMap(stream); - return new IdColumnSchema(columnName, dataType, props); + return new TagColumnSchema(columnName, dataType, props); } - static IdColumnSchema deserialize(final ByteBuffer buffer) { + static TagColumnSchema deserialize(final ByteBuffer buffer) { String columnName = ReadWriteIOUtils.readString(buffer); TSDataType dataType = ReadWriteIOUtils.readDataType(buffer); Map props = ReadWriteIOUtils.readMap(buffer); - return new IdColumnSchema(columnName, dataType, props); + return new TagColumnSchema(columnName, dataType, props); } } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnCategory.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnCategory.java index ae287e4f5516..03069f14742a 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnCategory.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnCategory.java @@ -28,10 +28,10 @@ import java.nio.ByteBuffer; public enum TsTableColumnCategory { - ID((byte) 0), + TAG((byte) 0), ATTRIBUTE((byte) 1), TIME((byte) 2), - MEASUREMENT((byte) 3); + FIELD((byte) 3); private final byte category; @@ -64,13 +64,13 @@ public static TsTableColumnCategory deserialize(ByteBuffer stream) { public static TsTableColumnCategory deserialize(byte category) { switch (category) { case 0: - return ID; + return TAG; case 1: return ATTRIBUTE; case 2: return TIME; case 3: - return MEASUREMENT; + return FIELD; default: throw new IllegalArgumentException(); } @@ -78,12 +78,12 @@ public static TsTableColumnCategory deserialize(byte category) { public ColumnCategory toTsFileColumnType() { switch (this) { - case ID: - return ColumnCategory.ID; + case TAG: + return ColumnCategory.TAG; case ATTRIBUTE: return ColumnCategory.ATTRIBUTE; - case MEASUREMENT: - return ColumnCategory.MEASUREMENT; + case FIELD: + return ColumnCategory.FIELD; default: throw new IllegalArgumentException("Unsupported column type in TsFile: " + this); } @@ -91,10 +91,10 @@ public ColumnCategory toTsFileColumnType() { public static TsTableColumnCategory fromTsFileColumnType(ColumnCategory columnType) { switch (columnType) { - case MEASUREMENT: - return MEASUREMENT; - case ID: - return ID; + case FIELD: + return FIELD; + case TAG: + return TAG; case ATTRIBUTE: return ATTRIBUTE; default: diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnSchemaUtil.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnSchemaUtil.java index c227f96d705d..2c2f2340fdef 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnSchemaUtil.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnSchemaUtil.java @@ -48,14 +48,14 @@ public static TsTableColumnSchema deserialize(InputStream inputStream) throws IO private static TsTableColumnSchema deserialize(TsTableColumnCategory category, InputStream stream) throws IOException { switch (category) { - case ID: - return IdColumnSchema.deserialize(stream); + case TAG: + return TagColumnSchema.deserialize(stream); case ATTRIBUTE: return AttributeColumnSchema.deserialize(stream); case TIME: return TimeColumnSchema.deserialize(stream); - case MEASUREMENT: - return MeasurementColumnSchema.deserialize(stream); + case FIELD: + return FieldColumnSchema.deserialize(stream); default: throw new IllegalArgumentException(); } @@ -68,14 +68,14 @@ public static TsTableColumnSchema deserialize(ByteBuffer buffer) { private static TsTableColumnSchema deserialize( TsTableColumnCategory category, ByteBuffer buffer) { switch (category) { - case ID: - return IdColumnSchema.deserialize(buffer); + case TAG: + return TagColumnSchema.deserialize(buffer); case ATTRIBUTE: return AttributeColumnSchema.deserialize(buffer); case TIME: return TimeColumnSchema.deserialize(buffer); - case MEASUREMENT: - return MeasurementColumnSchema.deserialize(buffer); + case FIELD: + return FieldColumnSchema.deserialize(buffer); default: throw new IllegalArgumentException(); } diff --git a/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4 b/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4 index 06a21e9cd4d6..fa599b9178f5 100644 --- a/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4 +++ b/iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4 @@ -167,8 +167,8 @@ charsetDesc ; columnDefinition - : identifier columnCategory=(ID | ATTRIBUTE | TIME) charsetName? - | identifier type (columnCategory=(ID | ATTRIBUTE | TIME | MEASUREMENT))? charsetName? + : identifier columnCategory=(TAG | ATTRIBUTE | TIME) charsetName? + | identifier type (columnCategory=(TAG | ATTRIBUTE | TIME | FIELD))? charsetName? ; charsetName @@ -936,14 +936,14 @@ nonReserved | CACHE | CALL | CALLED | CASCADE | CATALOG | CATALOGS | CHAR | CHARACTER | CHARSET | CLEAR | CLUSTER | CLUSTERID | COLUMN | COLUMNS | COMMENT | COMMIT | COMMITTED | CONDITION | CONDITIONAL | CONFIGNODES | CONFIGURATION | CONNECTOR | CONSTANT | COPARTITION | COUNT | CURRENT | DATA | DATABASE | DATABASES | DATANODES | DATE | DAY | DECLARE | DEFAULT | DEFINE | DEFINER | DENY | DESC | DESCRIPTOR | DETAILS| DETERMINISTIC | DEVICES | DISTRIBUTED | DO | DOUBLE | ELSEIF | EMPTY | ENCODING | ERROR | EXCLUDING | EXPLAIN | EXTRACTOR - | FETCH | FILTER | FINAL | FIRST | FLUSH | FOLLOWING | FORMAT | FUNCTION | FUNCTIONS + | FETCH | FIELD | FILTER | FINAL | FIRST | FLUSH | FOLLOWING | FORMAT | FUNCTION | FUNCTIONS | GRACE | GRANT | GRANTED | GRANTS | GRAPHVIZ | GROUPS | HOUR - | ID | INDEX | INDEXES | IF | IGNORE | IMMEDIATE | INCLUDING | INITIAL | INPUT | INTERVAL | INVOKER | IO | ITERATE | ISOLATION + | INDEX | INDEXES | IF | IGNORE | IMMEDIATE | INCLUDING | INITIAL | INPUT | INTERVAL | INVOKER | IO | ITERATE | ISOLATION | JSON | KEEP | KEY | KEYS | KILL | LANGUAGE | LAST | LATERAL | LEADING | LEAVE | LEVEL | LIMIT | LINEAR | LOAD | LOCAL | LOGICAL | LOOP - | MAP | MATCH | MATCHED | MATCHES | MATCH_RECOGNIZE | MATERIALIZED | MEASUREMENT | MEASURES | METHOD | MERGE | MICROSECOND | MIGRATE | MILLISECOND | MINUTE | MODIFY | MONTH + | MAP | MATCH | MATCHED | MATCHES | MATCH_RECOGNIZE | MATERIALIZED | MEASURES | METHOD | MERGE | MICROSECOND | MIGRATE | MILLISECOND | MINUTE | MODIFY | MONTH | NANOSECOND | NESTED | NEXT | NFC | NFD | NFKC | NFKD | NO | NODEID | NONE | NULLIF | NULLS | OBJECT | OF | OFFSET | OMIT | ONE | ONLY | OPTION | ORDINALITY | OUTPUT | OVER | OVERFLOW | PARTITION | PARTITIONS | PASSING | PAST | PATH | PATTERN | PER | PERIOD | PERMUTE | PIPE | PIPEPLUGIN | PIPEPLUGINS | PIPES | PLAN | POSITION | PRECEDING | PRECISION | PRIVILEGES | PREVIOUS | PROCESSLIST | PROCESSOR | PROPERTIES | PRUNE @@ -951,7 +951,7 @@ nonReserved | RANGE | READ | READONLY | REFRESH | REGION | REGIONID | REGIONS | RENAME | REPAIR | REPEAT | REPEATABLE | REPLACE | RESET | RESPECT | RESTRICT | RETURN | RETURNING | RETURNS | REVOKE | ROLE | ROLES | ROLLBACK | ROW | ROWS | RUNNING | SERIESSLOTID | SCALAR | SCHEMA | SCHEMAS | SECOND | SECURITY | SEEK | SERIALIZABLE | SESSION | SET | SETS | SHOW | SINK | SOME | SOURCE | START | STATS | STOP | SUBSCRIPTIONS | SUBSET | SUBSTRING | SYSTEM - | TABLES | TABLESAMPLE | TEXT | TEXT_STRING | TIES | TIME | TIMEPARTITION | TIMESERIES | TIMESLOTID | TIMESTAMP | TO | TOPIC | TOPICS | TRAILING | TRANSACTION | TRUNCATE | TRY_CAST | TYPE + | TABLES | TABLESAMPLE | TAG | TEXT | TEXT_STRING | TIES | TIME | TIMEPARTITION | TIMESERIES | TIMESLOTID | TIMESTAMP | TO | TOPIC | TOPICS | TRAILING | TRANSACTION | TRUNCATE | TRY_CAST | TYPE | UNBOUNDED | UNCOMMITTED | UNCONDITIONAL | UNIQUE | UNKNOWN | UNMATCHED | UNTIL | UPDATE | URI | USE | USED | USER | UTF16 | UTF32 | UTF8 | VALIDATE | VALUE | VARIABLES | VARIATION | VERBOSE | VERSION | VIEW | WEEK | WHILE | WINDOW | WITHIN | WITHOUT | WORK | WRAPPER | WRITE @@ -1065,6 +1065,7 @@ EXTRACT: 'EXTRACT'; EXTRACTOR: 'EXTRACTOR'; FALSE: 'FALSE'; FETCH: 'FETCH'; +FIELD: 'FIELD'; FILL: 'FILL'; FILL_GROUP: 'FILL_GROUP'; FILTER: 'FILTER'; @@ -1088,7 +1089,6 @@ GROUPING: 'GROUPING'; GROUPS: 'GROUPS'; HAVING: 'HAVING'; HOUR: 'HOUR' | 'H'; -ID: 'ID'; INDEX: 'INDEX'; INDEXES: 'INDEXES'; IF: 'IF'; @@ -1143,7 +1143,6 @@ MATCHED: 'MATCHED'; MATCHES: 'MATCHES'; MATCH_RECOGNIZE: 'MATCH_RECOGNIZE'; MATERIALIZED: 'MATERIALIZED'; -MEASUREMENT: 'MEASUREMENT'; MEASURES: 'MEASURES'; METHOD: 'METHOD'; MERGE: 'MERGE'; @@ -1267,6 +1266,7 @@ SYSTEM: 'SYSTEM'; TABLE: 'TABLE'; TABLES: 'TABLES'; TABLESAMPLE: 'TABLESAMPLE'; +TAG: 'TAG'; TEXT: 'TEXT'; TEXT_STRING: 'STRING'; THEN: 'THEN'; diff --git a/pom.xml b/pom.xml index 60498a1ee01f..430ade43f212 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,7 @@ 0.14.1 1.9 1.5.6-3 - 1.2.0-241211-SNAPSHOT + 1.2.0-241224-SNAPSHOT