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..07f1418b37ac 100644 --- a/example/session/src/main/java/org/apache/iotdb/TableModelSessionExample.java +++ b/example/session/src/main/java/org/apache/iotdb/TableModelSessionExample.java @@ -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..fe2b5a55c73c 100644 --- a/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java +++ b/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java @@ -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/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/TableModelUtils.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/tablemodel/TableModelUtils.java index ce33dc3e6a53..914392ad0f80 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 @@ -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/IoTDBInsertTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBInsertTableIT.java index 816aba7c183f..715f354abf7b 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 @@ -188,10 +188,7 @@ public void testPartialInsertTablet() { 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", @@ -578,7 +575,7 @@ public void testInsertCaseSensitivity() 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; @@ -626,7 +623,7 @@ public void testInsertCaseSensitivity() 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); List measurementIds = schemaList.stream() .map(IMeasurementSchema::getMeasurementName) @@ -675,7 +672,7 @@ public void testInsertCaseSensitivity() 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 = @@ -730,7 +727,7 @@ public void testInsertCaseSensitivity() 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 = @@ -807,18 +804,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 = @@ -949,7 +946,7 @@ public void testInsertTabletWithTTL() schemaList.add(new MeasurementSchema("id1", 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; @@ -1024,10 +1021,10 @@ public void testInsertUnsequenceData() 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 = 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..b598591792c0 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 @@ -1477,13 +1477,13 @@ 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); + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD); List measurementIds = IMeasurementSchema.getMeasurementNameList(schemaList); List dataTypes = IMeasurementSchema.getDataTypeList(schemaList); @@ -1532,13 +1532,13 @@ 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); + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD, + Tablet.ColumnCategory.FIELD); List measurementIds = IMeasurementSchema.getMeasurementNameList(schemaList); List dataTypes = IMeasurementSchema.getDataTypeList(schemaList); List values = 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..2d6f520b99a8 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; @@ -274,7 +274,7 @@ public void testInsertTablet() { 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\":[\"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\"}"; rightInsertTablet(json); } @@ -286,7 +286,7 @@ public void testInsertTabletNoDatabase() { 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\":[\"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())); } @@ -299,7 +299,7 @@ public void testInsertTablet1() { 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( @@ -315,7 +315,7 @@ public void testInsertTablet2() { 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\":[\"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( 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..19cb3754ba3b 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 @@ -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,", 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..a9812b157a6c 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 @@ -91,7 +91,7 @@ public void testManageTable() { // or use full qualified table name // test "TTL=INF" - // "MEASUREMENT" can be omitted when type is specified + // "FIELD" can be omitted when type is specified // "STRING" can be omitted when id/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')"); @@ -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; 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..ebacbf818a9a 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 @@ -160,7 +160,7 @@ private static void insertRelationalTabletPerformanceTest() 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 = @@ -385,10 +385,10 @@ public void partialInsertRelationalTabletTest() 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 = @@ -522,7 +522,7 @@ public void insertRelationalTabletTest() 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 = @@ -599,7 +599,7 @@ public void insertRelationalTabletWithCacheLeaderTest() 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 = @@ -679,7 +679,7 @@ public void autoCreateNonIdColumnTest() 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 = @@ -752,7 +752,7 @@ public void autoCreateTableTest() throws IoTDBConnectionException, StatementExec 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 = @@ -813,7 +813,7 @@ public void autoCreateIdColumnTest() 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 = @@ -895,10 +895,10 @@ public void autoAdjustIdTest() throws IoTDBConnectionException, StatementExecuti schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE)); final List columnTypes = Arrays.asList( - ColumnCategory.ID, - ColumnCategory.ID, + ColumnCategory.TAG, + ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, - ColumnCategory.MEASUREMENT); + ColumnCategory.FIELD); List measurementIds = IMeasurementSchema.getMeasurementNameList(schemaList); List dataTypes = IMeasurementSchema.getDataTypeList(schemaList); @@ -1154,7 +1154,7 @@ private void testOneCastWithTablet( schemaList.add(new MeasurementSchema("id1", 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, 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..083946c1c245 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 @@ -88,10 +88,7 @@ public void testPartialInsertTablet() { 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", @@ -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/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/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..7e6df862846d 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,7 +107,7 @@ 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"); } 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..da46cd243688 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 @@ -280,7 +280,7 @@ 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); @@ -295,7 +295,7 @@ public static TsTableColumnSchema generateColumnSchema( case TIME: throw new SemanticException( "Create table or add column statement shall not specify column category TIME"); - case MEASUREMENT: + case FIELD: return new MeasurementColumnSchema( columnName, dataType, @@ -341,7 +341,7 @@ 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."); } @@ -353,7 +353,7 @@ 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( 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..8e083c27b3ee 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; @@ -2514,17 +2514,17 @@ private Optional getIdentifierIfPresent(ParserRuleContext context) { private static TsTableColumnCategory getColumnCategory(Token category) { if (category == null) { - return MEASUREMENT; + return FIELD; } switch (category.getType()) { case RelationalSqlLexer.ID: - return ID; + return TAG; case RelationalSqlLexer.ATTRIBUTE: return ATTRIBUTE; case RelationalSqlLexer.TIME: return TIME; case RelationalSqlLexer.MEASUREMENT: - return MEASUREMENT; + 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/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/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..c2906da17e61 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 @@ -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,13 +238,13 @@ public static TsTable genTsTable() { TsTableColumnCategory[] columnCategories = genColumnCategories(); for (int i = 0; i < columnCategories.length; i++) { switch (columnCategories[i]) { - case ID: + case TAG: tsTable.addColumnSchema(new IdColumnSchema(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( 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/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/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/IdColumnSchema.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/IdColumnSchema.java index 87b2f3c77fed..28cd612c8e60 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/IdColumnSchema.java @@ -39,7 +39,7 @@ public IdColumnSchema( @Override public TsTableColumnCategory getColumnCategory() { - return TsTableColumnCategory.ID; + return TsTableColumnCategory.TAG; } static IdColumnSchema deserialize(final InputStream stream) throws IOException { 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/MeasurementColumnSchema.java index b5ff592dff66..feea92e20345 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/MeasurementColumnSchema.java @@ -68,7 +68,7 @@ public MeasurementColumnSchema( @Override public TsTableColumnCategory getColumnCategory() { - return TsTableColumnCategory.MEASUREMENT; + return TsTableColumnCategory.FIELD; } public TSEncoding getEncoding() { 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..026d61828ebe 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,13 +48,13 @@ public static TsTableColumnSchema deserialize(InputStream inputStream) throws IO private static TsTableColumnSchema deserialize(TsTableColumnCategory category, InputStream stream) throws IOException { switch (category) { - case ID: + case TAG: return IdColumnSchema.deserialize(stream); case ATTRIBUTE: return AttributeColumnSchema.deserialize(stream); case TIME: return TimeColumnSchema.deserialize(stream); - case MEASUREMENT: + case FIELD: return MeasurementColumnSchema.deserialize(stream); default: throw new IllegalArgumentException(); @@ -68,13 +68,13 @@ public static TsTableColumnSchema deserialize(ByteBuffer buffer) { private static TsTableColumnSchema deserialize( TsTableColumnCategory category, ByteBuffer buffer) { switch (category) { - case ID: + case TAG: return IdColumnSchema.deserialize(buffer); case ATTRIBUTE: return AttributeColumnSchema.deserialize(buffer); case TIME: return TimeColumnSchema.deserialize(buffer); - case MEASUREMENT: + case FIELD: return MeasurementColumnSchema.deserialize(buffer); default: throw new IllegalArgumentException(); 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