From 2530e79e7734540da0a1d8f47cb8c2c844355fc3 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 21 Nov 2025 10:49:59 +0800 Subject: [PATCH 01/33] refactor --- .../iotdb/db/it/IoTDBLoadLastCacheIT.java | 16 +-- .../session/it/IoTDBSessionSimpleIT.java | 5 +- .../manager/partition/PartitionManager.java | 14 ++- .../org/apache/iotdb/db/conf/IoTDBConfig.java | 8 +- .../db/protocol/thrift/OperationType.java | 4 +- .../thrift/impl/ClientRPCServiceImpl.java | 8 +- .../plan/statement/StatementType.java | 6 +- .../metadata/DatabaseSchemaStatement.java | 2 +- .../metadata/DeleteDatabaseStatement.java | 2 +- .../mem/snapshot/MemMTreeSnapshotUtil.java | 10 +- .../db/tools/schema/SRStatementGenerator.java | 8 +- .../analyze/cache/PartitionCacheTest.java | 116 ++++++++---------- ...odeManagementMemoryMergeNodeSerdeTest.java | 4 +- .../compaction/AbstractCompactionTest.java | 4 +- ...actionWithFastPerformerValidationTest.java | 3 +- ...sSpaceCompactionWithFastPerformerTest.java | 8 +- ...eCompactionWithReadPointPerformerTest.java | 8 +- .../memtable/MemTableFlushTaskTest.java | 18 +-- .../db/tools/TsFileAndModSettleToolTest.java | 10 +- .../iotdb/commons/schema/SchemaConstant.java | 16 +-- .../iotdb/commons/schema/node/MNodeType.java | 4 +- .../node/common/AbstractDatabaseMNode.java | 2 +- 22 files changed, 128 insertions(+), 148 deletions(-) diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java index 755b3aef75864..706c175047ea0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java @@ -126,8 +126,8 @@ private void registerSchema() throws SQLException { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE " + SchemaConfig.STORAGE_GROUP_0); - statement.execute("CREATE DATABASE " + SchemaConfig.STORAGE_GROUP_1); + statement.execute("CREATE DATABASE " + SchemaConfig.DATABASE_0); + statement.execute("CREATE DATABASE " + SchemaConfig.DATABASE_1); statement.execute(convert2SQL(SchemaConfig.DEVICE_0, SchemaConfig.MEASUREMENT_00)); statement.execute(convert2SQL(SchemaConfig.DEVICE_0, SchemaConfig.MEASUREMENT_01)); @@ -182,8 +182,8 @@ private void deleteSG() throws SQLException { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute(String.format("delete database %s", SchemaConfig.STORAGE_GROUP_0)); - statement.execute(String.format("delete database %s", SchemaConfig.STORAGE_GROUP_1)); + statement.execute(String.format("delete database %s", SchemaConfig.DATABASE_0)); + statement.execute(String.format("delete database %s", SchemaConfig.DATABASE_1)); } catch (final IoTDBSQLException ignored) { } } @@ -283,7 +283,7 @@ public void testTreeModelLoadWithLastCache() throws Exception { @Test public void testTableModelLoadWithLastCache() throws Exception { - final String database = SchemaConfig.DATABASE_0; + final String database = SchemaConfig.TABLE_DATABASE; final String table = SchemaConfig.TABLE_0; final String measurement = SchemaConfig.MEASUREMENT_00.getMeasurementName(); @@ -581,10 +581,10 @@ public void testTableLoadPerformance() throws Exception { private static class SchemaConfig { - private static final String DATABASE_0 = "db"; + private static final String TABLE_DATABASE = "db"; private static final String TABLE_0 = "test"; - private static final String STORAGE_GROUP_0 = "root.sg.test_0"; - private static final String STORAGE_GROUP_1 = "root.sg.test_1"; + private static final String DATABASE_0 = "root.sg.test_0"; + private static final String DATABASE_1 = "root.sg.test_1"; // device 0, nonaligned, sg 0 private static final String DEVICE_0 = "root.sg.test_0.d_0"; diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java index 38f6345bae5d1..ad2939af5aaab 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java @@ -1561,10 +1561,7 @@ public void insertIllegalPathTest() { e.getMessage() .contains( String.format( - msg, - TSStatusCode.ILLEGAL_PATH, - OperationType.SET_STORAGE_GROUP, - "root..sg"))); + msg, TSStatusCode.ILLEGAL_PATH, OperationType.SET_DATABASE, "root..sg"))); } try { diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java index 576d805c78624..1db7f41c429a5 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java @@ -211,9 +211,10 @@ public DataPartitionResp getDataPartition(final GetDataPartitionPlan req) { * Get SchemaPartition and create a new one if it does not exist. * * @param req SchemaPartitionPlan with partitionSlotsMap - * @return SchemaPartitionResp with DataPartition and TSStatus. SUCCESS_STATUS if all process - * finish. NOT_ENOUGH_DATA_NODE if the DataNodes is not enough to create new Regions. - * STORAGE_GROUP_NOT_EXIST if some StorageGroup don't exist. + * @return SchemaPartitionResp with DataPartition and TSStatus. {@link + * TSStatusCode#SUCCESS_STATUS} if all process finish. {@link TSStatusCode#NO_ENOUGH_DATANODE} + * if the DataNodes is not enough to create new Regions. {@link + * TSStatusCode#DATABASE_NOT_EXIST} if some Databases don't exist. */ public SchemaPartitionResp getOrCreateSchemaPartition(final GetOrCreateSchemaPartitionPlan req) { // Check if the related Databases exist @@ -534,12 +535,13 @@ private TSStatus consensusWritePartitionResult(ConfigPhysicalPlan plan) { // ====================================================== /** - * Allocate more RegionGroup to the specified StorageGroups if necessary. + * Allocate more RegionGroup to the specified Databases if necessary. * * @param unassignedPartitionSlotsCountMap Map * @param consensusGroupType SchemaRegion or DataRegion - * @return SUCCESS_STATUS when RegionGroup extension successful; NOT_ENOUGH_DATA_NODE when there - * are not enough DataNodes; STORAGE_GROUP_NOT_EXIST when some StorageGroups don't exist + * @return {@link TSStatusCode#SUCCESS_STATUS} when RegionGroup extension successful; {@link + * TSStatusCode#NO_ENOUGH_DATANODE} when there are not enough DataNodes; {@link + * TSStatusCode#DATABASE_NOT_EXIST} when some Databases don't exist */ private TSStatus extendRegionGroupIfNecessary( final Map unassignedPartitionSlotsCountMap, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java index b0b0c08322936..13c17c6e87d99 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java @@ -89,8 +89,8 @@ public class IoTDBConfig { new String[] {"SequenceStrategy", "MaxDiskUsableSpaceFirstStrategy"}; private static final String DEFAULT_MULTI_DIR_STRATEGY = "SequenceStrategy"; - private static final String STORAGE_GROUP_MATCHER = "([a-zA-Z0-9`_.\\-\\u2E80-\\u9FFF]+)"; - public static final Pattern DATABASE_PATTERN = Pattern.compile(STORAGE_GROUP_MATCHER); + private static final String DATABASE_MATCHER = "([a-zA-Z0-9`_.\\-\\u2E80-\\u9FFF]+)"; + public static final Pattern DATABASE_PATTERN = Pattern.compile(DATABASE_MATCHER); // e.g., a31+/$%#&[]{}3e4, "a.b", 'a.b' private static final String NODE_NAME_MATCHER = "([^\n\t]+)"; @@ -3432,8 +3432,8 @@ public String getConfigMessage() { String[] notShowArray = { "NODE_NAME_MATCHER", "PARTIAL_NODE_MATCHER", - "STORAGE_GROUP_MATCHER", - "STORAGE_GROUP_PATTERN", + "DATABASE_MATCHER", + "DATABASE_PATTERN", "NODE_MATCHER", "NODE_PATTERN" }; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/OperationType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/OperationType.java index e461f0cc45d16..21685e1122501 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/OperationType.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/OperationType.java @@ -41,8 +41,8 @@ public enum OperationType { DELETE_DATA("deleteData"), INSERT_TABLET("insertTablet"), INSERT_TABLETS("insertTablets"), - SET_STORAGE_GROUP("setStorageGroup"), - DELETE_STORAGE_GROUPS("deleteStorageGroup"), + SET_DATABASE("setDatabase"), + DELETE_DATABASE("deleteDatabase"), CREATE_TIMESERIES("createTimeseries"), CREATE_ALIGNED_TIMESERIES("createAlignedTimeseries"), CREATE_MULTI_TIMESERIES("createMultiTimeseries"), diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java index 5655758f1694e..64180502c1b86 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java @@ -1529,10 +1529,10 @@ public TSStatus setStorageGroup(long sessionId, String storageGroup) { return result.status; } catch (IoTDBException e) { - return onIoTDBException(e, OperationType.SET_STORAGE_GROUP, e.getErrorCode()); + return onIoTDBException(e, OperationType.SET_DATABASE, e.getErrorCode()); } catch (Exception e) { return onQueryException( - e, OperationType.SET_STORAGE_GROUP.getName(), TSStatusCode.EXECUTE_STATEMENT_ERROR); + e, OperationType.SET_DATABASE.getName(), TSStatusCode.EXECUTE_STATEMENT_ERROR); } } @@ -1764,10 +1764,10 @@ public TSStatus deleteStorageGroups(long sessionId, List storageGroups) return result.status; } catch (IoTDBException e) { - return onIoTDBException(e, OperationType.DELETE_STORAGE_GROUPS, e.getErrorCode()); + return onIoTDBException(e, OperationType.DELETE_DATABASE, e.getErrorCode()); } catch (Exception e) { return onQueryException( - e, OperationType.DELETE_STORAGE_GROUPS.getName(), TSStatusCode.EXECUTE_STATEMENT_ERROR); + e, OperationType.DELETE_DATABASE.getName(), TSStatusCode.EXECUTE_STATEMENT_ERROR); } finally { SESSION_MANAGER.updateIdleTime(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java index d75e2e09b7c28..f53b61a2e209b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java @@ -51,8 +51,8 @@ public enum StatementType { REVOKE_WATERMARK_EMBEDDING, RENAME_USER, - STORAGE_GROUP_SCHEMA, - DELETE_STORAGE_GROUP, + DATABASE_SCHEMA, + DELETE_DATABASE, CREATE_TIME_SERIES, CREATE_ALIGNED_TIME_SERIES, CREATE_MULTI_TIME_SERIES, @@ -109,7 +109,7 @@ public enum StatementType { MNODE, MEASUREMENT_MNODE, - STORAGE_GROUP_MNODE, + DATABASE_MNODE, AUTO_CREATE_DEVICE_MNODE, TTL, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DatabaseSchemaStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DatabaseSchemaStatement.java index 53ff33e2437cb..005740924da3f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DatabaseSchemaStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DatabaseSchemaStatement.java @@ -47,7 +47,7 @@ public class DatabaseSchemaStatement extends Statement implements IConfigStateme public DatabaseSchemaStatement(final DatabaseSchemaStatementType subType) { super(); this.subType = subType; - statementType = StatementType.STORAGE_GROUP_SCHEMA; + statementType = StatementType.DATABASE_SCHEMA; } public DatabaseSchemaStatementType getSubType() { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DeleteDatabaseStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DeleteDatabaseStatement.java index 6b538267555f2..2d08c10219700 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DeleteDatabaseStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/DeleteDatabaseStatement.java @@ -41,7 +41,7 @@ public class DeleteDatabaseStatement extends Statement implements IConfigStateme public DeleteDatabaseStatement() { super(); - statementType = StatementType.DELETE_STORAGE_GROUP; + statementType = StatementType.DELETE_DATABASE; } @Override diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java index 71d78712afb72..f4c01ef368ed9 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java @@ -56,14 +56,14 @@ import java.util.function.BiConsumer; import java.util.function.Consumer; +import static org.apache.iotdb.commons.schema.SchemaConstant.DATABASE_ENTITY_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.DATABASE_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.ENTITY_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.INTERNAL_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.LOGICAL_VIEW_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.MEASUREMENT_MNODE_TYPE; -import static org.apache.iotdb.commons.schema.SchemaConstant.STORAGE_GROUP_ENTITY_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.TABLE_MNODE_TYPE; -import static org.apache.iotdb.commons.schema.SchemaConstant.isStorageGroupType; +import static org.apache.iotdb.commons.schema.SchemaConstant.isDatabaseType; public class MemMTreeSnapshotUtil { @@ -258,7 +258,7 @@ private static void deserializeMNode( node = deserializer.deserializeEntityMNode(inputStream); deviceProcess.accept(node.getAsDeviceMNode()); break; - case STORAGE_GROUP_ENTITY_MNODE_TYPE: + case DATABASE_ENTITY_MNODE_TYPE: childrenNum = ReadWriteIOUtils.readInt(inputStream); node = deserializer.deserializeStorageGroupEntityMNode(inputStream); deviceProcess.accept(node.getAsDeviceMNode()); @@ -300,7 +300,7 @@ private static void deserializeMNode( } // Storage type means current node is root node, so it must be returned. - if (childrenNum > 0 || isStorageGroupType(type)) { + if (childrenNum > 0 || isDatabaseType(type)) { ancestors.push(node); restChildrenNum.push(childrenNum); } @@ -344,7 +344,7 @@ public Boolean visitDatabaseMNode( AbstractDatabaseMNode> node, OutputStream outputStream) { try { if (node.isDevice()) { - ReadWriteIOUtils.write(STORAGE_GROUP_ENTITY_MNODE_TYPE, outputStream); + ReadWriteIOUtils.write(DATABASE_ENTITY_MNODE_TYPE, outputStream); serializeBasicMNode(node.getBasicMNode(), outputStream); IDeviceMNode deviceMNode = node.getAsDeviceMNode(); ReadWriteIOUtils.write(deviceMNode.getSchemaTemplateIdWithState(), outputStream); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/tools/schema/SRStatementGenerator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/tools/schema/SRStatementGenerator.java index 239b55b521b1b..18d08157e4082 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/tools/schema/SRStatementGenerator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/tools/schema/SRStatementGenerator.java @@ -71,14 +71,14 @@ import java.util.Objects; import java.util.stream.Collectors; +import static org.apache.iotdb.commons.schema.SchemaConstant.DATABASE_ENTITY_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.DATABASE_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.ENTITY_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.INTERNAL_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.LOGICAL_VIEW_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.MEASUREMENT_MNODE_TYPE; -import static org.apache.iotdb.commons.schema.SchemaConstant.STORAGE_GROUP_ENTITY_MNODE_TYPE; import static org.apache.iotdb.commons.schema.SchemaConstant.TABLE_MNODE_TYPE; -import static org.apache.iotdb.commons.schema.SchemaConstant.isStorageGroupType; +import static org.apache.iotdb.commons.schema.SchemaConstant.isDatabaseType; import static org.apache.iotdb.db.schemaengine.schemaregion.tag.TagLogFile.parseByteBuffer; public class SRStatementGenerator implements Iterator, Iterable { @@ -295,7 +295,7 @@ private IMemMNode deserializeMNode( childrenNum = ReadWriteIOUtils.readInt(inputStream); node = deserializer.deserializeEntityMNode(inputStream); break; - case STORAGE_GROUP_ENTITY_MNODE_TYPE: + case DATABASE_ENTITY_MNODE_TYPE: childrenNum = ReadWriteIOUtils.readInt(inputStream); node = deserializer.deserializeStorageGroupEntityMNode(inputStream); break; @@ -327,7 +327,7 @@ private IMemMNode deserializeMNode( parent.addChild(node); } - if (childrenNum > 0 || isStorageGroupType(type)) { + if (childrenNum > 0 || isDatabaseType(type)) { ancestors.push(node); restChildrenNum.push(childrenNum); } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/PartitionCacheTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/PartitionCacheTest.java index e08a2b610c996..e873fa9c1633b 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/PartitionCacheTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/PartitionCacheTest.java @@ -62,7 +62,7 @@ public class PartitionCacheTest { SeriesPartitionExecutor.getSeriesPartitionExecutor( config.getSeriesPartitionExecutorClass(), config.getSeriesPartitionSlotNum()); - private static final Set storageGroups = new HashSet<>(); + private static final Set databases = new HashSet<>(); private static final Map> schemaPartitionTable = new HashMap<>(); private static final Map< @@ -71,28 +71,26 @@ public class PartitionCacheTest { private static final Map consensusGroupIdToRegionReplicaSet = new HashMap<>(); - private static final String STORAGE_GROUP_PREFIX = "root.sg"; - private static final Integer STORAGE_GROUP_NUMBER = 5; + private static final String DATABASE_PREFIX = "root.db"; + private static final Integer DATABASE_NUMBER = 5; private static final String DEVICE_PREFIX = "d"; - private static final Integer DEVICE_PER_STORAGE_GROUP = 10; - private static final Integer TIME_PARTITION_PER_STORAGE_GROUP = 10; + private static final Integer DEVICE_PER_DATABASE = 10; + private static final Integer TIME_PARTITION_PER_DATABASE = 10; private PartitionCache partitionCache; static { - for (int storageGroupNumber = 0; - storageGroupNumber < STORAGE_GROUP_NUMBER; - storageGroupNumber++) { + for (int storageGroupNumber = 0; storageGroupNumber < DATABASE_NUMBER; storageGroupNumber++) { // init each database String storageGroupName = getDatabaseName(storageGroupNumber); - storageGroups.add(storageGroupName); + databases.add(storageGroupName); if (!schemaPartitionTable.containsKey(storageGroupName)) { schemaPartitionTable.put(storageGroupName, new HashMap<>()); } if (!dataPartitionTable.containsKey(storageGroupName)) { dataPartitionTable.put(storageGroupName, new HashMap<>()); } - for (int deviceNumber = 0; deviceNumber < DEVICE_PER_STORAGE_GROUP; deviceNumber++) { + for (int deviceNumber = 0; deviceNumber < DEVICE_PER_DATABASE; deviceNumber++) { // init each device IDeviceID deviceID = Factory.DEFAULT_FACTORY.create(getDeviceName(storageGroupName, deviceNumber)); @@ -102,8 +100,8 @@ public class PartitionCacheTest { TConsensusGroupId schemaConsensusGroupId = new TConsensusGroupId( TConsensusGroupType.SchemaRegion, - (storageGroupNumber * DEVICE_PER_STORAGE_GROUP + deviceNumber) - * TIME_PARTITION_PER_STORAGE_GROUP); + (storageGroupNumber * DEVICE_PER_DATABASE + deviceNumber) + * TIME_PARTITION_PER_DATABASE); schemaPartitionTable.get(storageGroupName).put(seriesPartitionSlot, schemaConsensusGroupId); // init regionReplicaSet of specific schemaRegion List dataNodeLocations = new ArrayList<>(); @@ -113,7 +111,7 @@ public class PartitionCacheTest { // init dataRegion of device dataPartitionTable.get(storageGroupName).put(seriesPartitionSlot, new HashMap<>()); for (int timePartitionSlotNumber = 0; - timePartitionSlotNumber < TIME_PARTITION_PER_STORAGE_GROUP; + timePartitionSlotNumber < TIME_PARTITION_PER_DATABASE; timePartitionSlotNumber++) { // init each timePartition TTimePartitionSlot timePartitionSlot = new TTimePartitionSlot(timePartitionSlotNumber); @@ -121,8 +119,8 @@ public class PartitionCacheTest { TConsensusGroupId dataConsensusGroupId = new TConsensusGroupId( TConsensusGroupType.DataRegion, - (storageGroupNumber * DEVICE_PER_STORAGE_GROUP + deviceNumber) - * TIME_PARTITION_PER_STORAGE_GROUP + (storageGroupNumber * DEVICE_PER_DATABASE + deviceNumber) + * TIME_PARTITION_PER_DATABASE + timePartitionSlotNumber + 1); dataPartitionTable @@ -137,18 +135,18 @@ public class PartitionCacheTest { } } - private static String getDatabaseName(int storageGroupNumber) { - return STORAGE_GROUP_PREFIX + storageGroupNumber; + private static String getDatabaseName(int databaseNumber) { + return DATABASE_PREFIX + databaseNumber; } - private static String getDeviceName(String storageGroupName, int deviceNumber) { - return storageGroupName + "." + DEVICE_PREFIX + deviceNumber; + private static String getDeviceName(String databaseName, int deviceNumber) { + return databaseName + "." + DEVICE_PREFIX + deviceNumber; } @Before public void setUp() throws Exception { partitionCache = new PartitionCache(); - partitionCache.updateDatabaseCache(storageGroups); + partitionCache.updateDatabaseCache(databases); partitionCache.updateSchemaPartitionCache(schemaPartitionTable); partitionCache.updateDataPartitionCache(dataPartitionTable); partitionCache.updateGroupIdToReplicaSetMap(100, consensusGroupIdToRegionReplicaSet); @@ -248,24 +246,22 @@ public void testRegionReplicaSetCache() { // test update regionReplicaSetCache with small timestamp assertFalse(partitionCache.updateGroupIdToReplicaSetMap(0, consensusGroupIdToRegionReplicaSet)); - for (int storageGroupNumber = 0; - storageGroupNumber < STORAGE_GROUP_NUMBER; - storageGroupNumber++) { - for (int deviceNumber = 0; deviceNumber < DEVICE_PER_STORAGE_GROUP; deviceNumber++) { + for (int storageGroupNumber = 0; storageGroupNumber < DATABASE_NUMBER; storageGroupNumber++) { + for (int deviceNumber = 0; deviceNumber < DEVICE_PER_DATABASE; deviceNumber++) { TConsensusGroupId schemaConsensusGroupId = new TConsensusGroupId( TConsensusGroupType.SchemaRegion, - (storageGroupNumber * DEVICE_PER_STORAGE_GROUP + deviceNumber) - * TIME_PARTITION_PER_STORAGE_GROUP); + (storageGroupNumber * DEVICE_PER_DATABASE + deviceNumber) + * TIME_PARTITION_PER_DATABASE); checkRegionReplicaSet(schemaConsensusGroupId); for (int timePartitionSlotNumber = 0; - timePartitionSlotNumber < TIME_PARTITION_PER_STORAGE_GROUP; + timePartitionSlotNumber < TIME_PARTITION_PER_DATABASE; timePartitionSlotNumber++) { TConsensusGroupId dataConsensusGroupId = new TConsensusGroupId( TConsensusGroupType.DataRegion, - (storageGroupNumber * DEVICE_PER_STORAGE_GROUP + deviceNumber) - * TIME_PARTITION_PER_STORAGE_GROUP + (storageGroupNumber * DEVICE_PER_DATABASE + deviceNumber) + * TIME_PARTITION_PER_DATABASE + timePartitionSlotNumber + 1); checkRegionReplicaSet(dataConsensusGroupId); @@ -287,11 +283,9 @@ private void checkRegionReplicaSet(TConsensusGroupId consensusGroupId) { @Test public void testSchemaRegionCache() { - for (int storageGroupNumber = 0; - storageGroupNumber < STORAGE_GROUP_NUMBER; - storageGroupNumber++) { + for (int storageGroupNumber = 0; storageGroupNumber < DATABASE_NUMBER; storageGroupNumber++) { String storageGroupName = getDatabaseName(storageGroupNumber); - for (int deviceNumber = 0; deviceNumber < DEVICE_PER_STORAGE_GROUP; deviceNumber++) { + for (int deviceNumber = 0; deviceNumber < DEVICE_PER_DATABASE; deviceNumber++) { IDeviceID deviceID = Factory.DEFAULT_FACTORY.create(getDeviceName(storageGroupName, deviceNumber)); TSeriesPartitionSlot seriesPartitionSlot = @@ -312,7 +306,7 @@ public void testSchemaRegionCache() { // test missed storageGroups in schemaPartitionCache List missedStorageGroupNames = Arrays.asList("root.sg", "root.*"); for (String missedStorageGroupName : missedStorageGroupNames) { - for (int deviceNumber = 0; deviceNumber < DEVICE_PER_STORAGE_GROUP; deviceNumber++) { + for (int deviceNumber = 0; deviceNumber < DEVICE_PER_DATABASE; deviceNumber++) { IDeviceID deviceID = Factory.DEFAULT_FACTORY.create(getDeviceName(missedStorageGroupName, deviceNumber)); Map> searchMap = new HashMap<>(); @@ -322,12 +316,10 @@ public void testSchemaRegionCache() { } } // test missed devices in schemaPartitionCache - for (int storageGroupNumber = 0; - storageGroupNumber < STORAGE_GROUP_NUMBER; - storageGroupNumber++) { + for (int storageGroupNumber = 0; storageGroupNumber < DATABASE_NUMBER; storageGroupNumber++) { String storageGroupName = getDatabaseName(storageGroupNumber); - for (int deviceNumber = DEVICE_PER_STORAGE_GROUP; - deviceNumber < 2 * DEVICE_PER_STORAGE_GROUP; + for (int deviceNumber = DEVICE_PER_DATABASE; + deviceNumber < 2 * DEVICE_PER_DATABASE; deviceNumber++) { IDeviceID deviceID = Factory.DEFAULT_FACTORY.create(getDeviceName(storageGroupName, deviceNumber)); @@ -339,11 +331,9 @@ public void testSchemaRegionCache() { } // test invalid SchemaPartitionCache partitionCache.invalidAllSchemaPartitionCache(); - for (int storageGroupNumber = 0; - storageGroupNumber < STORAGE_GROUP_NUMBER; - storageGroupNumber++) { + for (int storageGroupNumber = 0; storageGroupNumber < DATABASE_NUMBER; storageGroupNumber++) { String storageGroupName = getDatabaseName(storageGroupNumber); - for (int deviceNumber = 0; deviceNumber < DEVICE_PER_STORAGE_GROUP; deviceNumber++) { + for (int deviceNumber = 0; deviceNumber < DEVICE_PER_DATABASE; deviceNumber++) { IDeviceID deviceID = Factory.DEFAULT_FACTORY.create(getDeviceName(storageGroupName, deviceNumber)); Map> searchMap = new HashMap<>(); @@ -356,11 +346,9 @@ public void testSchemaRegionCache() { @Test public void testDataPartitionCache() { - for (int storageGroupNumber = 0; - storageGroupNumber < STORAGE_GROUP_NUMBER; - storageGroupNumber++) { + for (int storageGroupNumber = 0; storageGroupNumber < DATABASE_NUMBER; storageGroupNumber++) { String storageGroupName = getDatabaseName(storageGroupNumber); - for (int deviceNumber = 0; deviceNumber < DEVICE_PER_STORAGE_GROUP; deviceNumber++) { + for (int deviceNumber = 0; deviceNumber < DEVICE_PER_DATABASE; deviceNumber++) { IDeviceID deviceID = IDeviceID.Factory.DEFAULT_FACTORY.create(getDeviceName(storageGroupName, deviceNumber)); TSeriesPartitionSlot seriesPartitionSlot = @@ -380,7 +368,7 @@ public void testDataPartitionCache() { result.get(storageGroupName).get(seriesPartitionSlot); assertNotNull(timePartitionSlotListMap); for (int timePartitionSlotNumber = 0; - timePartitionSlotNumber < TIME_PARTITION_PER_STORAGE_GROUP; + timePartitionSlotNumber < TIME_PARTITION_PER_DATABASE; timePartitionSlotNumber++) { TTimePartitionSlot timePartitionSlot = new TTimePartitionSlot(timePartitionSlotNumber); assertNotNull(timePartitionSlotListMap.get(timePartitionSlot)); @@ -391,7 +379,7 @@ public void testDataPartitionCache() { // test missed storageGroups in dataPartitionCache List missedStorageGroupNames = Arrays.asList("root.sg", "root.*"); for (String missedStorageGroupName : missedStorageGroupNames) { - for (int deviceNumber = 0; deviceNumber < DEVICE_PER_STORAGE_GROUP; deviceNumber++) { + for (int deviceNumber = 0; deviceNumber < DEVICE_PER_DATABASE; deviceNumber++) { IDeviceID deviceID = Factory.DEFAULT_FACTORY.create(getDeviceName(missedStorageGroupName, deviceNumber)); Map> searchMap = @@ -402,12 +390,10 @@ public void testDataPartitionCache() { } // test missed devices in dataPartitionCache - for (int storageGroupNumber = 0; - storageGroupNumber < STORAGE_GROUP_NUMBER; - storageGroupNumber++) { + for (int storageGroupNumber = 0; storageGroupNumber < DATABASE_NUMBER; storageGroupNumber++) { String storageGroupName = getDatabaseName(storageGroupNumber); - for (int deviceNumber = DEVICE_PER_STORAGE_GROUP; - deviceNumber < 2 * DEVICE_PER_STORAGE_GROUP; + for (int deviceNumber = DEVICE_PER_DATABASE; + deviceNumber < 2 * DEVICE_PER_DATABASE; deviceNumber++) { IDeviceID deviceID = Factory.DEFAULT_FACTORY.create(getDeviceName(storageGroupName, deviceNumber)); @@ -419,11 +405,9 @@ public void testDataPartitionCache() { } // test missed timePartitionSlots in dataPartitionCache - for (int storageGroupNumber = 0; - storageGroupNumber < STORAGE_GROUP_NUMBER; - storageGroupNumber++) { + for (int storageGroupNumber = 0; storageGroupNumber < DATABASE_NUMBER; storageGroupNumber++) { String storageGroupName = getDatabaseName(storageGroupNumber); - for (int deviceNumber = 0; deviceNumber < DEVICE_PER_STORAGE_GROUP; deviceNumber++) { + for (int deviceNumber = 0; deviceNumber < DEVICE_PER_DATABASE; deviceNumber++) { IDeviceID deviceID = Factory.DEFAULT_FACTORY.create(getDeviceName(storageGroupName, deviceNumber)); Map> searchMap = @@ -435,15 +419,13 @@ public void testDataPartitionCache() { // test invalid dataPartitionCache partitionCache.invalidAllDataPartitionCache(); - for (int storageGroupNumber = 0; - storageGroupNumber < STORAGE_GROUP_NUMBER; - storageGroupNumber++) { - String storageGroupName = getDatabaseName(storageGroupNumber); - for (int deviceNumber = 0; deviceNumber < DEVICE_PER_STORAGE_GROUP; deviceNumber++) { + for (int databaseNumber = 0; databaseNumber < DATABASE_NUMBER; databaseNumber++) { + String databaseName = getDatabaseName(databaseNumber); + for (int deviceNumber = 0; deviceNumber < DEVICE_PER_DATABASE; deviceNumber++) { IDeviceID deviceID = - Factory.DEFAULT_FACTORY.create(getDeviceName(storageGroupName, deviceNumber)); + Factory.DEFAULT_FACTORY.create(getDeviceName(databaseName, deviceNumber)); Map> searchMap = - getStorageGroupToQueryParamsMap(storageGroupName, deviceID, false); + getStorageGroupToQueryParamsMap(databaseName, deviceID, false); DataPartition dataPartition = partitionCache.getDataPartition(searchMap); assertNull(dataPartition); } @@ -462,10 +444,10 @@ private Map> getStorageGroupToQueryParamsM int startTime = 0; if (timePartitionSlotMissed) { - startTime = TIME_PARTITION_PER_STORAGE_GROUP; + startTime = TIME_PARTITION_PER_DATABASE; } for (int timePartitionSlotNumber = startTime; - timePartitionSlotNumber < startTime + TIME_PARTITION_PER_STORAGE_GROUP; + timePartitionSlotNumber < startTime + TIME_PARTITION_PER_DATABASE; timePartitionSlotNumber++) { TTimePartitionSlot timePartitionSlot = new TTimePartitionSlot(timePartitionSlotNumber); timePartitionSlotList.add(timePartitionSlot); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/metadata/read/NodeManagementMemoryMergeNodeSerdeTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/metadata/read/NodeManagementMemoryMergeNodeSerdeTest.java index 7b12f6d1dd713..84799f6c32333 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/metadata/read/NodeManagementMemoryMergeNodeSerdeTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/metadata/read/NodeManagementMemoryMergeNodeSerdeTest.java @@ -88,8 +88,8 @@ public void testNodeCountSerializeAndDeserialize() throws IllegalPathException { private NodeManagementMemoryMergeNode createNodeManagementMemoryMergeNode() throws IllegalPathException { Set data = new HashSet<>(); - data.add(new TSchemaNode("root.ln", MNodeType.STORAGE_GROUP.getNodeType())); - data.add(new TSchemaNode("root.abc", MNodeType.STORAGE_GROUP.getNodeType())); + data.add(new TSchemaNode("root.ln", MNodeType.DATABASE.getNodeType())); + data.add(new TSchemaNode("root.abc", MNodeType.DATABASE.getNodeType())); NodeManagementMemoryMergeNode memorySourceNode = new NodeManagementMemoryMergeNode(new PlanNodeId("nodeManagementMerge"), data); SchemaQueryMergeNode schemaMergeNode = new SchemaQueryMergeNode(new PlanNodeId("schemaMerge")); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/AbstractCompactionTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/AbstractCompactionTest.java index a5503bb9e645c..01defb0506964 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/AbstractCompactionTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/AbstractCompactionTest.java @@ -144,7 +144,7 @@ public class AbstractCompactionTest { private final long oldLongestExpiredTime = IoTDBDescriptor.getInstance().getConfig().getMaxExpiredTime(); - protected static File STORAGE_GROUP_DIR = + protected static File DATABASE_DIR = new File( TestConstant.BASE_OUTPUT_PATH + "data" @@ -184,7 +184,7 @@ public class AbstractCompactionTest { private int fileCount = 0; protected TsFileManager tsFileManager = - new TsFileManager(COMPACTION_TEST_SG, "0", STORAGE_GROUP_DIR.getPath()); + new TsFileManager(COMPACTION_TEST_SG, "0", DATABASE_DIR.getPath()); public void setUp() throws IOException, WriteProcessException, MetadataException, InterruptedException { diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/CrossSpaceCompactionWithFastPerformerValidationTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/CrossSpaceCompactionWithFastPerformerValidationTest.java index 644ddf77e1f24..0037fd7e36c9e 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/CrossSpaceCompactionWithFastPerformerValidationTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/CrossSpaceCompactionWithFastPerformerValidationTest.java @@ -78,8 +78,7 @@ @SuppressWarnings("OptionalGetWithoutIsPresent") public class CrossSpaceCompactionWithFastPerformerValidationTest extends AbstractCompactionTest { - TsFileManager tsFileManager = - new TsFileManager(COMPACTION_TEST_SG, "0", STORAGE_GROUP_DIR.getPath()); + TsFileManager tsFileManager = new TsFileManager(COMPACTION_TEST_SG, "0", DATABASE_DIR.getPath()); private final String oldThreadName = Thread.currentThread().getName(); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/RewriteCrossSpaceCompactionWithFastPerformerTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/RewriteCrossSpaceCompactionWithFastPerformerTest.java index ead500524e550..d9d2488025d41 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/RewriteCrossSpaceCompactionWithFastPerformerTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/RewriteCrossSpaceCompactionWithFastPerformerTest.java @@ -226,7 +226,7 @@ public void testAlignedCrossSpaceCompactionWithAllDataDeletedInTimeseries() thro List targetResources = CompactionFileGeneratorUtils.getCrossCompactionTargetTsFileResources(seqResources); TsFileManager tsFileManager = - new TsFileManager(COMPACTION_TEST_SG, "0", STORAGE_GROUP_DIR.getPath()); + new TsFileManager(COMPACTION_TEST_SG, "0", DATABASE_DIR.getPath()); tsFileManager.addAll(seqResources, true); tsFileManager.addAll(unseqResources, false); CrossSpaceCompactionTask task = @@ -455,7 +455,7 @@ public void testAlignedCrossSpaceCompactionWithAllDataDeletedInOneTargetFile() t List targetResources = CompactionFileGeneratorUtils.getCrossCompactionTargetTsFileResources(seqResources); TsFileManager tsFileManager = - new TsFileManager(COMPACTION_TEST_SG, "0", STORAGE_GROUP_DIR.getPath()); + new TsFileManager(COMPACTION_TEST_SG, "0", DATABASE_DIR.getPath()); tsFileManager.addAll(seqResources, true); tsFileManager.addAll(unseqResources, false); for (TsFileResource resource : seqResources) { @@ -577,7 +577,7 @@ public void testAlignedCrossSpaceCompactionWithAllDataDeletedInOneTargetFile() t public void testOneDeletionDuringCompaction() throws Exception { DataRegion vsgp = new DataRegion( - STORAGE_GROUP_DIR.getPath(), + DATABASE_DIR.getPath(), "0", new TsFileFlushPolicy.DirectFlushPolicy(), COMPACTION_TEST_SG); @@ -701,7 +701,7 @@ public void testOneDeletionDuringCompaction() throws Exception { public void testSeveralDeletionsDuringCompaction() throws Exception { DataRegion vsgp = new DataRegion( - STORAGE_GROUP_DIR.getPath(), + DATABASE_DIR.getPath(), "0", new TsFileFlushPolicy.DirectFlushPolicy(), COMPACTION_TEST_SG); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/RewriteCrossSpaceCompactionWithReadPointPerformerTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/RewriteCrossSpaceCompactionWithReadPointPerformerTest.java index d65400144137a..2d62696da7b96 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/RewriteCrossSpaceCompactionWithReadPointPerformerTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/RewriteCrossSpaceCompactionWithReadPointPerformerTest.java @@ -221,7 +221,7 @@ public void testAlignedCrossSpaceCompactionWithAllDataDeletedInTimeseries() thro List targetResources = CompactionFileGeneratorUtils.getCrossCompactionTargetTsFileResources(seqResources); TsFileManager tsFileManager = - new TsFileManager(COMPACTION_TEST_SG, "0", STORAGE_GROUP_DIR.getPath()); + new TsFileManager(COMPACTION_TEST_SG, "0", DATABASE_DIR.getPath()); tsFileManager.addAll(seqResources, true); tsFileManager.addAll(unseqResources, false); CrossSpaceCompactionTask task = @@ -450,7 +450,7 @@ public void testAlignedCrossSpaceCompactionWithAllDataDeletedInOneTargetFile() t List targetResources = CompactionFileGeneratorUtils.getCrossCompactionTargetTsFileResources(seqResources); TsFileManager tsFileManager = - new TsFileManager(COMPACTION_TEST_SG, "0", STORAGE_GROUP_DIR.getPath()); + new TsFileManager(COMPACTION_TEST_SG, "0", DATABASE_DIR.getPath()); tsFileManager.addAll(seqResources, true); tsFileManager.addAll(unseqResources, false); CrossSpaceCompactionTask task = @@ -572,7 +572,7 @@ public void testAlignedCrossSpaceCompactionWithAllDataDeletedInOneTargetFile() t public void testOneDeletionDuringCompaction() throws Exception { DataRegion vsgp = new DataRegion( - STORAGE_GROUP_DIR.getPath(), + DATABASE_DIR.getPath(), "0", new TsFileFlushPolicy.DirectFlushPolicy(), COMPACTION_TEST_SG); @@ -695,7 +695,7 @@ public void testOneDeletionDuringCompaction() throws Exception { public void testSeveralDeletionsDuringCompaction() throws Exception { DataRegion vsgp = new DataRegion( - STORAGE_GROUP_DIR.getPath(), + DATABASE_DIR.getPath(), "0", new TsFileFlushPolicy.DirectFlushPolicy(), COMPACTION_TEST_SG); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/MemTableFlushTaskTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/MemTableFlushTaskTest.java index 7b98a1ee99c50..4226f22aac992 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/MemTableFlushTaskTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/MemTableFlushTaskTest.java @@ -41,19 +41,19 @@ public class MemTableFlushTaskTest { private RestorableTsFileIOWriter writer; - private String storageGroup = "storage_group1"; - private String dataRegionId = "1"; - private String filePath = + private final String database = "database1"; + private final String dataRegionId = "1"; + private final String filePath = TestConstant.OUTPUT_DATA_DIR.concat("testUnsealedTsFileProcessor.tsfile"); private IMemTable memTable; - private long startTime = 1; - private long endTime = 100; + private final long startTime = 1; + private final long endTime = 100; @Before public void setUp() throws Exception { EnvironmentUtils.envSetUp(); writer = new RestorableTsFileIOWriter(FSFactoryProducer.getFSFactory().getFile(filePath)); - memTable = new PrimitiveMemTable(storageGroup, dataRegionId); + memTable = new PrimitiveMemTable(database, dataRegionId); } @After @@ -74,7 +74,7 @@ public void testFlushMemTable() MemTableTestUtils.measurementId0, MemTableTestUtils.dataType0); MemTableFlushTask memTableFlushTask = - new MemTableFlushTask(memTable, writer, storageGroup, dataRegionId); + new MemTableFlushTask(memTable, writer, database, dataRegionId); assertTrue( writer .getVisibleMetadataList( @@ -111,7 +111,7 @@ public void testFlushVectorMemTable() throws ExecutionException, InterruptedException, IllegalPathException, WriteProcessException { MemTableTestUtils.produceVectorData(memTable); MemTableFlushTask memTableFlushTask = - new MemTableFlushTask(memTable, writer, storageGroup, dataRegionId); + new MemTableFlushTask(memTable, writer, database, dataRegionId); assertTrue( writer .getVisibleMetadataList(MemTableTestUtils.deviceId0, "sensor0", TSDataType.BOOLEAN) @@ -139,7 +139,7 @@ public void testFlushNullableVectorMemTable() throws ExecutionException, InterruptedException, IllegalPathException, WriteProcessException { MemTableTestUtils.produceNullableVectorData(memTable); MemTableFlushTask memTableFlushTask = - new MemTableFlushTask(memTable, writer, storageGroup, dataRegionId); + new MemTableFlushTask(memTable, writer, database, dataRegionId); assertTrue( writer .getVisibleMetadataList(MemTableTestUtils.deviceId0, "sensor0", TSDataType.BOOLEAN) diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/tools/TsFileAndModSettleToolTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/tools/TsFileAndModSettleToolTest.java index 92bd8e0c0ab6e..996184b30e666 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/tools/TsFileAndModSettleToolTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/tools/TsFileAndModSettleToolTest.java @@ -60,9 +60,9 @@ public class TsFileAndModSettleToolTest { private final long newPartitionInterval = 3600_000; protected final long maxTimestamp = 50000L; // 100000000L; protected final String folder = "target" + File.separator + "settle"; - protected final String STORAGE_GROUP = "root.sg_0"; - protected final String DEVICE1 = STORAGE_GROUP + ".device_1"; - protected final String DEVICE2 = STORAGE_GROUP + ".device_2"; + protected final String DATABASE = "root.db"; + protected final String DEVICE1 = DATABASE + ".device_1"; + protected final String DEVICE2 = DATABASE + ".device_2"; protected final String SENSOR1 = "sensor_1"; protected final String SENSOR2 = "sensor_2"; private final long VALUE_OFFSET = 1; @@ -129,14 +129,14 @@ public List createFiles() throws IOException, InterruptedExcepti // first File sensors.add(SENSOR1); deviceSensorsMap.put(DEVICE1, sensors); - String timeseriesPath = STORAGE_GROUP + DEVICE1 + SENSOR1; + String timeseriesPath = DATABASE + DEVICE1 + SENSOR1; createFile(resourcesToBeSettled, deviceSensorsMap, timeseriesPath); // second file path = folder + File.separator + System.currentTimeMillis() + "-" + 0 + "-0.tsfile"; sensors.add(SENSOR2); deviceSensorsMap.put(DEVICE1, sensors); - timeseriesPath = STORAGE_GROUP + DEVICE1 + SENSOR2; + timeseriesPath = DATABASE + DEVICE1 + SENSOR2; createFile(resourcesToBeSettled, deviceSensorsMap, timeseriesPath); Thread.sleep(100); diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java index 2edece1c76d1e..e8c634b539d01 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java @@ -94,17 +94,17 @@ private SchemaConstant() { public static final byte DATABASE_MNODE_TYPE = 1; public static final byte MEASUREMENT_MNODE_TYPE = 2; public static final byte ENTITY_MNODE_TYPE = 3; - public static final byte STORAGE_GROUP_ENTITY_MNODE_TYPE = 4; + public static final byte DATABASE_ENTITY_MNODE_TYPE = 4; public static final byte LOGICAL_VIEW_MNODE_TYPE = 5; public static final byte TABLE_MNODE_TYPE = 6; public static final String INTERNAL_MNODE_TYPE_NAME = "InternalMNode"; - public static final String STORAGE_GROUP_MNODE_TYPE_NAME = "StorageGroupMNode"; + public static final String DATABASE_MNODE_TYPE_NAME = "DatabaseMNode"; public static final String MEASUREMENT_MNODE_TYPE_NAME = "MeasurementMNode"; public static final String ENTITY_MNODE_TYPE_NAME = "EntityMNode"; - public static final String STORAGE_GROUP_ENTITY_MNODE_TYPE_NAME = "StorageGroupEntityMNode"; + public static final String DATABASE_ENTITY_MNODE_TYPE_NAME = "StorageGroupEntityMNode"; public static final String LOGICAL_VIEW_MNODE_TYPE_NAME = "LogicalViewMNode"; @@ -121,13 +121,13 @@ public static String getMNodeTypeName(byte type) { case INTERNAL_MNODE_TYPE: return INTERNAL_MNODE_TYPE_NAME; case DATABASE_MNODE_TYPE: - return STORAGE_GROUP_MNODE_TYPE_NAME; + return DATABASE_MNODE_TYPE_NAME; case MEASUREMENT_MNODE_TYPE: return MEASUREMENT_MNODE_TYPE_NAME; case ENTITY_MNODE_TYPE: return ENTITY_MNODE_TYPE_NAME; - case STORAGE_GROUP_ENTITY_MNODE_TYPE: - return STORAGE_GROUP_ENTITY_MNODE_TYPE_NAME; + case DATABASE_ENTITY_MNODE_TYPE: + return DATABASE_ENTITY_MNODE_TYPE_NAME; case LOGICAL_VIEW_MNODE_TYPE: return LOGICAL_VIEW_MNODE_TYPE_NAME; case TABLE_MNODE_TYPE: @@ -137,7 +137,7 @@ public static String getMNodeTypeName(byte type) { } } - public static boolean isStorageGroupType(byte type) { - return type == DATABASE_MNODE_TYPE || type == STORAGE_GROUP_ENTITY_MNODE_TYPE; + public static boolean isDatabaseType(byte type) { + return type == DATABASE_MNODE_TYPE || type == DATABASE_ENTITY_MNODE_TYPE; } } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/MNodeType.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/MNodeType.java index ec2df5df931c0..752225a58f5d4 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/MNodeType.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/MNodeType.java @@ -28,7 +28,7 @@ public enum MNodeType { ROOT((byte) 0, "ROOT"), SG_INTERNAL((byte) 1, "SG INTERNAL"), - STORAGE_GROUP((byte) 2, "DATABASE"), + DATABASE((byte) 2, "DATABASE"), INTERNAL((byte) 3, "INTERNAL"), DEVICE((byte) 4, "DEVICE"), MEASUREMENT((byte) 5, "TIMESERIES"), @@ -50,7 +50,7 @@ public static MNodeType getMNodeType(byte type) { case 1: return MNodeType.SG_INTERNAL; case 2: - return MNodeType.STORAGE_GROUP; + return MNodeType.DATABASE; case 3: return MNodeType.INTERNAL; case 4: diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/AbstractDatabaseMNode.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/AbstractDatabaseMNode.java index 9c775ca008e6d..db0d86fdc1274 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/AbstractDatabaseMNode.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/AbstractDatabaseMNode.java @@ -139,7 +139,7 @@ public boolean isMeasurement() { @Override public MNodeType getMNodeType() { - return MNodeType.STORAGE_GROUP; + return MNodeType.DATABASE; } @Override From 47f928c6252c79f45ea4170bb5fa92e145648c4c Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 21 Nov 2025 11:22:58 +0800 Subject: [PATCH 02/33] db --- .../read/database/CountDatabasePlan.java | 16 +++--- .../read/database/GetDatabasePlan.java | 4 +- .../read/partition/GetDataPartitionPlan.java | 2 +- .../partition/GetSchemaPartitionPlan.java | 4 +- .../database/AdjustMaxRegionGroupNumPlan.java | 14 +++--- .../SetTimePartitionIntervalPlan.java | 17 +++---- .../partition/CreateDataPartitionPlan.java | 4 +- .../partition/CreateSchemaPartitionPlan.java | 8 +-- .../manager/partition/PartitionManager.java | 38 +++++++------- .../thrift/ConfigNodeRPCServiceProcessor.java | 2 +- .../common/header/DatasetHeaderFactory.java | 4 +- .../plan/analyze/AnalyzeVisitor.java | 2 +- .../plan/analyze/ClusterPartitionFetcher.java | 8 +-- .../analyze/schema/ClusterSchemaFetcher.java | 8 +-- .../impl/SchemaRegionPBTreeImpl.java | 32 ++++++------ .../logfile/MetadataOperationType.java | 48 ------------------ .../impl/pbtree/MTreeBelowSGCachedImpl.java | 50 +++++++++---------- ...nWithReadPointPerformerValidationTest.java | 2 +- .../iotdb/commons/schema/SchemaConstant.java | 10 ---- .../schema/column/ColumnHeaderConstant.java | 2 +- .../iotdb/commons/path/PartialPathTest.java | 6 +-- 21 files changed, 111 insertions(+), 170 deletions(-) delete mode 100644 iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/MetadataOperationType.java diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java index b2bef37fbcf6a..ada13e705127c 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/CountDatabasePlan.java @@ -28,18 +28,18 @@ public class CountDatabasePlan extends ConfigPhysicalReadPlan { - private final String[] storageGroupPattern; + private final String[] databasePattern; private final PathPatternTree scope; private final boolean isTableModel; private final boolean canSeeAuditDB; public CountDatabasePlan( - final List storageGroupPattern, + final List databasePattern, final PathPatternTree scope, final boolean isTableModel, final boolean canSeeAuditDB) { super(ConfigPhysicalPlanType.CountDatabase); - this.storageGroupPattern = storageGroupPattern.toArray(new String[0]); + this.databasePattern = databasePattern.toArray(new String[0]); this.scope = scope; this.isTableModel = isTableModel; this.canSeeAuditDB = canSeeAuditDB; @@ -47,19 +47,19 @@ public CountDatabasePlan( public CountDatabasePlan( final ConfigPhysicalPlanType type, - final List storageGroupPattern, + final List databasePattern, final PathPatternTree scope, final boolean isTableModel, final boolean canSeeAuditDB) { super(type); - this.storageGroupPattern = storageGroupPattern.toArray(new String[0]); + this.databasePattern = databasePattern.toArray(new String[0]); this.scope = scope; this.isTableModel = isTableModel; this.canSeeAuditDB = canSeeAuditDB; } public String[] getDatabasePattern() { - return storageGroupPattern; + return databasePattern; } public PathPatternTree getScope() { @@ -83,11 +83,11 @@ public boolean equals(final Object o) { return false; } final CountDatabasePlan that = (CountDatabasePlan) o; - return Arrays.equals(storageGroupPattern, that.storageGroupPattern); + return Arrays.equals(databasePattern, that.databasePattern); } @Override public int hashCode() { - return Arrays.hashCode(storageGroupPattern); + return Arrays.hashCode(databasePattern); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java index dc90c6e3ba540..3e0491730c19f 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/database/GetDatabasePlan.java @@ -28,14 +28,14 @@ public class GetDatabasePlan extends CountDatabasePlan { private final boolean isShowDatabasePlan; public GetDatabasePlan( - final List storageGroupPathPattern, + final List databasePathPattern, final PathPatternTree scope, final boolean isTableModel, final boolean isShowDatabasePlan, final boolean canSeeAuditDB) { super( ConfigPhysicalPlanType.GetDatabase, - storageGroupPathPattern, + databasePathPattern, scope, isTableModel, canSeeAuditDB); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java index cce8e14611490..f243716cb2bc6 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetDataPartitionPlan.java @@ -32,7 +32,7 @@ /** Get or create DataPartition by the specific partitionSlotsMap. */ public class GetDataPartitionPlan extends ConfigPhysicalReadPlan { - // Map>> + // Map>> protected Map> partitionSlotsMap; public GetDataPartitionPlan(final ConfigPhysicalPlanType configPhysicalPlanType) { diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java index 8bfccd18a1c62..93640d304645b 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/partition/GetSchemaPartitionPlan.java @@ -30,9 +30,9 @@ /** Get or create SchemaPartition by the specific partitionSlotsMap. */ public class GetSchemaPartitionPlan extends ConfigPhysicalReadPlan { - // Map> + // Map> // Get all SchemaPartitions when the partitionSlotsMap is empty - // Get all exists SchemaPartitions in one StorageGroup when the SeriesPartitionSlot is empty + // Get all exists SchemaPartitions in one Database when the SeriesPartitionSlot is empty protected Map> partitionSlotsMap; public GetSchemaPartitionPlan(final ConfigPhysicalPlanType configPhysicalPlanType) { diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/AdjustMaxRegionGroupNumPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/AdjustMaxRegionGroupNumPlan.java index 42b98cc30d03b..ca4ebb46152d6 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/AdjustMaxRegionGroupNumPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/AdjustMaxRegionGroupNumPlan.java @@ -34,7 +34,7 @@ public class AdjustMaxRegionGroupNumPlan extends ConfigPhysicalPlan { - // Map> + // Map> public final Map> maxRegionGroupNumMap; public AdjustMaxRegionGroupNumPlan() { @@ -42,8 +42,8 @@ public AdjustMaxRegionGroupNumPlan() { this.maxRegionGroupNumMap = new HashMap<>(); } - public void putEntry(final String storageGroup, final Pair maxRegionGroupNum) { - maxRegionGroupNumMap.put(storageGroup, maxRegionGroupNum); + public void putEntry(final String database, final Pair maxRegionGroupNum) { + maxRegionGroupNumMap.put(database, maxRegionGroupNum); } public Map> getMaxRegionGroupNumMap() { @@ -65,14 +65,14 @@ protected void serializeImpl(final DataOutputStream stream) throws IOException { @Override protected void deserializeImpl(final ByteBuffer buffer) throws IOException { - final int storageGroupNum = buffer.getInt(); + final int databaseNum = buffer.getInt(); - for (int i = 0; i < storageGroupNum; i++) { - final String storageGroup = ReadWriteIOUtils.readString(buffer); + for (int i = 0; i < databaseNum; i++) { + final String database = ReadWriteIOUtils.readString(buffer); final int maxSchemaRegionGroupNum = buffer.getInt(); final int maxDataRegionGroupNum = buffer.getInt(); maxRegionGroupNumMap.put( - storageGroup, new Pair<>(maxSchemaRegionGroupNum, maxDataRegionGroupNum)); + database, new Pair<>(maxSchemaRegionGroupNum, maxDataRegionGroupNum)); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/SetTimePartitionIntervalPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/SetTimePartitionIntervalPlan.java index 69fcd910c651c..7afc98296d54f 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/SetTimePartitionIntervalPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/database/SetTimePartitionIntervalPlan.java @@ -30,7 +30,7 @@ public class SetTimePartitionIntervalPlan extends ConfigPhysicalPlan { - private String storageGroup; + private String database; private long timePartitionInterval; @@ -38,14 +38,14 @@ public SetTimePartitionIntervalPlan() { super(ConfigPhysicalPlanType.SetTimePartitionInterval); } - public SetTimePartitionIntervalPlan(String storageGroup, long timePartitionInterval) { + public SetTimePartitionIntervalPlan(String database, long timePartitionInterval) { this(); - this.storageGroup = storageGroup; + this.database = database; this.timePartitionInterval = timePartitionInterval; } public String getDatabase() { - return storageGroup; + return database; } public long getTimePartitionInterval() { @@ -56,13 +56,13 @@ public long getTimePartitionInterval() { protected void serializeImpl(DataOutputStream stream) throws IOException { stream.writeShort(getType().getPlanType()); - BasicStructureSerDeUtil.write(storageGroup, stream); + BasicStructureSerDeUtil.write(database, stream); stream.writeLong(timePartitionInterval); } @Override protected void deserializeImpl(ByteBuffer buffer) throws IOException { - storageGroup = BasicStructureSerDeUtil.readString(buffer); + database = BasicStructureSerDeUtil.readString(buffer); timePartitionInterval = buffer.getLong(); } @@ -75,12 +75,11 @@ public boolean equals(Object o) { return false; } SetTimePartitionIntervalPlan that = (SetTimePartitionIntervalPlan) o; - return timePartitionInterval == that.timePartitionInterval - && storageGroup.equals(that.storageGroup); + return timePartitionInterval == that.timePartitionInterval && database.equals(that.database); } @Override public int hashCode() { - return Objects.hash(storageGroup, timePartitionInterval); + return Objects.hash(database, timePartitionInterval); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateDataPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateDataPartitionPlan.java index 89612da48df7c..985a9830ba600 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateDataPartitionPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateDataPartitionPlan.java @@ -76,8 +76,8 @@ protected void serializeImpl(DataOutputStream stream) throws IOException { protected void deserializeImpl(ByteBuffer buffer) throws IOException { assignedDataPartition = new HashMap<>(); - int storageGroupNum = buffer.getInt(); - for (int i = 0; i < storageGroupNum; i++) { + int databaseNum = buffer.getInt(); + for (int i = 0; i < databaseNum; i++) { String storageGroup = BasicStructureSerDeUtil.readString(buffer); DataPartitionTable dataPartitionTable = new DataPartitionTable(); dataPartitionTable.deserialize(buffer); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateSchemaPartitionPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateSchemaPartitionPlan.java index 5aee476ef2296..2a26ceea53a09 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateSchemaPartitionPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/partition/CreateSchemaPartitionPlan.java @@ -78,12 +78,12 @@ protected void serializeImpl(DataOutputStream stream) throws IOException { protected void deserializeImpl(ByteBuffer buffer) throws IOException { assignedSchemaPartition = new HashMap<>(); - int storageGroupNum = buffer.getInt(); - for (int i = 0; i < storageGroupNum; i++) { - String storageGroup = BasicStructureSerDeUtil.readString(buffer); + int databaseNum = buffer.getInt(); + for (int i = 0; i < databaseNum; i++) { + String database = BasicStructureSerDeUtil.readString(buffer); SchemaPartitionTable schemaPartitionTable = new SchemaPartitionTable(); schemaPartitionTable.deserialize(buffer); - assignedSchemaPartition.put(storageGroup, schemaPartitionTable); + assignedSchemaPartition.put(database, schemaPartitionTable); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java index 1db7f41c429a5..b3c67277a25c8 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java @@ -192,8 +192,7 @@ public SchemaPartitionResp getSchemaPartition(final GetSchemaPartitionPlan req) /** * Thread-safely get DataPartition * - * @param req DataPartitionPlan with Map> + * @param req DataPartitionPlan with Map> * @return DataPartitionDataSet that contains only existing DataPartition */ public DataPartitionResp getDataPartition(final GetDataPartitionPlan req) { @@ -270,15 +269,15 @@ public SchemaPartitionResp getOrCreateSchemaPartition(final GetOrCreateSchemaPar final Map> unassignedSchemaPartitionSlotsMap = partitionInfo.filterUnassignedSchemaPartitionSlots(req.getPartitionSlotsMap()); - // Here we ensure that each StorageGroup has at least one SchemaRegion. - // And if some StorageGroups own too many slots, extend SchemaRegion for them. + // Here we ensure that each Database has at least one SchemaRegion. + // And if some Databases own too many slots, extend SchemaRegion for them. - // Map + // Map final Map unassignedSchemaPartitionSlotsCountMap = new ConcurrentHashMap<>(); unassignedSchemaPartitionSlotsMap.forEach( - (storageGroup, unassignedSchemaPartitionSlots) -> + (database, unassignedSchemaPartitionSlots) -> unassignedSchemaPartitionSlotsCountMap.put( - storageGroup, unassignedSchemaPartitionSlots.size())); + database, unassignedSchemaPartitionSlots.size())); TSStatus status = extendRegionGroupIfNecessary( unassignedSchemaPartitionSlotsCountMap, TConsensusGroupType.SchemaRegion); @@ -353,7 +352,7 @@ public SchemaPartitionResp getOrCreateSchemaPartition(final GetOrCreateSchemaPar /** * Get DataPartition and create a new one if it does not exist. * - * @param req DataPartitionPlan with Map{@literal <}StorageGroupName, Map{@literal + * @param req DataPartitionPlan with Map{@literal <}DatabaseName, Map{@literal * <}SeriesPartitionSlot, List{@literal <}TimePartitionSlot{@literal >}{@literal >}{@literal * >} * @return DataPartitionResp with DataPartition and {@link TSStatus}. {@link @@ -415,15 +414,15 @@ public DataPartitionResp getOrCreateDataPartition(final GetOrCreateDataPartition Map> unassignedDataPartitionSlotsMap = partitionInfo.filterUnassignedDataPartitionSlots(req.getPartitionSlotsMap()); - // Here we ensure that each StorageGroup has at least one DataRegion. - // And if some StorageGroups own too many slots, extend DataRegion for them. + // Here we ensure that each Database has at least one DataRegion. + // And if some Databases own too many slots, extend DataRegion for them. - // Map + // Map Map unassignedDataPartitionSlotsCountMap = new ConcurrentHashMap<>(); unassignedDataPartitionSlotsMap.forEach( - (storageGroup, unassignedDataPartitionSlots) -> + (database, unassignedDataPartitionSlots) -> unassignedDataPartitionSlotsCountMap.put( - storageGroup, unassignedDataPartitionSlots.size())); + database, unassignedDataPartitionSlots.size())); TSStatus status = extendRegionGroupIfNecessary( unassignedDataPartitionSlotsCountMap, TConsensusGroupType.DataRegion); @@ -537,7 +536,8 @@ private TSStatus consensusWritePartitionResult(ConfigPhysicalPlan plan) { /** * Allocate more RegionGroup to the specified Databases if necessary. * - * @param unassignedPartitionSlotsCountMap Map + * @param unassignedPartitionSlotsCountMap Map{@literal <}Database, unassigned Partition + * count{@literal >} * @param consensusGroupType SchemaRegion or DataRegion * @return {@link TSStatusCode#SUCCESS_STATUS} when RegionGroup extension successful; {@link * TSStatusCode#NO_ENOUGH_DATANODE} when there are not enough DataNodes; {@link @@ -941,9 +941,9 @@ public long getAssignedTimePartitionSlotsCount(String database) { * * @param database DatabaseName * @param type SchemaRegion or DataRegion - * @return The specific StorageGroup's Regions that sorted by the number of allocated slots - * @throws NoAvailableRegionGroupException When all RegionGroups within the specified StorageGroup - * are unavailable currently + * @return The specific Database's Regions that sorted by the number of allocated slots + * @throws NoAvailableRegionGroupException When all RegionGroups within the specified Database are + * unavailable currently */ public List> getSortedRegionGroupSlotsCounter( final String database, final TConsensusGroupType type) @@ -1345,7 +1345,7 @@ public void maintainRegionReplicas() { schemaRegionCreateTask.getRegionId().getId(), new TCreateSchemaRegionReq( schemaRegionCreateTask.getRegionReplicaSet(), - schemaRegionCreateTask.getStorageGroup())); + schemaRegionCreateTask.getDatabase())); createSchemaRegionHandler.putNodeLocation( schemaRegionCreateTask.getRegionId().getId(), schemaRegionCreateTask.getTargetDataNode()); @@ -1381,7 +1381,7 @@ public void maintainRegionReplicas() { dataRegionCreateTask.getRegionId().getId(), new TCreateDataRegionReq( dataRegionCreateTask.getRegionReplicaSet(), - dataRegionCreateTask.getStorageGroup())); + dataRegionCreateTask.getDatabase())); createDataRegionHandler.putNodeLocation( dataRegionCreateTask.getRegionId().getId(), dataRegionCreateTask.getTargetDataNode()); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java index 59ce7352312f0..8d6bdc8f3966a 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java @@ -984,7 +984,7 @@ public TSStatus flush(final TFlushReq req) throws TException { configManager.getPartitionManager().filterUnExistDatabases(req.storageGroups); if (!noExistSg.isEmpty()) { final StringBuilder sb = new StringBuilder(); - noExistSg.forEach(storageGroup -> sb.append(storageGroup).append(",")); + noExistSg.forEach(database -> sb.append(database).append(",")); return RpcUtils.getStatus( TSStatusCode.DATABASE_NOT_EXIST, "Database " + sb.subSequence(0, sb.length() - 1) + " does not exist"); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/header/DatasetHeaderFactory.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/header/DatasetHeaderFactory.java index a9e737ac06e66..925dcfc9daf75 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/header/DatasetHeaderFactory.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/header/DatasetHeaderFactory.java @@ -27,8 +27,8 @@ private DatasetHeaderFactory() { // forbidding instantiation } - public static DatasetHeader getCountStorageGroupHeader() { - return new DatasetHeader(ColumnHeaderConstant.countStorageGroupColumnHeaders, true); + public static DatasetHeader getCountDatabaseHeader() { + return new DatasetHeader(ColumnHeaderConstant.countDatabaseColumnHeaders, true); } public static DatasetHeader getCountNodesHeader() { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java index 34a289b76c9da..7e405d63ebc24 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java @@ -3299,7 +3299,7 @@ public Analysis visitCountDatabase( CountDatabaseStatement countDatabaseStatement, MPPQueryContext context) { Analysis analysis = new Analysis(); analysis.setRealStatement(countDatabaseStatement); - analysis.setRespDatasetHeader(DatasetHeaderFactory.getCountStorageGroupHeader()); + analysis.setRespDatasetHeader(DatasetHeaderFactory.getCountDatabaseHeader()); return analysis; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java index 8c54fd640f88c..2502eb12430bf 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java @@ -103,9 +103,9 @@ public SchemaPartition getSchemaPartition( final PathPatternTree patternTree, String userName, boolean needAuditDB) { patternTree.constructTree(); final List deviceIDs = patternTree.getAllDevicePatterns(); - final Map> storageGroupToDeviceMap = + final Map> database2DeviceMap = partitionCache.getDatabaseToDevice(deviceIDs, true, false, userName); - SchemaPartition schemaPartition = partitionCache.getSchemaPartition(storageGroupToDeviceMap); + SchemaPartition schemaPartition = partitionCache.getSchemaPartition(database2DeviceMap); if (null == schemaPartition) { try (final ConfigNodeClient client = configNodeClientManager.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) { @@ -147,9 +147,9 @@ public SchemaPartition getOrCreateSchemaPartition( final PathPatternTree patternTree, final String userName) { patternTree.constructTree(); final List deviceIDs = patternTree.getAllDevicePatterns(); - final Map> storageGroupToDeviceMap = + final Map> database2DeviceMap = partitionCache.getDatabaseToDevice(deviceIDs, true, true, userName); - SchemaPartition schemaPartition = partitionCache.getSchemaPartition(storageGroupToDeviceMap); + SchemaPartition schemaPartition = partitionCache.getSchemaPartition(database2DeviceMap); if (null == schemaPartition) { try (final ConfigNodeClient client = configNodeClientManager.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetcher.java index 49e2995b3a800..a0b3e45cd4ca7 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetcher.java @@ -122,7 +122,7 @@ public ClusterSchemaTree fetchSchema( boolean isAllCached = true; ClusterSchemaTree cachedSchema; - Set storageGroupSet = new HashSet<>(); + Set databaseSet = new HashSet<>(); if (!explicitDevicePatternList.isEmpty()) { for (PartialPath explicitDevicePattern : explicitDevicePatternList) { cachedSchema = schemaCache.getMatchedTemplateSchema(explicitDevicePattern); @@ -131,7 +131,7 @@ public ClusterSchemaTree fetchSchema( break; } else { schemaTree.mergeSchemaTree(cachedSchema); - storageGroupSet.addAll(cachedSchema.getDatabases()); + databaseSet.addAll(cachedSchema.getDatabases()); } } } @@ -150,13 +150,13 @@ public ClusterSchemaTree fetchSchema( break; } else { schemaTree.mergeSchemaTree(cachedSchema); - storageGroupSet.addAll(cachedSchema.getDatabases()); + databaseSet.addAll(cachedSchema.getDatabases()); } } } if (isAllCached) { - schemaTree.setDatabases(storageGroupSet); + schemaTree.setDatabases(databaseSet); return schemaTree; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java index a39b881fe1f4f..22752f3ea54d8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java @@ -164,9 +164,9 @@ public class SchemaRegionPBTreeImpl implements ISchemaRegion { private volatile boolean initialized = false; private boolean isClearing = false; - private final String storageGroupDirPath; + private final String databaseDirPath; private final String schemaRegionDirPath; - private final String storageGroupFullPath; + private final String databaseFullPath; private final SchemaRegionId schemaRegionId; // the log file writer @@ -186,11 +186,11 @@ public class SchemaRegionPBTreeImpl implements ISchemaRegion { // region Interfaces and Implementation of initialization、snapshot、recover and clear public SchemaRegionPBTreeImpl(ISchemaRegionParams schemaRegionParams) throws MetadataException { - storageGroupFullPath = schemaRegionParams.getDatabase(); + databaseFullPath = schemaRegionParams.getDatabase(); this.schemaRegionId = schemaRegionParams.getSchemaRegionId(); - storageGroupDirPath = config.getSchemaDir() + File.separator + storageGroupFullPath; - schemaRegionDirPath = storageGroupDirPath + File.separator + schemaRegionId.getId(); + databaseDirPath = config.getSchemaDir() + File.separator + databaseFullPath; + schemaRegionDirPath = databaseDirPath + File.separator + schemaRegionId.getId(); this.regionStatistics = new CachedSchemaRegionStatistics( schemaRegionId.getId(), schemaRegionParams.getSchemaEngineStatistics()); @@ -225,7 +225,7 @@ public synchronized void init() throws MetadataException { tagManager = new TagManager(schemaRegionDirPath, regionStatistics); mtree = new MTreeBelowSGCachedImpl( - new PartialPath(storageGroupFullPath), + new PartialPath(databaseFullPath), tagManager::readTags, tagManager::readAttributes, this::flushCallback, @@ -248,7 +248,7 @@ public synchronized void init() throws MetadataException { } catch (IOException e) { logger.error( "Cannot recover all MTree from {} file, we try to recover as possible as we can", - storageGroupFullPath, + databaseFullPath, e); } initialized = true; @@ -269,7 +269,7 @@ private Consumer> measurementInitProcess() { } catch (IOException e) { logger.error( "Failed to recover tagIndex for {} in schemaRegion {}.", - storageGroupFullPath + PATH_SEPARATOR + measurementMNode.getFullPath(), + databaseFullPath + PATH_SEPARATOR + measurementMNode.getFullPath(), schemaRegionId); } }; @@ -300,14 +300,14 @@ private void flushCallback() { } private void initDir() throws SchemaDirCreationFailureException { - File sgSchemaFolder = SystemFileFactory.INSTANCE.getFile(storageGroupDirPath); + File sgSchemaFolder = SystemFileFactory.INSTANCE.getFile(databaseDirPath); if (!sgSchemaFolder.exists()) { if (sgSchemaFolder.mkdirs()) { - logger.info("create database schema folder {}", storageGroupDirPath); + logger.info("create database schema folder {}", databaseDirPath); } else { if (!sgSchemaFolder.exists()) { - logger.error("create database schema folder {} failed.", storageGroupDirPath); - throw new SchemaDirCreationFailureException(storageGroupDirPath); + logger.error("create database schema folder {} failed.", databaseDirPath); + throw new SchemaDirCreationFailureException(databaseDirPath); } } } @@ -405,9 +405,9 @@ private void initFromLog() throws IOException { logger.debug( "spend {} ms to deserialize {} mtree from mlog.bin", System.currentTimeMillis() - time, - storageGroupFullPath); + databaseFullPath); } catch (Exception e) { - throw new IOException("Failed to parse " + storageGroupFullPath + " mlog.bin", e); + throw new IOException("Failed to parse " + databaseFullPath + " mlog.bin", e); } } } @@ -476,7 +476,7 @@ public synchronized void clear() { @Override public String getDatabaseFullPath() { - return storageGroupFullPath; + return databaseFullPath; } @Override @@ -558,7 +558,7 @@ public void loadSnapshot(File latestSnapshotRootDir) { mtree = MTreeBelowSGCachedImpl.loadFromSnapshot( latestSnapshotRootDir, - storageGroupFullPath, + databaseFullPath, schemaRegionId.getId(), regionStatistics, metric, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/MetadataOperationType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/MetadataOperationType.java deleted file mode 100644 index 3e08745bb7240..0000000000000 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/MetadataOperationType.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.iotdb.db.schemaengine.schemaregion.logfile; - -public class MetadataOperationType { - - private MetadataOperationType() { - // allowed to do nothing - } - - public static final String CREATE_TIMESERIES = "0"; - public static final String DELETE_TIMESERIES = "1"; - public static final String SET_STORAGE_GROUP = "2"; - public static final String CREATE_ALIGNED_TIMESERIES = "3"; - public static final String AUTO_CREATE_DEVICE_MNODE = "4"; - public static final String SET_TTL = "10"; - public static final String DELETE_STORAGE_GROUP = "11"; - public static final String CREATE_INDEX = "31"; - public static final String DROP_INDEX = "32"; - public static final String CHANGE_OFFSET = "12"; - public static final String CHANGE_ALIAS = "13"; - public static final String CREATE_CONTINUOUS_QUERY = "14"; - public static final String DROP_CONTINUOUS_QUERY = "15"; - public static final String AUTO_CREATE_DEVICE = "4"; - public static final String CREATE_TEMPLATE = "5"; - public static final String SET_TEMPLATE = "6"; - public static final String UNSET_TEMPLATE = "69"; - public static final String SET_USING_TEMPLATE = "61"; - public static final String APPEND_TEMPLATE = "51"; - public static final String PRUNE_TEMPLATE = "52"; - public static final String DROP_TEMPLATE = "59"; -} diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java index 5127cd9e65532..7b6ac7d996e00 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java @@ -119,7 +119,7 @@ public class MTreeBelowSGCachedImpl { private final CachedMTreeStore store; @SuppressWarnings("java:S3077") - private volatile ICachedMNode storageGroupMNode; + private volatile ICachedMNode databaseMNode; private final ICachedMNode rootNode; private final Function, Map> tagGetter; @@ -131,7 +131,7 @@ public class MTreeBelowSGCachedImpl { // region MTree initialization, clear and serialization public MTreeBelowSGCachedImpl( - PartialPath storageGroupPath, + PartialPath databasePath, Function, Map> tagGetter, Function, Map> attributeGetter, Runnable flushCallback, @@ -147,17 +147,17 @@ public MTreeBelowSGCachedImpl( store = PBTreeFactory.getInstance() .createNewCachedMTreeStore( - storageGroupPath, schemaRegionId, regionStatistics, metric, flushCallback); - this.storageGroupMNode = store.getRoot(); - this.storageGroupMNode.setParent(storageGroupMNode.getParent()); - this.rootNode = store.generatePrefix(storageGroupPath); - levelOfSG = storageGroupPath.getNodeLength() - 1; + databasePath, schemaRegionId, regionStatistics, metric, flushCallback); + this.databaseMNode = store.getRoot(); + this.databaseMNode.setParent(databaseMNode.getParent()); + this.rootNode = store.generatePrefix(databasePath); + levelOfSG = databasePath.getNodeLength() - 1; // recover MNode try (MNodeCollector collector = new MNodeCollector( this.rootNode, - new PartialPath(storageGroupMNode.getFullPath()), + new PartialPath(databaseMNode.getFullPath()), this.store, true, SchemaConstant.ALL_MATCH_SCOPE) { @@ -177,7 +177,7 @@ protected Void collectMNode(ICachedMNode node) { /** Only used for load snapshot */ private MTreeBelowSGCachedImpl( - PartialPath storageGroupPath, + PartialPath databasePath, CachedMTreeStore store, Consumer> measurementProcess, Consumer> deviceProcess, @@ -187,9 +187,9 @@ private MTreeBelowSGCachedImpl( throws MetadataException { this.store = store; this.regionStatistics = regionStatistics; - this.storageGroupMNode = store.getRoot(); - this.rootNode = store.generatePrefix(storageGroupPath); - levelOfSG = storageGroupMNode.getPartialPath().getNodeLength() - 1; + this.databaseMNode = store.getRoot(); + this.rootNode = store.generatePrefix(databasePath); + levelOfSG = databaseMNode.getPartialPath().getNodeLength() - 1; this.tagGetter = tagGetter; this.attributeGetter = attributeGetter; @@ -197,7 +197,7 @@ private MTreeBelowSGCachedImpl( try (MNodeCollector collector = new MNodeCollector( this.rootNode, - new PartialPath(storageGroupMNode.getFullPath()), + new PartialPath(databaseMNode.getFullPath()), this.store, true, SchemaConstant.ALL_MATCH_SCOPE) { @@ -217,7 +217,7 @@ protected Void collectMNode(ICachedMNode node) { public void clear() { store.clear(); - storageGroupMNode = null; + databaseMNode = null; } public boolean createSnapshot(File snapshotDir) { @@ -226,7 +226,7 @@ public boolean createSnapshot(File snapshotDir) { public static MTreeBelowSGCachedImpl loadFromSnapshot( File snapshotDir, - String storageGroupFullPath, + String databaseFullPath, int schemaRegionId, CachedSchemaRegionStatistics regionStatistics, SchemaRegionCachedMetric metric, @@ -237,11 +237,11 @@ public static MTreeBelowSGCachedImpl loadFromSnapshot( Runnable flushCallback) throws IOException, MetadataException { return new MTreeBelowSGCachedImpl( - new PartialPath(storageGroupFullPath), + new PartialPath(databaseFullPath), PBTreeFactory.getInstance() .createCachedMTreeStoreFromSnapshot( snapshotDir, - storageGroupFullPath, + databaseFullPath, schemaRegionId, regionStatistics, metric, @@ -593,7 +593,7 @@ private ICachedMNode checkAndAutoCreateInternalPath(PartialPath devicePath) if (nodeNames.length == levelOfSG + 1) { return null; } - ICachedMNode cur = storageGroupMNode; + ICachedMNode cur = databaseMNode; ICachedMNode child; String childName; try { @@ -621,8 +621,8 @@ private ICachedMNode checkAndAutoCreateDeviceNode(String deviceName, ICachedMNod throws MetadataException { if (deviceParent == null) { // device is sg - pinMNode(storageGroupMNode); - return storageGroupMNode; + pinMNode(databaseMNode); + return databaseMNode; } ICachedMNode device = store.getChild(deviceParent, deviceName); if (device == null) { @@ -666,7 +666,7 @@ public IMeasurementMNode deleteTimeseries(PartialPath path) * Used when delete timeseries or deactivate template. The last survived ancestor will be * unpinned. * - * @param entityMNode delete empty InternalMNode from entityMNode to storageGroupMNode + * @param entityMNode delete empty InternalMNode from entityMNode to databaseMNode */ private void deleteAndUnpinEmptyInternalMNode(IDeviceMNode entityMNode) throws MetadataException { @@ -830,7 +830,7 @@ public void setAlias(IMeasurementMNode measurementMNode, String al public ICachedMNode getDeviceNodeWithAutoCreating(PartialPath deviceId) throws MetadataException { String[] nodeNames = deviceId.getNodes(); MetaFormatUtils.checkTimeseries(deviceId); - ICachedMNode cur = storageGroupMNode; + ICachedMNode cur = databaseMNode; ICachedMNode child; try { for (int i = levelOfSG + 1; i < nodeNames.length; i++) { @@ -983,7 +983,7 @@ protected Void collectEntity(IDeviceMNode node) { */ public ICachedMNode getNodeByPath(PartialPath path) throws MetadataException { String[] nodes = path.getNodes(); - ICachedMNode cur = storageGroupMNode; + ICachedMNode cur = databaseMNode; ICachedMNode next; try { for (int i = levelOfSG + 1; i < nodes.length; i++) { @@ -1164,7 +1164,7 @@ public void alterLogicalView(PartialPath path, ViewExpression expression) public void activateTemplate(PartialPath activatePath, Template template) throws MetadataException { String[] nodes = activatePath.getNodes(); - ICachedMNode cur = storageGroupMNode; + ICachedMNode cur = databaseMNode; ICachedMNode child; IDeviceMNode entityMNode; @@ -1211,7 +1211,7 @@ public void activateTemplate(PartialPath activatePath, Template template) public void activateTemplateWithoutCheck( PartialPath activatePath, int templateId, boolean isAligned) throws MetadataException { String[] nodes = activatePath.getNodes(); - ICachedMNode cur = storageGroupMNode; + ICachedMNode cur = databaseMNode; ICachedMNode child; IDeviceMNode entityMNode; diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/CrossSpaceCompactionWithReadPointPerformerValidationTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/CrossSpaceCompactionWithReadPointPerformerValidationTest.java index b05ab1e633e3a..b1fa4ed5df769 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/CrossSpaceCompactionWithReadPointPerformerValidationTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/CrossSpaceCompactionWithReadPointPerformerValidationTest.java @@ -78,7 +78,7 @@ public class CrossSpaceCompactionWithReadPointPerformerValidationTest extends AbstractCompactionTest { // TsFileManager tsFileManager = - // new TsFileManager(COMPACTION_TEST_SG, "0", STORAGE_GROUP_DIR.getPath()); + // new TsFileManager(COMPACTION_TEST_SG, "0", DATABASE_DIR.getPath()); private final String oldThreadName = Thread.currentThread().getName(); diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java index e8c634b539d01..ca1c474eb2126 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java @@ -19,7 +19,6 @@ package org.apache.iotdb.commons.schema; -import org.apache.iotdb.commons.conf.IoTDBConstant; import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.path.PathPatternTree; import org.apache.iotdb.commons.path.fa.dfa.PatternDFA; @@ -35,20 +34,11 @@ private SchemaConstant() { public static final String MTREE_PREFIX = "mtree"; private static final String MTREE_VERSION = "1"; - public static final String MTREE_TXT_SNAPSHOT_OLD_VERSION = - MTREE_PREFIX + IoTDBConstant.FILE_NAME_SEPARATOR + MTREE_VERSION + ".snapshot"; - public static final String MTREE_SNAPSHOT_OLD_VERSION = - MTREE_PREFIX + IoTDBConstant.FILE_NAME_SEPARATOR + MTREE_VERSION + ".snapshot.bin"; - public static final String MTREE_SNAPSHOT_TMP_OLDVERSION = - MTREE_PREFIX + IoTDBConstant.FILE_NAME_SEPARATOR + MTREE_VERSION + ".snapshot.bin.tmp"; public static final String ROOT = "root"; - public static final String METADATA_TXT_LOG = "mlog.txt"; public static final String METADATA_LOG = "mlog.bin"; public static final String METADATA_LOG_DESCRIPTION = "mlog.description"; public static final String TAG_LOG = "tlog.txt"; - public static final String TEMPLATE_FILE = "template_log.bin"; - public static final String STORAGE_GROUP_LOG = "storage_group_log.bin"; public static final String PBTREE_FILE_NAME = "pbtree.pst"; public static final String PBTREE_LOG_FILE_NAME = "pbtree_log.bin"; diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/column/ColumnHeaderConstant.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/column/ColumnHeaderConstant.java index 30997db31e1e2..ff5188513207c 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/column/ColumnHeaderConstant.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/column/ColumnHeaderConstant.java @@ -425,7 +425,7 @@ private ColumnHeaderConstant() { public static final List countTimeSeriesColumnHeaders = ImmutableList.of(new ColumnHeader(COUNT_TIMESERIES, TSDataType.INT64)); - public static final List countStorageGroupColumnHeaders = + public static final List countDatabaseColumnHeaders = ImmutableList.of(new ColumnHeader(COUNT_DATABASE, TSDataType.INT32)); public static final List showRegionColumnHeaders = diff --git a/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/path/PartialPathTest.java b/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/path/PartialPathTest.java index 777f06d2d3927..4cccc33c07c3e 100644 --- a/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/path/PartialPathTest.java +++ b/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/path/PartialPathTest.java @@ -139,9 +139,9 @@ public void testLegalPath() throws IllegalPathException { nodes = new String[] {"root", "sg", "abc"}; checkNodes(nodes, t.getNodes()); - PartialPath u = new PartialPath("root.sg.set_storage_group"); - Assert.assertEquals("root.sg.set_storage_group", u.getFullPath()); - nodes = new String[] {"root", "sg", "set_storage_group"}; + PartialPath u = new PartialPath("root.sg.set_database"); + Assert.assertEquals("root.sg.set_database", u.getFullPath()); + nodes = new String[] {"root", "sg", "set_database"}; checkNodes(nodes, u.getNodes()); } From 6b363ff5f894bf2a686229dd4927122e3b451c7d Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 21 Nov 2025 11:29:58 +0800 Subject: [PATCH 03/33] fix --- .../consensus/response/database/CountDatabaseResp.java | 2 +- .../service/thrift/ConfigNodeRPCServiceProcessor.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/CountDatabaseResp.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/CountDatabaseResp.java index b034c07c4bbb3..0c9d9577bc96d 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/CountDatabaseResp.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/CountDatabaseResp.java @@ -46,7 +46,7 @@ public void setCount(int count) { this.count = count; } - public void convertToRPCCountStorageGroupResp(TCountDatabaseResp resp) { + public void convertToRPCCountDatabaseResp(TCountDatabaseResp resp) { resp.setStatus(status); if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { resp.setCount(count); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java index 8d6bdc8f3966a..ef6516af39c64 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java @@ -531,7 +531,7 @@ public TCountDatabaseResp countMatchedDatabases(final TGetDatabaseReq req) { (CountDatabaseResp) configManager.countMatchedDatabases(plan); final TCountDatabaseResp resp = new TCountDatabaseResp(); - countDatabaseResp.convertToRPCCountStorageGroupResp(resp); + countDatabaseResp.convertToRPCCountDatabaseResp(resp); return resp; } From 0e0a2fdbeefa7498ba81f1bce62cf99d90a059b8 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 21 Nov 2025 11:42:25 +0800 Subject: [PATCH 04/33] ff --- .../source/IoTDBConfigRegionSourceTest.java | 2 +- .../consensus/config/PipeConsensusConfig.java | 36 ++++++------- .../ConsensusPipeDispatcher.java | 4 +- .../consensuspipe/ConsensusPipeManager.java | 4 +- .../metric/PipeConsensusSyncLagManager.java | 20 +++---- .../db/consensus/DataRegionConsensusImpl.java | 4 +- .../db/pipe/agent/task/PipeDataNodeTask.java | 28 +++++----- .../agent/task/PipeDataNodeTaskAgent.java | 10 ++-- .../task/builder/PipeDataNodeBuilder.java | 8 +-- .../task/builder/PipeDataNodeTaskBuilder.java | 4 +- .../task/stage/PipeTaskProcessorStage.java | 12 ++--- .../agent/task/stage/PipeTaskSourceStage.java | 33 ++++++------ .../ConsensusPipeDataNodeDispatcher.java | 8 +-- .../dataregion/IoTDBDataRegionSource.java | 52 +++++++++---------- ...icalDataRegionTsFileAndDeletionSource.java | 6 +-- .../PipeRealtimeDataRegionSource.java | 18 +++---- .../source/IoTDBDataRegionSourceTest.java | 2 +- .../pipe/agent/task/PipeTaskAgent.java | 8 +-- .../config/constant/PipeSourceConstant.java | 30 +++++------ .../datastructure/pattern/TablePattern.java | 2 +- .../datastructure/pattern/TreePattern.java | 2 +- .../visibility/VisibilityUtils.java | 2 +- .../commons/pipe/source/IoTDBSource.java | 4 +- 23 files changed, 149 insertions(+), 150 deletions(-) diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/IoTDBConfigRegionSourceTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/IoTDBConfigRegionSourceTest.java index 15051d436d8b2..3a072301bfa28 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/IoTDBConfigRegionSourceTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/IoTDBConfigRegionSourceTest.java @@ -43,7 +43,7 @@ public void testIoTDBConfigExtractor() { Boolean.TRUE.toString()); put( PipeSourceConstant.EXTRACTOR_REALTIME_MODE_KEY, - PipeSourceConstant.EXTRACTOR_REALTIME_MODE_HYBRID_VALUE); + PipeSourceConstant.SOURCE_REALTIME_MODE_HYBRID_VALUE); put( PipeSourceConstant.EXTRACTOR_INCLUSION_KEY, PipeSourceConstant.EXTRACTOR_INCLUSION_DEFAULT_VALUE); diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/PipeConsensusConfig.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/PipeConsensusConfig.java index da06c60a624dc..4fb2bfbf3850a 100644 --- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/PipeConsensusConfig.java +++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/PipeConsensusConfig.java @@ -241,9 +241,9 @@ public RPC build() { } public static class Pipe { - private final String extractorPluginName; + private final String sourcePluginName; private final String processorPluginName; - private final String connectorPluginName; + private final String sinkPluginName; private final ConsensusPipeDispatcher consensusPipeDispatcher; private final ConsensusPipeGuardian consensusPipeGuardian; private final ConsensusPipeSelector consensusPipeSelector; @@ -252,18 +252,18 @@ public static class Pipe { private final long consensusPipeGuardJobIntervalInSeconds; public Pipe( - String extractorPluginName, + String sourcePluginName, String processorPluginName, - String connectorPluginName, + String sinkPluginName, ConsensusPipeDispatcher consensusPipeDispatcher, ConsensusPipeGuardian consensusPipeGuardian, ConsensusPipeSelector consensusPipeSelector, ReplicateProgressManager replicateProgressManager, ConsensusPipeReceiver consensusPipeReceiver, long consensusPipeGuardJobIntervalInSeconds) { - this.extractorPluginName = extractorPluginName; + this.sourcePluginName = sourcePluginName; this.processorPluginName = processorPluginName; - this.connectorPluginName = connectorPluginName; + this.sinkPluginName = sinkPluginName; this.consensusPipeDispatcher = consensusPipeDispatcher; this.consensusPipeGuardian = consensusPipeGuardian; this.consensusPipeSelector = consensusPipeSelector; @@ -272,16 +272,16 @@ public Pipe( this.consensusPipeGuardJobIntervalInSeconds = consensusPipeGuardJobIntervalInSeconds; } - public String getExtractorPluginName() { - return extractorPluginName; + public String getSourcePluginName() { + return sourcePluginName; } public String getProcessorPluginName() { return processorPluginName; } - public String getConnectorPluginName() { - return connectorPluginName; + public String getSinkPluginName() { + return sinkPluginName; } public ConsensusPipeDispatcher getConsensusPipeDispatcher() { @@ -313,10 +313,10 @@ public static Pipe.Builder newBuilder() { } public static class Builder { - private String extractorPluginName = BuiltinPipePlugin.IOTDB_EXTRACTOR.getPipePluginName(); + private String sourcePluginName = BuiltinPipePlugin.IOTDB_EXTRACTOR.getPipePluginName(); private String processorPluginName = BuiltinPipePlugin.PIPE_CONSENSUS_PROCESSOR.getPipePluginName(); - private String connectorPluginName = + private String sinkPluginName = BuiltinPipePlugin.PIPE_CONSENSUS_ASYNC_CONNECTOR.getPipePluginName(); private ConsensusPipeDispatcher consensusPipeDispatcher = null; private ConsensusPipeGuardian consensusPipeGuardian = null; @@ -325,8 +325,8 @@ public static class Builder { private ConsensusPipeReceiver consensusPipeReceiver = null; private long consensusPipeGuardJobIntervalInSeconds = 180L; - public Pipe.Builder setExtractorPluginName(String extractorPluginName) { - this.extractorPluginName = extractorPluginName; + public Pipe.Builder setSourcePluginName(String sourcePluginName) { + this.sourcePluginName = sourcePluginName; return this; } @@ -335,8 +335,8 @@ public Pipe.Builder setProcessorPluginName(String processorPluginName) { return this; } - public Pipe.Builder setConnectorPluginName(String connectorPluginName) { - this.connectorPluginName = connectorPluginName; + public Pipe.Builder setSinkPluginName(String sinkPluginName) { + this.sinkPluginName = sinkPluginName; return this; } @@ -375,9 +375,9 @@ public Pipe.Builder setConsensusPipeGuardJobIntervalInSeconds( public Pipe build() { return new Pipe( - extractorPluginName, + sourcePluginName, processorPluginName, - connectorPluginName, + sinkPluginName, consensusPipeDispatcher, consensusPipeGuardian, consensusPipeSelector, diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeDispatcher.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeDispatcher.java index 568f68bb577e4..b3e75cef35ace 100644 --- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeDispatcher.java +++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeDispatcher.java @@ -24,9 +24,9 @@ public interface ConsensusPipeDispatcher { void createPipe( String pipeName, - Map extractorAttributes, + Map sourceAttributes, Map processorAttributes, - Map connectorAttributes, + Map sinkAttributes, boolean needManuallyStart) throws Exception; diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeManager.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeManager.java index c1aef74a4b43a..7167961951e80 100644 --- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeManager.java +++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/consensuspipe/ConsensusPipeManager.java @@ -99,7 +99,7 @@ public void createConsensusPipe(Peer senderPeer, Peer receiverPeer, boolean need final ConsensusPipeName consensusPipeName = new ConsensusPipeName(senderPeer, receiverPeer); return new ImmutableTriple<>( ImmutableMap.builder() - .put(EXTRACTOR_KEY, config.getExtractorPluginName()) + .put(EXTRACTOR_KEY, config.getSourcePluginName()) .put(EXTRACTOR_INCLUSION_KEY, CONSENSUS_EXTRACTOR_INCLUSION_VALUE) .put( EXTRACTOR_CONSENSUS_GROUP_ID_KEY, @@ -121,7 +121,7 @@ public void createConsensusPipe(Peer senderPeer, Peer receiverPeer, boolean need .put(PROCESSOR_KEY, config.getProcessorPluginName()) .build(), ImmutableMap.builder() - .put(CONNECTOR_KEY, config.getConnectorPluginName()) + .put(CONNECTOR_KEY, config.getSinkPluginName()) .put( CONNECTOR_CONSENSUS_GROUP_ID_KEY, String.valueOf(consensusPipeName.getConsensusGroupId().getId())) diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java index bd9a2fd73d365..63c0e9be167e1 100644 --- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java +++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java @@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock; /** - * This class is used to aggregate the write progress of all Connectors to calculate the minimum + * This class is used to aggregate the write progress of all Sinks to calculate the minimum * synchronization progress of all follower copies, thereby calculating syncLag. * *

Note: every consensusGroup/dataRegion has and only has 1 instance of this class. @@ -36,7 +36,7 @@ public class PipeConsensusSyncLagManager { long syncLag = Long.MIN_VALUE; ReentrantLock lock = new ReentrantLock(); - Map consensusPipe2ConnectorMap = new ConcurrentHashMap<>(); + Map consensusPipe2SinkMap = new ConcurrentHashMap<>(); /** * pinnedCommitIndex - currentReplicateProgress. If res <= 0, indicating that replication is @@ -44,7 +44,7 @@ public class PipeConsensusSyncLagManager { */ public long getSyncLagForRegionMigration( ConsensusPipeName consensusPipeName, long pinnedCommitIndex) { - return Optional.ofNullable(consensusPipe2ConnectorMap.get(consensusPipeName)) + return Optional.ofNullable(consensusPipe2SinkMap.get(consensusPipeName)) .map( consensusPipeSink -> Math.max(pinnedCommitIndex - consensusPipeSink.getFollowerApplyProgress(), 0L)) @@ -56,7 +56,7 @@ public long getSyncLagForRegionMigration( * finished. */ public long getSyncLagForSpecificConsensusPipe(ConsensusPipeName consensusPipeName) { - return Optional.ofNullable(consensusPipe2ConnectorMap.get(consensusPipeName)) + return Optional.ofNullable(consensusPipe2SinkMap.get(consensusPipeName)) .map( consensusPipeSink -> { long userWriteProgress = consensusPipeSink.getLeaderReplicateProgress(); @@ -67,7 +67,7 @@ public long getSyncLagForSpecificConsensusPipe(ConsensusPipeName consensusPipeNa } public long getCurrentLeaderReplicateIndex(ConsensusPipeName consensusPipeName) { - return Optional.ofNullable(consensusPipe2ConnectorMap.get(consensusPipeName)) + return Optional.ofNullable(consensusPipe2SinkMap.get(consensusPipeName)) .map(ConsensusPipeSink::getLeaderReplicateProgress) .orElse(0L); } @@ -76,7 +76,7 @@ public void addConsensusPipeConnector( ConsensusPipeName consensusPipeName, ConsensusPipeSink consensusPipeSink) { lock.lock(); try { - consensusPipe2ConnectorMap.put(consensusPipeName, consensusPipeSink); + consensusPipe2SinkMap.put(consensusPipeName, consensusPipeSink); } finally { lock.unlock(); } @@ -85,7 +85,7 @@ public void addConsensusPipeConnector( public void removeConsensusPipeConnector(ConsensusPipeName consensusPipeName) { lock.lock(); try { - consensusPipe2ConnectorMap.remove(consensusPipeName); + consensusPipe2SinkMap.remove(consensusPipeName); } finally { lock.unlock(); } @@ -100,12 +100,12 @@ public long calculateSyncLag() { lock.lock(); try { // if there isn't a consensus pipe task, the syncLag is 0 - if (consensusPipe2ConnectorMap.isEmpty()) { + if (consensusPipe2SinkMap.isEmpty()) { return 0; } // else we find the biggest gap between leader and replicas in all consensus pipe task. syncLag = Long.MIN_VALUE; - consensusPipe2ConnectorMap + consensusPipe2SinkMap .keySet() .forEach( consensusPipeName -> @@ -118,7 +118,7 @@ public long calculateSyncLag() { } public void clear() { - this.consensusPipe2ConnectorMap.clear(); + this.consensusPipe2SinkMap.clear(); } private PipeConsensusSyncLagManager() { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java index 2649f8de7af4a..cc6dde0431309 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java @@ -175,11 +175,11 @@ private static ConsensusConfig buildConsensusConfig() { .build()) .setPipe( PipeConsensusConfig.Pipe.newBuilder() - .setExtractorPluginName( + .setSourcePluginName( BuiltinPipePlugin.IOTDB_EXTRACTOR.getPipePluginName()) .setProcessorPluginName( BuiltinPipePlugin.PIPE_CONSENSUS_PROCESSOR.getPipePluginName()) - .setConnectorPluginName( + .setSinkPluginName( BuiltinPipePlugin.PIPE_CONSENSUS_ASYNC_CONNECTOR.getPipePluginName()) // name .setConsensusPipeDispatcher(new ConsensusPipeDataNodeDispatcher()) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTask.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTask.java index d33ec44a86e53..0d0b955c2109d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTask.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTask.java @@ -32,32 +32,32 @@ public class PipeDataNodeTask implements PipeTask { private final String pipeName; private final int regionId; - private final PipeTaskStage extractorStage; + private final PipeTaskStage sourceStage; private final PipeTaskStage processorStage; - private final PipeTaskStage connectorStage; + private final PipeTaskStage sinkStage; private volatile boolean isCompleted = false; public PipeDataNodeTask( final String pipeName, final int regionId, - final PipeTaskStage extractorStage, + final PipeTaskStage sourceStage, final PipeTaskStage processorStage, - final PipeTaskStage connectorStage) { + final PipeTaskStage sinkStage) { this.pipeName = pipeName; this.regionId = regionId; - this.extractorStage = extractorStage; + this.sourceStage = sourceStage; this.processorStage = processorStage; - this.connectorStage = connectorStage; + this.sinkStage = sinkStage; } @Override public void create() { final long startTime = System.currentTimeMillis(); - extractorStage.create(); + sourceStage.create(); processorStage.create(); - connectorStage.create(); + sinkStage.create(); LOGGER.info( "Create pipe DN task {} successfully within {} ms", this, @@ -67,9 +67,9 @@ public void create() { @Override public void drop() { final long startTime = System.currentTimeMillis(); - extractorStage.drop(); + sourceStage.drop(); processorStage.drop(); - connectorStage.drop(); + sinkStage.drop(); LOGGER.info( "Drop pipe DN task {} successfully within {} ms", this, @@ -79,9 +79,9 @@ public void drop() { @Override public void start() { final long startTime = System.currentTimeMillis(); - extractorStage.start(); + sourceStage.start(); processorStage.start(); - connectorStage.start(); + sinkStage.start(); LOGGER.info( "Start pipe DN task {} successfully within {} ms", this, @@ -91,9 +91,9 @@ public void start() { @Override public void stop() { final long startTime = System.currentTimeMillis(); - extractorStage.stop(); + sourceStage.stop(); processorStage.stop(); - connectorStage.stop(); + sinkStage.stop(); LOGGER.info( "Stop pipe DN task {} successfully within {} ms", this, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java index 438dfa3f2334e..3ed4aa673bf07 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java @@ -111,7 +111,7 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATH_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_END_TIME_KEY; @@ -594,7 +594,7 @@ public boolean isFullSync(final PipeParameters parameters) { final boolean isRealtimeEnable = parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE); + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE); return isHistoryEnable && isRealtimeEnable; } @@ -742,7 +742,7 @@ private void calculateInsertNodeQueueMemory(final PipeParameters sourceParameter // Realtime source is enabled by default, so we only need to check the source realtime if (!sourceParameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE)) { + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { return; } @@ -751,8 +751,8 @@ private void calculateInsertNodeQueueMemory(final PipeParameters sourceParameter sourceParameters.getStringByKeys( PipeSourceConstant.EXTRACTOR_REALTIME_MODE_KEY, PipeSourceConstant.SOURCE_REALTIME_MODE_KEY); - if (PipeSourceConstant.EXTRACTOR_REALTIME_MODE_BATCH_MODE_VALUE.equals(realtimeMode) - || PipeSourceConstant.EXTRACTOR_REALTIME_MODE_FILE_VALUE.equals(realtimeMode)) { + if (PipeSourceConstant.SOURCE_REALTIME_MODE_BATCH_MODE_VALUE.equals(realtimeMode) + || PipeSourceConstant.SOURCE_REALTIME_MODE_FILE_VALUE.equals(realtimeMode)) { return; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeBuilder.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeBuilder.java index b55704a3da408..46a10135d8865 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeBuilder.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeBuilder.java @@ -63,18 +63,18 @@ public Map buildTasksWithInternalSource() throws IllegalPathE final PipeTaskMeta pipeTaskMeta = consensusGroupIdToPipeTaskMeta.getValue(); if (pipeTaskMeta.getLeaderNodeId() == CONFIG.getDataNodeId()) { - final PipeParameters extractorParameters = pipeStaticMeta.getSourceParameters(); + final PipeParameters sourceParameters = pipeStaticMeta.getSourceParameters(); final DataRegionId dataRegionId = new DataRegionId(consensusGroupId); final boolean needConstructDataRegionTask = dataRegionIds.contains(dataRegionId) && DataRegionListeningFilter.shouldDataRegionBeListened( - extractorParameters, dataRegionId); + sourceParameters, dataRegionId); final boolean needConstructSchemaRegionTask = schemaRegionIds.contains(new SchemaRegionId(consensusGroupId)) && SchemaRegionListeningFilter.shouldSchemaRegionBeListened( - consensusGroupId, extractorParameters); + consensusGroupId, sourceParameters); - // Advance the extractor parameters parsing logic to avoid creating un-relevant pipeTasks + // Advance the source parameters parsing logic to avoid creating un-relevant pipeTasks if (needConstructDataRegionTask || needConstructSchemaRegionTask) { consensusGroupIdToPipeTaskMap.put( consensusGroupId, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java index 038420527fd4a..2e89b4e91ef6d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java @@ -51,7 +51,7 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSinkConstant.CONNECTOR_FORMAT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSinkConstant.CONNECTOR_FORMAT_TABLET_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSinkConstant.SINK_FORMAT_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_KEY; @@ -204,7 +204,7 @@ private void checkConflict( final boolean isRealtimeEnabled = sourceParameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE); + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE); if (isRealtimeEnabled && !shouldTerminatePipeOnAllHistoricalEventsConsumed) { final Boolean enableSendTsFileLimit = diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskProcessorStage.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskProcessorStage.java index 2e887f74bf023..3b7fc6068a885 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskProcessorStage.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskProcessorStage.java @@ -56,8 +56,8 @@ public class PipeTaskProcessorStage extends PipeTaskStage { * @param creationTime pipe creation time * @param pipeProcessorParameters used to create {@link PipeProcessor} * @param regionId {@link DataRegion} id - * @param pipeExtractorInputEventSupplier used to input {@link Event}s from {@link PipeExtractor} - * @param pipeConnectorOutputPendingQueue used to output {@link Event}s to {@link PipeConnector} + * @param pipeSourceInputEventSupplier used to input {@link Event}s from {@link PipeExtractor} + * @param pipeSinkOutputPendingQueue used to output {@link Event}s to {@link PipeConnector} * @throws PipeException if failed to {@link PipeProcessor#validate(PipeParameterValidator)} or * {@link PipeProcessor#customize(PipeParameters, PipeProcessorRuntimeConfiguration)}} */ @@ -66,8 +66,8 @@ public PipeTaskProcessorStage( final long creationTime, final PipeParameters pipeProcessorParameters, final int regionId, - final EventSupplier pipeExtractorInputEventSupplier, - final UnboundedBlockingPendingQueue pipeConnectorOutputPendingQueue, + final EventSupplier pipeSourceInputEventSupplier, + final UnboundedBlockingPendingQueue pipeSinkOutputPendingQueue, final PipeProcessorSubtaskExecutor executor, final PipeTaskMeta pipeTaskMeta, final boolean forceTabletFormat, @@ -105,7 +105,7 @@ public PipeTaskProcessorStage( final boolean isUsedForConsensusPipe = pipeName.contains(PipeStaticMeta.CONSENSUS_PIPE_PREFIX); final PipeEventCollector pipeConnectorOutputEventCollector = new PipeEventCollector( - pipeConnectorOutputPendingQueue, + pipeSinkOutputPendingQueue, creationTime, regionId, forceTabletFormat, @@ -117,7 +117,7 @@ public PipeTaskProcessorStage( pipeName, creationTime, regionId, - pipeExtractorInputEventSupplier, + pipeSourceInputEventSupplier, pipeProcessor, pipeConnectorOutputEventCollector); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSourceStage.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSourceStage.java index 57a804df0d382..9fc8a2650015b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSourceStage.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSourceStage.java @@ -40,38 +40,37 @@ public class PipeTaskSourceStage extends PipeTaskStage { private static final Logger LOGGER = LoggerFactory.getLogger(PipeTaskSourceStage.class); - private final PipeExtractor pipeExtractor; + private final PipeExtractor pipeSource; public PipeTaskSourceStage( String pipeName, long creationTime, - PipeParameters extractorParameters, + PipeParameters sourceParameters, int regionId, PipeTaskMeta pipeTaskMeta) { - pipeExtractor = + pipeSource = StorageEngine.getInstance().getAllDataRegionIds().contains(new DataRegionId(regionId)) || PipeRuntimeMeta.isSourceExternal(regionId) - ? PipeDataNodeAgent.plugin().dataRegion().reflectSource(extractorParameters) - : PipeDataNodeAgent.plugin().schemaRegion().reflectSource(extractorParameters); + ? PipeDataNodeAgent.plugin().dataRegion().reflectSource(sourceParameters) + : PipeDataNodeAgent.plugin().schemaRegion().reflectSource(sourceParameters); - // Validate and customize should be called before createSubtask. this allows extractor exposing + // Validate and customize should be called before createSubtask. this allows source exposing // exceptions in advance. try { - // 1. Validate extractor parameters - pipeExtractor.validate(new PipeParameterValidator(extractorParameters)); + // 1. Validate source parameters + pipeSource.validate(new PipeParameterValidator(sourceParameters)); - // 2. Customize extractor + // 2. Customize source final PipeTaskRuntimeConfiguration runtimeConfiguration = new PipeTaskRuntimeConfiguration( new PipeTaskSourceRuntimeEnvironment(pipeName, creationTime, regionId, pipeTaskMeta)); - pipeExtractor.customize(extractorParameters, runtimeConfiguration); + pipeSource.customize(sourceParameters, runtimeConfiguration); } catch (Exception e) { try { - pipeExtractor.close(); + pipeSource.close(); } catch (Exception closeException) { LOGGER.warn( - "Failed to close extractor after failed to initialize extractor. " - + "Ignore this exception.", + "Failed to close source after failed to initialize source. " + "Ignore this exception.", closeException); } throw new PipeException(e.getMessage(), e); @@ -86,7 +85,7 @@ public void createSubtask() throws PipeException { @Override public void startSubtask() throws PipeException { try { - pipeExtractor.start(); + pipeSource.start(); } catch (Exception e) { throw new PipeException(e.getMessage(), e); } @@ -94,19 +93,19 @@ public void startSubtask() throws PipeException { @Override public void stopSubtask() throws PipeException { - // Extractor continuously extracts data, so do nothing in stop + // Source continuously extracts data, so do nothing in stop } @Override public void dropSubtask() throws PipeException { try { - pipeExtractor.close(); + pipeSource.close(); } catch (Exception e) { throw new PipeException(e.getMessage(), e); } } public EventSupplier getEventSupplier() { - return pipeExtractor::supply; + return pipeSource::supply; } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/ConsensusPipeDataNodeDispatcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/ConsensusPipeDataNodeDispatcher.java index 02179a29f569a..39688e2a4b4ce 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/ConsensusPipeDataNodeDispatcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/ConsensusPipeDataNodeDispatcher.java @@ -49,9 +49,9 @@ public class ConsensusPipeDataNodeDispatcher implements ConsensusPipeDispatcher @Override public void createPipe( String pipeName, - Map extractorAttributes, + Map sourceAttributes, Map processorAttributes, - Map connectorAttributes, + Map sinkAttributes, boolean needManuallyStart) throws Exception { try (ConfigNodeClient configNodeClient = @@ -60,9 +60,9 @@ public void createPipe( new TCreatePipeReq() .setPipeName(pipeName) .setNeedManuallyStart(needManuallyStart) - .setExtractorAttributes(extractorAttributes) + .setExtractorAttributes(sourceAttributes) .setProcessorAttributes(processorAttributes) - .setConnectorAttributes(connectorAttributes); + .setConnectorAttributes(sinkAttributes); TSStatus status = configNodeClient.createPipe(req); if (TSStatusCode.SUCCESS_STATUS.getStatusCode() != status.getCode()) { LOGGER.warn("Failed to create consensus pipe-{}, status: {}", pipeName, status); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java index 4e69b47cc8df2..adba8ab8b197c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java @@ -69,7 +69,7 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_SNAPSHOT_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STREAMING_DEFAULT_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STREAMING_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STREAMING_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STRICT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_KEY; @@ -79,16 +79,16 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_PREFIX_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_BATCH_MODE_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_FILE_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_FORCED_LOG_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_HYBRID_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_BATCH_MODE_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_FILE_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_FORCED_LOG_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_HYBRID_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_LOG_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_STREAM_MODE_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_LOG_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_STREAM_MODE_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_TABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_TABLE_NAME_KEY; @@ -173,7 +173,7 @@ public void validate(final PipeParameterValidator validator) throws Exception { Arrays.asList( PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY, PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_KEY), - PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE); + PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE); final boolean isTreeModelDataAllowedToBeCaptured = isDoubleLiving || isCaptureTree; final boolean isTableModelDataAllowedToBeCaptured = isDoubleLiving || isCaptureTable; if (!isTreeModelDataAllowedToBeCaptured @@ -257,14 +257,14 @@ public void validate(final PipeParameterValidator validator) throws Exception { .getParameters() .getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE)); + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)); // Validate source.realtime.mode if (validator .getParameters() .getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE) + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE) || validator .getParameters() .hasAnyAttributes( @@ -277,12 +277,12 @@ public void validate(final PipeParameterValidator validator) throws Exception { ? EXTRACTOR_REALTIME_MODE_KEY : SOURCE_REALTIME_MODE_KEY, true, - EXTRACTOR_REALTIME_MODE_FILE_VALUE, - EXTRACTOR_REALTIME_MODE_HYBRID_VALUE, - EXTRACTOR_REALTIME_MODE_LOG_VALUE, - EXTRACTOR_REALTIME_MODE_FORCED_LOG_VALUE, - EXTRACTOR_REALTIME_MODE_STREAM_MODE_VALUE, - EXTRACTOR_REALTIME_MODE_BATCH_MODE_VALUE); + SOURCE_REALTIME_MODE_FILE_VALUE, + SOURCE_REALTIME_MODE_HYBRID_VALUE, + SOURCE_REALTIME_MODE_LOG_VALUE, + SOURCE_REALTIME_MODE_FORCED_LOG_VALUE, + SOURCE_REALTIME_MODE_STREAM_MODE_VALUE, + SOURCE_REALTIME_MODE_BATCH_MODE_VALUE); } checkInvalidParameters(validator); @@ -388,7 +388,7 @@ private void checkInvalidParameters(final PipeParameterValidator validator) { // Check if specifying mode.snapshot or mode.streaming when disable realtime source if (!parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE)) { + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { if (parameters.hasAnyAttributes(EXTRACTOR_REALTIME_MODE_KEY, SOURCE_REALTIME_MODE_KEY)) { LOGGER.warn( "When '{}' ('{}') is set to false, specifying {} and {} is invalid.", @@ -431,7 +431,7 @@ private void constructRealtimeExtractor(final PipeParameters parameters) { // Use heartbeat only source if disable realtime source if (!parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE)) { + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { realtimeExtractor = new PipeRealtimeDataRegionHeartbeatSource(); LOGGER.info( "Pipe: '{}' ('{}') is set to false, use heartbeat realtime source.", @@ -464,7 +464,7 @@ private void constructRealtimeExtractor(final PipeParameters parameters) { final boolean isStreamingMode = parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_MODE_STREAMING_KEY, SOURCE_MODE_STREAMING_KEY), - EXTRACTOR_MODE_STREAMING_DEFAULT_VALUE); + SOURCE_MODE_STREAMING_DEFAULT_VALUE); if (isStreamingMode) { realtimeExtractor = new PipeRealtimeDataRegionHybridSource(); } else { @@ -474,16 +474,16 @@ private void constructRealtimeExtractor(final PipeParameters parameters) { } switch (parameters.getStringByKeys(EXTRACTOR_REALTIME_MODE_KEY, SOURCE_REALTIME_MODE_KEY)) { - case EXTRACTOR_REALTIME_MODE_FILE_VALUE: - case EXTRACTOR_REALTIME_MODE_BATCH_MODE_VALUE: + case SOURCE_REALTIME_MODE_FILE_VALUE: + case SOURCE_REALTIME_MODE_BATCH_MODE_VALUE: realtimeExtractor = new PipeRealtimeDataRegionTsFileSource(); break; - case EXTRACTOR_REALTIME_MODE_HYBRID_VALUE: - case EXTRACTOR_REALTIME_MODE_LOG_VALUE: - case EXTRACTOR_REALTIME_MODE_STREAM_MODE_VALUE: + case SOURCE_REALTIME_MODE_HYBRID_VALUE: + case SOURCE_REALTIME_MODE_LOG_VALUE: + case SOURCE_REALTIME_MODE_STREAM_MODE_VALUE: realtimeExtractor = new PipeRealtimeDataRegionHybridSource(); break; - case EXTRACTOR_REALTIME_MODE_FORCED_LOG_VALUE: + case SOURCE_REALTIME_MODE_FORCED_LOG_VALUE: realtimeExtractor = new PipeRealtimeDataRegionLogSource(); break; default: diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java index 3112c3220fe8c..8947a435a2d2c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java @@ -92,7 +92,7 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_LOOSE_RANGE_PATH_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_LOOSE_RANGE_TIME_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_START_TIME_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STRICT_DEFAULT_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STRICT_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STRICT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_DEFAULT_VALUE; @@ -177,7 +177,7 @@ public void validate(final PipeParameterValidator validator) { final boolean isStrictMode = parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_MODE_STRICT_KEY, SOURCE_MODE_STRICT_KEY), - EXTRACTOR_MODE_STRICT_DEFAULT_VALUE); + SOURCE_MODE_STRICT_DEFAULT_VALUE); sloppyTimeRange = !isStrictMode; sloppyPattern = !isStrictMode; } else { @@ -378,7 +378,7 @@ public void customize( Arrays.asList( PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY, PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_KEY), - PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE); + PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE); if (isDoubleLiving) { isForwardingPipeRequests = false; } else { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java index cd00e2975a0aa..ff9da7a1687b8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java @@ -72,11 +72,11 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_ALL_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_DEFAULT_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_ALL_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_PATH_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_TIME_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_PATH_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_TIME_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_END_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODS_ENABLE_KEY; @@ -178,9 +178,9 @@ public void validate(final PipeParameterValidator validator) throws Exception { parameters .getStringOrDefault( Arrays.asList(EXTRACTOR_REALTIME_LOOSE_RANGE_KEY, SOURCE_REALTIME_LOOSE_RANGE_KEY), - EXTRACTOR_REALTIME_LOOSE_RANGE_DEFAULT_VALUE) + SOURCE_REALTIME_LOOSE_RANGE_DEFAULT_VALUE) .trim(); - if (EXTRACTOR_REALTIME_LOOSE_RANGE_ALL_VALUE.equalsIgnoreCase( + if (SOURCE_REALTIME_LOOSE_RANGE_ALL_VALUE.equalsIgnoreCase( extractorRealtimeLooseRangeValue)) { sloppyTimeRange = true; sloppyPattern = true; @@ -191,8 +191,8 @@ public void validate(final PipeParameterValidator validator) throws Exception { .filter(s -> !s.isEmpty()) .map(String::toLowerCase) .collect(Collectors.toSet()); - sloppyTimeRange = sloppyOptionSet.remove(EXTRACTOR_REALTIME_LOOSE_RANGE_TIME_VALUE); - sloppyPattern = sloppyOptionSet.remove(EXTRACTOR_REALTIME_LOOSE_RANGE_PATH_VALUE); + sloppyTimeRange = sloppyOptionSet.remove(SOURCE_REALTIME_LOOSE_RANGE_TIME_VALUE); + sloppyPattern = sloppyOptionSet.remove(SOURCE_REALTIME_LOOSE_RANGE_PATH_VALUE); if (!sloppyOptionSet.isEmpty()) { throw new PipeParameterNotValidException( String.format( @@ -255,7 +255,7 @@ public void customize( Arrays.asList( PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY, PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_KEY), - PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE); + PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE); if (isDoubleLiving) { isForwardingPipeRequests = false; } else { diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/IoTDBDataRegionSourceTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/IoTDBDataRegionSourceTest.java index fd1853fca1b74..00b7a55dd3d1f 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/IoTDBDataRegionSourceTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/IoTDBDataRegionSourceTest.java @@ -44,7 +44,7 @@ public void testIoTDBDataRegionExtractor() { Boolean.TRUE.toString()); put( PipeSourceConstant.EXTRACTOR_REALTIME_MODE_KEY, - PipeSourceConstant.EXTRACTOR_REALTIME_MODE_HYBRID_VALUE); + PipeSourceConstant.SOURCE_REALTIME_MODE_HYBRID_VALUE); } }))); } catch (final Exception e) { diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/PipeTaskAgent.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/PipeTaskAgent.java index 73b543592c1e2..66aa1ab812f87 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/PipeTaskAgent.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/PipeTaskAgent.java @@ -71,10 +71,10 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_QUERY_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_SNAPSHOT_DEFAULT_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_SNAPSHOT_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_SNAPSHOT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_SNAPSHOT_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_KEY; @@ -1128,7 +1128,7 @@ public static boolean isHistoryOnlyPipe(final PipeParameters parameters) { return isSnapshotMode(parameters) || !parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE); + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE); } public static boolean isRealtimeOnlyPipe(final PipeParameters parameters) { @@ -1144,7 +1144,7 @@ public static boolean isSnapshotMode(final PipeParameters parameters) { isSnapshotMode = parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_MODE_SNAPSHOT_KEY, SOURCE_MODE_SNAPSHOT_KEY), - EXTRACTOR_MODE_SNAPSHOT_DEFAULT_VALUE); + SOURCE_MODE_SNAPSHOT_DEFAULT_VALUE); } else { final String sourceModeValue = parameters.getStringOrDefault( diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/constant/PipeSourceConstant.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/constant/PipeSourceConstant.java index d13bdf7d046cc..fbfb8f58539a8 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/constant/PipeSourceConstant.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/constant/PipeSourceConstant.java @@ -104,34 +104,34 @@ public class PipeSourceConstant { public static final String EXTRACTOR_REALTIME_ENABLE_KEY = "extractor.realtime.enable"; public static final String SOURCE_REALTIME_ENABLE_KEY = "source.realtime.enable"; - public static final boolean EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE = true; + public static final boolean SOURCE_REALTIME_ENABLE_DEFAULT_VALUE = true; public static final String EXTRACTOR_REALTIME_MODE_KEY = "extractor.realtime.mode"; public static final String SOURCE_REALTIME_MODE_KEY = "source.realtime.mode"; - public static final String EXTRACTOR_REALTIME_MODE_HYBRID_VALUE = "hybrid"; - public static final String EXTRACTOR_REALTIME_MODE_FILE_VALUE = "file"; - public static final String EXTRACTOR_REALTIME_MODE_LOG_VALUE = "log"; - public static final String EXTRACTOR_REALTIME_MODE_FORCED_LOG_VALUE = "forced-log"; - public static final String EXTRACTOR_REALTIME_MODE_STREAM_MODE_VALUE = "stream"; - public static final String EXTRACTOR_REALTIME_MODE_BATCH_MODE_VALUE = "batch"; + public static final String SOURCE_REALTIME_MODE_HYBRID_VALUE = "hybrid"; + public static final String SOURCE_REALTIME_MODE_FILE_VALUE = "file"; + public static final String SOURCE_REALTIME_MODE_LOG_VALUE = "log"; + public static final String SOURCE_REALTIME_MODE_FORCED_LOG_VALUE = "forced-log"; + public static final String SOURCE_REALTIME_MODE_STREAM_MODE_VALUE = "stream"; + public static final String SOURCE_REALTIME_MODE_BATCH_MODE_VALUE = "batch"; public static final String EXTRACTOR_REALTIME_LOOSE_RANGE_KEY = "extractor.realtime.loose-range"; public static final String SOURCE_REALTIME_LOOSE_RANGE_KEY = "source.realtime.loose-range"; - public static final String EXTRACTOR_REALTIME_LOOSE_RANGE_TIME_VALUE = "time"; - public static final String EXTRACTOR_REALTIME_LOOSE_RANGE_PATH_VALUE = "path"; - public static final String EXTRACTOR_REALTIME_LOOSE_RANGE_ALL_VALUE = "all"; - public static final String EXTRACTOR_REALTIME_LOOSE_RANGE_DEFAULT_VALUE = ""; + public static final String SOURCE_REALTIME_LOOSE_RANGE_TIME_VALUE = "time"; + public static final String SOURCE_REALTIME_LOOSE_RANGE_PATH_VALUE = "path"; + public static final String SOURCE_REALTIME_LOOSE_RANGE_ALL_VALUE = "all"; + public static final String SOURCE_REALTIME_LOOSE_RANGE_DEFAULT_VALUE = ""; public static final String EXTRACTOR_MODE_STREAMING_KEY = "extractor.mode.streaming"; public static final String SOURCE_MODE_STREAMING_KEY = "source.mode.streaming"; - public static final boolean EXTRACTOR_MODE_STREAMING_DEFAULT_VALUE = true; + public static final boolean SOURCE_MODE_STREAMING_DEFAULT_VALUE = true; public static final String EXTRACTOR_MODE_STRICT_KEY = "extractor.mode.strict"; public static final String SOURCE_MODE_STRICT_KEY = "source.mode.strict"; - public static final boolean EXTRACTOR_MODE_STRICT_DEFAULT_VALUE = true; + public static final boolean SOURCE_MODE_STRICT_DEFAULT_VALUE = true; public static final String EXTRACTOR_MODE_SNAPSHOT_KEY = "extractor.mode.snapshot"; public static final String SOURCE_MODE_SNAPSHOT_KEY = "source.mode.snapshot"; - public static final boolean EXTRACTOR_MODE_SNAPSHOT_DEFAULT_VALUE = false; + public static final boolean SOURCE_MODE_SNAPSHOT_DEFAULT_VALUE = false; public static final String EXTRACTOR_MODE_DOUBLE_LIVING_KEY = "extractor.mode.double-living"; public static final String SOURCE_MODE_DOUBLE_LIVING_KEY = "source.mode.double-living"; - public static final boolean EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE = false; + public static final boolean SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE = false; public static final String EXTRACTOR_START_TIME_KEY = "extractor.start-time"; public static final String SOURCE_START_TIME_KEY = "source.start-time"; diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TablePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TablePattern.java index 698d6f44b88ac..583ec6a4f2b0c 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TablePattern.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TablePattern.java @@ -137,7 +137,7 @@ public static boolean isTableModelDataAllowToBeCaptured(final PipeParameters sou Arrays.asList( PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY, PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_KEY), - PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE) + PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE) || sourceParameters.getBooleanOrDefault( Arrays.asList( PipeSourceConstant.EXTRACTOR_CAPTURE_TABLE_KEY, diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TreePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TreePattern.java index e9b0fbe2180e5..826e3cec39f2e 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TreePattern.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TreePattern.java @@ -460,7 +460,7 @@ public static boolean isTreeModelDataAllowToBeCaptured(final PipeParameters sour Arrays.asList( PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY, PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_KEY), - PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE) + PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE) || sourceParameters.getBooleanOrDefault( Arrays.asList( PipeSourceConstant.EXTRACTOR_CAPTURE_TREE_KEY, diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/visibility/VisibilityUtils.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/visibility/VisibilityUtils.java index 235a22e23adb2..32f38ae2d7468 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/visibility/VisibilityUtils.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/visibility/VisibilityUtils.java @@ -92,7 +92,7 @@ public static Visibility calculateFromExtractorParameters( Arrays.asList( PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY, PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_KEY), - PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE); + PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE); if (isDoubleLiving) { return Visibility.BOTH; } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/source/IoTDBSource.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/source/IoTDBSource.java index 6640fde7f4a62..dcf592172f13d 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/source/IoTDBSource.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/source/IoTDBSource.java @@ -113,7 +113,7 @@ private void validateDoubleLiving(final PipeParameters parameters) { Arrays.asList( PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY, PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_KEY), - PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE); + PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE); if (!isDoubleLiving) { return; } @@ -166,7 +166,7 @@ public void customize( Arrays.asList( PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY, PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_KEY), - PipeSourceConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE); + PipeSourceConstant.SOURCE_MODE_DOUBLE_LIVING_DEFAULT_VALUE); if (isDoubleLiving) { isForwardingPipeRequests = false; } else { From 234088696f69eff11da0a4421e4f73ea6288d0c0 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 21 Nov 2025 11:43:43 +0800 Subject: [PATCH 05/33] f --- .../metric/PipeConsensusSyncLagManager.java | 4 +- .../agent/task/PipeDataNodeTaskAgent.java | 6 +-- .../task/builder/PipeDataNodeTaskBuilder.java | 4 +- .../pipeconsensus/PipeConsensusAsyncSink.java | 4 +- .../dataregion/IoTDBDataRegionSource.java | 38 +++++++++---------- ...icalDataRegionTsFileAndDeletionSource.java | 4 +- .../PipeRealtimeDataRegionSource.java | 13 +++---- .../pipe/agent/task/PipeTaskAgent.java | 6 +-- 8 files changed, 39 insertions(+), 40 deletions(-) diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java index 63c0e9be167e1..86ff40cf91bdb 100644 --- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java +++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/metric/PipeConsensusSyncLagManager.java @@ -72,7 +72,7 @@ public long getCurrentLeaderReplicateIndex(ConsensusPipeName consensusPipeName) .orElse(0L); } - public void addConsensusPipeConnector( + public void addConsensusPipeSink( ConsensusPipeName consensusPipeName, ConsensusPipeSink consensusPipeSink) { lock.lock(); try { @@ -82,7 +82,7 @@ public void addConsensusPipeConnector( } } - public void removeConsensusPipeConnector(ConsensusPipeName consensusPipeName) { + public void removeConsensusPipeSink(ConsensusPipeName consensusPipeName) { lock.lock(); try { consensusPipe2SinkMap.remove(consensusPipeName); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java index 3ed4aa673bf07..e0fc44c7ed3bc 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/PipeDataNodeTaskAgent.java @@ -111,7 +111,6 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATH_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_END_TIME_KEY; @@ -120,6 +119,7 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATH_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATTERN_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_START_TIME_KEY; @@ -594,7 +594,7 @@ public boolean isFullSync(final PipeParameters parameters) { final boolean isRealtimeEnable = parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - SOURCE_REALTIME_ENABLE_DEFAULT_VALUE); + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE); return isHistoryEnable && isRealtimeEnable; } @@ -742,7 +742,7 @@ private void calculateInsertNodeQueueMemory(final PipeParameters sourceParameter // Realtime source is enabled by default, so we only need to check the source realtime if (!sourceParameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { return; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java index 2e89b4e91ef6d..42ae390bf68b7 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java @@ -51,8 +51,8 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSinkConstant.CONNECTOR_FORMAT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSinkConstant.CONNECTOR_FORMAT_TABLET_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSinkConstant.SINK_FORMAT_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_KEY; public class PipeDataNodeTaskBuilder { @@ -204,7 +204,7 @@ private void checkConflict( final boolean isRealtimeEnabled = sourceParameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - SOURCE_REALTIME_ENABLE_DEFAULT_VALUE); + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE); if (isRealtimeEnabled && !shouldTerminatePipeOnAllHistoricalEventsConsumed) { final Boolean enableSendTsFileLimit = diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusAsyncSink.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusAsyncSink.java index a481f7cde0d54..13a728ac0153a 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusAsyncSink.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/pipeconsensus/PipeConsensusAsyncSink.java @@ -144,7 +144,7 @@ public void customize(PipeParameters parameters, PipeConnectorRuntimeConfigurati // initialize metric components pipeConsensusSinkMetrics = new PipeConsensusSinkMetrics(this); PipeConsensusSyncLagManager.getInstance(getConsensusGroupIdStr()) - .addConsensusPipeConnector(new ConsensusPipeName(consensusPipeName), this); + .addConsensusPipeSink(new ConsensusPipeName(consensusPipeName), this); MetricService.getInstance().addMetricSet(this.pipeConsensusSinkMetrics); // In PipeConsensus, one pipeConsensusTask corresponds to a pipeConsensusConnector. Thus, @@ -701,7 +701,7 @@ public synchronized void close() { } PipeConsensusSyncLagManager.getInstance(getConsensusGroupIdStr()) - .removeConsensusPipeConnector(new ConsensusPipeName(consensusPipeName)); + .removeConsensusPipeSink(new ConsensusPipeName(consensusPipeName)); MetricService.getInstance().removeMetricSet(this.pipeConsensusSinkMetrics); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java index adba8ab8b197c..b78d370eee784 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java @@ -69,7 +69,6 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_SNAPSHOT_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STREAMING_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STREAMING_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STRICT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_KEY; @@ -79,16 +78,9 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_PREFIX_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_BATCH_MODE_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_FILE_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_FORCED_LOG_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_HYBRID_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_MODE_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_LOG_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_STREAM_MODE_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_TABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_TABLE_NAME_KEY; @@ -103,6 +95,7 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_SNAPSHOT_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STREAMING_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STREAMING_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STRICT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODS_ENABLE_KEY; @@ -110,9 +103,16 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATH_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATTERN_FORMAT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATTERN_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_BATCH_MODE_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_FILE_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_FORCED_LOG_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_HYBRID_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_LOG_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_MODE_STREAM_MODE_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_TABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_TABLE_NAME_KEY; @@ -257,14 +257,14 @@ public void validate(final PipeParameterValidator validator) throws Exception { .getParameters() .getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)); + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)); // Validate source.realtime.mode if (validator .getParameters() .getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - SOURCE_REALTIME_ENABLE_DEFAULT_VALUE) + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE) || validator .getParameters() .hasAnyAttributes( @@ -277,12 +277,12 @@ public void validate(final PipeParameterValidator validator) throws Exception { ? EXTRACTOR_REALTIME_MODE_KEY : SOURCE_REALTIME_MODE_KEY, true, - SOURCE_REALTIME_MODE_FILE_VALUE, - SOURCE_REALTIME_MODE_HYBRID_VALUE, - SOURCE_REALTIME_MODE_LOG_VALUE, - SOURCE_REALTIME_MODE_FORCED_LOG_VALUE, - SOURCE_REALTIME_MODE_STREAM_MODE_VALUE, - SOURCE_REALTIME_MODE_BATCH_MODE_VALUE); + SOURCE_REALTIME_MODE_FILE_VALUE, + SOURCE_REALTIME_MODE_HYBRID_VALUE, + SOURCE_REALTIME_MODE_LOG_VALUE, + SOURCE_REALTIME_MODE_FORCED_LOG_VALUE, + SOURCE_REALTIME_MODE_STREAM_MODE_VALUE, + SOURCE_REALTIME_MODE_BATCH_MODE_VALUE); } checkInvalidParameters(validator); @@ -388,7 +388,7 @@ private void checkInvalidParameters(final PipeParameterValidator validator) { // Check if specifying mode.snapshot or mode.streaming when disable realtime source if (!parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { if (parameters.hasAnyAttributes(EXTRACTOR_REALTIME_MODE_KEY, SOURCE_REALTIME_MODE_KEY)) { LOGGER.warn( "When '{}' ('{}') is set to false, specifying {} and {} is invalid.", @@ -431,7 +431,7 @@ private void constructRealtimeExtractor(final PipeParameters parameters) { // Use heartbeat only source if disable realtime source if (!parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_REALTIME_ENABLE_KEY, SOURCE_REALTIME_ENABLE_KEY), - SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { + SOURCE_REALTIME_ENABLE_DEFAULT_VALUE)) { realtimeExtractor = new PipeRealtimeDataRegionHeartbeatSource(); LOGGER.info( "Pipe: '{}' ('{}') is set to false, use heartbeat realtime source.", @@ -464,7 +464,7 @@ private void constructRealtimeExtractor(final PipeParameters parameters) { final boolean isStreamingMode = parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_MODE_STREAMING_KEY, SOURCE_MODE_STREAMING_KEY), - SOURCE_MODE_STREAMING_DEFAULT_VALUE); + SOURCE_MODE_STREAMING_DEFAULT_VALUE); if (isStreamingMode) { realtimeExtractor = new PipeRealtimeDataRegionHybridSource(); } else { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java index 8947a435a2d2c..17fff27da39c2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileAndDeletionSource.java @@ -92,7 +92,6 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_LOOSE_RANGE_PATH_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_LOOSE_RANGE_TIME_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_HISTORY_START_TIME_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STRICT_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_STRICT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_DEFAULT_VALUE; @@ -104,6 +103,7 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_END_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_LOOSE_RANGE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_START_TIME_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STRICT_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_STRICT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODS_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODS_KEY; @@ -177,7 +177,7 @@ public void validate(final PipeParameterValidator validator) { final boolean isStrictMode = parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_MODE_STRICT_KEY, SOURCE_MODE_STRICT_KEY), - SOURCE_MODE_STRICT_DEFAULT_VALUE); + SOURCE_MODE_STRICT_DEFAULT_VALUE); sloppyTimeRange = !isStrictMode; sloppyPattern = !isStrictMode; } else { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java index ff9da7a1687b8..4c40bff90b330 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/PipeRealtimeDataRegionSource.java @@ -72,16 +72,16 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODS_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_ALL_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_LOOSE_RANGE_KEY; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_PATH_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_TIME_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_END_TIME_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODS_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODS_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_ALL_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_PATH_VALUE; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_LOOSE_RANGE_TIME_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_START_TIME_KEY; import static org.apache.iotdb.commons.pipe.source.IoTDBSource.getSkipIfNoPrivileges; @@ -178,10 +178,9 @@ public void validate(final PipeParameterValidator validator) throws Exception { parameters .getStringOrDefault( Arrays.asList(EXTRACTOR_REALTIME_LOOSE_RANGE_KEY, SOURCE_REALTIME_LOOSE_RANGE_KEY), - SOURCE_REALTIME_LOOSE_RANGE_DEFAULT_VALUE) + SOURCE_REALTIME_LOOSE_RANGE_DEFAULT_VALUE) .trim(); - if (SOURCE_REALTIME_LOOSE_RANGE_ALL_VALUE.equalsIgnoreCase( - extractorRealtimeLooseRangeValue)) { + if (SOURCE_REALTIME_LOOSE_RANGE_ALL_VALUE.equalsIgnoreCase(extractorRealtimeLooseRangeValue)) { sloppyTimeRange = true; sloppyPattern = true; } else { diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/PipeTaskAgent.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/PipeTaskAgent.java index 66aa1ab812f87..7299a2fff3127 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/PipeTaskAgent.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/PipeTaskAgent.java @@ -71,14 +71,14 @@ import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_QUERY_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_SNAPSHOT_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_SNAPSHOT_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_MODE_SNAPSHOT_VALUE; -import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_REALTIME_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_HISTORY_ENABLE_KEY; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_SNAPSHOT_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_MODE_SNAPSHOT_KEY; +import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_DEFAULT_VALUE; import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_REALTIME_ENABLE_KEY; /** @@ -1144,7 +1144,7 @@ public static boolean isSnapshotMode(final PipeParameters parameters) { isSnapshotMode = parameters.getBooleanOrDefault( Arrays.asList(EXTRACTOR_MODE_SNAPSHOT_KEY, SOURCE_MODE_SNAPSHOT_KEY), - SOURCE_MODE_SNAPSHOT_DEFAULT_VALUE); + SOURCE_MODE_SNAPSHOT_DEFAULT_VALUE); } else { final String sourceModeValue = parameters.getStringOrDefault( From 3a1cee6350d6e832918bf767e88430a72f909098 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 21 Nov 2025 12:52:51 +0800 Subject: [PATCH 06/33] grass --- .../impl/schema/SetTemplateProcedure.java | 12 ++++----- .../schema/table/AddTableColumnProcedure.java | 10 +++---- .../schema/table/CreateTableProcedure.java | 10 +++---- .../table/RenameTableColumnProcedure.java | 10 +++---- .../schema/table/RenameTableProcedure.java | 10 +++---- .../table/SetTablePropertiesProcedure.java | 14 +++++----- .../table/view/CreateTableViewProcedure.java | 2 +- .../state/schema/AddTableColumnState.java | 4 +-- .../state/schema/AlterDatabaseState.java | 27 ------------------- .../state/schema/CreateTableState.java | 4 +-- .../state/schema/RenameTableColumnState.java | 4 +-- .../state/schema/RenameTableState.java | 4 +-- .../state/schema/SetTablePropertiesState.java | 4 +-- .../state/schema/SetTemplateState.java | 4 +-- 14 files changed, 46 insertions(+), 73 deletions(-) delete mode 100644 iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AlterDatabaseState.java diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java index a5463439f66cf..b4f84e1601644 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java @@ -113,7 +113,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final SetTempl LOGGER.info("Pre set schemaengine template {} on path {}", templateName, templateSetPath); preSetTemplate(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Pre release schemaengine template {} set on path {}", templateName, templateSetPath); preReleaseTemplate(env); @@ -129,9 +129,9 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final SetTempl LOGGER.info( "Commit set schemaengine template {} on path {}", templateName, templateSetPath); commitSetTemplate(env); - setNextState(SetTemplateState.COMMIT_RELEASE); + setNextState(SetTemplateState.COMMIT_UPDATE_DATANODE_CACHE); break; - case COMMIT_RELEASE: + case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info( "Commit release schemaengine template {} set on path {}", templateName, @@ -184,7 +184,7 @@ private void preSetTemplate(final ConfigNodeProcedureEnv env) { status.setMessage(e.getMessage()); } if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - setNextState(SetTemplateState.PRE_RELEASE); + setNextState(SetTemplateState.PRE_UPDATE_DATANODE_CACHE); } else { LOGGER.warn( "Failed to pre set template {} on path {} due to {}", @@ -359,7 +359,7 @@ private void commitSetTemplate(final ConfigNodeProcedureEnv env) { status.setMessage(e.getMessage()); } if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - setNextState(SetTemplateState.COMMIT_RELEASE); + setNextState(SetTemplateState.COMMIT_UPDATE_DATANODE_CACHE); } else { LOGGER.warn( "Failed to commit set template {} on path {} due to {}", @@ -430,7 +430,7 @@ protected void rollbackState(final ConfigNodeProcedureEnv env, final SetTemplate templateSetPath); rollbackPreSet(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Start rollback pre release schemaengine template {} on path {}", templateName, diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java index d5b99942721bb..b99068ada99cb 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java @@ -74,7 +74,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final AddTable LOGGER.info("Column check for table {}.{} when adding column", database, tableName); columnCheck(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release info of table {}.{} when adding column", database, tableName); preRelease(env); break; @@ -82,7 +82,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final AddTable LOGGER.info("Add column to table {}.{}", database, tableName); addColumn(env); break; - case COMMIT_RELEASE: + case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info("Commit release info of table {}.{} when adding column", database, tableName); commitRelease(env); return Flow.NO_MORE_STATE; @@ -114,7 +114,7 @@ protected void columnCheck(final ConfigNodeProcedureEnv env) { return; } table = result.getRight(); - setNextState(AddTableColumnState.PRE_RELEASE); + setNextState(AddTableColumnState.PRE_UPDATE_DATANODE_CACHE); } catch (final MetadataException e) { setFailure(new ProcedureException(e)); } @@ -138,7 +138,7 @@ private void addColumn(final ConfigNodeProcedureEnv env) { if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { setFailure(new ProcedureException(new IoTDBException(status))); } else { - setNextState(AddTableColumnState.COMMIT_RELEASE); + setNextState(AddTableColumnState.COMMIT_UPDATE_DATANODE_CACHE); } } @@ -160,7 +160,7 @@ protected void rollbackState(final ConfigNodeProcedureEnv env, final AddTableCol table.getTableName()); rollbackAddColumn(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Start rollback pre release info of table {}.{}", database, table.getTableName()); rollbackPreRelease(env); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java index d0fbdb605d12f..4e6883cfac976 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java @@ -83,7 +83,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final CreateTa LOGGER.info("Pre create table {}.{}", database, table.getTableName()); preCreateTable(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release table {}.{}", database, table.getTableName()); preReleaseTable(env); break; @@ -91,7 +91,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final CreateTa LOGGER.info("Commit create table {}.{}", database, table.getTableName()); commitCreateTable(env); break; - case COMMIT_RELEASE: + case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info("Commit release table {}.{}", database, table.getTableName()); commitReleaseTable(env); return Flow.NO_MORE_STATE; @@ -140,7 +140,7 @@ protected void preCreateTable(final ConfigNodeProcedureEnv env) { final TSStatus status = SchemaUtils.executeInConsensusLayer(new PreCreateTablePlan(database, table), env, LOGGER); if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - setNextState(CreateTableState.PRE_RELEASE); + setNextState(CreateTableState.PRE_UPDATE_DATANODE_CACHE); } else { setFailure(new ProcedureException(new IoTDBException(status))); } @@ -173,7 +173,7 @@ private void commitCreateTable(final ConfigNodeProcedureEnv env) { env, LOGGER); if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - setNextState(CreateTableState.COMMIT_RELEASE); + setNextState(CreateTableState.COMMIT_UPDATE_DATANODE_CACHE); } else { setFailure(new ProcedureException(new IoTDBException(status))); } @@ -208,7 +208,7 @@ protected void rollbackState(final ConfigNodeProcedureEnv env, final CreateTable LOGGER.info("Start rollback pre create table {}.{}", database, table.getTableName()); rollbackCreate(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Start rollback pre release table {}.{}", database, table.getTableName()); rollbackPreRelease(env); break; diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java index da51dad267266..36676f152fc33 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java @@ -76,7 +76,7 @@ protected Flow executeFromState( LOGGER.info("Column check for table {}.{} when renaming column", database, tableName); columnCheck(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release info of table {}.{} when renaming column", database, tableName); preRelease(env); break; @@ -84,7 +84,7 @@ protected Flow executeFromState( LOGGER.info("Rename column to table {}.{} on config node", database, tableName); renameColumn(env); break; - case COMMIT_RELEASE: + case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info( "Commit release info of table {}.{} when renaming column", database, tableName); commitRelease(env); @@ -117,7 +117,7 @@ private void columnCheck(final ConfigNodeProcedureEnv env) { return; } table = result.getRight(); - setNextState(RenameTableColumnState.PRE_RELEASE); + setNextState(RenameTableColumnState.PRE_UPDATE_DATANODE_CACHE); } catch (final MetadataException e) { setFailure(new ProcedureException(e)); } @@ -141,7 +141,7 @@ private void renameColumn(final ConfigNodeProcedureEnv env) { if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { setFailure(new ProcedureException(new IoTDBException(status))); } else { - setNextState(RenameTableColumnState.COMMIT_RELEASE); + setNextState(RenameTableColumnState.COMMIT_UPDATE_DATANODE_CACHE); } } @@ -158,7 +158,7 @@ protected void rollbackState(final ConfigNodeProcedureEnv env, final RenameTable table.getTableName()); rollbackRenameColumn(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Start rollback pre release info of table {}.{}", database, table.getTableName()); rollbackPreRelease(env); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java index 93d1035a7615c..bd80a1326d073 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java @@ -69,7 +69,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final RenameTa LOGGER.info("Column check for table {}.{} when renaming table", database, tableName); tableCheck(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release info of table {}.{} when renaming table", database, tableName); preRelease(env); break; @@ -77,7 +77,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final RenameTa LOGGER.info("Rename column to table {}.{} on config node", database, tableName); renameTable(env); break; - case COMMIT_RELEASE: + case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info( "Commit release info of table {}.{} when renaming table", database, tableName); commitRelease(env, tableName); @@ -110,7 +110,7 @@ private void tableCheck(final ConfigNodeProcedureEnv env) { return; } table = result.getRight(); - setNextState(RenameTableState.PRE_RELEASE); + setNextState(RenameTableState.PRE_UPDATE_DATANODE_CACHE); } catch (final MetadataException e) { setFailure(new ProcedureException(e)); } @@ -134,7 +134,7 @@ private void renameTable(final ConfigNodeProcedureEnv env) { if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { setFailure(new ProcedureException(new IoTDBException(status))); } else { - setNextState(RenameTableState.COMMIT_RELEASE); + setNextState(RenameTableState.COMMIT_UPDATE_DATANODE_CACHE); } } @@ -149,7 +149,7 @@ protected void rollbackState(final ConfigNodeProcedureEnv env, final RenameTable "Start rollback Renaming table {}.{} on configNode", database, table.getTableName()); rollbackRenameTable(env); break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Start rollback pre release info of table {}.{}", database, table.getTableName()); rollbackPreRelease(env, tableName); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java index eedbf7fdb3d0a..5149e837585b6 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java @@ -44,8 +44,8 @@ import java.util.Map; import java.util.Objects; -import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.COMMIT_RELEASE; -import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.PRE_RELEASE; +import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.COMMIT_UPDATE_DATANODE_CACHE; +import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.PRE_UPDATE_DATANODE_CACHE; import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.SET_PROPERTIES; import static org.apache.iotdb.confignode.procedure.state.schema.SetTablePropertiesState.VALIDATE_TABLE; @@ -88,7 +88,7 @@ protected Flow executeFromState( return Flow.NO_MORE_STATE; } break; - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: preRelease(env); LOGGER.info( "Pre release info for table {}.{} when setting properties", database, tableName); @@ -97,7 +97,7 @@ protected Flow executeFromState( setProperties(env); LOGGER.info("Set properties to table {}.{}", database, tableName); break; - case COMMIT_RELEASE: + case COMMIT_UPDATE_DATANODE_CACHE: commitRelease(env); LOGGER.info( "Commit release info of table {}.{} when setting properties", database, tableName); @@ -134,7 +134,7 @@ private void validateTable(final ConfigNodeProcedureEnv env) { return; } table = result.getRight(); - setNextState(PRE_RELEASE); + setNextState(PRE_UPDATE_DATANODE_CACHE); } catch (final MetadataException e) { setFailure(new ProcedureException(e)); } @@ -158,7 +158,7 @@ private void setProperties(final ConfigNodeProcedureEnv env) { if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { setFailure(new ProcedureException(new IoTDBException(status))); } else { - setNextState(COMMIT_RELEASE); + setNextState(COMMIT_UPDATE_DATANODE_CACHE); } } @@ -174,7 +174,7 @@ protected void rollbackState( final long startTime = System.currentTimeMillis(); try { switch (state) { - case PRE_RELEASE: + case PRE_UPDATE_DATANODE_CACHE: LOGGER.info( "Start rollback pre release info for table {}.{} when setting properties", database, diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/view/CreateTableViewProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/view/CreateTableViewProcedure.java index b7fb458c8bb01..4fd3a4aceaa10 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/view/CreateTableViewProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/view/CreateTableViewProcedure.java @@ -121,7 +121,7 @@ protected void preCreateTable(final ConfigNodeProcedureEnv env) { SchemaUtils.executeInConsensusLayer( new PreCreateTableViewPlan(database, table, TableNodeStatus.PRE_CREATE), env, LOGGER); if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - setNextState(CreateTableState.PRE_RELEASE); + setNextState(CreateTableState.PRE_UPDATE_DATANODE_CACHE); } else { setFailure(new ProcedureException(new IoTDBException(status))); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AddTableColumnState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AddTableColumnState.java index cdcea88aa3c69..5e0346e9fc369 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AddTableColumnState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AddTableColumnState.java @@ -21,7 +21,7 @@ public enum AddTableColumnState { COLUMN_CHECK, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, ADD_COLUMN, - COMMIT_RELEASE + COMMIT_UPDATE_DATANODE_CACHE } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AlterDatabaseState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AlterDatabaseState.java deleted file mode 100644 index ca5a50c22654d..0000000000000 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/AlterDatabaseState.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.confignode.procedure.state.schema; - -public enum AlterDatabaseState { - CHECK_ALTERED_TABLES, - PRE_RELEASE, - ALTER_DATABASE, - COMMIT_RELEASE -} diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/CreateTableState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/CreateTableState.java index be765853ed05f..2810d58d8f7ee 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/CreateTableState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/CreateTableState.java @@ -22,7 +22,7 @@ public enum CreateTableState { CHECK_TABLE_EXISTENCE, PRE_CREATE, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, COMMIT_CREATE, - COMMIT_RELEASE, + COMMIT_UPDATE_DATANODE_CACHE, } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableColumnState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableColumnState.java index 398ef64222440..77d3a835042ec 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableColumnState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableColumnState.java @@ -21,7 +21,7 @@ public enum RenameTableColumnState { COLUMN_CHECK, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, RENAME_COLUMN, - COMMIT_RELEASE + COMMIT_UPDATE_DATANODE_CACHE } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableState.java index 1c71cb50182ed..4aa6e0d290913 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/RenameTableState.java @@ -21,7 +21,7 @@ public enum RenameTableState { COLUMN_CHECK, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, RENAME_TABLE, - COMMIT_RELEASE + COMMIT_UPDATE_DATANODE_CACHE } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTablePropertiesState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTablePropertiesState.java index 45a1b8b654a3b..0d8a4f71b5cba 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTablePropertiesState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTablePropertiesState.java @@ -21,7 +21,7 @@ public enum SetTablePropertiesState { VALIDATE_TABLE, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, SET_PROPERTIES, - COMMIT_RELEASE + COMMIT_UPDATE_DATANODE_CACHE } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTemplateState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTemplateState.java index cc43259a55ec7..1d72dbe8e6759 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTemplateState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/SetTemplateState.java @@ -22,8 +22,8 @@ public enum SetTemplateState { VALIDATE_TEMPLATE_EXISTENCE, PRE_SET, - PRE_RELEASE, + PRE_UPDATE_DATANODE_CACHE, VALIDATE_TIMESERIES_EXISTENCE, COMMIT_SET, - COMMIT_RELEASE, + COMMIT_UPDATE_DATANODE_CACHE, } From e83d24ab52529f50135f576ec30e2f2b89583a47 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 21 Nov 2025 14:11:18 +0800 Subject: [PATCH 07/33] fix --- .../maintainer/RegionCreateTask.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/maintainer/RegionCreateTask.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/maintainer/RegionCreateTask.java index e7b8981c03b4c..8d571d9071156 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/maintainer/RegionCreateTask.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/maintainer/RegionCreateTask.java @@ -37,7 +37,7 @@ public class RegionCreateTask extends RegionMaintainTask { - private String storageGroup; + private String database; private TRegionReplicaSet regionReplicaSet; public RegionCreateTask() { @@ -45,15 +45,15 @@ public RegionCreateTask() { } public RegionCreateTask( - TDataNodeLocation targetDataNode, String storageGroup, TRegionReplicaSet regionReplicaSet) { + TDataNodeLocation targetDataNode, String database, TRegionReplicaSet regionReplicaSet) { super(RegionMaintainType.CREATE); this.targetDataNode = targetDataNode; - this.storageGroup = storageGroup; + this.database = database; this.regionReplicaSet = regionReplicaSet; } - public String getStorageGroup() { - return storageGroup; + public String getDatabase() { + return database; } public TRegionReplicaSet getRegionReplicaSet() { @@ -70,14 +70,14 @@ public void serialize(DataOutputStream stream) throws IOException { stream.writeInt(RegionMaintainType.CREATE.ordinal()); ThriftCommonsSerDeUtils.serializeTDataNodeLocation(targetDataNode, stream); - ReadWriteIOUtils.write(storageGroup, stream); + ReadWriteIOUtils.write(database, stream); ThriftCommonsSerDeUtils.serializeTRegionReplicaSet(regionReplicaSet, stream); } @Override protected void deserialize(ByteBuffer buffer) throws IOException { this.targetDataNode = ThriftCommonsSerDeUtils.deserializeTDataNodeLocation(buffer); - this.storageGroup = ReadWriteIOUtils.readString(buffer); + this.database = ReadWriteIOUtils.readString(buffer); this.regionReplicaSet = ThriftCommonsSerDeUtils.deserializeTRegionReplicaSet(buffer); } @@ -87,7 +87,7 @@ public void serialize(OutputStream outputStream, TProtocol protocol) ReadWriteIOUtils.write(RegionMaintainType.CREATE.ordinal(), outputStream); this.targetDataNode.write(protocol); - ReadWriteIOUtils.write(storageGroup, outputStream); + ReadWriteIOUtils.write(database, outputStream); this.regionReplicaSet.write(protocol); } @@ -96,7 +96,7 @@ protected void deserialize(InputStream inputStream, TProtocol protocol) throws TException, IOException { this.targetDataNode = new TDataNodeLocation(); this.targetDataNode.read(protocol); - this.storageGroup = ReadWriteIOUtils.readString(inputStream); + this.database = ReadWriteIOUtils.readString(inputStream); this.regionReplicaSet = new TRegionReplicaSet(); this.regionReplicaSet.read(protocol); } @@ -107,11 +107,11 @@ public boolean equals(Object o) { if (!(o instanceof RegionCreateTask)) return false; if (!super.equals(o)) return false; RegionCreateTask that = (RegionCreateTask) o; - return storageGroup.equals(that.storageGroup) && regionReplicaSet.equals(that.regionReplicaSet); + return database.equals(that.database) && regionReplicaSet.equals(that.regionReplicaSet); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), storageGroup, regionReplicaSet); + return Objects.hash(super.hashCode(), database, regionReplicaSet); } } From 9ea6895f8dedda7a31ce9bfd52ef61e47740bbe2 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 21 Nov 2025 14:13:59 +0800 Subject: [PATCH 08/33] fix --- .../consensus/response/database/DatabaseSchemaResp.java | 2 +- .../service/thrift/ConfigNodeRPCServiceProcessor.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/DatabaseSchemaResp.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/DatabaseSchemaResp.java index 52407277fbb3c..4cd3431e80d17 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/DatabaseSchemaResp.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/database/DatabaseSchemaResp.java @@ -50,7 +50,7 @@ public void setSchemaMap(Map schemaMap) { this.schemaMap = schemaMap; } - public TDatabaseSchemaResp convertToRPCStorageGroupSchemaResp() { + public TDatabaseSchemaResp convertToRPCDatabaseSchemaResp() { TDatabaseSchemaResp resp = new TDatabaseSchemaResp(); resp.setStatus(status); if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java index ef6516af39c64..16c6a5c2ccdcd 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java @@ -551,7 +551,7 @@ public TDatabaseSchemaResp getMatchedDatabaseSchemas(final TGetDatabaseReq req) final DatabaseSchemaResp databaseSchemaResp = (DatabaseSchemaResp) configManager.getMatchedDatabaseSchemas(plan); - return databaseSchemaResp.convertToRPCStorageGroupSchemaResp(); + return databaseSchemaResp.convertToRPCDatabaseSchemaResp(); } @Override From 7eac2659fa04c57f5fc97a077783be0882383e44 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 21 Nov 2025 15:07:12 +0800 Subject: [PATCH 09/33] gra --- .../table/AbstractAlterOrDropTableProcedure.java | 14 ++++++++------ .../impl/schema/table/AddTableColumnProcedure.java | 8 ++++---- .../impl/schema/table/CreateTableProcedure.java | 8 ++++---- .../schema/table/RenameTableColumnProcedure.java | 8 ++++---- .../impl/schema/table/RenameTableProcedure.java | 8 ++++---- .../schema/table/SetTablePropertiesProcedure.java | 8 ++++---- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java index fe92c802ce687..6b61f26ddc3d3 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java @@ -85,11 +85,12 @@ public String getQueryId() { return queryId; } - protected void preRelease(final ConfigNodeProcedureEnv env) { - preRelease(env, null); + protected void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + preUpdateDataNodeCache(env, null); } - protected void preRelease(final ConfigNodeProcedureEnv env, final @Nullable String oldName) { + protected void preUpdateDataNodeCache( + final ConfigNodeProcedureEnv env, final @Nullable String oldName) { final Map failedResults = SchemaUtils.preReleaseTable(database, table, env.getConfigManager(), oldName); @@ -107,11 +108,12 @@ protected void preRelease(final ConfigNodeProcedureEnv env, final @Nullable Stri } } - protected void commitRelease(final ConfigNodeProcedureEnv env) { - commitRelease(env, null); + protected void commitUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + commitUpdateDataNodeCache(env, null); } - protected void commitRelease(final ConfigNodeProcedureEnv env, final @Nullable String oldName) { + protected void commitUpdateDataNodeCache( + final ConfigNodeProcedureEnv env, final @Nullable String oldName) { final Map failedResults = SchemaUtils.commitReleaseTable( database, table.getTableName(), env.getConfigManager(), oldName); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java index b99068ada99cb..2e0c879003b94 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java @@ -76,7 +76,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final AddTable break; case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release info of table {}.{} when adding column", database, tableName); - preRelease(env); + preUpdateDataNodeCache(env); break; case ADD_COLUMN: LOGGER.info("Add column to table {}.{}", database, tableName); @@ -84,7 +84,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final AddTable break; case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info("Commit release info of table {}.{} when adding column", database, tableName); - commitRelease(env); + commitUpdateDataNodeCache(env); return Flow.NO_MORE_STATE; default: setFailure(new ProcedureException("Unrecognized AddTableColumnState " + state)); @@ -121,8 +121,8 @@ protected void columnCheck(final ConfigNodeProcedureEnv env) { } @Override - protected void preRelease(final ConfigNodeProcedureEnv env) { - super.preRelease(env); + protected void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + super.preUpdateDataNodeCache(env); setNextState(AddTableColumnState.ADD_COLUMN); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java index 4e6883cfac976..26d1e8483e2de 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java @@ -85,7 +85,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final CreateTa break; case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release table {}.{}", database, table.getTableName()); - preReleaseTable(env); + preUpdateDataNodeCache(env); break; case COMMIT_CREATE: LOGGER.info("Commit create table {}.{}", database, table.getTableName()); @@ -93,7 +93,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final CreateTa break; case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info("Commit release table {}.{}", database, table.getTableName()); - commitReleaseTable(env); + commitUpdateDataNodeCache(env); return Flow.NO_MORE_STATE; default: setFailure(new ProcedureException("Unrecognized CreateTableState " + state)); @@ -146,7 +146,7 @@ protected void preCreateTable(final ConfigNodeProcedureEnv env) { } } - private void preReleaseTable(final ConfigNodeProcedureEnv env) { + private void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { final Map failedResults = SchemaUtils.preReleaseTable(database, table, env.getConfigManager(), null); @@ -179,7 +179,7 @@ private void commitCreateTable(final ConfigNodeProcedureEnv env) { } } - private void commitReleaseTable(final ConfigNodeProcedureEnv env) { + private void commitUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { final Map failedResults = SchemaUtils.commitReleaseTable( database, table.getTableName(), env.getConfigManager(), null); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java index 36676f152fc33..76d3505dffe9a 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableColumnProcedure.java @@ -78,7 +78,7 @@ protected Flow executeFromState( break; case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release info of table {}.{} when renaming column", database, tableName); - preRelease(env); + preUpdateDataNodeCache(env); break; case RENAME_COLUMN: LOGGER.info("Rename column to table {}.{} on config node", database, tableName); @@ -87,7 +87,7 @@ protected Flow executeFromState( case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info( "Commit release info of table {}.{} when renaming column", database, tableName); - commitRelease(env); + commitUpdateDataNodeCache(env); return Flow.NO_MORE_STATE; default: setFailure(new ProcedureException("Unrecognized RenameTableColumnState " + state)); @@ -124,8 +124,8 @@ private void columnCheck(final ConfigNodeProcedureEnv env) { } @Override - protected void preRelease(final ConfigNodeProcedureEnv env) { - super.preRelease(env); + protected void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + super.preUpdateDataNodeCache(env); setNextState(RenameTableColumnState.RENAME_COLUMN); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java index bd80a1326d073..5ddba53cbf59f 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/RenameTableProcedure.java @@ -71,7 +71,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final RenameTa break; case PRE_UPDATE_DATANODE_CACHE: LOGGER.info("Pre release info of table {}.{} when renaming table", database, tableName); - preRelease(env); + preUpdateDataNodeCache(env); break; case RENAME_TABLE: LOGGER.info("Rename column to table {}.{} on config node", database, tableName); @@ -80,7 +80,7 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final RenameTa case COMMIT_UPDATE_DATANODE_CACHE: LOGGER.info( "Commit release info of table {}.{} when renaming table", database, tableName); - commitRelease(env, tableName); + commitUpdateDataNodeCache(env, tableName); return Flow.NO_MORE_STATE; default: setFailure(new ProcedureException("Unrecognized RenameTableState " + state)); @@ -117,8 +117,8 @@ private void tableCheck(final ConfigNodeProcedureEnv env) { } @Override - protected void preRelease(final ConfigNodeProcedureEnv env) { - super.preRelease(env, tableName); + protected void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + super.preUpdateDataNodeCache(env, tableName); setNextState(RenameTableState.RENAME_TABLE); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java index 5149e837585b6..d0749a396aef9 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/SetTablePropertiesProcedure.java @@ -89,7 +89,7 @@ protected Flow executeFromState( } break; case PRE_UPDATE_DATANODE_CACHE: - preRelease(env); + preUpdateDataNodeCache(env); LOGGER.info( "Pre release info for table {}.{} when setting properties", database, tableName); break; @@ -98,7 +98,7 @@ protected Flow executeFromState( LOGGER.info("Set properties to table {}.{}", database, tableName); break; case COMMIT_UPDATE_DATANODE_CACHE: - commitRelease(env); + commitUpdateDataNodeCache(env); LOGGER.info( "Commit release info of table {}.{} when setting properties", database, tableName); return Flow.NO_MORE_STATE; @@ -141,8 +141,8 @@ private void validateTable(final ConfigNodeProcedureEnv env) { } @Override - protected void preRelease(final ConfigNodeProcedureEnv env) { - super.preRelease(env); + protected void preUpdateDataNodeCache(final ConfigNodeProcedureEnv env) { + super.preUpdateDataNodeCache(env); setNextState(SET_PROPERTIES); } From 18af64ede176f7cc99c60ecdf984460c91f6de1a Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 21 Nov 2025 16:07:55 +0800 Subject: [PATCH 10/33] refactor --- .../src/AlignedTimeseriesSessionExample.cpp | 46 +- .../client-cpp-example/src/SessionExample.cpp | 68 +- .../java/org/apache/iotdb/JDBCExample.java | 18 +- .../iotdb/SyntaxConventionRelatedExample.java | 48 +- example/mqtt/README.md | 2 +- .../org/apache/iotdb/mqtt/MQTTClient.java | 6 +- example/rest-client-c-example/main.c | 2 +- .../java/org/apache/iotdb/HttpExample.java | 4 +- .../java/org/apache/iotdb/HttpsExample.java | 4 +- .../AlignedTimeseriesSessionExample.java | 60 +- .../iotdb/HybridTimeseriesSessionExample.java | 8 +- .../iotdb/SessionConcurrentExample.java | 4 +- .../java/org/apache/iotdb/SessionExample.java | 60 +- .../org/apache/iotdb/SessionPoolExample.java | 4 +- .../iotdb/SubscriptionSessionExample.java | 4 +- .../iotdb/SyntaxConventionRelatedExample.java | 38 +- .../java/org/apache/iotdb/TabletExample.java | 2 +- .../org/apache/iotdb/udf/UDAFExample.java | 6 +- .../org/apache/iotdb/udf/UDTFExample.java | 10 +- .../it/IoTDBConfigNodeSnapshotIT.java | 10 +- .../database/IoTDBDatabaseSetAndDeleteIT.java | 8 +- .../load/IoTDBConfigNodeSwitchLeaderIT.java | 4 +- .../IoTDBCustomRegionGroupExtensionIT.java | 2 +- .../partition/IoTDBPartitionCreationIT.java | 2 +- .../it/partition/IoTDBPartitionDurableIT.java | 2 +- .../it/partition/IoTDBPartitionGetterIT.java | 26 +- .../it/partition/IoTDBTimePartitionIT.java | 8 +- ...RegionOperationReliabilityITFramework.java | 6 +- .../IoTDBRegionReconstructForIoTV1IT.java | 4 +- .../IoTDBRemoveConfigNodeITFramework.java | 2 +- .../it/utils/ConfigNodeTestUtils.java | 2 +- .../iotdb/db/it/GrafanaApiServiceIT.java | 20 +- .../iotdb/db/it/IoTDBDatetimeFormatIT.java | 16 +- .../apache/iotdb/db/it/IoTDBDeletionIT.java | 4 +- .../apache/iotdb/db/it/IoTDBExampleIT.java | 6 +- .../org/apache/iotdb/db/it/IoTDBFilterIT.java | 12 +- .../iotdb/db/it/IoTDBFloatPrecisionIT.java | 22 +- .../db/it/IoTDBInsertMultiPartitionIT.java | 6 +- .../iotdb/db/it/IoTDBInsertMultiRowIT.java | 6 +- .../apache/iotdb/db/it/IoTDBInsertNullIT.java | 30 +- .../iotdb/db/it/IoTDBInsertWithoutTimeIT.java | 34 +- .../iotdb/db/it/IoTDBJDBCMetadataIT.java | 28 +- .../iotdb/db/it/IoTDBLoadLastCacheIT.java | 14 +- .../apache/iotdb/db/it/IoTDBLoadTsFileIT.java | 80 +- .../iotdb/db/it/IoTDBPartialInsertionIT.java | 32 +- .../IoTDBQueryWithRecreatedTimeseriesIT.java | 16 +- .../iotdb/db/it/IoTDBRestServiceIT.java | 276 +-- .../apache/iotdb/db/it/IoTDBRestartIT.java | 14 +- .../iotdb/db/it/IoTDBSimpleQueryIT.java | 430 ++-- .../it/IoTDBSyntaxConventionIdentifierIT.java | 178 +- .../IoTDBSyntaxConventionStringLiteralIT.java | 44 +- .../org/apache/iotdb/db/it/IoTDBTtlIT.java | 34 +- .../IoTDBAggregationByLevelIT.java | 152 +- .../db/it/aggregation/IoTDBAggregationIT.java | 20 +- .../IoTDBAggregationScanOrderIT.java | 40 +- .../it/aggregation/IoTDBTagAggregationIT.java | 72 +- .../maxby/IoTDBMaxByAlignedSeriesIT.java | 8 +- .../db/it/aggregation/maxby/IoTDBMaxByIT.java | 10 +- ...lignByDeviceWithTemplateAggregationIT.java | 452 ++-- .../IoTDBAlignByDeviceWithTemplateIT.java | 720 +++--- .../it/alignbydevice/IoTDBShuffleSink1IT.java | 26 +- .../it/alignbydevice/IoTDBShuffleSink2IT.java | 58 +- .../IoTDBAggregationWithDeletion2IT.java | 4 +- .../IoTDBAggregationWithDeletionIT.java | 102 +- .../it/aligned/IoTDBAlignedLastQueryIT.java | 60 +- .../it/aligned/IoTDBAlignedSeriesQueryIT.java | 2094 ++++++++--------- ...IoTDBAlignedSeriesQueryWithDeletionIT.java | 20 +- ...IoTDBAlignedSeriesQueryWithMisMatchIT.java | 10 +- .../IoTDBCountMultiTimesWithDeletionIT.java | 10 +- .../it/aligned/IoTDBGroupByLevelQueryIT.java | 58 +- ...ByQueryWithValueFilterWithDeletion2IT.java | 4 +- ...pByQueryWithValueFilterWithDeletionIT.java | 200 +- ...ueryWithoutValueFilterWithDeletion2IT.java | 6 +- ...QueryWithoutValueFilterWithDeletionIT.java | 202 +- .../aligned/IoTDBInsertAlignedValues2IT.java | 30 +- .../aligned/IoTDBInsertAlignedValues4IT.java | 14 +- .../aligned/IoTDBInsertAlignedValuesIT.java | 16 +- .../IoTDBLastQueryWithDeletion2IT.java | 4 +- .../aligned/IoTDBLastQueryWithDeletionIT.java | 52 +- .../IoTDBLastQueryWithoutLastCacheIT.java | 60 +- ...tQueryWithoutLastCacheWithDeletion2IT.java | 4 +- ...stQueryWithoutLastCacheWithDeletionIT.java | 4 +- .../it/aligned/IoTDBPredicatePushDownIT.java | 298 +-- ...ueryWithoutValueFilterWithDeletion2IT.java | 8 +- ...QueryWithoutValueFilterWithDeletionIT.java | 62 +- .../apache/iotdb/db/it/auth/IoTDBAuthIT.java | 82 +- .../db/it/auth/IoTDBSeriesPermissionIT.java | 24 +- .../db/it/auth/IoTDBSystemPermissionIT.java | 8 +- .../iotdb/db/it/auth/IoTDBTemplateAuthIT.java | 40 +- .../db/it/auth/IoTDBTemplatePermissionIT.java | 44 +- .../scalar/IoTDBCastFunctionIT.java | 410 ++-- .../scalar/IoTDBReplaceFunctionIT.java | 66 +- .../scalar/IoTDBSubStringFunctionIT.java | 58 +- .../apache/iotdb/db/it/cq/IoTDBCQExecIT.java | 80 +- .../iotdb/db/it/cq/IoTDBCQExecInNsIT.java | 80 +- .../iotdb/db/it/cq/IoTDBCQExecInUsIT.java | 80 +- .../org/apache/iotdb/db/it/cq/IoTDBCQIT.java | 98 +- .../it/groupby/IoTDBGroupByConditionIT.java | 160 +- .../db/it/groupby/IoTDBGroupByCountIT.java | 156 +- .../groupby/IoTDBGroupByNaturalMonthIT.java | 38 +- ...IoTDBGroupByNaturalMonthNsPrecisionIT.java | 6 +- ...IoTDBGroupByNaturalMonthUsPrecisionIT.java | 2 +- .../db/it/groupby/IoTDBGroupByUnseqIT.java | 52 +- .../db/it/groupby/IoTDBLeftORightCIT.java | 6 +- .../db/it/last/IoTDBLastQueryLastCacheIT.java | 20 +- .../last/IoTDBLastQueryWithLimitOffsetIT.java | 26 +- .../iotdb/db/it/last/IoTDBLastWithTTLIT.java | 18 +- .../iotdb/db/it/orderBy/IoTDBOrderByIT.java | 258 +- .../iotdb/db/it/query/IoTDBAliasIT.java | 202 +- .../iotdb/db/it/query/IoTDBArithmeticIT.java | 42 +- .../db/it/query/IoTDBCaseWhenThenIT.java | 368 +-- .../it/query/IoTDBEncryptionValueQueryIT.java | 82 +- .../apache/iotdb/db/it/query/IoTDBInIT.java | 54 +- ...oTDBNoSelectExpressionAfterAnalyzedIT.java | 20 +- .../db/it/query/IoTDBNullValueFillIT.java | 180 +- .../iotdb/db/it/query/IoTDBQueryDemoIT.java | 82 +- .../IoTDBQueryWithComplexValueFilterIT.java | 82 +- .../iotdb/db/it/query/IoTDBResultSetIT.java | 30 +- .../query/IoTDBSelectCompareExpressionIT.java | 38 +- .../db/it/query/IoTDBSelectSchemaIT.java | 34 +- .../iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java | 244 +- .../db/it/schema/IoTDBAutoCreateSchemaIT.java | 40 +- .../db/it/schema/IoTDBCountDeviceIT.java | 20 +- .../IoTDBCreateAlignedTimeseriesIT.java | 28 +- .../db/it/schema/IoTDBCreateDatabaseIT.java | 4 +- .../db/it/schema/IoTDBCreateTimeseriesIT.java | 52 +- .../it/schema/IoTDBDeactivateTemplateIT.java | 74 +- .../IoTDBDeleteAlignedTimeseriesIT.java | 34 +- .../db/it/schema/IoTDBDeleteDatabaseIT.java | 28 +- .../db/it/schema/IoTDBDeleteTimeSeriesIT.java | 84 +- .../db/it/schema/IoTDBMetadataFetchIT.java | 52 +- .../db/it/schema/IoTDBSchemaTemplateIT.java | 248 +- .../schema/quota/IoTDBClusterMixQuotaIT.java | 22 +- .../it/schema/quota/IoTDBClusterQuotaIT.java | 32 +- .../regionscan/IoTDBActiveRegionScanIT.java | 236 +- .../IoTDBActiveRegionScanWithModsIT.java | 52 +- .../IoTDBActiveRegionScanWithTTLIT.java | 42 +- .../regionscan/IoTDBActiveSchemaQueryIT.java | 232 +- .../db/it/selectinto/IoTDBSelectIntoIT.java | 456 ++-- .../it/specialwords/IoTDBSpecialWordsIT.java | 10 +- .../it/udaf/IoTDBUDAFGroupByConditionIT.java | 142 +- .../db/it/udaf/IoTDBUDAFGroupByCountIT.java | 140 +- .../db/it/udaf/IoTDBUDAFGroupByLevelIT.java | 116 +- .../iotdb/db/it/udaf/IoTDBUDAFMiscIT.java | 16 +- .../db/it/udaf/IoTDBUDAFNormalQueryIT.java | 16 +- .../iotdb/db/it/udaf/IoTDBUDAFOrderByIT.java | 124 +- .../udf/IoTDBUDFIntermediateBlockSerdeIT.java | 16 +- .../db/it/udf/IoTDBUDFWindowQuery2IT.java | 36 +- .../it/udf/IoTDBUDTFAlignByTimeQueryIT.java | 6 +- .../db/it/udf/IoTDBUDTFBuiltinFunctionIT.java | 248 +- .../db/it/udf/IoTDBUDTFHybridQueryIT.java | 2 +- .../iotdb/db/it/utils/AlignedWriteUtil.java | 180 +- .../enhanced/IoTDBPipeSinkParallelIT.java | 12 +- .../auto/basic/IoTDBPipeSinkParallelIT.java | 10 +- .../enhanced/IoTDBPipeAutoConflictIT.java | 18 +- .../auto/enhanced/IoTDBPipeIdempotentIT.java | 76 +- .../auto/enhanced/IoTDBPipeNullValueIT.java | 22 +- .../manual/IoTDBPipeManualConflictIT.java | 24 +- .../manual/IoTDBPipeMetaHistoricalIT.java | 14 +- .../manual/IoTDBPipeMultiSchemaRegionIT.java | 6 +- ...oTDBPipeTsFileDecompositionWithModsIT.java | 262 +-- .../pipe/it/triple/IoTDBPipeForwardIT.java | 10 +- .../it/db/it/IoTDBCaseWhenThenTableIT.java | 28 +- .../it/query/old/IoTDBFilterTableIT.java | 4 +- .../it/query/old/IoTDBSimpleQueryTableIT.java | 20 +- .../IoTDBAlignedSeriesQueryTableIT.java | 18 +- .../old/orderBy/IoTDBOrderByTableIT.java | 70 +- ...oSelectExpressionAfterAnalyzedTableIT.java | 2 +- .../view/old/IoTDBFilterTableViewIT.java | 4 +- .../view/old/IoTDBSimpleQueryTableViewIT.java | 190 +- ...BAlignByDeviceWithTemplateTableViewIT.java | 26 +- .../IoTDBAlignedSeriesQueryTableViewIT.java | 18 +- .../view/old/aligned/TableViewUtils.java | 182 +- .../old/orderby/IoTDBOrderByTableViewIT.java | 154 +- .../old/query/IoTDBArithmeticTableViewIT.java | 32 +- .../it/IoTDBSessionAlignedInsertIT.java | 22 +- .../session/it/IoTDBSessionComplexIT.java | 156 +- .../it/IoTDBSessionDisableMemControlIT.java | 30 +- .../session/it/IoTDBSessionInsertNullIT.java | 44 +- .../iotdb/session/it/IoTDBSessionQueryIT.java | 64 +- .../it/IoTDBSessionSchemaTemplateIT.java | 54 +- .../session/it/IoTDBSessionSimpleIT.java | 252 +- .../it/IoTDBSessionSyntaxConventionIT.java | 42 +- .../apache/iotdb/session/it/SessionIT.java | 6 +- .../iotdb/session/it/pool/SessionPoolIT.java | 20 +- iotdb-client/client-cpp/src/main/Session.h | 2 +- .../client-py/iotdb/utils/NumpyTablet.py | 2 +- iotdb-client/client-py/iotdb/utils/Tablet.py | 2 +- .../session_aligned_timeseries_example.py | 48 +- iotdb-client/client-py/session_example.py | 104 +- .../tablet_performance_comparison.py | 2 +- .../integration/test_aligned_timeseries.py | 50 +- .../tests/integration/test_new_data_types.py | 12 +- .../tests/integration/test_session.py | 96 +- .../tests/integration/test_tablet.py | 16 +- .../client-py/tests/unit/test_numpy_tablet.py | 16 +- .../iotdb/session/SessionCacheLeaderTest.java | 56 +- .../iotdb/session/SessionConnectionTest.java | 2 +- .../org/apache/iotdb/session/SessionTest.java | 72 +- .../org/apache/iotdb/session/TabletTest.java | 2 +- .../confignode/manager/ConfigManager.java | 6 +- .../persistence/schema/ConfigMTree.java | 12 +- .../request/ConfigPhysicalPlanSerDeTest.java | 48 +- .../persistence/AuthorInfoTest.java | 2 +- .../CNPhysicalPlanGeneratorTest.java | 8 +- .../confignode/persistence/CQInfoTest.java | 8 +- .../persistence/PartitionInfoTest.java | 4 +- .../confignode/persistence/QuotaInfoTest.java | 2 +- .../confignode/persistence/TTLInfoTest.java | 4 +- .../schema/ClusterSchemaInfoTest.java | 2 +- .../persistence/schema/ConfigMTreeTest.java | 24 +- .../procedure/impl/CreateCQProcedureTest.java | 4 +- .../impl/CreateRegionGroupsProcedureTest.java | 8 +- .../receiver/PipeEnrichedProcedureTest.java | 20 +- .../AlterEncodingCompressorProcedureTest.java | 4 +- .../schema/AlterLogicalViewProcedureTest.java | 2 +- .../DeactivateTemplateProcedureTest.java | 4 +- .../schema/DeleteDatabaseProcedureTest.java | 2 +- .../schema/DeleteTimeSeriesProcedureTest.java | 8 +- .../impl/schema/SetTemplateProcedureTest.java | 2 +- .../schema/UnsetTemplateProcedureTest.java | 2 +- .../protocol/mqtt/JSONPayloadFormatter.java | 4 +- .../common/schematree/ClusterSchemaTree.java | 2 +- .../common/schematree/ISchemaTree.java | 2 +- .../operator/source/FileLoaderUtils.java | 4 +- .../db/queryengine/plan/analyze/Analysis.java | 6 +- .../plan/analyze/AnalyzeVisitor.java | 4 +- .../plan/analyze/GroupByLevelHelper.java | 8 +- .../expression/multi/FunctionExpression.java | 8 +- .../plan/node/process/GroupByLevelNode.java | 4 +- .../plan/node/process/GroupByTagNode.java | 14 +- .../plan/node/write/DeleteDataNode.java | 4 +- .../plan/parameter/AggregationDescriptor.java | 8 +- .../CrossSeriesAggregationDescriptor.java | 8 +- .../statement/component/ResultColumn.java | 24 +- .../impl/mem/MTreeBelowSGMemoryImpl.java | 4 +- .../impl/pbtree/MTreeBelowSGCachedImpl.java | 4 +- .../impl/pbtree/memory/buffer/NodeBuffer.java | 2 +- .../mtree/traverser/Traverser.java | 2 +- .../traverser/basic/DatabaseTraverser.java | 2 +- .../traverser/basic/EntityTraverser.java | 2 +- .../mtree/traverser/basic/MNodeTraverser.java | 4 +- .../traverser/basic/MeasurementTraverser.java | 2 +- .../traverser/updater/EntityUpdater.java | 2 +- .../traverser/updater/MeasurementUpdater.java | 2 +- .../schemaregion/utils/MetaUtils.java | 8 +- .../template/ClusterTemplateManager.java | 8 +- .../iotdb/db/storageengine/StorageEngine.java | 2 +- .../storageengine/dataregion/DataRegion.java | 4 +- .../db/auth/entity/PathPrivilegeTest.java | 4 +- .../DataRegionStateMachineTest.java | 12 +- .../iotdb/db/metadata/MetaUtilsTest.java | 20 +- .../cache/DataNodeDevicePathCacheTest.java | 8 +- .../TreeDeviceSchemaCacheManagerTest.java | 58 +- .../container/MNodeChildBufferTest.java | 26 +- .../metadata/idtable/entry/DeviceIDTest.java | 6 +- .../iotdb/db/metadata/mnode/MNodeTest.java | 4 +- .../mtree/schemafile/SchemaFileTest.java | 18 +- .../db/metadata/path/MeasurementPathTest.java | 6 +- .../db/metadata/path/PatternTreeMapTest.java | 98 +- .../SchemaRegionAliasAndTagTest.java | 136 +- .../schemaRegion/SchemaRegionBasicTest.java | 108 +- .../SchemaRegionManagementTest.java | 34 +- .../SchemaRegionSimpleRecoverTest.java | 30 +- .../SchemaRegionTemplateTest.java | 56 +- .../schemaRegion/SchemaStatisticsTest.java | 80 +- .../event/PipeTabletInsertionEventTest.java | 4 +- .../event/TsFileInsertionEventParserTest.java | 4 +- .../sink/PipeDataNodeThriftRequestTest.java | 6 +- .../iotdb/db/pipe/sink/PipeReceiverTest.java | 2 +- ...eStatementTreePatternParseVisitorTest.java | 4 +- .../pipe/sink/PipeTabletEventSorterTest.java | 6 +- .../PipePlanTreePatternParseVisitorTest.java | 12 +- .../pipe/source/PipeRealtimeExtractTest.java | 6 +- .../SchemaRegionListeningQueueTest.java | 2 +- .../mqtt/JSONPayloadFormatterTest.java | 20 +- .../protocol/rest/GrafanaApiServiceTest.java | 28 +- .../protocol/rest/IoTDBRestServiceTest.java | 100 +- .../schematree/ClusterSchemaTreeTest.java | 222 +- .../operator/LastQueryMergeOperatorTest.java | 64 +- .../operator/OperatorMemoryTest.java | 26 +- .../RawDataAggregationOperatorTest.java | 4 +- .../schema/SchemaFetchScanOperatorTest.java | 18 +- .../predicate/PredicateUtilsTest.java | 28 +- .../analyze/AggregationDescriptorTest.java | 84 +- .../plan/analyze/AnalyzeFailTest.java | 102 +- .../queryengine/plan/analyze/AnalyzeTest.java | 446 ++-- .../plan/analyze/ExpressionAnalyzerTest.java | 26 +- .../analyze/FakePartitionFetcherImpl.java | 20 +- .../plan/analyze/FakeSchemaFetcherImpl.java | 10 +- .../analyze/cache/PartitionCacheTest.java | 189 +- .../optimization/AggregationPushDownTest.java | 110 +- .../ColumnInjectionPushDownTest.java | 180 +- .../optimization/LimitOffsetPushDownTest.java | 182 +- .../optimization/OptimizationTestUtil.java | 46 +- .../optimization/PredicatePushDownTest.java | 246 +- .../plan/parser/StatementGeneratorTest.java | 70 +- .../plan/planner/ExpressionTest.java | 2 +- .../planner/FragmentInstanceSerdeTest.java | 6 +- .../plan/planner/PipelineBuilderTest.java | 56 +- .../AggregationAlignByDeviceTest.java | 70 +- .../AggregationDistributionTest.java | 98 +- .../AlignByDeviceOrderByLimitOffsetTest.java | 292 +-- .../AlignByTimeOrderByLimitOffsetTest.java | 68 +- .../distribution/AlignedByDeviceTest.java | 52 +- .../DistributionPlannerBasicTest.java | 30 +- .../DistributionPlannerCycleTest.java | 6 +- .../planner/distribution/LastQueryTest.java | 16 +- .../NoDataRegionPlanningTest.java | 2 +- .../distribution/RegionScanPlanningTest.java | 38 +- .../plan/planner/distribution/Util.java | 40 +- .../plan/planner/distribution/Util2.java | 12 +- .../logical/DataQueryLogicalPlannerTest.java | 306 +-- .../logical/RegionScanLogicalPlannerTest.java | 38 +- .../SchemaQueryLogicalPlannerTest.java | 4 +- .../read/DeviceSchemaFetchScanNodeTest.java | 10 +- .../read/DeviceSchemaScanNodeSerdeTest.java | 2 +- .../read/PathsUsingTemplateScanNodeTest.java | 4 +- .../read/SchemaCountNodeSerdeTest.java | 6 +- .../read/SchemaFetchMergeNodeTest.java | 4 +- .../read/SeriesSchemaFetchScanNodeTest.java | 8 +- .../TimeSeriesSchemaScanNodeSerdeTest.java | 2 +- .../write/MetadataWriteNodeSerDeTest.java | 32 +- .../PipeEnrichedDeleteDataNodeSerdeTest.java | 4 +- ...PipeEnrichedNonWritePlanNodeSerdeTest.java | 4 +- .../process/AggregationNodeSerdeTest.java | 8 +- .../node/process/DeviceViewNodeSerdeTest.java | 4 +- .../node/process/FilterNodeSerdeTest.java | 4 +- .../process/GroupByLevelNodeSerdeTest.java | 14 +- .../node/process/GroupByTagNodeSerdeTest.java | 16 +- .../node/process/IntoNodeSerdeTest.java | 24 +- .../node/process/LimitNodeSerdeTest.java | 2 +- .../node/process/OffsetNodeSerdeTest.java | 2 +- .../node/process/SortNodeSerdeTest.java | 2 +- .../node/process/TimeJoinNodeSerdeTest.java | 6 +- .../node/process/WindowNodeSerdeTest.java | 2 +- .../SeriesAggregationScanNodeSerdeTest.java | 4 +- .../node/source/SeriesScanNodeSerdeTest.java | 2 +- .../node/write/DeleteDataNodeSerdeTest.java | 4 +- .../node/write/InsertRowsNodeSerdeTest.java | 8 +- .../InsertRowsOfOneDeviceNodeSerdeTest.java | 2 +- .../node/write/WritePlanNodeSplitTest.java | 38 +- .../PatternRecognitionNodeSerdeTest.java | 2 +- .../plan/statement/QueryStatementTest.java | 52 +- .../builder/EvaluationDAGBuilderTest.java | 2 +- .../storageengine/DevicePathCacheTests.java | 12 +- .../buffer/BloomFilterCacheTest.java | 2 +- .../storageengine/buffer/ChunkCacheTest.java | 6 +- .../TsFileResourceProgressIndexTest.java | 6 +- .../compaction/CompactionValidationTest.java | 2 +- .../compaction/CompactionWorkerTest.java | 2 +- .../compaction/cross/MergeTest.java | 6 +- ...adChunkCompactionPerformerAlignedTest.java | 16 +- .../settle/SettleRequestHandlerTest.java | 4 +- .../memtable/PrimitiveMemTableTest.java | 4 +- .../memtable/TsFileProcessorTest.java | 4 +- .../series/AbstractAlignedSeriesScanTest.java | 4 +- .../reader/series/AbstractSeriesScanTest.java | 4 +- .../dataregion/tsfile/TsFileResourceTest.java | 10 +- .../wal/compression/WALCompressionTest.java | 2 +- .../apache/iotdb/db/tools/MLogParserTest.java | 18 +- .../db/tools/TsFileSelfCheckToolTest.java | 2 +- .../iotdb/db/tools/TsFileSketchToolTest.java | 2 +- .../db/tools/TsFileValidationScanTest.java | 2 +- .../trigger/executor/TriggerExecuteTest.java | 4 +- .../apache/iotdb/db/utils/MemUtilsTest.java | 6 +- .../utils/SchemaRegionSnapshotParserTest.java | 50 +- .../conf/iotdb-system.properties.template | 4 +- .../iotdb/commons/path/AlignedPath.java | 2 +- .../iotdb/commons/path/PartialPath.java | 62 +- .../iotdb/commons/path/PathPatternTree.java | 4 +- .../commons/path/PathPatternTreeUtils.java | 2 +- .../iotdb/commons/path/fa/nfa/SimpleNFA.java | 4 +- .../schema/tree/AbstractTreeVisitor.java | 10 +- .../multi/FunctionViewExpression.java | 4 +- .../iotdb/commons/path/PartialPathTest.java | 280 +-- .../commons/path/PathPatternTreeTest.java | 256 +- .../iotdb/commons/path/PatternDFATest.java | 44 +- .../commons/udf/IoTDBBuiltInUDFTest.java | 16 +- .../utils/ThriftConfigNodeSerDeUtilsTest.java | 2 +- 380 files changed, 10323 insertions(+), 10324 deletions(-) diff --git a/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp b/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp index 2cc04ab3b3946..77010951ccf4e 100644 --- a/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp +++ b/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp @@ -26,9 +26,9 @@ Session *session; #define DEFAULT_ROW_NUMBER 1000000 void createAlignedTimeseries() { - string alignedDeviceId = "root.sg1.d1"; + string alignedDeviceId = "root.db1.d1"; vector measurements = {"s1", "s2", "s3"}; - vector alignedTimeseries = {"root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3"}; + vector alignedTimeseries = {"root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3"}; vector dataTypes = {TSDataType::INT32, TSDataType::DOUBLE, TSDataType::BOOLEAN}; vector encodings = {TSEncoding::PLAIN, TSEncoding::GORILLA, TSEncoding::RLE}; vector compressors = { @@ -60,12 +60,12 @@ void createSchemaTemplate() { temp.addToTemplate(mNodeS2); session->createSchemaTemplate(temp); - session->setSchemaTemplate("template1", "root.sg3.d1"); + session->setSchemaTemplate("template1", "root.db3.d1"); } } void ActivateTemplate() { - session->executeNonQueryStatement("insert into root.sg3.d1(timestamp,s1, s2) values(200, 1, 1);"); + session->executeNonQueryStatement("insert into root.db3.d1(timestamp,s1, s2) values(200, 1, 1);"); } void showDevices() { @@ -101,7 +101,7 @@ void showTimeseries() { } void insertAlignedRecord() { - string deviceId = "root.sg1.d1"; + string deviceId = "root.db1.d1"; vector measurements; measurements.emplace_back("s1"); measurements.emplace_back("s2"); @@ -117,7 +117,7 @@ void insertAlignedRecord() { } void insertAlignedRecords() { - string deviceId = "root.sg1.d1"; + string deviceId = "root.db1.d1"; vector measurements; measurements.emplace_back("s1"); measurements.emplace_back("s2"); @@ -159,7 +159,7 @@ void insertAlignedTablet() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet("root.sg2.d2", schemas, 100000); + Tablet tablet("root.db2.d2", schemas, 100000); tablet.setAligned(true); for (int64_t time = 0; time < DEFAULT_ROW_NUMBER; time++) { @@ -192,14 +192,14 @@ void insertAlignedTablets() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet1("root.sg1.d1", schemas, 100); - Tablet tablet2("root.sg1.d2", schemas, 100); - Tablet tablet3("root.sg1.d3", schemas, 100); + Tablet tablet1("root.db1.d1", schemas, 100); + Tablet tablet2("root.db1.d2", schemas, 100); + Tablet tablet3("root.db1.d3", schemas, 100); unordered_map tabletMap; - tabletMap["root.sg1.d1"] = &tablet1; - tabletMap["root.sg1.d2"] = &tablet2; - tabletMap["root.sg1.d3"] = &tablet3; + tabletMap["root.db1.d1"] = &tablet1; + tabletMap["root.db1.d2"] = &tablet2; + tabletMap["root.db1.d3"] = &tablet3; for (int64_t time = 0; time < 20; time++) { size_t row1 = tablet1.rowSize++; @@ -256,7 +256,7 @@ void insertNullableTabletWithAlignedTimeseries() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet("root.sg1.d4", schemas, 20); + Tablet tablet("root.db1.d4", schemas, 20); tablet.setAligned(true); for (int64_t time = 0; time < 20; time++) { @@ -291,7 +291,7 @@ void insertNullableTabletWithAlignedTimeseries() { } void query() { - unique_ptr dataSet = session->executeQueryStatement("select * from root.sg1.**"); + unique_ptr dataSet = session->executeQueryStatement("select * from root.db1.**"); cout << "timestamp" << " "; for (const string &name: dataSet->getColumnNames()) { cout << name << " "; @@ -315,11 +315,11 @@ void deleteData() { void deleteTimeseries() { vector paths; - vector alignedTimeseries = {"root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", - "root.sg1.d2.s1", "root.sg1.d2.s2", "root.sg1.d2.s3", - "root.sg1.d3.s1", "root.sg1.d3.s2", "root.sg1.d3.s3", - "root.sg1.d4.s1", "root.sg1.d4.s2", "root.sg1.d4.s3", - "root.sg2.d2.s1", "root.sg2.d2.s2", "root.sg2.d2.s3", }; + vector alignedTimeseries = {"root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", + "root.db1.d2.s1", "root.db1.d2.s2", "root.db1.d2.s3", + "root.db1.d3.s1", "root.db1.d3.s2", "root.db1.d3.s3", + "root.db1.d4.s1", "root.db1.d4.s2", "root.db1.d4.s3", + "root.db2.d2.s1", "root.db2.d2.s2", "root.db2.d2.s3", }; for (const string ×eries: alignedTimeseries) { if (session->checkTimeseriesExists(timeseries)) { paths.push_back(timeseries); @@ -330,8 +330,8 @@ void deleteTimeseries() { void deleteStorageGroups() { vector storageGroups; - storageGroups.emplace_back("root.sg1"); - storageGroups.emplace_back("root.sg2"); + storageGroups.emplace_back("root.db1"); + storageGroups.emplace_back("root.db2"); session->deleteStorageGroups(storageGroups); } @@ -346,7 +346,7 @@ int main() { cout << "setStorageGroup\n" << endl; try { - session->setStorageGroup("root.sg1"); + session->setStorageGroup("root.db1"); } catch (IoTDBException &e) { string errorMessage(e.what()); diff --git a/example/client-cpp-example/src/SessionExample.cpp b/example/client-cpp-example/src/SessionExample.cpp index 2803d18976cbf..e941d2b30cbb3 100644 --- a/example/client-cpp-example/src/SessionExample.cpp +++ b/example/client-cpp-example/src/SessionExample.cpp @@ -24,35 +24,35 @@ using namespace std; Session *session; void createTimeseries() { - if (!session->checkTimeseriesExists("root.sg1.d1.s1")) { - session->createTimeseries("root.sg1.d1.s1", TSDataType::BOOLEAN, TSEncoding::RLE, + if (!session->checkTimeseriesExists("root.db1.d1.s1")) { + session->createTimeseries("root.db1.d1.s1", TSDataType::BOOLEAN, TSEncoding::RLE, CompressionType::SNAPPY); } - if (!session->checkTimeseriesExists("root.sg1.d1.s2")) { - session->createTimeseries("root.sg1.d1.s2", TSDataType::INT32, TSEncoding::RLE, + if (!session->checkTimeseriesExists("root.db1.d1.s2")) { + session->createTimeseries("root.db1.d1.s2", TSDataType::INT32, TSEncoding::RLE, CompressionType::SNAPPY); } - if (!session->checkTimeseriesExists("root.sg1.d1.s3")) { - session->createTimeseries("root.sg1.d1.s3", TSDataType::FLOAT, TSEncoding::RLE, + if (!session->checkTimeseriesExists("root.db1.d1.s3")) { + session->createTimeseries("root.db1.d1.s3", TSDataType::FLOAT, TSEncoding::RLE, CompressionType::SNAPPY); } // create timeseries with tags and attributes - if (!session->checkTimeseriesExists("root.sg1.d1.s4")) { + if (!session->checkTimeseriesExists("root.db1.d1.s4")) { map tags; tags["tag1"] = "v1"; map attributes; attributes["description"] = "v1"; - session->createTimeseries("root.sg1.d1.s4", TSDataType::INT64, TSEncoding::RLE, + session->createTimeseries("root.db1.d1.s4", TSDataType::INT64, TSEncoding::RLE, CompressionType::SNAPPY, nullptr, &tags, &attributes, "temperature"); } } void createMultiTimeseries() { - if (!session->checkTimeseriesExists("root.sg1.d2.s1") && !session->checkTimeseriesExists("root.sg1.d2.s2")) { + if (!session->checkTimeseriesExists("root.db1.d2.s1") && !session->checkTimeseriesExists("root.db1.d2.s2")) { vector paths; - paths.emplace_back("root.sg1.d2.s1"); - paths.emplace_back("root.sg1.d2.s2"); + paths.emplace_back("root.db1.d2.s1"); + paths.emplace_back("root.db1.d2.s2"); vector tsDataTypes; tsDataTypes.push_back(TSDataType::INT64); tsDataTypes.push_back(TSDataType::DOUBLE); @@ -104,12 +104,12 @@ void createSchemaTemplate() { temp.addToTemplate(mNodeS2); session->createSchemaTemplate(temp); - session->setSchemaTemplate("template1", "root.sg3.d1"); + session->setSchemaTemplate("template1", "root.db3.d1"); } } void ActivateTemplate() { - session->executeNonQueryStatement("insert into root.sg3.d1(timestamp,s1, s2) values(200, 1, 1);"); + session->executeNonQueryStatement("insert into root.db3.d1(timestamp,s1, s2) values(200, 1, 1);"); } void showTimeseries() { @@ -129,7 +129,7 @@ void showTimeseries() { } void insertRecord() { - string deviceId = "root.sg2.d1"; + string deviceId = "root.db2.d1"; vector measurements; measurements.emplace_back("s1"); measurements.emplace_back("s2"); @@ -152,7 +152,7 @@ void insertTablet() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet("root.sg1.d1", schemas, 100); + Tablet tablet("root.db1.d1", schemas, 100); for (int64_t time = 0; time < 30; time++) { size_t row = tablet.rowSize++; @@ -180,7 +180,7 @@ void insertTablet() { } void insertRecords() { - string deviceId = "root.sg2.d1"; + string deviceId = "root.db2.d1"; vector measurements; measurements.emplace_back("s1"); measurements.emplace_back("s2"); @@ -222,12 +222,12 @@ void insertTablets() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet1("root.sg1.d2", schemas, 100); - Tablet tablet2("root.sg1.d3", schemas, 100); + Tablet tablet1("root.db1.d2", schemas, 100); + Tablet tablet2("root.db1.d3", schemas, 100); unordered_map tabletMap; - tabletMap["root.sg1.d2"] = &tablet1; - tabletMap["root.sg1.d3"] = &tablet2; + tabletMap["root.db1.d2"] = &tablet1; + tabletMap["root.db1.d3"] = &tablet2; for (int64_t time = 0; time < 30; time++) { size_t row1 = tablet1.rowSize++; @@ -285,7 +285,7 @@ void insertTabletWithNullValues() { schemas.push_back(pairB); schemas.push_back(pairC); - Tablet tablet("root.sg1.d4", schemas, 30); + Tablet tablet("root.db1.d4", schemas, 30); for (int64_t time = 0; time < 30; time++) { size_t row = tablet.rowSize++; @@ -311,7 +311,7 @@ void insertTabletWithNullValues() { } void nonQuery() { - session->executeNonQueryStatement("insert into root.sg1.d1(timestamp,s1) values(100, 1);"); + session->executeNonQueryStatement("insert into root.db1.d1(timestamp,s1) values(100, 1);"); } void query() { @@ -331,18 +331,18 @@ void query() { } void deleteData() { - string path = "root.sg1.d1.s1"; + string path = "root.db1.d1.s1"; int64_t deleteTime = 99; session->deleteData(path, deleteTime); } void deleteTimeseries() { vector paths; - vector timeseriesGrp = { "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", - "root.sg1.d2.s1", "root.sg1.d2.s2", "root.sg1.d2.s3", - "root.sg1.d3.s1", "root.sg1.d3.s2", "root.sg1.d3.s3", - "root.sg1.d4.s1", "root.sg1.d4.s2", "root.sg1.d4.s3", - "root.sg2.d1.s1", "root.sg2.d1.s2", "root.sg2.d1.s3" }; + vector timeseriesGrp = { "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", + "root.db1.d2.s1", "root.db1.d2.s2", "root.db1.d2.s3", + "root.db1.d3.s1", "root.db1.d3.s2", "root.db1.d3.s3", + "root.db1.d4.s1", "root.db1.d4.s2", "root.db1.d4.s3", + "root.db2.d1.s1", "root.db2.d1.s2", "root.db2.d1.s3" }; for (const string& timeseries : timeseriesGrp) { if (session->checkTimeseriesExists(timeseries)) { paths.push_back(timeseries); @@ -353,8 +353,8 @@ void deleteTimeseries() { void deleteStorageGroups() { vector storageGroups; - storageGroups.emplace_back("root.sg1"); - storageGroups.emplace_back("root.sg2"); + storageGroups.emplace_back("root.db1"); + storageGroups.emplace_back("root.db2"); session->deleteStorageGroups(storageGroups); } @@ -379,9 +379,9 @@ int main() { session = new Session("127.0.0.1", 6667, "root", "root"); session->open(false); - cout << "setStorageGroup: root.sg1\n" << endl; + cout << "setStorageGroup: root.db1\n" << endl; try { - session->setStorageGroup("root.sg1"); + session->setStorageGroup("root.db1"); } catch (IoTDBException &e) { string errorMessage(e.what()); @@ -391,9 +391,9 @@ int main() { //throw e; } - cout << "setStorageGroup: root.sg2\n" << endl; + cout << "setStorageGroup: root.db2\n" << endl; try { - session->setStorageGroup("root.sg2"); + session->setStorageGroup("root.db2"); } catch (IoTDBException &e) { string errorMessage(e.what()); diff --git a/example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java b/example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java index efd9449079758..50dfd781d823e 100644 --- a/example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java +++ b/example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java @@ -45,21 +45,21 @@ public static void main(String[] args) throws ClassNotFoundException, SQLExcepti // set JDBC fetchSize statement.setFetchSize(10000); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s3 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s3 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); for (int i = 0; i <= 100; i++) { statement.addBatch(prepareInsertStatement(i)); @@ -107,7 +107,7 @@ private static void outputResult(ResultSet resultSet) throws SQLException { private static String prepareInsertStatement(int time) { return String.format( - "insert into root.sg1.d1(timestamp, s1, s2, s3, s4, s5, s6, s7) values(%d, %d, %d, %d, \"%s\", %d, %s, \"%s\")", + "insert into root.db1.d1(timestamp, s1, s2, s3, s4, s5, s6, s7) values(%d, %d, %d, %d, \"%s\", %d, %s, \"%s\")", time, 1, 1, 1, LocalDate.of(2024, 5, time % 31 + 1), time, "X'cafebabe'", time); } } diff --git a/example/jdbc/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java b/example/jdbc/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java index 98d75a398845b..2042ce8e725d8 100644 --- a/example/jdbc/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java +++ b/example/jdbc/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java @@ -32,38 +32,38 @@ public class SyntaxConventionRelatedExample { /** - * if you want to create a time series named root.sg1.select, a possible SQL statement would be - * like: create timeseries root.sg1.select with datatype=FLOAT, encoding=RLE As described before, + * if you want to create a time series named root.db1.select, a possible SQL statement would be + * like: create timeseries root.db1.select with datatype=FLOAT, encoding=RLE As described before, * when using session API, path is represented using String. The path should be written as - * "root.sg1.select". + * "root.db1.select". */ - private static final String ROOT_SG1_KEYWORD_EXAMPLE = "root.sg1.select"; + private static final String ROOT_SG1_KEYWORD_EXAMPLE = "root.db1.select"; /** - * if you want to create a time series named root.sg1.111, a possible SQL statement would be like: - * create timeseries root.sg1.`111` with datatype=FLOAT, encoding=RLE The path should be written - * as "root.sg1.`111`". + * if you want to create a time series named root.db1.111, a possible SQL statement would be like: + * create timeseries root.db1.`111` with datatype=FLOAT, encoding=RLE The path should be written + * as "root.db1.`111`". */ - private static final String ROOT_SG1_DIGITS_EXAMPLE = "root.sg1.`111`"; + private static final String ROOT_SG1_DIGITS_EXAMPLE = "root.db1.`111`"; /** - * if you want to create a time series named root.sg1.`a"b'c``, a possible SQL statement would be - * like: create timeseries root.sg1.`a"b'c``` with datatype=FLOAT, encoding=RLE The path should be - * written as "root.sg1.`a"b`c```". + * if you want to create a time series named root.db1.`a"b'c``, a possible SQL statement would be + * like: create timeseries root.db1.`a"b'c``` with datatype=FLOAT, encoding=RLE The path should be + * written as "root.db1.`a"b`c```". */ - private static final String ROOT_SG1_SPECIAL_CHARACTER_EXAMPLE = "root.sg1.`a\"b'c```"; + private static final String ROOT_SG1_SPECIAL_CHARACTER_EXAMPLE = "root.db1.`a\"b'c```"; /** - * if you want to create a time series named root.sg1.a, a possible SQL statement would be like: - * create timeseries root.sg1.a with datatype=FLOAT, encoding=RLE The path should be written as - * "root.sg1.a". + * if you want to create a time series named root.db1.a, a possible SQL statement would be like: + * create timeseries root.db1.a with datatype=FLOAT, encoding=RLE The path should be written as + * "root.db1.a". */ - private static final String ROOT_SG1_NORMAL_NODE_EXAMPLE = "root.sg1.a"; + private static final String ROOT_SG1_NORMAL_NODE_EXAMPLE = "root.db1.a"; public static final String CREATE = "CREATE TIMESERIES %s WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"; - private static final String DEVICE = "root.sg1"; + private static final String DEVICE = "root.db1"; public static void main(String[] args) throws ClassNotFoundException, SQLException { Class.forName("org.apache.iotdb.jdbc.IoTDBDriver"); @@ -84,7 +84,7 @@ public static void main(String[] args) throws ClassNotFoundException, SQLExcepti statement.execute(String.format(CREATE, ROOT_SG1_SPECIAL_CHARACTER_EXAMPLE)); // show timeseries - ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.*"); + ResultSet resultSet = statement.executeQuery("show timeseries root.db1.*"); List timeseriesList = new ArrayList<>(); while (resultSet.next()) { timeseriesList.add(resultSet.getString("Timeseries")); @@ -97,15 +97,15 @@ public static void main(String[] args) throws ClassNotFoundException, SQLExcepti statement.executeBatch(); statement.clearBatch(); - resultSet = statement.executeQuery("select ** from root.sg1 where time <= 10"); + resultSet = statement.executeQuery("select ** from root.db1 where time <= 10"); outputResult(resultSet); for (String path : timeseriesList) { - // For example, for timeseires root.sg1.`111`, sensor is 111, as described in syntax + // For example, for timeseires root.db1.`111`, sensor is 111, as described in syntax // convention, it should be written as `111` in SQL - // in resultSet of "show timeseries", result is root.sg1.`111`, which means you need not to + // in resultSet of "show timeseries", result is root.db1.`111`, which means you need not to // worry about dealing with backquotes yourself. resultSet = - statement.executeQuery(String.format("select %s from root.sg1", removeDevice(path))); + statement.executeQuery(String.format("select %s from root.db1", removeDevice(path))); outputResult(resultSet); } } catch (IoTDBSQLException e) { @@ -139,9 +139,9 @@ private static void outputResult(ResultSet resultSet) throws SQLException { } private static String prepareInsertStatement(int time, String path) { - // remove device root.sg1 + // remove device root.db1 path = removeDevice(path); - return String.format("insert into root.sg1(timestamp, %s) values( %d ,1)", path, time); + return String.format("insert into root.db1(timestamp, %s) values( %d ,1)", path, time); } private static String removeDevice(String path) { diff --git a/example/mqtt/README.md b/example/mqtt/README.md index 421dcd8b7263d..5f0427527266e 100644 --- a/example/mqtt/README.md +++ b/example/mqtt/README.md @@ -29,5 +29,5 @@ The example is to show how to send data to IoTDB from a mqtt client. * Update configuration to enable MQTT service. (`enable_mqtt_service=true` in iotdb-datanode.properties) * Launch the IoTDB server. -* Setup database `CREATE DATABASE root.sg` and create time timeseries `CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=DOUBLE, ENCODING=PLAIN`. +* Setup database `CREATE DATABASE root.db` and create time timeseries `CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=DOUBLE, ENCODING=PLAIN`. * Run `org.apache.iotdb.mqtt.MQTTClient` to run the mqtt client and send events to server. diff --git a/example/mqtt/src/main/java/org/apache/iotdb/mqtt/MQTTClient.java b/example/mqtt/src/main/java/org/apache/iotdb/mqtt/MQTTClient.java index ec15ad23567a3..c84ead139bedc 100644 --- a/example/mqtt/src/main/java/org/apache/iotdb/mqtt/MQTTClient.java +++ b/example/mqtt/src/main/java/org/apache/iotdb/mqtt/MQTTClient.java @@ -52,7 +52,7 @@ private static void jsonPayloadFormatter(BlockingConnection connection) throws E String payload = String.format( "{\n" - + "\"device\":\"root.sg.d1\",\n" + + "\"device\":\"root.db.d1\",\n" + "\"timestamp\":%d,\n" + "\"measurements\":[\"s1\"],\n" + "\"values\":[%f]\n" @@ -62,12 +62,12 @@ private static void jsonPayloadFormatter(BlockingConnection connection) throws E // publish a json object Thread.sleep(1); - connection.publish("root.sg.d1.s1", payload.getBytes(), QoS.AT_LEAST_ONCE, false); + connection.publish("root.db.d1.s1", payload.getBytes(), QoS.AT_LEAST_ONCE, false); } // publish a json array sb.insert(0, "["); sb.replace(sb.lastIndexOf(","), sb.length(), "]"); - connection.publish("root.sg.d1.s1", sb.toString().getBytes(), QoS.AT_LEAST_ONCE, false); + connection.publish("root.db.d1.s1", sb.toString().getBytes(), QoS.AT_LEAST_ONCE, false); } // The database must be created in advance diff --git a/example/rest-client-c-example/main.c b/example/rest-client-c-example/main.c index 2bd5efdd9daae..3c397e69058ad 100644 --- a/example/rest-client-c-example/main.c +++ b/example/rest-client-c-example/main.c @@ -86,7 +86,7 @@ void nonQuery(char* sql_str) { } void insertTablet(char * sql_str) { - // curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"timestamps":[1635232143960,1635232153960],"measurements":["s3","s4"],"dataTypes":["INT32","BOOLEAN"],"values":[[11,null],[false,true]],"isAligned":false,"deviceId":"root.sg27"}' http://127.0.0.1:18080/rest/v1/insertTablet + // curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"timestamps":[1635232143960,1635232153960],"measurements":["s3","s4"],"dataTypes":["INT32","BOOLEAN"],"values":[[11,null],[false,true]],"isAligned":false,"deviceId":"root.db27"}' http://127.0.0.1:18080/rest/v1/insertTablet CURL *curl_handle = curl_easy_init(); if (curl_handle == NULL) { fprintf(stderr, "curl_handle == NULL\n"); diff --git a/example/rest-java-example/src/main/java/org/apache/iotdb/HttpExample.java b/example/rest-java-example/src/main/java/org/apache/iotdb/HttpExample.java index bccc2fd254949..53893da866eec 100644 --- a/example/rest-java-example/src/main/java/org/apache/iotdb/HttpExample.java +++ b/example/rest-java-example/src/main/java/org/apache/iotdb/HttpExample.java @@ -94,7 +94,7 @@ public void insertTablet() { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:18080/rest/v1/insertTablet"); String json = - "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.sg25\"}"; + "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.db25\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -119,7 +119,7 @@ public void query() { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:18080/rest/v1/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); diff --git a/example/rest-java-example/src/main/java/org/apache/iotdb/HttpsExample.java b/example/rest-java-example/src/main/java/org/apache/iotdb/HttpsExample.java index a3dbbceafc7fe..2a543d8d62a1e 100644 --- a/example/rest-java-example/src/main/java/org/apache/iotdb/HttpsExample.java +++ b/example/rest-java-example/src/main/java/org/apache/iotdb/HttpsExample.java @@ -94,7 +94,7 @@ public void insertTablet() { try { HttpPost httpPost = getHttpPost("https://127.0.0.1:18080/rest/v1/insertTablet"); String json = - "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.sg25\"}"; + "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.db25\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -119,7 +119,7 @@ public void query() { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("https://127.0.0.1:18080/rest/v1/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); diff --git a/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java b/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java index 288bd65ddcb41..5e753c9e12b6b 100644 --- a/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java +++ b/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java @@ -45,14 +45,14 @@ public class AlignedTimeseriesSessionExample { private static Session session; - private static final String ROOT_SG1_D1 = "root.sg_1.d1"; - private static final String ROOT_SG1_D1_VECTOR2 = "root.sg_1.d1.vector2"; - private static final String ROOT_SG1_D1_VECTOR3 = "root.sg_1.d1.vector3"; - private static final String ROOT_SG2_D1_VECTOR4 = "root.sg_2.d1.vector4"; - private static final String ROOT_SG2_D1_VECTOR5 = "root.sg_2.d1.vector5"; - private static final String ROOT_SG2_D1_VECTOR6 = "root.sg_2.d1.vector6"; - private static final String ROOT_SG2_D1_VECTOR7 = "root.sg_2.d1.vector7"; - private static final String ROOT_SG2_D1_VECTOR8 = "root.sg_2.d1.vector8"; + private static final String ROOT_SG1_D1 = "root.db_1.d1"; + private static final String ROOT_SG1_D1_VECTOR2 = "root.db_1.d1.vector2"; + private static final String ROOT_SG1_D1_VECTOR3 = "root.db_1.d1.vector3"; + private static final String ROOT_SG2_D1_VECTOR4 = "root.db_2.d1.vector4"; + private static final String ROOT_SG2_D1_VECTOR5 = "root.db_2.d1.vector5"; + private static final String ROOT_SG2_D1_VECTOR6 = "root.db_2.d1.vector6"; + private static final String ROOT_SG2_D1_VECTOR7 = "root.db_2.d1.vector7"; + private static final String ROOT_SG2_D1_VECTOR8 = "root.db_2.d1.vector8"; public static final String FLUSH = "flush"; public static void main(String[] args) @@ -83,21 +83,21 @@ public static void main(String[] args) selectWithValueFilterTest(); selectWithLastTest(); selectWithLastTestWithoutValueFilter(); - session.executeNonQueryStatement("delete from root.sg_1.d1.s1 where time <= 5"); - System.out.println("execute sql delete from root.sg_1.d1.s1 where time <= 5"); + session.executeNonQueryStatement("delete from root.db_1.d1.s1 where time <= 5"); + System.out.println("execute sql delete from root.db_1.d1.s1 where time <= 5"); selectTest(); selectWithValueFilterTest(); selectWithLastTest(); selectWithLastTestWithoutValueFilter(); - session.executeNonQueryStatement("delete from root.sg_1.d1.s2 where time <= 3"); - System.out.println("execute sql delete from root.sg_1.d1.s2 where time <= 3"); + session.executeNonQueryStatement("delete from root.db_1.d1.s2 where time <= 3"); + System.out.println("execute sql delete from root.db_1.d1.s2 where time <= 3"); selectTest(); selectWithValueFilterTest(); selectWithLastTest(); selectWithLastTestWithoutValueFilter(); - session.executeNonQueryStatement("delete from root.sg_1.d1.s1 where time <= 10"); - System.out.println("execute sql delete from root.sg_1.d1.s1 where time <= 10"); + session.executeNonQueryStatement("delete from root.db_1.d1.s1 where time <= 10"); + System.out.println("execute sql delete from root.db_1.d1.s1 where time <= 10"); selectTest(); selectWithValueFilterTest(); selectWithLastTest(); @@ -115,14 +115,14 @@ public static void main(String[] args) } private static void selectTest() throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select s1 from root.sg_1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select s1 from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); } dataSet.closeOperationHandle(); - dataSet = session.executeQueryStatement("select * from root.sg_1.d1"); + dataSet = session.executeQueryStatement("select * from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -134,7 +134,7 @@ private static void selectTest() throws StatementExecutionException, IoTDBConnec private static void selectWithAlignByDeviceTest() throws StatementExecutionException, IoTDBConnectionException { SessionDataSet dataSet = - session.executeQueryStatement("select * from root.sg_1 align by device"); + session.executeQueryStatement("select * from root.db_1 align by device"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -146,7 +146,7 @@ private static void selectWithAlignByDeviceTest() private static void selectWithValueFilterTest() throws StatementExecutionException, IoTDBConnectionException { SessionDataSet dataSet = - session.executeQueryStatement("select s1 from root.sg_1.d1 where s1 > 3 and time < 9"); + session.executeQueryStatement("select s1 from root.db_1.d1 where s1 > 3 and time < 9"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -155,7 +155,7 @@ private static void selectWithValueFilterTest() dataSet.closeOperationHandle(); dataSet = session.executeQueryStatement( - "select * from root.sg_1.d1 where time < 8 and s1 > 3 and s2 > 5"); + "select * from root.db_1.d1 where time < 8 and s1 > 3 and s2 > 5"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -166,14 +166,14 @@ private static void selectWithValueFilterTest() private static void selectWithAggregationTest() throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select count(s1) from root.sg_1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select count(s1) from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); } dataSet.closeOperationHandle(); - dataSet = session.executeQueryStatement("select count(*) from root.sg_1.d1"); + dataSet = session.executeQueryStatement("select count(*) from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -182,7 +182,7 @@ private static void selectWithAggregationTest() dataSet.closeOperationHandle(); dataSet = session.executeQueryStatement( - "select sum(*) from root.sg_1.d1.vector where time > 50 and s1 > 0 and s2 > 10000"); + "select sum(*) from root.db_1.d1.vector where time > 50 and s1 > 0 and s2 > 10000"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -195,7 +195,7 @@ private static void selectWithGroupByTest() throws StatementExecutionException, IoTDBConnectionException { SessionDataSet dataSet = session.executeQueryStatement( - "select count(s1) from root.sg_1.d1.vector GROUP BY ([1, 100), 20ms)"); + "select count(s1) from root.db_1.d1.vector GROUP BY ([1, 100), 20ms)"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -204,7 +204,7 @@ private static void selectWithGroupByTest() dataSet.closeOperationHandle(); dataSet = session.executeQueryStatement( - "select count(*) from root.sg_1.d1.vector where time > 50 and s1 > 0 and s2 > 10000" + "select count(*) from root.db_1.d1.vector where time > 50 and s1 > 0 and s2 > 10000" + " GROUP BY ([50, 100), 10ms)"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { @@ -216,14 +216,14 @@ private static void selectWithGroupByTest() private static void selectWithLastTest() throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select last s1 from root.sg_1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select last s1 from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); } dataSet.closeOperationHandle(); - dataSet = session.executeQueryStatement("select last * from root.sg_1.d1"); + dataSet = session.executeQueryStatement("select last * from root.db_1.d1"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -235,7 +235,7 @@ private static void selectWithLastTest() private static void selectWithLastTestWithoutValueFilter() throws StatementExecutionException, IoTDBConnectionException { SessionDataSet dataSet = - session.executeQueryStatement("select last s1 from root.sg_1.d1 where time >= 5"); + session.executeQueryStatement("select last s1 from root.db_1.d1 where time >= 5"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -243,14 +243,14 @@ private static void selectWithLastTestWithoutValueFilter() dataSet.closeOperationHandle(); - dataSet = session.executeQueryStatement("select last * from root.sg_1.d1 where time >= 5"); + dataSet = session.executeQueryStatement("select last * from root.db_1.d1 where time >= 5"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); } dataSet.closeOperationHandle(); - dataSet = session.executeQueryStatement("select last * from root.sg_1.d1 where time >= 20"); + dataSet = session.executeQueryStatement("select last * from root.db_1.d1 where time >= 20"); System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -337,7 +337,7 @@ private static void createTemplate() template.addToTemplate(iNodeVector); session.createSchemaTemplate(template); - session.setSchemaTemplate("template1", "root.sg_1"); + session.setSchemaTemplate("template1", "root.db_1"); } /** Method 1 for insert tablet with aligned timeseries */ diff --git a/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java b/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java index 34f529d257dbb..eea0fe3cce6c9 100644 --- a/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java +++ b/example/session/src/main/java/org/apache/iotdb/HybridTimeseriesSessionExample.java @@ -44,9 +44,9 @@ public class HybridTimeseriesSessionExample { LoggerFactory.getLogger(HybridTimeseriesSessionExample.class); private static Session session; - private static final String ROOT_SG1_ALIGNEDDEVICE = "root.sg_1.aligned_device"; - private static final String ROOT_SG1_D1 = "root.sg_1.d1"; - private static final String ROOT_SG1_D2 = "root.sg_1.d2"; + private static final String ROOT_SG1_ALIGNEDDEVICE = "root.db_1.aligned_device"; + private static final String ROOT_SG1_D1 = "root.db_1.d1"; + private static final String ROOT_SG1_D2 = "root.db_1.d2"; public static void main(String[] args) throws IoTDBConnectionException, StatementExecutionException { @@ -66,7 +66,7 @@ public static void main(String[] args) } private static void selectTest() throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select ** from root.sg_1"); + SessionDataSet dataSet = session.executeQueryStatement("select ** from root.db_1"); LOGGER.info("columnNames = {}", dataSet.getColumnNames()); while (dataSet.hasNext()) { LOGGER.info("data = {}", dataSet.next()); diff --git a/example/session/src/main/java/org/apache/iotdb/SessionConcurrentExample.java b/example/session/src/main/java/org/apache/iotdb/SessionConcurrentExample.java index 40d3ed12e8094..077f49d6c629f 100644 --- a/example/session/src/main/java/org/apache/iotdb/SessionConcurrentExample.java +++ b/example/session/src/main/java/org/apache/iotdb/SessionConcurrentExample.java @@ -91,7 +91,7 @@ private static void concurrentOperation(CountDownLatch latch, int currentIndex) try { insertTablet( session, - String.format("root.sg_%d.d_%d", currentIndex / PARALLEL_DEGREE_FOR_ONE_SG, j)); + String.format("root.db_%d.d_%d", currentIndex / PARALLEL_DEGREE_FOR_ONE_SG, j)); } catch (IoTDBConnectionException | StatementExecutionException e) { LOGGER.error("Insert tablet error", e); } @@ -123,7 +123,7 @@ private static void createTemplate(Session session) session.createSchemaTemplate(template); for (int i = 0; i < SG_NUM; i++) { - session.setSchemaTemplate("template1", "root.sg_" + i); + session.setSchemaTemplate("template1", "root.db_" + i); } } diff --git a/example/session/src/main/java/org/apache/iotdb/SessionExample.java b/example/session/src/main/java/org/apache/iotdb/SessionExample.java index c9e8d42aacf59..407acbf9e8408 100644 --- a/example/session/src/main/java/org/apache/iotdb/SessionExample.java +++ b/example/session/src/main/java/org/apache/iotdb/SessionExample.java @@ -54,15 +54,15 @@ public class SessionExample { private static Session session; private static Session sessionEnableRedirect; - private static final String ROOT_SG1_D1_S1 = "root.sg1.d1.s1"; - private static final String ROOT_SG1_D1_S2 = "root.sg1.d1.s2"; - private static final String ROOT_SG1_D1_S3 = "root.sg1.d1.s3"; - private static final String ROOT_SG1_D1_S4 = "root.sg1.d1.s4"; - private static final String ROOT_SG1_D1_S5 = "root.sg1.d1.s5"; - private static final String ROOT_SG1_D1 = "root.sg1.d1"; - private static final String ROOT_SG1 = "root.sg1"; + private static final String ROOT_SG1_D1_S1 = "root.db1.d1.s1"; + private static final String ROOT_SG1_D1_S2 = "root.db1.d1.s2"; + private static final String ROOT_SG1_D1_S3 = "root.db1.d1.s3"; + private static final String ROOT_SG1_D1_S4 = "root.db1.d1.s4"; + private static final String ROOT_SG1_D1_S5 = "root.db1.d1.s5"; + private static final String ROOT_SG1_D1 = "root.db1.d1"; + private static final String ROOT_SG1 = "root.db1"; private static final String LOCAL_HOST = "127.0.0.1"; - public static final String SELECT_D1 = "select * from root.sg1.d1"; + public static final String SELECT_D1 = "select * from root.db1.d1"; private static final Random RANDOM = new Random(); @@ -82,7 +82,7 @@ public static void main(String[] args) session.setFetchSize(10000); try { - session.createDatabase("root.sg1"); + session.createDatabase("root.db1"); } catch (StatementExecutionException e) { if (e.getStatusCode() != TSStatusCode.DATABASE_ALREADY_EXISTS.getStatusCode()) { throw e; @@ -131,16 +131,16 @@ private static void createAndDropContinuousQueries() throws StatementExecutionException, IoTDBConnectionException { session.executeNonQueryStatement( "CREATE CONTINUOUS QUERY cq1 " - + "BEGIN SELECT max_value(s1) INTO temperature_max FROM root.sg1.* " + + "BEGIN SELECT max_value(s1) INTO temperature_max FROM root.db1.* " + "GROUP BY time(10s) END"); session.executeNonQueryStatement( "CREATE CONTINUOUS QUERY cq2 " - + "BEGIN SELECT count(s2) INTO temperature_cnt FROM root.sg1.* " + + "BEGIN SELECT count(s2) INTO temperature_cnt FROM root.db1.* " + "GROUP BY time(10s), level=1 END"); session.executeNonQueryStatement( "CREATE CONTINUOUS QUERY cq3 " + "RESAMPLE EVERY 20s FOR 20s " - + "BEGIN SELECT avg(s3) INTO temperature_avg FROM root.sg1.* " + + "BEGIN SELECT avg(s3) INTO temperature_avg FROM root.db1.* " + "GROUP BY time(10s), level=1 END"); session.executeNonQueryStatement("DROP CONTINUOUS QUERY cq1"); session.executeNonQueryStatement("DROP CONTINUOUS QUERY cq2"); @@ -204,11 +204,11 @@ private static void createTimeseries() private static void createMultiTimeseries() throws IoTDBConnectionException, StatementExecutionException { - if (!session.checkTimeseriesExists("root.sg1.d2.s1") - && !session.checkTimeseriesExists("root.sg1.d2.s2")) { + if (!session.checkTimeseriesExists("root.db1.d2.s1") + && !session.checkTimeseriesExists("root.db1.d2.s2")) { List paths = new ArrayList<>(); - paths.add("root.sg1.d2.s1"); - paths.add("root.sg1.d2.s2"); + paths.add("root.db1.d2.s1"); + paths.add("root.db1.d2.s2"); List tsDataTypes = new ArrayList<>(); tsDataTypes.add(TSDataType.INT64); tsDataTypes.add(TSDataType.INT64); @@ -244,12 +244,12 @@ private static void createMultiTimeseries() private static void createMultiTimeseriesWithNullPartical() throws IoTDBConnectionException, StatementExecutionException { - if (!session.checkTimeseriesExists("root.sg1.d2.s16") - && !session.checkTimeseriesExists("root.sg1.d2.s17")) { + if (!session.checkTimeseriesExists("root.db1.d2.s16") + && !session.checkTimeseriesExists("root.db1.d2.s17")) { List paths = new ArrayList<>(); - paths.add("root.sg1.d2.s16"); - paths.add("root.sg1.d2.s17"); - paths.add("root.sg1.d2.s18"); + paths.add("root.db1.d2.s16"); + paths.add("root.db1.d2.s17"); + paths.add("root.db1.d2.s18"); List tsDataTypes = new ArrayList<>(); tsDataTypes.add(TSDataType.INT64); tsDataTypes.add(TSDataType.INT64); @@ -304,7 +304,7 @@ private static void createTemplate() template.addToTemplate(mNodeS3); session.createSchemaTemplate(template); - session.setSchemaTemplate("template1", "root.sg1"); + session.setSchemaTemplate("template1", "root.db1"); } private static void insertRecord() throws IoTDBConnectionException, StatementExecutionException { @@ -584,13 +584,13 @@ private static void insertTablets() throws IoTDBConnectionException, StatementEx schemaList.add(new MeasurementSchema("s3", TSDataType.INT64)); Tablet tablet1 = new Tablet(ROOT_SG1_D1, schemaList, 100); - Tablet tablet2 = new Tablet("root.sg1.d2", schemaList, 100); - Tablet tablet3 = new Tablet("root.sg1.d3", schemaList, 100); + Tablet tablet2 = new Tablet("root.db1.d2", schemaList, 100); + Tablet tablet3 = new Tablet("root.db1.d3", schemaList, 100); Map tabletMap = new HashMap<>(); tabletMap.put(ROOT_SG1_D1, tablet1); - tabletMap.put("root.sg1.d2", tablet2); - tabletMap.put("root.sg1.d3", tablet3); + tabletMap.put("root.db1.d2", tablet2); + tabletMap.put("root.db1.d3", tablet3); long timestamp = System.currentTimeMillis(); for (long row = 0; row < 100; row++) { @@ -628,7 +628,7 @@ private static void insertTablets() throws IoTDBConnectionException, StatementEx * write data of String type or Binary type. */ private static void insertText() throws IoTDBConnectionException, StatementExecutionException { - String device = "root.sg1.text"; + String device = "root.db1.text"; // the first data is String type and the second data is Binary type List datas = Arrays.asList("String", new Binary("Binary", TSFileConfig.STRING_CHARSET)); // insertRecord example @@ -663,10 +663,10 @@ private static void insertText() throws IoTDBConnectionException, StatementExecu private static void selectInto() throws IoTDBConnectionException, StatementExecutionException { session.executeNonQueryStatement( - "select s1, s2, s3 into into_s1, into_s2, into_s3 from root.sg1.d1"); + "select s1, s2, s3 into into_s1, into_s2, into_s3 from root.db1.d1"); try (SessionDataSet dataSet = - session.executeQueryStatement("select into_s1, into_s2, into_s3 from root.sg1.d1")) { + session.executeQueryStatement("select into_s1, into_s2, into_s3 from root.db1.d1")) { System.out.println(dataSet.getColumnNames()); while (dataSet.hasNext()) { System.out.println(dataSet.next()); @@ -881,7 +881,7 @@ private static void queryByIterator() } private static void nonQuery() throws IoTDBConnectionException, StatementExecutionException { - session.executeNonQueryStatement("insert into root.sg1.d1(timestamp,s1) values(200, 1)"); + session.executeNonQueryStatement("insert into root.db1.d1(timestamp,s1) values(200, 1)"); } private static void setTimeout() throws IoTDBConnectionException { diff --git a/example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java b/example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java index ea5cdccb59701..d04ef2a8042d4 100644 --- a/example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java +++ b/example/session/src/main/java/org/apache/iotdb/SessionPoolExample.java @@ -82,7 +82,7 @@ public static void main(String[] args) // more insert example, see SessionExample.java private static void insertRecord() throws StatementExecutionException, IoTDBConnectionException { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); List types = new ArrayList<>(); measurements.add("s1"); @@ -107,7 +107,7 @@ private static void queryByIterator() { () -> { SessionDataSetWrapper wrapper = null; try { - wrapper = sessionPool.executeQueryStatement("select * from root.sg1.d1"); + wrapper = sessionPool.executeQueryStatement("select * from root.db1.d1"); // get DataIterator like JDBC DataIterator dataIterator = wrapper.iterator(); System.out.println(wrapper.getColumnNames()); diff --git a/example/session/src/main/java/org/apache/iotdb/SubscriptionSessionExample.java b/example/session/src/main/java/org/apache/iotdb/SubscriptionSessionExample.java index 6f4d503bce0f2..960b1614da80b 100644 --- a/example/session/src/main/java/org/apache/iotdb/SubscriptionSessionExample.java +++ b/example/session/src/main/java/org/apache/iotdb/SubscriptionSessionExample.java @@ -87,7 +87,7 @@ private static void prepareData() throws Exception { String.format( "insert into root.db.d2(time, s1, s2) values (%s, 3, 4)", CURRENT_TIME + i)); session.executeNonQueryStatement( - String.format("insert into root.sg.d3(time, s1) values (%s, 5)", CURRENT_TIME + 2 * i)); + String.format("insert into root.db.d3(time, s1) values (%s, 5)", CURRENT_TIME + 2 * i)); } session.executeNonQueryStatement("flush"); @@ -216,7 +216,7 @@ private static void dataSubscription2() throws Exception { QueryExpression.create( Arrays.asList( new Path("root.db.d2", "s2", true), - new Path("root.sg.d3", "s1", true)), + new Path("root.db.d3", "s1", true)), null)); while (dataSet.hasNext()) { System.out.println(dataSet.next()); diff --git a/example/session/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java b/example/session/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java index ada3646fcceaf..2cc24be34c25f 100644 --- a/example/session/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java +++ b/example/session/src/main/java/org/apache/iotdb/SyntaxConventionRelatedExample.java @@ -49,33 +49,33 @@ public class SyntaxConventionRelatedExample { private static final String LOCAL_HOST = "127.0.0.1"; /** - * if you want to create a time series named root.sg1.select, a possible SQL statement would be - * like: create timeseries root.sg1.select with datatype=FLOAT, encoding=RLE As described before, + * if you want to create a time series named root.db1.select, a possible SQL statement would be + * like: create timeseries root.db1.select with datatype=FLOAT, encoding=RLE As described before, * when using session API, path is represented using String. The path should be written as - * "root.sg1.select". + * "root.db1.select". */ - private static final String ROOT_SG1_KEYWORD_EXAMPLE = "root.sg1.select"; + private static final String ROOT_SG1_KEYWORD_EXAMPLE = "root.db1.select"; /** - * if you want to create a time series named root.sg1.111, a possible SQL statement would be like: - * create timeseries root.sg1.`111` with datatype=FLOAT, encoding=RLE The path should be written - * as "root.sg1.`111`". + * if you want to create a time series named root.db1.111, a possible SQL statement would be like: + * create timeseries root.db1.`111` with datatype=FLOAT, encoding=RLE The path should be written + * as "root.db1.`111`". */ - private static final String ROOT_SG1_DIGITS_EXAMPLE = "root.sg1.`111`"; + private static final String ROOT_SG1_DIGITS_EXAMPLE = "root.db1.`111`"; /** - * if you want to create a time series named root.sg1.`a"b'c``, a possible SQL statement would be - * like: create timeseries root.sg1.`a"b'c``` with datatype=FLOAT, encoding=RLE The path should be - * written as "root.sg1.`a"b`c```". + * if you want to create a time series named root.db1.`a"b'c``, a possible SQL statement would be + * like: create timeseries root.db1.`a"b'c``` with datatype=FLOAT, encoding=RLE The path should be + * written as "root.db1.`a"b`c```". */ - private static final String ROOT_SG1_SPECIAL_CHARACTER_EXAMPLE = "root.sg1.`a\"b'c```"; + private static final String ROOT_SG1_SPECIAL_CHARACTER_EXAMPLE = "root.db1.`a\"b'c```"; /** - * if you want to create a time series named root.sg1.a, a possible SQL statement would be like: - * create timeseries root.sg1.a with datatype=FLOAT, encoding=RLE The path should be written as - * "root.sg1.a". + * if you want to create a time series named root.db1.a, a possible SQL statement would be like: + * create timeseries root.db1.a with datatype=FLOAT, encoding=RLE The path should be written as + * "root.db1.a". */ - private static final String ROOT_SG1_NORMAL_NODE_EXAMPLE = "root.sg1.a"; + private static final String ROOT_SG1_NORMAL_NODE_EXAMPLE = "root.db1.a"; public static void main(String[] args) throws IoTDBConnectionException, StatementExecutionException { @@ -93,7 +93,7 @@ public static void main(String[] args) session.setFetchSize(10000); try { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); } catch (StatementExecutionException e) { if (e.getStatusCode() != TSStatusCode.PATH_ALREADY_EXIST.getStatusCode()) { throw e; @@ -102,9 +102,9 @@ public static void main(String[] args) // createTimeSeries createTimeSeries(); - SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.sg1.*"); + SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.db1.*"); // the expected paths would be: - // [root.sg1.select, root.sg1.`111`, root.sg1.`a"b'c```, root.sg1.a] + // [root.db1.select, root.db1.`111`, root.db1.`a"b'c```, root.db1.a] // You could see that time series in dataSet are exactly the same as // the initial String you used as path. Node names consist of digits or contain special // characters are quoted with ``, both in SQL statement and in header of result dataset. diff --git a/example/session/src/main/java/org/apache/iotdb/TabletExample.java b/example/session/src/main/java/org/apache/iotdb/TabletExample.java index f85dba2215b77..691717a593af6 100644 --- a/example/session/src/main/java/org/apache/iotdb/TabletExample.java +++ b/example/session/src/main/java/org/apache/iotdb/TabletExample.java @@ -169,7 +169,7 @@ public static void main(String[] args) throws Exception { long insertCost = 0; for (int i = 0; i < colSize; i++) { - String deviceId = "root.sg" + i % 8 + "." + i; + String deviceId = "root.db" + i % 8 + "." + i; Tablet ta = new Tablet(deviceId, schemas, rowSize); for (int t = 0; t < rowSize; t++) { diff --git a/example/udf/src/main/java/org/apache/iotdb/udf/UDAFExample.java b/example/udf/src/main/java/org/apache/iotdb/udf/UDAFExample.java index 540f6bcef5cce..3216b35651a18 100644 --- a/example/udf/src/main/java/org/apache/iotdb/udf/UDAFExample.java +++ b/example/udf/src/main/java/org/apache/iotdb/udf/UDAFExample.java @@ -37,11 +37,11 @@ /** This is an internal example of the UDAF implementation. */ public class UDAFExample implements UDAF { /** - * CREATE DATABASE root.sg; CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN; - * INSERT INTO root.sg(time, s1) VALUES (0, 1), (1, 3), (2, 5); + * CREATE DATABASE root.db; CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN; + * INSERT INTO root.db(time, s1) VALUES (0, 1), (1, 3), (2, 5); * *

CREATE FUNCTION avg_udaf AS 'org.apache.iotdb.udf.UDAFExample'; SHOW FUNCTIONS; SELECT s1 - * FROM root.sg; SELECT avg_udaf(s1) FROM root.sg; + * FROM root.db; SELECT avg_udaf(s1) FROM root.db; */ static class AvgState implements State { double sum; diff --git a/example/udf/src/main/java/org/apache/iotdb/udf/UDTFExample.java b/example/udf/src/main/java/org/apache/iotdb/udf/UDTFExample.java index 6d910284e4bbe..def7c689946af 100644 --- a/example/udf/src/main/java/org/apache/iotdb/udf/UDTFExample.java +++ b/example/udf/src/main/java/org/apache/iotdb/udf/UDTFExample.java @@ -34,13 +34,13 @@ /** This is an internal example of the UDTF implementation. */ public class UDTFExample implements UDTF { /** - * CREATE DATABASE root.sg1; CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN; - * CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN; INSERT INTO - * root.sg1.d1(timestamp, s1, s2) VALUES (0, -1, 1); INSERT INTO root.sg1.d1(timestamp, s1, s2) - * VALUES (1, -2, 2); INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (2, -3, 3); + * CREATE DATABASE root.db1; CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN; + * CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN; INSERT INTO + * root.db1.d1(timestamp, s1, s2) VALUES (0, -1, 1); INSERT INTO root.db1.d1(timestamp, s1, s2) + * VALUES (1, -2, 2); INSERT INTO root.db1.d1(timestamp, s1, s2) VALUES (2, -3, 3); * *

CREATE FUNCTION example AS 'org.apache.iotdb.udf.UDTFExample'; SHOW FUNCTIONS; SELECT s1, - * example(s1), s2, example(s2) FROM root.sg1.d1; + * example(s1), s2, example(s2) FROM root.db1.d1; */ @Override public void validate(UDFParameterValidator validator) throws Exception { diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java index a5c757d8dd361..94f3be1202816 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java @@ -105,7 +105,7 @@ public void tearDown() { @Test public void testPartitionInfoSnapshot() throws Exception { - final String sg = "root.sg"; + final String sg = "root.db"; final int databaseNum = 10; final int seriesPartitionSlotsNum = 10; final int timePartitionSlotsNum = 10; @@ -327,8 +327,8 @@ private void assertUDFInformation(List req, TGetUDFTableResp } private Set createCQs(SyncConfigNodeIServiceClient client) throws TException { - String sql1 = "create cq testCq1 BEGIN select s1 into root.backup.d1(s1) from root.sg.d1 END"; - String sql2 = "create cq testCq2 BEGIN select s1 into root.backup.d2(s1) from root.sg.d2 END"; + String sql1 = "create cq testCq1 BEGIN select s1 into root.backup.d1(s1) from root.db.d1 END"; + String sql2 = "create cq testCq2 BEGIN select s1 into root.backup.d2(s1) from root.db.d2 END"; TCreateCQReq req1 = new TCreateCQReq( "testCq1", @@ -337,7 +337,7 @@ private Set createCQs(SyncConfigNodeIServiceClient client) throws TExc 1000, 0, (byte) 0, - "select s1 into root.backup.d1(s1) from root.sg.d1", + "select s1 into root.backup.d1(s1) from root.db.d1", sql1, "UTC", "root"); @@ -349,7 +349,7 @@ private Set createCQs(SyncConfigNodeIServiceClient client) throws TExc 1000, 0, (byte) 1, - "select s1 into root.backup.d2(s1) from root.sg.d2", + "select s1 into root.backup.d2(s1) from root.db.d2", sql2, "UTC", "root"); diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/database/IoTDBDatabaseSetAndDeleteIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/database/IoTDBDatabaseSetAndDeleteIT.java index 959f37d594d51..538047a26102a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/database/IoTDBDatabaseSetAndDeleteIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/database/IoTDBDatabaseSetAndDeleteIT.java @@ -68,8 +68,8 @@ public void tearDown() { @Test public void testSetAndQueryDatabase() throws Exception { TSStatus status; - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String sg0 = "root.db0"; + final String sg1 = "root.db1"; try (SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { @@ -161,8 +161,8 @@ public void testSetAndQueryDatabase() throws Exception { @Test public void testDeleteDatabase() throws Exception { TSStatus status; - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String sg0 = "root.db0"; + final String sg1 = "root.db1"; try (SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBConfigNodeSwitchLeaderIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBConfigNodeSwitchLeaderIT.java index 2246ce4314a6b..6c05f78cf8ebf 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBConfigNodeSwitchLeaderIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/load/IoTDBConfigNodeSwitchLeaderIT.java @@ -88,8 +88,8 @@ private void switchLeader() throws IOException, InterruptedException { @Test public void basicDataInheritIT() throws Exception { - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String sg0 = "root.db0"; + final String sg1 = "root.db1"; final String d00 = sg0 + ".d0.s"; final String d01 = sg0 + ".d1.s"; final String d10 = sg1 + ".d0.s"; diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBCustomRegionGroupExtensionIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBCustomRegionGroupExtensionIT.java index 64b35875a203b..00fbb7176c2d4 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBCustomRegionGroupExtensionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBCustomRegionGroupExtensionIT.java @@ -62,7 +62,7 @@ public class IoTDBCustomRegionGroupExtensionIT { private static final int testReplicationFactor = 3; private static final long testTimePartitionInterval = 604800000; - private static final String sg = "root.sg"; + private static final String sg = "root.db"; private static final int testSgNum = 2; @Before diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionCreationIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionCreationIT.java index 954f54e01bd02..8526ee8390704 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionCreationIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionCreationIT.java @@ -66,7 +66,7 @@ public class IoTDBPartitionCreationIT { private static final String IoTConsensusProtocolClass = ConsensusFactory.IOT_CONSENSUS; private static final int testReplicationFactor = 3; private static final long testTimePartitionInterval = 604800000; - private static final String sg = "root.sg"; + private static final String sg = "root.db"; private static final int testSeriesPartitionBatchSize = 1; private static final int testTimePartitionBatchSize = 1; private static final int testDataRegionGroupPerDatabase = 4; diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionDurableIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionDurableIT.java index 8d6e4a5f83113..472073ed3e231 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionDurableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionDurableIT.java @@ -72,7 +72,7 @@ public class IoTDBPartitionDurableIT { private static final int testReplicationFactor = 3; private static final long testTimePartitionInterval = 604800000; private static final int testDataNodeId = 0; - private static final String sg = "root.sg"; + private static final String sg = "root.db"; final String d0 = sg + ".d0.s"; final String d1 = sg + ".d1.s"; private static final int testSeriesPartitionBatchSize = 1; diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java index f110d4a8d28f0..d331fd268eb6a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java @@ -83,7 +83,7 @@ public class IoTDBPartitionGetterIT { private static final long testTimePartitionInterval = 604800000; private static final int testDataRegionGroupPerDatabase = 5; - private static final String sg = "root.sg"; + private static final String sg = "root.db"; private static final int databaseNum = 2; private static final int testSeriesPartitionSlotNum = 1000; private static final int seriesPartitionBatchSize = 10; @@ -123,8 +123,8 @@ private static void prepareData() throws Exception { } /* Create SchemaPartitions */ - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String sg0 = "root.db0"; + final String sg1 = "root.db1"; final String d00 = sg0 + ".d0.s"; final String d01 = sg0 + ".d1.s"; @@ -202,16 +202,16 @@ private static void prepareData() throws Exception { @Test public void testGetSchemaPartition() throws Exception { - final String sg = "root.sg"; - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String sg = "root.db"; + final String sg0 = "root.db0"; + final String sg1 = "root.db1"; final String d11 = sg1 + ".d1.s"; - final String allPaths = "root.sg*"; - final String allSg0 = "root.sg0.**"; + final String allPaths = "root.db*"; + final String allSg0 = "root.db0.**"; - final String notExistsSg = "root.sg10.**"; + final String notExistsSg = "root.db10.**"; try (SyncConfigNodeIServiceClient client = (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { @@ -254,10 +254,10 @@ public void testGetSchemaPartition() throws Exception { schemaPartitionTableResp.getStatus().getCode()); Assert.assertEquals(2, schemaPartitionTableResp.getSchemaPartitionTableSize()); schemaPartitionTable = schemaPartitionTableResp.getSchemaPartitionTable(); - // Check "root.sg0" + // Check "root.db0" Assert.assertTrue(schemaPartitionTable.containsKey(sg0)); Assert.assertEquals(2, schemaPartitionTable.get(sg0).size()); - // Check "root.sg1" + // Check "root.db1" Assert.assertTrue(schemaPartitionTable.containsKey(sg1)); Assert.assertEquals(1, schemaPartitionTable.get(sg1).size()); } @@ -344,8 +344,8 @@ public void testGetDataPartition() throws Exception { @Test public void testGetSlots() throws Exception { - final String sg0 = "root.sg0"; - final String sg1 = "root.sg1"; + final String sg0 = "root.db0"; + final String sg1 = "root.db1"; final IDeviceID d00 = Factory.DEFAULT_FACTORY.create(sg0 + ".d0.s"); final IDeviceID d01 = Factory.DEFAULT_FACTORY.create(sg0 + ".d1.s"); diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBTimePartitionIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBTimePartitionIT.java index 469d6974cb583..ce4e0b97c5ab8 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBTimePartitionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBTimePartitionIT.java @@ -63,15 +63,15 @@ public class IoTDBTimePartitionIT { private static final Logger LOGGER = LoggerFactory.getLogger(IoTDBTimePartitionIT.class); private static final String INSERTION_1 = - "INSERT INTO root.sg1.d1(timestamp,speed,temperature) values(0, 1, 2)"; + "INSERT INTO root.db1.d1(timestamp,speed,temperature) values(0, 1, 2)"; private static final String INSERTION_2 = - "INSERT INTO root.sg1.d1(timestamp,speed,temperature) values(1000, 1, 2)"; + "INSERT INTO root.db1.d1(timestamp,speed,temperature) values(1000, 1, 2)"; private static final String INSERTION_3 = - "INSERT INTO root.sg1.d1(timestamp,speed,temperature) values(3601000, 1, 2)"; + "INSERT INTO root.db1.d1(timestamp,speed,temperature) values(3601000, 1, 2)"; private List timestatmps = Arrays.asList(0L, 1000L, 3601000L); - private static final String SHOW_TIME_PARTITION = "show timePartition where database = root.sg1"; + private static final String SHOW_TIME_PARTITION = "show timePartition where database = root.db1"; private static final TGetDatabaseReq showAllDatabasesReq; diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/IoTDBRegionOperationReliabilityITFramework.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/IoTDBRegionOperationReliabilityITFramework.java index 8e2a954dc91ce..a6b1487cda196 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/IoTDBRegionOperationReliabilityITFramework.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/IoTDBRegionOperationReliabilityITFramework.java @@ -88,13 +88,13 @@ public class IoTDBRegionOperationReliabilityITFramework { private static final Logger LOGGER = LoggerFactory.getLogger(IoTDBRegionOperationReliabilityITFramework.class); public static final String INSERTION1 = - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(100, 1, 2)"; + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(100, 1, 2)"; private static final String INSERTION2 = - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(101, 3, 4)"; + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(101, 3, 4)"; public static final String FLUSH_COMMAND = "flush on cluster"; private static final String SHOW_REGIONS = "show regions"; private static final String SHOW_DATANODES = "show datanodes"; - private static final String COUNT_TIMESERIES = "select count(*) from root.sg.**"; + private static final String COUNT_TIMESERIES = "select count(*) from root.db.**"; private static final String REGION_MIGRATE_COMMAND_FORMAT = "migrate region %d from %d to %d"; ExecutorService executorService = IoTDBThreadPoolFactory.newCachedThreadPool("regionMigrateIT"); diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionReconstructForIoTV1IT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionReconstructForIoTV1IT.java index 3dc4468e52691..af39e9c21dd8a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionReconstructForIoTV1IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionReconstructForIoTV1IT.java @@ -161,7 +161,7 @@ public void normal1C3DTest() throws Exception { // now, the query should throw exception try { - session.executeQueryStatement("select * from root.sg.**"); + session.executeQueryStatement("select * from root.db.**"); } catch (StatementExecutionException e) { break; } @@ -194,7 +194,7 @@ public void normal1C3DTest() throws Exception { while (true) { SessionDataSet resultSet; try { - resultSet = session.executeQueryStatement("select * from root.sg.**"); + resultSet = session.executeQueryStatement("select * from root.db.**"); } catch (StatementExecutionException e) { if (System.currentTimeMillis() - start > 60_000L) { fail("Cannot execute query within 60s"); diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/removeconfignode/IoTDBRemoveConfigNodeITFramework.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/removeconfignode/IoTDBRemoveConfigNodeITFramework.java index 6112fea7f5255..c29547818a565 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/removeconfignode/IoTDBRemoveConfigNodeITFramework.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/removeconfignode/IoTDBRemoveConfigNodeITFramework.java @@ -53,7 +53,7 @@ public class IoTDBRemoveConfigNodeITFramework { private static final Logger LOGGER = LoggerFactory.getLogger(IoTDBRemoveConfigNodeITFramework.class); private static final String TREE_MODEL_INSERTION = - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(100, 1, 2)"; + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(100, 1, 2)"; private static final String SHOW_CONFIGNODES = "show confignodes"; diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/utils/ConfigNodeTestUtils.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/utils/ConfigNodeTestUtils.java index 0697a6c674d24..d125c6aaae145 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/utils/ConfigNodeTestUtils.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/utils/ConfigNodeTestUtils.java @@ -378,7 +378,7 @@ public static void insertTreeModelData(Statement statement) throws SQLException for (int i = 0; i < 1024; i++) { statement.addBatch( String.format( - "INSERT INTO root.sg.d%d(timestamp,speed,temperature) values(%d, %d, %d)", + "INSERT INTO root.db.d%d(timestamp,speed,temperature) values(%d, %d, %d)", i, i, i, i)); } statement.executeBatch(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java index ee0ee073c9642..53679a9aefe89 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java @@ -140,7 +140,7 @@ public void rightInsertTablet(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/insertTablet"); String json = - "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s4\",\"s5\"],\"dataTypes\":[\"INT32\",\"INT32\"],\"values\":[[11,2],[15,13]],\"isAligned\":false,\"deviceId\":\"root.sg25\"}"; + "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s4\",\"s5\"],\"dataTypes\":[\"INT32\",\"INT32\"],\"values\":[[11,2],[15,13]],\"isAligned\":false,\"deviceId\":\"root.db25\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -181,7 +181,7 @@ public void expressionGroupByLevel(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/grafana/v1/query/expression"); String sql = - "{\"expression\":[\"count(s4)\"],\"prefixPath\":[\"root.sg25\"],\"startTime\":1635232143960,\"endTime\":1635232153960,\"control\":\"group by([1635232143960,1635232153960),1s),level=1\"}"; + "{\"expression\":[\"count(s4)\"],\"prefixPath\":[\"root.db25\"],\"startTime\":1635232143960,\"endTime\":1635232153960,\"control\":\"group by([1635232143960,1635232153960),1s),level=1\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -194,7 +194,7 @@ public void expressionGroupByLevel(CloseableHttpClient httpClient) { Assert.assertTrue(map.size() > 0); Assert.assertTrue(timestampsResult.size() == 10); Assert.assertTrue(valuesResult.size() == 1); - Assert.assertTrue("count(root.sg25.s4)".equals(expressionsResult.get(0))); + Assert.assertTrue("count(root.db25.s4)".equals(expressionsResult.get(0))); } catch (IOException e) { e.printStackTrace(); fail(e.getMessage()); @@ -215,7 +215,7 @@ public void expression(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/grafana/v1/query/expression"); String sql = - "{\"expression\":[\"s4\",\"s5\"],\"prefixPath\":[\"root.sg25\"],\"startTime\":1635232133960,\"endTime\":1635232163960}"; + "{\"expression\":[\"s4\",\"s5\"],\"prefixPath\":[\"root.db25\"],\"startTime\":1635232133960,\"endTime\":1635232163960}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -237,7 +237,7 @@ public void expression(CloseableHttpClient httpClient) { String message = EntityUtils.toString(responseEntity, "utf-8"); ObjectMapper mapper = new ObjectMapper(); Map map = mapper.readValue(message, Map.class); - String[] expressionsResult = {"root.sg25.s4", "root.sg25.s5"}; + String[] expressionsResult = {"root.db25.s4", "root.db25.s5"}; Long[] timestamps = {1635232143960L, 1635232153960L}; Object[] values1 = {11, 2}; Object[] values2 = {15, 13}; @@ -268,7 +268,7 @@ public void expressionWithControl(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/grafana/v1/query/expression"); String sql = - "{\"expression\":[\"sum(s4)\",\"avg(s5)\"],\"prefixPath\":[\"root.sg25\"],\"startTime\":1635232133960,\"endTime\":1635232163960,\"control\":\"group by([1635232133960,1635232163960),20s)\"}"; + "{\"expression\":[\"sum(s4)\",\"avg(s5)\"],\"prefixPath\":[\"root.db25\"],\"startTime\":1635232133960,\"endTime\":1635232163960,\"control\":\"group by([1635232133960,1635232163960),20s)\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { @@ -291,7 +291,7 @@ public void expressionWithControl(CloseableHttpClient httpClient) { String message = EntityUtils.toString(responseEntity, "utf-8"); ObjectMapper mapper = new ObjectMapper(); Map map = mapper.readValue(message, Map.class); - String[] expressionsResult = {"sum(root.sg25.s4)", "avg(root.sg25.s5)"}; + String[] expressionsResult = {"sum(root.db25.s4)", "avg(root.db25.s5)"}; Long[] timestamps = {1635232133960L, 1635232153960L}; Object[] values1 = {11.0, 2.0}; Object[] values2 = {15.0, 13.0}; @@ -322,7 +322,7 @@ public void expressionWithConditionControl(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/grafana/v1/query/expression"); String sql = - "{\"expression\":[\"sum(s4)\",\"avg(s5)\"],\"prefixPath\":[\"root.sg25\"],\"condition\":\"timestamp=1635232143960\",\"startTime\":1635232133960,\"endTime\":1635232163960,\"control\":\"group by([1635232133960,1635232163960),20s)\"}"; + "{\"expression\":[\"sum(s4)\",\"avg(s5)\"],\"prefixPath\":[\"root.db25\"],\"condition\":\"timestamp=1635232143960\",\"startTime\":1635232133960,\"endTime\":1635232163960,\"control\":\"group by([1635232133960,1635232163960),20s)\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -343,7 +343,7 @@ public void expressionWithConditionControl(CloseableHttpClient httpClient) { String message = EntityUtils.toString(responseEntity, "utf-8"); ObjectMapper mapper = new ObjectMapper(); Map map = mapper.readValue(message, Map.class); - String[] expressionsResult = {"sum(root.sg25.s4)", "avg(root.sg25.s5)"}; + String[] expressionsResult = {"sum(root.db25.s4)", "avg(root.db25.s5)"}; Long[] timestamps = {1635232133960L, 1635232153960L}; Object[] values1 = {11.0, null}; Object[] values2 = {15.0, null}; @@ -372,7 +372,7 @@ public void variable(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/grafana/v1/variable"); - String sql = "{\"sql\":\"show child paths root.sg25\"}"; + String sql = "{\"sql\":\"show child paths root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDatetimeFormatIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDatetimeFormatIT.java index 620043e6c7b7b..5f26d3d772d2a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDatetimeFormatIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDatetimeFormatIT.java @@ -93,11 +93,11 @@ public void testDatetimeInputFormat() { for (int i = 0; i < datetimeStrings.length; i++) { String insertSql = String.format( - "INSERT INTO root.sg1.d1(time, s1) values (%s, %d)", datetimeStrings[i], i); + "INSERT INTO root.db1.d1(time, s1) values (%s, %d)", datetimeStrings[i], i); statement.execute(insertSql); } - ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg1.d1"); + ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db1.d1"); Assert.assertNotNull(resultSet); int cnt = 0; @@ -117,20 +117,20 @@ public void testBigDateTime() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg"); + statement.execute("CREATE DATABASE root.db"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=DOUBLE, ENCODING=PLAIN;"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=DOUBLE, ENCODING=PLAIN;"); - statement.execute("insert into root.sg.d1(time,s2) values (1618283005586000, 8.76);"); - statement.execute("select * from root.sg.d1;"); - statement.execute("select * from root.sg.d1 where time=53251-05-07T17:06:26.000+08:00"); + statement.execute("insert into root.db.d1(time,s2) values (1618283005586000, 8.76);"); + statement.execute("select * from root.db.d1;"); + statement.execute("select * from root.db.d1 where time=53251-05-07T17:06:26.000+08:00"); } catch (SQLException e) { e.printStackTrace(); fail(); } try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time,s2) values (16182830055860000000, 8.76);"); + statement.execute("insert into root.db.d1(time,s2) values (16182830055860000000, 8.76);"); fail(); } catch (SQLException e) { Assert.assertTrue( diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java index 17ceb9b696255..fc976d5c95f50 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java @@ -385,10 +385,10 @@ public void testDeleteDataFromEmptySeries() throws SQLException { statement.execute( "INSERT INTO root.ln10.wf01.wt01(Time,status) VALUES (2022-10-11 10:20:50,true),(2022-10-11 10:20:51,true);"); statement.execute( - "create timeseries root.sg10.wf01.wt01.status with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db10.wf01.wt01.status with datatype=BOOLEAN,encoding=PLAIN;"); statement.execute( - "DELETE FROM root.ln10.wf01.wt01.status,root.sg.wf01.wt01.status WHERE time >2022-10-11 10:20:50;"); + "DELETE FROM root.ln10.wf01.wt01.status,root.db.wf01.wt01.status WHERE time >2022-10-11 10:20:50;"); try (ResultSet resultSet = statement.executeQuery("select ** from root.ln10")) { int cnt = 0; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBExampleIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBExampleIT.java index d51a058ec51d3..1afa03a4ec962 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBExampleIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBExampleIT.java @@ -55,11 +55,11 @@ public void exampleTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - try (ResultSet resultSet = statement.executeQuery("show databases root.sg")) { + statement.execute("CREATE DATABASE root.db"); + try (ResultSet resultSet = statement.executeQuery("show databases root.db")) { if (resultSet.next()) { String databasePath = resultSet.getString(ColumnHeaderConstant.DATABASE); - Assert.assertEquals("root.sg", databasePath); + Assert.assertEquals("root.db", databasePath); } else { Assert.fail("This ResultSet is empty."); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterIT.java index b8dd88ea9d715..c5ae6b3f81592 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFilterIT.java @@ -116,7 +116,7 @@ private static void generateData() { } } statement.execute( - " insert into root.sg1.d1(time, s1, s2) aligned values (1,1, \"1\"), (2,2,\"2\")"); + " insert into root.db1.d1(time, s1, s2) aligned values (1,1, \"1\"), (2,2,\"2\")"); statement.execute( " insert into root.vehicle.testUDTF(time, s1, s2) values (1,\"ss\",0), (2,\"d\",3)"); } catch (SQLException throwable) { @@ -185,7 +185,7 @@ public void testSameConstantWithDifferentType() { Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select s2 from root.sg1.d1 where s1 = 1 and s2 >= \"1\" and s2 <= \"2\";")) { + "select s2 from root.db1.d1 where s1 = 1 and s2 >= \"1\" and s2 <= \"2\";")) { int count = 0; while (resultSet.next()) { ++count; @@ -199,16 +199,16 @@ public void testSameConstantWithDifferentType() { @Test public void testMismatchedDataTypes() { assertTestFail( - "select s1 from root.sg1.d1 where s1;", + "select s1 from root.db1.d1 where s1;", "The output type of the expression in WHERE clause should be BOOLEAN, actual data type: DOUBLE."); assertTestFail( - "select count(s1) from root.sg1.d1 group by ([0, 40), 5ms) having count(s1) + 1;", + "select count(s1) from root.db1.d1 group by ([0, 40), 5ms) having count(s1) + 1;", "The output type of the expression in HAVING clause should be BOOLEAN, actual data type: DOUBLE."); assertTestFail( - "select s1 from root.sg1.d1 where s1 align by device;", + "select s1 from root.db1.d1 where s1 align by device;", "The output type of the expression in WHERE clause should be BOOLEAN, actual data type: DOUBLE."); assertTestFail( - "select count(s1) from root.sg1.d1 group by ([0, 40), 5ms) having count(s1) + 1 align by device;", + "select count(s1) from root.db1.d1 group by ([0, 40), 5ms) having count(s1) + 1 align by device;", "The output type of the expression in HAVING clause should be BOOLEAN, actual data type: DOUBLE."); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFloatPrecisionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFloatPrecisionIT.java index 4fd8c2dee4e36..5f14368a00301 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFloatPrecisionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFloatPrecisionIT.java @@ -177,21 +177,21 @@ public void bigFloatNumberTest2() { float[] floats = new float[] {6.5536403E8F, 3.123456768E20F, Float.NaN}; double[] doubles = new double[] {9.223372036854E18, 9.223372036854E100, Double.NaN}; - statement.execute("create timeseries root.sg.d1.s1 with datatype=float, encoding=rle"); - statement.execute("create timeseries root.sg.d1.s2 with datatype=double, encoding=rle"); + statement.execute("create timeseries root.db.d1.s1 with datatype=float, encoding=rle"); + statement.execute("create timeseries root.db.d1.s2 with datatype=double, encoding=rle"); statement.execute( - "insert into root.sg.d1(time, s1, s2) values (1, 6.5536403E8, 9.223372036854E18)"); + "insert into root.db.d1(time, s1, s2) values (1, 6.5536403E8, 9.223372036854E18)"); statement.execute( - "insert into root.sg.d1(time, s1, s2) values (2, 3.123456768E20, 9.223372036854E100)"); - statement.execute("insert into root.sg.d1(time, s1, s2) values (3, NaN, NaN)"); + "insert into root.db.d1(time, s1, s2) values (2, 3.123456768E20, 9.223372036854E100)"); + statement.execute("insert into root.db.d1(time, s1, s2) values (3, NaN, NaN)"); int cnt; - try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db.d1")) { assertNotNull(resultSet); cnt = 0; while (resultSet.next()) { - assertEquals(floats[cnt], resultSet.getFloat("root.sg.d1.s1"), DELTA_FLOAT); - assertEquals(doubles[cnt], resultSet.getDouble("root.sg.d1.s2"), DELTA_DOUBLE); + assertEquals(floats[cnt], resultSet.getFloat("root.db.d1.s1"), DELTA_FLOAT); + assertEquals(doubles[cnt], resultSet.getDouble("root.db.d1.s2"), DELTA_DOUBLE); cnt++; } assertEquals(3, cnt); @@ -199,12 +199,12 @@ public void bigFloatNumberTest2() { statement.execute("flush"); - try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db.d1")) { assertNotNull(resultSet); cnt = 0; while (resultSet.next()) { - assertEquals(floats[cnt], resultSet.getFloat("root.sg.d1.s1"), DELTA_FLOAT); - assertEquals(doubles[cnt], resultSet.getDouble("root.sg.d1.s2"), DELTA_DOUBLE); + assertEquals(floats[cnt], resultSet.getFloat("root.db.d1.s1"), DELTA_FLOAT); + assertEquals(doubles[cnt], resultSet.getDouble("root.db.d1.s2"), DELTA_DOUBLE); cnt++; } assertEquals(3, cnt); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiPartitionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiPartitionIT.java index fac1175f74e45..e6baf334a62af 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiPartitionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiPartitionIT.java @@ -59,10 +59,10 @@ public void testInsertMultiPartition() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time,s1) values(1,2)"); + statement.execute("insert into root.db.d1(time,s1) values(1,2)"); statement.execute("flush"); - statement.execute("insert into root.sg.d1(time,s1) values(2,2)"); - statement.execute("insert into root.sg.d1(time,s1) values(604800001,2)"); + statement.execute("insert into root.db.d1(time,s1) values(2,2)"); + statement.execute("insert into root.db.d1(time,s1) values(604800001,2)"); statement.execute("flush"); } catch (Exception e) { fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java index 18c00b125dd1c..1e03bbc308e05 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java @@ -176,11 +176,11 @@ public void testInsertMultiRowWithWrongTimestampPrecision() { @Test public void testInsertMultiRowWithMultiTimePartition() throws Exception { try (Statement st1 = connection.createStatement()) { - st1.execute("insert into root.sg1.d1(time,s1) values(604800010,1)"); + st1.execute("insert into root.db1.d1(time,s1) values(604800010,1)"); st1.execute("flush"); - st1.execute("insert into root.sg1.d1(time,s1) values(604799990,1), (604800001,1)"); + st1.execute("insert into root.db1.d1(time,s1) values(604799990,1), (604800001,1)"); st1.execute("flush"); - ResultSet rs1 = st1.executeQuery("select s1 from root.sg1.d1"); + ResultSet rs1 = st1.executeQuery("select s1 from root.db1.d1"); assertTrue(rs1.next()); assertEquals(604799990, rs1.getLong("Time")); assertTrue(rs1.next()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertNullIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertNullIT.java index 47f1e8f67dfe0..bcd842769dcca 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertNullIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertNullIT.java @@ -76,11 +76,11 @@ private static void close() { } private static void initCreateSQLStatement() { - sqls.add("CREATE DATABASE root.sg"); - sqls.add("CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=BOOLEAN"); - sqls.add("CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=FLOAT"); - sqls.add("CREATE TIMESERIES root.sg.d1.s3 WITH DATATYPE=INT32"); - sqls.add("CREATE ALIGNED TIMESERIES root.sg.d2(s1 BOOLEAN,s2 FLOAT,s3 INT32)"); + sqls.add("CREATE DATABASE root.db"); + sqls.add("CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=BOOLEAN"); + sqls.add("CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=FLOAT"); + sqls.add("CREATE TIMESERIES root.db.d1.s3 WITH DATATYPE=INT32"); + sqls.add("CREATE ALIGNED TIMESERIES root.db.d2(s1 BOOLEAN,s2 FLOAT,s3 INT32)"); } private static void insertData() throws SQLException { @@ -103,17 +103,17 @@ public void testInsertNull() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time,s1,s2,s3) values(1,null,1.0,1)"); - statement.execute("insert into root.sg.d1(time,s1,s2,s3) values(2,true,null,2)"); - statement.execute("insert into root.sg.d1(time,s1,s2,s3) values(3,true,3.0,null)"); + statement.execute("insert into root.db.d1(time,s1,s2,s3) values(1,null,1.0,1)"); + statement.execute("insert into root.db.d1(time,s1,s2,s3) values(2,true,null,2)"); + statement.execute("insert into root.db.d1(time,s1,s2,s3) values(3,true,3.0,null)"); - try (ResultSet resultSet = statement.executeQuery("select * from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db.d1")) { assertNotNull(resultSet); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, - "Time,root.sg.d1.s1,root.sg.d1.s2,root.sg.d1.s3", + "Time,root.db.d1.s1,root.db.d1.s2,root.db.d1.s3", new int[] { Types.TIMESTAMP, Types.BOOLEAN, Types.FLOAT, Types.INTEGER, }); @@ -149,17 +149,17 @@ public void testInsertAlignedNull() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d2(time,s1,s2,s3) aligned values(1,null,1.0,1)"); - statement.execute("insert into root.sg.d2(time,s1,s2,s3) aligned values(2,true,null,2)"); - statement.execute("insert into root.sg.d2(time,s1,s2,s3) aligned values(3,true,3.0,null)"); + statement.execute("insert into root.db.d2(time,s1,s2,s3) aligned values(1,null,1.0,1)"); + statement.execute("insert into root.db.d2(time,s1,s2,s3) aligned values(2,true,null,2)"); + statement.execute("insert into root.db.d2(time,s1,s2,s3) aligned values(3,true,3.0,null)"); - try (ResultSet resultSet = statement.executeQuery("select * from root.sg.d2")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db.d2")) { assertNotNull(resultSet); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, - "Time,root.sg.d2.s1,root.sg.d2.s2,root.sg.d2.s3", + "Time,root.db.d2.s1,root.db.d2.s2,root.db.d2.s3", new int[] { Types.TIMESTAMP, Types.BOOLEAN, Types.FLOAT, Types.INTEGER, }); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertWithoutTimeIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertWithoutTimeIT.java index 62d04de083a77..16b36b9e47882 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertWithoutTimeIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertWithoutTimeIT.java @@ -46,10 +46,10 @@ public class IoTDBInsertWithoutTimeIT { private static final List sqls = Arrays.asList( - "CREATE DATABASE root.sg1", - "CREATE TIMESERIES root.sg1.d1.s1 INT64", - "CREATE TIMESERIES root.sg1.d1.s2 FLOAT", - "CREATE TIMESERIES root.sg1.d1.s3 TEXT"); + "CREATE DATABASE root.db1", + "CREATE TIMESERIES root.db1.d1.s1 INT64", + "CREATE TIMESERIES root.db1.d1.s2 FLOAT", + "CREATE TIMESERIES root.db1.d1.s3 TEXT"); @Before public void setUp() throws Exception { @@ -78,50 +78,50 @@ private void createTimeseries() { public void testInsertWithoutTime() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg1.d1(s1, s2, s3) values (1, 1, '1')"); + statement.execute("insert into root.db1.d1(s1, s2, s3) values (1, 1, '1')"); Thread.sleep(1); - statement.execute("insert into root.sg1.d1(s2, s1, s3) values (2, 2, '2')"); + statement.execute("insert into root.db1.d1(s2, s1, s3) values (2, 2, '2')"); Thread.sleep(1); - statement.execute("insert into root.sg1.d1(s3, s2, s1) values ('3', 3, 3)"); + statement.execute("insert into root.db1.d1(s3, s2, s1) values ('3', 3, 3)"); Thread.sleep(1); - statement.execute("insert into root.sg1.d1(s1) values (1)"); - statement.execute("insert into root.sg1.d1(s2) values (2)"); - statement.execute("insert into root.sg1.d1(s3) values ('3')"); + statement.execute("insert into root.db1.d1(s1) values (1)"); + statement.execute("insert into root.db1.d1(s2) values (2)"); + statement.execute("insert into root.db1.d1(s3) values ('3')"); } catch (SQLException | InterruptedException e) { e.printStackTrace(); fail(e.getMessage()); } - String expectedHeader = "count(root.sg1.d1.s1),count(root.sg1.d1.s2),count(root.sg1.d1.s3),"; + String expectedHeader = "count(root.db1.d1.s1),count(root.db1.d1.s2),count(root.db1.d1.s3),"; String[] retArray = new String[] {"4,4,4,"}; resultSetEqualTest( - "select count(s1), count(s2), count(s3) from root.sg1.d1", expectedHeader, retArray); + "select count(s1), count(s2), count(s3) from root.db1.d1", expectedHeader, retArray); } @Test public void testInsertWithoutValueColumns() { assertNonQueryTestFail( - "insert into root.sg1.d1(time) values (1)", + "insert into root.db1.d1(time) values (1)", "InsertStatement should contain at least one measurement"); } @Test public void testInsertMultiRow() { assertNonQueryTestFail( - "insert into root.sg1.d1(s3) values ('1'), ('2')", + "insert into root.db1.d1(s3) values ('1'), ('2')", "need timestamps when insert multi rows"); assertNonQueryTestFail( - "insert into root.sg1.d1(s1, s2) values (1, 1), (2, 2)", + "insert into root.db1.d1(s1, s2) values (1, 1), (2, 2)", "need timestamps when insert multi rows"); } @Test public void testInsertWithMultiTimesColumns() { assertNonQueryTestFail( - "insert into root.sg1.d1(time, time) values (1, 1)", + "insert into root.db1.d1(time, time) values (1, 1)", "One row should only have one time value"); assertNonQueryTestFail( - "insert into root.sg1.d1(time, s1, time) values (1, 1, 1)", + "insert into root.db1.d1(time, s1, time) values (1, 1, 1)", "One row should only have one time value"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBJDBCMetadataIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBJDBCMetadataIT.java index 8e82865f8c220..01c01be0ff6db 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBJDBCMetadataIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBJDBCMetadataIT.java @@ -47,18 +47,18 @@ public class IoTDBJDBCMetadataIT { protected static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg_type;", - "CREATE TIMESERIES root.sg_type.d_0.s_boolean BOOLEAN;", - "CREATE TIMESERIES root.sg_type.d_0.s_int32 INT32;", - "CREATE TIMESERIES root.sg_type.d_0.s_int64 INT64;", - "CREATE TIMESERIES root.sg_type.d_0.s_float FLOAT;", - "CREATE TIMESERIES root.sg_type.d_0.s_double DOUBLE;", - "CREATE TIMESERIES root.sg_type.d_0.s_text TEXT;", - "CREATE TIMESERIES root.sg_type.d_0.s_timestamp TIMESTAMP;", - "CREATE TIMESERIES root.sg_type.d_0.s_date DATE;", - "CREATE TIMESERIES root.sg_type.d_0.s_blob BLOB;", - "CREATE TIMESERIES root.sg_type.d_0.s_string STRING;", - "INSERT INTO root.sg_type.d_0(time, s_int32, s_int64, s_float, s_double, s_text) VALUES (0, 0, 0, 0.000000, 0.000000, 'text0');" + "CREATE DATABASE root.db_type;", + "CREATE TIMESERIES root.db_type.d_0.s_boolean BOOLEAN;", + "CREATE TIMESERIES root.db_type.d_0.s_int32 INT32;", + "CREATE TIMESERIES root.db_type.d_0.s_int64 INT64;", + "CREATE TIMESERIES root.db_type.d_0.s_float FLOAT;", + "CREATE TIMESERIES root.db_type.d_0.s_double DOUBLE;", + "CREATE TIMESERIES root.db_type.d_0.s_text TEXT;", + "CREATE TIMESERIES root.db_type.d_0.s_timestamp TIMESTAMP;", + "CREATE TIMESERIES root.db_type.d_0.s_date DATE;", + "CREATE TIMESERIES root.db_type.d_0.s_blob BLOB;", + "CREATE TIMESERIES root.db_type.d_0.s_string STRING;", + "INSERT INTO root.db_type.d_0(time, s_int32, s_int64, s_float, s_double, s_text) VALUES (0, 0, 0, 0.000000, 0.000000, 'text0');" }; @BeforeClass @@ -113,14 +113,14 @@ public void testMetadata() throws Exception { }; String[] values = new String[] { - "0", "root.sg_type.d_0", null, "0", "0", "0.0", "0.0", "text0", null, null, null, null + "0", "root.db_type.d_0", null, "0", "0", "0.0", "0.0", "text0", null, null, null, null }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s_boolean, s_int32, s_int64, s_float, s_double, s_text, s_timestamp, s_date, s_blob, s_string from root.sg_type.d_0 align by device")) { + "select s_boolean, s_int32, s_int64, s_float, s_double, s_text, s_timestamp, s_date, s_blob, s_string from root.db_type.d_0 align by device")) { ResultSetMetaData metaData = resultSet.getMetaData(); assertEquals(columnNames.length, metaData.getColumnCount()); assertTrue(resultSet.next()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java index 706c175047ea0..2e3428cf9079e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadLastCacheIT.java @@ -583,11 +583,11 @@ private static class SchemaConfig { private static final String TABLE_DATABASE = "db"; private static final String TABLE_0 = "test"; - private static final String DATABASE_0 = "root.sg.test_0"; - private static final String DATABASE_1 = "root.sg.test_1"; + private static final String DATABASE_0 = "root.db.test_0"; + private static final String DATABASE_1 = "root.db.test_1"; // device 0, nonaligned, sg 0 - private static final String DEVICE_0 = "root.sg.test_0.d_0"; + private static final String DEVICE_0 = "root.db.test_0.d_0"; private static final MeasurementSchema MEASUREMENT_00 = new MeasurementSchema("sensor_00", TSDataType.INT32, TSEncoding.RLE); private static final MeasurementSchema MEASUREMENT_01 = @@ -606,7 +606,7 @@ private static class SchemaConfig { new MeasurementSchema("sensor_07", TSDataType.STRING, TSEncoding.PLAIN); // device 1, aligned, sg 0 - private static final String DEVICE_1 = "root.sg.test_0.a_1"; + private static final String DEVICE_1 = "root.db.test_0.a_1"; private static final MeasurementSchema MEASUREMENT_10 = new MeasurementSchema("sensor_10", TSDataType.INT32, TSEncoding.RLE); private static final MeasurementSchema MEASUREMENT_11 = @@ -625,17 +625,17 @@ private static class SchemaConfig { new MeasurementSchema("sensor_17", TSDataType.STRING, TSEncoding.PLAIN); // device 2, non aligned, sg 1 - private static final String DEVICE_2 = "root.sg.test_1.d_2"; + private static final String DEVICE_2 = "root.db.test_1.d_2"; private static final MeasurementSchema MEASUREMENT_20 = new MeasurementSchema("sensor_20", TSDataType.INT32, TSEncoding.RLE); // device 3, non aligned, sg 1 - private static final String DEVICE_3 = "root.sg.test_1.d_3"; + private static final String DEVICE_3 = "root.db.test_1.d_3"; private static final MeasurementSchema MEASUREMENT_30 = new MeasurementSchema("sensor_30", TSDataType.INT32, TSEncoding.RLE); // device 4, aligned, sg 1 - private static final String DEVICE_4 = "root.sg.test_1.a_4"; + private static final String DEVICE_4 = "root.db.test_1.a_4"; private static final MeasurementSchema MEASUREMENT_40 = new MeasurementSchema("sensor_40", TSDataType.INT32, TSEncoding.RLE); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadTsFileIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadTsFileIT.java index c54adb347117e..1b1ff5efab461 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadTsFileIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadTsFileIT.java @@ -241,11 +241,11 @@ public void testLoad() throws Exception { statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); + long sg1Count = resultSet.getLong("count(root.db.test_0.*.*)"); Assert.assertEquals(writtenPoint1, sg1Count); - long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); + long sg2Count = resultSet.getLong("count(root.db.test_1.*.*)"); Assert.assertEquals(writtenPoint2, sg2Count); } else { Assert.fail("This ResultSet is empty."); @@ -330,11 +330,11 @@ public void testLoadAcrossMultipleTimePartitions() throws Exception { statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); + long sg1Count = resultSet.getLong("count(root.db.test_0.*.*)"); Assert.assertEquals(writtenPoint1, sg1Count); - long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); + long sg2Count = resultSet.getLong("count(root.db.test_1.*.*)"); Assert.assertEquals(writtenPoint2, sg2Count); } else { Assert.fail("This ResultSet is empty."); @@ -378,17 +378,17 @@ public void testLoadWithExtendTemplate() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute("create database root.sg.test_0"); + statement.execute("create database root.db.test_0"); statement.execute( "create device template t1 (lat FLOAT encoding=Gorilla, lon FLOAT encoding=Gorilla)"); - statement.execute(" set device template t1 to root.sg.test_0.d_0"); + statement.execute(" set device template t1 to root.db.test_0.d_0"); statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); + final long sg1Count = resultSet.getLong("count(root.db.test_0.*.*)"); Assert.assertEquals(writtenPoint1, sg1Count); } else { Assert.fail("This ResultSet is empty."); @@ -476,11 +476,11 @@ public void testLoadWithAutoCreate() throws Exception { statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); + final long sg1Count = resultSet.getLong("count(root.db.test_0.*.*)"); Assert.assertEquals(writtenPoint1, sg1Count); - final long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); + final long sg2Count = resultSet.getLong("count(root.db.test_1.*.*)"); Assert.assertEquals(writtenPoint2, sg2Count); } else { Assert.fail("This ResultSet is empty."); @@ -493,7 +493,7 @@ public void testLoadWithAutoCreate() throws Exception { isAligned.put(SchemaConfig.DEVICE_2, "false"); isAligned.put(SchemaConfig.DEVICE_3, "false"); isAligned.put(SchemaConfig.DEVICE_4, "true"); - try (final ResultSet resultSet = statement.executeQuery("show devices root.sg.**")) { + try (final ResultSet resultSet = statement.executeQuery("show devices root.db.**")) { int size = 0; while (resultSet.next()) { size += 1; @@ -642,9 +642,9 @@ public void testLoadWithOnSuccess() throws Exception { file1.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); + final long sg1Count = resultSet.getLong("count(root.db.test_0.*.*)"); Assert.assertEquals(writtenPoint1, sg1Count); } else { Assert.fail("This ResultSet is empty."); @@ -662,11 +662,11 @@ public void testLoadWithOnSuccess() throws Exception { file2.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); + long sg1Count = resultSet.getLong("count(root.db.test_0.*.*)"); Assert.assertEquals(writtenPoint1, sg1Count); - long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); + long sg2Count = resultSet.getLong("count(root.db.test_1.*.*)"); Assert.assertEquals(writtenPoint2, sg2Count); } else { Assert.fail("This ResultSet is empty."); @@ -731,11 +731,11 @@ public void testLoadWithOnNonStandardTsFileName() throws Exception { statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); + final long sg1Count = resultSet.getLong("count(root.db.test_0.*.*)"); Assert.assertEquals(writtenPoint1, sg1Count); - final long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); + final long sg2Count = resultSet.getLong("count(root.db.test_1.*.*)"); Assert.assertEquals(writtenPoint2, sg2Count); } else { Assert.fail("This ResultSet is empty."); @@ -768,9 +768,9 @@ public void testLoadWithRelativePathName() throws Exception { statement.execute(String.format("load \"%s\" sglevel=2", "1-0-0-0.tsfile")); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); + final long sg1Count = resultSet.getLong("count(root.db.test_0.*.*)"); Assert.assertEquals(writtenPoint1, sg1Count); } else { Assert.fail("This ResultSet is empty."); @@ -851,11 +851,11 @@ public void testLoadWithMods() throws Exception { statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); + final long sg1Count = resultSet.getLong("count(root.db.test_0.*.*)"); Assert.assertEquals(writtenPoint1, sg1Count); - final long sg2Count = resultSet.getLong("count(root.sg.test_1.*.*)"); + final long sg2Count = resultSet.getLong("count(root.db.test_1.*.*)"); Assert.assertEquals(writtenPoint2, sg2Count); } else { Assert.fail("This ResultSet is empty."); @@ -863,7 +863,7 @@ public void testLoadWithMods() throws Exception { } TestUtils.assertSingleResultSetEqual( - TestUtils.executeQueryWithRetry(statement, "count timeSeries root.sg.**"), + TestUtils.executeQueryWithRetry(statement, "count timeSeries root.db.**"), Collections.singletonMap("count(timeseries)", "18")); } } @@ -877,7 +877,7 @@ public void testLoadWithEmptyTsFile() throws Exception { statement.execute(String.format("load \"%s\"", tmpDir.getAbsolutePath())); - try (final ResultSet resultSet = statement.executeQuery("show timeseries root.sg")) { + try (final ResultSet resultSet = statement.executeQuery("show timeseries root.db")) { Assert.assertFalse(resultSet.next()); } } @@ -945,9 +945,9 @@ public void testLoadLocally() throws Exception { statement.execute(String.format("load \"%s\" sglevel=2", tmpDir.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sg1Count = resultSet.getLong("count(root.sg.test_0.*.*)"); + final long sg1Count = resultSet.getLong("count(root.db.test_0.*.*)"); Assert.assertEquals(writtenPoint1, sg1Count); } else { Assert.fail("This ResultSet is empty."); @@ -989,9 +989,9 @@ public void testLoadWithConvertOnTypeMismatchForTreeModel() throws Exception { statement.execute(String.format("load \"%s\" ", file.getAbsolutePath())); try (final ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg.** group by level=1,2")) { + statement.executeQuery("select count(*) from root.db.** group by level=1,2")) { if (resultSet.next()) { - final long sgCount = resultSet.getLong("count(root.sg.test_0.*.*)"); + final long sgCount = resultSet.getLong("count(root.db.test_0.*.*)"); Assert.assertEquals(writtenPoint, sgCount); } else { Assert.fail("This ResultSet is empty."); @@ -1026,11 +1026,11 @@ public void testLoadWithConvertOnTypeMismatchForTreeModel() throws Exception { } private static class SchemaConfig { - private static final String DATABASE_0 = "root.sg.test_0"; - private static final String DATABASE_1 = "root.sg.test_1"; + private static final String DATABASE_0 = "root.db.test_0"; + private static final String DATABASE_1 = "root.db.test_1"; // device 0, nonaligned, sg 0 - private static final String DEVICE_0 = "root.sg.test_0.d_0"; + private static final String DEVICE_0 = "root.db.test_0.d_0"; private static final MeasurementSchema MEASUREMENT_00 = new MeasurementSchema("sensor_00", TSDataType.INT32, TSEncoding.RLE); private static final MeasurementSchema MEASUREMENT_01 = @@ -1049,7 +1049,7 @@ private static class SchemaConfig { new MeasurementSchema("sensor_07", TSDataType.STRING, TSEncoding.PLAIN); // device 1, aligned, sg 0 - private static final String DEVICE_1 = "root.sg.test_0.a_1"; + private static final String DEVICE_1 = "root.db.test_0.a_1"; private static final MeasurementSchema MEASUREMENT_10 = new MeasurementSchema("sensor_10", TSDataType.INT32, TSEncoding.RLE); private static final MeasurementSchema MEASUREMENT_11 = @@ -1068,17 +1068,17 @@ private static class SchemaConfig { new MeasurementSchema("sensor_17", TSDataType.STRING, TSEncoding.PLAIN); // device 2, non aligned, sg 1 - private static final String DEVICE_2 = "root.sg.test_1.d_2"; + private static final String DEVICE_2 = "root.db.test_1.d_2"; private static final MeasurementSchema MEASUREMENT_20 = new MeasurementSchema("sensor_20", TSDataType.INT32, TSEncoding.RLE); // device 3, non aligned, sg 1 - private static final String DEVICE_3 = "root.sg.test_1.d_3"; + private static final String DEVICE_3 = "root.db.test_1.d_3"; private static final MeasurementSchema MEASUREMENT_30 = new MeasurementSchema("sensor_30", TSDataType.INT32, TSEncoding.RLE); // device 4, aligned, sg 1 - private static final String DEVICE_4 = "root.sg.test_1.a_4"; + private static final String DEVICE_4 = "root.db.test_1.a_4"; private static final MeasurementSchema MEASUREMENT_40 = new MeasurementSchema("sensor_40", TSDataType.INT32, TSEncoding.RLE); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBPartialInsertionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBPartialInsertionIT.java index 18f805d1354fd..c608e08b8e71d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBPartialInsertionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBPartialInsertionIT.java @@ -75,13 +75,13 @@ public void testPartialInsertionAllFailed() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); try { - statement.execute("INSERT INTO root.sg1(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1(timestamp, s0) VALUES (1, 1)"); fail(); } catch (SQLException e) { - assertTrue(e.getMessage().contains("Path [root.sg1.s0] does not exist")); + assertTrue(e.getMessage().contains("Path [root.db1.s0] does not exist")); } } } @@ -91,12 +91,12 @@ public void testPartialInsertionRestart() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 datatype=text"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 datatype=double"); + statement.execute("CREATE DATABASE root.db"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 datatype=text"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 datatype=double"); try { - statement.execute("INSERT INTO root.sg.d1(time,s1,s2) VALUES(100,'test','test')"); + statement.execute("INSERT INTO root.db.d1(time,s1,s2) VALUES(100,'test','test')"); } catch (SQLException e) { // ignore } @@ -124,16 +124,16 @@ public void testPartialInsertionRestart() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db.d1")) { assertNotNull(resultSet); int cnt = 0; while (resultSet.next()) { cnt++; - assertEquals("test", resultSet.getString("root.sg.d1.s1")); + assertEquals("test", resultSet.getString("root.db.d1.s1")); } assertEquals(1, cnt); } - try (ResultSet resultSet = statement.executeQuery("SELECT s2 FROM root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s2 FROM root.db.d1")) { assertNotNull(resultSet); assertFalse(resultSet.next()); } @@ -144,14 +144,14 @@ public void testPartialInsertionRestart() throws SQLException { public void testPartialInsertTablet() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { session.createTimeseries( - "root.sg1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.d1.s2", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.d1.s2", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s3", TSDataType.INT64)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList, 300); + Tablet tablet = new Tablet("root.db1.d1", schemaList, 300); long timestamp = 0; for (long row = 0; row < 100; row++) { int rowIndex = tablet.getRowSize(); @@ -179,11 +179,11 @@ public void testPartialInsertTablet() { fail(e.getMessage()); } } - try (SessionDataSet dataSet = session.executeQueryStatement("SELECT * FROM root.sg1.d1")) { + try (SessionDataSet dataSet = session.executeQueryStatement("SELECT * FROM root.db1.d1")) { assertEquals(dataSet.getColumnNames().size(), 3); assertEquals(dataSet.getColumnNames().get(0), "Time"); - assertEquals(dataSet.getColumnNames().get(1), "root.sg1.d1.s1"); - assertEquals(dataSet.getColumnNames().get(2), "root.sg1.d1.s2"); + assertEquals(dataSet.getColumnNames().get(1), "root.db1.d1.s1"); + assertEquals(dataSet.getColumnNames().get(2), "root.db1.d1.s2"); int cnt = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBQueryWithRecreatedTimeseriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBQueryWithRecreatedTimeseriesIT.java index 5472fabec5e10..d6126135dcb76 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBQueryWithRecreatedTimeseriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBQueryWithRecreatedTimeseriesIT.java @@ -53,23 +53,23 @@ public static void tearDown() throws Exception { public void testQueryDiffTypeTimeseries() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); + statement.execute("CREATE DATABASE root.db"); Thread.sleep(100); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES(11000, 10, 20)"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES(11000, 10, 20)"); Thread.sleep(100); statement.execute("FLUSH"); Thread.sleep(100); - statement.execute("DELETE TIMESERIES root.sg.d1.s1"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("DELETE TIMESERIES root.db.d1.s1"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=INT32,encoding=PLAIN"); try (ResultSet resultSet = - statement.executeQuery("SELECT s1 FROM root.sg.d1 WHERE s1 > 10")) { + statement.executeQuery("SELECT s1 FROM root.db.d1 WHERE s1 > 10")) { Assert.assertFalse(resultSet.next()); } try (ResultSet resultSet = - statement.executeQuery("SELECT s1 FROM root.sg.d1 WHERE s1 <= 10")) { + statement.executeQuery("SELECT s1 FROM root.db.d1 WHERE s1 <= 10")) { Assert.assertFalse(resultSet.next()); } } catch (Exception e) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java index d84a2493cc25e..58b4923ec239b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java @@ -272,7 +272,7 @@ public void rightInsertTablet(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/insertTablet"); String json = - "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.sg25\"}"; + "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":false,\"deviceId\":\"root.db25\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -338,7 +338,7 @@ public void errorInsertTablet() { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/insertTablet"); String json = - "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"isAligned\":false,\"deviceId\":\"root.sg25\"}"; + "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"isAligned\":false,\"deviceId\":\"root.db25\"}"; httpPost.setEntity(new StringEntity(json, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -452,13 +452,13 @@ public void insertAndQuery() { insertTablet_right_json_list.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":\"" + isAligned - + "\",\"deviceId\":\"root.sg21" + + "\",\"deviceId\":\"root.db21" + i + "\"}"); insertTablet_right_json_list.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"`s3`\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"isAligned\":\"" + isAligned - + "\",\"deviceId\":\"root.sg22" + + "\",\"deviceId\":\"root.db22" + i + "\"}"); insertTablet_right_json_list.add( @@ -476,13 +476,13 @@ public void insertAndQuery() { insertTablet_error_json_list.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"isAligned\":" + isAligned - + ",\"deviceId\":\"root.sg25" + + ",\"deviceId\":\"root.db25" + i + "\"}"); insertTablet_error_json_list.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"`s3`\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"dataTypes\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"isAligned\":" + isAligned - + ",\"deviceId\":\"root.sg36" + + ",\"deviceId\":\"root.db36" + i + "\"}"); insertTablet_error_json_list.add( @@ -546,13 +546,13 @@ public void insertAndQuery() { insertTablet_right_json_list_v2.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"data_types\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"is_aligned\":\"" + isAligned - + "\",\"device\":\"root.sg21" + + "\",\"device\":\"root.db21" + i + "\"}"); insertTablet_right_json_list_v2.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"`s3`\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"data_types\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[11,2],[1635000012345555,1635000012345556],[1.41,null],[null,false],[null,3.5555]],\"is_aligned\":" + isAligned - + ",\"device\":\"root.sg22" + + ",\"device\":\"root.db22" + i + "\"}"); insertTablet_right_json_list_v2.add( @@ -570,13 +570,13 @@ public void insertAndQuery() { insertTablet_error_json_list_v2.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"data_types\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"is_aligned\":" + isAligned - + ",\"device\":\"root.sg25" + + ",\"device\":\"root.db25" + i + "\"}"); insertTablet_error_json_list_v2.add( "{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"`s3`\",\"s4\",\"s5\",\"s6\",\"s7\",\"s8\"],\"data_types\":[\"TEXT\",\"INT32\",\"INT64\",\"FLOAT\",\"BOOLEAN\",\"DOUBLE\"],\"values\":[[\"2aa\",\"\"],[111111112312312442352545452323123,2],[16,15],[1.41,null],[null,false],[null,3.55555555555555555555555555555555555555555555312234235345123127318927461482308478123645555555555555555555555555555555555555555555531223423534512312731892746148230847812364]],\"is_aligned\":" + isAligned - + ",\"device\":\"root.sg26" + + ",\"device\":\"root.db26" + i + "\"}"); insertTablet_error_json_list_v2.add( @@ -734,7 +734,7 @@ public void queryWithUnsetAuthorization() { HttpPost httpPost = new HttpPost("http://127.0.0.1:" + port + "/rest/v1/query"); httpPost.addHeader("Content-type", "application/json; charset=utf-8"); httpPost.setHeader("Accept", "application/json"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -781,7 +781,7 @@ public void queryWithWrongAuthorization() { httpPost.setHeader("Accept", "application/json"); String authorization = getAuthorization("abc", "def"); httpPost.setHeader("Authorization", authorization); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); for (int i = 0; i < 30; i++) { try { @@ -822,7 +822,7 @@ public void query(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -836,14 +836,14 @@ public void query(CloseableHttpClient httpClient) { List expressions = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); - add("root.sg25.s4 + 1"); - add("root.sg25.s4 + 1"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); + add("root.db25.s4 + 1"); + add("root.db25.s4 + 1"); } }; List timestamps = @@ -925,7 +925,7 @@ public void queryGroupByLevel(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/query"); String sql = - "{\"sql\":\"select count(s4) from root.sg25 group by([1635232143960,1635232153960),1s),level=1\"}"; + "{\"sql\":\"select count(s4) from root.db25 group by([1635232143960,1635232153960),1s),level=1\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -938,7 +938,7 @@ public void queryGroupByLevel(CloseableHttpClient httpClient) { Assert.assertTrue(map.size() > 0); Assert.assertTrue(timestampsResult.size() == 10); Assert.assertTrue(valuesResult.size() == 1); - Assert.assertTrue("count(root.sg25.s4)".equals(expressionsResult.get(0))); + Assert.assertTrue("count(root.db25.s4)".equals(expressionsResult.get(0))); } catch (IOException e) { e.printStackTrace(); fail(e.getMessage()); @@ -958,7 +958,7 @@ public void queryRowLimit(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\",\"rowLimit\":1}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\",\"rowLimit\":1}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -1008,7 +1008,7 @@ public Map queryMetaData(CloseableHttpClient httpClient, String sql) { } public void queryShowChildPaths(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show child paths root.sg25\"}"; + String sql = "{\"sql\":\"show child paths root.db25\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1023,12 +1023,12 @@ public void queryShowChildPaths(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); } }; @@ -1037,7 +1037,7 @@ public void queryShowChildPaths(CloseableHttpClient httpClient) { } public void queryShowNodes(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show child nodes root.sg25\"}"; + String sql = "{\"sql\":\"show child nodes root.db25\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1095,7 +1095,7 @@ public void showAllTTL(CloseableHttpClient httpClient) { } public void showDatabase(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"SHOW DATABASES root.sg25\"}"; + String sql = "{\"sql\":\"SHOW DATABASES root.db25\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1113,7 +1113,7 @@ public void showDatabase(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; Assert.assertEquals(columnNames, columnNamesResult); @@ -1130,7 +1130,7 @@ public void showFunctions(CloseableHttpClient httpClient) { } public void showTimeseries(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show timeseries root.sg25.**\"}"; + String sql = "{\"sql\":\"show timeseries root.db25.**\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1154,12 +1154,12 @@ public void showTimeseries(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); } }; List values2 = @@ -1176,12 +1176,12 @@ public void showTimeseries(CloseableHttpClient httpClient) { List values3 = new ArrayList() { { - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); } }; @@ -1192,7 +1192,7 @@ public void showTimeseries(CloseableHttpClient httpClient) { } public void showLastTimeseries(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"SHOW LATEST TIMESERIES root.sg25.**\"}"; + String sql = "{\"sql\":\"SHOW LATEST TIMESERIES root.db25.**\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1216,12 +1216,12 @@ public void showLastTimeseries(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s7"); - add("root.sg25.s8"); - add("root.sg25.s6"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s7"); + add("root.db25.s8"); + add("root.db25.s6"); } }; List values2 = @@ -1238,12 +1238,12 @@ public void showLastTimeseries(CloseableHttpClient httpClient) { List values3 = new ArrayList() { { - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); } }; @@ -1254,7 +1254,7 @@ public void showLastTimeseries(CloseableHttpClient httpClient) { } public void countTimeseries(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"COUNT TIMESERIES root.sg25.** GROUP BY LEVEL=1\"}"; + String sql = "{\"sql\":\"COUNT TIMESERIES root.db25.** GROUP BY LEVEL=1\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1269,7 +1269,7 @@ public void countTimeseries(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = @@ -1285,7 +1285,7 @@ public void countTimeseries(CloseableHttpClient httpClient) { } public void countNodes(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"count nodes root.sg25.** level=2\"}"; + String sql = "{\"sql\":\"count nodes root.db25.** level=2\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1307,7 +1307,7 @@ public void countNodes(CloseableHttpClient httpClient) { } public void showDevices(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show devices root.sg25\"}"; + String sql = "{\"sql\":\"show devices root.db25\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("columnNames"); List> valuesResult = (List>) map.get("values"); @@ -1324,7 +1324,7 @@ public void showDevices(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = @@ -1362,13 +1362,13 @@ public void showDevicesWithStroage(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values3 = @@ -1414,7 +1414,7 @@ public void listUser(CloseableHttpClient httpClient) { } public void selectCount(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"select count(s3) from root.sg25 group by level = 1\"}"; + String sql = "{\"sql\":\"select count(s3) from root.db25 group by level = 1\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("expressions"); List> valuesResult = (List>) map.get("values"); @@ -1422,7 +1422,7 @@ public void selectCount(CloseableHttpClient httpClient) { List columnNames = new ArrayList() { { - add("count(root.sg25.s3)"); + add("count(root.db25.s3)"); } }; List values1 = @@ -1436,7 +1436,7 @@ public void selectCount(CloseableHttpClient httpClient) { } public void selectLast(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"select last s4 from root.sg25\"}"; + String sql = "{\"sql\":\"select last s4 from root.db25\"}"; Map map = queryMetaData(httpClient, sql); List columnNamesResult = (List) map.get("expressions"); List> valuesResult = (List>) map.get("values"); @@ -1459,7 +1459,7 @@ public void selectLast(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s4"); + add("root.db25.s4"); } }; List values2 = @@ -1485,7 +1485,7 @@ public void queryV2(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v2/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\"}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -1499,14 +1499,14 @@ public void queryV2(CloseableHttpClient httpClient) { List expressions = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); - add("root.sg25.s4 + 1"); - add("root.sg25.s4 + 1"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); + add("root.db25.s4 + 1"); + add("root.db25.s4 + 1"); } }; List timestamps = @@ -1588,7 +1588,7 @@ public void queryGroupByLevelV2(CloseableHttpClient httpClient) { try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v2/query"); String sql = - "{\"sql\":\"select count(s4) from root.sg25 group by([1635232143960,1635232153960),1s),level=1\"}"; + "{\"sql\":\"select count(s4) from root.db25 group by([1635232143960,1635232153960),1s),level=1\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -1601,7 +1601,7 @@ public void queryGroupByLevelV2(CloseableHttpClient httpClient) { Assert.assertTrue(map.size() > 0); Assert.assertTrue(timestampsResult.size() == 10); Assert.assertTrue(valuesResult.size() == 1); - Assert.assertTrue("count(root.sg25.s4)".equals(expressionsResult.get(0))); + Assert.assertTrue("count(root.db25.s4)".equals(expressionsResult.get(0))); } catch (IOException e) { e.printStackTrace(); fail(e.getMessage()); @@ -1621,7 +1621,7 @@ public void queryRowLimitV2(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v2/query"); - String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.sg25\",\"row_limit\":1}"; + String sql = "{\"sql\":\"select *,s4+1,s4+1 from root.db25\",\"row_limit\":1}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -1671,7 +1671,7 @@ public Map queryMetaDataV2(CloseableHttpClient httpClient, String sql) { } public void queryShowChildPathsV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show child paths root.sg25\"}"; + String sql = "{\"sql\":\"show child paths root.db25\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1686,12 +1686,12 @@ public void queryShowChildPathsV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); } }; @@ -1700,7 +1700,7 @@ public void queryShowChildPathsV2(CloseableHttpClient httpClient) { } public void queryShowNodesV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show child nodes root.sg25\"}"; + String sql = "{\"sql\":\"show child nodes root.db25\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1758,7 +1758,7 @@ public void showAllTTLV2(CloseableHttpClient httpClient) { } public void showDatabaseV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"SHOW DATABASES root.sg25\"}"; + String sql = "{\"sql\":\"SHOW DATABASES root.db25\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1776,7 +1776,7 @@ public void showDatabaseV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; Assert.assertEquals(columnNames, columnNamesResult); @@ -1817,12 +1817,12 @@ public void showTimeseriesV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s6"); - add("root.sg25.s7"); - add("root.sg25.s8"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s6"); + add("root.db25.s7"); + add("root.db25.s8"); } }; List values2 = @@ -1839,12 +1839,12 @@ public void showTimeseriesV2(CloseableHttpClient httpClient) { List values3 = new ArrayList() { { - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); } }; @@ -1855,7 +1855,7 @@ public void showTimeseriesV2(CloseableHttpClient httpClient) { } public void showLastTimeseriesV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"SHOW LATEST TIMESERIES root.sg25.**\"}"; + String sql = "{\"sql\":\"SHOW LATEST TIMESERIES root.db25.**\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1879,12 +1879,12 @@ public void showLastTimeseriesV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s3"); - add("root.sg25.s4"); - add("root.sg25.s5"); - add("root.sg25.s7"); - add("root.sg25.s8"); - add("root.sg25.s6"); + add("root.db25.s3"); + add("root.db25.s4"); + add("root.db25.s5"); + add("root.db25.s7"); + add("root.db25.s8"); + add("root.db25.s6"); } }; List values2 = @@ -1901,12 +1901,12 @@ public void showLastTimeseriesV2(CloseableHttpClient httpClient) { List values3 = new ArrayList() { { - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); - add("root.sg25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); + add("root.db25"); } }; @@ -1917,7 +1917,7 @@ public void showLastTimeseriesV2(CloseableHttpClient httpClient) { } public void countTimeseriesV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"COUNT TIMESERIES root.sg25.** GROUP BY LEVEL=1\"}"; + String sql = "{\"sql\":\"COUNT TIMESERIES root.db25.** GROUP BY LEVEL=1\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1932,7 +1932,7 @@ public void countTimeseriesV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = @@ -1948,7 +1948,7 @@ public void countTimeseriesV2(CloseableHttpClient httpClient) { } public void countNodesV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"count nodes root.sg25.** level=2\"}"; + String sql = "{\"sql\":\"count nodes root.db25.** level=2\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1970,7 +1970,7 @@ public void countNodesV2(CloseableHttpClient httpClient) { } public void showDevicesV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"show devices root.sg25\"}"; + String sql = "{\"sql\":\"show devices root.db25\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("column_names"); List> valuesResult = (List>) map.get("values"); @@ -1987,7 +1987,7 @@ public void showDevicesV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = @@ -2026,13 +2026,13 @@ public void showDevicesWithStroageV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values2 = new ArrayList() { { - add("root.sg25"); + add("root.db25"); } }; List values3 = @@ -2078,7 +2078,7 @@ public void listUserV2(CloseableHttpClient httpClient) { } public void selectCountV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"select count(s3) from root.sg25 group by level = 1\"}"; + String sql = "{\"sql\":\"select count(s3) from root.db25 group by level = 1\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("expressions"); List> valuesResult = (List>) map.get("values"); @@ -2086,7 +2086,7 @@ public void selectCountV2(CloseableHttpClient httpClient) { List columnNames = new ArrayList() { { - add("count(root.sg25.s3)"); + add("count(root.db25.s3)"); } }; List values1 = @@ -2100,7 +2100,7 @@ public void selectCountV2(CloseableHttpClient httpClient) { } public void selectLastV2(CloseableHttpClient httpClient) { - String sql = "{\"sql\":\"select last s4 from root.sg25\"}"; + String sql = "{\"sql\":\"select last s4 from root.db25\"}"; Map map = queryMetaDataV2(httpClient, sql); List columnNamesResult = (List) map.get("expressions"); List> valuesResult = (List>) map.get("values"); @@ -2123,7 +2123,7 @@ public void selectLastV2(CloseableHttpClient httpClient) { List values1 = new ArrayList() { { - add("root.sg25.s4"); + add("root.db25.s4"); } }; List values2 = @@ -2151,15 +2151,15 @@ public void insertDate() { HttpPost httpPostV2 = getHttpPost("http://127.0.0.1:" + port + "/rest/v2/nonQuery"); nonQuery( httpClient, - "{\"sql\":\"CREATE TIMESERIES root.sg1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY\"}", + "{\"sql\":\"CREATE TIMESERIES root.db1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY\"}", httpPost2); nonQuery( httpClient, - "{\"sql\":\"CREATE TIMESERIES root.sg1.d1.s5 WITH DATATYPE=Blob, ENCODING=PLAIN, COMPRESSOR=SNAPPY\"}", + "{\"sql\":\"CREATE TIMESERIES root.db1.d1.s5 WITH DATATYPE=Blob, ENCODING=PLAIN, COMPRESSOR=SNAPPY\"}", httpPost2); String sql = - "{\"sql\":\"insert into root.sg1.d1(time,s4,s5) values(1,'2025-07-14',\\\"X'cafebabe'\\\")\"}"; + "{\"sql\":\"insert into root.db1.d1(time,s4,s5) values(1,'2025-07-14',\\\"X'cafebabe'\\\")\"}"; nonQuery(httpClient, sql, httpPost2); queryDateAndBlob(httpClient); queryDateAndBlobV2(httpClient); @@ -2169,7 +2169,7 @@ public void queryDateAndBlob(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/query"); - String sql = "{\"sql\":\"select s4,s5 from root.sg1.d1\"}"; + String sql = "{\"sql\":\"select s4,s5 from root.db1.d1\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -2183,8 +2183,8 @@ public void queryDateAndBlob(CloseableHttpClient httpClient) { List expressions = new ArrayList() { { - add("root.sg1.d1.s4"); - add("root.sg1.d1.s5"); + add("root.db1.d1.s4"); + add("root.db1.d1.s5"); } }; List timestamps = @@ -2230,7 +2230,7 @@ public void queryDateAndBlobV2(CloseableHttpClient httpClient) { CloseableHttpResponse response = null; try { HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v2/query"); - String sql = "{\"sql\":\"select s4,s5 from root.sg1.d1\"}"; + String sql = "{\"sql\":\"select s4,s5 from root.db1.d1\"}"; httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset())); response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); @@ -2244,8 +2244,8 @@ public void queryDateAndBlobV2(CloseableHttpClient httpClient) { List expressions = new ArrayList() { { - add("root.sg1.d1.s4"); - add("root.sg1.d1.s5"); + add("root.db1.d1.s4"); + add("root.db1.d1.s5"); } }; List timestamps = diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java index 571826307c667..e5d5d3cdea9e0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestartIT.java @@ -383,8 +383,8 @@ public void testRecoverFromFlushMemTableError() throws Exception { public void testInsertLoadAndRecover() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("create timeseries root.sg.d1.s1 with datatype=int32"); - statement.execute("insert into root.sg.d1(time,s1) values(2,2)"); + statement.execute("create timeseries root.db.d1.s1 with datatype=int32"); + statement.execute("insert into root.db.d1(time,s1) values(2,2)"); statement.execute("flush"); } File tmpDir = new File(Files.createTempDirectory("load").toUri()); @@ -392,14 +392,14 @@ public void testInsertLoadAndRecover() throws Exception { try { try (final TsFileGenerator generator = new TsFileGenerator(tsfile)) { generator.registerTimeseries( - "root.sg.d1", Collections.singletonList(new MeasurementSchema("s1", TSDataType.INT32))); - generator.generateData("root.sg.d1", 1, 2, false); + "root.db.d1", Collections.singletonList(new MeasurementSchema("s1", TSDataType.INT32))); + generator.generateData("root.db.d1", 1, 2, false); } try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time,s1) values(1,1)"); + statement.execute("insert into root.db.d1(time,s1) values(1,1)"); statement.execute(String.format("load \"%s\" ", tsfile.getAbsolutePath())); - try (ResultSet resultSet = statement.executeQuery("select s1 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from root.db.d1")) { assertNotNull(resultSet); int cnt = 0; while (resultSet.next()) { @@ -415,7 +415,7 @@ public void testInsertLoadAndRecover() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select s1 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from root.db.d1")) { assertNotNull(resultSet); int cnt = 0; while (resultSet.next()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java index c56c0077f29e2..3d57a5ee06b78 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java @@ -72,10 +72,10 @@ public void testCreateTimeseries1() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.d0.s1")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db1.d0.s1")) { if (resultSet.next()) { assertEquals("PLAIN", resultSet.getString(ColumnHeaderConstant.ENCODING).toUpperCase()); } @@ -91,20 +91,20 @@ public void testFailedToCreateTimeseriesSDTProperties() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); try { statement.execute( - "CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,'LOSS'='SDT','COMPDEV'='-2'"); + "CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,'LOSS'='SDT','COMPDEV'='-2'"); fail(); } catch (Exception e) { assertEquals( TSStatusCode.ILLEGAL_PARAMETER.getStatusCode() - + ": SDT compression deviation cannot be negative. Failed to create timeseries for path root.sg1.d0.s1", + + ": SDT compression deviation cannot be negative. Failed to create timeseries for path root.db1.d0.s1", e.getMessage()); } int count = 0; - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db1.**")) { while (resultSet.next()) { count++; } @@ -159,21 +159,21 @@ public void testSDTEncodingSeq() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); int degree = 0; for (int time = 0; time < 100; time++) { // generate data in sine wave pattern double value = 10 * Math.sin(degree++ * 3.141592653589793D / 180.0D); - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + "," + value + ")"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + "," + value + ")"; statement.execute(sql); } // before SDT encoding - ResultSet resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + ResultSet resultSet = statement.executeQuery("select s0 from root.db1.d0"); int count = 0; while (resultSet.next()) { count++; @@ -182,7 +182,7 @@ public void testSDTEncodingSeq() { // after flush and SDT encoding statement.execute("flush"); - resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + resultSet = statement.executeQuery("select s0 from root.db1.d0"); count = 0; while (resultSet.next()) { count++; @@ -200,28 +200,28 @@ public void testSDTEncodingCompDev() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2"); for (int time = 1; time < 8; time++) { - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + ",1)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + ",1)"; statement.execute(sql); } statement.execute("flush"); - String sql = "insert into root.sg1.d0(timestamp,s0) values(15,10)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(15,10)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(16,20)"; + sql = "insert into root.db1.d0(timestamp,s0) values(16,20)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(17,1)"; + sql = "insert into root.db1.d0(timestamp,s0) values(17,1)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(18,30)"; + sql = "insert into root.db1.d0(timestamp,s0) values(18,30)"; statement.execute(sql); statement.execute("flush"); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.**"); + ResultSet resultSet = statement.executeQuery("select * from root.db1.**"); int count = 0; String[] timestamps = {"1", "7", "15", "16", "17", "18"}; @@ -229,7 +229,7 @@ public void testSDTEncodingCompDev() { while (resultSet.next()) { assertEquals(timestamps[count], resultSet.getString("Time")); - assertEquals(values[count], resultSet.getString("root.sg1.d0.s0")); + assertEquals(values[count], resultSet.getString("root.db1.d0.s0")); count++; } } catch (SQLException e) { @@ -243,28 +243,28 @@ public void testSDTEncodingCompMin() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMINTIME=1"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMINTIME=1"); for (int time = 1; time < 8; time++) { - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + ",1)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + ",1)"; statement.execute(sql); } statement.execute("flush"); - String sql = "insert into root.sg1.d0(timestamp,s0) values(15,10)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(15,10)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(16,20)"; + sql = "insert into root.db1.d0(timestamp,s0) values(16,20)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(17,1)"; + sql = "insert into root.db1.d0(timestamp,s0) values(17,1)"; statement.execute(sql); - sql = "insert into root.sg1.d0(timestamp,s0) values(18,30)"; + sql = "insert into root.db1.d0(timestamp,s0) values(18,30)"; statement.execute(sql); statement.execute("flush"); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.**"); + ResultSet resultSet = statement.executeQuery("select * from root.db1.**"); int count = 0; // will not store time = 16 since time distance to last stored time 15 is within compMinTime @@ -273,7 +273,7 @@ public void testSDTEncodingCompMin() { while (resultSet.next()) { assertEquals(timestamps[count], resultSet.getString("Time")); - assertEquals(values[count], resultSet.getString("root.sg1.d0.s0")); + assertEquals(values[count], resultSet.getString("root.db1.d0.s0")); count++; } } catch (SQLException e) { @@ -287,18 +287,18 @@ public void testSDTEncodingCompMax() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMAXTIME=20"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2, COMPMAXTIME=20"); for (int time = 1; time < 50; time++) { - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + ",1)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + ",1)"; statement.execute(sql); } statement.execute("flush"); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.**"); + ResultSet resultSet = statement.executeQuery("select * from root.db1.**"); int count = 0; String[] timestamps = {"1", "21", "41", "49"}; @@ -306,7 +306,7 @@ public void testSDTEncodingCompMax() { while (resultSet.next()) { assertEquals(timestamps[count], resultSet.getString("Time")); - assertEquals(values[count], resultSet.getString("root.sg1.d0.s0")); + assertEquals(values[count], resultSet.getString("root.db1.d0.s0")); count++; } } catch (SQLException e) { @@ -320,25 +320,25 @@ public void testSDTEncodingUnseq() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); int degree = 0; for (int time = 0; time < 100; time++) { // generate data in sine wave pattern double value = 10 * Math.sin(degree++ * 3.141592653589793D / 180.0D); - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + "," + value + ")"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + "," + value + ")"; statement.execute(sql); } // insert unseq - String sql = "insert into root.sg1.d0(timestamp,s0) values(2,19)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(2,19)"; statement.execute(sql); // before SDT encoding - ResultSet resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + ResultSet resultSet = statement.executeQuery("select s0 from root.db1.d0"); int count = 0; while (resultSet.next()) { count++; @@ -347,7 +347,7 @@ public void testSDTEncodingUnseq() { // after flush and SDT encoding statement.execute("flush"); - resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + resultSet = statement.executeQuery("select s0 from root.db1.d0"); count = 0; while (resultSet.next()) { count++; @@ -365,21 +365,21 @@ public void testSDTEncodingMergeSeq() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); int degree = 0; for (int time = 0; time < 100; time++) { // generate data in sine wave pattern double value = 10 * Math.sin(degree++ * 3.141592653589793D / 180.0D); - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + "," + value + ")"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + "," + value + ")"; statement.execute(sql); } // before SDT encoding - ResultSet resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + ResultSet resultSet = statement.executeQuery("select s0 from root.db1.d0"); int count = 0; while (resultSet.next()) { count++; @@ -388,7 +388,7 @@ public void testSDTEncodingMergeSeq() { // after flush and SDT encoding statement.execute("flush"); - resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + resultSet = statement.executeQuery("select s0 from root.db1.d0"); count = 0; while (resultSet.next()) { count++; @@ -405,25 +405,25 @@ public void testSDTEncodingMergeUnseq() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); // test set sdt property statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=DOUBLE,ENCODING=PLAIN,LOSS=SDT,COMPDEV=0.01"); int degree = 0; for (int time = 0; time < 100; time++) { // generate data in sine wave pattern double value = 10 * Math.sin(degree++ * 3.141592653589793D / 180.0D); - String sql = "insert into root.sg1.d0(timestamp,s0) values(" + time + "," + value + ")"; + String sql = "insert into root.db1.d0(timestamp,s0) values(" + time + "," + value + ")"; statement.execute(sql); } // insert unseq - String sql = "insert into root.sg1.d0(timestamp,s0) values(2,19)"; + String sql = "insert into root.db1.d0(timestamp,s0) values(2,19)"; statement.execute(sql); // before SDT encoding - ResultSet resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + ResultSet resultSet = statement.executeQuery("select s0 from root.db1.d0"); int count = 0; while (resultSet.next()) { count++; @@ -432,7 +432,7 @@ public void testSDTEncodingMergeUnseq() { // after flush and SDT encoding statement.execute("flush"); - resultSet = statement.executeQuery("select s0 from root.sg1.d0"); + resultSet = statement.executeQuery("select s0 from root.db1.d0"); count = 0; while (resultSet.next()) { count++; @@ -449,7 +449,7 @@ public void testEmptyDataSet() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - ResultSet resultSet = statement.executeQuery("select * from root.sg1.**"); + ResultSet resultSet = statement.executeQuery("select * from root.db1.**"); // has an empty time column Assert.assertEquals(1, resultSet.getMetaData().getColumnCount()); try { @@ -473,7 +473,7 @@ public void testEmptyDataSet() throws SQLException { fail(); } - resultSet = statement.executeQuery("select * from root.sg1.** align by device"); + resultSet = statement.executeQuery("select * from root.db1.** align by device"); // has time and device columns Assert.assertEquals(1, resultSet.getMetaData().getColumnCount()); while (resultSet.next()) { @@ -509,15 +509,15 @@ public void testOrderByTimeDesc() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (2, 2)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (3, 3)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (4, 4)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (3, 3)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (1, 1)"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (2, 2)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (3, 3)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (4, 4)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (3, 3)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (1, 1)"); statement.execute("flush"); String[] ret = @@ -527,14 +527,14 @@ public void testOrderByTimeDesc() throws Exception { int cur = 0; try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.** order by time desc")) { + statement.executeQuery("select * from root.db1.** order by time desc")) { while (resultSet.next()) { String ans = resultSet.getString(ColumnHeaderConstant.TIME) + "," - + resultSet.getString("root.sg1.d0.s0") + + resultSet.getString("root.db1.d0.s0") + "," - + resultSet.getString("root.sg1.d0.s1"); + + resultSet.getString("root.db1.d0.s1"); assertEquals(ret[cur], ans); cur++; } @@ -547,22 +547,22 @@ public void testShowTimeseriesDataSet1() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); int count = 0; - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db1.**")) { while (resultSet.next()) { count++; } @@ -580,22 +580,22 @@ public void testShowTimeseriesDataSet2() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(10); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); int count = 0; - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db1.**")) { while (resultSet.next()) { count++; } @@ -613,22 +613,22 @@ public void testShowTimeseriesDataSet3() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(15); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); int count = 0; - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db1.**")) { while (resultSet.next()) { count++; } @@ -646,17 +646,17 @@ public void testShowTimeseriesDataSet4() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); @@ -680,12 +680,12 @@ public void testShowTimeseriesWithLimitOffset() throws SQLException { Statement statement = connection.createStatement()) { List exps = - Arrays.asList("root.sg1.d0.s1", "root.sg1.d0.s2", "root.sg1.d0.s3", "root.sg1.d0.s4"); + Arrays.asList("root.db1.d0.s1", "root.db1.d0.s2", "root.db1.d0.s3", "root.db1.d0.s4"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s2) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s3) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s4) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s2) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s3) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s4) VALUES (5, 5)"); int count = 0; try (ResultSet resultSet = statement.executeQuery("show timeseries limit 2 offset 1")) { @@ -703,12 +703,12 @@ public void testShowDevicesWithLimitOffset() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - List exps = Arrays.asList("root.sg1.d1,false", "root.sg1.d2,false"); + List exps = Arrays.asList("root.db1.d1,false", "root.db1.d2,false"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d1(timestamp, s2) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d2(timestamp, s3) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d3(timestamp, s4) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d1(timestamp, s2) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d2(timestamp, s3) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d3(timestamp, s4) VALUES (5, 5)"); int count = 0; try (ResultSet resultSet = statement.executeQuery("show devices limit 2 offset 1")) { @@ -727,12 +727,12 @@ public void testShowDevicesWithLimit() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - List exps = Arrays.asList("root.sg1.d0,false", "root.sg1.d1,false"); + List exps = Arrays.asList("root.db1.d0,false", "root.db1.d1,false"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d1(timestamp, s2) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d2(timestamp, s3) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d3(timestamp, s4) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d1(timestamp, s2) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d2(timestamp, s3) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d3(timestamp, s4) VALUES (5, 5)"); int count = 0; try (ResultSet resultSet = statement.executeQuery("show devices limit 2")) { @@ -750,30 +750,30 @@ public void testShowDevicesWithLimit() throws SQLException { public void testFirstOverlappedPageFiltered() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); // seq chunk : [1,10] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (10, 10)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (10, 10)"); statement.execute("flush"); // seq chunk : [13,20] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (13, 13)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (20, 20)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (13, 13)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (20, 20)"); statement.execute("flush"); // unseq chunk : [5,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 15)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 15)"); statement.execute("flush"); long count = 0; try (ResultSet resultSet = - statement.executeQuery("select s0 from root.sg1.d0 where s0 > 18")) { + statement.executeQuery("select s0 from root.db1.d0 where s0 > 18")) { while (resultSet.next()) { count++; } @@ -787,21 +787,21 @@ public void testFirstOverlappedPageFiltered() throws SQLException { public void testPartialInsertion() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); try { - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0, s1) VALUES (1, 1, 2.2)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0, s1) VALUES (1, 1, 2.2)"); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("s1")); } - try (ResultSet resultSet = statement.executeQuery("select s0, s1 from root.sg1.d0")) { + try (ResultSet resultSet = statement.executeQuery("select s0, s1 from root.db1.d0")) { while (resultSet.next()) { - assertEquals(1, resultSet.getInt("root.sg1.d0.s0")); - assertEquals(null, resultSet.getString("root.sg1.d0.s1")); + assertEquals(1, resultSet.getInt("root.db1.d0.s0")); + assertEquals(null, resultSet.getString("root.db1.d0.s1")); } } } @@ -811,35 +811,35 @@ public void testPartialInsertion() throws SQLException { public void testOverlappedPagesMerge() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); // seq chunk : start-end [1000, 1000] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1000, 0)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1000, 0)"); statement.execute("flush"); // unseq chunk : [1,10] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (10, 10)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (10, 10)"); statement.execute("flush"); // usneq chunk : [5,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 15)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 15)"); statement.execute("flush"); // unseq chunk : [15,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 150)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 150)"); statement.execute("flush"); long count = 0; try (ResultSet resultSet = - statement.executeQuery("select s0 from root.sg1.d0 where s0 < 100")) { + statement.executeQuery("select s0 from root.db1.d0 where s0 < 100")) { while (resultSet.next()) { count++; } @@ -853,16 +853,16 @@ public void testOverlappedPagesMerge() throws SQLException { public void testUnseqUnsealedDeleteQuery() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); // seq data - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1000, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1000, 1)"); statement.execute("flush"); for (int i = 1; i <= 10; i++) { statement.execute( - String.format("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (%d, %d)", i, i)); + String.format("INSERT INTO root.db1.d0(timestamp, s0) VALUES (%d, %d)", i, i)); } statement.execute("flush"); @@ -870,14 +870,14 @@ public void testUnseqUnsealedDeleteQuery() throws SQLException { // unseq data for (int i = 11; i <= 20; i++) { statement.execute( - String.format("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (%d, %d)", i, i)); + String.format("INSERT INTO root.db1.d0(timestamp, s0) VALUES (%d, %d)", i, i)); } - statement.execute("delete from root.sg1.d0.s0 where time <= 15"); + statement.execute("delete from root.db1.d0.s0 where time <= 15"); long count = 0; - try (ResultSet resultSet = statement.executeQuery("select * from root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db1.**")) { while (resultSet.next()) { count++; } @@ -891,16 +891,16 @@ public void testUnseqUnsealedDeleteQuery() throws SQLException { public void testTimeseriesMetadataCache() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); for (int i = 0; i < 10000; i++) { statement.execute( - "CREATE TIMESERIES root.sg1.d0.s" + i + " WITH DATATYPE=INT32,ENCODING=PLAIN"); + "CREATE TIMESERIES root.db1.d0.s" + i + " WITH DATATYPE=INT32,ENCODING=PLAIN"); } for (int i = 1; i < 10000; i++) { - statement.execute("INSERT INTO root.sg1.d0(timestamp, s" + i + ") VALUES (1000, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s" + i + ") VALUES (1000, 1)"); } statement.execute("flush"); - statement.executeQuery("select s0 from root.sg1.d0"); + statement.executeQuery("select s0 from root.db1.d0"); } catch (SQLException e) { fail(); } @@ -910,10 +910,10 @@ public void testTimeseriesMetadataCache() { public void testInvalidSchema() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); try { statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 with datatype=BOOLEAN, encoding=TS_2DIFF"); + "CREATE TIMESERIES root.db1.d1.s1 with datatype=BOOLEAN, encoding=TS_2DIFF"); fail(); } catch (Exception e) { Assert.assertEquals( @@ -924,7 +924,7 @@ public void testInvalidSchema() { try { statement.execute( - "CREATE TIMESERIES root.sg1.d1.s3 with datatype=DOUBLE, encoding=REGULAR"); + "CREATE TIMESERIES root.db1.d1.s3 with datatype=DOUBLE, encoding=REGULAR"); fail(); } catch (Exception e) { Assert.assertEquals( @@ -934,7 +934,7 @@ public void testInvalidSchema() { } try { - statement.execute("CREATE TIMESERIES root.sg1.d1.s4 with datatype=TEXT, encoding=TS_2DIFF"); + statement.execute("CREATE TIMESERIES root.db1.d1.s4 with datatype=TEXT, encoding=TS_2DIFF"); fail(); } catch (Exception e) { Assert.assertEquals( @@ -952,29 +952,29 @@ public void testInvalidSchema() { public void testUseSameStatement() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); - statement.execute("insert into root.sg1.d0(timestamp,s0,s1) values(1,1,1)"); - statement.execute("insert into root.sg1.d1(timestamp,s0,s1) values(1000,1000,1000)"); - statement.execute("insert into root.sg1.d0(timestamp,s0,s1) values(10,10,10)"); + statement.execute("insert into root.db1.d0(timestamp,s0,s1) values(1,1,1)"); + statement.execute("insert into root.db1.d1(timestamp,s0,s1) values(1000,1000,1000)"); + statement.execute("insert into root.db1.d0(timestamp,s0,s1) values(10,10,10)"); List resultSetList = new ArrayList<>(); - ResultSet r1 = statement.executeQuery("select * from root.sg1.d0 where time <= 1"); + ResultSet r1 = statement.executeQuery("select * from root.db1.d0 where time <= 1"); resultSetList.add(r1); - ResultSet r2 = statement.executeQuery("select * from root.sg1.d1 where s0 == 1000"); + ResultSet r2 = statement.executeQuery("select * from root.db1.d1 where s0 == 1000"); resultSetList.add(r2); - ResultSet r3 = statement.executeQuery("select * from root.sg1.d0 where s1 == 10"); + ResultSet r3 = statement.executeQuery("select * from root.db1.d0 where s1 == 10"); resultSetList.add(r3); r1.next(); @@ -998,38 +998,38 @@ public void testUseSameStatement() throws SQLException { public void testInvalidMaxPointNumber() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 with datatype=FLOAT, encoding=TS_2DIFF, " + "CREATE TIMESERIES root.db1.d1.s1 with datatype=FLOAT, encoding=TS_2DIFF, " + "'max_point_number'='4'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s2 with datatype=FLOAT, encoding=TS_2DIFF, " + "CREATE TIMESERIES root.db1.d1.s2 with datatype=FLOAT, encoding=TS_2DIFF, " + "'max_point_number'='2.5'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s3 with datatype=FLOAT, encoding=RLE, " + "CREATE TIMESERIES root.db1.d1.s3 with datatype=FLOAT, encoding=RLE, " + "'max_point_number'='q'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 with datatype=FLOAT, encoding=RLE, " + "CREATE TIMESERIES root.db1.d1.s4 with datatype=FLOAT, encoding=RLE, " + "'max_point_number'='-1'"); statement.execute( - "insert into root.sg1.d1(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); + "insert into root.db1.d1(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); - try (ResultSet r1 = statement.executeQuery("select s1 from root.sg1.d1")) { + try (ResultSet r1 = statement.executeQuery("select s1 from root.db1.d1")) { r1.next(); Assert.assertEquals(1.1234f, r1.getFloat(2), 0); } - try (ResultSet r2 = statement.executeQuery("select s3 from root.sg1.d1")) { + try (ResultSet r2 = statement.executeQuery("select s3 from root.db1.d1")) { r2.next(); Assert.assertEquals(1.12f, r2.getFloat(2), 0); } - try (ResultSet r3 = statement.executeQuery("select s3 from root.sg1.d1")) { + try (ResultSet r3 = statement.executeQuery("select s3 from root.db1.d1")) { r3.next(); Assert.assertEquals(1.12f, r3.getFloat(2), 0); } - try (ResultSet r4 = statement.executeQuery("select s4 from root.sg1.d1")) { + try (ResultSet r4 = statement.executeQuery("select s4 from root.db1.d1")) { r4.next(); Assert.assertEquals(1.12f, r4.getFloat(2), 0); } @@ -1067,9 +1067,9 @@ public void testDatabaseWithHyphenInName() { public void testDisableAlign() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=BOOLEAN"); - ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg1.d1 disable align"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=BOOLEAN"); + ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db1.d1 disable align"); ResultSetMetaData metaData = resultSet.getMetaData(); int[] types = {Types.TIMESTAMP, Types.INTEGER, Types.BIGINT, Types.BOOLEAN}; int columnCount = metaData.getColumnCount(); @@ -1083,9 +1083,9 @@ public void testDisableAlign() throws Exception { public void testEnableAlign() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=BOOLEAN"); - ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg1.d1"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=BOOLEAN"); + ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db1.d1"); ResultSetMetaData metaData = resultSet.getMetaData(); int[] types = {Types.TIMESTAMP, Types.INTEGER, Types.BOOLEAN}; int columnCount = metaData.getColumnCount(); @@ -1099,25 +1099,25 @@ public void testEnableAlign() throws Exception { public void testFromFuzzyMatching() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 with datatype=FLOAT, encoding=TS_2DIFF, " + "CREATE TIMESERIES root.db1.d1.s1 with datatype=FLOAT, encoding=TS_2DIFF, " + "'max_point_number'='4'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s2 with datatype=FLOAT, encoding=TS_2DIFF, " + "CREATE TIMESERIES root.db1.d1.s2 with datatype=FLOAT, encoding=TS_2DIFF, " + "'max_point_number'='2.5'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s3 with datatype=FLOAT, encoding=RLE, " + "CREATE TIMESERIES root.db1.d1.s3 with datatype=FLOAT, encoding=RLE, " + "'max_point_number'='q'"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 with datatype=FLOAT, encoding=RLE, " + "CREATE TIMESERIES root.db1.d1.s4 with datatype=FLOAT, encoding=RLE, " + "'max_point_number'='-1'"); statement.execute( - "insert into root.sg1.da1cb(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); + "insert into root.db1.da1cb(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); statement.execute( - "insert into root.sg1.da1ce(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); + "insert into root.db1.da1ce(timestamp,s1,s2,s3,s4) values(1,1.1234,1.1234,1.1234,1.1234)"); - try (ResultSet r1 = statement.executeQuery("select s1 from root.sg1.*a*")) { + try (ResultSet r1 = statement.executeQuery("select s1 from root.db1.*a*")) { while (r1.next()) { Assert.assertEquals(1.1234f, r1.getDouble(2), 0.001); } @@ -1134,23 +1134,23 @@ public void testNewDataType() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); for (int i = 1; i <= 10; i++) { statement.execute( String.format( - "insert into root.sg1.d1(timestamp, s4, s5, s6, s7) values(%d, \"%s\", %d, %s, \"%s\")", + "insert into root.db1.d1(timestamp, s4, s5, s6, s7) values(%d, \"%s\", %d, %s, \"%s\")", i, LocalDate.of(2024, 5, i % 31 + 1), i, "X'cafebabe'", i)); } - try (ResultSet resultSet = statement.executeQuery("select * from root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db1.**")) { final ResultSetMetaData metaData = resultSet.getMetaData(); final int columnCount = metaData.getColumnCount(); assertEquals(5, columnCount); @@ -1192,13 +1192,13 @@ public void testIllegalDateType() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); try { - statement.execute("insert into root.sg1.d1(timestamp, s4) values(1, '2022-04-31')"); + statement.execute("insert into root.db1.d1(timestamp, s4) values(1, '2022-04-31')"); fail(); } catch (Exception e) { assertEquals( @@ -1210,7 +1210,7 @@ public void testIllegalDateType() { } try { statement.execute( - "insert into root.sg1.d1(timestamp, s5) values(1999-04-31T00:00:00.000+08:00, 1999-04-31T00:00:00.000+08:00)"); + "insert into root.db1.d1(timestamp, s5) values(1999-04-31T00:00:00.000+08:00, 1999-04-31T00:00:00.000+08:00)"); fail(); } catch (Exception e) { assertEquals( diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java index c21e4e347c4db..43bdb28501ebf 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionIdentifierIT.java @@ -71,15 +71,15 @@ public void testKeyWord() { }; String[] resultTimeseries = { - "root.sg1.d1.add", - "root.sg1.d1.as", - "root.sg1.d1.select", - "root.sg1.d1.drop_trigger", - "root.sg1.d1.REVOKE_USER_ROLE", - "root.sg1.d1.pipesink", - "root.sg1.d1.boolean", - "root.sg1.d1.datatype", - "root.sg1.d1.device", + "root.db1.d1.add", + "root.db1.d1.as", + "root.db1.d1.select", + "root.db1.d1.drop_trigger", + "root.db1.d1.REVOKE_USER_ROLE", + "root.db1.d1.pipesink", + "root.db1.d1.boolean", + "root.db1.d1.datatype", + "root.db1.d1.device", }; String[] selectNodeNames = { @@ -109,14 +109,14 @@ public void testKeyWord() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (String createNodeName : createNodeNames) { - String createSql = String.format("CREATE TIMESERIES root.sg1.d1.%s INT32", createNodeName); + String createSql = String.format("CREATE TIMESERIES root.db1.d1.%s INT32", createNodeName); String insertSql = - String.format("INSERT INTO root.sg1.d1(time, %s) VALUES(1, 1)", createNodeName); + String.format("INSERT INTO root.db1.d1(time, %s) VALUES(1, 1)", createNodeName); statement.execute(createSql); statement.execute(insertSql); } - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { Set expectedResult = new HashSet<>(Arrays.asList(resultTimeseries)); while (resultSet.next()) { @@ -129,10 +129,10 @@ public void testKeyWord() { for (int i = 0; i < selectNodeNames.length; i++) { String selectSql = - String.format("SELECT %s FROM root.sg1.d1 WHERE time = 1", selectNodeNames[i]); + String.format("SELECT %s FROM root.db1.d1 WHERE time = 1", selectNodeNames[i]); try (ResultSet resultSet = statement.executeQuery(selectSql)) { Assert.assertTrue(resultSet.next()); - Assert.assertEquals(1, resultSet.getInt("root.sg1.d1." + suffixInResultColumns[i])); + Assert.assertEquals(1, resultSet.getInt("root.db1.d1." + suffixInResultColumns[i])); } } @@ -175,33 +175,33 @@ public void testNodeName() { }; String[] resultTimeseries = { - "root.sg1.d1.a_1", - "root.sg1.d1.aaa", - "root.sg1.d1.in", - "root.sg1.d1.between", - "root.sg1.d1.is", - "root.sg1.d1.select", - "root.sg1.d1.`a.b`", - "root.sg1.d1.`111`", - "root.sg1.d1.`a``b`", - "root.sg1.d1.`a.\"b`", - "root.sg1.d1.`a.'b`", - "root.sg1.d1.````", - "root.sg1.d1.`c.d.```", - "root.sg1.d1.abc", - "root.sg1.d1.`+12`", - "root.sg1.d1.`1e3`", - "root.sg1.d1.`001`", - "root.sg1.d1.`-1.0`", - "root.sg1.d1.`01e-3`", - "root.sg1.d1.`+0001`", - "root.sg1.d1.`-0001`", - "root.sg1.d1.`++1`", - "root.sg1.d1.`+-1`", - "root.sg1.d1.`--1`", - "root.sg1.d1.123w", - "root.sg1.d1.123d", - "root.sg1.d1.123h" + "root.db1.d1.a_1", + "root.db1.d1.aaa", + "root.db1.d1.in", + "root.db1.d1.between", + "root.db1.d1.is", + "root.db1.d1.select", + "root.db1.d1.`a.b`", + "root.db1.d1.`111`", + "root.db1.d1.`a``b`", + "root.db1.d1.`a.\"b`", + "root.db1.d1.`a.'b`", + "root.db1.d1.````", + "root.db1.d1.`c.d.```", + "root.db1.d1.abc", + "root.db1.d1.`+12`", + "root.db1.d1.`1e3`", + "root.db1.d1.`001`", + "root.db1.d1.`-1.0`", + "root.db1.d1.`01e-3`", + "root.db1.d1.`+0001`", + "root.db1.d1.`-0001`", + "root.db1.d1.`++1`", + "root.db1.d1.`+-1`", + "root.db1.d1.`--1`", + "root.db1.d1.123w", + "root.db1.d1.123d", + "root.db1.d1.123h" }; String[] selectNodeNames = { @@ -267,14 +267,14 @@ public void testNodeName() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (String createNodeName : createNodeNames) { - String createSql = String.format("CREATE TIMESERIES root.sg1.d1.%s INT32", createNodeName); + String createSql = String.format("CREATE TIMESERIES root.db1.d1.%s INT32", createNodeName); String insertSql = - String.format("INSERT INTO root.sg1.d1(time, %s) VALUES(1, 1)", createNodeName); + String.format("INSERT INTO root.db1.d1(time, %s) VALUES(1, 1)", createNodeName); statement.execute(createSql); statement.execute(insertSql); } - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { Set expectedResult = new HashSet<>(Arrays.asList(resultTimeseries)); while (resultSet.next()) { @@ -287,10 +287,10 @@ public void testNodeName() { for (int i = 0; i < selectNodeNames.length; i++) { String selectSql = - String.format("SELECT %s FROM root.sg1.d1 WHERE time = 1", selectNodeNames[i]); + String.format("SELECT %s FROM root.db1.d1 WHERE time = 1", selectNodeNames[i]); try (ResultSet resultSet = statement.executeQuery(selectSql)) { Assert.assertTrue(resultSet.next()); - Assert.assertEquals(1, resultSet.getInt("root.sg1.d1." + suffixInResultColumns[i])); + Assert.assertEquals(1, resultSet.getInt("root.db1.d1." + suffixInResultColumns[i])); } } @@ -307,76 +307,76 @@ public void testNodeNameIllegal() { // nodeName with special characters should be quoted with '`' try { - statement.execute("create timeseries root.sg1.d1.`a INT32"); + statement.execute("create timeseries root.db1.d1.`a INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.[a INT32"); + statement.execute("create timeseries root.db1.d1.[a INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.a! INT32"); + statement.execute("create timeseries root.db1.d1.a! INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.a\" INT32"); + statement.execute("create timeseries root.db1.d1.a\" INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.a' INT32"); + statement.execute("create timeseries root.db1.d1.a' INT32"); fail(); } catch (Exception ignored) { } // nodeName consists of numbers should be quoted with '`' try { - statement.execute("create timeseries root.sg1.d1.111 INT32"); + statement.execute("create timeseries root.db1.d1.111 INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.012 INT32"); + statement.execute("create timeseries root.db1.d1.012 INT32"); fail(); } catch (Exception ignored) { } // shouled use double '`' in a quoted nodeName try { - statement.execute("create timeseries root.sg1.d1.`a`` INT32"); + statement.execute("create timeseries root.db1.d1.`a`` INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.``a` INT32"); + statement.execute("create timeseries root.db1.d1.``a` INT32"); fail(); } catch (Exception ignored) { } // reserved words can not be identifier try { - statement.execute("create timeseries root.sg1.d1.root INT32"); + statement.execute("create timeseries root.db1.d1.root INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.time INT32"); + statement.execute("create timeseries root.db1.d1.time INT32"); fail(); } catch (Exception ignored) { } try { - statement.execute("create timeseries root.sg1.d1.timestamp INT32"); + statement.execute("create timeseries root.db1.d1.timestamp INT32"); fail(); } catch (Exception ignored) { } @@ -393,7 +393,7 @@ public void testCreateIllegalDatabase() { Statement statement = connection.createStatement()) { try { - statement.execute("create database root.sg1.d1."); + statement.execute("create database root.db1.d1."); fail(); } catch (Exception ignored) { } @@ -408,20 +408,20 @@ public void testCreateIllegalDatabase() { public void testExpression() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.`1` INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.`a.b` INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.`a.``b` INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.text TEXT"); + statement.execute("CREATE TIMESERIES root.db1.d1.`1` INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.`a.b` INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.`a.``b` INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.text TEXT"); int pointCnt = 3; for (int i = 0; i < pointCnt; i++) { statement.execute( String.format( - "insert into root.sg1.d1(time,%s,%s,%s) values(%d,%d,%d,%d)", + "insert into root.db1.d1(time,%s,%s,%s) values(%d,%d,%d,%d)", "`1`", "`a.b`", "`a.``b`", i, i, i, i)); } int cnt = 0; - try (ResultSet resultSet = statement.executeQuery("SELECT `1` + 1 FROM root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT `1` + 1 FROM root.db1.d1")) { while (resultSet.next()) { cnt++; } @@ -430,7 +430,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.sg1.d1 where `1` > 1")) { + statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.db1.d1 where `1` > 1")) { while (resultSet.next()) { cnt++; } @@ -439,7 +439,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.sg1.d1")) { + statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.db1.d1")) { while (resultSet.next()) { cnt++; } @@ -448,7 +448,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.sg1.d1 where `1`>0")) { + statement.executeQuery("SELECT (`1`*`1`)+1-`a.b` FROM root.db1.d1 where `1`>0")) { while (resultSet.next()) { cnt++; } @@ -456,7 +456,7 @@ public void testExpression() { } cnt = 0; - try (ResultSet resultSet = statement.executeQuery("SELECT avg(`1`)+1 FROM root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT avg(`1`)+1 FROM root.db1.d1")) { while (resultSet.next()) { cnt++; } @@ -465,7 +465,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT count(`1`)+1 FROM root.sg1.d1 where `1`>1")) { + statement.executeQuery("SELECT count(`1`)+1 FROM root.db1.d1 where `1`>1")) { while (resultSet.next()) { Assert.assertEquals(2.0, resultSet.getDouble(1), 1e-7); cnt++; @@ -474,7 +474,7 @@ public void testExpression() { } cnt = 0; - try (ResultSet resultSet = statement.executeQuery("SELECT sin(`1`) + 1 FROM root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT sin(`1`) + 1 FROM root.db1.d1")) { while (resultSet.next()) { cnt++; } @@ -483,7 +483,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT sin(`1`) + 1 FROM root.sg1.d1 where `1`>1")) { + statement.executeQuery("SELECT sin(`1`) + 1 FROM root.db1.d1 where `1`>1")) { while (resultSet.next()) { cnt++; } @@ -492,7 +492,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT text FROM root.sg1.d1 where text = '\'")) { + statement.executeQuery("SELECT text FROM root.db1.d1 where text = '\'")) { while (resultSet.next()) { cnt++; } @@ -502,7 +502,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "SELECT text FROM root.sg1.d1 where text = '\' or text = 'asdf'")) { + "SELECT text FROM root.db1.d1 where text = '\' or text = 'asdf'")) { while (resultSet.next()) { cnt++; } @@ -511,7 +511,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT text FROM root.sg1.d1 where text = '\\'")) { + statement.executeQuery("SELECT text FROM root.db1.d1 where text = '\\'")) { while (resultSet.next()) { cnt++; } @@ -521,7 +521,7 @@ public void testExpression() { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "SELECT text FROM root.sg1.d1 where text = '\\' and text = 'asdf'")) { + "SELECT text FROM root.db1.d1 where text = '\\' and text = 'asdf'")) { while (resultSet.next()) { cnt++; } @@ -784,14 +784,14 @@ public void testRoleName() { // Statement statement = connection.createStatement()) { // try { // statement.execute( - // "create trigger trigger` before insert on root.sg1.d1 " + // "create trigger trigger` before insert on root.db1.d1 " // + "as 'org.apache.iotdb.db.storageengine.trigger.example.Accumulator'"); // } catch (Exception ignored) { // } // // try { // statement.execute( - // "create trigger `trigger`` before insert on root.sg1.d1 " + // "create trigger `trigger`` before insert on root.db1.d1 " // + "as 'org.apache.iotdb.db.storageengine.trigger.example.Accumulator'"); // fail(); // } catch (Exception ignored) { @@ -799,7 +799,7 @@ public void testRoleName() { // // try { // statement.execute( - // "create trigger 111 before insert on root.sg1.d1 " + // "create trigger 111 before insert on root.db1.d1 " // + "as 'org.apache.iotdb.db.storageengine.trigger.example.Accumulator'"); // fail(); // } catch (Exception ignored) { @@ -807,7 +807,7 @@ public void testRoleName() { // // try { // statement.execute( - // "create trigger 'tri' before insert on root.sg1.d1 " + // "create trigger 'tri' before insert on root.db1.d1 " // + "as 'org.apache.iotdb.db.storageengine.trigger.example.Accumulator'"); // fail(); // } catch (Exception ignored) { @@ -815,7 +815,7 @@ public void testRoleName() { // // try { // statement.execute( - // "create trigger \"tri\" before insert on root.sg1.d1 " + // "create trigger \"tri\" before insert on root.db1.d1 " // + "as 'org.apache.iotdb.db.storageengine.trigger.example.Accumulator'"); // fail(); // } catch (Exception ignored) { @@ -1013,33 +1013,33 @@ public void testTemplateNameIllegal() { public void testNodeNameWithWildcard() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.device_123.s1 INT32"); + statement.execute("CREATE TIMESERIES root.db.device_123.s1 INT32"); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.device_123")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.device_123")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.device_*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.device_*")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.*_123")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.*_123")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.*123")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.*123")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.*_12*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.*_12*")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.*12*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.*12*")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg.*e*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db.*e*")) { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionStringLiteralIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionStringLiteralIT.java index 6da6a3b18030d..4448736a1bea0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionStringLiteralIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionStringLiteralIT.java @@ -89,24 +89,24 @@ public void testStringLiteralWithSingleQuote() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 TEXT"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 TEXT"); for (int i = 0; i < insertData.length; i++) { String insertSql = - String.format("INSERT INTO root.sg1.d1(time, s1) values (%d, %s)", i, insertData[i]); + String.format("INSERT INTO root.db1.d1(time, s1) values (%d, %s)", i, insertData[i]); statement.execute(insertSql); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db1.d1")) { int cnt = 0; while (resultSet.next()) { - Assert.assertEquals(resultData[cnt], resultSet.getString("root.sg1.d1.s1")); + Assert.assertEquals(resultData[cnt], resultSet.getString("root.db1.d1.s1")); cnt++; } Assert.assertEquals(insertData.length, cnt); } for (String insertDatum : insertData) { - String querySql = String.format("SELECT s1 FROM root.sg1.d1 WHERE s1 = %s", insertDatum); + String querySql = String.format("SELECT s1 FROM root.db1.d1 WHERE s1 = %s", insertDatum); try (ResultSet resultSet = statement.executeQuery(querySql)) { Assert.assertTrue(resultSet.next()); } @@ -147,24 +147,24 @@ public void testStringLiteralWithDoubleQuote() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 TEXT"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 TEXT"); for (int i = 0; i < insertData.length; i++) { String insertSql = - String.format("INSERT INTO root.sg1.d1(time, s1) values (%d, %s)", i, insertData[i]); + String.format("INSERT INTO root.db1.d1(time, s1) values (%d, %s)", i, insertData[i]); statement.execute(insertSql); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db1.d1")) { int cnt = 0; while (resultSet.next()) { - Assert.assertEquals(resultData[cnt], resultSet.getString("root.sg1.d1.s1")); + Assert.assertEquals(resultData[cnt], resultSet.getString("root.db1.d1.s1")); cnt++; } Assert.assertEquals(insertData.length, cnt); } for (String insertDatum : insertData) { - String querySql = String.format("SELECT s1 FROM root.sg1.d1 WHERE s1 = %s", insertDatum); + String querySql = String.format("SELECT s1 FROM root.db1.d1 WHERE s1 = %s", insertDatum); try (ResultSet resultSet = statement.executeQuery(querySql)) { Assert.assertTrue(resultSet.next()); } @@ -184,14 +184,14 @@ public void testStringLiteralIllegalCase() { + "line 1:45 mismatched input 'string' expecting {FALSE, NAN, NOW, NULL, TRUE, '-', '+', '/', '.', STRING_LITERAL, BINARY_LITERAL, DATETIME_LITERAL, INTEGER_LITERAL, EXPONENT_NUM_PART}"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 TEXT"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 TEXT"); } catch (SQLException e) { fail(e.getMessage()); } // without ' or " try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, string)"); + statement.execute("INSERT INTO root.db1.d1(time, s1) values (1, string)"); fail(); } catch (SQLException e) { Assert.assertEquals(errorMsg, e.getMessage()); @@ -204,7 +204,7 @@ public void testStringLiteralIllegalCase() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // wrap STRING_LITERAL with `` - statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, `string`)"); + statement.execute("INSERT INTO root.db1.d1(time, s1) values (1, `string`)"); fail(); } catch (SQLException e) { Assert.assertEquals(errorMsg1, e.getMessage()); @@ -217,7 +217,7 @@ public void testStringLiteralIllegalCase() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // single ' in '' - statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, ''string')"); + statement.execute("INSERT INTO root.db1.d1(time, s1) values (1, ''string')"); fail(); } catch (SQLException e) { Assert.assertEquals(errorMsg2, e.getMessage()); @@ -230,7 +230,7 @@ public void testStringLiteralIllegalCase() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // single " in "" - statement.execute("INSERT INTO root.sg1.d1(time, s1) values (1, \"\"string\")"); + statement.execute("INSERT INTO root.db1.d1(time, s1) values (1, \"\"string\")"); fail(); } catch (SQLException e) { Assert.assertEquals(errorMsg3, e.getMessage()); @@ -532,11 +532,11 @@ public void testAliasInResultColumn() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "create timeseries root.sg.a " + "create timeseries root.db.a " + "with datatype=INT64, encoding=PLAIN, compression=SNAPPY "); - statement.execute("insert into root.sg(time, a) values (1,1)"); + statement.execute("insert into root.db(time, a) values (1,1)"); - String selectSql = "select a as %s from root.sg"; + String selectSql = "select a as %s from root.db"; for (int i = 0; i < alias.length; i++) { try (ResultSet resultSet = statement.executeQuery(String.format(selectSql, alias[i]))) { Assert.assertEquals(res[i], resultSet.getMetaData().getColumnName(2)); @@ -544,7 +544,7 @@ public void testAliasInResultColumn() { } try { - statement.execute("select a as test.b from root.sg"); + statement.execute("select a as test.b from root.db"); fail(); } catch (Exception ignored) { } @@ -567,10 +567,10 @@ public void testAliasInAlterClause() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "create timeseries root.sg.a " + "create timeseries root.db.a " + "with datatype=INT64, encoding=PLAIN, compression=SNAPPY "); - String alterSql = "ALTER timeseries root.sg.a UPSERT alias = %s"; + String alterSql = "ALTER timeseries root.db.a UPSERT alias = %s"; for (int i = 0; i < alias.length; i++) { statement.execute(String.format(alterSql, alias[i])); try (ResultSet resultSet = statement.executeQuery("show timeseries")) { @@ -580,7 +580,7 @@ public void testAliasInAlterClause() { } try { - statement.execute("ALTER timeseries root.sg.a UPSERT alias = test.a"); + statement.execute("ALTER timeseries root.db.a UPSERT alias = test.a"); fail(); } catch (Exception ignored) { } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java index a0ad94a99444c..351243e9d6514 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java @@ -163,22 +163,22 @@ public void testTTL() throws SQLException, InterruptedException { } assertTrue(cnt >= 200); } - statement.execute("CREATE DATABASE root.sg.TTL_SG3"); - statement.execute("CREATE DATABASE root.sg.TTL_SG4"); + statement.execute("CREATE DATABASE root.db.TTL_SG3"); + statement.execute("CREATE DATABASE root.db.TTL_SG4"); // SG3 for (int i = 0; i < 100; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 100 + i, i)); + "INSERT INTO root.db.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 100 + i, i)); } for (int i = 100; i < 200; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)", + "INSERT INTO root.db.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 10000000 + i, i)); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg.TTL_SG3")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db.TTL_SG3")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -189,16 +189,16 @@ public void testTTL() throws SQLException, InterruptedException { for (int i = 200; i < 300; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 100 + i, i)); + "INSERT INTO root.db.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 100 + i, i)); } for (int i = 300; i < 400; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)", + "INSERT INTO root.db.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 10000000 + i, i)); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg.TTL_SG4")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db.TTL_SG4")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -206,8 +206,8 @@ public void testTTL() throws SQLException, InterruptedException { assertEquals(200, cnt); } - statement.execute("SET TTL TO root.sg.** 100000"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg.**")) { + statement.execute("SET TTL TO root.db.** 100000"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db.**")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -219,7 +219,7 @@ public void testTTL() throws SQLException, InterruptedException { try { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)", + "INSERT INTO root.db.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 5000000 + i, i)); } catch (SQLException e) { assertEquals(TSStatusCode.OUT_OF_TTL.getStatusCode(), e.getErrorCode()); @@ -230,14 +230,14 @@ public void testTTL() throws SQLException, InterruptedException { try { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)", + "INSERT INTO root.db.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 5000000 + i, i)); } catch (SQLException e) { assertEquals(TSStatusCode.OUT_OF_TTL.getStatusCode(), e.getErrorCode()); } } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg.**")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db.**")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -245,20 +245,20 @@ public void testTTL() throws SQLException, InterruptedException { assertEquals(200, cnt); } - statement.execute("UNSET TTL TO root.sg.**"); + statement.execute("UNSET TTL TO root.db.**"); // make sure other nodes have applied UNSET TTL Thread.sleep(1000); for (int i = 0; i < 100; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 30000 + i, i)); + "INSERT INTO root.db.TTL_SG3(timestamp, s1) VALUES (%d, %d)", now - 30000 + i, i)); } for (int i = 100; i < 200; i++) { statement.execute( String.format( - "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 30000 + i, i)); + "INSERT INTO root.db.TTL_SG4(timestamp, s1) VALUES (%d, %d)", now - 30000 + i, i)); } - try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.sg.**")) { + try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.db.**")) { int cnt = 0; while (resultSet.next()) { cnt++; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationByLevelIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationByLevelIT.java index 222988de43dca..10397d1f904fb 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationByLevelIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationByLevelIT.java @@ -54,25 +54,25 @@ public class IoTDBAggregationByLevelIT { protected static final String[] dataSet = new String[] { - "CREATE DATABASE root.sg1", - "CREATE DATABASE root.sg2", - "CREATE TIMESERIES root.sg1.d1.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d2.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d1.status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "INSERT INTO root.sg1.d1(timestamp,status) values(150,true)", - "INSERT INTO root.sg1.d1(timestamp,status,temperature) values(200,false,20.71)", - "INSERT INTO root.sg1.d1(timestamp,status,temperature) values(600,false,71.12)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(200,false,42.66)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(300,false,46.77)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(700,true,62.15)", - "INSERT INTO root.sg2.d1(timestamp,status,temperature) values(100,3,88.24)", - "INSERT INTO root.sg2.d1(timestamp,status,temperature) values(500,5,125.5)", - "INSERT INTO root.sg2.d2(timestamp,temperature) values(200,105.5)", - "INSERT INTO root.sg2.d2(timestamp,temperature) values(800,61.22)", + "CREATE DATABASE root.db1", + "CREATE DATABASE root.db2", + "CREATE TIMESERIES root.db1.d1.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d2.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d1.status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "INSERT INTO root.db1.d1(timestamp,status) values(150,true)", + "INSERT INTO root.db1.d1(timestamp,status,temperature) values(200,false,20.71)", + "INSERT INTO root.db1.d1(timestamp,status,temperature) values(600,false,71.12)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(200,false,42.66)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(300,false,46.77)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(700,true,62.15)", + "INSERT INTO root.db2.d1(timestamp,status,temperature) values(100,3,88.24)", + "INSERT INTO root.db2.d1(timestamp,status,temperature) values(500,5,125.5)", + "INSERT INTO root.db2.d2(timestamp,temperature) values(200,105.5)", + "INSERT INTO root.db2.d2(timestamp,temperature) values(800,61.22)", }; private static final double DOUBLE_PRECISION = 0.001d; @@ -99,18 +99,18 @@ public void sumFuncGroupByLevelTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select sum(temperature), sum(temperature) from root.sg1.* GROUP BY level=1")) { + "select sum(temperature), sum(temperature) from root.db1.* GROUP BY level=1")) { while (resultSet.next()) { - String ans = resultSet.getString(sum("root.sg1.*.temperature")); + String ans = resultSet.getString(sum("root.db1.*.temperature")); Assert.assertEquals(retArray[cnt], Double.parseDouble(ans), DOUBLE_PRECISION); cnt++; } } try (ResultSet resultSet = - statement.executeQuery("select sum(temperature) from root.sg2.* GROUP BY level=1")) { + statement.executeQuery("select sum(temperature) from root.db2.* GROUP BY level=1")) { while (resultSet.next()) { - String ans = resultSet.getString(sum("root.sg2.*.temperature")); + String ans = resultSet.getString(sum("root.db2.*.temperature")); Assert.assertEquals(retArray[cnt], Double.parseDouble(ans), DOUBLE_PRECISION); cnt++; } @@ -126,10 +126,10 @@ public void sumFuncGroupByLevelTest() throws Exception { } try (ResultSet resultSet = - statement.executeQuery("select sum(temperature) from root.sg1.* GROUP BY level=1,2")) { + statement.executeQuery("select sum(temperature) from root.db1.* GROUP BY level=1,2")) { while (resultSet.next()) { - String ans1 = resultSet.getString(sum("root.sg1.d1.temperature")); - String ans2 = resultSet.getString(sum("root.sg1.d2.temperature")); + String ans1 = resultSet.getString(sum("root.db1.d1.temperature")); + String ans2 = resultSet.getString(sum("root.db1.d2.temperature")); Assert.assertEquals(retArray[cnt++], Double.parseDouble(ans1), DOUBLE_PRECISION); Assert.assertEquals(retArray[cnt++], Double.parseDouble(ans2), DOUBLE_PRECISION); } @@ -146,18 +146,18 @@ public void avgFuncGroupByLevelTest() throws Exception { int cnt = 0; try (ResultSet resultSet = - statement.executeQuery("select avg(temperature) from root.sg1.* GROUP BY level=1")) { + statement.executeQuery("select avg(temperature) from root.db1.* GROUP BY level=1")) { while (resultSet.next()) { - String ans = resultSet.getString(avg("root.sg1.*.temperature")); + String ans = resultSet.getString(avg("root.db1.*.temperature")); Assert.assertEquals(retArray[cnt], Double.parseDouble(ans), DOUBLE_PRECISION); cnt++; } } try (ResultSet resultSet = - statement.executeQuery("select avg(temperature) from root.sg2.* GROUP BY level=1")) { + statement.executeQuery("select avg(temperature) from root.db2.* GROUP BY level=1")) { while (resultSet.next()) { - String ans = resultSet.getString(avg("root.sg2.*.temperature")); + String ans = resultSet.getString(avg("root.db2.*.temperature")); Assert.assertEquals(retArray[cnt], Double.parseDouble(ans), DOUBLE_PRECISION); cnt++; } @@ -173,10 +173,10 @@ public void avgFuncGroupByLevelTest() throws Exception { } try (ResultSet resultSet = - statement.executeQuery("select avg(temperature) from root.sg1.* GROUP BY level=1, 2")) { + statement.executeQuery("select avg(temperature) from root.db1.* GROUP BY level=1, 2")) { while (resultSet.next()) { - String ans1 = resultSet.getString(avg("root.sg1.d1.temperature")); - String ans2 = resultSet.getString(avg("root.sg1.d2.temperature")); + String ans1 = resultSet.getString(avg("root.db1.d1.temperature")); + String ans2 = resultSet.getString(avg("root.db1.d2.temperature")); Assert.assertEquals(retArray[cnt++], Double.parseDouble(ans1), DOUBLE_PRECISION); Assert.assertEquals(retArray[cnt++], Double.parseDouble(ans2), DOUBLE_PRECISION); } @@ -211,7 +211,7 @@ public void timeFuncGroupByLevelTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( - "select max_time(status), count(temperature) from root.sg1.* GROUP BY level=2")) { + "select max_time(status), count(temperature) from root.db1.* GROUP BY level=2")) { while (resultSet.next()) { String ans = resultSet.getString(maxTime("root.*.d1.status")) @@ -230,11 +230,11 @@ public void timeFuncGroupByLevelTest() throws Exception { statement.executeQuery("select max_time(status) from root.*.* GROUP BY level=1, 2")) { while (resultSet.next()) { String ans = - resultSet.getString(maxTime("root.sg1.d1.status")) + resultSet.getString(maxTime("root.db1.d1.status")) + "," - + resultSet.getString(maxTime("root.sg1.d2.status")) + + resultSet.getString(maxTime("root.db1.d2.status")) + "," - + resultSet.getString(maxTime("root.sg2.d1.status")); + + resultSet.getString(maxTime("root.db2.d1.status")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -268,7 +268,7 @@ public void valueFuncGroupByLevelTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( - "select last_value(temperature), max_value(temperature) from root.sg1.* GROUP BY level=2")) { + "select last_value(temperature), max_value(temperature) from root.db1.* GROUP BY level=2")) { while (resultSet.next()) { String ans = resultSet.getString(lastValue("root.*.d1.temperature")) @@ -323,9 +323,9 @@ public void countStarGroupByLevelTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 1 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 1 * - *

Result is [root.sg.*.temperature] + *

Result is [root.db.*.temperature] */ @Test public void groupByLevelWithAliasTest() throws Exception { @@ -336,7 +336,7 @@ public void groupByLevelWithAliasTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(temperature) as ct from root.sg1.d1, root.sg1.d2 GROUP BY level=1")) { + "select count(temperature) as ct from root.db1.d1, root.db1.d2 GROUP BY level=1")) { while (resultSet.next()) { String ans = resultSet.getString("ct"); Assert.assertEquals(retArray[cnt], ans); @@ -347,7 +347,7 @@ public void groupByLevelWithAliasTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(temperature) as ct from root.sg1.* GROUP BY level=1")) { + "select count(temperature) as ct from root.db1.* GROUP BY level=1")) { while (resultSet.next()) { String ans = resultSet.getString("ct"); Assert.assertEquals(retArray[cnt], ans); @@ -355,9 +355,9 @@ public void groupByLevelWithAliasTest() throws Exception { } } - // root.sg1.d1.* -> [root.sg1.d1.status, root.sg1.d1.temperature] -> root.*.*.* -> ct + // root.db1.d1.* -> [root.db1.d1.status, root.db1.d1.temperature] -> root.*.*.* -> ct try (ResultSet resultSet = - statement.executeQuery("select count(*) as ct from root.sg1.d1 GROUP BY level=0")) { + statement.executeQuery("select count(*) as ct from root.db1.d1 GROUP BY level=0")) { while (resultSet.next()) { String ans = resultSet.getString("ct"); Assert.assertEquals(retArray[cnt], ans); @@ -368,7 +368,7 @@ public void groupByLevelWithAliasTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 2 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 2 * *

Result is [root.*.d1.temperature, root.*.d2.temperature] */ @@ -376,20 +376,20 @@ public void groupByLevelWithAliasTest() throws Exception { public void groupByLevelWithAliasFailTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.executeQuery("select count(temperature) as ct from root.sg1.* GROUP BY level=2"); + statement.executeQuery("select count(temperature) as ct from root.db1.* GROUP BY level=2"); fail("No exception thrown"); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("can only be matched with one")); } } - // Different from above at: root.sg1.*.temperature is just one ResultColumn + // Different from above at: root.db1.*.temperature is just one ResultColumn @Test public void groupByLevelWithAliasFailTest2() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( - "select count(temperature) as ct from root.sg1.d1, root.sg2.d2 GROUP BY level=2"); + "select count(temperature) as ct from root.db1.d1, root.db2.d2 GROUP BY level=2"); fail("No exception thrown"); } catch (Exception e) { System.out.println(e.getMessage()); @@ -403,7 +403,7 @@ public void groupByLevelWithAliasFailTest3() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( - "select count(temperature) as ct, count(temperature) as ct2 from root.sg1.d1 GROUP BY level=2"); + "select count(temperature) as ct, count(temperature) as ct2 from root.db1.d1 GROUP BY level=2"); fail("No exception thrown"); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("more than one alias")); @@ -420,7 +420,7 @@ public void groupByLevelWithAliasWithTimeIntervalTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(temperature) as ct from root.sg1.d1, root.sg1.d2 GROUP BY ([0, 600), 100ms), level=1")) { + "select count(temperature) as ct from root.db1.d1, root.db1.d2 GROUP BY ([0, 600), 100ms), level=1")) { while (resultSet.next()) { String ans = resultSet.getString(ColumnHeaderConstant.TIME) + "," + resultSet.getString("ct"); @@ -432,7 +432,7 @@ public void groupByLevelWithAliasWithTimeIntervalTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(temperature) as ct from root.sg1.* GROUP BY ([0, 600), 100ms), level=1")) { + "select count(temperature) as ct from root.db1.* GROUP BY ([0, 600), 100ms), level=1")) { while (resultSet.next()) { String ans = resultSet.getString(ColumnHeaderConstant.TIME) + "," + resultSet.getString("ct"); @@ -442,10 +442,10 @@ public void groupByLevelWithAliasWithTimeIntervalTest() throws Exception { } cnt = 0; - // root.sg1.d1.* -> [root.sg1.d1.status, root.sg1.d1.temperature] -> root.*.*.* -> ct + // root.db1.d1.* -> [root.db1.d1.status, root.db1.d1.temperature] -> root.*.*.* -> ct try (ResultSet resultSet = statement.executeQuery( - "select count(*) as ct from root.sg1.d1 GROUP BY ([0, 600), 100ms), level=1")) { + "select count(*) as ct from root.db1.d1 GROUP BY ([0, 600), 100ms), level=1")) { while (resultSet.next()) { String ans = resultSet.getString(ColumnHeaderConstant.TIME) + "," + resultSet.getString("ct"); @@ -457,7 +457,7 @@ public void groupByLevelWithAliasWithTimeIntervalTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 2 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 2 * *

Result is [root.*.d1.temperature, root.*.d2.temperature] */ @@ -466,20 +466,20 @@ public void groupByLevelWithAliasWithTimeIntervalFailTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( - "select count(temperature) as ct from root.sg1.* GROUP BY ([0, 600), 100ms), level=2"); + "select count(temperature) as ct from root.db1.* GROUP BY ([0, 600), 100ms), level=2"); fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("can only be matched with one")); } } - // Different from above at: root.sg1.*.temperature is just one ResultColumn + // Different from above at: root.db1.*.temperature is just one ResultColumn @Test public void groupByLevelWithAliasWithTimeIntervalFailTest2() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( - "select count(temperature) as ct from root.sg1.d1, root.sg1.d2 GROUP BY ([0, 600), 100ms), level=2"); + "select count(temperature) as ct from root.db1.d1, root.db1.d2 GROUP BY ([0, 600), 100ms), level=2"); fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("can only be matched with one")); @@ -498,9 +498,9 @@ public void GroupByLevelSLimitTest() throws Exception { "select count(temperature), count(status) from root.*.* GROUP BY level=1 slimit 2")) { while (resultSet.next()) { String ans = - resultSet.getString(count("root.sg1.*.temperature")) + resultSet.getString(count("root.db1.*.temperature")) + "," - + resultSet.getString(count("root.sg2.*.temperature")); + + resultSet.getString(count("root.db2.*.temperature")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -511,9 +511,9 @@ public void GroupByLevelSLimitTest() throws Exception { "select count(temperature), count(status) from root.*.* GROUP BY level=1 slimit 2 soffset 1")) { while (resultSet.next()) { String ans = - resultSet.getString(count("root.sg2.*.temperature")) + resultSet.getString(count("root.db2.*.temperature")) + "," - + resultSet.getString(count("root.sg1.*.status")); + + resultSet.getString(count("root.db1.*.status")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -523,7 +523,7 @@ public void GroupByLevelSLimitTest() throws Exception { statement.executeQuery( "select count(temperature), count(status) from root.*.* GROUP BY level=1,2 slimit 1 soffset 4")) { while (resultSet.next()) { - String ans = resultSet.getString(count("root.sg1.d1.status")); + String ans = resultSet.getString(count("root.db1.d1.status")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -552,9 +552,9 @@ public void groupByLevelWithTimeIntervalTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select sum(temperature) from root.sg2.* GROUP BY ([0, 600), 100ms), level=1")) { + "select sum(temperature) from root.db2.* GROUP BY ([0, 600), 100ms), level=1")) { while (resultSet.next()) { - String ans = "" + resultSet.getString(sum("root.sg2.*.temperature")); + String ans = "" + resultSet.getString(sum("root.db2.*.temperature")); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -566,13 +566,13 @@ public void groupByLevelWithTimeIntervalTest() throws Exception { "select max_time(temperature), avg(temperature) from root.*.* GROUP BY ([0, 600), 100ms), level=1")) { while (resultSet.next()) { String ans = - resultSet.getString(maxTime("root.sg1.*.temperature")) + resultSet.getString(maxTime("root.db1.*.temperature")) + "," - + resultSet.getString(maxTime("root.sg2.*.temperature")) + + resultSet.getString(maxTime("root.db2.*.temperature")) + "," - + resultSet.getString(avg("root.sg1.*.temperature")) + + resultSet.getString(avg("root.db1.*.temperature")) + "," - + resultSet.getString(avg("root.sg2.*.temperature")); + + resultSet.getString(avg("root.db2.*.temperature")); Assert.assertEquals(retArray2[cnt], ans); cnt++; } @@ -592,9 +592,9 @@ public void groupByMultiLevelWithTimeIntervalTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select sum(temperature) from root.sg2.* GROUP BY ([0, 600), 100ms), level=0,1")) { + "select sum(temperature) from root.db2.* GROUP BY ([0, 600), 100ms), level=0,1")) { while (resultSet.next()) { - String ans = "" + resultSet.getString(sum("root.sg2.*.temperature")); + String ans = "" + resultSet.getString(sum("root.db2.*.temperature")); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -621,9 +621,9 @@ public void groupByMultiLevelWithTimeIntervalSLimitTest() throws Exception { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.*.temperature")) + + resultSet.getString(count("root.db1.*.temperature")) + "," - + resultSet.getString(count("root.sg2.*.temperature")); + + resultSet.getString(count("root.db2.*.temperature")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -637,9 +637,9 @@ public void groupByMultiLevelWithTimeIntervalSLimitTest() throws Exception { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg2.*.temperature")) + + resultSet.getString(count("root.db2.*.temperature")) + "," - + resultSet.getString(count("root.sg1.*.status")); + + resultSet.getString(count("root.db1.*.status")); Assert.assertEquals(retArray2[cnt], ans); cnt++; } @@ -668,7 +668,7 @@ public void TestGroupByLevelWithoutAggregationFunc() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.executeQuery("select temperature from root.sg1.* group by level = 2"); + statement.executeQuery("select temperature from root.db1.* group by level = 2"); fail("No expected exception thrown"); } catch (Exception e) { Assert.assertTrue( @@ -685,7 +685,7 @@ public void groupByLevelWithSameColumn() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(status),count(status) from root.sg*.** GROUP BY level=0")) { + "select count(status),count(status) from root.db*.** GROUP BY level=0")) { ResultSetMetaData metaData = resultSet.getMetaData(); Assert.assertEquals(metaData.getColumnName(1), metaData.getColumnName(2)); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java index 524d0770a6c07..785771168f223 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java @@ -95,16 +95,16 @@ public class IoTDBAggregationIT { }; private static final String[] dataSet3 = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", - "insert into root.sg.d1(timestamp,s1) values(5,5)", - "insert into root.sg.d1(timestamp,s1) values(12,12)", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", + "insert into root.db.d1(timestamp,s1) values(5,5)", + "insert into root.db.d1(timestamp,s1) values(12,12)", "flush", - "insert into root.sg.d1(timestamp,s1) values(15,15)", - "insert into root.sg.d1(timestamp,s1) values(25,25)", + "insert into root.db.d1(timestamp,s1) values(15,15)", + "insert into root.db.d1(timestamp,s1) values(25,25)", "flush", - "insert into root.sg.d1(timestamp,s1) values(1,111)", - "insert into root.sg.d1(timestamp,s1) values(20,200)", + "insert into root.db.d1(timestamp,s1) values(1,111)", + "insert into root.db.d1(timestamp,s1) values(20,200)", "flush", }; private final String d0s0 = "root.vehicle.d0.s0"; @@ -976,9 +976,9 @@ public void descAggregationWithUnseqData() { int cnt = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT max_time(s1) FROM root.sg.d1 where time < 15")) { + statement.executeQuery("SELECT max_time(s1) FROM root.db.d1 where time < 15")) { while (resultSet.next()) { - String ans = resultSet.getString(maxTime("root.sg.d1.s1")); + String ans = resultSet.getString(maxTime("root.db.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationScanOrderIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationScanOrderIT.java index 23f55af0ffd9f..5cd0feabd525d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationScanOrderIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationScanOrderIT.java @@ -41,31 +41,31 @@ public class IoTDBAggregationScanOrderIT { private static final String[] sqls = new String[] { - "insert into root.sg1.d1(time, s1) values (12, 12);", + "insert into root.db1.d1(time, s1) values (12, 12);", "flush;", - "insert into root.sg1.d1(time, s2) values (30, 30);", + "insert into root.db1.d1(time, s2) values (30, 30);", "flush;", - "insert into root.sg1.d1(time, s1) values (0, 0);", - "insert into root.sg1.d1(time, s1) values (8, 8);", + "insert into root.db1.d1(time, s1) values (0, 0);", + "insert into root.db1.d1(time, s1) values (8, 8);", "flush;", - "insert into root.sg1.d1(time, s1) values (0, 0);", - "insert into root.sg1.d1(time, s1) values (10, 10);", + "insert into root.db1.d1(time, s1) values (0, 0);", + "insert into root.db1.d1(time, s1) values (10, 10);", "flush;", - "insert into root.sg1.d1(time, s1) values (17, 17);", - "insert into root.sg1.d1(time, s1) values (20, 20);", + "insert into root.db1.d1(time, s1) values (17, 17);", + "insert into root.db1.d1(time, s1) values (20, 20);", "flush;", - "insert into root.sg1.d2(time, s1) aligned values (12, 12);", + "insert into root.db1.d2(time, s1) aligned values (12, 12);", "flush;", - "insert into root.sg1.d2(time, s2) aligned values (30, 30);", + "insert into root.db1.d2(time, s2) aligned values (30, 30);", "flush;", - "insert into root.sg1.d2(time, s1) aligned values (0, 0);", - "insert into root.sg1.d2(time, s1) aligned values (8, 8);", + "insert into root.db1.d2(time, s1) aligned values (0, 0);", + "insert into root.db1.d2(time, s1) aligned values (8, 8);", "flush;", - "insert into root.sg1.d2(time, s1) aligned values (0, 0);", - "insert into root.sg1.d2(time, s1) aligned values (10, 10);", + "insert into root.db1.d2(time, s1) aligned values (0, 0);", + "insert into root.db1.d2(time, s1) aligned values (10, 10);", "flush;", - "insert into root.sg1.d2(time, s1) aligned values (17, 17);", - "insert into root.sg1.d2(time, s1) aligned values (20, 20);", + "insert into root.db1.d2(time, s1) aligned values (17, 17);", + "insert into root.db1.d2(time, s1) aligned values (20, 20);", "flush;" }; @@ -88,21 +88,21 @@ public static void tearDown() throws Exception { @Test public void test() { - String d1s1 = "root.sg1.d1.s1"; + String d1s1 = "root.db1.d1.s1"; String[] expectedHeader = new String[] {firstValue(d1s1), lastValue(d1s1)}; String[] retArray = new String[] {"0.0,20.0,"}; resultSetEqualWithDescOrderTest( - "select first_value(s1), last_value(s1) from root.sg1.d1", expectedHeader, retArray); + "select first_value(s1), last_value(s1) from root.db1.d1", expectedHeader, retArray); } @Test public void alignedTest() { - String d2s1 = "root.sg1.d2.s1"; + String d2s1 = "root.db1.d2.s1"; String[] expectedHeader = new String[] {firstValue(d2s1), lastValue(d2s1)}; String[] retArray = new String[] {"0.0,20.0,"}; resultSetEqualWithDescOrderTest( - "select first_value(s1), last_value(s1) from root.sg1.d2", expectedHeader, retArray); + "select first_value(s1), last_value(s1) from root.db1.d2", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java index bb7a2645b0c3b..59ade50f2864b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBTagAggregationIT.java @@ -52,33 +52,33 @@ public class IoTDBTagAggregationIT { private final double E = 0.00001D; protected static final String[] DATASET = new String[] { - "CREATE DATABASE root.sg.a;", - "CREATE DATABASE root.sg.b;", - "CREATE DATABASE root.sg2.c;", + "CREATE DATABASE root.db.a;", + "CREATE DATABASE root.db.b;", + "CREATE DATABASE root.db2.c;", "CREATE DATABASE root.case2;", - "create timeseries root.sg.a.d1.t with datatype=FLOAT tags(k1=k1v1, k2=k2v1, k3=k3v1);", - "create timeseries root.sg.b.d2.t with datatype=FLOAT tags(k1=k1v1, k2=k2v2);", - "create timeseries root.sg.a.d3.t with datatype=FLOAT tags(k1=k1v2, k2=k2v1);", - "create timeseries root.sg.b.d4.t with datatype=FLOAT tags(k1=k1v2, k2=k2v2);", - "create timeseries root.sg.a.d5.t with datatype=FLOAT tags(k1=k1v1);", - "create timeseries root.sg.b.d6.t with datatype=FLOAT tags(k2=k2v1);", - "create timeseries root.sg.a.d7.t with datatype=FLOAT;", - "create timeseries root.sg2.c.d8.t with datatype=TEXT tags(k3=k3v1);", - "insert into root.sg.a.d1(time, t) values(1, 1.1);", - "insert into root.sg.b.d2(time, t) values(1, 1.2);", - "insert into root.sg.a.d3(time, t) values(1, 1.3);", - "insert into root.sg.b.d4(time, t) values(1, 1.4);", - "insert into root.sg.a.d5(time, t) values(1, 1.5);", - "insert into root.sg.b.d6(time, t) values(1, 1.6);", - "insert into root.sg.a.d7(time, t) values(1, 1.7);", - "insert into root.sg2.c.d8(time, t) values(1, 'abc');", - "insert into root.sg.a.d1(time, t) values(10, 2.1);", - "insert into root.sg.b.d2(time, t) values(10, 3.2);", - "insert into root.sg.a.d3(time, t) values(10, 4.3);", - "insert into root.sg.b.d4(time, t) values(10, 5.4);", - "insert into root.sg.a.d5(time, t) values(10, 6.5);", - "insert into root.sg.b.d6(time, t) values(10, 7.6);", - "insert into root.sg.a.d7(time, t) values(10, 8.7);", + "create timeseries root.db.a.d1.t with datatype=FLOAT tags(k1=k1v1, k2=k2v1, k3=k3v1);", + "create timeseries root.db.b.d2.t with datatype=FLOAT tags(k1=k1v1, k2=k2v2);", + "create timeseries root.db.a.d3.t with datatype=FLOAT tags(k1=k1v2, k2=k2v1);", + "create timeseries root.db.b.d4.t with datatype=FLOAT tags(k1=k1v2, k2=k2v2);", + "create timeseries root.db.a.d5.t with datatype=FLOAT tags(k1=k1v1);", + "create timeseries root.db.b.d6.t with datatype=FLOAT tags(k2=k2v1);", + "create timeseries root.db.a.d7.t with datatype=FLOAT;", + "create timeseries root.db2.c.d8.t with datatype=TEXT tags(k3=k3v1);", + "insert into root.db.a.d1(time, t) values(1, 1.1);", + "insert into root.db.b.d2(time, t) values(1, 1.2);", + "insert into root.db.a.d3(time, t) values(1, 1.3);", + "insert into root.db.b.d4(time, t) values(1, 1.4);", + "insert into root.db.a.d5(time, t) values(1, 1.5);", + "insert into root.db.b.d6(time, t) values(1, 1.6);", + "insert into root.db.a.d7(time, t) values(1, 1.7);", + "insert into root.db2.c.d8(time, t) values(1, 'abc');", + "insert into root.db.a.d1(time, t) values(10, 2.1);", + "insert into root.db.b.d2(time, t) values(10, 3.2);", + "insert into root.db.a.d3(time, t) values(10, 4.3);", + "insert into root.db.b.d4(time, t) values(10, 5.4);", + "insert into root.db.a.d5(time, t) values(10, 6.5);", + "insert into root.db.b.d6(time, t) values(10, 7.6);", + "insert into root.db.a.d7(time, t) values(10, 8.7);", // test multi value with multi aggregation column "create timeseries root.case2.d1.s1 with datatype=FLOAT tags(k1=v1);", @@ -119,7 +119,7 @@ public static void tearDown() throws Exception { @Test public void testAggregateFunctions() { String query = - "SELECT COUNT(t), AVG(t), MAX_TIME(t), MIN_TIME(t), MAX_VALUE(t), MIN_VALUE(t), EXTREME(t) FROM root.sg.** GROUP BY TAGS(k1)"; + "SELECT COUNT(t), AVG(t), MAX_TIME(t), MIN_TIME(t), MAX_VALUE(t), MIN_VALUE(t), EXTREME(t) FROM root.db.** GROUP BY TAGS(k1)"; // Expected result set: // +----+--------+------------------+-----------+-----------+------------+------------+----------+ // | k1|count(t)| @@ -174,7 +174,7 @@ public void testAggregateFunctions() { @Test @Ignore public void testAggregateFunctionsWithNestedExpression() { - String query = "SELECT COUNT(t + 1), AVG(t + 1) FROM root.sg.** GROUP BY TAGS(k1)"; + String query = "SELECT COUNT(t + 1), AVG(t + 1) FROM root.db.** GROUP BY TAGS(k1)"; // Expected result set: // +----+------------+------------------+ // | k1|count(t + 1)| avg(t + 1)| @@ -226,7 +226,7 @@ public void testAggregateFunctionsWithNestedExpression() { @Ignore // TODO: support having in later commits public void testAggregateFunctionsWithHaving() { String query = - "SELECT COUNT(t), AVG(t), MAX_TIME(t), MIN_TIME(t), MAX_VALUE(t), MIN_VALUE(t), EXTREME(t) FROM root.sg.** GROUP BY TAGS(k1) HAVING avg(t) > 3"; + "SELECT COUNT(t), AVG(t), MAX_TIME(t), MIN_TIME(t), MAX_VALUE(t), MIN_VALUE(t), EXTREME(t) FROM root.db.** GROUP BY TAGS(k1) HAVING avg(t) > 3"; // Expected result set: // +----+--------+------------------+-----------+-----------+------------+------------+----------+ // | k1|count(t)| @@ -269,7 +269,7 @@ public void testAggregateFunctionsWithHaving() { @Test public void testMultipleAggregationKeys() { - String query = "SELECT COUNT(t) FROM root.sg.** GROUP BY TAGS(k1, k2)"; + String query = "SELECT COUNT(t) FROM root.db.** GROUP BY TAGS(k1, k2)"; // Expected result set: // +----+----+--------+ // | k1| k2|count(t)| @@ -306,7 +306,7 @@ public void testMultipleAggregationKeys() { @Test public void testAlongWithTimeAggregation() { - String query = "SELECT COUNT(t) from root.sg.** GROUP BY ([0, 20), 10ms), TAGS(k1)"; + String query = "SELECT COUNT(t) from root.db.** GROUP BY ([0, 20), 10ms), TAGS(k1)"; // Expected result set: // +-----------------------------+----+--------+ // | Time| k1|count(t)| @@ -357,7 +357,7 @@ public void testAlongWithTimeAggregation() { @Test public void testAlongWithSlidingWindow() { - String query = "SELECT COUNT(t) from root.sg.** GROUP BY ([0, 20), 15ms, 5ms), TAGS(k1)"; + String query = "SELECT COUNT(t) from root.db.** GROUP BY ([0, 20), 15ms, 5ms), TAGS(k1)"; // Expected result set: // +-----------------------------+----+--------+ // | Time| k1|count(t)| @@ -411,7 +411,7 @@ public void testAlongWithSlidingWindow() { @Test public void testAlongWithTimeAggregationAndOrdering() { String query = - "SELECT COUNT(t) from root.sg.** GROUP BY ([0, 20), 10ms), TAGS(k1) ORDER BY TIME DESC"; + "SELECT COUNT(t) from root.db.** GROUP BY ([0, 20), 10ms), TAGS(k1) ORDER BY TIME DESC"; // Expected result set: // +-----------------------------+----+--------+ // | Time| k1|count(t)| @@ -462,7 +462,7 @@ public void testAlongWithTimeAggregationAndOrdering() { @Test public void testAlongWithTimeFiltering() { - String query = "SELECT COUNT(t) FROM root.sg.** WHERE time > 1 GROUP BY TAGS(k1)"; + String query = "SELECT COUNT(t) FROM root.db.** WHERE time > 1 GROUP BY TAGS(k1)"; // Expected result set: // +----+--------+ // | k1|count(t)| @@ -519,7 +519,7 @@ public void testIncompatibleMixedDataTypes() { @Test public void testWithValueFilters() { - String query = "SELECT AVG(t) FROM root.sg.** WHERE t > 1.5 GROUP BY TAGS(k1)"; + String query = "SELECT AVG(t) FROM root.db.** WHERE t > 1.5 GROUP BY TAGS(k1)"; // Value filter is not supported yet try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -535,7 +535,7 @@ public void testWithValueFilters() { @Test public void testWithHaving() { String query = - "SELECT COUNT(t) from root.sg.** GROUP BY ([0, 20), 10ms), TAGS(k1) HAVING COUNT(t) > 3"; + "SELECT COUNT(t) from root.db.** GROUP BY ([0, 20), 10ms), TAGS(k1) HAVING COUNT(t) > 3"; // Having is not supported yet try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByAlignedSeriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByAlignedSeriesIT.java index cf3a5d6cea802..f9ec723f4e889 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByAlignedSeriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByAlignedSeriesIT.java @@ -62,7 +62,7 @@ public class IoTDBMaxByAlignedSeriesIT extends IoTDBMaxByIT { "INSERT INTO root.db.d2(timestamp,y1,y2,y3,y4,y5,y6) values(12, 8, 8, 8, 8, false, \"4\")", "INSERT INTO root.db.d2(timestamp,x1,x2,x3,x4,x5,x6) values(13, 4, 4, 4, 4, false, \"4\")", "INSERT INTO root.db.d2(timestamp,y1,y2,y3,y4,y5,y6) values(13, 8, 8, 8, 8, false, \"4\")", - "insert into root.sg.d1(time,s1,s2) values(1,1,1);", + "insert into root.db.d1(time,s1,s2) values(1,1,1);", }; @BeforeClass @@ -76,15 +76,15 @@ public static void setUp() throws Exception { public void maxMinByTimeTest() { String[] expectedHeader = new String[] {"Device", "max_by(Time, s1 + 1)", "min_by(Time, s1 + 1)"}; - String[] retArray = new String[] {"root.sg.d1,1,1,"}; + String[] retArray = new String[] {"root.db.d1,1,1,"}; resultSetEqualTest( - "select max_by(time, s1+1), min_by(time, s1+1) from root.sg.* align by device", + "select max_by(time, s1+1), min_by(time, s1+1) from root.db.* align by device", expectedHeader, retArray); expectedHeader = new String[] {"Device", "max_by(Time, s1)", "min_by(Time, s1)"}; resultSetEqualTest( - "select max_by(time, s1), min_by(time, s1) from root.sg.* where s1>0 align by device", + "select max_by(time, s1), min_by(time, s1) from root.db.* where s1>0 align by device", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java index 540c8bc66719e..6e581f8deb741 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java @@ -111,7 +111,7 @@ public class IoTDBMaxByIT { "INSERT INTO root.db.d2(timestamp,y1,y2,y3,y4,y5,y6) values(12, 9, 9, 9, 9, false, \"1\")", "INSERT INTO root.db.d2(timestamp,x1,x2,x3,x4,x5,x6) values(13, 4, 4, 4, 4, false, \"4\")", "INSERT INTO root.db.d2(timestamp,y1,y2,y3,y4,y5,y6) values(13, 9, 9, 9, 9, false, \"1\")", - "insert into root.sg.d1(time,s1,s2) values(1,1,1);", + "insert into root.db.d1(time,s1,s2) values(1,1,1);", "flush" }; @@ -491,14 +491,14 @@ public void testMaxByWithGroupByLevel() { @Test public void maxMinByTimeTest() { String[] expectedHeader = - new String[] {"max_by(Time, root.sg.d1.s1 + 1)", "min_by(Time, root.sg.d1.s1 + 1)"}; + new String[] {"max_by(Time, root.db.d1.s1 + 1)", "min_by(Time, root.db.d1.s1 + 1)"}; String[] retArray = new String[] {"1,1,"}; resultSetEqualTest( - "select max_by(time, s1+1), min_by(time, s1+1) from root.sg.*", expectedHeader, retArray); + "select max_by(time, s1+1), min_by(time, s1+1) from root.db.*", expectedHeader, retArray); - expectedHeader = new String[] {"max_by(Time, root.sg.d1.s1)", "min_by(Time, root.sg.d1.s1)"}; + expectedHeader = new String[] {"max_by(Time, root.db.d1.s1)", "min_by(Time, root.db.d1.s1)"}; resultSetEqualTest( - "select max_by(time, s1), min_by(time, s1) from root.sg.* where s1>0", + "select max_by(time, s1), min_by(time, s1) from root.db.* where s1>0", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateAggregationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateAggregationIT.java index 38f2a9616464b..a8a02aa10640e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateAggregationIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateAggregationIT.java @@ -41,34 +41,34 @@ public class IoTDBAlignByDeviceWithTemplateAggregationIT { private static final String[] sqls = new String[] { // non-aligned template - "CREATE database root.sg1;", + "CREATE database root.db1;", "CREATE schema template t1 (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t1 to root.sg1;", - "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", - "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", + "SET SCHEMA TEMPLATE t1 to root.db1;", + "INSERT INTO root.db1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", + "INSERT INTO root.db1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", "flush;", - "INSERT INTO root.sg1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", - "INSERT INTO root.sg1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", + "INSERT INTO root.db1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", + "INSERT INTO root.db1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", // aligned template - "CREATE database root.sg2;", + "CREATE database root.db2;", "CREATE schema template t2 aligned (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t2 to root.sg2;", - "INSERT INTO root.sg2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", + "SET SCHEMA TEMPLATE t2 to root.db2;", + "INSERT INTO root.db2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", "flush;", - "INSERT INTO root.sg2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", - "INSERT INTO root.sg2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", + "INSERT INTO root.db2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", + "INSERT INTO root.db2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", // aligned template with delete - "CREATE database root.sg3;", - "SET SCHEMA TEMPLATE t2 to root.sg3;", - "INSERT INTO root.sg3.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", - "INSERT INTO root.sg3.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", + "CREATE database root.db3;", + "SET SCHEMA TEMPLATE t2 to root.db3;", + "INSERT INTO root.db3.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2), (5,5.5,true,5), (1314000000000,13.14,true,1314);", + "INSERT INTO root.db3.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22), (5,50.0,false,5), (1314000000001,13.15,false,1315);", "flush;", - "INSERT INTO root.sg3.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", - "INSERT INTO root.sg3.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", - "delete from root.sg3.d1.s1 where time <= 5;" + "INSERT INTO root.db3.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44), (8,8.8,false,4), (1314000000002,13.16,false,1316);", + "INSERT INTO root.db3.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555), (8,0.8,true,10), (1314000000003,13.14,true,1314);", + "delete from root.db3.d1.s1 where time <= 5;" }; @BeforeClass @@ -89,26 +89,26 @@ public void aggregationTest() { String[] expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),last_value(s2)"}; String[] retArray = new String[] { - "root.sg1.d1,1314000000000,13.14,true,", - "root.sg1.d2,1314000000001,13.15,false,", - "root.sg1.d3,1314000000002,13.16,false,", - "root.sg1.d4,1314000000003,13.14,true,", + "root.db1.d1,1314000000000,13.14,true,", + "root.db1.d2,1314000000001,13.15,false,", + "root.db1.d3,1314000000002,13.16,false,", + "root.db1.d4,1314000000003,13.14,true,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg1.** align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db1.** align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),last_value(s2)"}; retArray = new String[] { - "root.sg2.d1,1314000000000,13.14,true,", - "root.sg2.d2,1314000000001,13.15,false,", - "root.sg2.d3,1314000000002,13.16,false,", - "root.sg2.d4,1314000000003,13.14,true,", + "root.db2.d1,1314000000000,13.14,true,", + "root.db2.d2,1314000000001,13.15,false,", + "root.db2.d3,1314000000002,13.16,false,", + "root.db2.d4,1314000000003,13.14,true,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** align by device;", expectedHeader, retArray); @@ -123,23 +123,23 @@ public void filterTest() { String[] expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),last_value(s2)"}; String[] retArray = new String[] { - "root.sg1.d2,1314000000001,13.15,false,", - "root.sg1.d3,1314000000002,13.16,false,", - "root.sg1.d4,5,5555.5,false,", + "root.db1.d2,1314000000001,13.15,false,", + "root.db1.d3,1314000000002,13.16,false,", + "root.db1.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1314000000001,13.15,false,", - "root.sg2.d3,1314000000002,13.16,false,", - "root.sg2.d4,5,5555.5,false,", + "root.db2.d2,1314000000001,13.15,false,", + "root.db2.d3,1314000000002,13.16,false,", + "root.db2.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); @@ -147,23 +147,23 @@ public void filterTest() { expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),count(s2),first_value(s3)"}; retArray = new String[] { - "root.sg1.d2,1314000000001,13.15,4,11,", - "root.sg1.d3,1314000000002,13.16,2,4,", - "root.sg1.d4,5,5555.5,1,5555,", + "root.db1.d2,1314000000001,13.15,4,11,", + "root.db1.d3,1314000000002,13.16,2,4,", + "root.db1.d4,5,5555.5,1,5555,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.sg1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.db1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1314000000001,13.15,4,11,", - "root.sg2.d3,1314000000002,13.16,2,4,", - "root.sg2.d4,5,5555.5,1,5555,", + "root.db2.d2,1314000000001,13.15,4,11,", + "root.db2.d3,1314000000002,13.16,2,4,", + "root.db2.d4,5,5555.5,1,5555,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.sg2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.db2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); @@ -174,22 +174,22 @@ public void filterTest() { }; retArray = new String[] { - "root.sg1.d2,1314000000001,13.15,4,11,13.15,", - "root.sg1.d3,1314000000002,13.16,2,4,13.16,", - "root.sg1.d4,5,5555.5,1,5555,5555.5,", + "root.db1.d2,1314000000001,13.15,4,11,13.15,", + "root.db1.d3,1314000000002,13.16,2,4,13.16,", + "root.db1.d4,5,5555.5,1,5555,5555.5,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3), last_value(s1) FROM root.sg1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3), last_value(s1) FROM root.db1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1314000000001,13.15,4,11,13.15,", - "root.sg2.d3,1314000000002,13.16,2,4,13.16,", - "root.sg2.d4,5,5555.5,1,5555,5555.5,", + "root.db2.d2,1314000000001,13.15,4,11,13.15,", + "root.db2.d3,1314000000002,13.16,2,4,13.16,", + "root.db2.d4,5,5555.5,1,5555,5555.5,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3), last_value(s1) FROM root.sg2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3), last_value(s1) FROM root.db2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); @@ -197,18 +197,18 @@ public void filterTest() { expectedHeader = new String[] {"Device,c1,first_value(s3),c2"}; retArray = new String[] { - "root.sg1.d2,4,11,4,", "root.sg1.d3,2,4,2,", "root.sg1.d4,1,5555,1,", + "root.db1.d2,4,11,4,", "root.db1.d3,2,4,2,", "root.db1.d4,1,5555,1,", }; resultSetEqualTest( - "SELECT count(s1) as c1, first_value(s3), count(s1) as c2 FROM root.sg1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT count(s1) as c1, first_value(s3), count(s1) as c2 FROM root.db1.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,4,11,4,", "root.sg2.d3,2,4,2,", "root.sg2.d4,1,5555,1,", + "root.db2.d2,4,11,4,", "root.db2.d3,2,4,2,", "root.db2.d4,1,5555,1,", }; resultSetEqualTest( - "SELECT count(s1) as c1, first_value(s3), count(s1) as c2 FROM root.sg2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", + "SELECT count(s1) as c1, first_value(s3), count(s1) as c2 FROM root.db2.** where s3+1=1316 or s2=false having avg(s1)>2 align by device;", expectedHeader, retArray); @@ -217,46 +217,46 @@ public void filterTest() { new String[] {"Device,max_time(s1),count(s1),last_value(s2),count(s1) + last_value(s3)"}; retArray = new String[] { - "root.sg1.d2,1314000000001,4,false,1319.0,", - "root.sg1.d3,1314000000002,2,false,1318.0,", - "root.sg1.d4,5,1,false,5556.0,", + "root.db1.d2,1314000000001,4,false,1319.0,", + "root.db1.d3,1314000000002,2,false,1318.0,", + "root.db1.d4,5,1,false,5556.0,", }; resultSetEqualTest( - "SELECT max_time(s1), count(s1), last_value(s2), count(s1)+last_value(s3) FROM root.sg1.** where s3+1=1316 or s2=false having avg(s1)+sum(s3)>5 align by device;", + "SELECT max_time(s1), count(s1), last_value(s2), count(s1)+last_value(s3) FROM root.db1.** where s3+1=1316 or s2=false having avg(s1)+sum(s3)>5 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1314000000001,4,false,1319.0,", - "root.sg2.d3,1314000000002,2,false,1318.0,", - "root.sg2.d4,5,1,false,5556.0,", + "root.db2.d2,1314000000001,4,false,1319.0,", + "root.db2.d3,1314000000002,2,false,1318.0,", + "root.db2.d4,5,1,false,5556.0,", }; resultSetEqualTest( - "SELECT max_time(s1), count(s1), last_value(s2), count(s1)+last_value(s3) FROM root.sg2.** where s3+1=1316 or s2=false having avg(s1)+sum(s3)>5 align by device;", + "SELECT max_time(s1), count(s1), last_value(s2), count(s1)+last_value(s3) FROM root.db2.** where s3+1=1316 or s2=false having avg(s1)+sum(s3)>5 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),count(s2),first_value(s3)"}; retArray = new String[] { - "root.sg1.d1,1314000000000,13.14,3,2,", - "root.sg1.d2,1314000000001,13.15,4,11,", - "root.sg1.d3,1314000000002,13.16,3,44,", - "root.sg1.d4,1314000000003,13.14,4,1111,", + "root.db1.d1,1314000000000,13.14,3,2,", + "root.db1.d2,1314000000001,13.15,4,11,", + "root.db1.d3,1314000000002,13.16,3,44,", + "root.db1.d4,1314000000003,13.14,4,1111,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.sg1.** where s3>1 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.db1.** where s3>1 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,1314000000000,13.14,3,2,", - "root.sg2.d2,1314000000001,13.15,4,11,", - "root.sg2.d3,1314000000002,13.16,3,44,", - "root.sg2.d4,1314000000003,13.14,4,1111,", + "root.db2.d1,1314000000000,13.14,3,2,", + "root.db2.d2,1314000000001,13.15,4,11,", + "root.db2.d3,1314000000002,13.16,3,44,", + "root.db2.d4,1314000000003,13.14,4,1111,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.sg2.** where s3>1 align by device;", + "SELECT max_time(s1), last_value(s1), count(s2), first_value(s3) FROM root.db2.** where s3>1 align by device;", expectedHeader, retArray); } @@ -267,33 +267,33 @@ public void countTimeTest() { String[] expectedHeader = new String[] {"Device,count_time(*)"}; String[] retArray = new String[] { - "root.sg1.d1,4,", "root.sg1.d2,4,", "root.sg1.d3,4,", "root.sg1.d4,4,", + "root.db1.d1,4,", "root.db1.d2,4,", "root.db1.d3,4,", "root.db1.d4,4,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg1.** align by device;", expectedHeader, retArray); + "SELECT count_time(*) FROM root.db1.** align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,4,", "root.sg2.d2,4,", "root.sg2.d3,4,", "root.sg2.d4,4,", + "root.db2.d1,4,", "root.db2.d2,4,", "root.db2.d3,4,", "root.db2.d4,4,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg2.** align by device;", expectedHeader, retArray); + "SELECT count_time(*) FROM root.db2.** align by device;", expectedHeader, retArray); // and filter expectedHeader = new String[] {"Device,count_time(*)"}; retArray = new String[] { - "root.sg1.d1,2,", "root.sg1.d2,4,", "root.sg1.d3,2,", "root.sg1.d4,1,", + "root.db1.d1,2,", "root.db1.d2,4,", "root.db1.d3,2,", "root.db1.d4,1,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg1.** where s3>0 and s2=false align by device;", + "SELECT count_time(*) FROM root.db1.** where s3>0 and s2=false align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,2,", "root.sg2.d2,4,", "root.sg2.d3,2,", "root.sg2.d4,1,", + "root.db2.d1,2,", "root.db2.d2,4,", "root.db2.d3,2,", "root.db2.d4,1,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg2.** where s3>0 and s2=false align by device;", + "SELECT count_time(*) FROM root.db2.** where s3>0 and s2=false align by device;", expectedHeader, retArray); @@ -301,18 +301,18 @@ public void countTimeTest() { expectedHeader = new String[] {"Device,count_time(*)"}; retArray = new String[] { - "root.sg1.d1,2,", "root.sg1.d2,4,", "root.sg1.d3,2,", "root.sg1.d4,1,", + "root.db1.d1,2,", "root.db1.d2,4,", "root.db1.d3,2,", "root.db1.d4,1,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg1.** where s3+1=1316 or s2=false align by device;", + "SELECT count_time(*) FROM root.db1.** where s3+1=1316 or s2=false align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,2,", "root.sg2.d2,4,", "root.sg2.d3,2,", "root.sg2.d4,1,", + "root.db2.d1,2,", "root.db2.d2,4,", "root.db2.d3,2,", "root.db2.d4,1,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg2.** where s3+1=1316 or s2=false align by device;", + "SELECT count_time(*) FROM root.db2.** where s3+1=1316 or s2=false align by device;", expectedHeader, retArray); @@ -320,33 +320,33 @@ public void countTimeTest() { expectedHeader = new String[] {"Time,Device,count_time(*)"}; retArray = new String[] { - "1,root.sg1.d1,2,", - "6,root.sg1.d1,0,", - "1,root.sg1.d2,3,", - "6,root.sg1.d2,0,", - "1,root.sg1.d3,0,", - "6,root.sg1.d3,1,", - "1,root.sg1.d4,1,", - "6,root.sg1.d4,0,", + "1,root.db1.d1,2,", + "6,root.db1.d1,0,", + "1,root.db1.d2,3,", + "6,root.db1.d2,0,", + "1,root.db1.d3,0,", + "6,root.db1.d3,1,", + "1,root.db1.d4,1,", + "6,root.db1.d4,0,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg1.** where s3+1=1316 or s2=false group by ([1,10), 5ms) align by device;", + "SELECT count_time(*) FROM root.db1.** where s3+1=1316 or s2=false group by ([1,10), 5ms) align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,count_time(*)"}; retArray = new String[] { - "1,root.sg2.d1,2,", - "6,root.sg2.d1,0,", - "1,root.sg2.d2,3,", - "6,root.sg2.d2,0,", - "1,root.sg2.d3,0,", - "6,root.sg2.d3,1,", - "1,root.sg2.d4,1,", - "6,root.sg2.d4,0,", + "1,root.db2.d1,2,", + "6,root.db2.d1,0,", + "1,root.db2.d2,3,", + "6,root.db2.d2,0,", + "1,root.db2.d3,0,", + "6,root.db2.d3,1,", + "1,root.db2.d4,1,", + "6,root.db2.d4,0,", }; resultSetEqualTest( - "SELECT count_time(*) FROM root.sg2.** where s3+1=1316 or s2=false group by ([1,10), 5ms) align by device;", + "SELECT count_time(*) FROM root.db2.** where s3+1=1316 or s2=false group by ([1,10), 5ms) align by device;", expectedHeader, retArray); } @@ -357,27 +357,27 @@ public void groupByTest() { new String[] {"Time,Device,max_time(s1),last_value(s1),last_value(s2)"}; String[] retArray = new String[] { - "1,root.sg1.d1,2,2.2,false,", - "5,root.sg1.d1,5,5.5,true,", - "1,root.sg1.d2,2,22.2,false,", - "5,root.sg1.d2,5,50.0,false,", - "1,root.sg1.d3,1,111.1,true,", + "1,root.db1.d1,2,2.2,false,", + "5,root.db1.d1,5,5.5,true,", + "1,root.db1.d2,2,22.2,false,", + "5,root.db1.d2,5,50.0,false,", + "1,root.db1.d3,1,111.1,true,", }; resultSetEqualTest( - "select max_time(s1), last_value(s1), last_value(s2) from root.sg1.** group by ([1,10), 2ms) having last_value(s2) is not null limit 5 align by device;", + "select max_time(s1), last_value(s1), last_value(s2) from root.db1.** group by ([1,10), 2ms) having last_value(s2) is not null limit 5 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,max_time(s1),last_value(s1),last_value(s2)"}; retArray = new String[] { - "1,root.sg2.d1,2,2.2,false,", - "5,root.sg2.d1,5,5.5,true,", - "1,root.sg2.d2,2,22.2,false,", - "5,root.sg2.d2,5,50.0,false,", - "1,root.sg2.d3,1,111.1,true,", + "1,root.db2.d1,2,2.2,false,", + "5,root.db2.d1,5,5.5,true,", + "1,root.db2.d2,2,22.2,false,", + "5,root.db2.d2,5,50.0,false,", + "1,root.db2.d3,1,111.1,true,", }; resultSetEqualTest( - "select max_time(s1), last_value(s1), last_value(s2) from root.sg2.** group by ([1,10), 2ms) having last_value(s2) is not null limit 5 align by device;", + "select max_time(s1), last_value(s1), last_value(s2) from root.db2.** group by ([1,10), 2ms) having last_value(s2) is not null limit 5 align by device;", expectedHeader, retArray); @@ -385,31 +385,31 @@ public void groupByTest() { expectedHeader = new String[] {"Time,Device,max_time(s1),last_value(s1),last_value(s2)"}; retArray = new String[] { - "1,root.sg1.d1,2,2.2,false,", - "1,root.sg1.d2,2,22.2,false,", - "3,root.sg1.d2,5,50.0,false,", - "5,root.sg1.d2,5,50.0,false,", - "7,root.sg1.d3,8,8.8,false,", - "3,root.sg1.d4,5,5555.5,false,", - "5,root.sg1.d4,5,5555.5,false,", + "1,root.db1.d1,2,2.2,false,", + "1,root.db1.d2,2,22.2,false,", + "3,root.db1.d2,5,50.0,false,", + "5,root.db1.d2,5,50.0,false,", + "7,root.db1.d3,8,8.8,false,", + "3,root.db1.d4,5,5555.5,false,", + "5,root.db1.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg1.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db1.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,max_time(s1),last_value(s1),last_value(s2)"}; retArray = new String[] { - "1,root.sg2.d1,2,2.2,false,", - "1,root.sg2.d2,2,22.2,false,", - "3,root.sg2.d2,5,50.0,false,", - "5,root.sg2.d2,5,50.0,false,", - "7,root.sg2.d3,8,8.8,false,", - "3,root.sg2.d4,5,5555.5,false,", - "5,root.sg2.d4,5,5555.5,false,", + "1,root.db2.d1,2,2.2,false,", + "1,root.db2.d2,2,22.2,false,", + "3,root.db2.d2,5,50.0,false,", + "5,root.db2.d2,5,50.0,false,", + "7,root.db2.d3,8,8.8,false,", + "3,root.db2.d4,5,5555.5,false,", + "5,root.db2.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 align by device;", expectedHeader, retArray); } @@ -419,54 +419,54 @@ public void havingTest() { String[] expectedHeader = new String[] {"Device,max_time(s1),last_value(s1),last_value(s2)"}; String[] retArray = new String[] { - "root.sg1.d1,2,2.2,false,", - "root.sg1.d2,1314000000001,13.15,false,", - "root.sg1.d3,1314000000002,13.16,false,", - "root.sg1.d4,5,5555.5,false,", + "root.db1.d1,2,2.2,false,", + "root.db1.d2,1314000000001,13.15,false,", + "root.db1.d3,1314000000002,13.16,false,", + "root.db1.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg1.** where s2=false having avg(s3) > 1 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db1.** where s2=false having avg(s3) > 1 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,2,2.2,false,", - "root.sg2.d2,1314000000001,13.15,false,", - "root.sg2.d3,1314000000002,13.16,false,", - "root.sg2.d4,5,5555.5,false,", + "root.db2.d1,2,2.2,false,", + "root.db2.d2,1314000000001,13.15,false,", + "root.db2.d3,1314000000002,13.16,false,", + "root.db2.d4,5,5555.5,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** where s2=false having avg(s3) > 1 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** where s2=false having avg(s3) > 1 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg1.d1,2,2.2,false,", - "root.sg1.d2,1314000000001,13.15,false,", - "root.sg1.d3,1314000000002,13.16,false,", + "root.db1.d1,2,2.2,false,", + "root.db1.d2,1314000000001,13.15,false,", + "root.db1.d3,1314000000002,13.16,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg1.** where s2=false having count(s3)+count(s1) > 2 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db1.** where s2=false having count(s3)+count(s1) > 2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,2,2.2,false,", - "root.sg2.d2,1314000000001,13.15,false,", - "root.sg2.d3,1314000000002,13.16,false,", + "root.db2.d1,2,2.2,false,", + "root.db2.d2,1314000000001,13.15,false,", + "root.db2.d3,1314000000002,13.16,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** where s2=false having count(s3)+count(s1) > 2 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** where s2=false having count(s3)+count(s1) > 2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1314000000001,13.15,false,", + "root.db2.d2,1314000000001,13.15,false,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.sg2.** where s2=false having count(s3+s1) > 2 align by device;", + "SELECT max_time(s1), last_value(s1), last_value(s2) FROM root.db2.** where s2=false having count(s3+s1) > 2 align by device;", expectedHeader, retArray); } @@ -476,65 +476,65 @@ public void orderByTest() { String[] expectedHeader = new String[] {"Time,Device,sum(s3)"}; String[] retArray = new String[] { - "4,root.sg1.d1,5.0,", - "4,root.sg1.d2,5.0,", - "4,root.sg1.d3,44.0,", - "4,root.sg1.d4,5555.0,", - "2,root.sg1.d1,2.0,", + "4,root.db1.d1,5.0,", + "4,root.db1.d2,5.0,", + "4,root.db1.d3,44.0,", + "4,root.db1.d4,5555.0,", + "2,root.db1.d1,2.0,", }; resultSetEqualTest( - "select sum(s3) from root.sg1.** where s1>1 GROUP BY([0, 10), 2ms) order by time desc offset 8 limit 5 align by device;", + "select sum(s3) from root.db1.** where s1>1 GROUP BY([0, 10), 2ms) order by time desc offset 8 limit 5 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,sum(s3)"}; retArray = new String[] { - "4,root.sg2.d1,5.0,", - "4,root.sg2.d2,5.0,", - "4,root.sg2.d3,44.0,", - "4,root.sg2.d4,5555.0,", - "2,root.sg2.d1,2.0,", + "4,root.db2.d1,5.0,", + "4,root.db2.d2,5.0,", + "4,root.db2.d3,44.0,", + "4,root.db2.d4,5555.0,", + "2,root.db2.d1,2.0,", }; resultSetEqualTest( - "select sum(s3) from root.sg2.** where s1>1 GROUP BY([0, 10), 2ms) order by time desc offset 8 limit 5 align by device;", + "select sum(s3) from root.db2.** where s1>1 GROUP BY([0, 10), 2ms) order by time desc offset 8 limit 5 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,sum(s3)"}; retArray = new String[] { - "0,root.sg1.d1,1.0,", - "2,root.sg1.d1,2.0,", - "4,root.sg1.d1,5.0,", - "0,root.sg1.d2,11.0,", - "2,root.sg1.d2,22.0,", + "0,root.db1.d1,1.0,", + "2,root.db1.d1,2.0,", + "4,root.db1.d1,5.0,", + "0,root.db1.d2,11.0,", + "2,root.db1.d2,22.0,", }; resultSetEqualTest( - "select sum(s3) from root.sg1.** where s1>1 GROUP BY([0, 10), 2ms) order by count(s2) desc limit 5 align by device;", + "select sum(s3) from root.db1.** where s1>1 GROUP BY([0, 10), 2ms) order by count(s2) desc limit 5 align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,sum(s3)"}; retArray = new String[] { - "0,root.sg2.d1,1.0,", - "2,root.sg2.d1,2.0,", - "4,root.sg2.d1,5.0,", - "0,root.sg2.d2,11.0,", - "2,root.sg2.d2,22.0,", + "0,root.db2.d1,1.0,", + "2,root.db2.d1,2.0,", + "4,root.db2.d1,5.0,", + "0,root.db2.d2,11.0,", + "2,root.db2.d2,22.0,", }; resultSetEqualTest( - "select sum(s3) from root.sg2.** where s1>1 GROUP BY([0, 10), 2ms) order by count(s2) desc limit 5 align by device;", + "select sum(s3) from root.db2.** where s1>1 GROUP BY([0, 10), 2ms) order by count(s2) desc limit 5 align by device;", expectedHeader, retArray); // order by non-existent measurement assertTestFail( - "select sum(s3) from root.sg1.** where s1>1 order by count(s_null) desc limit 5 align by device;", + "select sum(s3) from root.db1.** where s1>1 order by count(s_null) desc limit 5 align by device;", "count(s_null) in order by clause doesn't exist."); assertTestFail( - "select sum(s3) from root.sg2.** where s1>1 order by count(s_null) desc limit 5 align by device;", + "select sum(s3) from root.db2.** where s1>1 order by count(s_null) desc limit 5 align by device;", "count(s_null) in order by clause doesn't exist."); } @@ -546,24 +546,24 @@ public void wildCardTest() { }; String[] retArray = new String[] { - "root.sg1.d1,1314000000000,1314000000000,1314000000000,13.14,1314,13.14,true,", - "root.sg1.d2,1314000000001,1314000000001,1314000000001,13.15,1315,13.15,false,", - "root.sg1.d3,1314000000002,1314000000002,1314000000002,13.16,1316,13.16,false,", - "root.sg1.d4,1314000000003,1314000000003,1314000000003,13.14,1314,13.14,true,", + "root.db1.d1,1314000000000,1314000000000,1314000000000,13.14,1314,13.14,true,", + "root.db1.d2,1314000000001,1314000000001,1314000000001,13.15,1315,13.15,false,", + "root.db1.d3,1314000000002,1314000000002,1314000000002,13.16,1316,13.16,false,", + "root.db1.d4,1314000000003,1314000000003,1314000000003,13.14,1314,13.14,true,", }; resultSetEqualTest( - "SELECT max_time(*), last_value(s1), last_value(*) FROM root.sg1.** align by device;", + "SELECT max_time(*), last_value(s1), last_value(*) FROM root.db1.** align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,1314000000000,1314000000000,1314000000000,13.14,1314,13.14,true,", - "root.sg2.d2,1314000000001,1314000000001,1314000000001,13.15,1315,13.15,false,", - "root.sg2.d3,1314000000002,1314000000002,1314000000002,13.16,1316,13.16,false,", - "root.sg2.d4,1314000000003,1314000000003,1314000000003,13.14,1314,13.14,true,", + "root.db2.d1,1314000000000,1314000000000,1314000000000,13.14,1314,13.14,true,", + "root.db2.d2,1314000000001,1314000000001,1314000000001,13.15,1315,13.15,false,", + "root.db2.d3,1314000000002,1314000000002,1314000000002,13.16,1316,13.16,false,", + "root.db2.d4,1314000000003,1314000000003,1314000000003,13.14,1314,13.14,true,", }; resultSetEqualTest( - "SELECT max_time(*), last_value(s1), last_value(*) FROM root.sg2.** align by device;", + "SELECT max_time(*), last_value(s1), last_value(*) FROM root.db2.** align by device;", expectedHeader, retArray); @@ -572,24 +572,24 @@ public void wildCardTest() { new String[] {"Device,max_time(s1),last_value(s3),last_value(s1),last_value(s2),count(s2)"}; retArray = new String[] { - "root.sg1.d1,1314000000000,1314,13.14,true,3,", - "root.sg1.d2,1314000000001,1315,13.15,false,4,", - "root.sg1.d3,1314000000002,1316,13.16,false,3,", - "root.sg1.d4,1314000000003,1314,13.14,true,4,", + "root.db1.d1,1314000000000,1314,13.14,true,3,", + "root.db1.d2,1314000000001,1315,13.15,false,4,", + "root.db1.d3,1314000000002,1316,13.16,false,3,", + "root.db1.d4,1314000000003,1314,13.14,true,4,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(*), count(s2) FROM root.sg1.** where s3>1 align by device;", + "SELECT max_time(s1), last_value(*), count(s2) FROM root.db1.** where s3>1 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d1,1314000000000,1314,13.14,true,3,", - "root.sg2.d2,1314000000001,1315,13.15,false,4,", - "root.sg2.d3,1314000000002,1316,13.16,false,3,", - "root.sg2.d4,1314000000003,1314,13.14,true,4,", + "root.db2.d1,1314000000000,1314,13.14,true,3,", + "root.db2.d2,1314000000001,1315,13.15,false,4,", + "root.db2.d3,1314000000002,1316,13.16,false,3,", + "root.db2.d4,1314000000003,1314,13.14,true,4,", }; resultSetEqualTest( - "SELECT max_time(s1), last_value(*), count(s2) FROM root.sg2.** where s3>1 align by device;", + "SELECT max_time(s1), last_value(*), count(s2) FROM root.db2.** where s3>1 align by device;", expectedHeader, retArray); @@ -597,30 +597,30 @@ public void wildCardTest() { expectedHeader = new String[] {"Time,Device,last_value(s1),last_value(s2)"}; retArray = new String[] { - "1,root.sg1.d1,2.2,false,", - "1,root.sg1.d2,22.2,false,", - "3,root.sg1.d2,50.0,false,", - "5,root.sg1.d2,50.0,false,", - "7,root.sg1.d3,8.8,false,", - "3,root.sg1.d4,5555.5,false,", - "5,root.sg1.d4,5555.5,false,", + "1,root.db1.d1,2.2,false,", + "1,root.db1.d2,22.2,false,", + "3,root.db1.d2,50.0,false,", + "5,root.db1.d2,50.0,false,", + "7,root.db1.d3,8.8,false,", + "3,root.db1.d4,5555.5,false,", + "5,root.db1.d4,5555.5,false,", }; resultSetEqualTest( - "SELECT last_value(*) FROM root.sg1.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 soffset 1 slimit 2 align by device;", + "SELECT last_value(*) FROM root.db1.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 soffset 1 slimit 2 align by device;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,2.2,false,", - "1,root.sg2.d2,22.2,false,", - "3,root.sg2.d2,50.0,false,", - "5,root.sg2.d2,50.0,false,", - "7,root.sg2.d3,8.8,false,", - "3,root.sg2.d4,5555.5,false,", - "5,root.sg2.d4,5555.5,false,", + "1,root.db2.d1,2.2,false,", + "1,root.db2.d2,22.2,false,", + "3,root.db2.d2,50.0,false,", + "5,root.db2.d2,50.0,false,", + "7,root.db2.d3,8.8,false,", + "3,root.db2.d4,5555.5,false,", + "5,root.db2.d4,5555.5,false,", }; resultSetEqualTest( - "SELECT last_value(*) FROM root.sg2.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 soffset 1 slimit 2 align by device;", + "SELECT last_value(*) FROM root.db2.** where s3+1=1316 or s2=false group by ([1,10),3ms,2ms) having avg(s1)>0 soffset 1 slimit 2 align by device;", expectedHeader, retArray); @@ -631,18 +631,18 @@ public void wildCardTest() { }; retArray = new String[] { - "root.sg1.d2,1315,13.15,false,11,11.1,false,", + "root.db1.d2,1315,13.15,false,11,11.1,false,", }; resultSetEqualTest( - "SELECT last_value(*), first_value(*) FROM root.sg1.** where s2=false having count(s3+s1) > 2 align by device;", + "SELECT last_value(*), first_value(*) FROM root.db1.** where s2=false having count(s3+s1) > 2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,1315,13.15,false,11,11.1,false,", + "root.db2.d2,1315,13.15,false,11,11.1,false,", }; resultSetEqualTest( - "SELECT last_value(*), first_value(*) FROM root.sg2.** where s2=false having count(s3+s1) > 2 align by device;", + "SELECT last_value(*), first_value(*) FROM root.db2.** where s2=false having count(s3+s1) > 2 align by device;", expectedHeader, retArray); @@ -650,18 +650,18 @@ public void wildCardTest() { expectedHeader = new String[] {"Device,count(s3) + 1,count(s1) + 1,count(s2) + 1"}; retArray = new String[] { - "root.sg1.d2,5.0,5.0,5.0,", + "root.db1.d2,5.0,5.0,5.0,", }; resultSetEqualTest( - "SELECT count(*)+1 FROM root.sg1.** where s2=false having count(s3+s1) > 2 align by device;", + "SELECT count(*)+1 FROM root.db1.** where s2=false having count(s3+s1) > 2 align by device;", expectedHeader, retArray); retArray = new String[] { - "root.sg2.d2,5.0,5.0,5.0,", + "root.db2.d2,5.0,5.0,5.0,", }; resultSetEqualTest( - "SELECT count(*)+1 FROM root.sg2.** where s2=false having count(s3+s1) > 2 align by device;", + "SELECT count(*)+1 FROM root.db2.** where s2=false having count(s3+s1) > 2 align by device;", expectedHeader, retArray); } @@ -671,16 +671,16 @@ public void orderByTimeWithDeleteTest() { String[] expectedHeader = new String[] {"Device,count(s1)"}; String[] retArray = new String[] { - "root.sg3.d1,1,", "root.sg3.d2,4,", "root.sg3.d3,4,", "root.sg3.d4,4,", + "root.db3.d1,1,", "root.db3.d2,4,", "root.db3.d3,4,", "root.db3.d4,4,", }; resultSetEqualTest( - "select count(s1) from root.sg3.** order by device align by device;", + "select count(s1) from root.db3.** order by device align by device;", expectedHeader, retArray); // to test visitSingeDeviceViewNode in AggregationPushDown resultSetEqualTest( - "select count(s1) from root.sg3.** order by time align by device;", + "select count(s1) from root.db3.** order by time align by device;", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateIT.java index 82758290dbbc8..d560debee81bf 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBAlignByDeviceWithTemplateIT.java @@ -41,22 +41,22 @@ public class IoTDBAlignByDeviceWithTemplateIT { private static final String[] sqls = new String[] { // non-aligned template - "CREATE database root.sg1;", + "CREATE database root.db1;", "CREATE schema template t1 (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t1 to root.sg1;", - "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", - "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", - "INSERT INTO root.sg1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", - "INSERT INTO root.sg1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", + "SET SCHEMA TEMPLATE t1 to root.db1;", + "INSERT INTO root.db1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", + "INSERT INTO root.db1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", + "INSERT INTO root.db1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", + "INSERT INTO root.db1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", // aligned template - "CREATE database root.sg2;", + "CREATE database root.db2;", "CREATE schema template t2 aligned (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t2 to root.sg2;", - "INSERT INTO root.sg2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", - "INSERT INTO root.sg2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", - "INSERT INTO root.sg2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", + "SET SCHEMA TEMPLATE t2 to root.db2;", + "INSERT INTO root.db2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", + "INSERT INTO root.db2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", + "INSERT INTO root.db2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", }; String[] expectedHeader; @@ -78,18 +78,18 @@ public void singleDeviceTest() { expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; retArray = new String[] { - "1,root.sg1.d1,1,1.1,false,", + "1,root.db1.d1,1,1.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.d1 order by time desc offset 1 limit 1 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.d1 order by time desc offset 1 limit 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1,1.1,false,", + "1,root.db2.d1,1,1.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.d1 order by time desc offset 1 limit 1 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.d1 order by time desc offset 1 limit 1 ALIGN BY DEVICE;", expectedHeader, retArray); } @@ -100,76 +100,76 @@ public void selectWildcardNoFilterTest() { expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; retArray = new String[] { - "1,root.sg1.d1,1,1.1,false,", - "2,root.sg1.d1,2,2.2,false,", - "1,root.sg1.d2,11,11.1,false,", - "2,root.sg1.d2,22,22.2,false,", - "1,root.sg1.d3,null,111.1,true,", - "4,root.sg1.d3,44,444.4,true,", - "1,root.sg1.d4,1111,1111.1,true,", - "5,root.sg1.d4,5555,5555.5,false,", + "1,root.db1.d1,1,1.1,false,", + "2,root.db1.d1,2,2.2,false,", + "1,root.db1.d2,11,11.1,false,", + "2,root.db1.d2,22,22.2,false,", + "1,root.db1.d3,null,111.1,true,", + "4,root.db1.d3,44,444.4,true,", + "1,root.db1.d4,1111,1111.1,true,", + "5,root.db1.d4,5555,5555.5,false,", }; - resultSetEqualTest("SELECT * FROM root.sg1.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT * FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1,1.1,false,", - "2,root.sg2.d1,2,2.2,false,", - "1,root.sg2.d2,11,11.1,false,", - "2,root.sg2.d2,22,22.2,false,", - "1,root.sg2.d3,null,111.1,true,", - "4,root.sg2.d3,44,444.4,true,", - "1,root.sg2.d4,1111,1111.1,true,", - "5,root.sg2.d4,5555,5555.5,false,", + "1,root.db2.d1,1,1.1,false,", + "2,root.db2.d1,2,2.2,false,", + "1,root.db2.d2,11,11.1,false,", + "2,root.db2.d2,22,22.2,false,", + "1,root.db2.d3,null,111.1,true,", + "4,root.db2.d3,44,444.4,true,", + "1,root.db2.d4,1111,1111.1,true,", + "5,root.db2.d4,5555,5555.5,false,", }; - resultSetEqualTest("SELECT * FROM root.sg2.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT * FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,s3,s1,s2,s1"}; retArray = new String[] { - "1,root.sg1.d1,1,1.1,false,1.1,", - "2,root.sg1.d1,2,2.2,false,2.2,", - "1,root.sg1.d2,11,11.1,false,11.1,", - "2,root.sg1.d2,22,22.2,false,22.2,", - "1,root.sg1.d3,null,111.1,true,111.1,", - "4,root.sg1.d3,44,444.4,true,444.4,", - "1,root.sg1.d4,1111,1111.1,true,1111.1,", - "5,root.sg1.d4,5555,5555.5,false,5555.5,", + "1,root.db1.d1,1,1.1,false,1.1,", + "2,root.db1.d1,2,2.2,false,2.2,", + "1,root.db1.d2,11,11.1,false,11.1,", + "2,root.db1.d2,22,22.2,false,22.2,", + "1,root.db1.d3,null,111.1,true,111.1,", + "4,root.db1.d3,44,444.4,true,444.4,", + "1,root.db1.d4,1111,1111.1,true,1111.1,", + "5,root.db1.d4,5555,5555.5,false,5555.5,", }; - resultSetEqualTest("SELECT *, s1 FROM root.sg1.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT *, s1 FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1,1.1,false,1.1,", - "2,root.sg2.d1,2,2.2,false,2.2,", - "1,root.sg2.d2,11,11.1,false,11.1,", - "2,root.sg2.d2,22,22.2,false,22.2,", - "1,root.sg2.d3,null,111.1,true,111.1,", - "4,root.sg2.d3,44,444.4,true,444.4,", - "1,root.sg2.d4,1111,1111.1,true,1111.1,", - "5,root.sg2.d4,5555,5555.5,false,5555.5,", + "1,root.db2.d1,1,1.1,false,1.1,", + "2,root.db2.d1,2,2.2,false,2.2,", + "1,root.db2.d2,11,11.1,false,11.1,", + "2,root.db2.d2,22,22.2,false,22.2,", + "1,root.db2.d3,null,111.1,true,111.1,", + "4,root.db2.d3,44,444.4,true,444.4,", + "1,root.db2.d4,1111,1111.1,true,1111.1,", + "5,root.db2.d4,5555,5555.5,false,5555.5,", }; - resultSetEqualTest("SELECT *, s1 FROM root.sg2.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT *, s1 FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; retArray = new String[] { - "1,root.sg1.d1,1,1.1,false,", - "2,root.sg1.d1,2,2.2,false,", - "1,root.sg1.d2,11,11.1,false,", - "2,root.sg1.d2,22,22.2,false,", + "1,root.db1.d1,1,1.1,false,", + "2,root.db1.d1,2,2.2,false,", + "1,root.db1.d2,11,11.1,false,", + "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.d1,root.sg1.d2,root.sg1.d6 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.d1,root.db1.d2,root.db1.d6 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1,1.1,false,", - "2,root.sg2.d1,2,2.2,false,", - "1,root.sg2.d2,11,11.1,false,", - "2,root.sg2.d2,22,22.2,false,", + "1,root.db2.d1,1,1.1,false,", + "2,root.db2.d1,2,2.2,false,", + "1,root.db2.d2,11,11.1,false,", + "2,root.db2.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.d1,root.sg2.d2,root.sg2.d6 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.d1,root.db2.d2,root.db2.d6 ALIGN BY DEVICE;", expectedHeader, retArray); @@ -177,65 +177,65 @@ public void selectWildcardNoFilterTest() { expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; retArray = new String[] { - "2,root.sg1.d1,2,2.2,false,", "1,root.sg1.d2,11,11.1,false,", + "2,root.db1.d1,2,2.2,false,", "1,root.db1.d2,11,11.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db1.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg2.d1,2,2.2,false,", "1,root.sg2.d2,11,11.1,false,", + "2,root.db2.d1,2,2.2,false,", "1,root.db2.d2,11,11.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db2.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); // 3. order by time retArray = new String[] { - "5,root.sg1.d4,5555,5555.5,false,", - "4,root.sg1.d3,44,444.4,true,", - "2,root.sg1.d1,2,2.2,false,", - "2,root.sg1.d2,22,22.2,false,", - "1,root.sg1.d1,1,1.1,false,", - "1,root.sg1.d2,11,11.1,false,", - "1,root.sg1.d3,null,111.1,true,", - "1,root.sg1.d4,1111,1111.1,true,", + "5,root.db1.d4,5555,5555.5,false,", + "4,root.db1.d3,44,444.4,true,", + "2,root.db1.d1,2,2.2,false,", + "2,root.db1.d2,22,22.2,false,", + "1,root.db1.d1,1,1.1,false,", + "1,root.db1.d2,11,11.1,false,", + "1,root.db1.d3,null,111.1,true,", + "1,root.db1.d4,1111,1111.1,true,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db1.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,5555.5,false,", - "4,root.sg2.d3,44,444.4,true,", - "2,root.sg2.d1,2,2.2,false,", - "2,root.sg2.d2,22,22.2,false,", - "1,root.sg2.d1,1,1.1,false,", - "1,root.sg2.d2,11,11.1,false,", - "1,root.sg2.d3,null,111.1,true,", - "1,root.sg2.d4,1111,1111.1,true,", + "5,root.db2.d4,5555,5555.5,false,", + "4,root.db2.d3,44,444.4,true,", + "2,root.db2.d1,2,2.2,false,", + "2,root.db2.d2,22,22.2,false,", + "1,root.db2.d1,1,1.1,false,", + "1,root.db2.d2,11,11.1,false,", + "1,root.db2.d3,null,111.1,true,", + "1,root.db2.d4,1111,1111.1,true,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db2.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); // 4. order by time + limit/offset retArray = new String[] { - "5,root.sg1.d4,5555,5555.5,false,", "4,root.sg1.d3,44,444.4,true,", - "2,root.sg1.d1,2,2.2,false,", "2,root.sg1.d2,22,22.2,false,", + "5,root.db1.d4,5555,5555.5,false,", "4,root.db1.d3,44,444.4,true,", + "2,root.db1.d1,2,2.2,false,", "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,5555.5,false,", "4,root.sg2.d3,44,444.4,true,", - "2,root.sg2.d1,2,2.2,false,", "2,root.sg2.d2,22,22.2,false,", + "5,root.db2.d4,5555,5555.5,false,", "4,root.db2.d3,44,444.4,true,", + "2,root.db2.d1,2,2.2,false,", "2,root.db2.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); } @@ -246,104 +246,104 @@ public void selectMeasurementNoFilterTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s1"}; String[] retArray = new String[] { - "1,root.sg1.d1,1,1.1,", - "2,root.sg1.d1,2,2.2,", - "1,root.sg1.d2,11,11.1,", - "2,root.sg1.d2,22,22.2,", - "1,root.sg1.d3,null,111.1,", - "4,root.sg1.d3,44,444.4,", - "1,root.sg1.d4,1111,1111.1,", - "5,root.sg1.d4,5555,5555.5,", + "1,root.db1.d1,1,1.1,", + "2,root.db1.d1,2,2.2,", + "1,root.db1.d2,11,11.1,", + "2,root.db1.d2,22,22.2,", + "1,root.db1.d3,null,111.1,", + "4,root.db1.d3,44,444.4,", + "1,root.db1.d4,1111,1111.1,", + "5,root.db1.d4,5555,5555.5,", }; - resultSetEqualTest("SELECT s3,s1 FROM root.sg1.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT s3,s1 FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT s3,s1,s_null FROM root.sg1.** ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT s3,s1,s_null FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1,1.1,", - "2,root.sg2.d1,2,2.2,", - "1,root.sg2.d2,11,11.1,", - "2,root.sg2.d2,22,22.2,", - "1,root.sg2.d3,null,111.1,", - "4,root.sg2.d3,44,444.4,", - "1,root.sg2.d4,1111,1111.1,", - "5,root.sg2.d4,5555,5555.5,", + "1,root.db2.d1,1,1.1,", + "2,root.db2.d1,2,2.2,", + "1,root.db2.d2,11,11.1,", + "2,root.db2.d2,22,22.2,", + "1,root.db2.d3,null,111.1,", + "4,root.db2.d3,44,444.4,", + "1,root.db2.d4,1111,1111.1,", + "5,root.db2.d4,5555,5555.5,", }; - resultSetEqualTest("SELECT s3,s1 FROM root.sg2.** ALIGN BY DEVICE;", expectedHeader, retArray); + resultSetEqualTest("SELECT s3,s1 FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT s3,s1,s_null FROM root.sg2.** ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT s3,s1,s_null FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); // 2. order by device + limit/offset retArray = new String[] { - "2,root.sg1.d1,2,2.2,", "1,root.sg1.d2,11,11.1,", + "2,root.db1.d1,2,2.2,", "1,root.db1.d2,11,11.1,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg1.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db1.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg2.d1,2,2.2,", "1,root.sg2.d2,11,11.1,", + "2,root.db2.d1,2,2.2,", "1,root.db2.d2,11,11.1,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg2.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db2.** OFFSET 1 LIMIT 2 ALIGN BY DEVICE;", expectedHeader, retArray); // 3. order by time retArray = new String[] { - "5,root.sg1.d4,5555,5555.5,", - "4,root.sg1.d3,44,444.4,", - "2,root.sg1.d1,2,2.2,", - "2,root.sg1.d2,22,22.2,", - "1,root.sg1.d1,1,1.1,", - "1,root.sg1.d2,11,11.1,", - "1,root.sg1.d3,null,111.1,", - "1,root.sg1.d4,1111,1111.1,", + "5,root.db1.d4,5555,5555.5,", + "4,root.db1.d3,44,444.4,", + "2,root.db1.d1,2,2.2,", + "2,root.db1.d2,22,22.2,", + "1,root.db1.d1,1,1.1,", + "1,root.db1.d2,11,11.1,", + "1,root.db1.d3,null,111.1,", + "1,root.db1.d4,1111,1111.1,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg1.** ORDER BY TIME DESC ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db1.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,5555.5,", - "4,root.sg2.d3,44,444.4,", - "2,root.sg2.d1,2,2.2,", - "2,root.sg2.d2,22,22.2,", - "1,root.sg2.d1,1,1.1,", - "1,root.sg2.d2,11,11.1,", - "1,root.sg2.d3,null,111.1,", - "1,root.sg2.d4,1111,1111.1,", + "5,root.db2.d4,5555,5555.5,", + "4,root.db2.d3,44,444.4,", + "2,root.db2.d1,2,2.2,", + "2,root.db2.d2,22,22.2,", + "1,root.db2.d1,1,1.1,", + "1,root.db2.d2,11,11.1,", + "1,root.db2.d3,null,111.1,", + "1,root.db2.d4,1111,1111.1,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg2.** ORDER BY TIME DESC ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db2.** ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); // 4. order by time + limit/offset retArray = new String[] { - "5,root.sg1.d4,5555,5555.5,", "4,root.sg1.d3,44,444.4,", - "2,root.sg1.d1,2,2.2,", "2,root.sg1.d2,22,22.2,", + "5,root.db1.d4,5555,5555.5,", "4,root.db1.d3,44,444.4,", + "2,root.db1.d1,2,2.2,", "2,root.db1.d2,22,22.2,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg1.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db1.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,5555.5,", "4,root.sg2.d3,44,444.4,", - "2,root.sg2.d1,2,2.2,", "2,root.sg2.d2,22,22.2,", + "5,root.db2.d4,5555,5555.5,", "4,root.db2.d3,44,444.4,", + "2,root.db2.d1,2,2.2,", "2,root.db2.d2,22,22.2,", }; resultSetEqualTest( - "SELECT s3,s1 FROM root.sg2.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s1 FROM root.db2.** ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); } @@ -354,45 +354,45 @@ public void selectWildcardWithFilterOrderByTimeTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; String[] retArray = new String[] { - "4,root.sg1.d3,44,444.4,true,", - "2,root.sg1.d1,2,2.2,false,", - "2,root.sg1.d2,22,22.2,false,", - "1,root.sg1.d1,1,1.1,false,", + "4,root.db1.d3,44,444.4,true,", + "2,root.db1.d1,2,2.2,false,", + "2,root.db1.d2,22,22.2,false,", + "1,root.db1.d1,1,1.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,444.4,true,", - "2,root.sg2.d1,2,2.2,false,", - "2,root.sg2.d2,22,22.2,false,", - "1,root.sg2.d1,1,1.1,false,", + "4,root.db2.d3,44,444.4,true,", + "2,root.db2.d1,2,2.2,false,", + "2,root.db2.d2,22,22.2,false,", + "1,root.db2.d1,1,1.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); // 2. order by time + time filter + value filter retArray = new String[] { - "4,root.sg1.d3,44,444.4,true,", "2,root.sg1.d2,22,22.2,false,", + "4,root.db1.d3,44,444.4,true,", "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT * FROM root.db1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,444.4,true,", "2,root.sg2.d2,22,22.2,false,", + "4,root.db2.d3,44,444.4,true,", "2,root.db2.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT * FROM root.db2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); @@ -400,29 +400,29 @@ public void selectWildcardWithFilterOrderByTimeTest() { // 3. order by time + value filter: s_null > 1 retArray = new String[] {}; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg1.d3,44,444.4,true,", "2,root.sg1.d2,22,22.2,false,", + "4,root.db1.d3,44,444.4,true,", "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE s_null > 1 or " + "SELECT * FROM root.db1.** WHERE s_null > 1 or " + "(time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,444.4,true,", "2,root.sg2.d2,22,22.2,false,", + "4,root.db2.d3,44,444.4,true,", "2,root.db2.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE s_null > 1 or " + "SELECT * FROM root.db2.** WHERE s_null > 1 or " + "(time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); @@ -434,45 +434,45 @@ public void selectWildcardWithFilterOrderByDeviceTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; String[] retArray = new String[] { - "1,root.sg1.d4,1111,1111.1,true,", - "1,root.sg1.d3,null,111.1,true,", - "4,root.sg1.d3,44,444.4,true,", - "1,root.sg1.d2,11,11.1,false,", + "1,root.db1.d4,1111,1111.1,true,", + "1,root.db1.d3,null,111.1,true,", + "4,root.db1.d3,44,444.4,true,", + "1,root.db1.d2,11,11.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d4,1111,1111.1,true,", - "1,root.sg2.d3,null,111.1,true,", - "4,root.sg2.d3,44,444.4,true,", - "1,root.sg2.d2,11,11.1,false,", + "1,root.db2.d4,1111,1111.1,true,", + "1,root.db2.d3,null,111.1,true,", + "4,root.db2.d3,44,444.4,true,", + "1,root.db2.d2,11,11.1,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); // 2. order by device + time filter + value filter retArray = new String[] { - "4,root.sg1.d3,44,444.4,true,", "2,root.sg1.d2,22,22.2,false,", + "4,root.db1.d3,44,444.4,true,", "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT * FROM root.db1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY DEVICE DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg2.d2,22,22.2,false,", "4,root.sg2.d3,44,444.4,true,", + "2,root.db2.d2,22,22.2,false,", "4,root.db2.d3,44,444.4,true,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT * FROM root.db2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY DEVICE ALIGN BY DEVICE;", expectedHeader, retArray); @@ -480,29 +480,29 @@ public void selectWildcardWithFilterOrderByDeviceTest() { // 3. order by device + value filter: s_null > 1 retArray = new String[] {}; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg1.d3,44,444.4,true,", "2,root.sg1.d2,22,22.2,false,", + "4,root.db1.d3,44,444.4,true,", "2,root.db1.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** WHERE s_null > 1 or " + "SELECT * FROM root.db1.** WHERE s_null > 1 or " + "(time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) ORDER BY DEVICE DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,444.4,true,", "2,root.sg2.d2,22,22.2,false,", + "4,root.db2.d3,44,444.4,true,", "2,root.db2.d2,22,22.2,false,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** WHERE s_null > 1 or " + "SELECT * FROM root.db2.** WHERE s_null > 1 or " + "(time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) ORDER BY DEVICE DESC ALIGN BY DEVICE;", expectedHeader, retArray); @@ -514,45 +514,45 @@ public void selectMeasurementWithFilterOrderByTimeTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s2"}; String[] retArray = new String[] { - "4,root.sg1.d3,44,true,", - "2,root.sg1.d1,2,false,", - "2,root.sg1.d2,22,false,", - "1,root.sg1.d1,1,false,", + "4,root.db1.d3,44,true,", + "2,root.db1.d1,2,false,", + "2,root.db1.d2,22,false,", + "1,root.db1.d1,1,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db1.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,true,", - "2,root.sg2.d1,2,false,", - "2,root.sg2.d2,22,false,", - "1,root.sg2.d1,1,false,", + "4,root.db2.d3,44,true,", + "2,root.db2.d1,2,false,", + "2,root.db2.d2,22,false,", + "1,root.db2.d1,1,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db2.** WHERE time < 5 ORDER BY TIME DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); // 2. order by time + time filter + value filter retArray = new String[] { - "4,root.sg1.d3,44,true,", "2,root.sg1.d2,22,false,", + "4,root.db1.d3,44,true,", "2,root.db1.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT s3,s2 FROM root.db1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,true,", "2,root.sg2.d2,22,false,", + "4,root.db2.d3,44,true,", "2,root.db2.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT s3,s2 FROM root.db2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); @@ -560,30 +560,30 @@ public void selectMeasurementWithFilterOrderByTimeTest() { // 3. order by time + value filter: s_null > 1 retArray = new String[] {}; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db1.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db2.** WHERE s_null > 1 ORDER BY TIME ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg1.d2,22,false,", + "2,root.db1.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "SELECT s3,s2 FROM root.db1.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "ORDER BY TIME DESC OFFSET 1 LIMIT 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg2.d2,22,false,", + "2,root.db2.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "SELECT s3,s2 FROM root.db2.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "ORDER BY TIME DESC OFFSET 1 LIMIT 1 ALIGN BY DEVICE;", expectedHeader, retArray); @@ -595,45 +595,45 @@ public void selectMeasurementWithFilterOrderByDeviceTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s2"}; String[] retArray = new String[] { - "1,root.sg1.d4,1111,true,", - "1,root.sg1.d3,null,true,", - "4,root.sg1.d3,44,true,", - "1,root.sg1.d2,11,false,", + "1,root.db1.d4,1111,true,", + "1,root.db1.d3,null,true,", + "4,root.db1.d3,44,true,", + "1,root.db1.d2,11,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db1.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d4,1111,true,", - "1,root.sg2.d3,null,true,", - "4,root.sg2.d3,44,true,", - "1,root.sg2.d2,11,false,", + "1,root.db2.d4,1111,true,", + "1,root.db2.d3,null,true,", + "4,root.db2.d3,44,true,", + "1,root.db2.d2,11,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db2.** WHERE time < 5 ORDER BY DEVICE DESC LIMIT 4 ALIGN BY DEVICE;", expectedHeader, retArray); // 2. order by device + time filter + value filter retArray = new String[] { - "4,root.sg1.d3,44,true,", "2,root.sg1.d2,22,false,", + "4,root.db1.d3,44,true,", "2,root.db1.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT s3,s2 FROM root.db1.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY DEVICE DESC ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "4,root.sg2.d3,44,true,", "2,root.sg2.d2,22,false,", + "4,root.db2.d3,44,true,", "2,root.db2.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "SELECT s3,s2 FROM root.db2.** where time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1 " + "ORDER BY DEVICE DESC ALIGN BY DEVICE;", expectedHeader, retArray); @@ -641,30 +641,30 @@ public void selectMeasurementWithFilterOrderByDeviceTest() { // 3. order by device + value filter: s_null > 1 retArray = new String[] {}; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db1.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", + "SELECT s3,s2 FROM root.db2.** WHERE s_null > 1 ORDER BY DEVICE ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg1.d2,22,false,", + "2,root.db1.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg1.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "SELECT s3,s2 FROM root.db1.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "ORDER BY DEVICE DESC OFFSET 1 LIMIT 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "2,root.sg2.d2,22,false,", + "2,root.db2.d2,22,false,", }; resultSetEqualTest( - "SELECT s3,s2 FROM root.sg2.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "SELECT s3,s2 FROM root.db2.** where s_null > 1 or (time > 1 and time < 5 and s3>=11 and s3<=1111 and s1 != 11.1) " + "ORDER BY DEVICE DESC OFFSET 1 LIMIT 1 ALIGN BY DEVICE;", expectedHeader, retArray); @@ -675,66 +675,66 @@ public void aliasTest() { String[] expectedHeader = new String[] {"Time,Device,aa,bb,s3,s2"}; String[] retArray = new String[] { - "1,root.sg1.d1,1.1,false,1,false,", - "2,root.sg1.d1,2.2,false,2,false,", - "1,root.sg1.d2,11.1,false,11,false,", - "2,root.sg1.d2,22.2,false,22,false,", - "1,root.sg1.d3,111.1,true,null,true,", - "4,root.sg1.d3,444.4,true,44,true,", - "1,root.sg1.d4,1111.1,true,1111,true,", - "5,root.sg1.d4,5555.5,false,5555,false,", + "1,root.db1.d1,1.1,false,1,false,", + "2,root.db1.d1,2.2,false,2,false,", + "1,root.db1.d2,11.1,false,11,false,", + "2,root.db1.d2,22.2,false,22,false,", + "1,root.db1.d3,111.1,true,null,true,", + "4,root.db1.d3,444.4,true,44,true,", + "1,root.db1.d4,1111.1,true,1111,true,", + "5,root.db1.d4,5555.5,false,5555,false,", }; resultSetEqualTest( - "SELECT s1 as aa, s2 as bb, s3, s2 FROM root.sg1.** ALIGN BY DEVICE;", + "SELECT s1 as aa, s2 as bb, s3, s2 FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,aa,bb,s3,s2"}; retArray = new String[] { - "1,root.sg2.d1,1.1,false,1,false,", - "2,root.sg2.d1,2.2,false,2,false,", - "1,root.sg2.d2,11.1,false,11,false,", - "2,root.sg2.d2,22.2,false,22,false,", - "1,root.sg2.d3,111.1,true,null,true,", - "4,root.sg2.d3,444.4,true,44,true,", - "1,root.sg2.d4,1111.1,true,1111,true,", - "5,root.sg2.d4,5555.5,false,5555,false,", + "1,root.db2.d1,1.1,false,1,false,", + "2,root.db2.d1,2.2,false,2,false,", + "1,root.db2.d2,11.1,false,11,false,", + "2,root.db2.d2,22.2,false,22,false,", + "1,root.db2.d3,111.1,true,null,true,", + "4,root.db2.d3,444.4,true,44,true,", + "1,root.db2.d4,1111.1,true,1111,true,", + "5,root.db2.d4,5555.5,false,5555,false,", }; resultSetEqualTest( - "SELECT s1 as aa, s2 as bb, s3, s2 FROM root.sg2.** ALIGN BY DEVICE;", + "SELECT s1 as aa, s2 as bb, s3, s2 FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,a,b"}; retArray = new String[] { - "1,root.sg1.d1,1.1,1.1,", - "2,root.sg1.d1,2.2,2.2,", - "1,root.sg1.d2,11.1,11.1,", - "2,root.sg1.d2,22.2,22.2,", - "1,root.sg1.d3,111.1,111.1,", - "4,root.sg1.d3,444.4,444.4,", - "1,root.sg1.d4,1111.1,1111.1,", - "5,root.sg1.d4,5555.5,5555.5,", + "1,root.db1.d1,1.1,1.1,", + "2,root.db1.d1,2.2,2.2,", + "1,root.db1.d2,11.1,11.1,", + "2,root.db1.d2,22.2,22.2,", + "1,root.db1.d3,111.1,111.1,", + "4,root.db1.d3,444.4,444.4,", + "1,root.db1.d4,1111.1,1111.1,", + "5,root.db1.d4,5555.5,5555.5,", }; resultSetEqualTest( - "SELECT s1 as a, s1 as b FROM root.sg1.** ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT s1 as a, s1 as b FROM root.db1.** ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,a,b"}; retArray = new String[] { - "1,root.sg2.d1,1.1,1.1,", - "2,root.sg2.d1,2.2,2.2,", - "1,root.sg2.d2,11.1,11.1,", - "2,root.sg2.d2,22.2,22.2,", - "1,root.sg2.d3,111.1,111.1,", - "4,root.sg2.d3,444.4,444.4,", - "1,root.sg2.d4,1111.1,1111.1,", - "5,root.sg2.d4,5555.5,5555.5,", + "1,root.db2.d1,1.1,1.1,", + "2,root.db2.d1,2.2,2.2,", + "1,root.db2.d2,11.1,11.1,", + "2,root.db2.d2,22.2,22.2,", + "1,root.db2.d3,111.1,111.1,", + "4,root.db2.d3,444.4,444.4,", + "1,root.db2.d4,1111.1,1111.1,", + "5,root.db2.d4,5555.5,5555.5,", }; resultSetEqualTest( - "SELECT s1 as a, s1 as b FROM root.sg2.** ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT s1 as a, s1 as b FROM root.db2.** ALIGN BY DEVICE;", expectedHeader, retArray); } @Test @@ -744,33 +744,33 @@ public void orderByExpressionTest() { String[] expectedHeader = new String[] {"Time,Device,s3,s1,s2"}; String[] retArray = new String[] { - "5,root.sg1.d4,5555,5555.5,false,", - "2,root.sg1.d2,22,22.2,false,", - "1,root.sg1.d2,11,11.1,false,", - "2,root.sg1.d1,2,2.2,false,", - "1,root.sg1.d1,1,1.1,false,", - "1,root.sg1.d4,1111,1111.1,true,", - "4,root.sg1.d3,44,444.4,true,", - "1,root.sg1.d3,null,111.1,true,", + "5,root.db1.d4,5555,5555.5,false,", + "2,root.db1.d2,22,22.2,false,", + "1,root.db1.d2,11,11.1,false,", + "2,root.db1.d1,2,2.2,false,", + "1,root.db1.d1,1,1.1,false,", + "1,root.db1.d4,1111,1111.1,true,", + "4,root.db1.d3,44,444.4,true,", + "1,root.db1.d3,null,111.1,true,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** order by s2 asc, s1 desc ALIGN BY DEVICE;", + "SELECT * FROM root.db1.** order by s2 asc, s1 desc ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,5555.5,false,", - "2,root.sg2.d2,22,22.2,false,", - "1,root.sg2.d2,11,11.1,false,", - "2,root.sg2.d1,2,2.2,false,", - "1,root.sg2.d1,1,1.1,false,", - "1,root.sg2.d4,1111,1111.1,true,", - "4,root.sg2.d3,44,444.4,true,", - "1,root.sg2.d3,null,111.1,true,", + "5,root.db2.d4,5555,5555.5,false,", + "2,root.db2.d2,22,22.2,false,", + "1,root.db2.d2,11,11.1,false,", + "2,root.db2.d1,2,2.2,false,", + "1,root.db2.d1,1,1.1,false,", + "1,root.db2.d4,1111,1111.1,true,", + "4,root.db2.d3,44,444.4,true,", + "1,root.db2.d3,null,111.1,true,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** order by s2 asc, s1 desc ALIGN BY DEVICE;", + "SELECT * FROM root.db2.** order by s2 asc, s1 desc ALIGN BY DEVICE;", expectedHeader, retArray); @@ -778,65 +778,65 @@ public void orderByExpressionTest() { expectedHeader = new String[] {"Time,Device,s3"}; retArray = new String[] { - "5,root.sg1.d4,5555,", - "2,root.sg1.d2,22,", - "1,root.sg1.d2,11,", - "2,root.sg1.d1,2,", - "1,root.sg1.d1,1,", - "1,root.sg1.d4,1111,", - "4,root.sg1.d3,44,", - "1,root.sg1.d3,null,", + "5,root.db1.d4,5555,", + "2,root.db1.d2,22,", + "1,root.db1.d2,11,", + "2,root.db1.d1,2,", + "1,root.db1.d1,1,", + "1,root.db1.d4,1111,", + "4,root.db1.d3,44,", + "1,root.db1.d3,null,", }; resultSetEqualTest( - "SELECT s3 FROM root.sg1.** order by s2 asc, s1 desc ALIGN BY DEVICE;", + "SELECT s3 FROM root.db1.** order by s2 asc, s1 desc ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,", - "2,root.sg2.d2,22,", - "1,root.sg2.d2,11,", - "2,root.sg2.d1,2,", - "1,root.sg2.d1,1,", - "1,root.sg2.d4,1111,", - "4,root.sg2.d3,44,", - "1,root.sg2.d3,null,", + "5,root.db2.d4,5555,", + "2,root.db2.d2,22,", + "1,root.db2.d2,11,", + "2,root.db2.d1,2,", + "1,root.db2.d1,1,", + "1,root.db2.d4,1111,", + "4,root.db2.d3,44,", + "1,root.db2.d3,null,", }; resultSetEqualTest( - "SELECT s3 FROM root.sg2.** order by s2 asc, s1 desc ALIGN BY DEVICE;", + "SELECT s3 FROM root.db2.** order by s2 asc, s1 desc ALIGN BY DEVICE;", expectedHeader, retArray); // 3. order by expression retArray = new String[] { - "5,root.sg1.d4,5555,", - "1,root.sg1.d4,1111,", - "4,root.sg1.d3,44,", - "2,root.sg1.d2,22,", - "1,root.sg1.d2,11,", - "2,root.sg1.d1,2,", - "1,root.sg1.d1,1,", - "1,root.sg1.d3,null,", + "5,root.db1.d4,5555,", + "1,root.db1.d4,1111,", + "4,root.db1.d3,44,", + "2,root.db1.d2,22,", + "1,root.db1.d2,11,", + "2,root.db1.d1,2,", + "1,root.db1.d1,1,", + "1,root.db1.d3,null,", }; resultSetEqualTest( - "SELECT s3 FROM root.sg1.** order by s1+s3 desc ALIGN BY DEVICE;", + "SELECT s3 FROM root.db1.** order by s1+s3 desc ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "5,root.sg2.d4,5555,", - "1,root.sg2.d4,1111,", - "4,root.sg2.d3,44,", - "2,root.sg2.d2,22,", - "1,root.sg2.d2,11,", - "2,root.sg2.d1,2,", - "1,root.sg2.d1,1,", - "1,root.sg2.d3,null,", + "5,root.db2.d4,5555,", + "1,root.db2.d4,1111,", + "4,root.db2.d3,44,", + "2,root.db2.d2,22,", + "1,root.db2.d2,11,", + "2,root.db2.d1,2,", + "1,root.db2.d1,1,", + "1,root.db2.d3,null,", }; resultSetEqualTest( - "SELECT s3 FROM root.sg2.** order by s1+s3 desc ALIGN BY DEVICE;", + "SELECT s3 FROM root.db2.** order by s1+s3 desc ALIGN BY DEVICE;", expectedHeader, retArray); } @@ -844,42 +844,42 @@ public void orderByExpressionTest() { @Test public void templateInvalidTest() { // 1. non align by device query - String[] expectedHeader = new String[] {"Time,root.sg1.d4.s3,root.sg1.d4.s1,root.sg1.d4.s2"}; + String[] expectedHeader = new String[] {"Time,root.db1.d4.s3,root.db1.d4.s1,root.db1.d4.s2"}; String[] retArray = new String[] { "1,1111,1111.1,true,", "5,5555,5555.5,false,", }; - resultSetEqualTest("SELECT * FROM root.sg1.** slimit 3;", expectedHeader, retArray); + resultSetEqualTest("SELECT * FROM root.db1.** slimit 3;", expectedHeader, retArray); - expectedHeader = new String[] {"Time,root.sg2.d4.s3,root.sg2.d4.s1,root.sg2.d4.s2"}; + expectedHeader = new String[] {"Time,root.db2.d4.s3,root.db2.d4.s1,root.db2.d4.s2"}; retArray = new String[] { "1,1111,1111.1,true,", "5,5555,5555.5,false,", }; - resultSetEqualTest("SELECT * FROM root.sg2.** slimit 3;", expectedHeader, retArray); + resultSetEqualTest("SELECT * FROM root.db2.** slimit 3;", expectedHeader, retArray); // 2. aggregation expectedHeader = new String[] {"Device,count(s1 + 1)"}; retArray = new String[] { - "root.sg1.d1,2,", "root.sg1.d2,2,", "root.sg1.d3,2,", "root.sg1.d4,2,", + "root.db1.d1,2,", "root.db1.d2,2,", "root.db1.d3,2,", "root.db1.d4,2,", }; resultSetEqualTest( - "select count(s1+1) from root.sg1.** align by device;", expectedHeader, retArray); + "select count(s1+1) from root.db1.** align by device;", expectedHeader, retArray); expectedHeader = new String[] {"Device,count(s1 + 1)"}; retArray = new String[] { - "root.sg2.d1,2,", "root.sg2.d2,2,", "root.sg2.d3,2,", "root.sg2.d4,2,", + "root.db2.d1,2,", "root.db2.d2,2,", "root.db2.d3,2,", "root.db2.d4,2,", }; resultSetEqualTest( - "select count(s1+1) from root.sg2.** align by device;", expectedHeader, retArray); + "select count(s1+1) from root.db2.** align by device;", expectedHeader, retArray); assertTestFail( - "select s1 from root.sg1.** where s1 align by device;", + "select s1 from root.db1.** where s1 align by device;", "The output type of the expression in WHERE clause should be BOOLEAN, actual data type: FLOAT."); assertTestFail( - "select s1 from root.sg2.** where s1 align by device;", + "select s1 from root.db2.** where s1 align by device;", "The output type of the expression in WHERE clause should be BOOLEAN, actual data type: FLOAT."); } @@ -889,78 +889,78 @@ public void sLimitOffsetTest() { String[] expectedHeader = new String[] {"Time,Device,s1"}; String[] retArray = new String[] { - "1,root.sg1.d1,1.1,", - "2,root.sg1.d1,2.2,", - "1,root.sg1.d2,11.1,", - "2,root.sg1.d2,22.2,", - "1,root.sg1.d3,111.1,", - "4,root.sg1.d3,444.4,", - "1,root.sg1.d4,1111.1,", - "5,root.sg1.d4,5555.5,", + "1,root.db1.d1,1.1,", + "2,root.db1.d1,2.2,", + "1,root.db1.d2,11.1,", + "2,root.db1.d2,22.2,", + "1,root.db1.d3,111.1,", + "4,root.db1.d3,444.4,", + "1,root.db1.d4,1111.1,", + "5,root.db1.d4,5555.5,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.** slimit 1 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db1.** slimit 1 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1.1,", - "2,root.sg2.d1,2.2,", - "1,root.sg2.d2,11.1,", - "2,root.sg2.d2,22.2,", - "1,root.sg2.d3,111.1,", - "4,root.sg2.d3,444.4,", - "1,root.sg2.d4,1111.1,", - "5,root.sg2.d4,5555.5,", + "1,root.db2.d1,1.1,", + "2,root.db2.d1,2.2,", + "1,root.db2.d2,11.1,", + "2,root.db2.d2,22.2,", + "1,root.db2.d3,111.1,", + "4,root.db2.d3,444.4,", + "1,root.db2.d4,1111.1,", + "5,root.db2.d4,5555.5,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.** slimit 1 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); + "SELECT * FROM root.db2.** slimit 1 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,s1,s2"}; retArray = new String[] { - "1,root.sg1.d1,1.1,false,", - "2,root.sg1.d1,2.2,false,", - "1,root.sg1.d2,11.1,false,", - "2,root.sg1.d2,22.2,false,", - "1,root.sg1.d3,111.1,true,", - "4,root.sg1.d3,444.4,true,", - "1,root.sg1.d4,1111.1,true,", - "5,root.sg1.d4,5555.5,false,", + "1,root.db1.d1,1.1,false,", + "2,root.db1.d1,2.2,false,", + "1,root.db1.d2,11.1,false,", + "2,root.db1.d2,22.2,false,", + "1,root.db1.d3,111.1,true,", + "4,root.db1.d3,444.4,true,", + "1,root.db1.d4,1111.1,true,", + "5,root.db1.d4,5555.5,false,", }; resultSetEqualTest( - "SELECT *, s1 FROM root.sg1.** slimit 2 soffset 1 ALIGN BY DEVICE;", + "SELECT *, s1 FROM root.db1.** slimit 2 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1.1,false,", - "2,root.sg2.d1,2.2,false,", - "1,root.sg2.d2,11.1,false,", - "2,root.sg2.d2,22.2,false,", - "1,root.sg2.d3,111.1,true,", - "4,root.sg2.d3,444.4,true,", - "1,root.sg2.d4,1111.1,true,", - "5,root.sg2.d4,5555.5,false,", + "1,root.db2.d1,1.1,false,", + "2,root.db2.d1,2.2,false,", + "1,root.db2.d2,11.1,false,", + "2,root.db2.d2,22.2,false,", + "1,root.db2.d3,111.1,true,", + "4,root.db2.d3,444.4,true,", + "1,root.db2.d4,1111.1,true,", + "5,root.db2.d4,5555.5,false,", }; resultSetEqualTest( - "SELECT *, s1 FROM root.sg2.** slimit 2 soffset 1 ALIGN BY DEVICE;", + "SELECT *, s1 FROM root.db2.** slimit 2 soffset 1 ALIGN BY DEVICE;", expectedHeader, retArray); expectedHeader = new String[] {"Time,Device,s1"}; retArray = new String[] { - "1,root.sg1.d1,1.1,", "2,root.sg1.d1,2.2,", "1,root.sg1.d2,11.1,", "2,root.sg1.d2,22.2,", + "1,root.db1.d1,1.1,", "2,root.db1.d1,2.2,", "1,root.db1.d2,11.1,", "2,root.db1.d2,22.2,", }; resultSetEqualTest( - "SELECT * FROM root.sg1.d1,root.sg1.d2,root.sg1.d6 soffset 1 slimit 1 ALIGN BY DEVICE;", + "SELECT * FROM root.db1.d1,root.db1.d2,root.db1.d6 soffset 1 slimit 1 ALIGN BY DEVICE;", expectedHeader, retArray); retArray = new String[] { - "1,root.sg2.d1,1.1,", "2,root.sg2.d1,2.2,", "1,root.sg2.d2,11.1,", "2,root.sg2.d2,22.2,", + "1,root.db2.d1,1.1,", "2,root.db2.d1,2.2,", "1,root.db2.d2,11.1,", "2,root.db2.d2,22.2,", }; resultSetEqualTest( - "SELECT * FROM root.sg2.d1,root.sg2.d2,root.sg2.d6 soffset 1 slimit 1 ALIGN BY DEVICE;", + "SELECT * FROM root.db2.d1,root.db2.d2,root.db2.d6 soffset 1 slimit 1 ALIGN BY DEVICE;", expectedHeader, retArray); } @@ -973,12 +973,12 @@ public void emptyResultTest() { // is changed from 'time>=now()-1d' to 'time>=now()-1ms' to reduce memory use because of the // creation of timeslots. resultSetEqualTest( - "SELECT * FROM root.sg1.** where time>=now()-1ms and time<=now() " + "SELECT * FROM root.db1.** where time>=now()-1ms and time<=now() " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); resultSetEqualTest( - "SELECT * FROM root.sg2.** where time>=now()-1ms and time<=now() " + "SELECT * FROM root.db2.** where time>=now()-1ms and time<=now() " + "ORDER BY TIME DESC ALIGN BY DEVICE;", expectedHeader, retArray); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink1IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink1IT.java index 095783fdd20bb..7909a44cf5f78 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink1IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink1IT.java @@ -47,11 +47,11 @@ public class IoTDBShuffleSink1IT { // two devices protected static final String[] MULTI_SERIES = new String[] { - "create database root.sg", - "insert into root.sg.d1(time,s1,s2) values (1,2,2)", - "insert into root.sg.d1(time,s1,s2) values (now(),3,3)", - "insert into root.sg.d2(time,s1,s2) values (1,4,4)", - "insert into root.sg.d2(time,s1,s2) values (now(),5,5)" + "create database root.db", + "insert into root.db.d1(time,s1,s2) values (1,2,2)", + "insert into root.db.d1(time,s1,s2) values (now(),3,3)", + "insert into root.db.d2(time,s1,s2) values (1,4,4)", + "insert into root.db.d2(time,s1,s2) values (now(),5,5)" }; @BeforeClass @@ -80,10 +80,10 @@ public void testCountAlignByDeviceOrderByDeviceWithoutValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** align by device", expectedHeader2, retArray2); + "select count(s1),count(s2) from root.db.** align by device", expectedHeader2, retArray2); } @Test @@ -99,10 +99,10 @@ public void testCountAlignByDeviceOrderByDeviceWithValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,1,1,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,1,1,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** where s1 <= 4 align by device", + "select count(s1),count(s2) from root.db.** where s1 <= 4 align by device", expectedHeader2, retArray2); } @@ -120,10 +120,10 @@ public void testCountAlignByDeviceOrderByTimeWithoutValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** order by time align by device", + "select count(s1),count(s2) from root.db.** order by time align by device", expectedHeader2, retArray2); } @@ -141,10 +141,10 @@ public void testCountAlignByDeviceOrderByTimeWithValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,1,1,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,1,1,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** where s1 <= 4 order by time align by device", + "select count(s1),count(s2) from root.db.** where s1 <= 4 order by time align by device", expectedHeader2, retArray2); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink2IT.java index 17368548d8598..63c03d9d3b4eb 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBShuffleSink2IT.java @@ -50,24 +50,24 @@ public class IoTDBShuffleSink2IT { // three devices, three data regions protected static final String[] MULTI_SERIES = new String[] { - "create database root.sg", - "insert into root.sg.d1(time,s1,s2) values (1,1,1)", - "insert into root.sg.d1(time,s1,s2) values (now(),2,2)", - "insert into root.sg.d2(time,s1,s2) values (now(),3,3)", - "insert into root.sg.d2(time,s1,s2) values (1,4,4)", - "insert into root.sg.d3(time,s1,s2) values (now(),5,5)", - "insert into root.sg.d3(time,s1,s2) values (1,6,6)" + "create database root.db", + "insert into root.db.d1(time,s1,s2) values (1,1,1)", + "insert into root.db.d1(time,s1,s2) values (now(),2,2)", + "insert into root.db.d2(time,s1,s2) values (now(),3,3)", + "insert into root.db.d2(time,s1,s2) values (1,4,4)", + "insert into root.db.d3(time,s1,s2) values (now(),5,5)", + "insert into root.db.d3(time,s1,s2) values (1,6,6)" }; // three devices, three data regions, d3 has only one region protected static final String[] SECOND_MULTI_SERIES = new String[] { - "create database root.sg1", - "insert into root.sg1.d1(time,s1,s2) values (1,1,1)", - "insert into root.sg1.d1(time,s1,s2) values (now(),2,2)", - "insert into root.sg1.d2(time,s1,s2) values (now(),3,3)", - "insert into root.sg1.d2(time,s1,s2) values (1,4,4)", - "insert into root.sg1.d3(time,s1,s2) values (1,6,6)" + "create database root.db1", + "insert into root.db1.d1(time,s1,s2) values (1,1,1)", + "insert into root.db1.d1(time,s1,s2) values (now(),2,2)", + "insert into root.db1.d2(time,s1,s2) values (now(),3,3)", + "insert into root.db1.d2(time,s1,s2) values (1,4,4)", + "insert into root.db1.d3(time,s1,s2) values (1,6,6)" }; @BeforeClass @@ -98,17 +98,17 @@ public void testCountAlignByDeviceOrderByDeviceWithoutValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,", "root.sg.d3,2,2,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,", "root.db.d3,2,2,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** align by device", expectedHeader2, retArray2); + "select count(s1),count(s2) from root.db.** align by device", expectedHeader2, retArray2); // result of SECOND_MULTI_SERIES String expectedHeader3 = "Device,count(s1),count(s2),"; - String[] retArray3 = new String[] {"root.sg1.d1,2,2,", "root.sg1.d2,2,2,", "root.sg1.d3,1,1,"}; + String[] retArray3 = new String[] {"root.db1.d1,2,2,", "root.db1.d2,2,2,", "root.db1.d3,1,1,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg1.** align by device", expectedHeader3, retArray3); + "select count(s1),count(s2) from root.db1.** align by device", expectedHeader3, retArray3); } @Test @@ -125,19 +125,19 @@ public void testCountAlignByDeviceOrderByDeviceWithValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,", "root.sg.d3,0,0,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,", "root.db.d3,0,0,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** where s1 <= 4 align by device", + "select count(s1),count(s2) from root.db.** where s1 <= 4 align by device", expectedHeader2, retArray2); // result of SECOND_MULTI_SERIES String expectedHeader3 = "Device,count(s1),count(s2),"; - String[] retArray3 = new String[] {"root.sg1.d1,2,2,", "root.sg1.d2,2,2,", "root.sg1.d3,0,0,"}; + String[] retArray3 = new String[] {"root.db1.d1,2,2,", "root.db1.d2,2,2,", "root.db1.d3,0,0,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg1.** where s1 <= 4 align by device", + "select count(s1),count(s2) from root.db1.** where s1 <= 4 align by device", expectedHeader3, retArray3); } @@ -156,19 +156,19 @@ public void testCountAlignByDeviceOrderByTimeWithoutValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,", "root.sg.d3,2,2,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,", "root.db.d3,2,2,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** order by time align by device", + "select count(s1),count(s2) from root.db.** order by time align by device", expectedHeader2, retArray2); // result of SECOND_MULTI_SERIES String expectedHeader3 = "Device,count(s1),count(s2),"; - String[] retArray3 = new String[] {"root.sg1.d1,2,2,", "root.sg1.d2,2,2,", "root.sg1.d3,1,1,"}; + String[] retArray3 = new String[] {"root.db1.d1,2,2,", "root.db1.d2,2,2,", "root.db1.d3,1,1,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg1.** order by time align by device", + "select count(s1),count(s2) from root.db1.** order by time align by device", expectedHeader3, retArray3); } @@ -187,19 +187,19 @@ public void testCountAlignByDeviceOrderByTimeWithValueFilter() { // result of MULTI_SERIES String expectedHeader2 = "Device,count(s1),count(s2),"; - String[] retArray2 = new String[] {"root.sg.d1,2,2,", "root.sg.d2,2,2,", "root.sg.d3,0,0,"}; + String[] retArray2 = new String[] {"root.db.d1,2,2,", "root.db.d2,2,2,", "root.db.d3,0,0,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg.** where s1 <= 4 order by time align by device", + "select count(s1),count(s2) from root.db.** where s1 <= 4 order by time align by device", expectedHeader2, retArray2); // result of MULTI_SERIES String expectedHeader3 = "Device,count(s1),count(s2),"; - String[] retArray3 = new String[] {"root.sg1.d1,2,2,", "root.sg1.d2,2,2,", "root.sg1.d3,0,0,"}; + String[] retArray3 = new String[] {"root.db1.d1,2,2,", "root.db1.d2,2,2,", "root.db1.d3,0,0,"}; resultSetEqualTest( - "select count(s1),count(s2) from root.sg1.** where s1 <= 4 order by time align by device", + "select count(s1),count(s2) from root.db1.** where s1 <= 4 order by time align by device", expectedHeader3, retArray3); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletion2IT.java index 8d69a09e89725..36f13110e4017 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletion2IT.java @@ -55,8 +55,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 21"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 21"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletionIT.java index d16587ac45354..45b7e4fe8bb92 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAggregationWithDeletionIT.java @@ -62,8 +62,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 21"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 21"); } catch (Exception e) { fail(e.getMessage()); e.printStackTrace(); @@ -79,15 +79,15 @@ public static void tearDown() throws Exception { public void countAllAlignedWithoutTimeFilterTest() { String[] retArray = new String[] {"1", "28", "19", "20"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -118,20 +118,20 @@ public void countAllAlignedWithoutTimeFilterTest() { public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { String[] retArray = new String[] {"1", "28", "19", "20", "19", "29", "28", "18", "19"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)", - "count(root.sg1.d2.s1)", - "count(root.sg1.d2.s2)", - "count(root.sg1.d2.s3)", - "count(root.sg1.d2.s4)", - "count(root.sg1.d2.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)", + "count(root.db1.d2.s1)", + "count(root.db1.d2.s2)", + "count(root.db1.d2.s3)", + "count(root.db1.d2.s4)", + "count(root.db1.d2.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -162,17 +162,17 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { public void countAllAlignedWithTimeFilterTest() { String[] retArray = new String[] {"1", "22", "13", "6"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 where time >= 9 and time <= 33")) { + "select count(*) from root.db1.d1 where time >= 9 and time <= 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -204,19 +204,19 @@ public void countAllAlignedWithTimeFilterTest() { public void aggregateSomeAlignedWithoutTimeFilterTest() { double[] retArray = new double[] {1, 28, 230000, 390417, 230000, 13943.464285714286}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "sum(root.sg1.d1.s1)", - "sum(root.sg1.d1.s3)", - "avg(root.sg1.d1.s1)", - "avg(root.sg1.d1.s3)", + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "sum(root.db1.d1.s1)", + "sum(root.db1.d1.s3)", + "avg(root.db1.d1.s1)", + "avg(root.db1.d1.s3)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(s1),count (s3),sum(s1),sum(s3),avg(s1),avg(s3) from root.sg1.d1")) { + "select count(s1),count (s3),sum(s1),sum(s3),avg(s1),avg(s3) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -248,19 +248,19 @@ public void aggregateSomeAlignedWithoutTimeFilterTest() { public void aggregateSomeAlignedWithTimeFilterTest() { double[] retArray = new double[] {1, 15, 230000, 230322, 230000, 15354.8}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "sum(root.sg1.d1.s1)", - "sum(root.sg1.d1.s3)", - "avg(root.sg1.d1.s1)", - "avg(root.sg1.d1.s3)", + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "sum(root.db1.d1.s1)", + "sum(root.db1.d1.s3)", + "avg(root.db1.d1.s1)", + "avg(root.db1.d1.s3)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(s1),count (s3),sum(s1),sum(s3),avg(s1),avg(s3) from root.sg1.d1 where time>=16 and time<=34")) { + "select count(s1),count (s3),sum(s1),sum(s3),avg(s1),avg(s3) from root.db1.d1 where time>=16 and time<=34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -290,12 +290,12 @@ public void aggregateSomeAlignedWithTimeFilterTest() { @Test public void countSingleAlignedWithTimeFilterTest() { String[] retArray = new String[] {"0"}; - String[] columnNames = {"count(root.sg1.d1.s1)"}; + String[] columnNames = {"count(root.db1.d1.s1)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(s1) from root.sg1.d1 where time>=16 and time<=20")) { + statement.executeQuery("select count(s1) from root.db1.d1 where time>=16 and time<=20")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -327,12 +327,12 @@ public void countSingleAlignedWithTimeFilterTest() { @Test public void sumSingleAlignedWithTimeFilterTest() { String[] retArray = new String[] {"null"}; - String[] columnNames = {"sum(root.sg1.d1.s1)"}; + String[] columnNames = {"sum(root.db1.d1.s1)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select sum(s1) from root.sg1.d1 where time>=16 and time<=20")) { + statement.executeQuery("select sum(s1) from root.db1.d1 where time>=16 and time<=20")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -364,12 +364,12 @@ public void sumSingleAlignedWithTimeFilterTest() { @Test public void avgSingleAlignedWithTimeFilterTest() { String[] retArray = new String[] {"null"}; - String[] columnNames = {"avg(root.sg1.d1.s1)"}; + String[] columnNames = {"avg(root.db1.d1.s1)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select avg(s1) from root.sg1.d1 where time>=16 and time<=20")) { + statement.executeQuery("select avg(s1) from root.db1.d1 where time>=16 and time<=20")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -402,12 +402,12 @@ public void avgSingleAlignedWithTimeFilterTest() { @Test public void countAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"11"}; - String[] columnNames = {"count(root.sg1.d1.s4)"}; + String[] columnNames = {"count(root.db1.d1.s4)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(s4) from root.sg1.d1 where s4 = true")) { + statement.executeQuery("select count(s4) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -438,16 +438,16 @@ public void countAlignedWithValueFilterTest() throws ClassNotFoundException { public void countAllAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"0", "9", "11", "6"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.d1 where s4 = true")) { + statement.executeQuery("select count(*) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -478,14 +478,14 @@ public void countAllAlignedWithValueFilterTest() throws ClassNotFoundException { public void aggregationAllAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"0", "25", "1"}; String[] columnNames = { - "count(root.sg1.d1.s1)", "max_time(root.sg1.d1.s4)", "min_value(root.sg1.d1.s3)", + "count(root.db1.d1.s1)", "max_time(root.db1.d1.s4)", "min_value(root.db1.d1.s3)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), max_time(s4), min_value(s3) from root.sg1.d1 where s4 = true")) { + "select count(s1), max_time(s4), min_value(s3) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java index 514757ccbaca5..3944132a6f0f4 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java @@ -76,17 +76,17 @@ public void selectAllAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "40,root.sg1.d1.s2,40,INT32", - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "40,root.db1.d1.s2,40,INT32", + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -115,22 +115,22 @@ public void selectAllAlignedAndNonAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "40,root.sg1.d1.s2,40,INT32", - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "20,root.sg1.d2.s1,20.0,FLOAT", - "40,root.sg1.d2.s2,40,INT32", - "30,root.sg1.d2.s3,30,INT64", - "30,root.sg1.d2.s4,false,BOOLEAN", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "40,root.db1.d1.s2,40,INT32", + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT", + "20,root.db1.d2.s1,20.0,FLOAT", + "40,root.db1.d2.s2,40,INT32", + "30,root.db1.d2.s3,30,INT64", + "30,root.db1.d2.s4,false,BOOLEAN", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.* order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.* order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -158,14 +158,14 @@ public void selectAllAlignedLastWithTimeFilterTest() { Set retSet = new HashSet<>( - Arrays.asList("40,root.sg1.d1.s2,40,INT32", "40,root.sg1.d1.s5,aligned_test40,TEXT")); + Arrays.asList("40,root.db1.d1.s2,40,INT32", "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last * from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last * from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -193,16 +193,16 @@ public void selectSomeAlignedLastTest1() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -229,13 +229,13 @@ public void selectSomeAlignedLastTest1() { public void selectSomeAlignedLastTest2() { Set retSet = new HashSet<>( - Arrays.asList("23,root.sg1.d1.s1,230000.0,FLOAT", "30,root.sg1.d1.s4,false,BOOLEAN")); + Arrays.asList("23,root.db1.d1.s1,230000.0,FLOAT", "30,root.db1.d1.s4,false,BOOLEAN")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last s1, s4 from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last s1, s4 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -262,14 +262,14 @@ public void selectSomeAlignedLastTest2() { public void selectSomeAlignedLastWithTimeFilterTest() { Set retSet = - new HashSet<>(Collections.singletonList("40,root.sg1.d1.s5,aligned_test40,TEXT")); + new HashSet<>(Collections.singletonList("40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -298,8 +298,8 @@ public void selectSomeAlignedAndNonAlignedLastWithTimeFilterTest() { Set retSet = new HashSet<>( Arrays.asList( - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "40,root.db1.d1.s5,aligned_test40,TEXT", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -307,7 +307,7 @@ public void selectSomeAlignedAndNonAlignedLastWithTimeFilterTest() { // 1 4 5 try (ResultSet resultSet = statement.executeQuery( - "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time > 30 order by timeseries asc")) { + "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryIT.java index 64ef126853127..0e43f359dc0f3 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryIT.java @@ -127,13 +127,13 @@ public void selectAllAlignedWithoutValueFilterTest() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select * from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -208,22 +208,22 @@ public void selectAllAlignedAndNonAlignedTest() { }; String[] columnNames = { - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5", - "root.sg1.d2.s1", - "root.sg1.d2.s2", - "root.sg1.d2.s3", - "root.sg1.d2.s4", - "root.sg1.d2.s5" + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5", + "root.db1.d2.s1", + "root.db1.d2.s2", + "root.db1.d2.s3", + "root.db1.d2.s4", + "root.db1.d2.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select * from root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("select * from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -283,14 +283,14 @@ public void selectAllAlignedWithTimeFilterTest() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where time >= 9 and time <= 33")) { + statement.executeQuery("select * from root.db1.d1 where time >= 9 and time <= 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -364,12 +364,12 @@ public void selectSomeAlignedWithoutValueFilterTest1() { "40,null,null,aligned_test40", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select s1,s4,s5 from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1,s4,s5 from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -433,12 +433,12 @@ public void selectSomeAlignedWithoutValueFilterTest2() { "30,null,false", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select s1,s4 from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1,s4 from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -491,14 +491,14 @@ public void selectSomeAlignedWithTimeFilterTest() { "34,null,null,aligned_test34", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where time >= 16 and time <= 34")) { + "select s1,s4,s5 from root.db1.d1 where time >= 16 and time <= 34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -552,12 +552,12 @@ public void selectSomeAlignedAndNonAlignedWithTimeFilterTest() { }; String[] columnNames = { - "root.sg1.d2.s5", - "root.sg1.d1.s4", - "root.sg1.d2.s1", - "root.sg1.d1.s5", - "root.sg1.d2.s4", - "root.sg1.d1.s1" + "root.db1.d2.s5", + "root.db1.d1.s4", + "root.db1.d2.s1", + "root.db1.d1.s5", + "root.db1.d2.s4", + "root.db1.d1.s1" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -565,7 +565,7 @@ public void selectSomeAlignedAndNonAlignedWithTimeFilterTest() { try (ResultSet resultSet = statement.executeQuery( - "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time >= 16 and time <= 34")) { + "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time >= 16 and time <= 34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -612,14 +612,14 @@ public void selectAllAlignedWithValueFilterTest1() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where s4 = true")) { + statement.executeQuery("select * from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -662,14 +662,14 @@ public void selectAllAlignedWithValueFilterTest2() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where s1 > 11 and s2 <= 33")) { + statement.executeQuery("select * from root.db1.d1 where s1 > 11 and s2 <= 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -727,14 +727,14 @@ public void selectAllAlignedWithValueFilterTest3() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where s1 >= 13 or s2 < 33")) { + statement.executeQuery("select * from root.db1.d1 where s1 >= 13 or s2 < 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -774,16 +774,16 @@ public void selectAllAlignedAndNonAlignedTest1() { }; String[] columnNames = { - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5", - "root.sg1.d2.s1", - "root.sg1.d2.s2", - "root.sg1.d2.s3", - "root.sg1.d2.s4", - "root.sg1.d2.s5" + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5", + "root.db1.d2.s1", + "root.db1.d2.s2", + "root.db1.d2.s3", + "root.db1.d2.s4", + "root.db1.d2.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -791,7 +791,7 @@ public void selectAllAlignedAndNonAlignedTest1() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.* where root.sg1.d1.s2 > 16 and root.sg1.d2.s3 <= 36")) { + "select * from root.db1.* where root.db1.d1.s2 > 16 and root.db1.d2.s3 <= 36")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -849,16 +849,16 @@ public void selectAllAlignedAndNonAlignedTest2() { }; String[] columnNames = { - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5", - "root.sg1.d2.s1", - "root.sg1.d2.s2", - "root.sg1.d2.s3", - "root.sg1.d2.s4", - "root.sg1.d2.s5" + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5", + "root.db1.d2.s1", + "root.db1.d2.s2", + "root.db1.d2.s3", + "root.db1.d2.s4", + "root.db1.d2.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -866,7 +866,7 @@ public void selectAllAlignedAndNonAlignedTest2() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.* where root.sg1.d1.s2 > 16 or root.sg1.d2.s4 = false")) { + "select * from root.db1.* where root.db1.d1.s2 > 16 or root.db1.d2.s4 = false")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -909,7 +909,7 @@ public void selectAllAlignedWithTimeAndValueFilterTest1() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -917,7 +917,7 @@ public void selectAllAlignedWithTimeAndValueFilterTest1() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where time >= 9 and time <= 33 and s1 < 19")) { + "select * from root.db1.d1 where time >= 9 and time <= 33 and s1 < 19")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -979,7 +979,7 @@ public void selectAllAlignedWithTimeAndValueFilterTest2() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -987,7 +987,7 @@ public void selectAllAlignedWithTimeAndValueFilterTest2() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where time >= 9 and time <= 33 or s5 = 'aligned_test36' or s5 = 'aligned_test37'")) { + "select * from root.db1.d1 where time >= 9 and time <= 33 or s5 = 'aligned_test36' or s5 = 'aligned_test37'")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1027,7 +1027,7 @@ public void selectAllAlignedWithLimitOffsetTest() { }; String[] columnNames = { - "root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5" + "root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -1035,7 +1035,7 @@ public void selectAllAlignedWithLimitOffsetTest() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where time >= 9 and time <= 33 offset 5 limit 5")) { + "select * from root.db1.d1 where time >= 9 and time <= 33 offset 5 limit 5")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1083,14 +1083,14 @@ public void selectSomeAlignedWithValueFilterTest1() { "34,null,null,aligned_test34", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where s1 < 17 or s5 = 'aligned_test34'")) { + "select s1,s4,s5 from root.db1.d1 where s1 < 17 or s5 = 'aligned_test34'")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1125,13 +1125,13 @@ public void selectSomeAlignedWithValueFilterTest2() { "7,7.0,false", "9,9.0,false", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1,s4 from root.sg1.d1 where s1 < 19 and s4 = false")) { + statement.executeQuery("select s1,s4 from root.db1.d1 where s1 < 19 and s4 = false")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1171,14 +1171,14 @@ public void selectSomeAlignedWithTimeAndValueFilterTest() { "30,null,false,null", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where time >= 16 and time <= 34 and s4=false")) { + "select s1,s4,s5 from root.db1.d1 where time >= 16 and time <= 34 and s4=false")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1221,12 +1221,12 @@ public void selectSomeAlignedAndNonAlignedWithTimeAndValueFilterTest() { }; String[] columnNames = { - "root.sg1.d2.s5", - "root.sg1.d1.s4", - "root.sg1.d2.s1", - "root.sg1.d1.s5", - "root.sg1.d2.s4", - "root.sg1.d1.s1" + "root.db1.d2.s5", + "root.db1.d1.s4", + "root.db1.d2.s1", + "root.db1.d1.s5", + "root.db1.d2.s4", + "root.db1.d1.s1" }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -1234,7 +1234,7 @@ public void selectSomeAlignedAndNonAlignedWithTimeAndValueFilterTest() { try (ResultSet resultSet = statement.executeQuery( - "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time >= 16 and time <= 34 and (d1.s1 >= 18 or d2.s4 = true)")) { + "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time >= 16 and time <= 34 and (d1.s1 >= 18 or d2.s4 = true)")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1266,16 +1266,16 @@ public void selectSomeAlignedAndNonAlignedWithTimeAndValueFilterTest() { public void countAllAlignedWithoutTimeFilterTest() { String[] retArray = new String[] {"20", "29", "28", "19", "20"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1306,21 +1306,21 @@ public void countAllAlignedWithoutTimeFilterTest() { public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { String[] retArray = new String[] {"20", "29", "28", "19", "20", "19", "29", "28", "18", "19"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)", - "count(root.sg1.d2.s1)", - "count(root.sg1.d2.s2)", - "count(root.sg1.d2.s3)", - "count(root.sg1.d2.s4)", - "count(root.sg1.d2.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)", + "count(root.db1.d2.s1)", + "count(root.db1.d2.s2)", + "count(root.db1.d2.s3)", + "count(root.db1.d2.s4)", + "count(root.db1.d2.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1351,18 +1351,18 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { public void countAllAlignedWithTimeFilterTest() { String[] retArray = new String[] {"12", "15", "22", "13", "6"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 where time >= 9 and time <= 33")) { + "select count(*) from root.db1.d1 where time >= 9 and time <= 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1397,22 +1397,22 @@ public void aggregateSomeAlignedWithoutTimeFilterTest() { 20, 29, 28, 390184, 130549, 390417, 19509.2, 4501.689655172413, 13943.464285714286 }; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "sum(root.sg1.d1.s1)", - "sum(root.sg1.d1.s2)", - "sum(root.sg1.d1.s3)", - "avg(root.sg1.d1.s1)", - "avg(root.sg1.d1.s2)", - "avg(root.sg1.d1.s3)", + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "sum(root.db1.d1.s1)", + "sum(root.db1.d1.s2)", + "sum(root.db1.d1.s3)", + "avg(root.db1.d1.s1)", + "avg(root.db1.d1.s2)", + "avg(root.db1.d1.s3)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(s1),count(s2),count(s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.sg1.d1")) { + "select count(s1),count(s2),count(s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1447,22 +1447,22 @@ public void aggregateSomeAlignedWithTimeFilterTest() { 6, 9, 15, 230090, 220, 230322, 38348.333333333336, 24.444444444444443, 15354.8 }; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "sum(root.sg1.d1.s1)", - "sum(root.sg1.d1.s2)", - "sum(root.sg1.d1.s3)", - "avg(root.sg1.d1.s1)", - "avg(root.sg1.d1.s2)", - "avg(root.sg1.d1.s3)", + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "sum(root.db1.d1.s1)", + "sum(root.db1.d1.s2)", + "sum(root.db1.d1.s3)", + "avg(root.db1.d1.s1)", + "avg(root.db1.d1.s2)", + "avg(root.db1.d1.s3)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select count(s1),count (s2),count (s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.sg1.d1 where time>=16 and time<=34")) { + "select count(s1),count (s2),count (s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.db1.d1 where time>=16 and time<=34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1492,12 +1492,12 @@ public void aggregateSomeAlignedWithTimeFilterTest() { @Test public void countSingleAlignedWithTimeFilterTest() { String[] retArray = new String[] {"9"}; - String[] columnNames = {"count(root.sg1.d1.s2)"}; + String[] columnNames = {"count(root.db1.d1.s2)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(s2) from root.sg1.d1 where time>=16 and time<=34")) { + statement.executeQuery("select count(s2) from root.db1.d1 where time>=16 and time<=34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1529,12 +1529,12 @@ public void countSingleAlignedWithTimeFilterTest() { @Test public void sumSingleAlignedWithTimeFilterTest() { String[] retArray = new String[] {"230322.0"}; - String[] columnNames = {"sum(root.sg1.d1.s3)"}; + String[] columnNames = {"sum(root.db1.d1.s3)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select sum(s3) from root.sg1.d1 where time>=16 and time<=34")) { + statement.executeQuery("select sum(s3) from root.db1.d1 where time>=16 and time<=34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1566,12 +1566,12 @@ public void sumSingleAlignedWithTimeFilterTest() { @Test public void avgSingleAlignedWithTimeFilterTest() { double[][] retArray = {{24.444444444444443}}; - String[] columnNames = {"avg(root.sg1.d1.s2)"}; + String[] columnNames = {"avg(root.db1.d1.s2)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select avg(s2) from root.sg1.d1 where time>=16 and time<=34")) { + statement.executeQuery("select avg(s2) from root.db1.d1 where time>=16 and time<=34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1603,12 +1603,12 @@ public void avgSingleAlignedWithTimeFilterTest() { @Test public void countAlignedWithValueFilterTest() { String[] retArray = new String[] {"11"}; - String[] columnNames = {"count(root.sg1.d1.s4)"}; + String[] columnNames = {"count(root.db1.d1.s4)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(s4) from root.sg1.d1 where s4 = true")) { + statement.executeQuery("select count(s4) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1639,15 +1639,15 @@ public void countAlignedWithValueFilterTest() { public void aggregationFuncAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"8", "42.0", "5.25", "1.0", "9.0", "1", "9", "1.0", "9.0"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "sum(root.sg1.d1.s1)", - "avg(root.sg1.d1.s1)", - "first_value(root.sg1.d1.s1)", - "last_value(root.sg1.d1.s1)", - "min_time(root.sg1.d1.s1)", - "max_time(root.sg1.d1.s1)", - "min_value(root.sg1.d1.s1)", - "max_value(root.sg1.d1.s1)", + "count(root.db1.d1.s1)", + "sum(root.db1.d1.s1)", + "avg(root.db1.d1.s1)", + "first_value(root.db1.d1.s1)", + "last_value(root.db1.d1.s1)", + "min_time(root.db1.d1.s1)", + "max_time(root.db1.d1.s1)", + "min_value(root.db1.d1.s1)", + "max_value(root.db1.d1.s1)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -1657,7 +1657,7 @@ public void aggregationFuncAlignedWithValueFilterTest() throws ClassNotFoundExce "select count(s1), sum(s1), avg(s1), " + "first_value(s1), last_value(s1), " + "min_time(s1), max_time(s1)," - + "max_value(s1), min_value(s1) from root.sg1.d1 where s1 < 10")) { + + "max_value(s1), min_value(s1) from root.db1.d1 where s1 < 10")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1688,17 +1688,17 @@ public void aggregationFuncAlignedWithValueFilterTest() throws ClassNotFoundExce public void countAllAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"6", "6", "9", "11", "6"}; String[] columnNames = { - "count(root.sg1.d1.s1)", - "count(root.sg1.d1.s2)", - "count(root.sg1.d1.s3)", - "count(root.sg1.d1.s4)", - "count(root.sg1.d1.s5)" + "count(root.db1.d1.s1)", + "count(root.db1.d1.s2)", + "count(root.db1.d1.s3)", + "count(root.db1.d1.s4)", + "count(root.db1.d1.s5)" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.d1 where s4 = true")) { + statement.executeQuery("select count(*) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1729,17 +1729,17 @@ public void countAllAlignedWithValueFilterTest() throws ClassNotFoundException { public void aggregationAllAlignedWithValueFilterTest() throws ClassNotFoundException { String[] retArray = new String[] {"160016.0", "11", "1", "13"}; String[] columnNames = { - "sum(root.sg1.d1.s1)", - "count(root.sg1.d1.s4)", - "min_value(root.sg1.d1.s3)", - "max_time(root.sg1.d1.s2)", + "sum(root.db1.d1.s1)", + "count(root.db1.d1.s4)", + "min_value(root.db1.d1.s3)", + "max_time(root.db1.d1.s2)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select sum(s1), count(s4), min_value(s3), max_time(s2) from root.sg1.d1 where s4 = true")) { + "select sum(s1), count(s4), min_value(s3), max_time(s2) from root.db1.d1 where s4 = true")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1771,46 +1771,46 @@ public void aggregationAllAlignedWithValueFilterTest() throws ClassNotFoundExcep public void selectAllAlignedWithoutValueFilterAlignByDeviceTest() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,1,1,true,aligned_test1", - "2,root.sg1.d1,2.0,2,2,null,aligned_test2", - "3,root.sg1.d1,30000.0,null,30000,true,aligned_unseq_test3", - "4,root.sg1.d1,4.0,4,null,true,aligned_test4", - "5,root.sg1.d1,5.0,5,null,true,aligned_test5", - "6,root.sg1.d1,6.0,6,6,true,null", - "7,root.sg1.d1,7.0,7,7,false,aligned_test7", - "8,root.sg1.d1,8.0,8,8,null,aligned_test8", - "9,root.sg1.d1,9.0,9,9,false,aligned_test9", - "10,root.sg1.d1,null,10,10,true,aligned_test10", - "11,root.sg1.d1,11.0,11,11,null,null", - "12,root.sg1.d1,12.0,12,12,null,null", - "13,root.sg1.d1,130000.0,130000,130000,true,aligned_unseq_test13", - "14,root.sg1.d1,14.0,14,14,null,null", - "15,root.sg1.d1,15.0,15,15,null,null", - "16,root.sg1.d1,16.0,16,16,null,null", - "17,root.sg1.d1,17.0,17,17,null,null", - "18,root.sg1.d1,18.0,18,18,null,null", - "19,root.sg1.d1,19.0,19,19,null,null", - "20,root.sg1.d1,20.0,20,20,null,null", - "21,root.sg1.d1,null,null,21,true,null", - "22,root.sg1.d1,null,null,22,true,null", - "23,root.sg1.d1,230000.0,null,230000,false,null", - "24,root.sg1.d1,null,null,24,true,null", - "25,root.sg1.d1,null,null,25,true,null", - "26,root.sg1.d1,null,null,26,false,null", - "27,root.sg1.d1,null,null,27,false,null", - "28,root.sg1.d1,null,null,28,false,null", - "29,root.sg1.d1,null,null,29,false,null", - "30,root.sg1.d1,null,null,30,false,null", - "31,root.sg1.d1,null,31,null,null,aligned_test31", - "32,root.sg1.d1,null,32,null,null,aligned_test32", - "33,root.sg1.d1,null,33,null,null,aligned_test33", - "34,root.sg1.d1,null,34,null,null,aligned_test34", - "35,root.sg1.d1,null,35,null,null,aligned_test35", - "36,root.sg1.d1,null,36,null,null,aligned_test36", - "37,root.sg1.d1,null,37,null,null,aligned_test37", - "38,root.sg1.d1,null,38,null,null,aligned_test38", - "39,root.sg1.d1,null,39,null,null,aligned_test39", - "40,root.sg1.d1,null,40,null,null,aligned_test40", + "1,root.db1.d1,1.0,1,1,true,aligned_test1", + "2,root.db1.d1,2.0,2,2,null,aligned_test2", + "3,root.db1.d1,30000.0,null,30000,true,aligned_unseq_test3", + "4,root.db1.d1,4.0,4,null,true,aligned_test4", + "5,root.db1.d1,5.0,5,null,true,aligned_test5", + "6,root.db1.d1,6.0,6,6,true,null", + "7,root.db1.d1,7.0,7,7,false,aligned_test7", + "8,root.db1.d1,8.0,8,8,null,aligned_test8", + "9,root.db1.d1,9.0,9,9,false,aligned_test9", + "10,root.db1.d1,null,10,10,true,aligned_test10", + "11,root.db1.d1,11.0,11,11,null,null", + "12,root.db1.d1,12.0,12,12,null,null", + "13,root.db1.d1,130000.0,130000,130000,true,aligned_unseq_test13", + "14,root.db1.d1,14.0,14,14,null,null", + "15,root.db1.d1,15.0,15,15,null,null", + "16,root.db1.d1,16.0,16,16,null,null", + "17,root.db1.d1,17.0,17,17,null,null", + "18,root.db1.d1,18.0,18,18,null,null", + "19,root.db1.d1,19.0,19,19,null,null", + "20,root.db1.d1,20.0,20,20,null,null", + "21,root.db1.d1,null,null,21,true,null", + "22,root.db1.d1,null,null,22,true,null", + "23,root.db1.d1,230000.0,null,230000,false,null", + "24,root.db1.d1,null,null,24,true,null", + "25,root.db1.d1,null,null,25,true,null", + "26,root.db1.d1,null,null,26,false,null", + "27,root.db1.d1,null,null,27,false,null", + "28,root.db1.d1,null,null,28,false,null", + "29,root.db1.d1,null,null,29,false,null", + "30,root.db1.d1,null,null,30,false,null", + "31,root.db1.d1,null,31,null,null,aligned_test31", + "32,root.db1.d1,null,32,null,null,aligned_test32", + "33,root.db1.d1,null,33,null,null,aligned_test33", + "34,root.db1.d1,null,34,null,null,aligned_test34", + "35,root.db1.d1,null,35,null,null,aligned_test35", + "36,root.db1.d1,null,36,null,null,aligned_test36", + "37,root.db1.d1,null,37,null,null,aligned_test37", + "38,root.db1.d1,null,38,null,null,aligned_test38", + "39,root.db1.d1,null,39,null,null,aligned_test39", + "40,root.db1.d1,null,40,null,null,aligned_test40", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -1819,7 +1819,7 @@ public void selectAllAlignedWithoutValueFilterAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 align by device")) { + statement.executeQuery("select * from root.db1.d1 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1850,86 +1850,86 @@ public void selectAllAlignedWithoutValueFilterAlignByDeviceTest() { public void selectAllAlignedAndNonAlignedAlignByDeviceTest() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,1,1,true,aligned_test1", - "2,root.sg1.d1,2.0,2,2,null,aligned_test2", - "3,root.sg1.d1,30000.0,null,30000,true,aligned_unseq_test3", - "4,root.sg1.d1,4.0,4,null,true,aligned_test4", - "5,root.sg1.d1,5.0,5,null,true,aligned_test5", - "6,root.sg1.d1,6.0,6,6,true,null", - "7,root.sg1.d1,7.0,7,7,false,aligned_test7", - "8,root.sg1.d1,8.0,8,8,null,aligned_test8", - "9,root.sg1.d1,9.0,9,9,false,aligned_test9", - "10,root.sg1.d1,null,10,10,true,aligned_test10", - "11,root.sg1.d1,11.0,11,11,null,null", - "12,root.sg1.d1,12.0,12,12,null,null", - "13,root.sg1.d1,130000.0,130000,130000,true,aligned_unseq_test13", - "14,root.sg1.d1,14.0,14,14,null,null", - "15,root.sg1.d1,15.0,15,15,null,null", - "16,root.sg1.d1,16.0,16,16,null,null", - "17,root.sg1.d1,17.0,17,17,null,null", - "18,root.sg1.d1,18.0,18,18,null,null", - "19,root.sg1.d1,19.0,19,19,null,null", - "20,root.sg1.d1,20.0,20,20,null,null", - "21,root.sg1.d1,null,null,21,true,null", - "22,root.sg1.d1,null,null,22,true,null", - "23,root.sg1.d1,230000.0,null,230000,false,null", - "24,root.sg1.d1,null,null,24,true,null", - "25,root.sg1.d1,null,null,25,true,null", - "26,root.sg1.d1,null,null,26,false,null", - "27,root.sg1.d1,null,null,27,false,null", - "28,root.sg1.d1,null,null,28,false,null", - "29,root.sg1.d1,null,null,29,false,null", - "30,root.sg1.d1,null,null,30,false,null", - "31,root.sg1.d1,null,31,null,null,aligned_test31", - "32,root.sg1.d1,null,32,null,null,aligned_test32", - "33,root.sg1.d1,null,33,null,null,aligned_test33", - "34,root.sg1.d1,null,34,null,null,aligned_test34", - "35,root.sg1.d1,null,35,null,null,aligned_test35", - "36,root.sg1.d1,null,36,null,null,aligned_test36", - "37,root.sg1.d1,null,37,null,null,aligned_test37", - "38,root.sg1.d1,null,38,null,null,aligned_test38", - "39,root.sg1.d1,null,39,null,null,aligned_test39", - "40,root.sg1.d1,null,40,null,null,aligned_test40", - "1,root.sg1.d2,1.0,1,1,true,non_aligned_test1", - "2,root.sg1.d2,2.0,2,2,null,non_aligned_test2", - "3,root.sg1.d2,3.0,null,3,false,non_aligned_test3", - "4,root.sg1.d2,4.0,4,null,true,non_aligned_test4", - "5,root.sg1.d2,5.0,5,null,true,non_aligned_test5", - "6,root.sg1.d2,6.0,6,6,true,null", - "7,root.sg1.d2,7.0,7,7,false,non_aligned_test7", - "8,root.sg1.d2,8.0,8,8,null,non_aligned_test8", - "9,root.sg1.d2,9.0,9,9,false,non_aligned_test9", - "10,root.sg1.d2,null,10,10,true,non_aligned_test10", - "11,root.sg1.d2,11.0,11,11,null,null", - "12,root.sg1.d2,12.0,12,12,null,null", - "13,root.sg1.d2,13.0,13,13,null,null", - "14,root.sg1.d2,14.0,14,14,null,null", - "15,root.sg1.d2,15.0,15,15,null,null", - "16,root.sg1.d2,16.0,16,16,null,null", - "17,root.sg1.d2,17.0,17,17,null,null", - "18,root.sg1.d2,18.0,18,18,null,null", - "19,root.sg1.d2,19.0,19,19,null,null", - "20,root.sg1.d2,20.0,20,20,null,null", - "21,root.sg1.d2,null,null,21,true,null", - "22,root.sg1.d2,null,null,22,true,null", - "23,root.sg1.d2,null,null,23,true,null", - "24,root.sg1.d2,null,null,24,true,null", - "25,root.sg1.d2,null,null,25,true,null", - "26,root.sg1.d2,null,null,26,false,null", - "27,root.sg1.d2,null,null,27,false,null", - "28,root.sg1.d2,null,null,28,false,null", - "29,root.sg1.d2,null,null,29,false,null", - "30,root.sg1.d2,null,null,30,false,null", - "31,root.sg1.d2,null,31,null,null,non_aligned_test31", - "32,root.sg1.d2,null,32,null,null,non_aligned_test32", - "33,root.sg1.d2,null,33,null,null,non_aligned_test33", - "34,root.sg1.d2,null,34,null,null,non_aligned_test34", - "35,root.sg1.d2,null,35,null,null,non_aligned_test35", - "36,root.sg1.d2,null,36,null,null,non_aligned_test36", - "37,root.sg1.d2,null,37,null,null,non_aligned_test37", - "38,root.sg1.d2,null,38,null,null,non_aligned_test38", - "39,root.sg1.d2,null,39,null,null,non_aligned_test39", - "40,root.sg1.d2,null,40,null,null,non_aligned_test40", + "1,root.db1.d1,1.0,1,1,true,aligned_test1", + "2,root.db1.d1,2.0,2,2,null,aligned_test2", + "3,root.db1.d1,30000.0,null,30000,true,aligned_unseq_test3", + "4,root.db1.d1,4.0,4,null,true,aligned_test4", + "5,root.db1.d1,5.0,5,null,true,aligned_test5", + "6,root.db1.d1,6.0,6,6,true,null", + "7,root.db1.d1,7.0,7,7,false,aligned_test7", + "8,root.db1.d1,8.0,8,8,null,aligned_test8", + "9,root.db1.d1,9.0,9,9,false,aligned_test9", + "10,root.db1.d1,null,10,10,true,aligned_test10", + "11,root.db1.d1,11.0,11,11,null,null", + "12,root.db1.d1,12.0,12,12,null,null", + "13,root.db1.d1,130000.0,130000,130000,true,aligned_unseq_test13", + "14,root.db1.d1,14.0,14,14,null,null", + "15,root.db1.d1,15.0,15,15,null,null", + "16,root.db1.d1,16.0,16,16,null,null", + "17,root.db1.d1,17.0,17,17,null,null", + "18,root.db1.d1,18.0,18,18,null,null", + "19,root.db1.d1,19.0,19,19,null,null", + "20,root.db1.d1,20.0,20,20,null,null", + "21,root.db1.d1,null,null,21,true,null", + "22,root.db1.d1,null,null,22,true,null", + "23,root.db1.d1,230000.0,null,230000,false,null", + "24,root.db1.d1,null,null,24,true,null", + "25,root.db1.d1,null,null,25,true,null", + "26,root.db1.d1,null,null,26,false,null", + "27,root.db1.d1,null,null,27,false,null", + "28,root.db1.d1,null,null,28,false,null", + "29,root.db1.d1,null,null,29,false,null", + "30,root.db1.d1,null,null,30,false,null", + "31,root.db1.d1,null,31,null,null,aligned_test31", + "32,root.db1.d1,null,32,null,null,aligned_test32", + "33,root.db1.d1,null,33,null,null,aligned_test33", + "34,root.db1.d1,null,34,null,null,aligned_test34", + "35,root.db1.d1,null,35,null,null,aligned_test35", + "36,root.db1.d1,null,36,null,null,aligned_test36", + "37,root.db1.d1,null,37,null,null,aligned_test37", + "38,root.db1.d1,null,38,null,null,aligned_test38", + "39,root.db1.d1,null,39,null,null,aligned_test39", + "40,root.db1.d1,null,40,null,null,aligned_test40", + "1,root.db1.d2,1.0,1,1,true,non_aligned_test1", + "2,root.db1.d2,2.0,2,2,null,non_aligned_test2", + "3,root.db1.d2,3.0,null,3,false,non_aligned_test3", + "4,root.db1.d2,4.0,4,null,true,non_aligned_test4", + "5,root.db1.d2,5.0,5,null,true,non_aligned_test5", + "6,root.db1.d2,6.0,6,6,true,null", + "7,root.db1.d2,7.0,7,7,false,non_aligned_test7", + "8,root.db1.d2,8.0,8,8,null,non_aligned_test8", + "9,root.db1.d2,9.0,9,9,false,non_aligned_test9", + "10,root.db1.d2,null,10,10,true,non_aligned_test10", + "11,root.db1.d2,11.0,11,11,null,null", + "12,root.db1.d2,12.0,12,12,null,null", + "13,root.db1.d2,13.0,13,13,null,null", + "14,root.db1.d2,14.0,14,14,null,null", + "15,root.db1.d2,15.0,15,15,null,null", + "16,root.db1.d2,16.0,16,16,null,null", + "17,root.db1.d2,17.0,17,17,null,null", + "18,root.db1.d2,18.0,18,18,null,null", + "19,root.db1.d2,19.0,19,19,null,null", + "20,root.db1.d2,20.0,20,20,null,null", + "21,root.db1.d2,null,null,21,true,null", + "22,root.db1.d2,null,null,22,true,null", + "23,root.db1.d2,null,null,23,true,null", + "24,root.db1.d2,null,null,24,true,null", + "25,root.db1.d2,null,null,25,true,null", + "26,root.db1.d2,null,null,26,false,null", + "27,root.db1.d2,null,null,27,false,null", + "28,root.db1.d2,null,null,28,false,null", + "29,root.db1.d2,null,null,29,false,null", + "30,root.db1.d2,null,null,30,false,null", + "31,root.db1.d2,null,31,null,null,non_aligned_test31", + "32,root.db1.d2,null,32,null,null,non_aligned_test32", + "33,root.db1.d2,null,33,null,null,non_aligned_test33", + "34,root.db1.d2,null,34,null,null,non_aligned_test34", + "35,root.db1.d2,null,35,null,null,non_aligned_test35", + "36,root.db1.d2,null,36,null,null,non_aligned_test36", + "37,root.db1.d2,null,37,null,null,non_aligned_test37", + "38,root.db1.d2,null,38,null,null,non_aligned_test38", + "39,root.db1.d2,null,39,null,null,non_aligned_test39", + "40,root.db1.d2,null,40,null,null,non_aligned_test40", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -1938,7 +1938,7 @@ public void selectAllAlignedAndNonAlignedAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.* align by device")) { + statement.executeQuery("select * from root.db1.* align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -1969,31 +1969,31 @@ public void selectAllAlignedAndNonAlignedAlignByDeviceTest() { public void selectAllAlignedWithTimeFilterAlignByDeviceTest() { String[] retArray = new String[] { - "9,root.sg1.d1,9.0,9,9,false,aligned_test9", - "10,root.sg1.d1,null,10,10,true,aligned_test10", - "11,root.sg1.d1,11.0,11,11,null,null", - "12,root.sg1.d1,12.0,12,12,null,null", - "13,root.sg1.d1,130000.0,130000,130000,true,aligned_unseq_test13", - "14,root.sg1.d1,14.0,14,14,null,null", - "15,root.sg1.d1,15.0,15,15,null,null", - "16,root.sg1.d1,16.0,16,16,null,null", - "17,root.sg1.d1,17.0,17,17,null,null", - "18,root.sg1.d1,18.0,18,18,null,null", - "19,root.sg1.d1,19.0,19,19,null,null", - "20,root.sg1.d1,20.0,20,20,null,null", - "21,root.sg1.d1,null,null,21,true,null", - "22,root.sg1.d1,null,null,22,true,null", - "23,root.sg1.d1,230000.0,null,230000,false,null", - "24,root.sg1.d1,null,null,24,true,null", - "25,root.sg1.d1,null,null,25,true,null", - "26,root.sg1.d1,null,null,26,false,null", - "27,root.sg1.d1,null,null,27,false,null", - "28,root.sg1.d1,null,null,28,false,null", - "29,root.sg1.d1,null,null,29,false,null", - "30,root.sg1.d1,null,null,30,false,null", - "31,root.sg1.d1,null,31,null,null,aligned_test31", - "32,root.sg1.d1,null,32,null,null,aligned_test32", - "33,root.sg1.d1,null,33,null,null,aligned_test33", + "9,root.db1.d1,9.0,9,9,false,aligned_test9", + "10,root.db1.d1,null,10,10,true,aligned_test10", + "11,root.db1.d1,11.0,11,11,null,null", + "12,root.db1.d1,12.0,12,12,null,null", + "13,root.db1.d1,130000.0,130000,130000,true,aligned_unseq_test13", + "14,root.db1.d1,14.0,14,14,null,null", + "15,root.db1.d1,15.0,15,15,null,null", + "16,root.db1.d1,16.0,16,16,null,null", + "17,root.db1.d1,17.0,17,17,null,null", + "18,root.db1.d1,18.0,18,18,null,null", + "19,root.db1.d1,19.0,19,19,null,null", + "20,root.db1.d1,20.0,20,20,null,null", + "21,root.db1.d1,null,null,21,true,null", + "22,root.db1.d1,null,null,22,true,null", + "23,root.db1.d1,230000.0,null,230000,false,null", + "24,root.db1.d1,null,null,24,true,null", + "25,root.db1.d1,null,null,25,true,null", + "26,root.db1.d1,null,null,26,false,null", + "27,root.db1.d1,null,null,27,false,null", + "28,root.db1.d1,null,null,28,false,null", + "29,root.db1.d1,null,null,29,false,null", + "30,root.db1.d1,null,null,30,false,null", + "31,root.db1.d1,null,31,null,null,aligned_test31", + "32,root.db1.d1,null,32,null,null,aligned_test32", + "33,root.db1.d1,null,33,null,null,aligned_test33", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -2003,7 +2003,7 @@ public void selectAllAlignedWithTimeFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where time >= 9 and time <= 33 align by device")) { + "select * from root.db1.d1 where time >= 9 and time <= 33 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2034,46 +2034,46 @@ public void selectAllAlignedWithTimeFilterAlignByDeviceTest() { public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest1() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,true,aligned_test1", - "2,root.sg1.d1,2.0,null,aligned_test2", - "3,root.sg1.d1,30000.0,true,aligned_unseq_test3", - "4,root.sg1.d1,4.0,true,aligned_test4", - "5,root.sg1.d1,5.0,true,aligned_test5", - "6,root.sg1.d1,6.0,true,null", - "7,root.sg1.d1,7.0,false,aligned_test7", - "8,root.sg1.d1,8.0,null,aligned_test8", - "9,root.sg1.d1,9.0,false,aligned_test9", - "10,root.sg1.d1,null,true,aligned_test10", - "11,root.sg1.d1,11.0,null,null", - "12,root.sg1.d1,12.0,null,null", - "13,root.sg1.d1,130000.0,true,aligned_unseq_test13", - "14,root.sg1.d1,14.0,null,null", - "15,root.sg1.d1,15.0,null,null", - "16,root.sg1.d1,16.0,null,null", - "17,root.sg1.d1,17.0,null,null", - "18,root.sg1.d1,18.0,null,null", - "19,root.sg1.d1,19.0,null,null", - "20,root.sg1.d1,20.0,null,null", - "21,root.sg1.d1,null,true,null", - "22,root.sg1.d1,null,true,null", - "23,root.sg1.d1,230000.0,false,null", - "24,root.sg1.d1,null,true,null", - "25,root.sg1.d1,null,true,null", - "26,root.sg1.d1,null,false,null", - "27,root.sg1.d1,null,false,null", - "28,root.sg1.d1,null,false,null", - "29,root.sg1.d1,null,false,null", - "30,root.sg1.d1,null,false,null", - "31,root.sg1.d1,null,null,aligned_test31", - "32,root.sg1.d1,null,null,aligned_test32", - "33,root.sg1.d1,null,null,aligned_test33", - "34,root.sg1.d1,null,null,aligned_test34", - "35,root.sg1.d1,null,null,aligned_test35", - "36,root.sg1.d1,null,null,aligned_test36", - "37,root.sg1.d1,null,null,aligned_test37", - "38,root.sg1.d1,null,null,aligned_test38", - "39,root.sg1.d1,null,null,aligned_test39", - "40,root.sg1.d1,null,null,aligned_test40", + "1,root.db1.d1,1.0,true,aligned_test1", + "2,root.db1.d1,2.0,null,aligned_test2", + "3,root.db1.d1,30000.0,true,aligned_unseq_test3", + "4,root.db1.d1,4.0,true,aligned_test4", + "5,root.db1.d1,5.0,true,aligned_test5", + "6,root.db1.d1,6.0,true,null", + "7,root.db1.d1,7.0,false,aligned_test7", + "8,root.db1.d1,8.0,null,aligned_test8", + "9,root.db1.d1,9.0,false,aligned_test9", + "10,root.db1.d1,null,true,aligned_test10", + "11,root.db1.d1,11.0,null,null", + "12,root.db1.d1,12.0,null,null", + "13,root.db1.d1,130000.0,true,aligned_unseq_test13", + "14,root.db1.d1,14.0,null,null", + "15,root.db1.d1,15.0,null,null", + "16,root.db1.d1,16.0,null,null", + "17,root.db1.d1,17.0,null,null", + "18,root.db1.d1,18.0,null,null", + "19,root.db1.d1,19.0,null,null", + "20,root.db1.d1,20.0,null,null", + "21,root.db1.d1,null,true,null", + "22,root.db1.d1,null,true,null", + "23,root.db1.d1,230000.0,false,null", + "24,root.db1.d1,null,true,null", + "25,root.db1.d1,null,true,null", + "26,root.db1.d1,null,false,null", + "27,root.db1.d1,null,false,null", + "28,root.db1.d1,null,false,null", + "29,root.db1.d1,null,false,null", + "30,root.db1.d1,null,false,null", + "31,root.db1.d1,null,null,aligned_test31", + "32,root.db1.d1,null,null,aligned_test32", + "33,root.db1.d1,null,null,aligned_test33", + "34,root.db1.d1,null,null,aligned_test34", + "35,root.db1.d1,null,null,aligned_test35", + "36,root.db1.d1,null,null,aligned_test36", + "37,root.db1.d1,null,null,aligned_test37", + "38,root.db1.d1,null,null,aligned_test38", + "39,root.db1.d1,null,null,aligned_test39", + "40,root.db1.d1,null,null,aligned_test40", }; String[] columnNames = {"Device", "s1", "s4", "s5"}; @@ -2082,7 +2082,7 @@ public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest1() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1,s4,s5 from root.sg1.d1 align by device")) { + statement.executeQuery("select s1,s4,s5 from root.db1.d1 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2113,36 +2113,36 @@ public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest1() { public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest2() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,true", - "2,root.sg1.d1,2.0,null", - "3,root.sg1.d1,30000.0,true", - "4,root.sg1.d1,4.0,true", - "5,root.sg1.d1,5.0,true", - "6,root.sg1.d1,6.0,true", - "7,root.sg1.d1,7.0,false", - "8,root.sg1.d1,8.0,null", - "9,root.sg1.d1,9.0,false", - "10,root.sg1.d1,null,true", - "11,root.sg1.d1,11.0,null", - "12,root.sg1.d1,12.0,null", - "13,root.sg1.d1,130000.0,true", - "14,root.sg1.d1,14.0,null", - "15,root.sg1.d1,15.0,null", - "16,root.sg1.d1,16.0,null", - "17,root.sg1.d1,17.0,null", - "18,root.sg1.d1,18.0,null", - "19,root.sg1.d1,19.0,null", - "20,root.sg1.d1,20.0,null", - "21,root.sg1.d1,null,true", - "22,root.sg1.d1,null,true", - "23,root.sg1.d1,230000.0,false", - "24,root.sg1.d1,null,true", - "25,root.sg1.d1,null,true", - "26,root.sg1.d1,null,false", - "27,root.sg1.d1,null,false", - "28,root.sg1.d1,null,false", - "29,root.sg1.d1,null,false", - "30,root.sg1.d1,null,false", + "1,root.db1.d1,1.0,true", + "2,root.db1.d1,2.0,null", + "3,root.db1.d1,30000.0,true", + "4,root.db1.d1,4.0,true", + "5,root.db1.d1,5.0,true", + "6,root.db1.d1,6.0,true", + "7,root.db1.d1,7.0,false", + "8,root.db1.d1,8.0,null", + "9,root.db1.d1,9.0,false", + "10,root.db1.d1,null,true", + "11,root.db1.d1,11.0,null", + "12,root.db1.d1,12.0,null", + "13,root.db1.d1,130000.0,true", + "14,root.db1.d1,14.0,null", + "15,root.db1.d1,15.0,null", + "16,root.db1.d1,16.0,null", + "17,root.db1.d1,17.0,null", + "18,root.db1.d1,18.0,null", + "19,root.db1.d1,19.0,null", + "20,root.db1.d1,20.0,null", + "21,root.db1.d1,null,true", + "22,root.db1.d1,null,true", + "23,root.db1.d1,230000.0,false", + "24,root.db1.d1,null,true", + "25,root.db1.d1,null,true", + "26,root.db1.d1,null,false", + "27,root.db1.d1,null,false", + "28,root.db1.d1,null,false", + "29,root.db1.d1,null,false", + "30,root.db1.d1,null,false", }; String[] columnNames = {"Device", "s1", "s4"}; @@ -2151,7 +2151,7 @@ public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest2() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1,s4 from root.sg1.d1 align by device")) { + statement.executeQuery("select s1,s4 from root.db1.d1 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2182,25 +2182,25 @@ public void selectSomeAlignedWithoutValueFilterAlignByDeviceTest2() { public void selectSomeAlignedWithTimeFilterAlignByDeviceTest() { String[] retArray = new String[] { - "16,root.sg1.d1,16.0,null,null", - "17,root.sg1.d1,17.0,null,null", - "18,root.sg1.d1,18.0,null,null", - "19,root.sg1.d1,19.0,null,null", - "20,root.sg1.d1,20.0,null,null", - "21,root.sg1.d1,null,true,null", - "22,root.sg1.d1,null,true,null", - "23,root.sg1.d1,230000.0,false,null", - "24,root.sg1.d1,null,true,null", - "25,root.sg1.d1,null,true,null", - "26,root.sg1.d1,null,false,null", - "27,root.sg1.d1,null,false,null", - "28,root.sg1.d1,null,false,null", - "29,root.sg1.d1,null,false,null", - "30,root.sg1.d1,null,false,null", - "31,root.sg1.d1,null,null,aligned_test31", - "32,root.sg1.d1,null,null,aligned_test32", - "33,root.sg1.d1,null,null,aligned_test33", - "34,root.sg1.d1,null,null,aligned_test34", + "16,root.db1.d1,16.0,null,null", + "17,root.db1.d1,17.0,null,null", + "18,root.db1.d1,18.0,null,null", + "19,root.db1.d1,19.0,null,null", + "20,root.db1.d1,20.0,null,null", + "21,root.db1.d1,null,true,null", + "22,root.db1.d1,null,true,null", + "23,root.db1.d1,230000.0,false,null", + "24,root.db1.d1,null,true,null", + "25,root.db1.d1,null,true,null", + "26,root.db1.d1,null,false,null", + "27,root.db1.d1,null,false,null", + "28,root.db1.d1,null,false,null", + "29,root.db1.d1,null,false,null", + "30,root.db1.d1,null,false,null", + "31,root.db1.d1,null,null,aligned_test31", + "32,root.db1.d1,null,null,aligned_test32", + "33,root.db1.d1,null,null,aligned_test33", + "34,root.db1.d1,null,null,aligned_test34", }; String[] columnNames = {"Device", "s1", "s4", "s5"}; @@ -2210,7 +2210,7 @@ public void selectSomeAlignedWithTimeFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where time >= 16 and time <= 34 align by device")) { + "select s1,s4,s5 from root.db1.d1 where time >= 16 and time <= 34 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2241,17 +2241,17 @@ public void selectSomeAlignedWithTimeFilterAlignByDeviceTest() { public void selectAllAlignedWithValueFilterAlignByDeviceTest1() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,1,1,true,aligned_test1", - "3,root.sg1.d1,30000.0,null,30000,true,aligned_unseq_test3", - "4,root.sg1.d1,4.0,4,null,true,aligned_test4", - "5,root.sg1.d1,5.0,5,null,true,aligned_test5", - "6,root.sg1.d1,6.0,6,6,true,null", - "10,root.sg1.d1,null,10,10,true,aligned_test10", - "13,root.sg1.d1,130000.0,130000,130000,true,aligned_unseq_test13", - "21,root.sg1.d1,null,null,21,true,null", - "22,root.sg1.d1,null,null,22,true,null", - "24,root.sg1.d1,null,null,24,true,null", - "25,root.sg1.d1,null,null,25,true,null", + "1,root.db1.d1,1.0,1,1,true,aligned_test1", + "3,root.db1.d1,30000.0,null,30000,true,aligned_unseq_test3", + "4,root.db1.d1,4.0,4,null,true,aligned_test4", + "5,root.db1.d1,5.0,5,null,true,aligned_test5", + "6,root.db1.d1,6.0,6,6,true,null", + "10,root.db1.d1,null,10,10,true,aligned_test10", + "13,root.db1.d1,130000.0,130000,130000,true,aligned_unseq_test13", + "21,root.db1.d1,null,null,21,true,null", + "22,root.db1.d1,null,null,22,true,null", + "24,root.db1.d1,null,null,24,true,null", + "25,root.db1.d1,null,null,25,true,null", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -2260,7 +2260,7 @@ public void selectAllAlignedWithValueFilterAlignByDeviceTest1() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where s4 = true align by device")) { + statement.executeQuery("select * from root.db1.d1 where s4 = true align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2291,14 +2291,14 @@ public void selectAllAlignedWithValueFilterAlignByDeviceTest1() { public void selectAllAlignedWithValueFilterAlignByDeviceTest2() { String[] retArray = new String[] { - "12,root.sg1.d1,12.0,12,12,null,null", - "14,root.sg1.d1,14.0,14,14,null,null", - "15,root.sg1.d1,15.0,15,15,null,null", - "16,root.sg1.d1,16.0,16,16,null,null", - "17,root.sg1.d1,17.0,17,17,null,null", - "18,root.sg1.d1,18.0,18,18,null,null", - "19,root.sg1.d1,19.0,19,19,null,null", - "20,root.sg1.d1,20.0,20,20,null,null", + "12,root.db1.d1,12.0,12,12,null,null", + "14,root.db1.d1,14.0,14,14,null,null", + "15,root.db1.d1,15.0,15,15,null,null", + "16,root.db1.d1,16.0,16,16,null,null", + "17,root.db1.d1,17.0,17,17,null,null", + "18,root.db1.d1,18.0,18,18,null,null", + "19,root.db1.d1,19.0,19,19,null,null", + "20,root.db1.d1,20.0,20,20,null,null", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -2308,7 +2308,7 @@ public void selectAllAlignedWithValueFilterAlignByDeviceTest2() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where s1 > 11 and s2 <= 33 align by device")) { + "select * from root.db1.d1 where s1 > 11 and s2 <= 33 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2339,14 +2339,14 @@ public void selectAllAlignedWithValueFilterAlignByDeviceTest2() { public void selectAllAlignedWithTimeAndValueFilterAlignByDeviceTest1() { String[] retArray = new String[] { - "9,root.sg1.d1,9.0,9,9,false,aligned_test9", - "11,root.sg1.d1,11.0,11,11,null,null", - "12,root.sg1.d1,12.0,12,12,null,null", - "14,root.sg1.d1,14.0,14,14,null,null", - "15,root.sg1.d1,15.0,15,15,null,null", - "16,root.sg1.d1,16.0,16,16,null,null", - "17,root.sg1.d1,17.0,17,17,null,null", - "18,root.sg1.d1,18.0,18,18,null,null", + "9,root.db1.d1,9.0,9,9,false,aligned_test9", + "11,root.db1.d1,11.0,11,11,null,null", + "12,root.db1.d1,12.0,12,12,null,null", + "14,root.db1.d1,14.0,14,14,null,null", + "15,root.db1.d1,15.0,15,15,null,null", + "16,root.db1.d1,16.0,16,16,null,null", + "17,root.db1.d1,17.0,17,17,null,null", + "18,root.db1.d1,18.0,18,18,null,null", }; String[] columnNames = {"Device", "s1", "s2", "s3", "s4", "s5"}; @@ -2356,7 +2356,7 @@ public void selectAllAlignedWithTimeAndValueFilterAlignByDeviceTest1() { try (ResultSet resultSet = statement.executeQuery( - "select * from root.sg1.d1 where time >= 9 and time <= 33 and s1 < 19 align by device")) { + "select * from root.db1.d1 where time >= 9 and time <= 33 and s1 < 19 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2387,20 +2387,20 @@ public void selectAllAlignedWithTimeAndValueFilterAlignByDeviceTest1() { public void selectSomeAlignedWithValueFilterAlignByDeviceTest1() { String[] retArray = new String[] { - "1,root.sg1.d1,1.0,true,aligned_test1", - "2,root.sg1.d1,2.0,null,aligned_test2", - "4,root.sg1.d1,4.0,true,aligned_test4", - "5,root.sg1.d1,5.0,true,aligned_test5", - "6,root.sg1.d1,6.0,true,null", - "7,root.sg1.d1,7.0,false,aligned_test7", - "8,root.sg1.d1,8.0,null,aligned_test8", - "9,root.sg1.d1,9.0,false,aligned_test9", - "11,root.sg1.d1,11.0,null,null", - "12,root.sg1.d1,12.0,null,null", - "14,root.sg1.d1,14.0,null,null", - "15,root.sg1.d1,15.0,null,null", - "16,root.sg1.d1,16.0,null,null", - "34,root.sg1.d1,null,null,aligned_test34", + "1,root.db1.d1,1.0,true,aligned_test1", + "2,root.db1.d1,2.0,null,aligned_test2", + "4,root.db1.d1,4.0,true,aligned_test4", + "5,root.db1.d1,5.0,true,aligned_test5", + "6,root.db1.d1,6.0,true,null", + "7,root.db1.d1,7.0,false,aligned_test7", + "8,root.db1.d1,8.0,null,aligned_test8", + "9,root.db1.d1,9.0,false,aligned_test9", + "11,root.db1.d1,11.0,null,null", + "12,root.db1.d1,12.0,null,null", + "14,root.db1.d1,14.0,null,null", + "15,root.db1.d1,15.0,null,null", + "16,root.db1.d1,16.0,null,null", + "34,root.db1.d1,null,null,aligned_test34", }; String[] columnNames = {"Device", "s1", "s4", "s5"}; @@ -2410,7 +2410,7 @@ public void selectSomeAlignedWithValueFilterAlignByDeviceTest1() { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where s1 < 17 or s5 = 'aligned_test34' align by device")) { + "select s1,s4,s5 from root.db1.d1 where s1 < 17 or s5 = 'aligned_test34' align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2441,7 +2441,7 @@ public void selectSomeAlignedWithValueFilterAlignByDeviceTest1() { public void selectSomeAlignedWithValueFilterAlignByDeviceTest2() { String[] retArray = new String[] { - "7,root.sg1.d1,7.0,false", "9,root.sg1.d1,9.0,false", + "7,root.db1.d1,7.0,false", "9,root.db1.d1,9.0,false", }; String[] columnNames = {"Device", "s1", "s4"}; @@ -2451,7 +2451,7 @@ public void selectSomeAlignedWithValueFilterAlignByDeviceTest2() { try (ResultSet resultSet = statement.executeQuery( - "select s1,s4 from root.sg1.d1 where s1 < 19 and s4 = false align by device")) { + "select s1,s4 from root.db1.d1 where s1 < 19 and s4 = false align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2480,7 +2480,7 @@ public void selectSomeAlignedWithValueFilterAlignByDeviceTest2() { @Test public void countAllAlignedWithoutTimeFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1", "20", "29", "28", "19", "20"}; + String[] retArray = new String[] {"root.db1.d1", "20", "29", "28", "19", "20"}; String[] columnNames = { "Device", "count(s1)", "count(s2)", "count(s3)", "count(s4)", "count(s5)" }; @@ -2489,7 +2489,7 @@ public void countAllAlignedWithoutTimeFilterAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.d1 align by device")) { + statement.executeQuery("select count(*) from root.db1.d1 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2518,7 +2518,7 @@ public void countAllAlignedWithoutTimeFilterAlignByDeviceTest() { @Test public void countAllAlignedAndNonAlignedWithoutTimeFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1,20,29,28,19,20,", "root.sg1.d2,19,29,28,18,19,"}; + String[] retArray = new String[] {"root.db1.d1,20,29,28,19,20,", "root.db1.d2,19,29,28,18,19,"}; String[] columnNames = { "Device", "count(s1)", "count(s2)", "count(s3)", "count(s4)", "count(s5)" }; @@ -2527,7 +2527,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.* align by device")) { + statement.executeQuery("select count(*) from root.db1.* align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2554,7 +2554,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterAlignByDeviceTest() { @Test public void countAllAlignedWithTimeFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1", "12", "15", "22", "13", "6"}; + String[] retArray = new String[] {"root.db1.d1", "12", "15", "22", "13", "6"}; String[] columnNames = { "Device", "count(s1)", "count(s2)", "count(s3)", "count(s4)", "count(s5)" }; @@ -2564,7 +2564,7 @@ public void countAllAlignedWithTimeFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 where time >= 9 and time <= 33 align by device")) { + "select count(*) from root.db1.d1 where time >= 9 and time <= 33 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2616,7 +2616,7 @@ public void aggregateSomeAlignedWithoutTimeFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select count(s1),count(s2),count(s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.sg1.d1 align by device")) { + "select count(s1),count(s2),count(s3),sum(s1),sum(s2),sum(s3),avg(s1),avg(s2),avg(s3) from root.db1.d1 align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2645,7 +2645,7 @@ public void aggregateSomeAlignedWithoutTimeFilterAlignByDeviceTest() { @Test public void countAlignedWithValueFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1", "11"}; + String[] retArray = new String[] {"root.db1.d1", "11"}; String[] columnNames = {"Device", "count(s4)"}; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -2653,7 +2653,7 @@ public void countAlignedWithValueFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select count(s4) from root.sg1.d1 where s4 = true align by device")) { + "select count(s4) from root.db1.d1 where s4 = true align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2683,7 +2683,7 @@ public void countAlignedWithValueFilterAlignByDeviceTest() { @Test public void aggregationFuncAlignedWithValueFilterAlignByDeviceTest() { String[] retArray = - new String[] {"root.sg1.d1", "8", "42.0", "5.25", "1.0", "9.0", "1", "9", "1.0", "9.0"}; + new String[] {"root.db1.d1", "8", "42.0", "5.25", "1.0", "9.0", "1", "9", "1.0", "9.0"}; String[] columnNames = { "Device", "count(s1)", @@ -2705,7 +2705,7 @@ public void aggregationFuncAlignedWithValueFilterAlignByDeviceTest() { "select count(s1), sum(s1), avg(s1), " + "first_value(s1), last_value(s1), " + "min_time(s1), max_time(s1)," - + "max_value(s1), min_value(s1) from root.sg1.d1 where s1 < 10 " + + "max_value(s1), min_value(s1) from root.db1.d1 where s1 < 10 " + "align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence @@ -2735,7 +2735,7 @@ public void aggregationFuncAlignedWithValueFilterAlignByDeviceTest() { @Test public void countAllAlignedWithValueFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1", "6", "6", "9", "11", "6"}; + String[] retArray = new String[] {"root.db1.d1", "6", "6", "9", "11", "6"}; String[] columnNames = { "Device", "count(s1)", "count(s2)", "count(s3)", "count(s4)", "count(s5)" }; @@ -2745,7 +2745,7 @@ public void countAllAlignedWithValueFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 where s4 = true " + "align by device")) { + "select count(*) from root.db1.d1 where s4 = true " + "align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2774,7 +2774,7 @@ public void countAllAlignedWithValueFilterAlignByDeviceTest() { @Test public void aggregationAllAlignedWithValueFilterAlignByDeviceTest() { - String[] retArray = new String[] {"root.sg1.d1", "160016.0", "11", "1", "13"}; + String[] retArray = new String[] {"root.db1.d1", "160016.0", "11", "1", "13"}; String[] columnNames = { "Device", "sum(s1)", "count(s4)", "min_value(s3)", "max_time(s2)", }; @@ -2784,7 +2784,7 @@ public void aggregationAllAlignedWithValueFilterAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select sum(s1), count(s4), min_value(s3), max_time(s2) from root.sg1.d1 where s4 = true " + "select sum(s1), count(s4), min_value(s3), max_time(s2) from root.db1.d1 where s4 = true " + "align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence @@ -2816,17 +2816,17 @@ public void aggregationAllAlignedWithValueFilterAlignByDeviceTest() { public void countSumAvgGroupByTimeAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,4,40.0,7.5", - "11,root.sg1.d1,10,130142.0,13014.2", - "21,root.sg1.d1,1,null,230000.0", - "31,root.sg1.d1,0,355.0,null" + "1,root.db1.d1,4,40.0,7.5", + "11,root.db1.d1,10,130142.0,13014.2", + "21,root.db1.d1,1,null,230000.0", + "31,root.db1.d1,0,355.0,null" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -2852,10 +2852,10 @@ public void countSumAvgGroupByTimeAlignByDeviceTest() throws SQLException { public void maxMinValueGroupByTimeAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,10,6.0,10,6", - "11,root.sg1.d1,130000,11.0,20,11", - "21,root.sg1.d1,230000,230000.0,null,21", - "31,root.sg1.d1,null,null,40,null" + "1,root.db1.d1,10,6.0,10,6", + "11,root.db1.d1,130000,11.0,20,11", + "21,root.db1.d1,230000,230000.0,null,21", + "31,root.db1.d1,null,null,40,null" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -2863,7 +2863,7 @@ public void maxMinValueGroupByTimeAlignByDeviceTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -2891,10 +2891,10 @@ public void maxMinValueGroupByTimeAlignByDeviceTest() throws SQLException { public void firstLastGroupByTimeAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,null,null", "6,root.sg1.d1,true,aligned_test7", - "11,root.sg1.d1,true,aligned_unseq_test13", "16,root.sg1.d1,null,null", - "21,root.sg1.d1,true,null", "26,root.sg1.d1,false,null", - "31,root.sg1.d1,null,aligned_test31", "36,root.sg1.d1,null,aligned_test36" + "1,root.db1.d1,null,null", "6,root.db1.d1,true,aligned_test7", + "11,root.db1.d1,true,aligned_unseq_test13", "16,root.db1.d1,null,null", + "21,root.db1.d1,true,null", "26,root.db1.d1,false,null", + "31,root.db1.d1,null,aligned_test31", "36,root.db1.d1,null,aligned_test36" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -2902,7 +2902,7 @@ public void firstLastGroupByTimeAlignByDeviceTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -2926,10 +2926,10 @@ public void firstLastGroupByTimeAlignByDeviceTest() throws SQLException { public void groupByWithWildcardAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,9,9,8,8,9,9.0,10,10,true,aligned_test10", - "11,root.sg1.d1,10,10,10,1,1,20.0,20,20,true,aligned_unseq_test13", - "21,root.sg1.d1,1,0,10,10,0,230000.0,null,30,false,null", - "31,root.sg1.d1,0,10,0,0,10,null,40,null,null,aligned_test40" + "1,root.db1.d1,9,9,8,8,9,9.0,10,10,true,aligned_test10", + "11,root.db1.d1,10,10,10,1,1,20.0,20,20,true,aligned_unseq_test13", + "21,root.db1.d1,1,0,10,10,0,230000.0,null,30,false,null", + "31,root.db1.d1,0,10,0,0,10,null,40,null,null,aligned_test40" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -2937,7 +2937,7 @@ public void groupByWithWildcardAlignByDeviceTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 GROUP BY ([1, 41), 10ms) align by device")) { + "select count(*), last_value(*) from root.db1.d1 GROUP BY ([1, 41), 10ms) align by device")) { cnt = 0; while (resultSet.next()) { String ans = @@ -2976,20 +2976,20 @@ public void groupByWithWildcardAlignByDeviceTest() throws SQLException { public void groupByWithNonAlignedTimeseriesAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,0,null,null", - "7,root.sg1.d1,3,34.0,8.0", - "13,root.sg1.d1,4,130045.0,32511.25", - "19,root.sg1.d1,2,39.0,19.5", - "25,root.sg1.d1,0,null,null", - "31,root.sg1.d1,0,130.0,null", - "37,root.sg1.d1,0,154.0,null", - "1,root.sg1.d2,0,null,null", - "7,root.sg1.d2,3,34.0,8.0", - "13,root.sg1.d2,4,58.0,14.5", - "19,root.sg1.d2,2,39.0,19.5", - "25,root.sg1.d2,0,null,null", - "31,root.sg1.d2,0,130.0,null", - "37,root.sg1.d2,0,154.0,null" + "1,root.db1.d1,0,null,null", + "7,root.db1.d1,3,34.0,8.0", + "13,root.db1.d1,4,130045.0,32511.25", + "19,root.db1.d1,2,39.0,19.5", + "25,root.db1.d1,0,null,null", + "31,root.db1.d1,0,130.0,null", + "37,root.db1.d1,0,154.0,null", + "1,root.db1.d2,0,null,null", + "7,root.db1.d2,3,34.0,8.0", + "13,root.db1.d2,4,58.0,14.5", + "19,root.db1.d2,2,39.0,19.5", + "25,root.db1.d2,0,null,null", + "31,root.db1.d2,0,130.0,null", + "37,root.db1.d2,0,154.0,null" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -2997,7 +2997,7 @@ public void groupByWithNonAlignedTimeseriesAlignByDeviceTest() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.* " + "select count(s1), sum(s2), avg(s1) from root.db1.* " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -3023,10 +3023,10 @@ public void groupByWithNonAlignedTimeseriesAlignByDeviceTest() throws SQLExcepti public void countSumAvgPreviousFillAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,4,40.0,7.5", - "11,root.sg1.d1,10,130142.0,13014.2", - "21,root.sg1.d1,1,130142.0,230000.0", - "31,root.sg1.d1,0,355.0,230000.0" + "1,root.db1.d1,4,40.0,7.5", + "11,root.db1.d1,10,130142.0,13014.2", + "21,root.db1.d1,1,130142.0,230000.0", + "31,root.db1.d1,0,355.0,230000.0" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -3034,7 +3034,7 @@ public void countSumAvgPreviousFillAlignByDeviceTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms) FILL (previous) align by device")) { cnt = 0; while (resultSet.next()) { @@ -3060,13 +3060,13 @@ public void countSumAvgPreviousFillAlignByDeviceTest() throws SQLException { public void countSumAvgValueFillAlignByDeviceTest() throws SQLException { String[] retArray = new String[] { - "1,root.sg1.d1,1,3.0,30000.0", - "6,root.sg1.d1,4,40.0,7.5", - "11,root.sg1.d1,5,130052.0,26010.4", - "16,root.sg1.d1,5,90.0,18.0", - "21,root.sg1.d1,1,3.0,230000.0", - "26,root.sg1.d1,0,3.0,3.0", - "31,root.sg1.d1,0,3.0,3.0" + "1,root.db1.d1,1,3.0,30000.0", + "6,root.db1.d1,4,40.0,7.5", + "11,root.db1.d1,5,130052.0,26010.4", + "16,root.db1.d1,5,90.0,18.0", + "21,root.db1.d1,1,3.0,230000.0", + "26,root.db1.d1,0,3.0,3.0", + "31,root.db1.d1,0,3.0,3.0" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -3074,7 +3074,7 @@ public void countSumAvgValueFillAlignByDeviceTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 36), 5ms) FILL (3) align by device")) { cnt = 0; while (resultSet.next()) { @@ -3109,18 +3109,18 @@ public void countSumAvgGroupByTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3129,18 +3129,18 @@ public void countSumAvgGroupByTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3161,18 +3161,18 @@ public void countSumAvgGroupByTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3181,18 +3181,18 @@ public void countSumAvgGroupByTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3218,18 +3218,18 @@ public void countSumAvgGroupByWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3238,18 +3238,18 @@ public void countSumAvgGroupByWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3276,23 +3276,23 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3302,23 +3302,23 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3341,20 +3341,20 @@ public void maxMinValueTimeGroupByTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3363,20 +3363,20 @@ public void maxMinValueTimeGroupByTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3404,20 +3404,20 @@ public void maxMinValueTimeGroupByTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3426,20 +3426,20 @@ public void maxMinValueTimeGroupByTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3465,20 +3465,20 @@ public void maxMinValueTimeGroupByWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3487,20 +3487,20 @@ public void maxMinValueTimeGroupByWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3528,27 +3528,27 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3559,27 +3559,27 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3602,16 +3602,16 @@ public void firstLastGroupByTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3620,16 +3620,16 @@ public void firstLastGroupByTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3650,16 +3650,16 @@ public void firstLastGroupByTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3668,16 +3668,16 @@ public void firstLastGroupByTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3704,16 +3704,16 @@ public void firstLastGroupByWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3722,16 +3722,16 @@ public void firstLastGroupByWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3759,19 +3759,19 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3781,20 +3781,20 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 " + + "from root.db1 where time > 5 and time < 38 " + "GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3818,31 +3818,31 @@ public void groupByWithWildcardTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 GROUP BY ([1, 41), 10ms)")) { + "select count(*), last_value(*) from root.db1.d1 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3851,32 +3851,32 @@ public void groupByWithWildcardTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + "GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3906,22 +3906,22 @@ public void groupByWithWildcardTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3930,22 +3930,22 @@ public void groupByWithWildcardTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -3975,22 +3975,22 @@ public void groupByWithWildcardTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -3999,22 +3999,22 @@ public void groupByWithWildcardTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4028,7 +4028,7 @@ public void groupByWithoutAggregationFuncTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.executeQuery("select s1 from root.sg1.d1 group by ([0, 100), 5ms)"); + statement.executeQuery("select s1 from root.db1.d1 group by ([0, 100), 5ms)"); fail("No expected exception thrown"); } catch (Exception e) { @@ -4046,7 +4046,7 @@ public void negativeOrZeroTimeIntervalTest() { Statement statement = connection.createStatement()) { statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 0ms)"); fail(); } catch (Exception e) { @@ -4070,18 +4070,18 @@ public void countSumAvgWithValueFilterTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4090,18 +4090,18 @@ public void countSumAvgWithValueFilterTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4128,18 +4128,18 @@ public void countSumAvgWithValueFilterTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 36), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4148,18 +4148,18 @@ public void countSumAvgWithValueFilterTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 36), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4186,18 +4186,18 @@ public void countSumAvgWithSlidingStepAndValueFilterTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4206,18 +4206,18 @@ public void countSumAvgWithSlidingStepAndValueFilterTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4243,23 +4243,23 @@ public void countSumAvgWithNonAlignedTimeseriesAndValueFilterTest() throws SQLEx try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 4ms, 6ms)")) { + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4269,24 +4269,24 @@ public void countSumAvgWithNonAlignedTimeseriesAndValueFilterTest() throws SQLEx try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 4ms, 6ms) " + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 4ms, 6ms) " + "order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4310,20 +4310,20 @@ public void maxMinValueTimeWithValueFilterTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4332,20 +4332,20 @@ public void maxMinValueTimeWithValueFilterTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4371,20 +4371,20 @@ public void maxMinValueTimeWithValueFilterTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 31), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4393,20 +4393,20 @@ public void maxMinValueTimeWithValueFilterTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 31), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4433,20 +4433,20 @@ public void maxMinValueTimeWithSlidingStepAndValueFilterTest() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4455,20 +4455,20 @@ public void maxMinValueTimeWithSlidingStepAndValueFilterTest() throws SQLExcepti try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4497,27 +4497,27 @@ public void maxMinValueTimeWithNonAlignedTimeseriesAndValueFilterTest() throws S statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4528,28 +4528,28 @@ public void maxMinValueTimeWithNonAlignedTimeseriesAndValueFilterTest() throws S statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 4ms, 6ms) " + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 4ms, 6ms) " + " order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4570,16 +4570,16 @@ public void firstLastWithValueFilterTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 = true GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4588,16 +4588,16 @@ public void firstLastWithValueFilterTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 = true GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4619,16 +4619,16 @@ public void firstLastWithValueFilterTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 = false GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4637,16 +4637,16 @@ public void firstLastWithValueFilterTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 = false GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4673,16 +4673,16 @@ public void firstLastWithSlidingStepAndValueFilterTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 != false GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4691,16 +4691,16 @@ public void firstLastWithSlidingStepAndValueFilterTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 != false GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4728,20 +4728,20 @@ public void firstLastWithNonAlignedTimeseriesAndValueFilterTest() throws SQLExce try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + + "from root.db1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + "GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4751,20 +4751,20 @@ public void firstLastWithNonAlignedTimeseriesAndValueFilterTest() throws SQLExce try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + + "from root.db1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + "GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4788,32 +4788,32 @@ public void groupByWithWildcardAndValueFilterTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4822,32 +4822,32 @@ public void groupByWithWildcardAndValueFilterTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4877,22 +4877,22 @@ public void groupByWithWildcardAndValueFilterTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + "where s1 > 5 or s2 > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4901,7 +4901,7 @@ public void groupByWithWildcardAndValueFilterTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + " where s1 > 5 or s2 > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) " + " order by time desc")) { cnt = retArray.length; @@ -4909,15 +4909,15 @@ public void groupByWithWildcardAndValueFilterTest2() throws SQLException { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s2")) + + resultSet.getString(count("root.db1.d1.s2")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -4947,22 +4947,22 @@ public void groupByWithWildcardAndValueFilterTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + "where s1 > 5 or s2 > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -4971,22 +4971,22 @@ public void groupByWithWildcardAndValueFilterTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + " where s1 > 5 or s2 > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s2")) + + resultSet.getString(lastValue("root.db1.d1.s2")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5015,18 +5015,18 @@ public void countSumAvgSlidingWindowTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5035,18 +5035,18 @@ public void countSumAvgSlidingWindowTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5080,18 +5080,18 @@ public void countSumAvgSlidingWindowTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5100,18 +5100,18 @@ public void countSumAvgSlidingWindowTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5151,18 +5151,18 @@ public void countSumAvgSlidingWindowTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5171,18 +5171,18 @@ public void countSumAvgSlidingWindowTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5223,23 +5223,23 @@ public void countSumAvgSlidingWindowWithNonAlignedTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 5ms, 2ms)")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 5ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5249,23 +5249,23 @@ public void countSumAvgSlidingWindowWithNonAlignedTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 5ms, 2ms) order by time desc")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 5ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5293,20 +5293,20 @@ public void maxMinValueTimeSlidingWindowTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5315,20 +5315,20 @@ public void maxMinValueTimeSlidingWindowTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5362,20 +5362,20 @@ public void maxMinValueTimeSlidingWindowTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5384,20 +5384,20 @@ public void maxMinValueTimeSlidingWindowTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5437,20 +5437,20 @@ public void maxMinValueTimeSlidingWindowTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5459,20 +5459,20 @@ public void maxMinValueTimeSlidingWindowTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5508,27 +5508,27 @@ public void maxMinValueTimeSlidingWindowWithNonAlignedTest() throws SQLException statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5539,27 +5539,27 @@ public void maxMinValueTimeSlidingWindowWithNonAlignedTest() throws SQLException statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5587,16 +5587,16 @@ public void firstLastValueSlidingWindowTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5605,16 +5605,16 @@ public void firstLastValueSlidingWindowTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5648,16 +5648,16 @@ public void firstLastValueSlidingWindowTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5666,16 +5666,16 @@ public void firstLastValueSlidingWindowTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5715,16 +5715,16 @@ public void firstLastValueSlidingWindowTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5733,16 +5733,16 @@ public void firstLastValueSlidingWindowTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5777,19 +5777,19 @@ public void firstLastValueSlidingWindowWithNonAlignedTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5799,20 +5799,20 @@ public void firstLastValueSlidingWindowWithNonAlignedTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 " + + "from root.db1 where time > 5 and time < 38 " + "GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5841,18 +5841,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5861,18 +5861,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5904,18 +5904,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 36), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5924,18 +5924,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 36), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -5975,18 +5975,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -5995,18 +5995,18 @@ public void countSumAvgSlidingWindowWithValueFilterTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s1) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d1.s1")); + + resultSet.getString(avg("root.db1.d1.s1")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6042,23 +6042,23 @@ public void countSumAvgSlidingWindowWithNonAlignedAndValueFilterTest() throws SQ try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 5ms, 2ms)")) { + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 5ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6068,24 +6068,24 @@ public void countSumAvgSlidingWindowWithNonAlignedAndValueFilterTest() throws SQ try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 5ms, 2ms) " + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 31), 5ms, 2ms) " + "order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(sum("root.sg1.d2.s2")) + + resultSet.getString(sum("root.db1.d2.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s1")) + + resultSet.getString(avg("root.db1.d2.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(sum("root.sg1.d1.s2")) + + resultSet.getString(sum("root.db1.d1.s2")) + "," - + resultSet.getString(avg("root.sg1.d2.s3")); + + resultSet.getString(avg("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6113,20 +6113,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest1() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6135,20 +6135,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest1() throws SQLExcepti try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s1 > 5 and time < 35 GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6178,20 +6178,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest2() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 31), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6200,20 +6200,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest2() throws SQLExcepti try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 31), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6253,20 +6253,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest3() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6275,20 +6275,20 @@ public void maxMinValueTimeSlidingWindowWithValueFilterTest3() throws SQLExcepti try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6330,27 +6330,27 @@ public void maxMinValueTimeSlidingWindowWithNonAlignedAndValueFilterTest() throw statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 5ms, 2ms)")) { + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 5ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6361,28 +6361,28 @@ public void maxMinValueTimeSlidingWindowWithNonAlignedAndValueFilterTest() throw statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 5ms, 2ms) " + + "from root.db1 where d2.s3 > 5 and d1.s3 < 25 GROUP BY ([1, 41), 5ms, 2ms) " + " order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d2.s3")) + + resultSet.getString(maxValue("root.db1.d2.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d2.s2")) + + resultSet.getString(maxTime("root.db1.d2.s2")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")) + + resultSet.getString(minTime("root.db1.d1.s3")) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d2.s1")) + + resultSet.getString(minValue("root.db1.d2.s1")) + "," - + resultSet.getString(maxTime("root.sg1.d1.s2")) + + resultSet.getString(maxTime("root.db1.d1.s2")) + "," - + resultSet.getString(minTime("root.sg1.d2.s3")); + + resultSet.getString(minTime("root.db1.d2.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6410,16 +6410,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest1() throws SQLExceptio int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 = true GROUP BY ([1, 41), 10ms, 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6428,16 +6428,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest1() throws SQLExceptio try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 = true GROUP BY ([1, 41), 10ms, 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6471,16 +6471,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest2() throws SQLExceptio int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 = false GROUP BY ([1, 41), 5ms, 3ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6489,16 +6489,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest2() throws SQLExceptio try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 = false GROUP BY ([1, 41), 5ms, 3ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6538,16 +6538,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest3() throws SQLExceptio int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + "where s4 != false GROUP BY ([1, 41), 4ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6556,16 +6556,16 @@ public void firstLastValueSlidingWindowWithValueFilterTest3() throws SQLExceptio try (ResultSet resultSet = statement.executeQuery( - "select last_value(s4), first_value(s5) from root.sg1.d1 " + "select last_value(s4), first_value(s5) from root.db1.d1 " + " where s4 != false GROUP BY ([1, 41), 4ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s5")); + + resultSet.getString(firstValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -6606,20 +6606,20 @@ public void firstLastValueSlidingWindowWithNonAlignedAndValueFilterTest() throws try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + + "from root.db1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + "GROUP BY ([1, 41), 5ms, 2ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -6629,20 +6629,20 @@ public void firstLastValueSlidingWindowWithNonAlignedAndValueFilterTest() throws try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + + "from root.db1 where d1.s5 like 'aligned_unseq_test%' or d2.s5 like 'non_aligned_test%' " + "GROUP BY ([1, 41), 5ms, 2ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d2.s5")) + + resultSet.getString(lastValue("root.db1.d2.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s4")) + + resultSet.getString(firstValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")) + + resultSet.getString(lastValue("root.db1.d1.s5")) + "," - + resultSet.getString(firstValue("root.sg1.d2.s4")); + + resultSet.getString(firstValue("root.db1.d2.s4")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithDeletionIT.java index 2242398103fbd..acc67bbf529ad 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithDeletionIT.java @@ -61,7 +61,7 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete from root.sg1.d1.* where time <= 2"); + statement.execute("delete from root.db1.d1.* where time <= 2"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -80,12 +80,12 @@ public void selectAllDeletedColumns() { "3,30000.0,null,30000", "4,4.0,4,null", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s3"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s3"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select s1, s2, s3 from root.sg1.d1 where time <= 4")) { + statement.executeQuery("select s1, s2, s3 from root.db1.d1 where time <= 4")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -116,9 +116,9 @@ public void selectAllDeletedAndNullColumns() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select s1, s4 from root.sg1.d1 where time <= 2")) { + statement.executeQuery("select s1, s4 from root.db1.d1 where time <= 2")) { // data at timestamp [1,2] has been deleted and should not be kept in result - // data of root.sg1.d1.s4 is not deleted at timestamp 2, but it is null + // data of root.db1.d1.s4 is not deleted at timestamp 2, but it is null assertFalse(resultSet.next()); } catch (SQLException e) { @@ -132,19 +132,19 @@ public void selectPartialDeletedColumns() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "insert into root.sg1.factory0.d1.group1(time, s_lat, s_son)" + "insert into root.db1.factory0.d1.group1(time, s_lat, s_son)" + " aligned values (10,3.3,4.4),(20,13.3,14.4),(30,23.3,24.4),(40,43.3,44.4);"); statement.execute( - "insert into root.sg1.factory0.d1.group1(time, s_lat, s_son, s_boolean)" + "insert into root.db1.factory0.d1.group1(time, s_lat, s_son, s_boolean)" + " aligned values (10,3.3,4.4, true),(20,13.3,14.4, false),(30,23.3,24.4, true),(40,43.3,44.4, true);"); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.factory0.d1.group1;"); + ResultSet resultSet = statement.executeQuery("select * from root.db1.factory0.d1.group1;"); int cnt = 0; while (resultSet.next()) { cnt++; } assertEquals(4, cnt); - statement.execute("delete from root.sg1.factory0.d1.group1.* where time < 30;"); - resultSet = statement.executeQuery("select * from root.sg1.factory0.d1.group1;"); + statement.execute("delete from root.db1.factory0.d1.group1.* where time < 30;"); + resultSet = statement.executeQuery("select * from root.db1.factory0.d1.group1;"); cnt = 0; while (resultSet.next()) { cnt++; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithMisMatchIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithMisMatchIT.java index a8fcf713bcda6..a8f1ccfcf1a65 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithMisMatchIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedSeriesQueryWithMisMatchIT.java @@ -59,10 +59,10 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg1.d1(time, s1, s2) aligned values (1, 1, true)"); + statement.execute("insert into root.db1.d1(time, s1, s2) aligned values (1, 1, true)"); statement.execute("flush"); - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("insert into root.sg1.d1(time, s1, s2) aligned values (10, 10, 100)"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("insert into root.db1.d1(time, s1, s2) aligned values (10, 10, 100)"); statement.execute("flush"); } catch (Exception e) { fail(e.getMessage()); @@ -82,11 +82,11 @@ public void selectAllDeletedColumns() { "1,1.0,null", "10,10.0,100.0", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s2"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s2"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg1.d1")) { + ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBCountMultiTimesWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBCountMultiTimesWithDeletionIT.java index f2827a7659025..5a7508550712c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBCountMultiTimesWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBCountMultiTimesWithDeletionIT.java @@ -59,9 +59,9 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg1.d1(time, s1) aligned values (1,1), (2,2)"); + statement.execute("insert into root.db1.d1(time, s1) aligned values (1,1), (2,2)"); statement.execute("flush"); - statement.execute("delete from root.sg1.d1.s1 where time > 1"); + statement.execute("delete from root.db1.d1.s1 where time > 1"); } catch (Exception e) { fail(e.getMessage()); e.printStackTrace(); @@ -77,13 +77,13 @@ public static void tearDown() throws Exception { public void countSingleAlignedWithoutTimeFilterMultiTimesTest() { String[] retArray = new String[] {"1"}; String[] columnNames = { - "count(root.sg1.d1.s1)", + "count(root.db1.d1.s1)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // first time - try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -106,7 +106,7 @@ public void countSingleAlignedWithoutTimeFilterMultiTimesTest() { } // second time - try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.sg1.d1")) { + try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); // used to adjust result sequence for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByLevelQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByLevelQueryIT.java index 5bcc8e5eb7dea..a1ed00dddacab 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByLevelQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByLevelQueryIT.java @@ -55,30 +55,30 @@ public static void setUp() throws Exception { AlignedWriteUtil.insertData(); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg2"); + statement.execute("CREATE DATABASE root.db2"); statement.execute( - "create aligned timeseries root.sg2.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64)"); + "create aligned timeseries root.db2.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64)"); for (int i = 1; i <= 10; i++) { statement.execute( String.format( Locale.ENGLISH, - "insert into root.sg2.d1(time, s1) aligned values(%d,%f)", + "insert into root.db2.d1(time, s1) aligned values(%d,%f)", i, (double) i)); } for (int i = 11; i <= 20; i++) { statement.execute( - String.format("insert into root.sg2.d1(time, s2) aligned values(%d,%d)", i, i)); + String.format("insert into root.db2.d1(time, s2) aligned values(%d,%d)", i, i)); } for (int i = 21; i <= 30; i++) { statement.execute( - String.format("insert into root.sg2.d1(time, s3) aligned values(%d,%d)", i, i)); + String.format("insert into root.db2.d1(time, s3) aligned values(%d,%d)", i, i)); } for (int i = 31; i <= 40; i++) { statement.execute( String.format( Locale.ENGLISH, - "insert into root.sg2.d1(time, s1, s2, s3) aligned values(%d,%f,%d,%d)", + "insert into root.db2.d1(time, s1, s2, s3) aligned values(%d,%f,%d,%d)", i, (double) i, i, @@ -98,7 +98,7 @@ public static void tearDown() throws Exception { public void countFuncByLevelTest() { // level = 1 double[][] retArray1 = new double[][] {{39, 20}}; - String[] columnNames1 = {"count(root.sg1.*.s1)", "count(root.sg2.*.s1)"}; + String[] columnNames1 = {"count(root.db1.*.s1)", "count(root.db2.*.s1)"}; resultSetEqualTest("select count(s1) from root.*.* group by level=1", retArray1, columnNames1); // level = 2 double[][] retArray2 = new double[][] {{40, 19}}; @@ -111,7 +111,7 @@ public void countFuncByLevelTest() { // multi level = 1,2 double[][] retArray4 = new double[][] {{20, 19, 20}}; String[] columnNames4 = { - "count(root.sg1.d1.s1)", "count(root.sg1.d2.s1)", "count(root.sg2.d1.s1)" + "count(root.db1.d1.s1)", "count(root.db1.d2.s1)", "count(root.db2.d1.s1)" }; resultSetEqualTest( "select count(s1) from root.*.* group by level=1,2", retArray4, columnNames4); @@ -134,7 +134,7 @@ public void countFuncByLevelTest() { public void sumFuncByLevelTest() { // level = 1 double[][] retArray1 = new double[][] {{131111, 510}}; - String[] columnNames1 = {"sum(root.sg1.*.s2)", "sum(root.sg2.*.s2)"}; + String[] columnNames1 = {"sum(root.db1.*.s2)", "sum(root.db2.*.s2)"}; resultSetEqualTest("select sum(s2) from root.*.* group by level=1", retArray1, columnNames1); // level = 2 double[][] retArray2 = new double[][] {{131059, 562}}; @@ -146,7 +146,7 @@ public void sumFuncByLevelTest() { resultSetEqualTest("select sum(s2) from root.*.* group by level=3", retArray3, columnNames3); // multi level = 1,2 double[][] retArray4 = new double[][] {{130549, 562, 510}}; - String[] columnNames4 = {"sum(root.sg1.d1.s2)", "sum(root.sg1.d2.s2)", "sum(root.sg2.d1.s2)"}; + String[] columnNames4 = {"sum(root.db1.d1.s2)", "sum(root.db1.d2.s2)", "sum(root.db2.d1.s2)"}; resultSetEqualTest("select sum(s2) from root.*.* group by level=1,2", retArray4, columnNames4); // level=2 with time filter double[][] retArray5 = @@ -167,7 +167,7 @@ public void sumFuncByLevelTest() { public void avgFuncByLevelTest() { // level = 1 double[][] retArray1 = new double[][] {{2260.53448275862, 25.5}}; - String[] columnNames1 = {"avg(root.sg1.*.s2)", "avg(root.sg2.*.s2)"}; + String[] columnNames1 = {"avg(root.db1.*.s2)", "avg(root.db2.*.s2)"}; resultSetEqualTest("select avg(s2) from root.*.* group by level=1", retArray1, columnNames1); // level = 2 double[][] retArray2 = new double[][] {{2674.6734693877547, 19.379310344827587}}; @@ -179,7 +179,7 @@ public void avgFuncByLevelTest() { resultSetEqualTest("select avg(s2) from root.*.* group by level=3", retArray3, columnNames3); // multi level = 1,2 double[][] retArray4 = new double[][] {{4501.68965517241, 19.379310344827587, 25.5}}; - String[] columnNames4 = {"avg(root.sg1.d1.s2)", "avg(root.sg1.d2.s2)", "avg(root.sg2.d1.s2)"}; + String[] columnNames4 = {"avg(root.db1.d1.s2)", "avg(root.db1.d2.s2)", "avg(root.db2.d1.s2)"}; resultSetEqualTest("select avg(s2) from root.*.* group by level=1,2", retArray4, columnNames4); // level=2 with time filter double[][] retArray5 = @@ -228,7 +228,7 @@ public void valueFuncGroupByLevelTest() { public void nestedQueryTest1() { // level = 1 double[][] retArray1 = new double[][] {{40.0, 21.0}}; - String[] columnNames1 = {"count(root.sg1.*.s1 + 1) + 1", "count(root.sg2.*.s1 + 1) + 1"}; + String[] columnNames1 = {"count(root.db1.*.s1 + 1) + 1", "count(root.db2.*.s1 + 1) + 1"}; resultSetEqualTest( "select count(s1 + 1) + 1 from root.*.* group by level=1", retArray1, columnNames1); @@ -250,10 +250,10 @@ public void nestedQueryTest2() { // level = 1 double[][] retArray1 = new double[][] {{390423.0, 449.0, 390404.0, 430.0}}; String[] columnNames1 = { - "count(root.sg1.*.s1) + sum(root.sg1.*.s1)", - "count(root.sg1.*.s1) + sum(root.sg2.*.s1)", - "count(root.sg2.*.s1) + sum(root.sg1.*.s1)", - "count(root.sg2.*.s1) + sum(root.sg2.*.s1)" + "count(root.db1.*.s1) + sum(root.db1.*.s1)", + "count(root.db1.*.s1) + sum(root.db2.*.s1)", + "count(root.db2.*.s1) + sum(root.db1.*.s1)", + "count(root.db2.*.s1) + sum(root.db2.*.s1)" }; resultSetEqualTest( "select count(s1) + sum(s1) from root.*.* group by level=1", retArray1, columnNames1); @@ -281,12 +281,12 @@ public void caseSensitivityTest() { double[][] retArray = new double[][] {{39, 20, 39, 20, 39, 20}}; String[] columnNames1 = { - "count(root.sg1.*.s1)", - "count(root.sg2.*.s1)", - "COUNT(root.sg1.*.s1)", - "COUNT(root.sg2.*.s1)", - "cOuNt(root.sg1.*.s1)", - "cOuNt(root.sg2.*.s1)" + "count(root.db1.*.s1)", + "count(root.db2.*.s1)", + "COUNT(root.db1.*.s1)", + "COUNT(root.db2.*.s1)", + "cOuNt(root.db1.*.s1)", + "cOuNt(root.db2.*.s1)" }; resultSetEqualTest( "select count(s1), COUNT(s1), cOuNt(s1) from root.*.* group by level=1", @@ -294,12 +294,12 @@ public void caseSensitivityTest() { columnNames1); String[] columnNames2 = { - "Count(root.sg1.*.s1)", - "Count(root.sg2.*.s1)", - "COUNT(root.sg1.*.s1)", - "COUNT(root.sg2.*.s1)", - "cOuNt(root.sg1.*.s1)", - "cOuNt(root.sg2.*.s1)" + "Count(root.db1.*.s1)", + "Count(root.db2.*.s1)", + "COUNT(root.db1.*.s1)", + "COUNT(root.db2.*.s1)", + "cOuNt(root.db1.*.s1)", + "cOuNt(root.db2.*.s1)" }; resultSetEqualTest( "select Count(s1), COUNT(s1), cOuNt(s1) from root.*.* group by level=1", diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletion2IT.java index de074bfe88c73..a8dddc4cd4eff 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletion2IT.java @@ -53,8 +53,8 @@ public static void setUp() throws Exception { AlignedWriteUtil.insertData(); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete from root.sg1.d1.s1 where time <= 15"); - statement.execute("delete timeseries root.sg1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 15"); + statement.execute("delete timeseries root.db1.d1.s2"); } catch (Exception e) { e.printStackTrace(); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletionIT.java index 7b228b700b816..deb58646555c3 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithValueFilterWithDeletionIT.java @@ -64,8 +64,8 @@ public static void setUp() throws Exception { AlignedWriteUtil.insertData(); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete from root.sg1.d1.s1 where time <= 15"); - statement.execute("delete timeseries root.sg1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 15"); + statement.execute("delete timeseries root.db1.d1.s2"); } catch (Exception e) { e.printStackTrace(); } @@ -86,16 +86,16 @@ public void countSumAvgTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -104,16 +104,16 @@ public void countSumAvgTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -135,16 +135,16 @@ public void countSumAvgTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -153,16 +153,16 @@ public void countSumAvgTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -189,16 +189,16 @@ public void countSumAvgWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -207,16 +207,16 @@ public void countSumAvgWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -237,18 +237,18 @@ public void maxMinValueTimeTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -257,18 +257,18 @@ public void maxMinValueTimeTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -296,18 +296,18 @@ public void maxMinValueTimeTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -316,18 +316,18 @@ public void maxMinValueTimeTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -354,18 +354,18 @@ public void maxMinValueTimeWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -374,18 +374,18 @@ public void maxMinValueTimeWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -404,16 +404,16 @@ public void firstLastTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where s3 > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -422,16 +422,16 @@ public void firstLastTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where s3 > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -459,16 +459,16 @@ public void firstLastTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -477,16 +477,16 @@ public void firstLastTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -513,16 +513,16 @@ public void firstLastWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -531,16 +531,16 @@ public void firstLastWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where s3 > 5 and time < 30 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -564,28 +564,28 @@ public void groupByWithWildcardTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + " where s3 > 5 or s4 = true GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -594,28 +594,28 @@ public void groupByWithWildcardTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + "where s3 > 5 or s4 = true GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -645,20 +645,20 @@ public void groupByWithWildcardTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + "where s3 > 5 or s5 like 'aligned_test3%' GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -667,20 +667,20 @@ public void groupByWithWildcardTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 where s3 > 5 or s5 like 'aligned_test3%' " + "select count(*) from root.db1.d1 where s3 > 5 or s5 like 'aligned_test3%' " + " GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -710,20 +710,20 @@ public void groupByWithWildcardTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + "where s3 > 5 or s5 like 'aligned_test3%' GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -732,20 +732,20 @@ public void groupByWithWildcardTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 where s3 > 5 or s5 like 'aligned_test3%' " + "select last_value(*) from root.db1.d1 where s3 > 5 or s5 like 'aligned_test3%' " + " GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java index 46b964a78adb2..85988127fa7db 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletion2IT.java @@ -52,9 +52,9 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete from root.sg1.d1.s1 where time <= 15"); - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s3 where time > 25"); + statement.execute("delete from root.db1.d1.s1 where time <= 15"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s3 where time > 25"); } catch (Exception e) { e.printStackTrace(); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java index 3461bbb32b2f1..1144dfcc28c6d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBGroupByQueryWithoutValueFilterWithDeletionIT.java @@ -64,9 +64,9 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete from root.sg1.d1.s1 where time <= 15"); - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s3 where time > 25"); + statement.execute("delete from root.db1.d1.s1 where time <= 15"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s3 where time > 25"); } catch (Exception e) { e.printStackTrace(); } @@ -86,16 +86,16 @@ public void countSumAvgTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -104,16 +104,16 @@ public void countSumAvgTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -135,16 +135,16 @@ public void countSumAvgTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -153,16 +153,16 @@ public void countSumAvgTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -183,16 +183,16 @@ public void countSumAvgWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -201,16 +201,16 @@ public void countSumAvgWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s3) from root.sg1.d1 " + "select count(s1), sum(s2), avg(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(avg("root.sg1.d1.s3")); + + resultSet.getString(avg("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -231,18 +231,18 @@ public void maxMinValueTimeTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -251,18 +251,18 @@ public void maxMinValueTimeTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -289,18 +289,18 @@ public void maxMinValueTimeTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -309,18 +309,18 @@ public void maxMinValueTimeTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -347,18 +347,18 @@ public void maxMinValueTimeWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -367,18 +367,18 @@ public void maxMinValueTimeWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.sg1.d1 " + "select max_value(s3), min_value(s1), max_time(s2), min_time(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(maxValue("root.sg1.d1.s3")) + + resultSet.getString(maxValue("root.db1.d1.s3")) + "," - + resultSet.getString(minValue("root.sg1.d1.s1")) + + resultSet.getString(minValue("root.db1.d1.s1")) + "," - + resultSet.getString(minTime("root.sg1.d1.s3")); + + resultSet.getString(minTime("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -395,16 +395,16 @@ public void firstLastTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where time > 5 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -413,16 +413,16 @@ public void firstLastTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where time > 5 GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -450,16 +450,16 @@ public void firstLastTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 5ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -468,16 +468,16 @@ public void firstLastTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 5ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -504,16 +504,16 @@ public void firstLastWithSlidingStepTest() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -522,16 +522,16 @@ public void firstLastWithSlidingStepTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(s1), first_value(s3) from root.sg1.d1 " + "select last_value(s1), first_value(s3) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(firstValue("root.sg1.d1.s3")); + + resultSet.getString(firstValue("root.db1.d1.s3")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -554,27 +554,27 @@ public void groupByWithWildcardTest1() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 GROUP BY ([1, 41), 10ms)")) { + "select count(*), last_value(*) from root.db1.d1 GROUP BY ([1, 41), 10ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -583,28 +583,28 @@ public void groupByWithWildcardTest1() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*), last_value(*) from root.sg1.d1 " + "select count(*), last_value(*) from root.db1.d1 " + "GROUP BY ([1, 41), 10ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")) + + resultSet.getString(count("root.db1.d1.s5")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -634,20 +634,20 @@ public void groupByWithWildcardTest2() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -656,20 +656,20 @@ public void groupByWithWildcardTest2() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select count(*) from root.sg1.d1 " + "select count(*) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(count("root.sg1.d1.s1")) + + resultSet.getString(count("root.db1.d1.s1")) + "," - + resultSet.getString(count("root.sg1.d1.s3")) + + resultSet.getString(count("root.db1.d1.s3")) + "," - + resultSet.getString(count("root.sg1.d1.s4")) + + resultSet.getString(count("root.db1.d1.s4")) + "," - + resultSet.getString(count("root.sg1.d1.s5")); + + resultSet.getString(count("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } @@ -699,20 +699,20 @@ public void groupByWithWildcardTest3() throws SQLException { int cnt; try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + "where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms)")) { cnt = 0; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt], ans); cnt++; } @@ -721,20 +721,20 @@ public void groupByWithWildcardTest3() throws SQLException { try (ResultSet resultSet = statement.executeQuery( - "select last_value(*) from root.sg1.d1 " + "select last_value(*) from root.db1.d1 " + " where time > 5 and time < 38 GROUP BY ([1, 41), 3ms, 4ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(lastValue("root.sg1.d1.s1")) + + resultSet.getString(lastValue("root.db1.d1.s1")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s3")) + + resultSet.getString(lastValue("root.db1.d1.s3")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s4")) + + resultSet.getString(lastValue("root.db1.d1.s4")) + "," - + resultSet.getString(lastValue("root.sg1.d1.s5")); + + resultSet.getString(lastValue("root.db1.d1.s5")); Assert.assertEquals(retArray[cnt - 1], ans); cnt--; } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues2IT.java index 530e0189c52ef..638fc6b1447b6 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues2IT.java @@ -120,11 +120,11 @@ public void testInsertAlignedWithEmptyPage() throws SQLException { public void testInsertAlignedWithEmptyPage2() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time, s1,s2) aligned values(1,'aa','bb')"); - statement.execute("insert into root.sg.d1(time, s1,s2) aligned values(1,'aa','bb')"); - statement.execute("insert into root.sg.d1(time, s1,s2) aligned values(1,'aa','bb')"); + statement.execute("insert into root.db.d1(time, s1,s2) aligned values(1,'aa','bb')"); + statement.execute("insert into root.db.d1(time, s1,s2) aligned values(1,'aa','bb')"); + statement.execute("insert into root.db.d1(time, s1,s2) aligned values(1,'aa','bb')"); statement.execute("flush"); - statement.execute("insert into root.sg.d1(time, s1,s2) aligned values(1,'aa','bb')"); + statement.execute("insert into root.db.d1(time, s1,s2) aligned values(1,'aa','bb')"); } } @@ -132,19 +132,19 @@ public void testInsertAlignedWithEmptyPage2() throws SQLException { public void testInsertComplexAlignedValues() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.addBatch("create aligned timeseries root.sg.d1(s1 int32, s2 int32, s3 int32)"); - statement.addBatch("insert into root.sg.d1(time,s1) values(3,1)"); - statement.addBatch("insert into root.sg.d1(time,s1) values(1,1)"); - statement.addBatch("insert into root.sg.d1(time,s1) values(2,1)"); - statement.addBatch("insert into root.sg.d1(time,s2) values(2,2)"); - statement.addBatch("insert into root.sg.d1(time,s2) values(1,2)"); - statement.addBatch("insert into root.sg.d1(time,s2) values(3,2)"); - statement.addBatch("insert into root.sg.d1(time,s3) values(1,3)"); - statement.addBatch("insert into root.sg.d1(time,s3) values(3,3)"); + statement.addBatch("create aligned timeseries root.db.d1(s1 int32, s2 int32, s3 int32)"); + statement.addBatch("insert into root.db.d1(time,s1) values(3,1)"); + statement.addBatch("insert into root.db.d1(time,s1) values(1,1)"); + statement.addBatch("insert into root.db.d1(time,s1) values(2,1)"); + statement.addBatch("insert into root.db.d1(time,s2) values(2,2)"); + statement.addBatch("insert into root.db.d1(time,s2) values(1,2)"); + statement.addBatch("insert into root.db.d1(time,s2) values(3,2)"); + statement.addBatch("insert into root.db.d1(time,s3) values(1,3)"); + statement.addBatch("insert into root.db.d1(time,s3) values(3,3)"); statement.executeBatch(); try (ResultSet resultSet = - statement.executeQuery("select count(s1), count(s2), count(s3) from root.sg.d1")) { + statement.executeQuery("select count(s1), count(s2), count(s3) from root.db.d1")) { assertTrue(resultSet.next()); assertEquals(3, resultSet.getInt(1)); @@ -156,7 +156,7 @@ public void testInsertComplexAlignedValues() throws SQLException { statement.execute("flush"); try (ResultSet resultSet = - statement.executeQuery("select count(s1), count(s2), count(s3) from root.sg.d1")) { + statement.executeQuery("select count(s1), count(s2), count(s3) from root.db.d1")) { assertTrue(resultSet.next()); assertEquals(3, resultSet.getInt(1)); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues4IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues4IT.java index 244e86a6d8b06..314c287f83be2 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues4IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValues4IT.java @@ -59,14 +59,14 @@ public void testExtendTextColumn() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time,s1,s2) aligned values(1,'test','test')"); - statement.execute("insert into root.sg.d1(time,s1,s2) aligned values(2,'test','test')"); - statement.execute("insert into root.sg.d1(time,s1,s2) aligned values(3,'test','test')"); - statement.execute("insert into root.sg.d1(time,s1,s2) aligned values(4,'test','test')"); - statement.execute("insert into root.sg.d1(time,s1,s3) aligned values(5,'test','test')"); - statement.execute("insert into root.sg.d1(time,s1,s2) aligned values(6,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s2) aligned values(1,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s2) aligned values(2,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s2) aligned values(3,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s2) aligned values(4,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s3) aligned values(5,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s2) aligned values(6,'test','test')"); statement.execute("flush"); - statement.execute("insert into root.sg.d1(time,s1,s3) aligned values(7,'test','test')"); + statement.execute("insert into root.db.d1(time,s1,s3) aligned values(7,'test','test')"); } catch (SQLException e) { fail(); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java index 1ac466653f6b0..b23fcc3587249 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java @@ -221,11 +221,11 @@ public void testUpdatingAlignedValues() throws SQLException { public void testInsertAlignedValuesWithSameTimestamp() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.addBatch("insert into root.sg.d1(time,s2) aligned values(1,2)"); - statement.addBatch("insert into root.sg.d1(time,s1) aligned values(1,2)"); + statement.addBatch("insert into root.db.d1(time,s2) aligned values(1,2)"); + statement.addBatch("insert into root.db.d1(time,s1) aligned values(1,2)"); statement.executeBatch(); - try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db.d1")) { assertTrue(resultSet.next()); assertEquals(1, resultSet.getLong(1)); @@ -236,7 +236,7 @@ public void testInsertAlignedValuesWithSameTimestamp() throws SQLException { } statement.execute("flush"); - try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1, s2 from root.db.d1")) { assertTrue(resultSet.next()); assertEquals(1, resultSet.getLong(1)); @@ -355,9 +355,9 @@ public void testInsertNonAlignedTimeseriesWithAligned() throws SQLException { public void testInsertAlignedValuesWithThreeLevelPath() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg_device(time, status) aligned values (4000, true)"); + statement.execute("insert into root.db_device(time, status) aligned values (4000, true)"); - try (ResultSet resultSet = statement.executeQuery("select ** from root.sg_device")) { + try (ResultSet resultSet = statement.executeQuery("select ** from root.db_device")) { assertTrue(resultSet.next()); assertTrue(resultSet.getBoolean(2)); assertFalse(resultSet.next()); @@ -384,7 +384,7 @@ public void testInsertMultiRows() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "insert into root.sg1.d1(time, s1, s2) aligned values(10, 2, 2), (11, 3, '3'), (12,12.11,false);"); + "insert into root.db1.d1(time, s1, s2) aligned values(10, 2, 2), (11, 3, '3'), (12,12.11,false);"); fail(); } catch (SQLException e) { assertTrue(e.getMessage(), e.getMessage().contains("data type is not consistent")); @@ -396,7 +396,7 @@ public void testInsertLargeNumber() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "insert into root.sg1.d1(time, s98, s99) aligned values(10, 2, 271840880000000000000000)"); + "insert into root.db1.d1(time, s98, s99) aligned values(10, 2, 271840880000000000000000)"); } catch (SQLException e) { fail(); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletion2IT.java index 0810a0abe5953..97ff1ad575773 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletion2IT.java @@ -52,8 +52,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 27"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 27"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletionIT.java index f02e2fd6ec8ae..f19c044bae53c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithDeletionIT.java @@ -64,8 +64,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 27"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 27"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -82,14 +82,14 @@ public void selectAllAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { @@ -118,19 +118,19 @@ public void selectAllAlignedAndNonAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "20,root.sg1.d2.s1,20.0,FLOAT", - "40,root.sg1.d2.s2,40,INT32", - "30,root.sg1.d2.s3,30,INT64", - "30,root.sg1.d2.s4,false,BOOLEAN", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT", + "20,root.db1.d2.s1,20.0,FLOAT", + "40,root.db1.d2.s2,40,INT32", + "30,root.db1.d2.s3,30,INT64", + "30,root.db1.d2.s4,false,BOOLEAN", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.* order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.* order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { @@ -157,13 +157,13 @@ public void selectAllAlignedAndNonAlignedLastTest() { public void selectAllAlignedLastWithTimeFilterTest() { Set retSet = - new HashSet<>(Collections.singletonList("40,root.sg1.d1.s5,aligned_test40,TEXT")); + new HashSet<>(Collections.singletonList("40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select last * from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last * from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -190,13 +190,13 @@ public void selectSomeAlignedLastTest1() { Set retSet = new HashSet<>( Arrays.asList( - "30,root.sg1.d1.s4,false,BOOLEAN", "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "30,root.db1.d1.s4,false,BOOLEAN", "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { @@ -222,12 +222,12 @@ public void selectSomeAlignedLastTest1() { @Test public void selectSomeAlignedLastTest2() { Set retSet = - new HashSet<>(Collections.singletonList("30,root.sg1.d1.s4,false,BOOLEAN")); + new HashSet<>(Collections.singletonList("30,root.db1.d1.s4,false,BOOLEAN")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select last s1, s4 from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last s1, s4 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { @@ -254,13 +254,13 @@ public void selectSomeAlignedLastTest2() { public void selectSomeAlignedLastWithTimeFilterTest() { Set retSet = - new HashSet<>(Collections.singletonList("40,root.sg1.d1.s5,aligned_test40,TEXT")); + new HashSet<>(Collections.singletonList("40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { @@ -289,14 +289,14 @@ public void selectSomeAlignedAndNonAlignedLastWithTimeFilterTest() { Set retSet = new HashSet<>( Arrays.asList( - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "40,root.db1.d1.s5,aligned_test40,TEXT", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time > 30 order by timeseries asc")) { + "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheIT.java index 25b6a2098c9c3..3a209b74d723c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheIT.java @@ -74,17 +74,17 @@ public void selectAllAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "40,root.sg1.d1.s2,40,INT32", - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "40,root.db1.d1.s2,40,INT32", + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -113,22 +113,22 @@ public void selectAllAlignedAndNonAlignedLastTest() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "40,root.sg1.d1.s2,40,INT32", - "30,root.sg1.d1.s3,30,INT64", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "20,root.sg1.d2.s1,20.0,FLOAT", - "40,root.sg1.d2.s2,40,INT32", - "30,root.sg1.d2.s3,30,INT64", - "30,root.sg1.d2.s4,false,BOOLEAN", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "40,root.db1.d1.s2,40,INT32", + "30,root.db1.d1.s3,30,INT64", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT", + "20,root.db1.d2.s1,20.0,FLOAT", + "40,root.db1.d2.s2,40,INT32", + "30,root.db1.d2.s3,30,INT64", + "30,root.db1.d2.s4,false,BOOLEAN", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg1.* order by timeseries asc")) { + statement.executeQuery("select last * from root.db1.* order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -156,14 +156,14 @@ public void selectAllAlignedLastWithTimeFilterTest() { Set retSet = new HashSet<>( - Arrays.asList("40,root.sg1.d1.s2,40,INT32", "40,root.sg1.d1.s5,aligned_test40,TEXT")); + Arrays.asList("40,root.db1.d1.s2,40,INT32", "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last * from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last * from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -191,16 +191,16 @@ public void selectSomeAlignedLastTest1() { Set retSet = new HashSet<>( Arrays.asList( - "23,root.sg1.d1.s1,230000.0,FLOAT", - "30,root.sg1.d1.s4,false,BOOLEAN", - "40,root.sg1.d1.s5,aligned_test40,TEXT")); + "23,root.db1.d1.s1,230000.0,FLOAT", + "30,root.db1.d1.s4,false,BOOLEAN", + "40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -227,13 +227,13 @@ public void selectSomeAlignedLastTest1() { public void selectSomeAlignedLastTest2() { Set retSet = new HashSet<>( - Arrays.asList("23,root.sg1.d1.s1,230000.0,FLOAT", "30,root.sg1.d1.s4,false,BOOLEAN")); + Arrays.asList("23,root.db1.d1.s1,230000.0,FLOAT", "30,root.db1.d1.s4,false,BOOLEAN")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last s1, s4 from root.sg1.d1 order by timeseries asc")) { + statement.executeQuery("select last s1, s4 from root.db1.d1 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -260,14 +260,14 @@ public void selectSomeAlignedLastTest2() { public void selectSomeAlignedLastWithTimeFilterTest() { Set retSet = - new HashSet<>(Collections.singletonList("40,root.sg1.d1.s5,aligned_test40,TEXT")); + new HashSet<>(Collections.singletonList("40,root.db1.d1.s5,aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last s1, s4, s5 from root.sg1.d1 where time > 30 order by timeseries asc")) { + "select last s1, s4, s5 from root.db1.d1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -296,15 +296,15 @@ public void selectSomeAlignedAndNonAlignedLastWithTimeFilterTest() { Set retSet = new HashSet<>( Arrays.asList( - "40,root.sg1.d1.s5,aligned_test40,TEXT", - "40,root.sg1.d2.s5,non_aligned_test40,TEXT")); + "40,root.db1.d1.s5,aligned_test40,TEXT", + "40,root.db1.d2.s5,non_aligned_test40,TEXT")); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time > 30 order by timeseries asc")) { + "select last d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time > 30 order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletion2IT.java index efc2d65dd9185..65da253986853 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletion2IT.java @@ -55,8 +55,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 27"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 27"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletionIT.java index eaa134759c389..0ad7c3b390984 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBLastQueryWithoutLastCacheWithDeletionIT.java @@ -53,8 +53,8 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s1 where time <= 27"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s1 where time <= 27"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBPredicatePushDownIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBPredicatePushDownIT.java index f9639d3ea2d2c..0b0ae45deae9f 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBPredicatePushDownIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBPredicatePushDownIT.java @@ -57,7 +57,7 @@ public static void tearDown() throws Exception { @Test public void testAlignedRawDataAlignByTime1() { - String expectedHeader1 = "Time,root.sg1.d1.s2,root.sg1.d1.s3,"; + String expectedHeader1 = "Time,root.db1.d1.s2,root.db1.d1.s3,"; String[] retArray1 = new String[] { "10,10,10,", @@ -72,46 +72,46 @@ public void testAlignedRawDataAlignByTime1() { "20,20,20," }; resultSetEqualTest( - "select s2, s3 from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); + "select s2, s3 from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); resultSetEqualTest( - "select s2, s3 from root.sg1.d1 where 9 <= s2 - 1 and 30 > s2", expectedHeader1, retArray1); + "select s2, s3 from root.db1.d1 where 9 <= s2 - 1 and 30 > s2", expectedHeader1, retArray1); retArray1 = new String[] {"20,20,20,"}; resultSetEqualTest( - "select s2, s3 from root.sg1.d1 where 9 <= s2 - 1 and 30 > s2 and 19 < time", + "select s2, s3 from root.db1.d1 where 9 <= s2 - 1 and 30 > s2 and 19 < time", expectedHeader1, retArray1); - String expectedHeader2 = "Time,root.sg1.d1.s3,"; + String expectedHeader2 = "Time,root.db1.d1.s3,"; String[] retArray2 = new String[] { "10,10,", "11,11,", "12,12,", "14,14,", "15,15,", "16,16,", "17,17,", "18,18,", "19,19,", "20,20," }; resultSetEqualTest( - "select s3 from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); + "select s3 from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); - String expectedHeader3 = "Time,root.sg1.d1.s2,"; + String expectedHeader3 = "Time,root.db1.d1.s2,"; String[] retArray3 = new String[] { "10,10,", "11,11,", "12,12,", "14,14,", "15,15,", "16,16,", "17,17,", "18,18,", "19,19,", "20,20," }; resultSetEqualTest( - "select s2 from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); + "select s2 from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); - String expectedHeader4 = "Time,root.sg1.d1.s2,"; + String expectedHeader4 = "Time,root.db1.d1.s2,"; String[] retArray4 = new String[] {"14,14,", "15,15,"}; resultSetEqualTest( - "select s2 from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30 offset 3 limit 2", + "select s2 from root.db1.d1 where s2 - 1 >= 9 and s2 < 30 offset 3 limit 2", expectedHeader4, retArray4); } @Test public void testAlignedRawDataAlignByTime2() { - String expectedHeader1 = "Time,root.sg1.d1.s2,root.sg1.d1.s3 + 1,"; + String expectedHeader1 = "Time,root.db1.d1.s2,root.db1.d1.s3 + 1,"; String[] retArray1 = new String[] { "3,null,30001.0,", @@ -133,9 +133,9 @@ public void testAlignedRawDataAlignByTime2() { "30,null,31.0,", }; resultSetEqualTest( - "select s2, s3 + 1 from root.sg1.d1 where s3 + 1 > 16", expectedHeader1, retArray1); + "select s2, s3 + 1 from root.db1.d1 where s3 + 1 > 16", expectedHeader1, retArray1); - String expectedHeader2 = "Time,root.sg1.d1.s2,"; + String expectedHeader2 = "Time,root.db1.d1.s2,"; String[] retArray2 = new String[] { "3,null,", @@ -156,9 +156,9 @@ public void testAlignedRawDataAlignByTime2() { "29,null,", "30,null,", }; - resultSetEqualTest("select s2 from root.sg1.d1 where s3 + 1 > 16", expectedHeader2, retArray2); + resultSetEqualTest("select s2 from root.db1.d1 where s3 + 1 > 16", expectedHeader2, retArray2); - String expectedHeader3 = "Time,root.sg1.d1.s3,"; + String expectedHeader3 = "Time,root.db1.d1.s3,"; String[] retArray3 = new String[] { "3,30000,", @@ -179,17 +179,17 @@ public void testAlignedRawDataAlignByTime2() { "29,29,", "30,30,", }; - resultSetEqualTest("select s3 from root.sg1.d1 where s3 + 1 > 16", expectedHeader3, retArray3); + resultSetEqualTest("select s3 from root.db1.d1 where s3 + 1 > 16", expectedHeader3, retArray3); - String expectedHeader4 = "Time,root.sg1.d1.s3,"; + String expectedHeader4 = "Time,root.db1.d1.s3,"; String[] retArray4 = new String[] {"3,30000,", "13,130000,", "16,16,"}; resultSetEqualTest( - "select s3 from root.sg1.d1 where s3 + 1 > 16 limit 3", expectedHeader4, retArray4); + "select s3 from root.db1.d1 where s3 + 1 > 16 limit 3", expectedHeader4, retArray4); } @Test public void testNonAlignedRawDataAlignByTime1() { - String expectedHeader1 = "Time,root.sg1.d2.s2,root.sg1.d2.s3,"; + String expectedHeader1 = "Time,root.db1.d2.s2,root.db1.d2.s3,"; String[] retArray1 = new String[] { "10,10,10,", @@ -205,37 +205,37 @@ public void testNonAlignedRawDataAlignByTime1() { "20,20,20," }; resultSetEqualTest( - "select s2, s3 from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); + "select s2, s3 from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); - String expectedHeader2 = "Time,root.sg1.d2.s3,"; + String expectedHeader2 = "Time,root.db1.d2.s3,"; String[] retArray2 = new String[] { "10,10,", "11,11,", "12,12,", "13,13,", "14,14,", "15,15,", "16,16,", "17,17,", "18,18,", "19,19,", "20,20," }; resultSetEqualTest( - "select s3 from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); + "select s3 from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); - String expectedHeader3 = "Time,root.sg1.d2.s2,"; + String expectedHeader3 = "Time,root.db1.d2.s2,"; String[] retArray3 = new String[] { "10,10,", "11,11,", "12,12,", "13,13,", "14,14,", "15,15,", "16,16,", "17,17,", "18,18,", "19,19,", "20,20," }; resultSetEqualTest( - "select s2 from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); + "select s2 from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); - String expectedHeader4 = "Time,root.sg1.d2.s2,"; + String expectedHeader4 = "Time,root.db1.d2.s2,"; String[] retArray4 = new String[] {"12,12,", "13,13,", "14,14,"}; resultSetEqualTest( - "select s2 from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 limit 3 offset 2", + "select s2 from root.db1.d2 where s2 - 1 >= 9 and s2 < 30 limit 3 offset 2", expectedHeader4, retArray4); } @Test public void testNonAlignedRawDataAlignByTime2() { - String expectedHeader1 = "Time,root.sg1.d2.s2,root.sg1.d2.s3,"; + String expectedHeader1 = "Time,root.db1.d2.s2,root.db1.d2.s3,"; String[] retArray1 = new String[] { "16,16,16,", @@ -255,9 +255,9 @@ public void testNonAlignedRawDataAlignByTime2() { "30,null,30,", }; resultSetEqualTest( - "select s2, s3 from root.sg1.d2 where s3 + 1 > 16", expectedHeader1, retArray1); + "select s2, s3 from root.db1.d2 where s3 + 1 > 16", expectedHeader1, retArray1); - String expectedHeader2 = "Time,root.sg1.d2.s2,"; + String expectedHeader2 = "Time,root.db1.d2.s2,"; String[] retArray2 = new String[] { "16,16,", @@ -276,28 +276,28 @@ public void testNonAlignedRawDataAlignByTime2() { "29,null,", "30,null,", }; - resultSetEqualTest("select s2 from root.sg1.d2 where s3 + 1 > 16", expectedHeader2, retArray2); + resultSetEqualTest("select s2 from root.db1.d2 where s3 + 1 > 16", expectedHeader2, retArray2); - String expectedHeader3 = "Time,root.sg1.d2.s3,"; + String expectedHeader3 = "Time,root.db1.d2.s3,"; String[] retArray3 = new String[] { "16,16,", "17,17,", "18,18,", "19,19,", "20,20,", "21,21,", "22,22,", "23,23,", "24,24,", "25,25,", "26,26,", "27,27,", "28,28,", "29,29,", "30,30,", }; - resultSetEqualTest("select s3 from root.sg1.d2 where s3 + 1 > 16", expectedHeader3, retArray3); + resultSetEqualTest("select s3 from root.db1.d2 where s3 + 1 > 16", expectedHeader3, retArray3); - String expectedHeader4 = "Time,root.sg1.d2.s3,"; + String expectedHeader4 = "Time,root.db1.d2.s3,"; String[] retArray4 = new String[] { "26,26,", "27,27,", "28,28,", "29,29,", "30,30,", }; resultSetEqualTest( - "select s3 from root.sg1.d2 where s3 + 1 > 16 offset 10", expectedHeader4, retArray4); + "select s3 from root.db1.d2 where s3 + 1 > 16 offset 10", expectedHeader4, retArray4); } @Test public void testMixRawDataAlignByTime() { - String expectedHeader1 = "Time,root.sg1.d1.s2,root.sg1.d2.s2,root.sg1.d1.s3,root.sg1.d2.s3,"; + String expectedHeader1 = "Time,root.db1.d1.s2,root.db1.d2.s2,root.db1.d1.s3,root.db1.d2.s3,"; String[] retArray1 = new String[] { "10,10,10,10,10,", @@ -312,174 +312,174 @@ public void testMixRawDataAlignByTime() { "20,20,20,20,20," }; resultSetEqualTest( - "select s2, s3 from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", + "select s2, s3 from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); } @Test public void testAlignedAggregationAlignByTime1() { - String expectedHeader1 = "count(root.sg1.d1.s2),count(root.sg1.d1.s3),"; + String expectedHeader1 = "count(root.db1.d1.s2),count(root.db1.d1.s3),"; String[] retArray1 = new String[] { "10,10,", }; resultSetEqualTest( - "select count(s2), count(s3) from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", + "select count(s2), count(s3) from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); - String expectedHeader2 = "count(root.sg1.d1.s3),"; + String expectedHeader2 = "count(root.db1.d1.s3),"; String[] retArray2 = new String[] {"10,"}; resultSetEqualTest( - "select count(s3) from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", + "select count(s3) from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); - String expectedHeader3 = "count(root.sg1.d1.s2),"; + String expectedHeader3 = "count(root.db1.d1.s2),"; String[] retArray3 = new String[] { "10,", }; resultSetEqualTest( - "select count(s2) from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30", + "select count(s2) from root.db1.d1 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); } @Test public void testAlignedAggregationAlignByTime2() { - String expectedHeader1 = "count(root.sg1.d1.s2),count(root.sg1.d1.s3 + 1),"; + String expectedHeader1 = "count(root.db1.d1.s2),count(root.db1.d1.s3 + 1),"; String[] retArray1 = new String[] { "6,17,", }; resultSetEqualTest( - "select count(s2), count(s3 + 1) from root.sg1.d1 where s3 + 1 > 16", + "select count(s2), count(s3 + 1) from root.db1.d1 where s3 + 1 > 16", expectedHeader1, retArray1); - String expectedHeader2 = "count(root.sg1.d1.s2),"; + String expectedHeader2 = "count(root.db1.d1.s2),"; String[] retArray2 = new String[] { "6,", }; resultSetEqualTest( - "select count(s2) from root.sg1.d1 where s3 + 1 > 16", expectedHeader2, retArray2); + "select count(s2) from root.db1.d1 where s3 + 1 > 16", expectedHeader2, retArray2); - String expectedHeader3 = "count(root.sg1.d1.s3),"; + String expectedHeader3 = "count(root.db1.d1.s3),"; String[] retArray3 = new String[] { "17,", }; resultSetEqualTest( - "select count(s3) from root.sg1.d1 where s3 + 1 > 16", expectedHeader3, retArray3); + "select count(s3) from root.db1.d1 where s3 + 1 > 16", expectedHeader3, retArray3); } @Test public void testNonAlignedAggregationAlignByTime1() { - String expectedHeader1 = "count(root.sg1.d2.s2),count(root.sg1.d2.s3),"; + String expectedHeader1 = "count(root.db1.d2.s2),count(root.db1.d2.s3),"; String[] retArray1 = new String[] {"11,11,"}; resultSetEqualTest( - "select count(s2), count(s3) from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", + "select count(s2), count(s3) from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); - String expectedHeader2 = "count(root.sg1.d2.s3),"; + String expectedHeader2 = "count(root.db1.d2.s3),"; String[] retArray2 = new String[] {"11,"}; resultSetEqualTest( - "select count(s3) from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", + "select count(s3) from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader2, retArray2); - String expectedHeader3 = "count(root.sg1.d2.s2),"; + String expectedHeader3 = "count(root.db1.d2.s2),"; String[] retArray3 = new String[] {"11,"}; resultSetEqualTest( - "select count(s2) from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", + "select count(s2) from root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader3, retArray3); } @Test public void testNonAlignedAggregationAlignByTime2() { - String expectedHeader1 = "count(root.sg1.d2.s2),count(root.sg1.d2.s3),"; + String expectedHeader1 = "count(root.db1.d2.s2),count(root.db1.d2.s3),"; String[] retArray1 = new String[] { "5,15,", }; resultSetEqualTest( - "select count(s2), count(s3) from root.sg1.d2 where s3 + 1 > 16", + "select count(s2), count(s3) from root.db1.d2 where s3 + 1 > 16", expectedHeader1, retArray1); - String expectedHeader2 = "count(root.sg1.d2.s2),"; + String expectedHeader2 = "count(root.db1.d2.s2),"; String[] retArray2 = new String[] { "5,", }; resultSetEqualTest( - "select count(s2) from root.sg1.d2 where s3 + 1 > 16", expectedHeader2, retArray2); + "select count(s2) from root.db1.d2 where s3 + 1 > 16", expectedHeader2, retArray2); - String expectedHeader3 = "count(root.sg1.d2.s3),"; + String expectedHeader3 = "count(root.db1.d2.s3),"; String[] retArray3 = new String[] { "15,", }; resultSetEqualTest( - "select count(s3) from root.sg1.d2 where s3 + 1 > 16", expectedHeader3, retArray3); + "select count(s3) from root.db1.d2 where s3 + 1 > 16", expectedHeader3, retArray3); } @Test public void testMixAggregationAlignByTime() { String expectedHeader1 = - "count(root.sg1.d1.s2),count(root.sg1.d2.s2),count(root.sg1.d1.s3),count(root.sg1.d2.s3),"; + "count(root.db1.d1.s2),count(root.db1.d2.s2),count(root.db1.d1.s3),count(root.db1.d2.s3),"; String[] retArray1 = new String[] { "10,10,10,10,", }; resultSetEqualTest( - "select count(s2), count(s3) from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30", + "select count(s2), count(s3) from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30", expectedHeader1, retArray1); } @Test public void testAlignedGroupByTimeAlignByTime1() { - String expectedHeader = "Time,count(root.sg1.d1.s2),sum(root.sg1.d1.s3),"; + String expectedHeader = "Time,count(root.db1.d1.s2),sum(root.db1.d1.s3),"; String[] retArray = new String[] {"1,1,10.0,", "11,9,142.0,", "21,0,null,", "31,0,null,"}; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d1 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", + "select count(s2), sum(s3) from root.db1.d1 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", expectedHeader, retArray); } @Test public void testAlignedGroupByTimeAlignByTime2() { - String expectedHeader = "Time,count(root.sg1.d1.s2),sum(root.sg1.d1.s3),"; + String expectedHeader = "Time,count(root.db1.d1.s2),sum(root.db1.d1.s3),"; String[] retArray = new String[] {"1,0,30000.0,", "11,6,130090.0,", "21,0,230232.0,", "31,0,null,"}; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d1 where s3 + 1 > 16 group by ([1, 41), 10ms)", + "select count(s2), sum(s3) from root.db1.d1 where s3 + 1 > 16 group by ([1, 41), 10ms)", expectedHeader, retArray); } @Test public void testNonAlignedGroupByTimeAlignByTime1() { - String expectedHeader = "Time,count(root.sg1.d2.s2),sum(root.sg1.d2.s3 + 1),"; + String expectedHeader = "Time,count(root.db1.d2.s2),sum(root.db1.d2.s3 + 1),"; String[] retArray = new String[] {"1,1,11.0,", "11,10,165.0,", "21,0,null,", "31,0,null,"}; resultSetEqualTest( - "select count(s2), sum(s3 + 1) from root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", + "select count(s2), sum(s3 + 1) from root.db1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", expectedHeader, retArray); } @Test public void testNonAlignedGroupByTimeAlignByTime2() { - String expectedHeader = "Time,count(root.sg1.d2.s2),sum(root.sg1.d2.s3),"; + String expectedHeader = "Time,count(root.db1.d2.s2),sum(root.db1.d2.s3),"; String[] retArray = new String[] {"1,0,null,", "11,5,90.0,", "21,0,255.0,", "31,0,null,"}; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d2 where s3 + 1 > 16 group by ([1, 41), 10ms)", + "select count(s2), sum(s3) from root.db1.d2 where s3 + 1 > 16 group by ([1, 41), 10ms)", expectedHeader, retArray); } @@ -487,13 +487,13 @@ public void testNonAlignedGroupByTimeAlignByTime2() { @Test public void testMixGroupByTimeAlignByTime() { String expectedHeader = - "Time,count(root.sg1.d1.s2),count(root.sg1.d2.s2),sum(root.sg1.d1.s3),sum(root.sg1.d2.s3),"; + "Time,count(root.db1.d1.s2),count(root.db1.d2.s2),sum(root.db1.d1.s3),sum(root.db1.d2.s3),"; String[] retArray = new String[] { "1,1,1,10.0,10.0,", "11,9,9,142.0,142.0,", "21,0,0,null,null,", "31,0,0,null,null," }; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", + "select count(s2), sum(s3) from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms)", expectedHeader, retArray); } @@ -503,30 +503,30 @@ public void testRawDataAlignByDevice1() { String expectedHeader = "Time,Device,s2,s3,"; String[] retArray = new String[] { - "10,root.sg1.d2,10,10,", - "11,root.sg1.d2,11,11,", - "12,root.sg1.d2,12,12,", - "13,root.sg1.d2,13,13,", - "14,root.sg1.d2,14,14,", - "15,root.sg1.d2,15,15,", - "16,root.sg1.d2,16,16,", - "17,root.sg1.d2,17,17,", - "18,root.sg1.d2,18,18,", - "19,root.sg1.d2,19,19,", - "20,root.sg1.d2,20,20,", - "10,root.sg1.d1,10,10,", - "11,root.sg1.d1,11,11,", - "12,root.sg1.d1,12,12,", - "14,root.sg1.d1,14,14,", - "15,root.sg1.d1,15,15,", - "16,root.sg1.d1,16,16,", - "17,root.sg1.d1,17,17,", - "18,root.sg1.d1,18,18,", - "19,root.sg1.d1,19,19,", - "20,root.sg1.d1,20,20," + "10,root.db1.d2,10,10,", + "11,root.db1.d2,11,11,", + "12,root.db1.d2,12,12,", + "13,root.db1.d2,13,13,", + "14,root.db1.d2,14,14,", + "15,root.db1.d2,15,15,", + "16,root.db1.d2,16,16,", + "17,root.db1.d2,17,17,", + "18,root.db1.d2,18,18,", + "19,root.db1.d2,19,19,", + "20,root.db1.d2,20,20,", + "10,root.db1.d1,10,10,", + "11,root.db1.d1,11,11,", + "12,root.db1.d1,12,12,", + "14,root.db1.d1,14,14,", + "15,root.db1.d1,15,15,", + "16,root.db1.d1,16,16,", + "17,root.db1.d1,17,17,", + "18,root.db1.d1,18,18,", + "19,root.db1.d1,19,19,", + "20,root.db1.d1,20,20," }; resultSetEqualTest( - "select s2, s3 from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 order by device desc align by device", + "select s2, s3 from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30 order by device desc align by device", expectedHeader, retArray); } @@ -536,41 +536,41 @@ public void testRawDataAlignByDevice2() { String expectedHeader = "Time,Device,s2,s3 + 1,"; String[] retArray = new String[] { - "3,root.sg1.d1,null,30001.0,", - "13,root.sg1.d1,130000,130001.0,", - "16,root.sg1.d1,16,17.0,", - "17,root.sg1.d1,17,18.0,", - "18,root.sg1.d1,18,19.0,", - "19,root.sg1.d1,19,20.0,", - "20,root.sg1.d1,20,21.0,", - "21,root.sg1.d1,null,22.0,", - "22,root.sg1.d1,null,23.0,", - "23,root.sg1.d1,null,230001.0,", - "24,root.sg1.d1,null,25.0,", - "25,root.sg1.d1,null,26.0,", - "26,root.sg1.d1,null,27.0,", - "27,root.sg1.d1,null,28.0,", - "28,root.sg1.d1,null,29.0,", - "29,root.sg1.d1,null,30.0,", - "30,root.sg1.d1,null,31.0,", - "16,root.sg1.d2,16,17.0,", - "17,root.sg1.d2,17,18.0,", - "18,root.sg1.d2,18,19.0,", - "19,root.sg1.d2,19,20.0,", - "20,root.sg1.d2,20,21.0,", - "21,root.sg1.d2,null,22.0,", - "22,root.sg1.d2,null,23.0,", - "23,root.sg1.d2,null,24.0,", - "24,root.sg1.d2,null,25.0,", - "25,root.sg1.d2,null,26.0,", - "26,root.sg1.d2,null,27.0,", - "27,root.sg1.d2,null,28.0,", - "28,root.sg1.d2,null,29.0,", - "29,root.sg1.d2,null,30.0,", - "30,root.sg1.d2,null,31.0,", + "3,root.db1.d1,null,30001.0,", + "13,root.db1.d1,130000,130001.0,", + "16,root.db1.d1,16,17.0,", + "17,root.db1.d1,17,18.0,", + "18,root.db1.d1,18,19.0,", + "19,root.db1.d1,19,20.0,", + "20,root.db1.d1,20,21.0,", + "21,root.db1.d1,null,22.0,", + "22,root.db1.d1,null,23.0,", + "23,root.db1.d1,null,230001.0,", + "24,root.db1.d1,null,25.0,", + "25,root.db1.d1,null,26.0,", + "26,root.db1.d1,null,27.0,", + "27,root.db1.d1,null,28.0,", + "28,root.db1.d1,null,29.0,", + "29,root.db1.d1,null,30.0,", + "30,root.db1.d1,null,31.0,", + "16,root.db1.d2,16,17.0,", + "17,root.db1.d2,17,18.0,", + "18,root.db1.d2,18,19.0,", + "19,root.db1.d2,19,20.0,", + "20,root.db1.d2,20,21.0,", + "21,root.db1.d2,null,22.0,", + "22,root.db1.d2,null,23.0,", + "23,root.db1.d2,null,24.0,", + "24,root.db1.d2,null,25.0,", + "25,root.db1.d2,null,26.0,", + "26,root.db1.d2,null,27.0,", + "27,root.db1.d2,null,28.0,", + "28,root.db1.d2,null,29.0,", + "29,root.db1.d2,null,30.0,", + "30,root.db1.d2,null,31.0,", }; resultSetEqualTest( - "select s2, s3 + 1 from root.sg1.d1, root.sg1.d2 where s3 + 1 > 16 align by device", + "select s2, s3 + 1 from root.db1.d1, root.db1.d2 where s3 + 1 > 16 align by device", expectedHeader, retArray); } @@ -578,9 +578,9 @@ public void testRawDataAlignByDevice2() { @Test public void testAggregationAlignByDevice1() { String expectedHeader = "Device,count(s2),sum(s3),"; - String[] retArray = new String[] {"root.sg1.d2,11,165.0,", "root.sg1.d1,10,152.0,"}; + String[] retArray = new String[] {"root.db1.d2,11,165.0,", "root.db1.d1,10,152.0,"}; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 order by device desc align by device", + "select count(s2), sum(s3) from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30 order by device desc align by device", expectedHeader, retArray); } @@ -588,9 +588,9 @@ public void testAggregationAlignByDevice1() { @Test public void testAggregationAlignByDevice2() { String expectedHeader = "Device,count(s2),sum(s3 + 1),"; - String[] retArray = new String[] {"root.sg1.d1,6,390339.0,", "root.sg1.d2,5,360.0,"}; + String[] retArray = new String[] {"root.db1.d1,6,390339.0,", "root.db1.d2,5,360.0,"}; resultSetEqualTest( - "select count(s2), sum(s3 + 1) from root.sg1.d1, root.sg1.d2 where s3 + 1 > 16 align by device", + "select count(s2), sum(s3 + 1) from root.db1.d1, root.db1.d2 where s3 + 1 > 16 align by device", expectedHeader, retArray); } @@ -600,17 +600,17 @@ public void testGroupByTimeAlignByDevice1() { String expectedHeader = "Time,Device,count(s2),sum(s3),"; String[] retArray = new String[] { - "1,root.sg1.d2,1,10.0,", - "11,root.sg1.d2,10,155.0,", - "21,root.sg1.d2,0,null,", - "31,root.sg1.d2,0,null,", - "1,root.sg1.d1,1,10.0,", - "11,root.sg1.d1,9,142.0,", - "21,root.sg1.d1,0,null,", - "31,root.sg1.d1,0,null," + "1,root.db1.d2,1,10.0,", + "11,root.db1.d2,10,155.0,", + "21,root.db1.d2,0,null,", + "31,root.db1.d2,0,null,", + "1,root.db1.d1,1,10.0,", + "11,root.db1.d1,9,142.0,", + "21,root.db1.d1,0,null,", + "31,root.db1.d1,0,null," }; resultSetEqualTest( - "select count(s2), sum(s3) from root.sg1.d1, root.sg1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms) order by device desc align by device", + "select count(s2), sum(s3) from root.db1.d1, root.db1.d2 where s2 - 1 >= 9 and s2 < 30 group by ([1, 41), 10ms) order by device desc align by device", expectedHeader, retArray); } @@ -620,17 +620,17 @@ public void testGroupByTimeAlignByDevice2() { String expectedHeader = "Time,Device,count(s2),sum(s3 + 1),"; String[] retArray = new String[] { - "1,root.sg1.d1,0,30001.0,", - "11,root.sg1.d1,6,130096.0,", - "21,root.sg1.d1,0,230242.0,", - "31,root.sg1.d1,0,null,", - "1,root.sg1.d2,0,null,", - "11,root.sg1.d2,5,95.0,", - "21,root.sg1.d2,0,265.0,", - "31,root.sg1.d2,0,null," + "1,root.db1.d1,0,30001.0,", + "11,root.db1.d1,6,130096.0,", + "21,root.db1.d1,0,230242.0,", + "31,root.db1.d1,0,null,", + "1,root.db1.d2,0,null,", + "11,root.db1.d2,5,95.0,", + "21,root.db1.d2,0,265.0,", + "31,root.db1.d2,0,null," }; resultSetEqualTest( - "select count(s2), sum(s3 + 1) from root.sg1.d1, root.sg1.d2 where s3 + 1 > 16 group by ([1, 41), 10ms) align by device", + "select count(s2), sum(s3 + 1) from root.db1.d1, root.db1.d2 where s3 + 1 > 16 group by ([1, 41), 10ms) align by device", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletion2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletion2IT.java index 01e9466fcbab6..dee36b10de1ba 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletion2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletion2IT.java @@ -54,10 +54,10 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s2 where time <= 40"); - statement.execute("delete from root.sg1.d1.s1 where time <= 21"); - statement.execute("delete from root.sg1.d1.s5 where time <= 31 and time > 20"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s2 where time <= 40"); + statement.execute("delete from root.db1.d1.s1 where time <= 21"); + statement.execute("delete from root.db1.d1.s5 where time <= 31 and time > 20"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletionIT.java index 5bd02dbacacc8..1b8cba96daa79 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBRawQueryWithoutValueFilterWithDeletionIT.java @@ -58,10 +58,10 @@ public static void setUp() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("delete timeseries root.sg1.d1.s2"); - statement.execute("delete from root.sg1.d1.s2 where time <= 40"); - statement.execute("delete from root.sg1.d1.s1 where time <= 21"); - statement.execute("delete from root.sg1.d1.s5 where time <= 31 and time > 20"); + statement.execute("delete timeseries root.db1.d1.s2"); + statement.execute("delete from root.db1.d1.s2 where time <= 40"); + statement.execute("delete from root.db1.d1.s1 where time <= 21"); + statement.execute("delete from root.db1.d1.s5 where time <= 31 and time > 20"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -119,11 +119,11 @@ public void selectAllAlignedWithoutValueFilterTest() { "40,null,null,null,aligned_test40", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.d1")) { + ResultSet resultSet = statement.executeQuery("select * from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -198,20 +198,20 @@ public void selectAllAlignedAndNonAlignedTest() { }; String[] columnNames = { - "root.sg1.d1.s1", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5", - "root.sg1.d2.s1", - "root.sg1.d2.s2", - "root.sg1.d2.s3", - "root.sg1.d2.s4", - "root.sg1.d2.s5" + "root.db1.d1.s1", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5", + "root.db1.d2.s1", + "root.db1.d2.s2", + "root.db1.d2.s3", + "root.db1.d2.s4", + "root.db1.d2.s5" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select * from root.sg1.*")) { + ResultSet resultSet = statement.executeQuery("select * from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -269,12 +269,12 @@ public void selectAllAlignedWithTimeFilterTest() { "33,null,null,null,aligned_test33", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s3", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s3", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = - statement.executeQuery("select * from root.sg1.d1 where time >= 9 and time <= 33")) { + statement.executeQuery("select * from root.db1.d1 where time >= 9 and time <= 33")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -338,11 +338,11 @@ public void selectSomeAlignedWithoutValueFilterTest1() { "40,null,null,aligned_test40", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select s1,s4,s5 from root.sg1.d1")) { + ResultSet resultSet = statement.executeQuery("select s1,s4,s5 from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -395,11 +395,11 @@ public void selectSomeAlignedWithoutValueFilterTest2() { "30,null,false", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select s1,s4 from root.sg1.d1")) { + ResultSet resultSet = statement.executeQuery("select s1,s4 from root.db1.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -446,13 +446,13 @@ public void selectSomeAlignedWithTimeFilterTest() { "34,null,null,aligned_test34", }; - String[] columnNames = {"root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"}; + String[] columnNames = {"root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select s1,s4,s5 from root.sg1.d1 where time >= 16 and time <= 34")) { + "select s1,s4,s5 from root.db1.d1 where time >= 16 and time <= 34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); @@ -506,19 +506,19 @@ public void selectSomeAlignedAndNonAlignedWithTimeFilterTest() { }; String[] columnNames = { - "root.sg1.d2.s5", - "root.sg1.d1.s4", - "root.sg1.d2.s1", - "root.sg1.d1.s5", - "root.sg1.d2.s4", - "root.sg1.d1.s1" + "root.db1.d2.s5", + "root.db1.d1.s4", + "root.db1.d2.s1", + "root.db1.d1.s5", + "root.db1.d2.s4", + "root.db1.d1.s1" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.sg1 where time >= 16 and time <= 34")) { + "select d2.s5, d1.s4, d2.s1, d1.s5, d2.s4, d1.s1 from root.db1 where time >= 16 and time <= 34")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java index bc77f5d3947dc..2a6928dc96da4 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java @@ -199,13 +199,13 @@ public void testSetDeleteSG() throws SQLException { Statement userStmt = userCon.createStatement()) { Assert.assertThrows( - SQLException.class, () -> userStmt.execute("CREATE DATABASE root.sgtest")); + SQLException.class, () -> userStmt.execute("CREATE DATABASE root.dbtest")); adminStmt.execute("GRANT SYSTEM ON root.** TO USER sgtest"); try { - userStmt.execute("CREATE DATABASE root.sgtest"); - userStmt.execute("DELETE DATABASE root.sgtest"); + userStmt.execute("CREATE DATABASE root.dbtest"); + userStmt.execute("DELETE DATABASE root.dbtest"); } catch (SQLException e) { fail(e.getMessage()); } @@ -355,23 +355,23 @@ public void templateQueryTest() throws SQLException { try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser", "temppw123456"); Statement userStmt = userCon.createStatement()) { adminStmt.execute( - "GRANT READ_DATA ON root.sg.aligned_template.temperature TO USER tempuser"); - adminStmt.execute("CREATE DATABASE root.sg"); + "GRANT READ_DATA ON root.db.aligned_template.temperature TO USER tempuser"); + adminStmt.execute("CREATE DATABASE root.db"); adminStmt.execute( "create device template t1 aligned (temperature FLOAT encoding=Gorilla, status BOOLEAN encoding=PLAIN);"); - adminStmt.execute("set device template t1 to root.sg.aligned_template;"); - adminStmt.execute("create timeseries using device template on root.sg.aligned_template;"); + adminStmt.execute("set device template t1 to root.db.aligned_template;"); + adminStmt.execute("create timeseries using device template on root.db.aligned_template;"); adminStmt.execute( - "insert into root.sg.aligned_template(time,temperature,status) values(1,20,false),(2,22.1,true),(3,18,false);"); + "insert into root.db.aligned_template(time,temperature,status) values(1,20,false),(2,22.1,true),(3,18,false);"); - ResultSet set1 = adminStmt.executeQuery("SELECT * from root.sg.aligned_template"); + ResultSet set1 = adminStmt.executeQuery("SELECT * from root.db.aligned_template"); assertEquals(3, set1.getMetaData().getColumnCount()); - assertEquals("root.sg.aligned_template.temperature", set1.getMetaData().getColumnName(2)); - assertEquals("root.sg.aligned_template.status", set1.getMetaData().getColumnName(3)); + assertEquals("root.db.aligned_template.temperature", set1.getMetaData().getColumnName(2)); + assertEquals("root.db.aligned_template.status", set1.getMetaData().getColumnName(3)); - ResultSet set2 = userStmt.executeQuery("SELECT * from root.sg.aligned_template"); + ResultSet set2 = userStmt.executeQuery("SELECT * from root.db.aligned_template"); assertEquals(2, set2.getMetaData().getColumnCount()); - assertEquals("root.sg.aligned_template.temperature", set2.getMetaData().getColumnName(2)); + assertEquals("root.db.aligned_template.temperature", set2.getMetaData().getColumnName(2)); } } } @@ -882,8 +882,8 @@ public void testExecuteBatchWithPrivilege() throws SQLException { adminStmt.execute("CREATE USER tempuser 'temppw123456'"); try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser", "temppw123456"); Statement userStatement = userCon.createStatement()) { - userStatement.addBatch("CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64"); - userStatement.addBatch("CREATE TIMESERIES root.sg2.d1.s1 WITH DATATYPE=INT64"); + userStatement.addBatch("CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT64"); + userStatement.addBatch("CREATE TIMESERIES root.db2.d1.s1 WITH DATATYPE=INT64"); Assert.assertThrows(BatchUpdateException.class, () -> userStatement.executeBatch()); } } @@ -894,19 +894,19 @@ public void testExecuteBatchWithPrivilege1() throws SQLException { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { adminStmt.execute("CREATE USER tempuser 'temppw123456'"); - adminStmt.execute("GRANT WRITE_DATA on root.sg1.** TO USER tempuser"); - adminStmt.execute("GRANT WRITE_SCHEMA on root.sg1.** TO USER tempuser"); + adminStmt.execute("GRANT WRITE_DATA on root.db1.** TO USER tempuser"); + adminStmt.execute("GRANT WRITE_SCHEMA on root.db1.** TO USER tempuser"); adminStmt.execute("GRANT SYSTEM on root.** TO USER tempuser"); try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser", "temppw123456"); Statement userStatement = userCon.createStatement()) { - userStatement.addBatch("insert into root.sg1.d1(timestamp,s1) values (1,1)"); - userStatement.addBatch("insert into root.sg1.d1(timestamp,s2) values (3,1)"); - userStatement.addBatch("insert into root.sg2.d1(timestamp,s1) values (2,1)"); - userStatement.addBatch("insert into root.sg2.d1(timestamp,s1) values (4,1)"); + userStatement.addBatch("insert into root.db1.d1(timestamp,s1) values (1,1)"); + userStatement.addBatch("insert into root.db1.d1(timestamp,s2) values (3,1)"); + userStatement.addBatch("insert into root.db2.d1(timestamp,s1) values (2,1)"); + userStatement.addBatch("insert into root.db2.d1(timestamp,s1) values (4,1)"); Assert.assertThrows(BatchUpdateException.class, userStatement::executeBatch); } - ResultSet resultSet = adminStmt.executeQuery("select * from root.sg1.**"); + ResultSet resultSet = adminStmt.executeQuery("select * from root.db1.**"); String[] expected = new String[] {"1, 1.0", "1, null", "3, null", "3, 1.0"}; List expectedList = new ArrayList<>(); Collections.addAll(expectedList, expected); @@ -915,11 +915,11 @@ public void testExecuteBatchWithPrivilege1() throws SQLException { result.add( resultSet.getString(ColumnHeaderConstant.TIME) + ", " - + resultSet.getString("root.sg1.d1.s1")); + + resultSet.getString("root.db1.d1.s1")); result.add( resultSet.getString(ColumnHeaderConstant.TIME) + ", " - + resultSet.getString("root.sg1.d1.s2")); + + resultSet.getString("root.db1.d1.s2")); } assertEquals(expected.length, result.size()); assertTrue(expectedList.containsAll(result)); @@ -1155,27 +1155,27 @@ public void testQueryTemplate() throws SQLException { Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement(); adminStmt.execute("CREATE USER user1 'password123456'"); - adminStmt.execute("GRANT READ_DATA ON root.sg.d1.** TO USER user1 with grant option;"); - adminStmt.execute("GRANT READ_DATA ON root.sg.aligned_template.temperature TO USER user1;"); - adminStmt.execute("CREATE DATABASE root.sg;"); + adminStmt.execute("GRANT READ_DATA ON root.db.d1.** TO USER user1 with grant option;"); + adminStmt.execute("GRANT READ_DATA ON root.db.aligned_template.temperature TO USER user1;"); + adminStmt.execute("CREATE DATABASE root.db;"); adminStmt.execute( "create device template t1 aligned (temperature FLOAT encoding=Gorilla, status BOOLEAN encoding=PLAIN);"); - adminStmt.execute("set device template t1 to root.sg.aligned_template;"); - adminStmt.execute("insert into root.sg.d1(time,s1,s2) values(1,1,1)"); - adminStmt.execute("insert into root.sg.d2(time,s1,s2) values(1,1,1)"); + adminStmt.execute("set device template t1 to root.db.aligned_template;"); + adminStmt.execute("insert into root.db.d1(time,s1,s2) values(1,1,1)"); + adminStmt.execute("insert into root.db.d2(time,s1,s2) values(1,1,1)"); adminStmt.execute( - "insert into root.sg.aligned_template(time,temperature,status) values(1,20,true)"); - try (ResultSet resultSet = adminStmt.executeQuery("select * from root.sg.**;")) { + "insert into root.db.aligned_template(time,temperature,status) values(1,20,true)"); + try (ResultSet resultSet = adminStmt.executeQuery("select * from root.db.**;")) { Set standards = new HashSet<>( Arrays.asList( "Time", - "root.sg.aligned_template.temperature", - "root.sg.aligned_template.status", - "root.sg.d2.s1", - "root.sg.d2.s2", - "root.sg.d1.s1", - "root.sg.d1.s2")); + "root.db.aligned_template.temperature", + "root.db.aligned_template.status", + "root.db.d2.s1", + "root.db.d2.s2", + "root.db.d1.s1", + "root.db.d1.s2")); ResultSetMetaData metaData = resultSet.getMetaData(); for (int i = 1; i < metaData.getColumnCount() + 1; i++) { Assert.assertTrue(standards.remove(metaData.getColumnName(i))); @@ -1189,9 +1189,9 @@ public void testQueryTemplate() throws SQLException { new HashSet<>( Arrays.asList( "Time", - "root.sg.aligned_template.temperature", - "root.sg.d1.s1", - "root.sg.d1.s2")); + "root.db.aligned_template.temperature", + "root.db.d1.s1", + "root.db.d1.s2")); ResultSetMetaData metaData = resultSet.getMetaData(); for (int i = 1; i < metaData.getColumnCount() + 1; i++) { Assert.assertTrue(standards.remove(metaData.getColumnName(i))); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSeriesPermissionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSeriesPermissionIT.java index ad34c1cc0b9d4..ee548c6ef0640 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSeriesPermissionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSeriesPermissionIT.java @@ -260,32 +260,32 @@ public void testData() { } private void testWriteData() { - grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_DATA, "root.sg.d1.s1"); + grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_DATA, "root.db.d1.s1"); assertNonQueryTestFail( - "insert into root.sg.d1(time,s1,s2) values(1,1,1)", - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg.d1.s2]", + "insert into root.db.d1(time,s1,s2) values(1,1,1)", + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db.d1.s2]", "test1", "test123123456"); assertNonQueryTestFail( - "delete from root.sg.d1.s1, root.sg.d1.s2", - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg.d1.s2]", + "delete from root.db.d1.s1, root.db.d1.s2", + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db.d1.s2]", "test1", "test123123456"); - grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_DATA, "root.sg.d1.s2"); + grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_DATA, "root.db.d1.s2"); assertNonQueryTestFail( - "insert into root.sg.d1(time,s1,s2) values(1,1,1)", - "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg.d1.s1, root.sg.d1.s2]", + "insert into root.db.d1(time,s1,s2) values(1,1,1)", + "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db.d1.s1, root.db.d1.s2]", "test1", "test123123456"); - executeNonQuery("delete from root.sg.d1.s1, root.sg.d1.s2", "test1", "test123123456"); - grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_SCHEMA, "root.sg.d1.**"); + executeNonQuery("delete from root.db.d1.s1, root.db.d1.s2", "test1", "test123123456"); + grantUserSeriesPrivilege("test1", PrivilegeType.WRITE_SCHEMA, "root.db.d1.**"); assertNonQueryTestFail( - "insert into root.sg.d1(time,s1,s2) values(1,1,1)", + "insert into root.db.d1(time,s1,s2) values(1,1,1)", "803: No permissions for this operation, please add privilege SYSTEM", "test1", "test123123456"); grantUserSystemPrivileges("test1", PrivilegeType.SYSTEM); - executeNonQuery("insert into root.sg.d1(time,s1,s2) values(1,1,1)", "test1", "test123123456"); + executeNonQuery("insert into root.db.d1(time,s1,s2) values(1,1,1)", "test1", "test123123456"); } private void testReadData() { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java index 2ebdd37758fe4..52825f562b362 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java @@ -151,8 +151,8 @@ public void manageCQTest() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END", "803: No permissions for this operation, please add privilege SYSTEM", @@ -177,8 +177,8 @@ public void manageCQTest() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END", "test5", diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplateAuthIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplateAuthIT.java index 4f17b9b3de2aa..bfd3d82b35307 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplateAuthIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplateAuthIT.java @@ -110,22 +110,22 @@ public void manageDataBaseTest() { } } - adminStmt.execute("create database root.sg1"); - adminStmt.execute("create database root.sg2"); - adminStmt.execute("create database root.sg3"); - adminStmt.execute("set device template t1 to root.sg1.d1"); + adminStmt.execute("create database root.db1"); + adminStmt.execute("create database root.db2"); + adminStmt.execute("create database root.db3"); + adminStmt.execute("set device template t1 to root.db1.d1"); - adminStmt.execute("set device template t2 to root.sg2"); + adminStmt.execute("set device template t2 to root.db2"); assertNonQueryTestFail( - "set device template t1 to root.sg3", + "set device template t1 to root.db3", "803: No permissions for this operation, please add privilege SYSTEM", "tytyty1", "tytytytytytytyty"); - adminStmt.execute("set device template t1 to root.sg3"); - adminStmt.execute("create timeseries using device template on root.sg1.d1"); - adminStmt.execute("create timeseries using device template on root.sg3"); + adminStmt.execute("set device template t1 to root.db3"); + adminStmt.execute("create timeseries using device template on root.db1.d1"); + adminStmt.execute("create timeseries using device template on root.db3"); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); @@ -135,7 +135,7 @@ public void manageDataBaseTest() { } } - adminStmt.execute("grant read_schema on root.sg1.d2.** to user tytyty1"); + adminStmt.execute("grant read_schema on root.db1.d2.** to user tytyty1"); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); @@ -145,7 +145,7 @@ public void manageDataBaseTest() { } } - adminStmt.execute("grant read_schema on root.sg1.d1.** to user tytyty1"); + adminStmt.execute("grant read_schema on root.db1.d1.** to user tytyty1"); retSet = Collections.singleton("t1"); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); @@ -159,7 +159,7 @@ public void manageDataBaseTest() { assertEquals(retSet.size(), cnt); } - adminStmt.execute("grant read_schema on root.sg1.** to user tytyty2"); + adminStmt.execute("grant read_schema on root.db1.** to user tytyty2"); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty2", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show device templates")) { @@ -300,7 +300,7 @@ public void manageDataBaseTest() { } // show paths set device template - retSet = new HashSet<>(Arrays.asList("root.sg1.d1", "root.sg3")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1", "root.db3")); try (ResultSet resultSet = adminStmt.executeQuery("show paths set device template t1")) { int cnt = 0; while (resultSet.next()) { @@ -321,7 +321,7 @@ public void manageDataBaseTest() { } assertEquals(retSet.size(), cnt); } - retSet = new HashSet<>(Arrays.asList("root.sg1.d1")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1")); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show paths set device template t1")) { @@ -345,7 +345,7 @@ public void manageDataBaseTest() { assertEquals(retSet.size(), cnt); } - retSet = new HashSet<>(Arrays.asList("root.sg2")); + retSet = new HashSet<>(Arrays.asList("root.db2")); try (ResultSet resultSet = adminStmt.executeQuery("show paths set device template t2")) { int cnt = 0; while (resultSet.next()) { @@ -409,7 +409,7 @@ public void manageDataBaseTest() { } // show paths using device template - retSet = new HashSet<>(Arrays.asList("root.sg1.d1", "root.sg3")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1", "root.db3")); try (ResultSet resultSet = adminStmt.executeQuery("show paths using device template t1")) { int cnt = 0; while (resultSet.next()) { @@ -430,7 +430,7 @@ public void manageDataBaseTest() { } assertEquals(retSet.size(), cnt); } - retSet = new HashSet<>(Arrays.asList("root.sg1.d1")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1")); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show paths using device template t1")) { @@ -515,7 +515,7 @@ public void manageDataBaseTest() { assertEquals(retSet.size(), cnt); } - retSet = new HashSet<>(Arrays.asList("root.sg1.d1", "root.sg3")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1", "root.db3")); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show paths set device template t1")) { @@ -527,7 +527,7 @@ public void manageDataBaseTest() { } assertEquals(retSet.size(), cnt); } - retSet = new HashSet<>(Arrays.asList("root.sg2")); + retSet = new HashSet<>(Arrays.asList("root.db2")); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show paths set device template t2")) { @@ -548,7 +548,7 @@ public void manageDataBaseTest() { } } - retSet = new HashSet<>(Arrays.asList("root.sg1.d1")); + retSet = new HashSet<>(Arrays.asList("root.db1.d1")); try (Connection userCon = EnvFactory.getEnv().getConnection("tytyty1", "tytytytytytytyty"); Statement userStmt = userCon.createStatement(); ResultSet resultSet = userStmt.executeQuery("show paths using device template t1")) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplatePermissionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplatePermissionIT.java index b2c02164c31ae..e10f3d9be4067 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplatePermissionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBTemplatePermissionIT.java @@ -85,12 +85,12 @@ public void adminOperationsTest() { "test", "test123123456"); assertNonQueryTestFail( - "set device template t1 to root.sg1", + "set device template t1 to root.db1", "803: No permissions for this operation, please add privilege SYSTEM", "test", "test123123456"); assertNonQueryTestFail( - "unset device template t1 from root.sg1", + "unset device template t1 from root.db1", "803: No permissions for this operation, please add privilege SYSTEM", "test", "test123123456"); @@ -105,56 +105,56 @@ public void adminOperationsTest() { public void otherTest() { executeNonQuery( "create device template t1 (temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)"); - executeNonQuery("create database root.sg1"); - executeNonQuery("set device template t1 to root.sg1.d1"); + executeNonQuery("create database root.db1"); + executeNonQuery("set device template t1 to root.db1.d1"); // active assertNonQueryTestFail( - "create timeseries using device template on root.sg1.d1", - "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg1.d1.temperature, root.sg1.d1.status]", + "create timeseries using device template on root.db1.d1", + "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db1.d1.temperature, root.db1.d1.status]", "test", "test123123456"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); executeNonQuery( - "create timeseries using device template on root.sg1.d1", "test", "test123123456"); + "create timeseries using device template on root.db1.d1", "test", "test123123456"); // insert assertNonQueryTestFail( - "insert into root.sg1.d1(time, s1) values(1,1)", - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg1.d1.s1]", + "insert into root.db1.d1(time, s1) values(1,1)", + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db1.d1.s1]", "test", "test123123456"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.**"); executeNonQuery( - "insert into root.sg1.d1(time, temperature) values(1,1)", "test", "test123123456"); + "insert into root.db1.d1(time, temperature) values(1,1)", "test", "test123123456"); assertNonQueryTestFail( - "insert into root.sg1.d1(time, s1) values(1,1)", + "insert into root.db1.d1(time, s1) values(1,1)", "803: No permissions for this operation, please add privilege SYSTEM", "test", "test123123456"); grantUserSeriesPrivilege("test", PrivilegeType.SYSTEM, "root.**"); - executeNonQuery("insert into root.sg1.d1(time, s1) values(1,1)", "test", "test123123456"); + executeNonQuery("insert into root.db1.d1(time, s1) values(1,1)", "test", "test123123456"); // show - executeNonQuery("create database root.sg2"); - executeNonQuery("set device template t1 to root.sg2.d1"); + executeNonQuery("create database root.db2"); + executeNonQuery("set device template t1 to root.db2.d1"); resultSetEqualTest( "show paths using device template t1", showPathsUsingTemplateHeaders.stream() .map(ColumnHeader::getColumnName) .toArray(String[]::new), - new String[] {"root.sg1.d1,"}, + new String[] {"root.db1.d1,"}, "test", "test123123456"); // deActive - revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); + revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); assertNonQueryTestFail( - "deactivate device template t1 from root.sg1.d1", - "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg1.d1.temperature, root.sg1.d1.s1, root.sg1.d1.status]", + "deactivate device template t1 from root.db1.d1", + "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db1.d1.temperature, root.db1.d1.s1, root.db1.d1.status]", "test", "test123123456"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); - executeNonQuery("deactivate device template t1 from root.sg1.d1", "test", "test123123456"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); + executeNonQuery("deactivate device template t1 from root.db1.d1", "test", "test123123456"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBCastFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBCastFunctionIT.java index fb14be551e096..9cd899b4559f2 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBCastFunctionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBCastFunctionIT.java @@ -45,61 +45,61 @@ public class IoTDBCastFunctionIT { private static final String[] SQLs = new String[] { // normal cases - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", // data for int series - "INSERT INTO root.sg.d1(timestamp,s1) values(0, 0)", - "INSERT INTO root.sg.d1(timestamp,s1) values(1, 1)", - "INSERT INTO root.sg.d1(timestamp,s1) values(2, 2)", - "INSERT INTO root.sg.d1(timestamp,s1) values(3, 3)", + "INSERT INTO root.db.d1(timestamp,s1) values(0, 0)", + "INSERT INTO root.db.d1(timestamp,s1) values(1, 1)", + "INSERT INTO root.db.d1(timestamp,s1) values(2, 2)", + "INSERT INTO root.db.d1(timestamp,s1) values(3, 3)", // data for long series - "INSERT INTO root.sg.d1(timestamp,s2) values(0, 0)", - "INSERT INTO root.sg.d1(timestamp,s2) values(1, 1)", - "INSERT INTO root.sg.d1(timestamp,s2) values(2, 2)", - "INSERT INTO root.sg.d1(timestamp,s2) values(3, 3)", + "INSERT INTO root.db.d1(timestamp,s2) values(0, 0)", + "INSERT INTO root.db.d1(timestamp,s2) values(1, 1)", + "INSERT INTO root.db.d1(timestamp,s2) values(2, 2)", + "INSERT INTO root.db.d1(timestamp,s2) values(3, 3)", // data for float series - "INSERT INTO root.sg.d1(timestamp,s3) values(0, 0)", - "INSERT INTO root.sg.d1(timestamp,s3) values(1, 1)", - "INSERT INTO root.sg.d1(timestamp,s3) values(2, 2.7)", - "INSERT INTO root.sg.d1(timestamp,s3) values(3, 3.33)", + "INSERT INTO root.db.d1(timestamp,s3) values(0, 0)", + "INSERT INTO root.db.d1(timestamp,s3) values(1, 1)", + "INSERT INTO root.db.d1(timestamp,s3) values(2, 2.7)", + "INSERT INTO root.db.d1(timestamp,s3) values(3, 3.33)", // data for double series - "INSERT INTO root.sg.d1(timestamp,s4) values(0, 0)", - "INSERT INTO root.sg.d1(timestamp,s4) values(1, 1.0)", - "INSERT INTO root.sg.d1(timestamp,s4) values(2, 2.7)", - "INSERT INTO root.sg.d1(timestamp,s4) values(3, 3.33)", + "INSERT INTO root.db.d1(timestamp,s4) values(0, 0)", + "INSERT INTO root.db.d1(timestamp,s4) values(1, 1.0)", + "INSERT INTO root.db.d1(timestamp,s4) values(2, 2.7)", + "INSERT INTO root.db.d1(timestamp,s4) values(3, 3.33)", // data for boolean series - "INSERT INTO root.sg.d1(timestamp,s5) values(0, false)", - "INSERT INTO root.sg.d1(timestamp,s5) values(1, false)", - "INSERT INTO root.sg.d1(timestamp,s5) values(2, true)", - "INSERT INTO root.sg.d1(timestamp,s5) values(3, true)", + "INSERT INTO root.db.d1(timestamp,s5) values(0, false)", + "INSERT INTO root.db.d1(timestamp,s5) values(1, false)", + "INSERT INTO root.db.d1(timestamp,s5) values(2, true)", + "INSERT INTO root.db.d1(timestamp,s5) values(3, true)", // data for text series - "INSERT INTO root.sg.d1(timestamp,s6) values(0, \"10000\")", - "INSERT INTO root.sg.d1(timestamp,s6) values(1, \"3\")", - "INSERT INTO root.sg.d1(timestamp,s6) values(2, \"TRue\")", - "INSERT INTO root.sg.d1(timestamp,s6) values(3, \"faLse\")", + "INSERT INTO root.db.d1(timestamp,s6) values(0, \"10000\")", + "INSERT INTO root.db.d1(timestamp,s6) values(1, \"3\")", + "INSERT INTO root.db.d1(timestamp,s6) values(2, \"TRue\")", + "INSERT INTO root.db.d1(timestamp,s6) values(3, \"faLse\")", "flush", // special cases - "create DATABASE root.sg1", - "create timeseries root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "create timeseries root.sg1.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", - "create timeseries root.sg1.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "create timeseries root.sg1.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "create timeseries root.sg1.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "create timeseries root.sg1.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "INSERT INTO root.sg1.d1(timestamp,s2) values(1, 2147483648)", - "INSERT INTO root.sg1.d1(timestamp,s3) values(1, 2147483648.0)", - "INSERT INTO root.sg1.d1(timestamp,s3) values(2, 2e38)", - "INSERT INTO root.sg1.d1(timestamp,s4) values(1, 4e50)", - "INSERT INTO root.sg1.d1(timestamp,s6) values(1, \"test\")", - "INSERT INTO root.sg1.d1(timestamp,s6) values(2, \"1.1\")", - "INSERT INTO root.sg1.d1(timestamp,s6) values(3, \"4e60\")", - "INSERT INTO root.sg1.d1(timestamp,s6) values(4, \"4e60000\")", + "create DATABASE root.db1", + "create timeseries root.db1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "create timeseries root.db1.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", + "create timeseries root.db1.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "create timeseries root.db1.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "create timeseries root.db1.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "create timeseries root.db1.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "INSERT INTO root.db1.d1(timestamp,s2) values(1, 2147483648)", + "INSERT INTO root.db1.d1(timestamp,s3) values(1, 2147483648.0)", + "INSERT INTO root.db1.d1(timestamp,s3) values(2, 2e38)", + "INSERT INTO root.db1.d1(timestamp,s4) values(1, 4e50)", + "INSERT INTO root.db1.d1(timestamp,s6) values(1, \"test\")", + "INSERT INTO root.db1.d1(timestamp,s6) values(2, \"1.1\")", + "INSERT INTO root.db1.d1(timestamp,s6) values(3, \"4e60\")", + "INSERT INTO root.db1.d1(timestamp,s6) values(4, \"4e60000\")", }; @BeforeClass @@ -128,340 +128,340 @@ private static void registerUDF() { @Test public void testNewTransformerWithIntSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS INT32)"}; String[] intRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; - resultSetEqualTest("select CAST(s1 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + resultSetEqualTest("select CAST(s1 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS INT64)"}; String[] longRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; resultSetEqualTest( - "select CAST(s1 AS INT64) from root.sg.d1", longExpectedHeader, longRetArray); + "select CAST(s1 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.0,", "3,3.0,", }; resultSetEqualTest( - "select CAST(s1 AS FLOAT) from root.sg.d1", floatExpectedHeader, floatRetArray); + "select CAST(s1 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.0,", "3,3.0,", }; resultSetEqualTest( - "select CAST(s1 AS DOUBLE) from root.sg.d1", doubleExpectedHeader, doubleRetArray); + "select CAST(s1 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,false,", "1,true,", "2,true,", "3,true,", }; resultSetEqualTest( - "select CAST(s1 AS BOOLEAN) from root.sg.d1", booleanExpectedHeader, booleanRetArray); + "select CAST(s1 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s1 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s1 AS TEXT)"}; String[] textRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; - resultSetEqualTest("select CAST(s1 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s1 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testNewTransformerWithLongSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS INT32)"}; String[] intRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; - resultSetEqualTest("select CAST(s2 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + resultSetEqualTest("select CAST(s2 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS INT64)"}; String[] longRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; resultSetEqualTest( - "select CAST(s2 AS INT64) from root.sg.d1", longExpectedHeader, longRetArray); + "select CAST(s2 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.0,", "3,3.0,", }; resultSetEqualTest( - "select CAST(s2 AS FLOAT) from root.sg.d1", floatExpectedHeader, floatRetArray); + "select CAST(s2 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.0,", "3,3.0,", }; resultSetEqualTest( - "select CAST(s2 AS DOUBLE) from root.sg.d1", doubleExpectedHeader, doubleRetArray); + "select CAST(s2 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,false,", "1,true,", "2,true,", "3,true,", }; resultSetEqualTest( - "select CAST(s2 AS BOOLEAN) from root.sg.d1", booleanExpectedHeader, booleanRetArray); + "select CAST(s2 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s2 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s2 AS TEXT)"}; String[] textRetArray = new String[] { "0,0,", "1,1,", "2,2,", "3,3,", }; - resultSetEqualTest("select CAST(s2 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s2 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testNewTransformerWithFloatSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS INT32)"}; String[] intRetArray = new String[] { "0,0,", "1,1,", "2,3,", "3,3,", }; - resultSetEqualTest("select CAST(s3 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + resultSetEqualTest("select CAST(s3 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS INT64)"}; String[] longRetArray = new String[] { "0,0,", "1,1,", "2,3,", "3,3,", }; resultSetEqualTest( - "select CAST(s3 AS INT64) from root.sg.d1", longExpectedHeader, longRetArray); + "select CAST(s3 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.7,", "3,3.33,", }; resultSetEqualTest( - "select CAST(s3 AS FLOAT) from root.sg.d1", floatExpectedHeader, floatRetArray); + "select CAST(s3 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.700000047683716,", "3,3.3299999237060547,", }; resultSetEqualTest( - "select CAST(s3 AS DOUBLE) from root.sg.d1", doubleExpectedHeader, doubleRetArray); + "select CAST(s3 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,false,", "1,true,", "2,true,", "3,true,", }; resultSetEqualTest( - "select CAST(s3 AS BOOLEAN) from root.sg.d1", booleanExpectedHeader, booleanRetArray); + "select CAST(s3 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s3 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s3 AS TEXT)"}; String[] textRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.7,", "3,3.33,", }; - resultSetEqualTest("select CAST(s3 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s3 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testNewTransformerWithDoubleSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS INT32)"}; String[] intRetArray = new String[] { "0,0,", "1,1,", "2,3,", "3,3,", }; - resultSetEqualTest("select CAST(s4 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + resultSetEqualTest("select CAST(s4 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS INT64)"}; String[] longRetArray = new String[] { "0,0,", "1,1,", "2,3,", "3,3,", }; resultSetEqualTest( - "select CAST(s4 AS INT64) from root.sg.d1", longExpectedHeader, longRetArray); + "select CAST(s4 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.7,", "3,3.33,", }; resultSetEqualTest( - "select CAST(s4 AS FLOAT) from root.sg.d1", floatExpectedHeader, floatRetArray); + "select CAST(s4 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.7,", "3,3.33,", }; resultSetEqualTest( - "select CAST(s4 AS DOUBLE) from root.sg.d1", doubleExpectedHeader, doubleRetArray); + "select CAST(s4 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,false,", "1,true,", "2,true,", "3,true,", }; resultSetEqualTest( - "select CAST(s4 AS BOOLEAN) from root.sg.d1", booleanExpectedHeader, booleanRetArray); + "select CAST(s4 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s4 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s4 AS TEXT)"}; String[] textRetArray = new String[] { "0,0.0,", "1,1.0,", "2,2.7,", "3,3.33,", }; - resultSetEqualTest("select CAST(s4 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s4 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testNewTransformerWithBooleanSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS INT32)"}; String[] intRetArray = new String[] { "0,0,", "1,0,", "2,1,", "3,1,", }; - resultSetEqualTest("select CAST(s5 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + resultSetEqualTest("select CAST(s5 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS INT64)"}; String[] longRetArray = new String[] { "0,0,", "1,0,", "2,1,", "3,1,", }; resultSetEqualTest( - "select CAST(s5 AS INT64) from root.sg.d1", longExpectedHeader, longRetArray); + "select CAST(s5 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,0.0,", "1,0.0,", "2,1.0,", "3,1.0,", }; resultSetEqualTest( - "select CAST(s5 AS FLOAT) from root.sg.d1", floatExpectedHeader, floatRetArray); + "select CAST(s5 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,0.0,", "1,0.0,", "2,1.0,", "3,1.0,", }; resultSetEqualTest( - "select CAST(s5 AS DOUBLE) from root.sg.d1", doubleExpectedHeader, doubleRetArray); + "select CAST(s5 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,false,", "1,false,", "2,true,", "3,true,", }; resultSetEqualTest( - "select CAST(s5 AS BOOLEAN) from root.sg.d1", booleanExpectedHeader, booleanRetArray); + "select CAST(s5 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s5 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s5 AS TEXT)"}; String[] textRetArray = new String[] { "0,false,", "1,false,", "2,true,", "3,true,", }; - resultSetEqualTest("select CAST(s5 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s5 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testNewTransformerWithTextSource() { // cast to int - String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS INT32)"}; + String[] intExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS INT32)"}; String[] intRetArray = new String[] { "0,10000,", "1,3,", }; resultSetEqualTest( - "select CAST(s6 AS INT32) from root.sg.d1 where time < 2", intExpectedHeader, intRetArray); + "select CAST(s6 AS INT32) from root.db.d1 where time < 2", intExpectedHeader, intRetArray); // cast to long - String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS INT64)"}; + String[] longExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS INT64)"}; String[] longRetArray = new String[] { "0,10000,", "1,3,", }; resultSetEqualTest( - "select CAST(s6 AS INT64) from root.sg.d1 where time < 2", + "select CAST(s6 AS INT64) from root.db.d1 where time < 2", longExpectedHeader, longRetArray); // cast to float - String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS FLOAT)"}; + String[] floatExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,10000.0,", "1,3.0,", }; resultSetEqualTest( - "select CAST(s6 AS FLOAT) from root.sg.d1 where time < 2", + "select CAST(s6 AS FLOAT) from root.db.d1 where time < 2", floatExpectedHeader, floatRetArray); // cast to double - String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS DOUBLE)"}; + String[] doubleExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,10000.0,", "1,3.0,", }; resultSetEqualTest( - "select CAST(s6 AS DOUBLE) from root.sg.d1 where time < 2", + "select CAST(s6 AS DOUBLE) from root.db.d1 where time < 2", doubleExpectedHeader, doubleRetArray); // cast to boolean - String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS BOOLEAN)"}; + String[] booleanExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "2,true,", "3,false,", }; resultSetEqualTest( - "select CAST(s6 AS BOOLEAN) from root.sg.d1 where time >= 2", + "select CAST(s6 AS BOOLEAN) from root.db.d1 where time >= 2", booleanExpectedHeader, booleanRetArray); // cast to text - String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.sg.d1.s6 AS TEXT)"}; + String[] textExpectedHeader = new String[] {TIMESTAMP_STR, "CAST(root.db.d1.s6 AS TEXT)"}; String[] textRetArray = new String[] { "0,10000,", "1,3,", "2,TRue,", "3,faLse,", }; - resultSetEqualTest("select CAST(s6 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + resultSetEqualTest("select CAST(s6 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } // endregion @@ -472,428 +472,428 @@ public void testNewTransformerWithTextSource() { public void testOldTransformerWithIntSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS INT32)"}; String[] intRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + "select constvalue(s1),CAST(s1 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS INT64)"}; String[] longRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS INT64) from root.sg.d1", + "select constvalue(s1),CAST(s1 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.0,", "3,1,3.0,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS FLOAT) from root.sg.d1", + "select constvalue(s1),CAST(s1 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.0,", "3,1,3.0,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS DOUBLE) from root.sg.d1", + "select constvalue(s1),CAST(s1 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,1,false,", "1,1,true,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS BOOLEAN) from root.sg.d1", + "select constvalue(s1),CAST(s1 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s1),CAST(root.sg.d1.s1 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s1),CAST(root.db.d1.s1 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s1),CAST(s1 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s1),CAST(s1 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testOldTransformerWithLongSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS INT32)"}; String[] intRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + "select constvalue(s2),CAST(s2 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS INT64)"}; String[] longRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS INT64) from root.sg.d1", + "select constvalue(s2),CAST(s2 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.0,", "3,1,3.0,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS FLOAT) from root.sg.d1", + "select constvalue(s2),CAST(s2 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.0,", "3,1,3.0,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS DOUBLE) from root.sg.d1", + "select constvalue(s2),CAST(s2 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,1,false,", "1,1,true,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS BOOLEAN) from root.sg.d1", + "select constvalue(s2),CAST(s2 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s2),CAST(root.sg.d1.s2 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s2),CAST(root.db.d1.s2 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,2,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s2),CAST(s2 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s2),CAST(s2 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testOldTransformerWithFloatSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS INT32)"}; String[] intRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,3,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + "select constvalue(s3),CAST(s3 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS INT64)"}; String[] longRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,3,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS INT64) from root.sg.d1", + "select constvalue(s3),CAST(s3 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.7,", "3,1,3.33,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS FLOAT) from root.sg.d1", + "select constvalue(s3),CAST(s3 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.700000047683716,", "3,1,3.3299999237060547,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS DOUBLE) from root.sg.d1", + "select constvalue(s3),CAST(s3 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,1,false,", "1,1,true,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS BOOLEAN) from root.sg.d1", + "select constvalue(s3),CAST(s3 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s3),CAST(root.sg.d1.s3 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s3),CAST(root.db.d1.s3 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.7,", "3,1,3.33,", }; resultSetEqualTest( - "select constvalue(s3),CAST(s3 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s3),CAST(s3 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testOldTransformerWithDoubleSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS INT32)"}; String[] intRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,3,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + "select constvalue(s4),CAST(s4 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS INT64)"}; String[] longRetArray = new String[] { "0,1,0,", "1,1,1,", "2,1,3,", "3,1,3,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS INT64) from root.sg.d1", + "select constvalue(s4),CAST(s4 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.7,", "3,1,3.33,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS FLOAT) from root.sg.d1", + "select constvalue(s4),CAST(s4 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.7,", "3,1,3.33,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS DOUBLE) from root.sg.d1", + "select constvalue(s4),CAST(s4 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,1,false,", "1,1,true,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS BOOLEAN) from root.sg.d1", + "select constvalue(s4),CAST(s4 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s4),CAST(root.sg.d1.s4 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s4),CAST(root.db.d1.s4 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,0.0,", "1,1,1.0,", "2,1,2.7,", "3,1,3.33,", }; resultSetEqualTest( - "select constvalue(s4),CAST(s4 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s4),CAST(s4 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testOldTransformerWithBooleanSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS INT32)"}; String[] intRetArray = new String[] { "0,1,0,", "1,1,0,", "2,1,1,", "3,1,1,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS INT32) from root.sg.d1", intExpectedHeader, intRetArray); + "select constvalue(s5),CAST(s5 AS INT32) from root.db.d1", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS INT64)"}; String[] longRetArray = new String[] { "0,1,0,", "1,1,0,", "2,1,1,", "3,1,1,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS INT64) from root.sg.d1", + "select constvalue(s5),CAST(s5 AS INT64) from root.db.d1", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,0.0,", "1,1,0.0,", "2,1,1.0,", "3,1,1.0,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS FLOAT) from root.sg.d1", + "select constvalue(s5),CAST(s5 AS FLOAT) from root.db.d1", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,0.0,", "1,1,0.0,", "2,1,1.0,", "3,1,1.0,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS DOUBLE) from root.sg.d1", + "select constvalue(s5),CAST(s5 AS DOUBLE) from root.db.d1", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "0,1,false,", "1,1,false,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS BOOLEAN) from root.sg.d1", + "select constvalue(s5),CAST(s5 AS BOOLEAN) from root.db.d1", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s5),CAST(root.sg.d1.s5 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s5),CAST(root.db.d1.s5 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,false,", "1,1,false,", "2,1,true,", "3,1,true,", }; resultSetEqualTest( - "select constvalue(s5),CAST(s5 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s5),CAST(s5 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } @Test public void testOldTransformerWithTextSource() { // cast to int String[] intExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS INT32)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS INT32)"}; String[] intRetArray = new String[] { "0,1,10000,", "1,1,3,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS INT32) from root.sg.d1 where time < 2", + "select constvalue(s6),CAST(s6 AS INT32) from root.db.d1 where time < 2", intExpectedHeader, intRetArray); // cast to long String[] longExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS INT64)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS INT64)"}; String[] longRetArray = new String[] { "0,1,10000,", "1,1,3,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS INT64) from root.sg.d1 where time < 2", + "select constvalue(s6),CAST(s6 AS INT64) from root.db.d1 where time < 2", longExpectedHeader, longRetArray); // cast to float String[] floatExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS FLOAT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS FLOAT)"}; String[] floatRetArray = new String[] { "0,1,10000.0,", "1,1,3.0,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS FLOAT) from root.sg.d1 where time < 2", + "select constvalue(s6),CAST(s6 AS FLOAT) from root.db.d1 where time < 2", floatExpectedHeader, floatRetArray); // cast to double String[] doubleExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS DOUBLE)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS DOUBLE)"}; String[] doubleRetArray = new String[] { "0,1,10000.0,", "1,1,3.0,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS DOUBLE) from root.sg.d1 where time < 2", + "select constvalue(s6),CAST(s6 AS DOUBLE) from root.db.d1 where time < 2", doubleExpectedHeader, doubleRetArray); // cast to boolean String[] booleanExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS BOOLEAN)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS BOOLEAN)"}; String[] booleanRetArray = new String[] { "2,1,true,", "3,1,false,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS BOOLEAN) from root.sg.d1 where time >= 2", + "select constvalue(s6),CAST(s6 AS BOOLEAN) from root.db.d1 where time >= 2", booleanExpectedHeader, booleanRetArray); // cast to text String[] textExpectedHeader = - new String[] {TIMESTAMP_STR, "constvalue(root.sg.d1.s6),CAST(root.sg.d1.s6 AS TEXT)"}; + new String[] {TIMESTAMP_STR, "constvalue(root.db.d1.s6),CAST(root.db.d1.s6 AS TEXT)"}; String[] textRetArray = new String[] { "0,1,10000,", "1,1,3,", "2,1,TRue,", "3,1,faLse,", }; resultSetEqualTest( - "select constvalue(s6),CAST(s6 AS TEXT) from root.sg.d1", textExpectedHeader, textRetArray); + "select constvalue(s6),CAST(s6 AS TEXT) from root.db.d1", textExpectedHeader, textRetArray); } // endregion @@ -905,7 +905,7 @@ public void testCastWithLongSource() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select CAST(s2 AS INT32) from root.sg1.d1"); + statement.execute("select CAST(s2 AS INT32) from root.db1.d1"); fail(); } catch (Exception ignored) { } @@ -920,13 +920,13 @@ public void testCastWithFloatSource() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select CAST(s3 AS INT32) from root.sg1.d1"); + statement.execute("select CAST(s3 AS INT32) from root.db1.d1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s3 AS INT64) from root.sg1.d1"); + statement.execute("select CAST(s3 AS INT64) from root.db1.d1"); fail(); } catch (Exception ignored) { } @@ -941,19 +941,19 @@ public void testCastWithDoubleSource() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select CAST(s4 AS INT32) from root.sg1.d1"); + statement.execute("select CAST(s4 AS INT32) from root.db1.d1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s4 AS INT64) from root.sg1.d1"); + statement.execute("select CAST(s4 AS INT64) from root.db1.d1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s4 AS Float) from root.sg1.d1"); + statement.execute("select CAST(s4 AS Float) from root.db1.d1"); fail(); } catch (Exception ignored) { } @@ -968,55 +968,55 @@ public void testCastWithTextSource() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select CAST(s6 AS INT32) from root.sg1.d1 where time = 1"); + statement.execute("select CAST(s6 AS INT32) from root.db1.d1 where time = 1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS INT32) from root.sg1.d1 where time = 2"); + statement.execute("select CAST(s6 AS INT32) from root.db1.d1 where time = 2"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS INT64) from root.sg1.d1 where time = 1"); + statement.execute("select CAST(s6 AS INT64) from root.db1.d1 where time = 1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS INT64) from root.sg1.d1 where time = 2"); + statement.execute("select CAST(s6 AS INT64) from root.db1.d1 where time = 2"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS FLOAT) from root.sg1.d1 where time=3"); + statement.execute("select CAST(s6 AS FLOAT) from root.db1.d1 where time=3"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS FLOAT) from root.sg1.d1 where time=1"); + statement.execute("select CAST(s6 AS FLOAT) from root.db1.d1 where time=1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS DOUBLE) from root.sg1.d1 where time = 1"); + statement.execute("select CAST(s6 AS DOUBLE) from root.db1.d1 where time = 1"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS DOUBLE) from root.sg1.d1 where time = 4"); + statement.execute("select CAST(s6 AS DOUBLE) from root.db1.d1 where time = 4"); fail(); } catch (Exception ignored) { } try { - statement.execute("select CAST(s6 AS BOOLEAN) from root.sg1.d1 where time = 1"); + statement.execute("select CAST(s6 AS BOOLEAN) from root.db1.d1 where time = 1"); fail(); } catch (Exception ignored) { } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBReplaceFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBReplaceFunctionIT.java index 12c608562348a..c0360027f7555 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBReplaceFunctionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBReplaceFunctionIT.java @@ -44,22 +44,22 @@ public class IoTDBReplaceFunctionIT { private static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.s1 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s3 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s4 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s5 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s6 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s7 WITH DATATYPE=DATE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s8 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s9 WITH DATATYPE=STRING, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s10 WITH DATATYPE=BLOB, ENCODING=PLAIN", - "INSERT INTO root.sg(timestamp,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd','abcd')", - "INSERT INTO root.sg(timestamp,s1) values(2, 'test\\\\')", - "INSERT INTO root.sg(timestamp,s1) values(3, 'abcd\\\\')", - "INSERT INTO root.sg(timestamp,s9) values(2, 'test\\\\')", - "INSERT INTO root.sg(timestamp,s9) values(3, 'abcd\\\\')", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.s1 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s3 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s4 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s5 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s6 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s7 WITH DATATYPE=DATE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s8 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s9 WITH DATATYPE=STRING, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s10 WITH DATATYPE=BLOB, ENCODING=PLAIN", + "INSERT INTO root.db(timestamp,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd','abcd')", + "INSERT INTO root.db(timestamp,s1) values(2, 'test\\\\')", + "INSERT INTO root.db(timestamp,s1) values(3, 'abcd\\\\')", + "INSERT INTO root.db(timestamp,s9) values(2, 'test\\\\')", + "INSERT INTO root.db(timestamp,s9) values(3, 'abcd\\\\')", "flush" }; @@ -89,27 +89,27 @@ private static void registerUDF() { public void testNewTransformer() { String[] expectedHeader = new String[] { - TIMESTAMP_STR, "REPLACE(root.sg.s1, 'ab', 'AB')", "REPLACE(root.sg.s1, '\\', 'a')" + TIMESTAMP_STR, "REPLACE(root.db.s1, 'ab', 'AB')", "REPLACE(root.db.s1, '\\', 'a')" }; String[] retArray = new String[] { "1,ABcd,abcd,", "2,test\\\\,testaa,", "3,ABcd\\\\,abcdaa,", }; resultSetEqualTest( - "select REPLACE(s1, 'ab', 'AB'), REPLACE(s1, '\\', 'a') from root.sg", + "select REPLACE(s1, 'ab', 'AB'), REPLACE(s1, '\\', 'a') from root.db", expectedHeader, retArray); String[] expectedHeader2 = new String[] { - TIMESTAMP_STR, "REPLACE(root.sg.s9, 'ab', 'AB')", "REPLACE(root.sg.s9, '\\', 'a')" + TIMESTAMP_STR, "REPLACE(root.db.s9, 'ab', 'AB')", "REPLACE(root.db.s9, '\\', 'a')" }; String[] retArray2 = new String[] { "1,ABcd,abcd,", "2,test\\\\,testaa,", "3,ABcd\\\\,abcdaa,", }; resultSetEqualTest( - "select REPLACE(s9, 'ab', 'AB'), REPLACE(s9, '\\', 'a') from root.sg", + "select REPLACE(s9, 'ab', 'AB'), REPLACE(s9, '\\', 'a') from root.db", expectedHeader2, retArray2); } @@ -119,16 +119,16 @@ public void testOldTransformer() { String[] expectedHeader = new String[] { TIMESTAMP_STR, - "constvalue(root.sg.s1)", - "REPLACE(root.sg.s1, 'ab', 'AB')", - "REPLACE(root.sg.s1, '\\', 'a')" + "constvalue(root.db.s1)", + "REPLACE(root.db.s1, 'ab', 'AB')", + "REPLACE(root.db.s1, '\\', 'a')" }; String[] retArray = new String[] { "1,1,ABcd,abcd,", "2,1,test\\\\,testaa,", "3,1,ABcd\\\\,abcdaa,", }; resultSetEqualTest( - "select constvalue(s1),REPLACE(s1, 'ab', 'AB'), REPLACE(s1, '\\', 'a') from root.sg", + "select constvalue(s1),REPLACE(s1, 'ab', 'AB'), REPLACE(s1, '\\', 'a') from root.db", expectedHeader, retArray); } @@ -138,7 +138,7 @@ public void testWithoutFromOrTo() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select REPLACE(s1, 'b') from root.sg"); + statement.execute("select REPLACE(s1, 'b') from root.db"); fail(); } catch (Exception ignored) { } @@ -153,49 +153,49 @@ public void testWrongInputType() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("select REPLACE(s2, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s2, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s3, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s3, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s4, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s4, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s5, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s5, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s6, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s6, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s7, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s7, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s8, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s8, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } try { - statement.execute("select REPLACE(s10, 'a', 'b') from root.sg"); + statement.execute("select REPLACE(s10, 'a', 'b') from root.db"); fail(); } catch (Exception ignored) { } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBSubStringFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBSubStringFunctionIT.java index 15e2d400497cd..dc800af5ed2bd 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBSubStringFunctionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/builtinfunction/scalar/IoTDBSubStringFunctionIT.java @@ -45,22 +45,22 @@ public class IoTDBSubStringFunctionIT { private static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.s1 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s3 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s4 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s5 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s6 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s7 WITH DATATYPE=DATE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s8 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s9 WITH DATATYPE=STRING, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.s10 WITH DATATYPE=BLOB, ENCODING=PLAIN", - "INSERT INTO root.sg(timestamp,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', 'abcd')", - "INSERT INTO root.sg(timestamp,s1) values(2, 'test')", - "INSERT INTO root.sg(timestamp,s1) values(3, 'abcdefg')", - "INSERT INTO root.sg(timestamp,s9) values(2, 'test')", - "INSERT INTO root.sg(timestamp,s9) values(3, 'abcdefg')", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.s1 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s3 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s4 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s5 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s6 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s7 WITH DATATYPE=DATE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s8 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s9 WITH DATATYPE=STRING, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.s10 WITH DATATYPE=BLOB, ENCODING=PLAIN", + "INSERT INTO root.db(timestamp,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10) values(1, 'abcd', 1, 1, 1, 1, true, '2021-10-01', 1633046400000, 'abcd', 'abcd')", + "INSERT INTO root.db(timestamp,s1) values(2, 'test')", + "INSERT INTO root.db(timestamp,s1) values(3, 'abcdefg')", + "INSERT INTO root.db(timestamp,s9) values(2, 'test')", + "INSERT INTO root.db(timestamp,s9) values(3, 'abcdefg')", "flush" }; @@ -91,7 +91,7 @@ public void testNewTransformer() { // Normal String[] expectedHeader = new String[] { - "Time,root.sg.s1,SUBSTRING(root.sg.s1,1),SUBSTRING(root.sg.s1,1,3),SUBSTRING(root.sg.s1 FROM 1),SUBSTRING(root.sg.s1 FROM 1 FOR 3)" + "Time,root.db.s1,SUBSTRING(root.db.s1,1),SUBSTRING(root.db.s1,1,3),SUBSTRING(root.db.s1 FROM 1),SUBSTRING(root.db.s1 FROM 1 FOR 3)" }; String[] retArray = new String[] { @@ -100,28 +100,28 @@ public void testNewTransformer() { "3,abcdefg,abcdefg,abc,abcdefg,abc,", }; resultSetEqualTest( - "select s1,SUBSTRING(s1,1),SUBSTRING(s1,1,3),SUBSTRING(s1 from 1),SUBSTRING(s1 from 1 for 3) from root.sg", + "select s1,SUBSTRING(s1,1),SUBSTRING(s1,1,3),SUBSTRING(s1 from 1),SUBSTRING(s1 from 1 for 3) from root.db", expectedHeader, retArray); // Param 1 greater than input series length expectedHeader = new String[] { - "Time,root.sg.s1,SUBSTRING(root.sg.s1,11),SUBSTRING(root.sg.s1,11,13),SUBSTRING(root.sg.s1 FROM 11),SUBSTRING(root.sg.s1 FROM 11 FOR 13)" + "Time,root.db.s1,SUBSTRING(root.db.s1,11),SUBSTRING(root.db.s1,11,13),SUBSTRING(root.db.s1 FROM 11),SUBSTRING(root.db.s1 FROM 11 FOR 13)" }; retArray = new String[] { "1,abcd,,,,,", "2,test,,,,,", "3,abcdefg,,,,,", }; resultSetEqualTest( - "select s1,SUBSTRING(s1,11),SUBSTRING(s1,11,13),SUBSTRING(s1 from 11),SUBSTRING(s1 from 11 for 13) from root.sg", + "select s1,SUBSTRING(s1,11),SUBSTRING(s1,11,13),SUBSTRING(s1 from 11),SUBSTRING(s1 from 11 for 13) from root.db", expectedHeader, retArray); // Normal String[] expectedHeader2 = new String[] { - "Time,root.sg.s9,SUBSTRING(root.sg.s9,1),SUBSTRING(root.sg.s9,1,3),SUBSTRING(root.sg.s9 FROM 1),SUBSTRING(root.sg.s9 FROM 1 FOR 3)" + "Time,root.db.s9,SUBSTRING(root.db.s9,1),SUBSTRING(root.db.s9,1,3),SUBSTRING(root.db.s9 FROM 1),SUBSTRING(root.db.s9 FROM 1 FOR 3)" }; String[] retArray2 = new String[] { @@ -130,7 +130,7 @@ public void testNewTransformer() { "3,abcdefg,abcdefg,abc,abcdefg,abc,", }; resultSetEqualTest( - "select s9,SUBSTRING(s9,1),SUBSTRING(s9,1,3),SUBSTRING(s9 from 1),SUBSTRING(s9 from 1 for 3) from root.sg", + "select s9,SUBSTRING(s9,1),SUBSTRING(s9,1,3),SUBSTRING(s9 from 1),SUBSTRING(s9 from 1 for 3) from root.db", expectedHeader2, retArray2); } @@ -140,7 +140,7 @@ public void testOldTransformer() { // Normal String[] expectedHeader = new String[] { - "Time,root.sg.s1,change_points(root.sg.s1),SUBSTRING(root.sg.s1,1),SUBSTRING(root.sg.s1,1,3),SUBSTRING(root.sg.s1 FROM 1),SUBSTRING(root.sg.s1 FROM 1 FOR 3)" + "Time,root.db.s1,change_points(root.db.s1),SUBSTRING(root.db.s1,1),SUBSTRING(root.db.s1,1,3),SUBSTRING(root.db.s1 FROM 1),SUBSTRING(root.db.s1 FROM 1 FOR 3)" }; String[] retArray = new String[] { @@ -149,28 +149,28 @@ public void testOldTransformer() { "3,abcdefg,abcdefg,abcdefg,abc,abcdefg,abc,", }; resultSetEqualTest( - "select s1,change_points(s1),SUBSTRING(s1,1),SUBSTRING(s1,1,3),SUBSTRING(s1 from 1),SUBSTRING(s1 from 1 for 3) from root.sg", + "select s1,change_points(s1),SUBSTRING(s1,1),SUBSTRING(s1,1,3),SUBSTRING(s1 from 1),SUBSTRING(s1 from 1 for 3) from root.db", expectedHeader, retArray); // Param 1 greater than input series length expectedHeader = new String[] { - "Time,root.sg.s1,change_points(root.sg.s1),SUBSTRING(root.sg.s1,11),SUBSTRING(root.sg.s1,11,13),SUBSTRING(root.sg.s1 FROM 11),SUBSTRING(root.sg.s1 FROM 11 FOR 13)" + "Time,root.db.s1,change_points(root.db.s1),SUBSTRING(root.db.s1,11),SUBSTRING(root.db.s1,11,13),SUBSTRING(root.db.s1 FROM 11),SUBSTRING(root.db.s1 FROM 11 FOR 13)" }; retArray = new String[] { "1,abcd,abcd,,,,,", "2,test,test,,,,,", "3,abcdefg,abcdefg,,,,,", }; resultSetEqualTest( - "select s1,change_points(s1),SUBSTRING(s1,11),SUBSTRING(s1,11,13),SUBSTRING(s1 from 11),SUBSTRING(s1 from 11 for 13) from root.sg", + "select s1,change_points(s1),SUBSTRING(s1,11),SUBSTRING(s1,11,13),SUBSTRING(s1 from 11),SUBSTRING(s1 from 11 for 13) from root.db", expectedHeader, retArray); // Normal String[] expectedHeader2 = new String[] { - "Time,root.sg.s9,change_points(root.sg.s1),SUBSTRING(root.sg.s9,1),SUBSTRING(root.sg.s9,1,3),SUBSTRING(root.sg.s9 FROM 1),SUBSTRING(root.sg.s9 FROM 1 FOR 3)" + "Time,root.db.s9,change_points(root.db.s1),SUBSTRING(root.db.s9,1),SUBSTRING(root.db.s9,1,3),SUBSTRING(root.db.s9 FROM 1),SUBSTRING(root.db.s9 FROM 1 FOR 3)" }; String[] retArray2 = new String[] { @@ -179,7 +179,7 @@ public void testOldTransformer() { "3,abcdefg,abcdefg,abcdefg,abc,abcdefg,abc,", }; resultSetEqualTest( - "select s9,change_points(s1),SUBSTRING(s9,1),SUBSTRING(s9,1,3),SUBSTRING(s9 from 1),SUBSTRING(s9 from 1 for 3) from root.sg", + "select s9,change_points(s1),SUBSTRING(s9,1),SUBSTRING(s9,1,3),SUBSTRING(s9 from 1),SUBSTRING(s9 from 1 for 3) from root.db", expectedHeader2, retArray2); } @@ -188,7 +188,7 @@ public void testOldTransformer() { public void testRoundBooleanAndText() { // Using substring without start and end position. assertTestFail( - "select s1,SUBSTRING(s1) from root.sg", + "select s1,SUBSTRING(s1) from root.db", TSStatusCode.SEMANTIC_ERROR.getStatusCode() + ": Argument exception,the scalar function [SUBSTRING] needs at least one argument,it must be a signed integer"); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecIT.java index ea00bbfa646a9..ddd06b3cb4cd3 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecIT.java @@ -55,19 +55,19 @@ public static void tearDown() throws Exception { @Test public void testCQExecution1() { String insertTemplate = - "INSERT INTO root.sg.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis(); long firstExecutionTime = now + 10_000; long startTime = firstExecutionTime - 3_000; - statement.execute("create timeseries root.sg.d1.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d1.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d1(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d1(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -99,8 +99,8 @@ public void testCQExecution1() { + String.format("BOUNDARY %d\n", firstExecutionTime) + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d1(s1_max)\n" - + " FROM root.sg.d1\n" + + " INTO root.db.d1(s1_max)\n" + + " FROM root.db.d1\n" + " GROUP BY(1s) \n" + "END"); @@ -121,11 +121,11 @@ public void testCQExecution1() { }; long[] expectedValue = {4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d1")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d1.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d1.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -142,19 +142,19 @@ public void testCQExecution1() { @Test public void testCQExecution2() { String insertTemplate = - "INSERT INTO root.sg.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis(); long firstExecutionTime = now + 10_000; long startTime = firstExecutionTime - 3_000; - statement.execute("create timeseries root.sg.d2.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d2.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d2(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d2(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -187,8 +187,8 @@ public void testCQExecution2() { + "RANGE 4s \n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d2(s1_max)\n" - + " FROM root.sg.d2\n" + + " INTO root.db.d2(s1_max)\n" + + " FROM root.db.d2\n" + " GROUP BY(1s) \n" + "END"); @@ -209,11 +209,11 @@ public void testCQExecution2() { }; long[] expectedValue = {2, 4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d2")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d2")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d2.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d2.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -230,19 +230,19 @@ public void testCQExecution2() { @Test public void testCQExecution3() { String insertTemplate = - "INSERT INTO root.sg.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis(); long firstExecutionTime = now + 10_000; long startTime = firstExecutionTime - 3_000; - statement.execute("create timeseries root.sg.d3.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d3.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d3(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d3(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -275,8 +275,8 @@ public void testCQExecution3() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d3(s1_max)\n" - + " FROM root.sg.d3\n" + + " INTO root.db.d3(s1_max)\n" + + " FROM root.db.d3\n" + " GROUP BY(1s) \n" + " FILL(100)\n" + "END"); @@ -305,14 +305,14 @@ public void testCQExecution3() { try (ResultSet resultSet = statement.executeQuery( - "select s1_max from root.sg.d3 where time between " + "select s1_max from root.db.d3 where time between " + (startTime - 1_000) + " and " + (startTime + 4_000))) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d3.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d3.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -329,19 +329,19 @@ public void testCQExecution3() { @Test public void testCQExecution4() { String insertTemplate = - "INSERT INTO root.sg.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis(); long firstExecutionTime = now + 10_000; long startTime = firstExecutionTime - 3_000; - statement.execute("create timeseries root.sg.d4.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d4.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d4(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d4(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -374,8 +374,8 @@ public void testCQExecution4() { + "RANGE 2s, 1s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d4(s1_max)\n" - + " FROM root.sg.d4\n" + + " INTO root.db.d4(s1_max)\n" + + " FROM root.db.d4\n" + " GROUP BY(1s) \n" + "END"); @@ -394,11 +394,11 @@ public void testCQExecution4() { long[] expectedTime = {startTime + 1_000, startTime + 3_000}; long[] expectedValue = {4, 8}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d4")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d4")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d4.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d4.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -415,19 +415,19 @@ public void testCQExecution4() { @Test public void testCQExecution5() { String insertTemplate = - "INSERT INTO root.sg.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis(); long firstExecutionTime = now + 10_000; long startTime = firstExecutionTime - 3_000; - statement.execute("create timeseries root.sg.d5.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); + statement.execute("create timeseries root.db.d5.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d5(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d5(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -460,8 +460,8 @@ public void testCQExecution5() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT s1 + 1 \n" - + " INTO root.sg.d5(precalculated_s1)\n" - + " FROM root.sg.d5\n" + + " INTO root.db.d5(precalculated_s1)\n" + + " FROM root.db.d5\n" + " align by device\n" + "END"); @@ -493,7 +493,7 @@ public void testCQExecution5() { try (ResultSet resultSet = statement.executeQuery( - "select precalculated_s1 from root.sg.d5 where time between " + "select precalculated_s1 from root.db.d5 where time between " + startTime + " and " + (startTime + 4_500))) { @@ -501,7 +501,7 @@ public void testCQExecution5() { while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); assertEquals( - expectedValue[cnt], resultSet.getDouble("root.sg.d5.precalculated_s1"), 0.00001); + expectedValue[cnt], resultSet.getDouble("root.db.d5.precalculated_s1"), 0.00001); cnt++; } assertEquals(expectedTime.length, cnt); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInNsIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInNsIT.java index 80acdb1408728..2271481919f62 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInNsIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInNsIT.java @@ -57,19 +57,19 @@ public static void tearDown() throws Exception { @Test public void testCQExecution1() { String insertTemplate = - "INSERT INTO root.sg.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000_000L; long firstExecutionTime = now + 10_000_000_000L; long startTime = firstExecutionTime - 3_000_000_000L; - statement.execute("create timeseries root.sg.d1.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d1.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d1(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d1(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -101,8 +101,8 @@ public void testCQExecution1() { + String.format("BOUNDARY %d\n", firstExecutionTime) + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d1(s1_max)\n" - + " FROM root.sg.d1\n" + + " INTO root.db.d1(s1_max)\n" + + " FROM root.db.d1\n" + " GROUP BY(1s) \n" + "END"); @@ -126,11 +126,11 @@ public void testCQExecution1() { }; long[] expectedValue = {4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d1")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d1.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d1.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -147,19 +147,19 @@ public void testCQExecution1() { @Test public void testCQExecution2() { String insertTemplate = - "INSERT INTO root.sg.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000_000L; long firstExecutionTime = now + 10_000_000_000L; long startTime = firstExecutionTime - 3_000_000_000L; - statement.execute("create timeseries root.sg.d2.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d2.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d2(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d2(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -192,8 +192,8 @@ public void testCQExecution2() { + "RANGE 4s \n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d2(s1_max)\n" - + " FROM root.sg.d2\n" + + " INTO root.db.d2(s1_max)\n" + + " FROM root.db.d2\n" + " GROUP BY(1s) \n" + "END"); @@ -218,11 +218,11 @@ public void testCQExecution2() { }; long[] expectedValue = {2, 4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d2")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d2")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d2.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d2.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -239,19 +239,19 @@ public void testCQExecution2() { @Test public void testCQExecution3() { String insertTemplate = - "INSERT INTO root.sg.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000_000L; long firstExecutionTime = now + 10_000_000_000L; long startTime = firstExecutionTime - 3_000_000_000L; - statement.execute("create timeseries root.sg.d3.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d3.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d3(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d3(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -284,8 +284,8 @@ public void testCQExecution3() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d3(s1_max)\n" - + " FROM root.sg.d3\n" + + " INTO root.db.d3(s1_max)\n" + + " FROM root.db.d3\n" + " GROUP BY(1s) \n" + " FILL(100)\n" + "END"); @@ -314,14 +314,14 @@ public void testCQExecution3() { try (ResultSet resultSet = statement.executeQuery( - "select s1_max from root.sg.d3 where time between " + "select s1_max from root.db.d3 where time between " + (startTime - 1_000_000_000L) + " and " + (startTime + 4_000_000_000L))) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d3.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d3.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -338,19 +338,19 @@ public void testCQExecution3() { @Test public void testCQExecution4() { String insertTemplate = - "INSERT INTO root.sg.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000_000L; long firstExecutionTime = now + 10_000_000_000L; long startTime = firstExecutionTime - 3_000_000_000L; - statement.execute("create timeseries root.sg.d4.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d4.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d4(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d4(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -383,8 +383,8 @@ public void testCQExecution4() { + "RANGE 2s, 1s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d4(s1_max)\n" - + " FROM root.sg.d4\n" + + " INTO root.db.d4(s1_max)\n" + + " FROM root.db.d4\n" + " GROUP BY(1s) \n" + "END"); @@ -403,11 +403,11 @@ public void testCQExecution4() { long[] expectedTime = {startTime + 1_000_000_000L, startTime + 3_000_000_000L}; long[] expectedValue = {4, 8}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d4")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d4")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d4.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d4.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -424,19 +424,19 @@ public void testCQExecution4() { @Test public void testCQExecution5() { String insertTemplate = - "INSERT INTO root.sg.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000_000L; long firstExecutionTime = now + 10_000_000_000L; long startTime = firstExecutionTime - 3_000_000_000L; - statement.execute("create timeseries root.sg.d5.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); + statement.execute("create timeseries root.db.d5.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d5(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d5(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -469,8 +469,8 @@ public void testCQExecution5() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT s1 + 1 \n" - + " INTO root.sg.d5(precalculated_s1)\n" - + " FROM root.sg.d5\n" + + " INTO root.db.d5(precalculated_s1)\n" + + " FROM root.db.d5\n" + " align by device\n" + "END"); @@ -502,7 +502,7 @@ public void testCQExecution5() { try (ResultSet resultSet = statement.executeQuery( - "select precalculated_s1 from root.sg.d5 where time between " + "select precalculated_s1 from root.db.d5 where time between " + startTime + " and " + (startTime + 4_500_000_000L))) { @@ -510,7 +510,7 @@ public void testCQExecution5() { while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); assertEquals( - expectedValue[cnt], resultSet.getDouble("root.sg.d5.precalculated_s1"), 0.00001); + expectedValue[cnt], resultSet.getDouble("root.db.d5.precalculated_s1"), 0.00001); cnt++; } assertEquals(expectedTime.length, cnt); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInUsIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInUsIT.java index c9971af3afb27..43c1a8a6f0822 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInUsIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQExecInUsIT.java @@ -57,19 +57,19 @@ public static void tearDown() throws Exception { @Test public void testCQExecution1() { String insertTemplate = - "INSERT INTO root.sg.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d1(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000L; long firstExecutionTime = now + 10_000_000L; long startTime = firstExecutionTime - 3_000_000L; - statement.execute("create timeseries root.sg.d1.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d1.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d1.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d1(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d1(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -101,8 +101,8 @@ public void testCQExecution1() { + String.format("BOUNDARY %d\n", firstExecutionTime) + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d1(s1_max)\n" - + " FROM root.sg.d1\n" + + " INTO root.db.d1(s1_max)\n" + + " FROM root.db.d1\n" + " GROUP BY(1s) \n" + "END"); @@ -126,11 +126,11 @@ public void testCQExecution1() { }; long[] expectedValue = {4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d1")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d1.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d1.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -147,19 +147,19 @@ public void testCQExecution1() { @Test public void testCQExecution2() { String insertTemplate = - "INSERT INTO root.sg.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d2(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000L; long firstExecutionTime = now + 10_000_000L; long startTime = firstExecutionTime - 3_000_000L; - statement.execute("create timeseries root.sg.d2.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d2.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d2.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d2(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d2(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -192,8 +192,8 @@ public void testCQExecution2() { + "RANGE 4s \n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d2(s1_max)\n" - + " FROM root.sg.d2\n" + + " INTO root.db.d2(s1_max)\n" + + " FROM root.db.d2\n" + " GROUP BY(1s) \n" + "END"); @@ -218,11 +218,11 @@ public void testCQExecution2() { }; long[] expectedValue = {2, 4, 6, 8, 10}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d2")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d2")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d2.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d2.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -239,19 +239,19 @@ public void testCQExecution2() { @Test public void testCQExecution3() { String insertTemplate = - "INSERT INTO root.sg.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d3(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000L; long firstExecutionTime = now + 10_000_000L; long startTime = firstExecutionTime - 3_000_000L; - statement.execute("create timeseries root.sg.d3.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d3.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d3.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d3(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d3(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -284,8 +284,8 @@ public void testCQExecution3() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d3(s1_max)\n" - + " FROM root.sg.d3\n" + + " INTO root.db.d3(s1_max)\n" + + " FROM root.db.d3\n" + " GROUP BY(1s) \n" + " FILL(100)\n" + "END"); @@ -314,14 +314,14 @@ public void testCQExecution3() { try (ResultSet resultSet = statement.executeQuery( - "select s1_max from root.sg.d3 where time between " + "select s1_max from root.db.d3 where time between " + (startTime - 1_000_000L) + " and " + (startTime + 4_000_000L))) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d3.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d3.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -338,19 +338,19 @@ public void testCQExecution3() { @Test public void testCQExecution4() { String insertTemplate = - "INSERT INTO root.sg.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d4(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000L; long firstExecutionTime = now + 10_000_000L; long startTime = firstExecutionTime - 3_000_000L; - statement.execute("create timeseries root.sg.d4.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d4.s1_max WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d4.s1_max WITH DATATYPE=INT64"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d4(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d4(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -383,8 +383,8 @@ public void testCQExecution4() { + "RANGE 2s, 1s\n" + "BEGIN \n" + " SELECT max_value(s1) \n" - + " INTO root.sg.d4(s1_max)\n" - + " FROM root.sg.d4\n" + + " INTO root.db.d4(s1_max)\n" + + " FROM root.db.d4\n" + " GROUP BY(1s) \n" + "END"); @@ -403,11 +403,11 @@ public void testCQExecution4() { long[] expectedTime = {startTime + 1_000_000L, startTime + 3_000_000L}; long[] expectedValue = {4, 8}; - try (ResultSet resultSet = statement.executeQuery("select s1_max from root.sg.d4")) { + try (ResultSet resultSet = statement.executeQuery("select s1_max from root.db.d4")) { int cnt = 0; while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); - assertEquals(expectedValue[cnt], resultSet.getLong("root.sg.d4.s1_max")); + assertEquals(expectedValue[cnt], resultSet.getLong("root.db.d4.s1_max")); cnt++; } assertEquals(expectedTime.length, cnt); @@ -424,19 +424,19 @@ public void testCQExecution4() { @Test public void testCQExecution5() { String insertTemplate = - "INSERT INTO root.sg.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; + "INSERT INTO root.db.d5(time, s1) VALUES (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { long now = System.currentTimeMillis() * 1_000L; long firstExecutionTime = now + 10_000_000L; long startTime = firstExecutionTime - 3_000_000L; - statement.execute("create timeseries root.sg.d5.s1 WITH DATATYPE=INT64"); - statement.execute("create timeseries root.sg.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); + statement.execute("create timeseries root.db.d5.s1 WITH DATATYPE=INT64"); + statement.execute("create timeseries root.db.d5.precalculated_s1 WITH DATATYPE=DOUBLE"); // firstly write one row to init data region, just for accelerating the following insert // statement. - statement.execute("INSERT INTO root.sg.d5(time, s1) VALUES (0,0)"); + statement.execute("INSERT INTO root.db.d5(time, s1) VALUES (0,0)"); statement.execute( String.format( @@ -469,8 +469,8 @@ public void testCQExecution5() { + "RANGE 4s\n" + "BEGIN \n" + " SELECT s1 + 1 \n" - + " INTO root.sg.d5(precalculated_s1)\n" - + " FROM root.sg.d5\n" + + " INTO root.db.d5(precalculated_s1)\n" + + " FROM root.db.d5\n" + " align by device\n" + "END"); @@ -502,7 +502,7 @@ public void testCQExecution5() { try (ResultSet resultSet = statement.executeQuery( - "select precalculated_s1 from root.sg.d5 where time between " + "select precalculated_s1 from root.db.d5 where time between " + startTime + " and " + (startTime + 4_500_000L))) { @@ -510,7 +510,7 @@ public void testCQExecution5() { while (resultSet.next()) { assertEquals(expectedTime[cnt], resultSet.getLong(TIMESTAMP_STR)); assertEquals( - expectedValue[cnt], resultSet.getDouble("root.sg.d5.precalculated_s1"), 0.00001); + expectedValue[cnt], resultSet.getDouble("root.db.d5.precalculated_s1"), 0.00001); cnt++; } assertEquals(expectedTime.length, cnt); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQIT.java index 399694b5e2cee..ab49cdcd07b72 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/cq/IoTDBCQIT.java @@ -64,8 +64,8 @@ public void testCreateWrongCQ() { "CREATE CQ s1_count_cq \n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY([0, 10), 30m)\n" + "END"; statement.execute(sql); @@ -83,8 +83,8 @@ public void testCreateWrongCQ() { "CREATE CQ s1_count_cq \n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " WHERE time >= 0 and time <= 10\n" + " GROUP BY(30m)\n" + "END"; @@ -103,8 +103,8 @@ public void testCreateWrongCQ() { "CREATE CQ s1_count_cq \n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + "END"; statement.execute(sql); fail(); @@ -121,7 +121,7 @@ public void testCreateWrongCQ() { "CREATE CQ s1_count_cq_2\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " FROM root.sg.d\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -141,8 +141,8 @@ public void testCreateWrongCQ() { + "RESAMPLE EVERY 50ms\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -161,8 +161,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE -1m\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -181,8 +181,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE 0m\n" + "BEGIN \n" + " SELECT count(s1)\n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -201,8 +201,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE 30m, -1m\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -221,8 +221,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE 30m, 30m\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -241,8 +241,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE 30m, 31m\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -261,8 +261,8 @@ public void testCreateWrongCQ() { + "RESAMPLE RANGE 30m\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(1h)\n" + "END"; statement.execute(sql); @@ -282,8 +282,8 @@ public void testCreateWrongCQ() { + "TIMEOUT POLICY UNKNOWN\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(1h)\n" + "END"; statement.execute(sql); @@ -301,8 +301,8 @@ public void testCreateWrongCQ() { "CREATE CQ s1_count_cq \n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -339,8 +339,8 @@ public void testCreateCorrectCQ() { + "TIMEOUT POLICY BLOCKED\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -354,8 +354,8 @@ public void testCreateCorrectCQ() { "CREATE CQ correct_cq_2\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END"; statement.execute(sql); @@ -371,8 +371,8 @@ public void testCreateCorrectCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END"; statement.execute(sql); @@ -388,8 +388,8 @@ public void testCreateCorrectCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END"; statement.execute(sql); @@ -423,15 +423,15 @@ public void testShowCQ() { + "TIMEOUT POLICY BLOCKED\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END", "CREATE CQ show_cq_2\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END", "CREATE CQ show_cq_3\n" @@ -439,8 +439,8 @@ public void testShowCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END", "CREATE CQ show_cq_4\n" @@ -448,8 +448,8 @@ public void testShowCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END" }; @@ -497,15 +497,15 @@ public void testDropCQ() { + "TIMEOUT POLICY BLOCKED\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END", "CREATE CQ drop_cq_2\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(30m)\n" + "END", "CREATE CQ drop_cq_3\n" @@ -513,8 +513,8 @@ public void testDropCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END", "CREATE CQ drop_cq_4\n" @@ -522,8 +522,8 @@ public void testDropCQ() { + "TIMEOUT POLICY DISCARD\n" + "BEGIN \n" + " SELECT count(s1) \n" - + " INTO root.sg_count.d(count_s1)\n" - + " FROM root.sg.d\n" + + " INTO root.db_count.d(count_s1)\n" + + " FROM root.db.d\n" + " GROUP BY(10m)\n" + "END" }; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByConditionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByConditionIT.java index f518749b03259..4bfdd76b07e70 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByConditionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByConditionIT.java @@ -47,70 +47,70 @@ public class IoTDBGroupByConditionIT { // https://docs.google.com/spreadsheets/d/1vsSmb41pdmK-BdBR1STwr8olg1Qc8baKVEWnfJB4mAg/edit#gid=0 private static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg.beijing.car01", - "CREATE TIMESERIES root.sg.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "CREATE DATABASE root.db.beijing.car01", + "CREATE TIMESERIES root.db.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", "flush", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", "flush" }; private static final String[] SQLs2 = new String[] { - "CREATE DATABASE root.sg.beijing.car02", - "CREATE TIMESERIES root.sg.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "CREATE DATABASE root.db.beijing.car02", + "CREATE TIMESERIES root.db.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", "flush" }; @@ -151,10 +151,10 @@ public void groupByConditionTest1() { {"2400000000", "2500000000", "100000000.0", "2", "100.0"} }; String sql = - "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false)"; + "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false)"; normalTestWithEndTime(res, sql); String sql2 = - "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false)"; + "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false)"; normalTest(res, sql2); } @@ -166,7 +166,7 @@ public void groupByConditionTest2() { {"5", "2500000000", "2499999995.0", "9", "100.0"} }; String sql2 = - "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=true)"; + "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=true)"; normalTest(res, sql2); } @@ -177,7 +177,7 @@ public void groupByConditionTest3() { {"5", "2500000000", "2499999995.0", "9", "100.0"}, }; String sql = - "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=3,ignoreNull=true)"; + "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=3,ignoreNull=true)"; normalTestWithEndTime(res, sql); } @@ -188,7 +188,7 @@ public void groupByConditionTest4() { {"5", "7", "2.0", "3", "36.0"}, }; String sql2 = - "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=3,ignoreNull=false)"; + "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=3,ignoreNull=false)"; normalTest(res, sql2); } @@ -199,7 +199,7 @@ public void groupByConditionTest5() { {"3", "4", "1.0", "2", "16.0"}, }; String sql = - "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=0,KEEP=2,ignoreNull=true)"; + "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=0,KEEP=2,ignoreNull=true)"; normalTestWithEndTime(res, sql); } @@ -210,7 +210,7 @@ public void groupByConditionTest6() { {"6", "2500000000", "2499999994", "13", "100.0"}, }; String sql = - "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(soc>=24.0,KEEP<=15)"; + "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(soc>=24.0,KEEP<=15)"; normalTestWithEndTime(res, sql); } @@ -222,7 +222,7 @@ private void normalTestWithEndTime(String[][] res, String sql) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); checkHeader( resultSetMetaData, - "Time,__endTime,max_time(root.sg.beijing.car01.charging_status) - min_time(root.sg.beijing.car01.charging_status),count(root.sg.beijing.car01.vehicle_status),last_value(root.sg.beijing.car01.soc)"); + "Time,__endTime,max_time(root.db.beijing.car01.charging_status) - min_time(root.db.beijing.car01.charging_status),count(root.db.beijing.car01.vehicle_status),last_value(root.db.beijing.car01.soc)"); int count = 0; while (resultSet.next()) { String startTime = resultSet.getString(1); @@ -253,7 +253,7 @@ private void normalTest(String[][] res, String sql) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); checkHeader( resultSetMetaData, - "Time,max_time(root.sg.beijing.car01.charging_status) - min_time(root.sg.beijing.car01.charging_status),count(root.sg.beijing.car01.vehicle_status),last_value(root.sg.beijing.car01.soc)"); + "Time,max_time(root.db.beijing.car01.charging_status) - min_time(root.db.beijing.car01.charging_status),count(root.db.beijing.car01.vehicle_status),last_value(root.db.beijing.car01.soc)"); int count = 0; while (resultSet.next()) { String startTime = resultSet.getString(1); @@ -285,11 +285,11 @@ private void normalTestWithEndTimeAlignByDevice(String[][] res, String sql) { "Time,Device,__endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc)"); int count = 0; int rowNum = res.length; - String device = "root.sg.beijing.car01"; + String device = "root.db.beijing.car01"; while (resultSet.next()) { if (count == rowNum) { count = 0; - device = "root.sg.beijing.car02"; + device = "root.db.beijing.car02"; } String startTime = resultSet.getString(1); String deviceName = resultSet.getString(2); @@ -324,11 +324,11 @@ private void normalTestAlignByDevice(String[][] res, String sql) { "Time,Device,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc)"); int count = 0; int rowNum = res.length; - String device = "root.sg.beijing.car01"; + String device = "root.db.beijing.car01"; while (resultSet.next()) { if (count == rowNum) { count = 0; - device = "root.sg.beijing.car02"; + device = "root.db.beijing.car02"; } String startTime = resultSet.getString(1); String deviceName = resultSet.getString(2); @@ -374,10 +374,10 @@ public void groupByConditionTestWithHaving() { {"2400000000", "2500000000", "100000000.0", "2", "100.0"} }; String sql = - "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false) having last_value(soc)>50"; + "select __endTime,max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false) having last_value(soc)>50"; normalTestWithEndTime(res, sql); String sql2 = - "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false) having last_value(soc)>50"; + "select max_time(charging_status) - min_time(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by condition(charging_status=1,KEEP>=2,ignoreNull=false) having last_value(soc)>50"; normalTest(res, sql2); } @@ -385,13 +385,13 @@ public void groupByConditionTestWithHaving() { public void groupByConditionFirstValueTest() { String[][] res = new String[][] {{"5", "7", "18.0"}}; String sql = - "select first_value(soc) from root.sg.beijing.car01 group by condition(charging_status!=0,KEEP>2,ignoreNull=false)"; + "select first_value(soc) from root.db.beijing.car01 group by condition(charging_status!=0,KEEP>2,ignoreNull=false)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); - checkHeader(resultSetMetaData, "Time,first_value(root.sg.beijing.car01.soc)"); + checkHeader(resultSetMetaData, "Time,first_value(root.db.beijing.car01.soc)"); int count = 0; while (resultSet.next()) { String startTime = resultSet.getString(1); @@ -427,28 +427,28 @@ public void errorTest1() { @Test public void errorTest2() { errorTest( - "select first_value(soc) from root.sg.beijing.car01 group by condition(count(charging_status)!=0,KEEP>2,ignoreNull=false)", + "select first_value(soc) from root.db.beijing.car01 group by condition(count(charging_status)!=0,KEEP>2,ignoreNull=false)", "701: Aggregation expression shouldn't exist in group by clause"); } @Test public void errorTest3() { errorTest( - "select first_value(soc) from root.sg.beijing.car01 group by condition(s1!=0,KEEP>2,ignoreNull=false)", - "701: root.sg.beijing.car01.s1 != 0 in group by clause doesn't exist."); + "select first_value(soc) from root.db.beijing.car01 group by condition(s1!=0,KEEP>2,ignoreNull=false)", + "701: root.db.beijing.car01.s1 != 0 in group by clause doesn't exist."); } @Test public void errorTest4() { errorTest( - "select first_value(soc) from root.sg.beijing.car01 group by condition(s1!=0,KEEP>2,ignoreNull=false) align by device", + "select first_value(soc) from root.db.beijing.car01 group by condition(s1!=0,KEEP>2,ignoreNull=false) align by device", "701: s1 != 0 in group by clause doesn't exist."); } @Test public void errorTest5() { errorTest( - "select first_value(soc) from root.sg.beijing.car01 group by condition(root.sg.beijing.car01.soc!=0,KEEP>2,ignoreNull=false) align by device", + "select first_value(soc) from root.db.beijing.car01 group by condition(root.db.beijing.car01.soc!=0,KEEP>2,ignoreNull=false) align by device", "701: ALIGN BY DEVICE: the suffix paths can only be measurement or one-level wildcard"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByCountIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByCountIT.java index 92af9934da95a..cda9fd8a43c5e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByCountIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByCountIT.java @@ -46,60 +46,60 @@ public class IoTDBGroupByCountIT { // https://docs.google.com/spreadsheets/d/1vsSmb41pdmK-BdBR1STwr8olg1Qc8baKVEWnfJB4mAg/edit#gid=0 private static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg.beijing.car01", - "CREATE TIMESERIES root.sg.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.soc WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "CREATE DATABASE root.db.beijing.car01", + "CREATE TIMESERIES root.db.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.soc WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", "flush", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", "flush" }; private static final String[] SQLs2 = new String[] { - "CREATE DATABASE root.sg.beijing.car02", - "CREATE TIMESERIES root.sg.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.soc WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "CREATE DATABASE root.db.beijing.car02", + "CREATE TIMESERIES root.db.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.soc WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", "flush", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", "flush" }; @@ -137,8 +137,8 @@ private void normalTest(String[][] res, String sql, boolean hasEndTime) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); String title = hasEndTime - ? "Time,__endTime,sum(root.sg.beijing.car01.charging_status),count(root.sg.beijing.car01.vehicle_status),last_value(root.sg.beijing.car01.soc)" - : "Time,sum(root.sg.beijing.car01.charging_status),count(root.sg.beijing.car01.vehicle_status),last_value(root.sg.beijing.car01.soc)"; + ? "Time,__endTime,sum(root.db.beijing.car01.charging_status),count(root.db.beijing.car01.vehicle_status),last_value(root.db.beijing.car01.soc)" + : "Time,sum(root.db.beijing.car01.charging_status),count(root.db.beijing.car01.vehicle_status),last_value(root.db.beijing.car01.soc)"; checkHeader(resultSetMetaData, title); int base = hasEndTime ? 1 : 0; int count = 0; @@ -173,8 +173,8 @@ private void firstValueTest(String[][] res, String sql, boolean hasEndTime) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); String title = hasEndTime - ? "Time,__endTime,first_value(root.sg.beijing.car01.soc)" - : "Time,first_value(root.sg.beijing.car01.soc)"; + ? "Time,__endTime,first_value(root.db.beijing.car01.soc)" + : "Time,first_value(root.db.beijing.car01.soc)"; checkHeader(resultSetMetaData, title); int count = 0; while (resultSet.next()) { @@ -206,9 +206,9 @@ public void groupByCountNormalTest1() { {"6", "1900000000", "5.0", "5", "55"}, }; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5)"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 5)"; String sql2 = - "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5)"; + "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 5)"; normalTest(res, sql, false); normalTest(res, sql2, true); } @@ -217,9 +217,9 @@ public void groupByCountNormalTest1() { public void groupByCountNormalTest2() { String[][] res = {{"1", "2400000000", "10.0", "12", "80"}}; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 12)"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 12)"; String sql2 = - "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 12)"; + "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 12)"; normalTest(res, sql, false); normalTest(res, sql2, true); } @@ -231,9 +231,9 @@ public void groupByCountNormalTest3() { {"6", "1900000000", "24"}, }; String sql = - "select first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5)"; + "select first_value(soc) from root.db.beijing.car01 group by count(charging_status, 5)"; String sql2 = - "select __endTime,first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5)"; + "select __endTime,first_value(soc) from root.db.beijing.car01 group by count(charging_status, 5)"; firstValueTest(res, sql, false); firstValueTest(res, sql2, true); } @@ -245,9 +245,9 @@ public void groupByCountNormalTest4() { {"9", "2600000000", "45"}, }; String sql = - "select first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 7)"; + "select first_value(soc) from root.db.beijing.car01 group by count(charging_status, 7)"; String sql2 = - "select __endTime,first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 7)"; + "select __endTime,first_value(soc) from root.db.beijing.car01 group by count(charging_status, 7)"; firstValueTest(res, sql, false); firstValueTest(res, sql2, true); } @@ -264,9 +264,9 @@ public void groupByCountNormalTest5() { {"2500000000", "2600000000", "100"} }; String sql = - "select first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2)"; + "select first_value(soc) from root.db.beijing.car01 group by count(charging_status, 2)"; String sql2 = - "select __endTime,first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2)"; + "select __endTime,first_value(soc) from root.db.beijing.car01 group by count(charging_status, 2)"; firstValueTest(res, sql, false); firstValueTest(res, sql2, true); } @@ -283,9 +283,9 @@ public void groupByCountNormalTest6() { {"2500000000", "2600000000", "1.0", "2", "101"} }; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2)"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 2)"; String sql2 = - "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2)"; + "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 2)"; normalTest(res, sql, false); normalTest(res, sql2, true); } @@ -297,7 +297,7 @@ public void groupByCountNormalTest7() { {"2500000000", "2600000000", "1.0", "2", "101"} }; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2) having sum(charging_status)<2"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 2) having sum(charging_status)<2"; normalTest(res, sql, false); } @@ -310,9 +310,9 @@ public void groupByCountNormalTest8() { {"2200000000", "2600000000", "2.0", "5", "101"}, }; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5, ignoreNull=false)"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 5, ignoreNull=false)"; String sql2 = - "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 5, ignoreNull=false)"; + "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 5, ignoreNull=false)"; normalTest(res, sql, false); normalTest(res, sql2, true); } @@ -332,9 +332,9 @@ public void groupByCountNormalTest9() { {"2500000000", "2600000000", "100"} }; String sql = - "select first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2, ignoreNull=false)"; + "select first_value(soc) from root.db.beijing.car01 group by count(charging_status, 2, ignoreNull=false)"; String sql2 = - "select __endTime,first_value(soc) from root.sg.beijing.car01 group by count(charging_status, 2, ignoreNull=false)"; + "select __endTime,first_value(soc) from root.db.beijing.car01 group by count(charging_status, 2, ignoreNull=false)"; firstValueTest(res, sql, false); firstValueTest(res, sql2, true); } @@ -343,9 +343,9 @@ public void groupByCountNormalTest9() { public void groupByCountNormalTest10() { String[][] res = {{"1", "1200000000", "7.0", "12", "0"}}; String sql = - "select sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 12, ignoreNull = false)"; + "select sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 12, ignoreNull = false)"; String sql2 = - "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.sg.beijing.car01 group by count(charging_status, 12, ignoreNull = false)"; + "select __endTime,sum(charging_status),count(vehicle_status),last_value(soc) from root.db.beijing.car01 group by count(charging_status, 12, ignoreNull = false)"; normalTest(res, sql, false); normalTest(res, sql2, true); } @@ -362,12 +362,12 @@ private void normalTestWithAlignByDevice(String[][] res, String sql, boolean has : "Time,Device,sum(charging_status),count(vehicle_status),last_value(soc)"; checkHeader(resultSetMetaData, title); int count = 0; - String expectedDevice = "root.sg.beijing.car01"; + String expectedDevice = "root.db.beijing.car01"; int base = hasEndTime ? 1 : 0; while (resultSet.next()) { if (count == res.length) { count = 0; - expectedDevice = "root.sg.beijing.car02"; + expectedDevice = "root.db.beijing.car02"; } String startTime = resultSet.getString(1); String device = resultSet.getString(2); @@ -431,28 +431,28 @@ public void errorTest1() { @Test public void errorTest2() { errorTest( - "select count(soc) from root.sg.beijing.car01 group by count(count(soc),2)", + "select count(soc) from root.db.beijing.car01 group by count(count(soc),2)", "701: Aggregation expression shouldn't exist in group by clause"); } @Test public void errorTest3() { errorTest( - "select count(soc) from root.sg.beijing.car01 group by count(s1,2)", - "701: root.sg.beijing.car01.s1 in group by clause doesn't exist."); + "select count(soc) from root.db.beijing.car01 group by count(s1,2)", + "701: root.db.beijing.car01.s1 in group by clause doesn't exist."); } @Test public void errorTest4() { errorTest( - "select count(soc) from root.sg.beijing.car01 group by count(s1,2) align by device", + "select count(soc) from root.db.beijing.car01 group by count(s1,2) align by device", "701: s1 in group by clause doesn't exist."); } @Test public void errorTest5() { errorTest( - "select count(soc) from root.sg.beijing.car01 group by count(root.sg.beijing.car01.soc,2) align by device", + "select count(soc) from root.db.beijing.car01 group by count(root.db.beijing.car01.soc,2) align by device", "701: ALIGN BY DEVICE: the suffix paths can only be measurement or one-level wildcard"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthIT.java index 9d56acf518fbf..a2057752896ab 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthIT.java @@ -65,7 +65,7 @@ public class IoTDBGroupByNaturalMonthIT { for (long i = 1604102400000L /* 2020-10-31 00:00:00 */; i <= 1617148800000L /* 2021-03-31 00:00:00 */; i += 86400_000L) { - dataSet.add("insert into root.sg1.d1(timestamp, temperature) values (" + i + ", 1)"); + dataSet.add("insert into root.db1.d1(timestamp, temperature) values (" + i + ", 1)"); } // TimeRange: [2023-01-01 00:00:00, 2027-01-01 00:00:00] @@ -103,7 +103,7 @@ public static void tearDown() throws Exception { */ @Test public void groupByNaturalMonthTest1() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = new String[] { "10/31/2020:00:00:00,30.0,", @@ -113,7 +113,7 @@ public void groupByNaturalMonthTest1() { "02/28/2021:00:00:00,1.0," }; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2020-10-31, 2021-03-01), 1mo, 1mo)", expectedHeader, retArray, @@ -127,7 +127,7 @@ public void groupByNaturalMonthTest1() { */ @Test public void groupByNaturalMonthTest2() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = { "10/31/2020:00:00:00,10.0,", "11/30/2020:00:00:00,10.0,", @@ -136,7 +136,7 @@ public void groupByNaturalMonthTest2() { "02/28/2021:00:00:00,1.0," }; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2020-10-31, 2021-03-01), 10d, 1mo)", expectedHeader, retArray, @@ -150,10 +150,10 @@ public void groupByNaturalMonthTest2() { */ @Test public void groupByNaturalMonthTest3() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = {"10/31/2020:00:00:00,30.0,"}; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 " + "GROUP BY ([2020-10-31, 2020-11-30), 1mo)", + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2020-10-31, 2020-11-30), 1mo)", expectedHeader, retArray, df, @@ -166,10 +166,10 @@ public void groupByNaturalMonthTest3() { */ @Test public void groupByNaturalMonthTest4() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = {"01/31/2021:00:00:00,28.0,", "02/28/2021:00:00:00,31.0,"}; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 GROUP BY ([2021-01-31, 2021-03-31), 1mo)", + "select sum(temperature) from root.db1.d1 GROUP BY ([2021-01-31, 2021-03-31), 1mo)", expectedHeader, retArray, df, @@ -178,12 +178,12 @@ public void groupByNaturalMonthTest4() { @Test public void groupByNaturalMonthTest5() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = { "01/30/2021:00:00:00,29.0,", "02/28/2021:00:00:00,30.0,", "03/30/2021:00:00:00,1.0," }; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 GROUP BY ([2021-01-30, 2021-03-31), 1mo)", + "select sum(temperature) from root.db1.d1 GROUP BY ([2021-01-30, 2021-03-31), 1mo)", expectedHeader, retArray, df, @@ -194,12 +194,12 @@ public void groupByNaturalMonthTest5() { @Test public void groupByNaturalMonthFailTest() { assertTestFail( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2021-01-31, 2021-03-31), 1mo) order by time desc", "doesn't support order by time desc now."); assertTestFail( - "select sum(temperature) from root.sg1.d1 GROUP BY ([1970-01-01, 2970-01-01), 40d, 1mo)", + "select sum(temperature) from root.db1.d1 GROUP BY ([1970-01-01, 2970-01-01), 40d, 1mo)", "The time windows may exceed 10000, please ensure your input."); } @@ -217,9 +217,9 @@ public void groupByNaturalMonthWithNowTest() { List times = new ArrayList<>(); try (ResultSet resultSet = statement.executeQuery( - "select sum(temperature) from root.sg1.d1 GROUP BY ([now() - 1mo, now()), 1d)")) { + "select sum(temperature) from root.db1.d1 GROUP BY ([now() - 1mo, now()), 1d)")) { while (resultSet.next()) { - String ans = resultSet.getString(sum("root.sg1.d1.temperature")); + String ans = resultSet.getString(sum("root.db1.d1.temperature")); times.add(resultSet.getString("Time")); if (ans == null) { cnt++; @@ -236,7 +236,7 @@ public void groupByNaturalMonthWithNowTest() { @Test public void groupBySlingWindowNaturalMonth1() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = { "10/31/2020:00:00:00,61.0,", "11/30/2020:00:00:00,62.0,", @@ -245,7 +245,7 @@ public void groupBySlingWindowNaturalMonth1() { "02/28/2021:00:00:00,1.0," }; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2020-10-31, 2021-03-01), 2mo, 1mo)", expectedHeader, retArray, @@ -255,7 +255,7 @@ public void groupBySlingWindowNaturalMonth1() { @Test public void groupBySlingWindowNaturalMonth2() { - String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.sg1.d1.temperature")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, sum("root.db1.d1.temperature")}; String[] retArray = { "10/31/2020:00:00:00,30.0,", "11/10/2020:00:00:00,30.0,", @@ -272,7 +272,7 @@ public void groupBySlingWindowNaturalMonth2() { "02/28/2021:00:00:00,1.0," }; resultSetEqualTest( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2020-10-31, 2021-03-01), 1mo, 10d)", expectedHeader, retArray, diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthNsPrecisionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthNsPrecisionIT.java index 807ecf6620e30..ec7803921084b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthNsPrecisionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthNsPrecisionIT.java @@ -45,7 +45,7 @@ public class IoTDBGroupByNaturalMonthNsPrecisionIT extends IoTDBGroupByNaturalMo i <= 1617148800000L /* 2021-03-31 00:00:00 */; i += 86400_000L) { dataSet.add( - "insert into root.sg1.d1(timestamp, temperature) values (" + i * 1000000 + ", 1)"); + "insert into root.db1.d1(timestamp, temperature) values (" + i * 1000000 + ", 1)"); } // TimeRange: [2023-01-01 00:00:00, 2027-01-01 00:00:00] @@ -72,13 +72,13 @@ public static void setUp() throws Exception { @Test public void groupByNaturalMonthFailTest() { assertTestFail( - "select sum(temperature) from root.sg1.d1 " + "select sum(temperature) from root.db1.d1 " + "GROUP BY ([2021-01-31, 2021-03-31), 1mo) order by time desc", "doesn't support order by time desc now."); // 2970-01-01 in ns precision has exceeded field of long number assertTestFail( - "select sum(temperature) from root.sg1.d1 GROUP BY ([1970-01-01, 2970-01-01), 40d, 1mo)", + "select sum(temperature) from root.db1.d1 GROUP BY ([1970-01-01, 2970-01-01), 40d, 1mo)", "Input time format 2970-01-01 error."); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthUsPrecisionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthUsPrecisionIT.java index eb4bfec938f9d..81e1c2daa5b43 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthUsPrecisionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByNaturalMonthUsPrecisionIT.java @@ -43,7 +43,7 @@ public class IoTDBGroupByNaturalMonthUsPrecisionIT extends IoTDBGroupByNaturalMo for (long i = 1604102400000L /* 2020-10-31 00:00:00 */; i <= 1617148800000L /* 2021-03-31 00:00:00 */; i += 86400_000L) { - dataSet.add("insert into root.sg1.d1(timestamp, temperature) values (" + i * 1000 + ", 1)"); + dataSet.add("insert into root.db1.d1(timestamp, temperature) values (" + i * 1000 + ", 1)"); } // TimeRange: [2023-01-01 00:00:00, 2027-01-01 00:00:00] diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByUnseqIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByUnseqIT.java index a15991c487683..3899c8f6b5fe2 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByUnseqIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBGroupByUnseqIT.java @@ -39,36 +39,36 @@ public class IoTDBGroupByUnseqIT { private static final String[] dataSet1 = new String[] { - "CREATE DATABASE root.sg1", - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg1.d1(time,s1) values(1, 1)", - "INSERT INTO root.sg1.d1(time,s1) values(2, 2)", - "INSERT INTO root.sg1.d1(time,s1) values(3, 3)", - "INSERT INTO root.sg1.d1(time,s1) values(4, 4)", - "INSERT INTO root.sg1.d1(time,s1) values(8, 8)", - "INSERT INTO root.sg1.d1(time,s1) values(10, 10)", - "INSERT INTO root.sg1.d1(time,s1) values(11, 11)", - "INSERT INTO root.sg1.d1(time,s1) values(12, 12)", + "CREATE DATABASE root.db1", + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db1.d1(time,s1) values(1, 1)", + "INSERT INTO root.db1.d1(time,s1) values(2, 2)", + "INSERT INTO root.db1.d1(time,s1) values(3, 3)", + "INSERT INTO root.db1.d1(time,s1) values(4, 4)", + "INSERT INTO root.db1.d1(time,s1) values(8, 8)", + "INSERT INTO root.db1.d1(time,s1) values(10, 10)", + "INSERT INTO root.db1.d1(time,s1) values(11, 11)", + "INSERT INTO root.db1.d1(time,s1) values(12, 12)", "flush", - "INSERT INTO root.sg1.d1(time,s1) values(7, 7)", - "INSERT INTO root.sg1.d1(time,s1) values(9, 9)", + "INSERT INTO root.db1.d1(time,s1) values(7, 7)", + "INSERT INTO root.db1.d1(time,s1) values(9, 9)", "flush" }; private static final String[] dataSet2 = new String[] { - "CREATE DATABASE root.sg2", - "CREATE TIMESERIES root.sg2.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg2.d1(time,s1) values(1, 1)", - "INSERT INTO root.sg2.d1(time,s1) values(10, 10)", + "CREATE DATABASE root.db2", + "CREATE TIMESERIES root.db2.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db2.d1(time,s1) values(1, 1)", + "INSERT INTO root.db2.d1(time,s1) values(10, 10)", "flush", - "INSERT INTO root.sg2.d1(time,s1) values(19, 19)", - "INSERT INTO root.sg2.d1(time,s1) values(30, 30)", + "INSERT INTO root.db2.d1(time,s1) values(19, 19)", + "INSERT INTO root.db2.d1(time,s1) values(30, 30)", "flush", - "INSERT INTO root.sg2.d1(time,s1) values(5, 5)", - "INSERT INTO root.sg2.d1(time,s1) values(15, 15)", - "INSERT INTO root.sg2.d1(time,s1) values(26, 26)", - "INSERT INTO root.sg2.d1(time,s1) values(30, 30)", + "INSERT INTO root.db2.d1(time,s1) values(5, 5)", + "INSERT INTO root.db2.d1(time,s1) values(15, 15)", + "INSERT INTO root.db2.d1(time,s1) values(26, 26)", + "INSERT INTO root.db2.d1(time,s1) values(30, 30)", "flush" }; @@ -86,7 +86,7 @@ public void tearDown() throws Exception { public void test1() { EnvFactory.getEnv().getConfig().getCommonConfig().setMaxNumberOfPointsInPage(4); EnvFactory.getEnv().initClusterEnvironment(); - String[] expectedHeader = new String[] {TIMESTAMP_STR, count("root.sg1.d1.s1")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, count("root.db1.d1.s1")}; String[] retArray = new String[] { "1,3,", "4,1,", "7,3,", "10,3,", @@ -94,7 +94,7 @@ public void test1() { prepareData(dataSet1); resultSetEqualTest( - "select count(s1) from root.sg1.d1 group by ([1, 13), 3ms)", expectedHeader, retArray); + "select count(s1) from root.db1.d1 group by ([1, 13), 3ms)", expectedHeader, retArray); } /** @@ -112,11 +112,11 @@ public void test2() { .setMaxNumberOfPointsInPage(4) .setTargetChunkPointNum(2); EnvFactory.getEnv().initClusterEnvironment(); - String[] expectedHeader = new String[] {TIMESTAMP_STR, count("root.sg2.d1.s1")}; + String[] expectedHeader = new String[] {TIMESTAMP_STR, count("root.db2.d1.s1")}; String[] retArray = new String[] {"5,1,", "10,1,", "15,2,", "20,0,", "25,1,"}; prepareData(dataSet2); resultSetEqualTest( - "select count(s1) from root.sg2.d1 group by ([5, 30), 5ms)", expectedHeader, retArray); + "select count(s1) from root.db2.d1 group by ([5, 30), 5ms)", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBLeftORightCIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBLeftORightCIT.java index 82e32b314db8f..6aa04c304d2bd 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBLeftORightCIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/groupby/IoTDBLeftORightCIT.java @@ -40,7 +40,7 @@ public class IoTDBLeftORightCIT { private static final String[] sqls = new String[] { - "insert into root.sg1.d1(time, s1) values(9, 9)", + "insert into root.db1.d1(time, s1) values(9, 9)", }; @BeforeClass @@ -58,13 +58,13 @@ public static void tearDown() throws Exception { public void testLeftORightCGroupBy() { String[] expectedHeader = new String[] { - TIMESTAMP_STR, count("root.sg1.d1.s1"), + TIMESTAMP_STR, count("root.db1.d1.s1"), }; String[] retArray = new String[] { "2,0,", "4,0,", "6,0,", "8,0,", "9,1,", }; resultSetEqualWithDescOrderTest( - "select count(s1) from root.sg1.d1 group by((0, 9], 2ms)", expectedHeader, retArray); + "select count(s1) from root.db1.d1 group by((0, 9], 2ms)", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java index 1c69857a3c506..21683fe61f493 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java @@ -75,11 +75,11 @@ public class IoTDBLastQueryLastCacheIT { "insert into root.ln_1.tb_6141(time,`waterNH4-N_DOUBLE`) aligned values(1679365910000,12.0);", "insert into root.ln_1.tb_6141(time,`waterNH4-N_DOUBLE`) aligned values(1679365910000,12.0);", "insert into root.ln_1.tb_6141(time,`switch_BOOLEAN`) aligned values(1675995566000,false);", - "create aligned timeseries root.sg(风机退出_BOOLEAN BOOLEAN encoding=RLE,`NH4-N_DOUBLE` DOUBLE encoding=GORILLA,膜产水状态_BOOLEAN BOOLEAN encoding=RLE,11_TEXT TEXT encoding=PLAIN,产水间歇运行时间设置_DOUBLE DOUBLE encoding=GORILLA,文本_TEXT TEXT encoding=PLAIN, 风机投入_BOOLEAN BOOLEAN encoding=RLE,枚举_INT32 INT32 encoding=RLE,出水TP_DOUBLE DOUBLE encoding=GORILLA,水管流速_DOUBLE DOUBLE encoding=GORILLA,CO2_DOUBLE DOUBLE encoding=GORILLA,`开关量-运行_BOOLEAN` BOOLEAN encoding=RLE,code_DOUBLE DOUBLE encoding=GORILLA);", - "insert into root.sg(time,code_DOUBLE) aligned values(1679477545000,2.0);", - "insert into root.sg(time,`NH4-N_DOUBLE`) aligned values(1679365910000,12.0);", - "create timeseries root.sg.d1.s1 with datatype=BLOB;", - "insert into root.sg.d1(time,s1) values(1,X'cafebabe')", + "create aligned timeseries root.db(风机退出_BOOLEAN BOOLEAN encoding=RLE,`NH4-N_DOUBLE` DOUBLE encoding=GORILLA,膜产水状态_BOOLEAN BOOLEAN encoding=RLE,11_TEXT TEXT encoding=PLAIN,产水间歇运行时间设置_DOUBLE DOUBLE encoding=GORILLA,文本_TEXT TEXT encoding=PLAIN, 风机投入_BOOLEAN BOOLEAN encoding=RLE,枚举_INT32 INT32 encoding=RLE,出水TP_DOUBLE DOUBLE encoding=GORILLA,水管流速_DOUBLE DOUBLE encoding=GORILLA,CO2_DOUBLE DOUBLE encoding=GORILLA,`开关量-运行_BOOLEAN` BOOLEAN encoding=RLE,code_DOUBLE DOUBLE encoding=GORILLA);", + "insert into root.db(time,code_DOUBLE) aligned values(1679477545000,2.0);", + "insert into root.db(time,`NH4-N_DOUBLE`) aligned values(1679365910000,12.0);", + "create timeseries root.db.d1.s1 with datatype=BLOB;", + "insert into root.db.d1(time,s1) values(1,X'cafebabe')", }; @BeforeClass @@ -155,10 +155,10 @@ public void testLastQuery1() { new String[] {TIMESTAMP_STR, TIMESERIES_STR, VALUE_STR, DATA_TYPE_STR}; String[] retArray = new String[] { - "1679365910000,root.sg.`NH4-N_DOUBLE`,12.0,DOUBLE,", - "1679477545000,root.sg.code_DOUBLE,2.0,DOUBLE,", + "1679365910000,root.db.`NH4-N_DOUBLE`,12.0,DOUBLE,", + "1679477545000,root.db.code_DOUBLE,2.0,DOUBLE,", }; - resultSetEqualTest("select last * from root.sg;", expectedHeader, retArray); + resultSetEqualTest("select last * from root.db;", expectedHeader, retArray); } @Test @@ -188,8 +188,8 @@ public void testLastQueryWithBlobType() { new String[] {TIMESTAMP_STR, TIMESERIES_STR, VALUE_STR, DATA_TYPE_STR}; String[] retArray = new String[] { - "1,root.sg.d1.s1,0xcafebabe,BLOB,", + "1,root.db.d1.s1,0xcafebabe,BLOB,", }; - resultSetEqualTest("select last s1 from root.sg.d1;", expectedHeader, retArray); + resultSetEqualTest("select last s1 from root.db.d1;", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryWithLimitOffsetIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryWithLimitOffsetIT.java index 995367f10ad15..f3e9fe3b89153 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryWithLimitOffsetIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryWithLimitOffsetIT.java @@ -47,8 +47,8 @@ public static void setUp() throws Exception { EnvFactory.getEnv().initClusterEnvironment(); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time, s1, s2) values(1, 1, 1)"); - statement.execute("insert into root.sg.d2(time, s1, s2) aligned values(2, 1, 1)"); + statement.execute("insert into root.db.d1(time, s1, s2) values(1, 1, 1)"); + statement.execute("insert into root.db.d2(time, s1, s2) aligned values(2, 1, 1)"); } catch (SQLException e) { e.printStackTrace(); fail(e.getMessage()); @@ -64,14 +64,14 @@ public static void tearDown() throws Exception { public void testWithLimit() { String[] retArray = new String[] { - "1,root.sg.d1.s1,1.0,DOUBLE", + "1,root.db.d1.s1,1.0,DOUBLE", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg.* order by timeseries asc limit 1")) { + statement.executeQuery("select last * from root.db.* order by timeseries asc limit 1")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -95,13 +95,13 @@ public void testWithLimit() { @Test public void testWithOffset() { - String[] retArray = new String[] {"2,root.sg.d2.s2,1.0,DOUBLE"}; + String[] retArray = new String[] {"2,root.db.d2.s2,1.0,DOUBLE"}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg.* order by timeseries asc offset 3")) { + statement.executeQuery("select last * from root.db.* order by timeseries asc offset 3")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -127,7 +127,7 @@ public void testWithOffset() { public void testWithLimitAndOffset() { String[] retArray = new String[] { - "1,root.sg.d1.s2,1.0,DOUBLE", "2,root.sg.d2.s1,1.0,DOUBLE", + "1,root.db.d1.s2,1.0,DOUBLE", "2,root.db.d2.s1,1.0,DOUBLE", }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -135,7 +135,7 @@ public void testWithLimitAndOffset() { try (ResultSet resultSet = statement.executeQuery( - "select last * from root.sg.* order by timeseries asc limit 2 offset 1")) { + "select last * from root.db.* order by timeseries asc limit 2 offset 1")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -164,14 +164,14 @@ public void testWithSLimitOrSOffset() { Statement statement = connection.createStatement()) { try { - statement.executeQuery("select last * from root.sg.* order by timeseries asc slimit 1"); + statement.executeQuery("select last * from root.db.* order by timeseries asc slimit 1"); fail(); } catch (Exception ignored) { } try { - statement.executeQuery("select last * from root.sg.* order by timeseries asc soffset 1"); + statement.executeQuery("select last * from root.db.* order by timeseries asc soffset 1"); fail(); } catch (Exception ignored) { @@ -179,7 +179,7 @@ public void testWithSLimitOrSOffset() { try { statement.executeQuery( - "select last * from root.sg.* order by timeseries asc slimit 1 soffset 1"); + "select last * from root.db.* order by timeseries asc slimit 1 soffset 1"); fail(); } catch (Exception ignored) { @@ -195,7 +195,7 @@ public void testWithSLimitOrSOffset() { public void testWithSortLimit() { String[] retArray = new String[] { - "2,root.sg.d2.s2,1.0,DOUBLE", + "2,root.db.d2.s2,1.0,DOUBLE", }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -203,7 +203,7 @@ public void testWithSortLimit() { try (ResultSet resultSet = statement.executeQuery( - "select last * from root.sg.** order by time desc, timeseries desc limit 1")) { + "select last * from root.db.** order by time desc, timeseries desc limit 1")) { int cnt = 0; while (resultSet.next()) { String ans = diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastWithTTLIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastWithTTLIT.java index b69af5ab0172f..2ba3b7269127c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastWithTTLIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastWithTTLIT.java @@ -48,8 +48,8 @@ public static void setUp() throws Exception { EnvFactory.getEnv().initClusterEnvironment(); try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1(time, s1, s2) values(1, 1, 1)"); - statement.execute("insert into root.sg.d2(time, s1, s2) aligned values(2, 1, 1)"); + statement.execute("insert into root.db.d1(time, s1, s2) values(1, 1, 1)"); + statement.execute("insert into root.db.d2(time, s1, s2) aligned values(2, 1, 1)"); } catch (SQLException e) { e.printStackTrace(); fail(e.getMessage()); @@ -65,17 +65,17 @@ public static void tearDown() throws Exception { public void withTTL() { String[] retArray = new String[] { - "1,root.sg.d1.s1,1.0,DOUBLE", - "1,root.sg.d1.s2,1.0,DOUBLE", - "2,root.sg.d2.s1,1.0,DOUBLE", - "2,root.sg.d2.s2,1.0,DOUBLE" + "1,root.db.d1.s1,1.0,DOUBLE", + "1,root.db.d1.s2,1.0,DOUBLE", + "2,root.db.d2.s1,1.0,DOUBLE", + "2,root.db.d2.s2,1.0,DOUBLE" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg.* order by timeseries asc")) { + statement.executeQuery("select last * from root.db.* order by timeseries asc")) { int cnt = 0; while (resultSet.next()) { String ans = @@ -91,10 +91,10 @@ public void withTTL() { assertEquals(retArray.length, cnt); } - statement.execute("set ttl to root.sg 1"); + statement.execute("set ttl to root.db 1"); try (ResultSet resultSet = - statement.executeQuery("select last * from root.sg.* order by timeseries asc")) { + statement.executeQuery("select last * from root.db.* order by timeseries asc")) { assertFalse(resultSet.next()); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java index 7f84a2df90065..212c11cd33933 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java @@ -50,51 +50,51 @@ public class IoTDBOrderByIT { // https://docs.google.com/spreadsheets/d/1OWA1bKraArCwWVnuTjuhJ5yLG0PFLdD78gD6FjquepI/edit#gid=0 private static final String[] sql = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d.bigNum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d.floatNum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", - "CREATE TIMESERIES root.sg.d.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d.bigNum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d.floatNum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", + "CREATE TIMESERIES root.db.d.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" }; private static final String[] sql2 = new String[] { - "CREATE TIMESERIES root.sg.d2.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.bigNum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.floatNum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", - "CREATE TIMESERIES root.sg.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" + "CREATE TIMESERIES root.db.d2.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.bigNum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.floatNum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", + "CREATE TIMESERIES root.db.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" }; @BeforeClass @@ -164,11 +164,11 @@ private void testNormalOrderBy(String sql, int[] ans) { metaData, new String[] { "Time", - "root.sg.d.num", - "root.sg.d.bigNum", - "root.sg.d.floatNum", - "root.sg.d.str", - "root.sg.d.bool" + "root.db.d.num", + "root.db.d.bigNum", + "root.db.d.floatNum", + "root.db.d.str", + "root.db.d.bool" }); int i = 0; while (resultSet.next()) { @@ -200,35 +200,35 @@ private void testNormalOrderBy(String sql, int[] ans) { // 1. One-level order by test @Test public void orderByTest1() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by num"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by num"; int[] ans = {2, 1, 0, 7, 8, 5, 9, 4, 3, 6, 10, 11, 13, 12, 14}; testNormalOrderBy(sql, ans); } @Test public void orderByTest2() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by bigNum,time"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by bigNum,time"; int[] ans = {13, 11, 10, 3, 1, 5, 4, 7, 9, 8, 2, 12, 0, 6, 14}; testNormalOrderBy(sql, ans); } @Test public void orderByTest3() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by floatNum"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by floatNum"; int[] ans = {2, 3, 11, 13, 10, 8, 7, 9, 0, 12, 6, 14, 1, 5, 4}; testNormalOrderBy(sql, ans); } @Test public void orderByTest4() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by str"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by str"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; testNormalOrderBy(sql, ans); } @Test public void orderByTest5() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by num desc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by num desc"; int[] ans = {2, 1, 0, 7, 8, 5, 9, 4, 3, 6, 10, 11, 13, 12, 14}; testNormalOrderBy(sql, Arrays.reverse(ans)); } @@ -236,28 +236,28 @@ public void orderByTest5() { @Test public void orderByTest6() { String sql = - "select num,bigNum,floatNum,str,bool from root.sg.d order by bigNum desc, time asc"; + "select num,bigNum,floatNum,str,bool from root.db.d order by bigNum desc, time asc"; int[] ans = {6, 14, 0, 12, 2, 8, 9, 7, 4, 5, 1, 3, 10, 11, 13}; testNormalOrderBy(sql, ans); } @Test public void orderByTest7() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by floatNum desc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by floatNum desc"; int[] ans = {2, 3, 11, 13, 10, 8, 7, 9, 0, 12, 6, 14, 1, 5, 4}; testNormalOrderBy(sql, Arrays.reverse(ans)); } @Test public void orderByTest8() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by str desc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by str desc"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; testNormalOrderBy(sql, Arrays.reverse(ans)); } @Test public void orderByTest15() { - String sql = "select num+bigNum,floatNum from root.sg.d order by str"; + String sql = "select num+bigNum,floatNum from root.db.d order by str"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -266,7 +266,7 @@ public void orderByTest15() { ResultSetMetaData metaData = resultSet.getMetaData(); checkHeader( metaData, - new String[] {"Time", "root.sg.d.num + root.sg.d.bigNum", "root.sg.d.floatNum"}); + new String[] {"Time", "root.db.d.num + root.db.d.bigNum", "root.db.d.floatNum"}); int i = 0; while (resultSet.next()) { @@ -292,14 +292,14 @@ public void orderByTest15() { // 2. Multi-level order by test @Test public void orderByTest9() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by bool asc, str asc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by bool asc, str asc"; int[] ans = {3, 12, 0, 8, 7, 10, 6, 11, 2, 5, 9, 13, 4, 1, 14}; testNormalOrderBy(sql, ans); } @Test public void orderByTest10() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by bool asc, num desc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by bool asc, num desc"; int[] ans = {12, 11, 10, 6, 3, 8, 7, 0, 14, 13, 4, 9, 5, 1, 2}; testNormalOrderBy(sql, ans); } @@ -307,7 +307,7 @@ public void orderByTest10() { @Test public void orderByTest11() { String sql = - "select num,bigNum,floatNum,str,bool from root.sg.d order by bigNum desc, floatNum desc"; + "select num,bigNum,floatNum,str,bool from root.db.d order by bigNum desc, floatNum desc"; int[] ans = {14, 6, 0, 12, 2, 8, 9, 7, 4, 5, 1, 3, 10, 11, 13}; testNormalOrderBy(sql, ans); } @@ -315,7 +315,7 @@ public void orderByTest11() { @Test public void orderByTest12() { String sql = - "select num,bigNum,floatNum,str,bool from root.sg.d order by str desc, floatNum desc"; + "select num,bigNum,floatNum,str,bool from root.db.d order by str desc, floatNum desc"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; testNormalOrderBy(sql, Arrays.reverse(ans)); } @@ -323,20 +323,20 @@ public void orderByTest12() { @Test public void orderByTest13() { String sql = - "select num,bigNum,floatNum,str,bool from root.sg.d order by num+floatNum desc, floatNum desc"; + "select num,bigNum,floatNum,str,bool from root.db.d order by num+floatNum desc, floatNum desc"; int[] ans = {4, 5, 1, 14, 12, 6, 0, 9, 7, 13, 10, 8, 11, 3, 2}; testNormalOrderBy(sql, ans); } @Test public void orderByTest14() { - String sql = "select num+bigNum from root.sg.d order by num+floatNum desc, floatNum desc"; + String sql = "select num+bigNum from root.db.d order by num+floatNum desc, floatNum desc"; int[] ans = {4, 5, 1, 14, 12, 6, 0, 9, 7, 13, 10, 8, 11, 3, 2}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { ResultSetMetaData metaData = resultSet.getMetaData(); - checkHeader(metaData, new String[] {"Time", "root.sg.d.num + root.sg.d.bigNum"}); + checkHeader(metaData, new String[] {"Time", "root.db.d.num + root.db.d.bigNum"}); int i = 0; while (resultSet.next()) { @@ -359,13 +359,13 @@ public void orderByTest14() { @Test public void orderByTest16() { - String sql = "select num+floatNum from root.sg.d order by floatNum+num desc, floatNum desc"; + String sql = "select num+floatNum from root.db.d order by floatNum+num desc, floatNum desc"; int[] ans = {4, 5, 1, 14, 12, 6, 0, 9, 7, 13, 10, 8, 11, 3, 2}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { ResultSetMetaData metaData = resultSet.getMetaData(); - checkHeader(metaData, new String[] {"Time", "root.sg.d.num + root.sg.d.floatNum"}); + checkHeader(metaData, new String[] {"Time", "root.db.d.num + root.db.d.floatNum"}); int i = 0; while (resultSet.next()) { @@ -390,14 +390,14 @@ public void orderByTest16() { @Test public void orderByTest17() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by str desc, str asc"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by str desc, str asc"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; testNormalOrderBy(sql, Arrays.reverse(ans)); } @Test public void orderByTest18() { - String sql = "select num,bigNum,floatNum,str,bool from root.sg.d order by str, str"; + String sql = "select num,bigNum,floatNum,str,bool from root.db.d order by str, str"; int[] ans = {3, 2, 5, 12, 0, 9, 13, 8, 4, 7, 1, 10, 6, 11, 14}; testNormalOrderBy(sql, ans); } @@ -405,13 +405,13 @@ public void orderByTest18() { // limit cannot be pushed down in ORDER BY @Test public void orderByTest19() { - String sql = "select num from root.sg.d order by num limit 5"; + String sql = "select num from root.db.d order by num limit 5"; int[] ans = {2, 1, 0, 7, 8}; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { ResultSetMetaData metaData = resultSet.getMetaData(); - checkHeader(metaData, new String[] {"Time", "root.sg.d.num"}); + checkHeader(metaData, new String[] {"Time", "root.db.d.num"}); int i = 0; while (resultSet.next()) { String actualTime = resultSet.getString(1); @@ -431,7 +431,7 @@ public void orderByTest19() { // 3. aggregation query @Test public void orderByInAggregationTest() { - String sql = "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc"; + String sql = "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc"; double[][] ans = new double[][] {{15.0}, {13.0}, {13.0}, {11.0}, {6.4}, {4.6}}; long[] times = new long[] {51536000000L, 41536000000L, 41536900000L, 31536100000L, 31536000000L, 0L}; @@ -457,7 +457,7 @@ public void orderByInAggregationTest() { @Test public void orderByInAggregationTest2() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12}, @@ -491,7 +491,7 @@ public void orderByInAggregationTest2() { @Test public void orderByInAggregationTest3() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; double[] ans = new double[] {15.0, 13.0, 13.0, 11.0, 6.4, 4.6}; long[] times = new long[] {51536000000L, 41536900000L, 41536000000L, 31536100000L, 31536000000L, 0L}; @@ -517,7 +517,7 @@ public void orderByInAggregationTest3() { @Test public void orderByInAggregationTest4() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -545,7 +545,7 @@ public void orderByInAggregationTest4() { @Test public void orderByInAggregationTest5() { String sql = - "select min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483646L, 2147483650L, 2147468648L, 2146483648L, 2107483648L, 3147483648L}; long[] times = @@ -573,7 +573,7 @@ public void orderByInAggregationTest5() { @Test public void orderByInAggregationTest6() { String sql = - "select min_value(num)+min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(num)+min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483647L, 2147483654L, 2147468659L, 2146483660L, 2107483661L, 3147483663L}; long[] times = @@ -601,7 +601,7 @@ public void orderByInAggregationTest6() { @Test public void orderByInAggregationTest7() { String sql = - "select avg(num)+min_value(floatNum) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num)+min_value(floatNum) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12, 54.12}, @@ -635,7 +635,7 @@ public void orderByInAggregationTest7() { @Test public void orderByInAggregationTest8() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(floatNum)+avg(num)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(floatNum)+avg(num)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -670,7 +670,7 @@ private void testNormalOrderByAlignByDevice(String sql, int[] ans) { metaData, new String[] {"Time", "Device", "num", "bigNum", "floatNum", "str", "bool"}); int i = 0; int total = 0; - String device = "root.sg.d"; + String device = "root.db.d"; while (resultSet.next()) { String actualTime = resultSet.getString(1); @@ -689,10 +689,10 @@ private void testNormalOrderByAlignByDevice(String sql, int[] ans) { assertEquals(res[ans[i]][4], actualStr); assertEquals(res[ans[i]][5], actualBool); - if (device.equals("root.sg.d")) { - device = "root.sg.d2"; + if (device.equals("root.db.d")) { + device = "root.db.d2"; } else { - device = "root.sg.d"; + device = "root.db.d"; i++; } total++; @@ -711,7 +711,7 @@ public void alignByDeviceOrderByTest1() { String sql = "select num+bigNum from root.** order by num+floatNum desc, floatNum desc align by device"; int[] ans = {4, 5, 1, 14, 12, 6, 0, 9, 7, 13, 10, 8, 11, 3, 2}; - String device = "root.sg.d"; + String device = "root.db.d"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { @@ -725,10 +725,10 @@ public void alignByDeviceOrderByTest1() { assertEquals(res[ans[i]][0], actualTime); assertEquals( Long.parseLong(res[ans[i]][1]) + Long.parseLong(res[ans[i]][2]), actualNum, 0.0001); - if (device.equals("root.sg.d")) { - device = "root.sg.d2"; + if (device.equals("root.db.d")) { + device = "root.db.d2"; } else { - device = "root.sg.d"; + device = "root.db.d"; i++; } } @@ -811,7 +811,7 @@ private void testNormalOrderByMixAlignBy(String sql, int[] ans) { metaData, new String[] {"Time", "Device", "num", "bigNum", "floatNum", "str", "bool"}); int i = 0; int total = 0; - String device = "root.sg.d"; + String device = "root.db.d"; while (resultSet.next()) { String actualTime = resultSet.getString(1); @@ -830,11 +830,11 @@ private void testNormalOrderByMixAlignBy(String sql, int[] ans) { assertEquals(res[ans[i]][4], actualStr); assertEquals(res[ans[i]][5], actualBool); - if (device.equals("root.sg.d2")) { + if (device.equals("root.db.d2")) { i++; - device = "root.sg.d"; + device = "root.db.d"; } else { - device = "root.sg.d2"; + device = "root.db.d2"; } total++; @@ -857,7 +857,7 @@ private void testDeviceViewOrderByMixAlignBy(String sql, int[] ans) { metaData, new String[] {"Time", "Device", "num", "bigNum", "floatNum", "str", "bool"}); int i = 0; int total = 0; - String device = "root.sg.d2"; + String device = "root.db.d2"; while (resultSet.next()) { String actualTime = resultSet.getString(1); @@ -880,10 +880,10 @@ private void testDeviceViewOrderByMixAlignBy(String sql, int[] ans) { total++; if (total == ans.length) { i = 0; - if (device.equals("root.sg.d2")) { - device = "root.sg.d"; + if (device.equals("root.db.d2")) { + device = "root.db.d"; } else { - device = "root.sg.d2"; + device = "root.db.d2"; } } } @@ -905,7 +905,7 @@ private void orderByBigNumAlignByDevice(String sql, int[] ans) { metaData, new String[] {"Time", "Device", "num", "bigNum", "floatNum", "str", "bool"}); int i = 0; int total = 0; - String device = "root.sg.d"; + String device = "root.db.d"; while (resultSet.next()) { String actualTime = resultSet.getString(1); @@ -919,9 +919,9 @@ private void orderByBigNumAlignByDevice(String sql, int[] ans) { if (total < 4) { i = total % 2; if (total < 2) { - device = "root.sg.d2"; + device = "root.db.d2"; } else { - device = "root.sg.d"; + device = "root.db.d"; } } @@ -933,11 +933,11 @@ private void orderByBigNumAlignByDevice(String sql, int[] ans) { assertEquals(res[ans[i]][4], actualStr); assertEquals(res[ans[i]][5], actualBool); - if (device.equals("root.sg.d2")) { - device = "root.sg.d"; + if (device.equals("root.db.d2")) { + device = "root.db.d"; } else { i++; - device = "root.sg.d2"; + device = "root.db.d2"; } total++; @@ -1023,18 +1023,18 @@ public void orderByInAggregationAlignByDeviceTest() { }; String[] device = new String[] { - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d", - "root.sg.d2", - "root.sg.d2", - "root.sg.d", - "root.sg.d2" + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d", + "root.db.d2", + "root.db.d2", + "root.db.d", + "root.db.d2" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -1066,8 +1066,8 @@ public void orderByInAggregationAlignByDeviceTest2() { } private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { - String device = "root.sg.d"; - if (!deviceAsc) device = "root.sg.d2"; + String device = "root.db.d"; + if (!deviceAsc) device = "root.db.d2"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { @@ -1077,8 +1077,8 @@ private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { double actualVal = resultSet.getDouble(2); assertEquals(deviceName, device); assertEquals(Double.parseDouble(value.toString()), actualVal, 1); - if (device.equals("root.sg.d")) device = "root.sg.d2"; - else device = "root.sg.d"; + if (device.equals("root.db.d")) device = "root.db.d2"; + else device = "root.db.d"; i++; } assertEquals(i, 2); @@ -1242,7 +1242,7 @@ private void orderByUDFTest(String sql, int[] ans) { @Test public void orderByUDFTest1() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; int[] ans = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 11, 12, 14}; orderByUDFTest(sql, ans); } @@ -1250,7 +1250,7 @@ public void orderByUDFTest1() { @Test public void orderByUDFTest2() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; int[] ans = {12, 14, 13, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; orderByUDFTest(sql, ans); } @@ -1267,22 +1267,22 @@ private void errorTest(String sql, String error) { @Test public void errorTest1() { errorTest( - "select num from root.sg.d order by avg(bigNum)", + "select num from root.db.d order by avg(bigNum)", "701: Raw data and aggregation hybrid query is not supported."); } @Test public void errorTest2() { errorTest( - "select avg(num) from root.sg.d order by bigNum", + "select avg(num) from root.db.d order by bigNum", "701: Raw data and aggregation hybrid query is not supported."); } @Test public void errorTest3() { errorTest( - "select bigNum,floatNum from root.sg.d order by s1", - "701: root.sg.d.s1 in order by clause doesn't exist."); + "select bigNum,floatNum from root.db.d order by s1", + "701: root.db.d.s1 in order by clause doesn't exist."); } @Test @@ -1302,15 +1302,15 @@ public void errorTest5() { @Test public void errorTest6() { errorTest( - "select bigNum,floatNum from root.** order by root.sg.d.bigNum align by device", + "select bigNum,floatNum from root.** order by root.db.d.bigNum align by device", "701: ALIGN BY DEVICE: the suffix paths can only be measurement or one-level wildcard"); } @Test public void errorTest7() { errorTest( - "select last bigNum,floatNum from root.** order by root.sg.d.bigNum", - "701: root.sg.d.bigNum in order by clause doesn't exist in the result of last query."); + "select last bigNum,floatNum from root.** order by root.db.d.bigNum", + "701: root.db.d.bigNum in order by clause doesn't exist in the result of last query."); } // last query @@ -1345,7 +1345,7 @@ public void lastQueryOrderBy() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d.num", "root.sg.d2.num", "root.sg.d.bigNum", "root.sg.d2.bigNum"}, + {"root.db.d.num", "root.db.d2.num", "root.db.d.bigNum", "root.db.d2.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1358,7 +1358,7 @@ public void lastQueryOrderBy2() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1371,7 +1371,7 @@ public void lastQueryOrderBy3() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1384,7 +1384,7 @@ public void lastQueryOrderBy4() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1397,7 +1397,7 @@ public void lastQueryOrderBy5() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBAliasIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBAliasIT.java index 0ddb6ea2f24c0..b34306fb2ff39 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBAliasIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBAliasIT.java @@ -50,40 +50,40 @@ public class IoTDBAliasIT { private static final String[] SQLs = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1(speed) WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d1.s2(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.s1(speed) WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.s2(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.s3(power) WITH DATATYPE=FLOAT, ENCODING=RLE", - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(100, 10.1, 20.7)", - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(200, 15.2, 22.9)", - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(300, 30.3, 25.1)", - "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(400, 50.4, 28.3)", - "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(100, 11.1, 20.2, 80.0)", - "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(200, 20.2, 21.8, 81.0)", - "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(300, 45.3, 23.4, 82.0)", - "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(400, 73.4, 26.3, 83.0)", - "CREATE DATABASE root.sg1", - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (0, -1, 1)", - "INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (1, -2, 2)", - "INSERT INTO root.sg1.d1(timestamp, s1, s2) VALUES (2, -3, 3)", - "CREATE DATABASE root.sg2", - "CREATE TIMESERIES root.sg2.d1.s1 WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg2.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg2.d2.s1 WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg2.d2.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg2.d2.s3 WITH DATATYPE=FLOAT, ENCODING=RLE", - "INSERT INTO root.sg2.d1(timestamp,s1,s2) values(100, 10.1, 20.7)", - "INSERT INTO root.sg2.d1(timestamp,s1,s2) values(200, 15.2, 22.9)", - "INSERT INTO root.sg2.d1(timestamp,s1,s2) values(300, 30.3, 25.1)", - "INSERT INTO root.sg2.d1(timestamp,s1,s2) values(400, 50.4, 28.3)", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(100, 11.1, 20.2, 80.0)", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(200, 20.2, 21.8, 81.0)", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(300, 45.3, 23.4, 82.0)", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(400, 73.4, 26.3, 83.0)" + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1(speed) WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db.d1.s2(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.s1(speed) WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.s2(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.s3(power) WITH DATATYPE=FLOAT, ENCODING=RLE", + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(100, 10.1, 20.7)", + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(200, 15.2, 22.9)", + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(300, 30.3, 25.1)", + "INSERT INTO root.db.d1(timestamp,speed,temperature) values(400, 50.4, 28.3)", + "INSERT INTO root.db.d2(timestamp,speed,temperature,power) values(100, 11.1, 20.2, 80.0)", + "INSERT INTO root.db.d2(timestamp,speed,temperature,power) values(200, 20.2, 21.8, 81.0)", + "INSERT INTO root.db.d2(timestamp,speed,temperature,power) values(300, 45.3, 23.4, 82.0)", + "INSERT INTO root.db.d2(timestamp,speed,temperature,power) values(400, 73.4, 26.3, 83.0)", + "CREATE DATABASE root.db1", + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db1.d1(timestamp, s1, s2) VALUES (0, -1, 1)", + "INSERT INTO root.db1.d1(timestamp, s1, s2) VALUES (1, -2, 2)", + "INSERT INTO root.db1.d1(timestamp, s1, s2) VALUES (2, -3, 3)", + "CREATE DATABASE root.db2", + "CREATE TIMESERIES root.db2.d1.s1 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db2.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db2.d2.s1 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db2.d2.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db2.d2.s3 WITH DATATYPE=FLOAT, ENCODING=RLE", + "INSERT INTO root.db2.d1(timestamp,s1,s2) values(100, 10.1, 20.7)", + "INSERT INTO root.db2.d1(timestamp,s1,s2) values(200, 15.2, 22.9)", + "INSERT INTO root.db2.d1(timestamp,s1,s2) values(300, 30.3, 25.1)", + "INSERT INTO root.db2.d1(timestamp,s1,s2) values(400, 50.4, 28.3)", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(100, 11.1, 20.2, 80.0)", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(200, 20.2, 21.8, 81.0)", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(300, 45.3, 23.4, 82.0)", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(400, 73.4, 26.3, 83.0)" }; private static final String LAST_QUERY_HEADER = "Time,timeseries,value,dataType,"; @@ -103,32 +103,32 @@ public static void tearDown() throws Exception { @Test public void rawDataQueryAliasTest() { - String expectedHeader = "Time,root.sg.d1.speed,root.sg.d1.temperature,"; + String expectedHeader = "Time,root.db.d1.speed,root.db.d1.temperature,"; String[] retArray = new String[] {"100,10.1,20.7,", "200,15.2,22.9,", "300,30.3,25.1,", "400,50.4,28.3,"}; - resultSetEqualTest("select speed, temperature from root.sg.d1", expectedHeader, retArray); + resultSetEqualTest("select speed, temperature from root.db.d1", expectedHeader, retArray); } @Test public void rawDataQueryWithDuplicatedColumnsAliasTest() { - String expectedHeader = "Time,root.sg.d1.speed,root.sg.d1.speed,root.sg.d1.s2,"; + String expectedHeader = "Time,root.db.d1.speed,root.db.d1.speed,root.db.d1.s2,"; String[] retArray = new String[] { "100,10.1,10.1,20.7,", "200,15.2,15.2,22.9,", "300,30.3,30.3,25.1,", "400,50.4,50.4,28.3," }; - resultSetEqualTest("select speed, speed, s2 from root.sg.d1", expectedHeader, retArray); + resultSetEqualTest("select speed, speed, s2 from root.db.d1", expectedHeader, retArray); } @Test @Ignore // TODO: remove @Ignore after support alias in last query public void lastQueryAliasTest() { String[] retArray = - new String[] {"400,root.sg.d1.speed,50.4", "400,root.sg.d1.temperature,28.3"}; + new String[] {"400,root.db.d1.speed,50.4", "400,root.db.d1.temperature,28.3"}; resultSetEqualTest( - "select last speed, temperature from root.sg.d1", LAST_QUERY_HEADER, retArray); + "select last speed, temperature from root.db.d1", LAST_QUERY_HEADER, retArray); } @Test @@ -136,22 +136,22 @@ public void lastQueryAliasTest() { public void lastQueryWithDuplicatedColumnsAliasTest() { String[] retArray = new String[] { - "400,root.sg.d1.speed,50.4", "400,root.sg.d1.s1,50.4", "400,root.sg.d1.s2,28.3" + "400,root.db.d1.speed,50.4", "400,root.db.d1.s1,50.4", "400,root.db.d1.s2,28.3" }; resultSetEqualTest( - "select last speed, s1, speed, s2 from root.sg.d1", LAST_QUERY_HEADER, retArray); + "select last speed, s1, speed, s2 from root.db.d1", LAST_QUERY_HEADER, retArray); } @Test public void aggregationQueryAliasTest() { String expectedHeader = - "count(root.sg.d1.speed),count(root.sg.d2.speed),max_value(root.sg.d1.temperature)," - + "max_value(root.sg.d2.temperature),"; + "count(root.db.d1.speed),count(root.db.d2.speed),max_value(root.db.d1.temperature)," + + "max_value(root.db.d2.temperature),"; String[] retArray = new String[] {"4,4,28.3,26.3,"}; resultSetEqualTest( - "select count(speed), max_value(temperature) from root.sg.*", expectedHeader, retArray); + "select count(speed), max_value(temperature) from root.db.*", expectedHeader, retArray); } @Test @@ -160,10 +160,10 @@ public void alterAliasTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("ALTER timeseries root.sg.d2.s3 UPSERT ALIAS='powerNew'"); + statement.execute("ALTER timeseries root.db.d2.s3 UPSERT ALIAS='powerNew'"); - try (ResultSet resultSet = statement.executeQuery("select powerNew from root.sg.d2")) { - assertResultSetEqual(resultSet, "Time,root.sg.d2.powerNew,", retArray); + try (ResultSet resultSet = statement.executeQuery("select powerNew from root.db.d2")) { + assertResultSetEqual(resultSet, "Time,root.db.d2.powerNew,", retArray); } } catch (SQLException e) { fail(e.getMessage()); @@ -178,8 +178,8 @@ public void rawDataQueryAsTest1() { String expectedHeader = "Time,power,"; String[] retArray = new String[] {"100,80.0,", "200,81.0,", "300,82.0,", "400,83.0,"}; - // root.sg.*.s3 matches root.sg.d2.s3 exactly - resultSetEqualTest("select s3 as power from root.sg2.*", expectedHeader, retArray); + // root.db.*.s3 matches root.db.d2.s3 exactly + resultSetEqualTest("select s3 as power from root.db2.*", expectedHeader, retArray); } @Test @@ -189,22 +189,22 @@ public void rawDataQueryAsTest2() { new String[] {"100,10.1,20.7,", "200,15.2,22.9,", "300,30.3,25.1,", "400,50.4,28.3,"}; resultSetEqualTest( - "select s1 as speed, s2 as temperature from root.sg2.d1", expectedHeader, retArray); + "select s1 as speed, s2 as temperature from root.db2.d1", expectedHeader, retArray); } @Test public void rawDataQueryAsTest3() { - String expectedHeader = "Time,speed,root.sg2.d1.s2,"; + String expectedHeader = "Time,speed,root.db2.d1.s2,"; String[] retArray = new String[] {"100,10.1,20.7,", "200,15.2,22.9,", "300,30.3,25.1,", "400,50.4,28.3,"}; - resultSetEqualTest("select s1 as speed, s2 from root.sg2.d1", expectedHeader, retArray); + resultSetEqualTest("select s1 as speed, s2 from root.db2.d1", expectedHeader, retArray); } @Test public void rawDataQueryAsFailTest() { assertTestFail( - "select s1 as speed from root.sg2.*", + "select s1 as speed from root.db2.*", "alias 'speed' can only be matched with one time series"); } @@ -217,16 +217,16 @@ public void aggregationQueryAsTest() { }; resultSetEqualTest( - "select count(s1) as s1_num, max_value(s2) as s2_max from root.sg2.d1", + "select count(s1) as s1_num, max_value(s2) as s2_max from root.db2.d1", expectedHeader, retArray); } @Test public void aggregationQueryAsFailTest() { - // root.sg2.*.s1 matches root.sg2.d1.s1 and root.sg2.d2.s1 both + // root.db2.*.s1 matches root.db2.d1.s1 and root.db2.d2.s1 both assertTestFail( - "select count(s1) as s1_num from root.sg2.*", + "select count(s1) as s1_num from root.db2.*", "alias 's1_num' can only be matched with one time series"); } @@ -239,7 +239,7 @@ public void groupByQueryAsTest() { }; resultSetEqualTest( - "select count(s1) as 's1_num' from root.sg2.d1 group by ([100,500), 80ms)", + "select count(s1) as 's1_num' from root.db2.d1 group by ([100,500), 80ms)", expectedHeader, retArray); } @@ -249,14 +249,14 @@ public void alignByDeviceQueryAsTest1() { String expectedHeader = "Time,Device,speed,temperature,"; String[] retArray = new String[] { - "100,root.sg2.d1,10.1,20.7,", - "200,root.sg2.d1,15.2,22.9,", - "300,root.sg2.d1,30.3,25.1,", - "400,root.sg2.d1,50.4,28.3," + "100,root.db2.d1,10.1,20.7,", + "200,root.db2.d1,15.2,22.9,", + "300,root.db2.d1,30.3,25.1,", + "400,root.db2.d1,50.4,28.3," }; resultSetEqualTest( - "select s1 as speed, s2 as temperature from root.sg2.d1 align by device", + "select s1 as speed, s2 as temperature from root.db2.d1 align by device", expectedHeader, retArray); } @@ -266,18 +266,18 @@ public void alignByDeviceQueryAsTest2() { String expectedHeader = "Time,Device,speed,s2,"; String[] retArray = new String[] { - "100,root.sg2.d1,10.1,20.7,", - "200,root.sg2.d1,15.2,22.9,", - "300,root.sg2.d1,30.3,25.1,", - "400,root.sg2.d1,50.4,28.3,", - "100,root.sg2.d2,11.1,20.2,", - "200,root.sg2.d2,20.2,21.8,", - "300,root.sg2.d2,45.3,23.4,", - "400,root.sg2.d2,73.4,26.3," + "100,root.db2.d1,10.1,20.7,", + "200,root.db2.d1,15.2,22.9,", + "300,root.db2.d1,30.3,25.1,", + "400,root.db2.d1,50.4,28.3,", + "100,root.db2.d2,11.1,20.2,", + "200,root.db2.d2,20.2,21.8,", + "300,root.db2.d2,45.3,23.4,", + "400,root.db2.d2,73.4,26.3," }; resultSetEqualTest( - "select s1 as speed, s2 from root.sg2.* align by device", expectedHeader, retArray); + "select s1 as speed, s2 from root.db2.* align by device", expectedHeader, retArray); } @Test @@ -286,41 +286,41 @@ public void alignByDeviceQueryAsTest3() { String expectedHeader = "Time,Device,speed,s1,"; String[] retArray = new String[] { - "100,root.sg2.d1,10.1,10.1,", - "200,root.sg2.d1,15.2,15.2,", - "300,root.sg2.d1,30.3,30.3,", - "400,root.sg2.d1,50.4,50.4," + "100,root.db2.d1,10.1,10.1,", + "200,root.db2.d1,15.2,15.2,", + "300,root.db2.d1,30.3,30.3,", + "400,root.db2.d1,50.4,50.4," }; resultSetEqualTest( - "select s1 as speed, s1 from root.sg2.d1 align by device", expectedHeader, retArray); + "select s1 as speed, s1 from root.db2.d1 align by device", expectedHeader, retArray); } @Test public void alignByDeviceQueryAsTest4() { String expectedHeader = "Device,s1_num,count(s2),s3_num,"; - String[] retArray = new String[] {"root.sg2.d2,4,4,4,"}; + String[] retArray = new String[] {"root.db2.d2,4,4,4,"}; resultSetEqualTest( - "select count(s1) as s1_num, count(s2), count(s3) as s3_num from root.sg2.d2 align by device", + "select count(s1) as s1_num, count(s2), count(s3) as s3_num from root.db2.d2 align by device", expectedHeader, retArray); } @Test public void alignByDeviceQueryAsFailTest() { - // root.sg.*.s1 matches root.sg.d1.s1 and root.sg.d2.s1 both + // root.db.*.s1 matches root.db.d1.s1 and root.db.d2.s1 both assertTestFail( - "select * as speed from root.sg2.d1 align by device", + "select * as speed from root.db2.d1 align by device", "can only be matched with one time series"); } @Test @Ignore // TODO: remove @Ignore after support alias in last query public void lastQueryAsTest() { - String[] retArray = new String[] {"400,speed,50.4,FLOAT,", "400,root.sg2.d1.s2,28.3,FLOAT,"}; + String[] retArray = new String[] {"400,speed,50.4,FLOAT,", "400,root.db2.d1.s2,28.3,FLOAT,"}; - resultSetEqualTest("select last s1 as speed, s2 from root.sg2.d1", LAST_QUERY_HEADER, retArray); + resultSetEqualTest("select last s1 as speed, s2 from root.db2.d1", LAST_QUERY_HEADER, retArray); } @Test @@ -328,11 +328,11 @@ public void lastQueryAsTest() { public void lastQueryAsTest2() { String[] retArray = new String[] { - "400,speed,50.4,FLOAT,", "400,root.sg2.d1.s1,50.4,FLOAT,", "400,temperature,28.3,FLOAT," + "400,speed,50.4,FLOAT,", "400,root.db2.d1.s1,50.4,FLOAT,", "400,temperature,28.3,FLOAT," }; resultSetEqualTest( - "select last s1 as speed, s1, s2 as temperature from root.sg2.d1", + "select last s1 as speed, s1, s2 as temperature from root.db2.d1", LAST_QUERY_HEADER, retArray); } @@ -340,9 +340,9 @@ public void lastQueryAsTest2() { @Test @Ignore // TODO: remove @Ignore after support alias in last query public void lastQueryAsFailTest() { - // root.sg2.*.s1 matches root.sg2.d1.s1 and root.sg2.d2.s1 both + // root.db2.*.s1 matches root.db2.d1.s1 and root.db2.d2.s1 both assertTestFail( - "select last s1 as speed from root.sg2.*", + "select last s1 as speed from root.db2.*", "alias 'speed' can only be matched with one time series"); } @@ -350,16 +350,16 @@ public void lastQueryAsFailTest() { public void UDFQueryAsTest() { List sqls = Arrays.asList( - "select -s1, sin(cos(tan(s1))) as a, cos(s2), top_k(s1 + s1, 'k'='1') as b from root.sg1.d1 WHERE time >= 1509466140000", - "select -s1, sin(cos(tan(s1))) as a, cos(s2), top_k(s1 + s1, 'k'='1') as b from root.sg1.d1", - "select -s1, -s1, sin(cos(tan(s1))) as a, sin(cos(tan(s1))), cos(s2), top_k(s1 + s1, 'k'='1') as b, cos(s2) from root.sg1.d1", - "select s1, s2, sin(s1+s2) as a from root.sg1.d1"); + "select -s1, sin(cos(tan(s1))) as a, cos(s2), top_k(s1 + s1, 'k'='1') as b from root.db1.d1 WHERE time >= 1509466140000", + "select -s1, sin(cos(tan(s1))) as a, cos(s2), top_k(s1 + s1, 'k'='1') as b from root.db1.d1", + "select -s1, -s1, sin(cos(tan(s1))) as a, sin(cos(tan(s1))), cos(s2), top_k(s1 + s1, 'k'='1') as b, cos(s2) from root.db1.d1", + "select s1, s2, sin(s1+s2) as a from root.db1.d1"); List expectHeaders = Arrays.asList( - "Time,-root.sg1.d1.s1,a,cos(root.sg1.d1.s2),b,", - "Time,-root.sg1.d1.s1,a,cos(root.sg1.d1.s2),b,", - "Time,-root.sg1.d1.s1,-root.sg1.d1.s1,a,sin(cos(tan(root.sg1.d1.s1))),cos(root.sg1.d1.s2),b,cos(root.sg1.d1.s2),", - "Time,root.sg1.d1.s1,root.sg1.d1.s2,a,"); + "Time,-root.db1.d1.s1,a,cos(root.db1.d1.s2),b,", + "Time,-root.db1.d1.s1,a,cos(root.db1.d1.s2),b,", + "Time,-root.db1.d1.s1,-root.db1.d1.s1,a,sin(cos(tan(root.db1.d1.s1))),cos(root.db1.d1.s2),b,cos(root.db1.d1.s2),", + "Time,root.db1.d1.s1,root.db1.d1.s2,a,"); List retArrays = Arrays.asList( new String[] {}, @@ -387,24 +387,24 @@ public void UDFQueryAsTest() { @Test public void aggregationFuncNameTest() { String expectedHeader = - "count(root.sg.d1.temperature),count(root.sg.d2.temperature)," - + "COUNT(root.sg.d1.s2),COUNT(root.sg.d2.s2)," - + "CoUnT(root.sg.d1.temperature),CoUnT(root.sg.d2.temperature),"; + "count(root.db.d1.temperature),count(root.db.d2.temperature)," + + "COUNT(root.db.d1.s2),COUNT(root.db.d2.s2)," + + "CoUnT(root.db.d1.temperature),CoUnT(root.db.d2.temperature),"; String[] retArray = new String[] {"4,4,4,4,4,4,"}; resultSetEqualTest( - "select count(temperature),COUNT(s2),CoUnT(temperature) from root.sg.*", + "select count(temperature),COUNT(s2),CoUnT(temperature) from root.db.*", expectedHeader, retArray); } @Test public void groupByLevelFuncNameTest() { - String expectedHeader = "count(root.sg.*.s2),COUNT(root.sg.*.temperature),CoUnT(root.sg.*.s2),"; + String expectedHeader = "count(root.db.*.s2),COUNT(root.db.*.temperature),CoUnT(root.db.*.s2),"; String[] retArray = new String[] {"8,8,8,"}; resultSetEqualTest( - "select count(s2),COUNT(temperature),CoUnT(s2) from root.sg.* group by level = 1", + "select count(s2),COUNT(temperature),CoUnT(s2) from root.db.* group by level = 1", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticIT.java index 6c54b7f187535..ee3a819ea16d5 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBArithmeticIT.java @@ -51,19 +51,19 @@ public class IoTDBArithmeticIT { private static final String[] INSERTION_SQLS = { "CREATE DATABASE root.test", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s7 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s8 WITH DATATYPE=INT32, ENCODING=PLAIN", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7) values (1, 1, 1, 1, 1, false, '1', 1)", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s8) values (2, 2, 2, 2, 2, false, '2', 2)", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7) values (3, 3, 3, 3, 3, true, '3', 3)", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s8) values (4, 4, 4, 4, 4, true, '4', 4)", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (5, 5, 5, 5, 5, true, '5', 5, 5)", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s7 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s8 WITH DATATYPE=INT32, ENCODING=PLAIN", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7) values (1, 1, 1, 1, 1, false, '1', 1)", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s8) values (2, 2, 2, 2, 2, false, '2', 2)", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7) values (3, 3, 3, 3, 3, true, '3', 3)", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s8) values (4, 4, 4, 4, 4, true, '4', 4)", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (5, 5, 5, 5, 5, true, '5', 5, 5)", }; @BeforeClass @@ -90,7 +90,7 @@ public void testArithmeticBinary() { expressions.add(leftOperand + operator + rightOperand); } } - String sql = String.format("select %s from root.sg.d1", String.join(",", expressions)); + String sql = String.format("select %s from root.db.d1", String.join(",", expressions)); ResultSet resultSet = statement.executeQuery(sql); @@ -132,7 +132,7 @@ public void testArithmeticUnary() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { String[] expressions = new String[] {"- s1", "- s2", "- s3", "- s4"}; - String sql = String.format("select %s from root.sg.d1", String.join(",", expressions)); + String sql = String.format("select %s from root.db.d1", String.join(",", expressions)); ResultSet resultSet = statement.executeQuery(sql); assertEquals(1 + expressions.length, resultSet.getMetaData().getColumnCount()); @@ -156,7 +156,7 @@ public void testHybridQuery() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { String[] expressions = new String[] {"s1", "s1 + s2", "sin(s1)"}; - String sql = String.format("select %s from root.sg.d1", String.join(",", expressions)); + String sql = String.format("select %s from root.db.d1", String.join(",", expressions)); ResultSet resultSet = statement.executeQuery(sql); assertEquals(1 + expressions.length, resultSet.getMetaData().getColumnCount()); @@ -177,7 +177,7 @@ public void testHybridQuery() { public void testNonAlign() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - ResultSet resultSet = statement.executeQuery("select s7 + s8 from root.sg.d1"); + ResultSet resultSet = statement.executeQuery("select s7 + s8 from root.db.d1"); assertEquals(1 + 1, resultSet.getMetaData().getColumnCount()); assertTrue(resultSet.next()); String curr = null; @@ -188,7 +188,7 @@ public void testNonAlign() { assertEquals(10, Double.parseDouble(resultSet.getString(2)), E); assertFalse(resultSet.next()); - resultSet = statement.executeQuery("select s7 + s8 from root.sg.d1 where time < 5"); + resultSet = statement.executeQuery("select s7 + s8 from root.db.d1 where time < 5"); assertEquals(1 + 1, resultSet.getMetaData().getColumnCount()); curr = null; while (curr == null) { @@ -208,7 +208,7 @@ public void testNonAlign() { public void testWrongTypeBoolean() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.executeQuery("select s1 + s5 from root.sg.d1"); + statement.executeQuery("select s1 + s5 from root.db.d1"); } catch (Exception throwable) { assertTrue(throwable.getMessage().contains("Invalid input expression data type.")); } @@ -218,7 +218,7 @@ public void testWrongTypeBoolean() { public void testWrongTypeText() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.executeQuery("select s1 + s6 from root.sg.d1"); + statement.executeQuery("select s1 + s6 from root.db.d1"); } catch (SQLException throwable) { assertTrue(throwable.getMessage().contains("Invalid input expression data type.")); } @@ -228,7 +228,7 @@ public void testWrongTypeText() { public void testNot() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select not(s5), !s5 from root.sg.d1"); ) { + ResultSet resultSet = statement.executeQuery("select not(s5), !s5 from root.db.d1"); ) { String[] retArray = new String[] {"true", "true", "false", "false", "false"}; int cnt = 0; while (resultSet.next()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java index a88b89e90b5da..ea98a85088d26 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java @@ -45,25 +45,25 @@ public class IoTDBCaseWhenThenIT { private static final String[] SQLs = new String[] { // normal cases - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "INSERT INTO root.sg.d1(timestamp,s1) values(0, 0) ", - "INSERT INTO root.sg.d1(timestamp,s1) values(1000000, 11)", - "INSERT INTO root.sg.d1(timestamp,s1) values(20000000, 22)", - "INSERT INTO root.sg.d1(timestamp,s1) values(210000000, 33)", - "INSERT INTO root.sg.d2(timestamp,s3) values(0, 0) ", - "INSERT INTO root.sg.d2(timestamp,s3) values(1000000, 11)", - "INSERT INTO root.sg.d2(timestamp,s3) values(20000000, 22)", - "INSERT INTO root.sg.d2(timestamp,s3) values(210000000, 33)", - "INSERT INTO root.sg.d2(timestamp,s4) values(0, 44)", - "INSERT INTO root.sg.d2(timestamp,s4) values(1000000, 55)", - "INSERT INTO root.sg.d2(timestamp,s4) values(20000000, 66)", - "INSERT INTO root.sg.d2(timestamp,s4) values(210000000, 77)", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s5 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s6 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "INSERT INTO root.db.d1(timestamp,s1) values(0, 0) ", + "INSERT INTO root.db.d1(timestamp,s1) values(1000000, 11)", + "INSERT INTO root.db.d1(timestamp,s1) values(20000000, 22)", + "INSERT INTO root.db.d1(timestamp,s1) values(210000000, 33)", + "INSERT INTO root.db.d2(timestamp,s3) values(0, 0) ", + "INSERT INTO root.db.d2(timestamp,s3) values(1000000, 11)", + "INSERT INTO root.db.d2(timestamp,s3) values(20000000, 22)", + "INSERT INTO root.db.d2(timestamp,s3) values(210000000, 33)", + "INSERT INTO root.db.d2(timestamp,s4) values(0, 44)", + "INSERT INTO root.db.d2(timestamp,s4) values(1000000, 55)", + "INSERT INTO root.db.d2(timestamp,s4) values(20000000, 66)", + "INSERT INTO root.db.d2(timestamp,s4) values(210000000, 77)", }; @BeforeClass @@ -72,7 +72,7 @@ public static void setUp() throws Exception { prepareData(SQLs); List moreSQLs = new ArrayList<>(); for (int i = 0; i < 100; i++) { - moreSQLs.add(String.format("INSERT INTO root.sg.d1(timestamp,s2) values(%d, %d)", i, i)); + moreSQLs.add(String.format("INSERT INTO root.db.d1(timestamp,s2) values(%d, %d)", i, i)); } prepareData(moreSQLs); } @@ -87,34 +87,34 @@ public void testKind1Basic() { String[] expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 ELSE 9999 END" + "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 ELSE 9999 END" }; String[] retArray = new String[] {"0,99.0,", "1000000,9999.0,", "20000000,9999.0,", "210000000,999.0,"}; resultSetEqualTest( - "select case when s1=0 then 99 when s1>22 then 999 else 9999 end from root.sg.d1", + "select case when s1=0 then 99 when s1>22 then 999 else 9999 end from root.db.d1", expectedHeader, retArray); // without ELSE clause expectedHeader = new String[] { - TIMESTAMP_STR, "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 END" + TIMESTAMP_STR, "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 END" }; retArray = new String[] {"0,99.0,", "1000000,null,", "20000000,null,", "210000000,999.0,"}; resultSetEqualTest( - "select case when s1=0 then 99 when s1>22 then 999 end from root.sg.d1", + "select case when s1=0 then 99 when s1>22 then 999 end from root.db.d1", expectedHeader, retArray); } @Test public void testKind2Basic() { - String sql = "select case s1 when 0 then 99 when 22 then 999 else 9999 end from root.sg.d1"; + String sql = "select case s1 when 0 then 99 when 22 then 999 else 9999 end from root.db.d1"; String[] expectedHeader = new String[] { "Time", - "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22 THEN 999 ELSE 9999 END", + "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22 THEN 999 ELSE 9999 END", }; String[] retArray = new String[] { @@ -123,10 +123,10 @@ public void testKind2Basic() { resultSetEqualTest(sql, expectedHeader, retArray); // without ELSE clause - sql = "select case s1 when 0 then 99 when 22 then 999 end from root.sg.d1"; + sql = "select case s1 when 0 then 99 when 22 then 999 end from root.db.d1"; expectedHeader = new String[] { - "Time", "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22 THEN 999 END", + "Time", "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22 THEN 999 END", }; retArray = new String[] { @@ -141,10 +141,10 @@ public void testShortCircuitEvaluation() { new String[] {"0,0.0,", "1000000,11.0,", "20000000,22.0,", "210000000,33.0,"}; String[] expectedHeader = new String[] { - "Time", "CASE WHEN 1 = 0 THEN root.sg.d1.s1 / 0 WHEN 1 != 0 THEN root.sg.d1.s1 END", + "Time", "CASE WHEN 1 = 0 THEN root.db.d1.s1 / 0 WHEN 1 != 0 THEN root.db.d1.s1 END", }; resultSetEqualTest( - "select case when 1=0 then s1/0 when 1!=0 then s1 end from root.sg.d1", + "select case when 1=0 then s1/0 when 1!=0 then s1 end from root.db.d1", expectedHeader, retArray); } @@ -152,18 +152,18 @@ public void testShortCircuitEvaluation() { @Test public void testKind1InputTypeRestrict() { // WHEN clause must return BOOLEAN - String sql = "select case when s1+1 then 20 else 22 end from root.sg.d1"; + String sql = "select case when s1+1 then 20 else 22 end from root.db.d1"; String msg = - "701: The expression in the WHEN clause must return BOOLEAN. expression: root.sg.d1.s1 + 1, actual data type: DOUBLE."; + "701: The expression in the WHEN clause must return BOOLEAN. expression: root.db.d1.s1 + 1, actual data type: DOUBLE."; assertTestFail(sql, msg); } @Test public void testKind2InputTypeRestrict() { // the expression in CASE clause must be able to be equated with the expression in WHEN clause - String sql = "select case s1 when \"1\" then 20 else 22 end from root.sg.d1"; + String sql = "select case s1 when \"1\" then 20 else 22 end from root.db.d1"; String msg = - "701: Invalid input expression data type. expression: root.sg.d1.s1, actual data type: INT32, expected data type(s): [TEXT, STRING]."; + "701: Invalid input expression data type. expression: root.db.d1.s1, actual data type: INT32, expected data type(s): [TEXT, STRING]."; assertTestFail(sql, msg); } @@ -173,35 +173,35 @@ public void testKind1OutputTypeRestrict() { String[] expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 <= 0 THEN true WHEN root.sg.d1.s1 = 11 THEN false ELSE true END" + "CASE WHEN root.db.d1.s1 <= 0 THEN true WHEN root.db.d1.s1 = 11 THEN false ELSE true END" }; String[] retArray = new String[] {"0,true,", "1000000,false,", "20000000,true,", "210000000,true,"}; // success resultSetEqualTest( - "select case when s1<=0 then true when s1=11 then false else true end from root.sg.d1", + "select case when s1<=0 then true when s1=11 then false else true end from root.db.d1", expectedHeader, retArray); // fail assertTestFail( - "select case when s1<=0 then true else 22 end from root.sg.d1", + "select case when s1<=0 then true else 22 end from root.db.d1", "701: CASE expression: BOOLEAN and other types cannot exist at the same time"); // TEXT and other types cannot exist at the same time expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 <= 0 THEN \"good\" WHEN root.sg.d1.s1 = 11 THEN \"bad\" ELSE \"okok\" END" + "CASE WHEN root.db.d1.s1 <= 0 THEN \"good\" WHEN root.db.d1.s1 = 11 THEN \"bad\" ELSE \"okok\" END" }; retArray = new String[] {"0,good,", "1000000,bad,", "20000000,okok,", "210000000,okok,"}; // success resultSetEqualTest( - "select case when s1<=0 then \"good\" when s1=11 then \"bad\" else \"okok\" end from root.sg.d1", + "select case when s1<=0 then \"good\" when s1=11 then \"bad\" else \"okok\" end from root.db.d1", expectedHeader, retArray); // fail assertTestFail( - "select case when s1<=0 then \"good\" else 22 end from root.sg.d1", + "select case when s1<=0 then \"good\" else 22 end from root.db.d1", "701: CASE expression: TEXT and other types cannot exist at the same time"); // 4 numerical types(INT LONG FLOAT DOUBLE) can exist at the same time @@ -211,7 +211,7 @@ public void testKind1OutputTypeRestrict() { "0,99.0,", "1000000,99.9,", "20000000,8.589934588E9,", "210000000,999.9999999999," }; resultSetEqualTest( - "select case when s1=0 then 99 when s1=11 then 99.9 when s1=22 then 8589934588 when s1=33 then 999.9999999999 else 10086 end as `result` from root.sg.d1", + "select case when s1=0 then 99 when s1=11 then 99.9 when s1=22 then 8589934588 when s1=33 then 999.9999999999 else 10086 end as `result` from root.db.d1", expectedHeader, retArray); } @@ -222,7 +222,7 @@ public void testKind2OutputTypeRestrict() { String[] expectedHeader = new String[] { "Time", - "CASE WHEN root.sg.d1.s1 = 0 THEN true WHEN root.sg.d1.s1 = 11 THEN false ELSE true END", + "CASE WHEN root.db.d1.s1 = 0 THEN true WHEN root.db.d1.s1 = 11 THEN false ELSE true END", }; String[] retArray = new String[] { @@ -230,29 +230,29 @@ public void testKind2OutputTypeRestrict() { }; // success resultSetEqualTest( - "select case s1 when 0 then true when 11 then false else true end from root.sg.d1", + "select case s1 when 0 then true when 11 then false else true end from root.db.d1", expectedHeader, retArray); // fail assertTestFail( - "select case s1 when 0 then true else 22 end from root.sg.d1", + "select case s1 when 0 then true else 22 end from root.db.d1", "701: CASE expression: BOOLEAN and other types cannot exist at the same time"); // TEXT and other types cannot exist at the same time expectedHeader = new String[] { "Time", - "CASE WHEN root.sg.d1.s1 = 0 THEN \"good\" WHEN root.sg.d1.s1 = 11 THEN \"bad\" ELSE \"okok\" END", + "CASE WHEN root.db.d1.s1 = 0 THEN \"good\" WHEN root.db.d1.s1 = 11 THEN \"bad\" ELSE \"okok\" END", }; retArray = new String[] {"0,good,", "1000000,bad,", "20000000,okok,", "210000000,okok,"}; // success resultSetEqualTest( - "select case s1 when 0 then \"good\" when 11 then \"bad\" else \"okok\" end from root.sg.d1", + "select case s1 when 0 then \"good\" when 11 then \"bad\" else \"okok\" end from root.db.d1", expectedHeader, retArray); // fail assertTestFail( - "select case s1 when 0 then \"good\" else 22 end from root.sg.d1", + "select case s1 when 0 then \"good\" else 22 end from root.db.d1", "701: CASE expression: TEXT and other types cannot exist at the same time"); // 4 numerical types(INT LONG FLOAT DOUBLE) can exist at the same time @@ -262,7 +262,7 @@ public void testKind2OutputTypeRestrict() { "0,99.0,", "1000000,99.9,", "20000000,8.589934588E9,", "210000000,999.9999999999," }; resultSetEqualTest( - "select case s1 when 0 then 99 when 11 then 99.9 when 22 then 8589934588 when 33 then 999.9999999999 else 10086 end as `result` from root.sg.d1", + "select case s1 when 0 then 99 when 11 then 99.9 when 22 then 8589934588 when 33 then 999.9999999999 else 10086 end as `result` from root.db.d1", expectedHeader, retArray); } @@ -277,10 +277,10 @@ public void testKind1LargeNumberBranches() { for (int i = 0; i < 100; i++) { sqlBuilder.append(String.format("when s2=%d then s2*%d ", i, i * 100)); expectedHeaderBuilder.append( - String.format("WHEN root.sg.d1.s2 = %d THEN root.sg.d1.s2 * %d ", i, i * 100)); + String.format("WHEN root.db.d1.s2 = %d THEN root.db.d1.s2 * %d ", i, i * 100)); retList.add(String.format("%d,%d.0,", i, i * i * 100)); } - sqlBuilder.append("end from root.sg.d1"); + sqlBuilder.append("end from root.db.d1"); expectedHeaderBuilder.append("END"); String[] expectedHeader = new String[] {TIMESTAMP_STR, expectedHeaderBuilder.toString()}; resultSetEqualTest(sqlBuilder.toString(), expectedHeader, retList.toArray(new String[] {})); @@ -296,10 +296,10 @@ public void testKind2LargeNumberBranches() { for (int i = 0; i < 100; i++) { sqlBuilder.append(String.format("when %d then s2*%d ", i, i * 100)); expectedHeaderBuilder.append( - String.format("WHEN root.sg.d1.s2 = %d THEN root.sg.d1.s2 * %d ", i, i * 100)); + String.format("WHEN root.db.d1.s2 = %d THEN root.db.d1.s2 * %d ", i, i * 100)); retList.add(String.format("%d,%d.0,", i, i * i * 100)); } - sqlBuilder.append("end from root.sg.d1"); + sqlBuilder.append("end from root.db.d1"); expectedHeaderBuilder.append("END"); String[] expectedHeader = new String[] {TIMESTAMP_STR, expectedHeaderBuilder.toString()}; resultSetEqualTest(sqlBuilder.toString(), expectedHeader, retList.toArray(new String[] {})); @@ -314,11 +314,11 @@ public void testKind1UsedInOtherOperation() { // use in scalar operation // multiply - sql = "select 2 * case when s1=0 then 99 when s1=22.0 then 999 else 9999 end from root.sg.d1"; + sql = "select 2 * case when s1=0 then 99 when s1=22.0 then 999 else 9999 end from root.db.d1"; expectedHeader = new String[] { TIMESTAMP_STR, - "2 * CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22.0 THEN 999 ELSE 9999 END" + "2 * CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22.0 THEN 999 ELSE 9999 END" }; retArray = new String[] {"0,198.0,", "1000000,19998.0,", "20000000,1998.0,", "210000000,19998.0,"}; @@ -330,11 +330,11 @@ public void testKind1UsedInOtherOperation() { + "case when s1=0 then 99 when s1=22.0 then 999 else 9999 end " + "+" + "case when s1=11 then 99 else 9999 end " - + "from root.sg.d1, root.sg.d2"; + + "from root.db.d1, root.db.d2"; expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22.0 THEN 999 ELSE 9999 END + CASE WHEN root.sg.d1.s1 = 11 THEN 99 ELSE 9999 END" + "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22.0 THEN 999 ELSE 9999 END + CASE WHEN root.db.d1.s1 = 11 THEN 99 ELSE 9999 END" }; retArray = new String[] { @@ -344,7 +344,7 @@ public void testKind1UsedInOtherOperation() { // function sql = - "select diff(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select diff(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {TIMESTAMP_STR, "result"}; retArray = new String[] {"0,null,", "1000000,9900.0,", "20000000,0.0,", "210000000,-9000.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); @@ -353,33 +353,33 @@ public void testKind1UsedInOtherOperation() { // avg sql = - "select avg(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select avg(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {"result"}; retArray = new String[] {"5274.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); // max_value sql = - "select max_value(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select max_value(case when s1=0 then 99 when s1>22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {"result"}; retArray = new String[] {"9999.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); // avg × max_value resultSetEqualTest( - "select avg(case when s1=0 then 99 when s1>22 then 999 else 9999 end) * max_value(case when s1=0 then 99 when s1>22 then 999 else 9999 end) from root.sg.d1", + "select avg(case when s1=0 then 99 when s1>22 then 999 else 9999 end) * max_value(case when s1=0 then 99 when s1>22 then 999 else 9999 end) from root.db.d1", new String[] { - "avg(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 ELSE 9999 END) * max_value(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 ELSE 9999 END)" + "avg(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 ELSE 9999 END) * max_value(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 ELSE 9999 END)" }, new String[] {"5.2734726E7,"}); // UDF is not allowed - sql = "select change_points(case when s1=0 then 99 end) from root.sg.d1"; + sql = "select change_points(case when s1=0 then 99 end) from root.db.d1"; String msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); - sql = "select change_points(s1) + case when s1=0 then 99 end from root.sg.d1"; + sql = "select change_points(s1) + case when s1=0 then 99 end from root.db.d1"; msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); } @@ -393,11 +393,11 @@ public void testKind2UsedInOtherOperation() { // use in scalar operation // multiply - sql = "select 2 * case s1 when 0 then 99 when 22.0 then 999 else 9999 end from root.sg.d1"; + sql = "select 2 * case s1 when 0 then 99 when 22.0 then 999 else 9999 end from root.db.d1"; expectedHeader = new String[] { "Time", - "2 * CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22.0 THEN 999 ELSE 9999 END", + "2 * CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22.0 THEN 999 ELSE 9999 END", }; retArray = new String[] {"0,198.0,", "1000000,19998.0,", "20000000,1998.0,", "210000000,19998.0,"}; @@ -409,11 +409,11 @@ public void testKind2UsedInOtherOperation() { + "case s1 when 0 then 99 when 22.0 then 999 else 9999 end " + "+" + "case s3 when 11 then 99 else 9999 end " - + "from root.sg.d1, root.sg.d2"; + + "from root.db.d1, root.db.d2"; expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22.0 THEN 999 ELSE 9999 END + CASE WHEN root.sg.d2.s3 = 11 THEN 99 ELSE 9999 END" + "CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22.0 THEN 999 ELSE 9999 END + CASE WHEN root.db.d2.s3 = 11 THEN 99 ELSE 9999 END" }; retArray = new String[] { @@ -423,7 +423,7 @@ public void testKind2UsedInOtherOperation() { // function sql = - "select diff(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select diff(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {TIMESTAMP_STR, "result"}; retArray = new String[] { @@ -435,33 +435,33 @@ public void testKind2UsedInOtherOperation() { // avg sql = - "select avg(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select avg(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {"result"}; retArray = new String[] {"5274.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); // max_value sql = - "select max_value(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.sg.d1"; + "select max_value(case s1 when 0 then 99 when 22 then 999 else 9999 end) as `result` from root.db.d1"; expectedHeader = new String[] {"result"}; retArray = new String[] {"9999.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); // avg × max_value resultSetEqualTest( - "select avg(case s1 when 0 then 99 when 22 then 999 else 9999 end) * max_value(case s1 when 0 then 99 when 22 then 999 else 9999 end) from root.sg.d1", + "select avg(case s1 when 0 then 99 when 22 then 999 else 9999 end) * max_value(case s1 when 0 then 99 when 22 then 999 else 9999 end) from root.db.d1", new String[] { - "avg(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22 THEN 999 ELSE 9999 END) * max_value(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 = 22 THEN 999 ELSE 9999 END)" + "avg(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22 THEN 999 ELSE 9999 END) * max_value(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 = 22 THEN 999 ELSE 9999 END)" }, new String[] {"5.2734726E7,"}); // UDF is not allowed - sql = "select change_points(case s1 when 0 then 99 end) from root.sg.d1"; + sql = "select change_points(case s1 when 0 then 99 end) from root.db.d1"; String msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); - sql = "select change_points(s1) + case when s1=0 then 99 end from root.sg.d1"; + sql = "select change_points(s1) + case when s1=0 then 99 end from root.db.d1"; msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); } @@ -469,10 +469,10 @@ public void testKind2UsedInOtherOperation() { @Test public void testKind1UseOtherOperation() { // WHEN-clause use scalar function - String sql = "select case when sin(s1)>=0 then \">0\" else \"<0\" end from root.sg.d1"; + String sql = "select case when sin(s1)>=0 then \">0\" else \"<0\" end from root.db.d1"; String[] expectHeader = new String[] { - TIMESTAMP_STR, "CASE WHEN sin(root.sg.d1.s1) >= 0 THEN \">0\" ELSE \"<0\" END", + TIMESTAMP_STR, "CASE WHEN sin(root.db.d1.s1) >= 0 THEN \">0\" ELSE \"<0\" END", }; String[] retArray = new String[] { @@ -482,7 +482,7 @@ public void testKind1UseOtherOperation() { // THEN-clause and ELSE-clause use scalar function sql = - "select case when s1<=11 then CAST(diff(s1) as TEXT) else CAST(s1-1 as TEXT) end from root.sg.d1 align by device"; + "select case when s1<=11 then CAST(diff(s1) as TEXT) else CAST(s1-1 as TEXT) end from root.db.d1 align by device"; expectHeader = new String[] { TIMESTAMP_STR, @@ -491,15 +491,15 @@ public void testKind1UseOtherOperation() { }; retArray = new String[] { - "0,root.sg.d1,null,", - "1000000,root.sg.d1,11.0,", - "20000000,root.sg.d1,21.0,", - "210000000,root.sg.d1,32.0,", + "0,root.db.d1,null,", + "1000000,root.db.d1,11.0,", + "20000000,root.db.d1,21.0,", + "210000000,root.db.d1,32.0,", }; resultSetEqualTest(sql, expectHeader, retArray); // UDF is not allowed - sql = "select case when s1=0 then change_points(s1) end from root.sg.d1"; + sql = "select case when s1=0 then change_points(s1) end from root.db.d1"; String msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); } @@ -508,11 +508,11 @@ public void testKind1UseOtherOperation() { public void testKind2UseOtherOperation() { // CASE-clause use scalar function String sql = - "select case round(sin(s1)) when 0 then \"=0\" when -1 then \"<0\" else \">0\" end from root.sg.d1"; + "select case round(sin(s1)) when 0 then \"=0\" when -1 then \"<0\" else \">0\" end from root.db.d1"; String[] expectHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN ROUND(sin(root.sg.d1.s1)) = 0 THEN \"=0\" WHEN ROUND(sin(root.sg.d1.s1)) = -1 THEN \"<0\" ELSE \">0\" END", + "CASE WHEN ROUND(sin(root.db.d1.s1)) = 0 THEN \"=0\" WHEN ROUND(sin(root.db.d1.s1)) = -1 THEN \"<0\" ELSE \">0\" END", }; String[] retArray = new String[] { @@ -521,10 +521,10 @@ public void testKind2UseOtherOperation() { resultSetEqualTest(sql, expectHeader, retArray); // WHEN-clause use scalar function - sql = "select case 0 when sin(s1) then \"=0\" else \"!=0\" end from root.sg.d1"; + sql = "select case 0 when sin(s1) then \"=0\" else \"!=0\" end from root.db.d1"; expectHeader = new String[] { - TIMESTAMP_STR, "CASE WHEN 0 = sin(root.sg.d1.s1) THEN \"=0\" ELSE \"!=0\" END", + TIMESTAMP_STR, "CASE WHEN 0 = sin(root.db.d1.s1) THEN \"=0\" ELSE \"!=0\" END", }; retArray = new String[] { @@ -534,7 +534,7 @@ public void testKind2UseOtherOperation() { // THEN-clause and ELSE-clause use scalar function sql = - "select case s1 when 11 then CAST(diff(s1) as TEXT) else CAST(s1-1 as TEXT) end from root.sg.d1 align by device"; + "select case s1 when 11 then CAST(diff(s1) as TEXT) else CAST(s1-1 as TEXT) end from root.db.d1 align by device"; expectHeader = new String[] { "Time", @@ -543,41 +543,41 @@ public void testKind2UseOtherOperation() { }; retArray = new String[] { - "0,root.sg.d1,-1.0,", - "1000000,root.sg.d1,11.0,", - "20000000,root.sg.d1,21.0,", - "210000000,root.sg.d1,32.0,", + "0,root.db.d1,-1.0,", + "1000000,root.db.d1,11.0,", + "20000000,root.db.d1,21.0,", + "210000000,root.db.d1,32.0,", }; resultSetEqualTest(sql, expectHeader, retArray); // UDF is not allowed - sql = "select case s1 when 0 then change_points(s1) end from root.sg.d1"; + sql = "select case s1 when 0 then change_points(s1) end from root.db.d1"; String msg = "301: CASE expression cannot be used with non-mappable UDF"; assertTestFail(sql, msg); } @Test public void testKind1Wildcard() { - String sql = "select case when *=* then * else * end from root.sg.d2"; + String sql = "select case when *=* then * else * end from root.db.d2"; String[] expectedHeaders = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", }; String[] retArray = { "0,0.0,0.0,44.0,44.0,0.0,44.0,0.0,44.0,0.0,44.0,0.0,44.0,0.0,0.0,44.0,44.0,", @@ -590,26 +590,26 @@ public void testKind1Wildcard() { @Test public void testKind2Wildcard() { - String sql = "select case * when * then * else * end from root.sg.d2"; + String sql = "select case * when * then * else * end from root.db.d2"; String[] expectedHeaders = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s3 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s3 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s3 END", - "CASE WHEN root.sg.d2.s4 = root.sg.d2.s4 THEN root.sg.d2.s4 ELSE root.sg.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s3 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s3 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s3 END", + "CASE WHEN root.db.d2.s4 = root.db.d2.s4 THEN root.db.d2.s4 ELSE root.db.d2.s4 END", }; String[] retArray = { "0,0.0,0.0,44.0,44.0,0.0,44.0,0.0,44.0,0.0,44.0,0.0,44.0,0.0,0.0,44.0,44.0,", @@ -624,23 +624,23 @@ public void testKind2Wildcard() { public void testKind1AlignedByDevice() { // from different devices, result should be empty String sql = - "select case when s1<=11 then s3 else s4 end from root.sg.d1, root.sg.d2 align by device"; + "select case when s1<=11 then s3 else s4 end from root.db.d1, root.db.d2 align by device"; String[] expectedHeader = new String[] {TIMESTAMP_STR}; String[] retArray = {}; resultSetEqualTest(sql, expectedHeader, retArray); // from same device - sql = "select case when s3<=11 then s3 else s4 end from root.sg.d1, root.sg.d2 align by device"; + sql = "select case when s3<=11 then s3 else s4 end from root.db.d1, root.db.d2 align by device"; expectedHeader = new String[] { TIMESTAMP_STR, DEVICE, "CASE WHEN s3 <= 11 THEN s3 ELSE s4 END", }; retArray = new String[] { - "0,root.sg.d2,0.0,", - "1000000,root.sg.d2,11.0,", - "20000000,root.sg.d2,66.0,", - "210000000,root.sg.d2,77.0,", + "0,root.db.d2,0.0,", + "1000000,root.db.d2,11.0,", + "20000000,root.db.d2,66.0,", + "210000000,root.db.d2,77.0,", }; resultSetEqualTest(sql, expectedHeader, retArray); @@ -649,7 +649,7 @@ public void testKind1AlignedByDevice() { "select " + "case when s1<=11 then s1 else s1*2 end, " + "case when s3<=11 then s3 else s4 end " - + "from root.sg.d1, root.sg.d2 align by device"; + + "from root.db.d1, root.db.d2 align by device"; expectedHeader = new String[] { TIMESTAMP_STR, @@ -659,14 +659,14 @@ public void testKind1AlignedByDevice() { }; retArray = new String[] { - "0,root.sg.d1,0.0,null,", - "1000000,root.sg.d1,11.0,null,", - "20000000,root.sg.d1,44.0,null,", - "210000000,root.sg.d1,66.0,null,", - "0,root.sg.d2,null,0.0,", - "1000000,root.sg.d2,null,11.0,", - "20000000,root.sg.d2,null,66.0,", - "210000000,root.sg.d2,null,77.0,", + "0,root.db.d1,0.0,null,", + "1000000,root.db.d1,11.0,null,", + "20000000,root.db.d1,44.0,null,", + "210000000,root.db.d1,66.0,null,", + "0,root.db.d2,null,0.0,", + "1000000,root.db.d2,null,11.0,", + "20000000,root.db.d2,null,66.0,", + "210000000,root.db.d2,null,77.0,", }; resultSetEqualTest(sql, expectedHeader, retArray); } @@ -675,23 +675,23 @@ public void testKind1AlignedByDevice() { public void testKind2AlignedByDevice() { // from different devices, result should be empty String sql = - "select case s1 when 11 then s3 else s4 end from root.sg.d1, root.sg.d2 align by device"; + "select case s1 when 11 then s3 else s4 end from root.db.d1, root.db.d2 align by device"; String[] expectedHeader = new String[] {TIMESTAMP_STR}; String[] retArray = {}; resultSetEqualTest(sql, expectedHeader, retArray); // from same device - sql = "select case s3 when 11 then s3 else s4 end from root.sg.d1, root.sg.d2 align by device"; + sql = "select case s3 when 11 then s3 else s4 end from root.db.d1, root.db.d2 align by device"; expectedHeader = new String[] { TIMESTAMP_STR, DEVICE, "CASE WHEN s3 = 11 THEN s3 ELSE s4 END", }; retArray = new String[] { - "0,root.sg.d2,44.0,", - "1000000,root.sg.d2,11.0,", - "20000000,root.sg.d2,66.0,", - "210000000,root.sg.d2,77.0,", + "0,root.db.d2,44.0,", + "1000000,root.db.d2,11.0,", + "20000000,root.db.d2,66.0,", + "210000000,root.db.d2,77.0,", }; resultSetEqualTest(sql, expectedHeader, retArray); @@ -700,7 +700,7 @@ public void testKind2AlignedByDevice() { "select " + "case s1 when 11 then s1 else s1*2 end, " + "case s3 when 11 then s3 else s4 end " - + "from root.sg.d1, root.sg.d2 align by device"; + + "from root.db.d1, root.db.d2 align by device"; expectedHeader = new String[] { TIMESTAMP_STR, @@ -710,14 +710,14 @@ public void testKind2AlignedByDevice() { }; retArray = new String[] { - "0,root.sg.d1,0.0,null,", - "1000000,root.sg.d1,11.0,null,", - "20000000,root.sg.d1,44.0,null,", - "210000000,root.sg.d1,66.0,null,", - "0,root.sg.d2,null,44.0,", - "1000000,root.sg.d2,null,11.0,", - "20000000,root.sg.d2,null,66.0,", - "210000000,root.sg.d2,null,77.0,", + "0,root.db.d1,0.0,null,", + "1000000,root.db.d1,11.0,null,", + "20000000,root.db.d1,44.0,null,", + "210000000,root.db.d1,66.0,null,", + "0,root.db.d2,null,44.0,", + "1000000,root.db.d2,null,11.0,", + "20000000,root.db.d2,null,66.0,", + "210000000,root.db.d2,null,77.0,", }; resultSetEqualTest(sql, expectedHeader, retArray); } @@ -725,12 +725,12 @@ public void testKind2AlignedByDevice() { @Test public void testKind1MultipleTimeseries() { // time stamp is aligned - String sql = "select s1*s1, case when s1<=11 then s3 else s4 end from root.sg.d1, root.sg.d2"; + String sql = "select s1*s1, case when s1<=11 then s3 else s4 end from root.db.d1, root.db.d2"; String[] expectedHeader = new String[] { TIMESTAMP_STR, - "root.sg.d1.s1 * root.sg.d1.s1", - "CASE WHEN root.sg.d1.s1 <= 11 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", + "root.db.d1.s1 * root.db.d1.s1", + "CASE WHEN root.db.d1.s1 <= 11 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", }; String[] retArray = new String[] { @@ -743,12 +743,12 @@ public void testKind1MultipleTimeseries() { "select " + "case when s2%2==1 then s2 else s2/2 end, " + "case when s1<=11 then s3 else s4 end " - + "from root.sg.d1, root.sg.d2 limit 5 offset 98"; + + "from root.db.d1, root.db.d2 limit 5 offset 98"; expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s2 % 2 = 1 THEN root.sg.d1.s2 ELSE root.sg.d1.s2 / 2 END", - "CASE WHEN root.sg.d1.s1 <= 11 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", + "CASE WHEN root.db.d1.s2 % 2 = 1 THEN root.db.d1.s2 ELSE root.db.d1.s2 / 2 END", + "CASE WHEN root.db.d1.s1 <= 11 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", }; retArray = new String[] { @@ -764,12 +764,12 @@ public void testKind1MultipleTimeseries() { @Test public void testKind2MultipleTimeseries() { // time stamp is aligned - String sql = "select s1*s1, case s1 when 11 then s3 else s4 end from root.sg.d1, root.sg.d2"; + String sql = "select s1*s1, case s1 when 11 then s3 else s4 end from root.db.d1, root.db.d2"; String[] expectedHeader = new String[] { TIMESTAMP_STR, - "root.sg.d1.s1 * root.sg.d1.s1", - "CASE WHEN root.sg.d1.s1 = 11 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", + "root.db.d1.s1 * root.db.d1.s1", + "CASE WHEN root.db.d1.s1 = 11 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", }; String[] retArray = new String[] { @@ -782,12 +782,12 @@ public void testKind2MultipleTimeseries() { "select " + "case s2%2 when 1 then s2 else s2/2 end, " + "case s3 when 11 then s3 else s4 end " - + "from root.sg.d1, root.sg.d2 limit 5 offset 98"; + + "from root.db.d1, root.db.d2 limit 5 offset 98"; expectedHeader = new String[] { "Time", - "CASE WHEN root.sg.d1.s2 % 2 = 1 THEN root.sg.d1.s2 ELSE root.sg.d1.s2 / 2 END", - "CASE WHEN root.sg.d2.s3 = 11 THEN root.sg.d2.s3 ELSE root.sg.d2.s4 END", + "CASE WHEN root.db.d1.s2 % 2 = 1 THEN root.db.d1.s2 ELSE root.db.d1.s2 / 2 END", + "CASE WHEN root.db.d2.s3 = 11 THEN root.db.d2.s3 ELSE root.db.d2.s4 END", }; retArray = new String[] { @@ -803,16 +803,16 @@ public void testKind2MultipleTimeseries() { @Test public void testKind1UseInWhereClause() { String sql = - "select s4 from root.sg.d2 where case when s3=0 then s4>44 when s3=22 then s4>0 when time>200000000 then true end"; + "select s4 from root.db.d2 where case when s3=0 then s4>44 when s3=22 then s4>0 when time>200000000 then true end"; String[] expectedHeader = new String[] { - TIMESTAMP_STR, "root.sg.d2.s4", + TIMESTAMP_STR, "root.db.d2.s4", }; String[] retArray = new String[] {"20000000,66.0,", "210000000,77.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); sql = - "select case when s3=0 then s4>44 when s3=22 then s4>0 when time>200000000 then true end as result from root.sg.d2"; + "select case when s3=0 then s4>44 when s3=22 then s4>0 when time>200000000 then true end as result from root.db.d2"; expectedHeader = new String[] { TIMESTAMP_STR, "result", @@ -826,15 +826,15 @@ public void testKind1UseInWhereClause() { @Test public void testKind2UseInWhereClause() { - String sql = "select s4 from root.sg.d2 where case s3 when 0 then s4>44 when 22 then s4>0 end"; + String sql = "select s4 from root.db.d2 where case s3 when 0 then s4>44 when 22 then s4>0 end"; String[] expectedHeader = new String[] { - TIMESTAMP_STR, "root.sg.d2.s4", + TIMESTAMP_STR, "root.db.d2.s4", }; String[] retArray = new String[] {"20000000,66.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); - sql = "select case s3 when 0 then s4>44 when 22 then s4>0 end as result from root.sg.d2"; + sql = "select case s3 when 0 then s4>44 when 22 then s4>0 end as result from root.db.d2"; expectedHeader = new String[] { TIMESTAMP_STR, "result", @@ -847,10 +847,10 @@ public void testKind2UseInWhereClause() { // CASE time sql = - "select s4 from root.sg.d2 where case time when 0 then false when 20000000 then true when 1000000 then true end"; + "select s4 from root.db.d2 where case time when 0 then false when 20000000 then true when 1000000 then true end"; expectedHeader = new String[] { - TIMESTAMP_STR, "root.sg.d2.s4", + TIMESTAMP_STR, "root.db.d2.s4", }; retArray = new String[] {"1000000,55.0,", "20000000,66.0,"}; resultSetEqualTest(sql, expectedHeader, retArray); @@ -859,11 +859,11 @@ public void testKind2UseInWhereClause() { @Test public void testKind1CaseInCase() { String sql = - "select case when s1=0 || s1=22 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) else \"xxx\" end from root.sg.d1"; + "select case when s1=0 || s1=22 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) else \"xxx\" end from root.db.d1"; String[] expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 = 0 | root.sg.d1.s1 = 22 THEN CAST(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 END AS TEXT) ELSE \"xxx\" END" + "CASE WHEN root.db.d1.s1 = 0 | root.db.d1.s1 = 22 THEN CAST(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 END AS TEXT) ELSE \"xxx\" END" }; String[] retArray = new String[] { @@ -875,11 +875,11 @@ public void testKind1CaseInCase() { @Test public void testKind2CaseInCase() { String sql = - "select case s1 when 0 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) when 22 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) else \"xxx\" end from root.sg.d1"; + "select case s1 when 0 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) when 22 then cast(case when s1=0 then 99 when s1>22 then 999 end as TEXT) else \"xxx\" end from root.db.d1"; String[] expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d1.s1 = 0 THEN CAST(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 END AS TEXT) WHEN root.sg.d1.s1 = 22 THEN CAST(CASE WHEN root.sg.d1.s1 = 0 THEN 99 WHEN root.sg.d1.s1 > 22 THEN 999 END AS TEXT) ELSE \"xxx\" END" + "CASE WHEN root.db.d1.s1 = 0 THEN CAST(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 END AS TEXT) WHEN root.db.d1.s1 = 22 THEN CAST(CASE WHEN root.db.d1.s1 = 0 THEN 99 WHEN root.db.d1.s1 > 22 THEN 999 END AS TEXT) ELSE \"xxx\" END" }; String[] retArray = new String[] { @@ -891,7 +891,7 @@ public void testKind2CaseInCase() { @Test public void testKind1Logic() { String sql = - "select case when s3 >= 0 and s3 < 20 and s4 >= 50 and s4 < 60 then 'just so so~~~' when s3 >= 20 and s3 < 40 and s4 >= 70 and s4 < 80 then 'very well~~~' end as result from root.sg.d2"; + "select case when s3 >= 0 and s3 < 20 and s4 >= 50 and s4 < 60 then 'just so so~~~' when s3 >= 20 and s3 < 40 and s4 >= 70 and s4 < 80 then 'very well~~~' end as result from root.db.d2"; String[] expectedHeader = new String[] {TIMESTAMP_STR, "result"}; String[] retArray = new String[] { @@ -904,11 +904,11 @@ public void testKind1Logic() { public void testMultipleSatisfyCase() { // Test the result when two when clause are satisfied String sql = - "select case when s3 < 20 or s4 > 60 then \"just so so~~~\" when s3 > 20 or s4 < 60 then \"very well~~~\" end from root.sg.d2"; + "select case when s3 < 20 or s4 > 60 then \"just so so~~~\" when s3 > 20 or s4 < 60 then \"very well~~~\" end from root.db.d2"; String[] expectedHeader = new String[] { TIMESTAMP_STR, - "CASE WHEN root.sg.d2.s3 < 20 | root.sg.d2.s4 > 60 THEN \"just so so~~~\" WHEN root.sg.d2.s3 > 20 | root.sg.d2.s4 < 60 THEN \"very well~~~\" END" + "CASE WHEN root.db.d2.s3 < 20 | root.db.d2.s4 > 60 THEN \"just so so~~~\" WHEN root.db.d2.s3 > 20 | root.db.d2.s4 < 60 THEN \"very well~~~\" END" }; String[] retArray = new String[] { @@ -922,7 +922,7 @@ public void testMultipleSatisfyCase() { @Test public void testThenWithBinarySameConstant() { - String sql = "SELECT CASE WHEN true THEN 200 + (s1 - 200) END AS result FROM root.sg.d1"; + String sql = "SELECT CASE WHEN true THEN 200 + (s1 - 200) END AS result FROM root.db.d1"; String[] expectedHeader = new String[] {TIMESTAMP_STR, "result"}; String[] retArray = new String[] {"0,0.0,", "1000000,11.0,", "20000000,22.0,", "210000000,33.0,"}; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBEncryptionValueQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBEncryptionValueQueryIT.java index 45bf938d71f37..e99faac4e8d8c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBEncryptionValueQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBEncryptionValueQueryIT.java @@ -96,29 +96,29 @@ public class IoTDBEncryptionValueQueryIT { "insert into root.ln.wf02.wt02(timestamp,status) values(1509466080000,false)", "insert into root.ln.wf02.wt02(timestamp,status) values(1509466140000,false)", "flush", - "CREATE DATABASE root.sgcc", - "create timeseries root.sgcc.wf03.wt01.status with datatype=BOOLEAN,encoding=PLAIN", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465600000,true)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465660000,true)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465720000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465780000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465840000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465900000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465960000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466020000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466080000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466140000,false)", - "create timeseries root.sgcc.wf03.wt01.temperature with datatype=FLOAT,encoding=RLE", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465600000,25.957603)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465660000,24.359503)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465720000,20.092794)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465780000,20.182663)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465840000,21.125198)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465900000,22.720892)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465960000,20.71)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466020000,21.451046)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466080000,22.57987)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466140000,20.98177)", + "CREATE DATABASE root.dbcc", + "create timeseries root.dbcc.wf03.wt01.status with datatype=BOOLEAN,encoding=PLAIN", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465600000,true)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465660000,true)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465720000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465780000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465840000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465900000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465960000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466020000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466080000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466140000,false)", + "create timeseries root.dbcc.wf03.wt01.temperature with datatype=FLOAT,encoding=RLE", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465600000,25.957603)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465660000,24.359503)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465720000,20.092794)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465780000,20.182663)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465840000,21.125198)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465900000,22.720892)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465960000,20.71)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466020000,21.451046)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466080000,22.57987)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466140000,20.98177)", "flush", }; @@ -167,14 +167,14 @@ public void selectTest() { Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select * from root.ln.**,root.sgcc.** where time>10"); + statement.executeQuery("select * from root.ln.**,root.dbcc.** where time>10"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -226,14 +226,14 @@ public void LimitTest() { ResultSet resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time>10 limit 5 offset 3"); + "select * from root.ln.**,root.dbcc.** where time>10 limit 5 offset 3"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -265,15 +265,15 @@ public void LimitTest() { Assert.assertEquals(10000, statement.getFetchSize()); resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time>10 limit 5 offset 3"); + "select * from root.ln.**,root.dbcc.** where time>10 limit 5 offset 3"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -325,14 +325,14 @@ public void InTest() { Assert.assertEquals(4, statement.getFetchSize()); ResultSet resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); + "select * from root.ln.**,root.dbcc.** where time in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -369,15 +369,15 @@ public void InTest() { }; resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time not in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); + "select * from root.ln.**,root.dbcc.** where time not in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -413,15 +413,15 @@ public void InTest() { resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where root.ln.wf01.wt01.temperature in (20.18, 20.71, 22.58)"); + "select * from root.ln.**,root.dbcc.** where root.ln.wf01.wt01.temperature in (20.18, 20.71, 22.58)"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBInIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBInIT.java index a83db53570d11..1ca8f2223fbfa 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBInIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBInIT.java @@ -53,22 +53,22 @@ public class IoTDBInIT { private static String[] sqls = new String[] { "CREATE DATABASE root.ln", - "CREATE DATABASE root.sg", - "create timeseries root.sg.d1.s1.qrcode with datatype=TEXT,encoding=PLAIN", - "insert into root.sg.d1.s1(timestamp,qrcode) values(1509465600000,'qrcode001')", - "insert into root.sg.d1.s1(timestamp,qrcode) values(1509465660000,'qrcode002')", - "insert into root.sg.d1.s1(timestamp,qrcode) values(1509465720000,'qrcode003')", - "insert into root.sg.d1.s1(timestamp,qrcode) values(1509465780000,'qrcode004')", - "create timeseries root.sg.d1.s2.qrcode with datatype=TEXT,encoding=PLAIN", - "insert into root.sg.d1.s2(timestamp,qrcode) values(1509465720000,'qrcode002')", - "insert into root.sg.d1.s2(timestamp,qrcode) values(1509465780000,'qrcode003')", - "insert into root.sg.d1.s2(timestamp,qrcode) values(1509465840000,'qrcode004')", - "insert into root.sg.d1.s2(timestamp,qrcode) values(1509465900000,'qrcode005')", - "create timeseries root.sg.d2.s1.qrcode with datatype=TEXT,encoding=PLAIN", - "insert into root.sg.d2.s1(timestamp,qrcode) values(1509465780000,'qrcode002')", - "insert into root.sg.d2.s1(timestamp,qrcode) values(1509465840000,'qrcode003')", - "insert into root.sg.d2.s1(timestamp,qrcode) values(1509465900000,'qrcode004')", - "insert into root.sg.d2.s1(timestamp,qrcode) values(1509465960000,'qrcode005')", + "CREATE DATABASE root.db", + "create timeseries root.db.d1.s1.qrcode with datatype=TEXT,encoding=PLAIN", + "insert into root.db.d1.s1(timestamp,qrcode) values(1509465600000,'qrcode001')", + "insert into root.db.d1.s1(timestamp,qrcode) values(1509465660000,'qrcode002')", + "insert into root.db.d1.s1(timestamp,qrcode) values(1509465720000,'qrcode003')", + "insert into root.db.d1.s1(timestamp,qrcode) values(1509465780000,'qrcode004')", + "create timeseries root.db.d1.s2.qrcode with datatype=TEXT,encoding=PLAIN", + "insert into root.db.d1.s2(timestamp,qrcode) values(1509465720000,'qrcode002')", + "insert into root.db.d1.s2(timestamp,qrcode) values(1509465780000,'qrcode003')", + "insert into root.db.d1.s2(timestamp,qrcode) values(1509465840000,'qrcode004')", + "insert into root.db.d1.s2(timestamp,qrcode) values(1509465900000,'qrcode005')", + "create timeseries root.db.d2.s1.qrcode with datatype=TEXT,encoding=PLAIN", + "insert into root.db.d2.s1(timestamp,qrcode) values(1509465780000,'qrcode002')", + "insert into root.db.d2.s1(timestamp,qrcode) values(1509465840000,'qrcode003')", + "insert into root.db.d2.s1(timestamp,qrcode) values(1509465900000,'qrcode004')", + "insert into root.db.d2.s1(timestamp,qrcode) values(1509465960000,'qrcode005')", "create timeseries root.test.s1 with datatype=INT32,encoding=PLAIN", "create timeseries root.test.s2 with datatype=INT64,encoding=PLAIN", "create timeseries root.test.s3 with datatype=FLOAT,encoding=PLAIN", @@ -135,12 +135,12 @@ public void selectWithStarTest1() { try (ResultSet resultSet = statement.executeQuery( - "select qrcode from root.sg.d1.* where qrcode in ('qrcode002', 'qrcode003')")) { + "select qrcode from root.db.d1.* where qrcode in ('qrcode002', 'qrcode003')")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, - "Time,root.sg.d1.s1.qrcode,root.sg.d1.s2.qrcode,", + "Time,root.db.d1.s1.qrcode,root.db.d1.s2.qrcode,", new int[] { Types.TIMESTAMP, Types.VARCHAR, Types.VARCHAR, }); @@ -177,12 +177,12 @@ public void selectWithStarTest2() { try (ResultSet resultSet = statement.executeQuery( - "select qrcode from root.sg.*.* where qrcode in ('qrcode002', 'qrcode003', 'qrcode004')")) { + "select qrcode from root.db.*.* where qrcode in ('qrcode002', 'qrcode003', 'qrcode004')")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, - "Time,root.sg.d1.s1.qrcode,root.sg.d1.s2.qrcode,root.sg.d2.s1.qrcode,", + "Time,root.db.d1.s1.qrcode,root.db.d1.s2.qrcode,root.db.d2.s1.qrcode,", new int[] { Types.TIMESTAMP, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, }); @@ -214,12 +214,12 @@ public void selectWithStarTest2() { public void selectWithAlignByDeviceTest() { String[] retArray = new String[] { - "1509465660000,root.sg.d1.s1,qrcode002,", - "1509465780000,root.sg.d1.s1,qrcode004,", - "1509465720000,root.sg.d1.s2,qrcode002,", - "1509465840000,root.sg.d1.s2,qrcode004,", - "1509465780000,root.sg.d2.s1,qrcode002,", - "1509465900000,root.sg.d2.s1,qrcode004,", + "1509465660000,root.db.d1.s1,qrcode002,", + "1509465780000,root.db.d1.s1,qrcode004,", + "1509465720000,root.db.d1.s2,qrcode002,", + "1509465840000,root.db.d1.s2,qrcode004,", + "1509465780000,root.db.d2.s1,qrcode002,", + "1509465900000,root.db.d2.s1,qrcode004,", }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -227,7 +227,7 @@ public void selectWithAlignByDeviceTest() { try (ResultSet resultSet = statement.executeQuery( - "select qrcode from root.sg.*.* where qrcode in ('qrcode002', 'qrcode004') align by device")) { + "select qrcode from root.db.*.* where qrcode in ('qrcode002', 'qrcode004') align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNoSelectExpressionAfterAnalyzedIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNoSelectExpressionAfterAnalyzedIT.java index 8989d8a450c29..97284c18263ea 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNoSelectExpressionAfterAnalyzedIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNoSelectExpressionAfterAnalyzedIT.java @@ -43,8 +43,8 @@ public class IoTDBNoSelectExpressionAfterAnalyzedIT { private static final String[] SQLs = new String[] { - "insert into root.sg.d1(time,s1) values(1,1)", - "insert into root.sg.d2(time,s1,s2) values(1,1,1)" + "insert into root.db.d1(time,s1) values(1,1)", + "insert into root.db.d2(time,s1,s2) values(1,1,1)" }; @BeforeClass @@ -63,31 +63,31 @@ public void testAlignByDevice() { String[] expectedHeader = new String[] {TIMESTAMP_STR}; String[] retArray = new String[] {}; resultSetEqualTest( - "select s2 from root.sg.d1 where s1>0 align by device", expectedHeader, retArray); + "select s2 from root.db.d1 where s1>0 align by device", expectedHeader, retArray); resultSetEqualTest( - "select count(s2) from root.sg.d1 where s1>0 align by device", expectedHeader, retArray); + "select count(s2) from root.db.d1 where s1>0 align by device", expectedHeader, retArray); // mix test expectedHeader = new String[] {DEVICE, count(s1), count(s2)}; - retArray = new String[] {"root.sg.d1,1,null,", "root.sg.d2,1,1,"}; + retArray = new String[] {"root.db.d1,1,null,", "root.db.d2,1,1,"}; resultSetEqualTest( - "select count(s1), count(s2) from root.sg.* where s1>0 align by device", + "select count(s1), count(s2) from root.db.* where s1>0 align by device", expectedHeader, retArray); expectedHeader = new String[] {TIMESTAMP_STR, DEVICE, s1, s2}; - retArray = new String[] {"1,root.sg.d1,1.0,null,", "1,root.sg.d2,1.0,1.0,"}; + retArray = new String[] {"1,root.db.d1,1.0,null,", "1,root.db.d2,1.0,1.0,"}; resultSetEqualTest( - "select s1, s2 from root.sg.* where s1>0 align by device", expectedHeader, retArray); + "select s1, s2 from root.db.* where s1>0 align by device", expectedHeader, retArray); } @Test public void testAlignByTime() { String[] expectedHeader = new String[] {TIMESTAMP_STR}; String[] retArray = new String[] {}; - resultSetEqualTest("select s2 from root.sg.d1 where s1>0", expectedHeader, retArray); + resultSetEqualTest("select s2 from root.db.d1 where s1>0", expectedHeader, retArray); - resultSetEqualTest("select count(s2) from root.sg.d1 where s1>0", expectedHeader, retArray); + resultSetEqualTest("select count(s2) from root.db.d1 where s1>0", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullValueFillIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullValueFillIT.java index 3ca0d6bef6bfc..b2e8198a7cffe 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullValueFillIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBNullValueFillIT.java @@ -39,7 +39,7 @@ public class IoTDBNullValueFillIT { /** - * [root.sg1.d1 (aligned)] + * [root.db1.d1 (aligned)] * *

Time, s1[INT32], s2[INT64], s3[FLOAT], s4[DOUBLE], s5[BOOLEAN], s6[TEXT]
* 1, null, 1, null, 1.0, null, t1
@@ -52,7 +52,7 @@ public class IoTDBNullValueFillIT { * 8, 8, 8, 8.0, 8.0, true, t8
* 9, 9, null, 9.0, null, true, null * - *

[root.sg1.d2 (non-aligned)] + *

[root.db1.d2 (non-aligned)] * *

Time, s1[INT32], s2[INT64], s3[FLOAT], s4[DOUBLE], s5[BOOLEAN], s6[TEXT]
* 1, 1, null, 1.0, null, true, null
@@ -67,41 +67,41 @@ public class IoTDBNullValueFillIT { */ private static final String[] sqls = new String[] { - "CREATE DATABASE root.sg1", - "create aligned timeseries root.sg1.d1(s1 INT32, s2 INT64, s3 FLOAT, s4 DOUBLE, s5 BOOLEAN, s6 TEXT)", - "insert into root.sg1.d1(time, s2, s4, s6) aligned values(1, 1, 1.0, 't1')", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(2, 2, 2, 2.0, 2.0, true, 't2')", - "insert into root.sg1.d1(time, s1, s3, s5) aligned values(3, 3, 3.0, false)", - "insert into root.sg1.d1(time, s2, s4, s6) aligned values(4, 4, 4.0, 't4')", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(5, 5, 5, 5.0, 5.0, false, 't5')", - "insert into root.sg1.d1(time, s2, s4, s6) aligned values(6, 6, 6.0, 't6')", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(8, 8, 8, 8.0, 8.0, true, 't8')", - "insert into root.sg1.d1(time, s1, s3, s5) aligned values(9, 9, 9.0, true)", - "create timeseries root.sg1.d2.s1 INT32", - "create timeseries root.sg1.d2.s2 INT64", - "create timeseries root.sg1.d2.s3 FLOAT", - "create timeseries root.sg1.d2.s4 DOUBLE", - "create timeseries root.sg1.d2.s5 BOOLEAN", - "create timeseries root.sg1.d2.s6 TEXT", - "insert into root.sg1.d2(time, s1, s3, s5) values(1, 1, 1.0, true)", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5, s6) values(2, 2, 2, 2.0, 2.0, true, 't2')", - "insert into root.sg1.d2(time, s2, s4, s6) values(3, 3, 3.0, 't3')", - "insert into root.sg1.d2(time, s1, s3, s5) values(4, 4, 4.0, false)", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5, s6) values(5, 5, 5, 5.0, 5.0, false, 't5')", - "insert into root.sg1.d2(time, s1, s3, s5) values(6, 6, 6.0, false)", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5, s6) values(8, 8, 8, 8.0, 8.0, true, 't8')", - "insert into root.sg1.d2(time, s2, s4, s6) values(9, 9, 9.0, 't9')" + "CREATE DATABASE root.db1", + "create aligned timeseries root.db1.d1(s1 INT32, s2 INT64, s3 FLOAT, s4 DOUBLE, s5 BOOLEAN, s6 TEXT)", + "insert into root.db1.d1(time, s2, s4, s6) aligned values(1, 1, 1.0, 't1')", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(2, 2, 2, 2.0, 2.0, true, 't2')", + "insert into root.db1.d1(time, s1, s3, s5) aligned values(3, 3, 3.0, false)", + "insert into root.db1.d1(time, s2, s4, s6) aligned values(4, 4, 4.0, 't4')", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(5, 5, 5, 5.0, 5.0, false, 't5')", + "insert into root.db1.d1(time, s2, s4, s6) aligned values(6, 6, 6.0, 't6')", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(8, 8, 8, 8.0, 8.0, true, 't8')", + "insert into root.db1.d1(time, s1, s3, s5) aligned values(9, 9, 9.0, true)", + "create timeseries root.db1.d2.s1 INT32", + "create timeseries root.db1.d2.s2 INT64", + "create timeseries root.db1.d2.s3 FLOAT", + "create timeseries root.db1.d2.s4 DOUBLE", + "create timeseries root.db1.d2.s5 BOOLEAN", + "create timeseries root.db1.d2.s6 TEXT", + "insert into root.db1.d2(time, s1, s3, s5) values(1, 1, 1.0, true)", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5, s6) values(2, 2, 2, 2.0, 2.0, true, 't2')", + "insert into root.db1.d2(time, s2, s4, s6) values(3, 3, 3.0, 't3')", + "insert into root.db1.d2(time, s1, s3, s5) values(4, 4, 4.0, false)", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5, s6) values(5, 5, 5, 5.0, 5.0, false, 't5')", + "insert into root.db1.d2(time, s1, s3, s5) values(6, 6, 6.0, false)", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5, s6) values(8, 8, 8, 8.0, 8.0, true, 't8')", + "insert into root.db1.d2(time, s2, s4, s6) values(9, 9, 9.0, 't9')" }; private final String[] expectedHeader = new String[] { "Time", - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5", - "root.sg1.d1.s6" + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5", + "root.db1.d1.s6" }; private final String[] expectedAlignByDeviceHeader = @@ -132,7 +132,7 @@ public void previousFillTest() { "9,9,8,9.0,8.0,true,t8," }; resultSetEqualTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(previous)", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(previous)", expectedHeader, retArray); } @Test @@ -149,7 +149,7 @@ public void previousDescFillTest() { "1,2,1,2.0,1.0,true,t1," }; resultSetEqualTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(previous) order by time desc", + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(previous) order by time desc", expectedHeader, retArray); } @@ -158,25 +158,25 @@ public void previousDescFillTest() { public void previousFillAlignByDeviceTest() { String[] retArray = new String[] { - "1,root.sg1.d1,null,1,null,1.0,null,t1,", - "2,root.sg1.d1,2,2,2.0,2.0,true,t2,", - "3,root.sg1.d1,3,2,3.0,2.0,false,t2,", - "4,root.sg1.d1,3,4,3.0,4.0,false,t4,", - "5,root.sg1.d1,5,5,5.0,5.0,false,t5,", - "6,root.sg1.d1,5,6,5.0,6.0,false,t6,", - "8,root.sg1.d1,8,8,8.0,8.0,true,t8,", - "9,root.sg1.d1,9,8,9.0,8.0,true,t8,", - "1,root.sg1.d2,1,8,1.0,8.0,true,t8,", - "2,root.sg1.d2,2,2,2.0,2.0,true,t2,", - "3,root.sg1.d2,2,3,2.0,3.0,true,t3,", - "4,root.sg1.d2,4,3,4.0,3.0,false,t3,", - "5,root.sg1.d2,5,5,5.0,5.0,false,t5,", - "6,root.sg1.d2,6,5,6.0,5.0,false,t5,", - "8,root.sg1.d2,8,8,8.0,8.0,true,t8,", - "9,root.sg1.d2,8,9,8.0,9.0,true,t9," + "1,root.db1.d1,null,1,null,1.0,null,t1,", + "2,root.db1.d1,2,2,2.0,2.0,true,t2,", + "3,root.db1.d1,3,2,3.0,2.0,false,t2,", + "4,root.db1.d1,3,4,3.0,4.0,false,t4,", + "5,root.db1.d1,5,5,5.0,5.0,false,t5,", + "6,root.db1.d1,5,6,5.0,6.0,false,t6,", + "8,root.db1.d1,8,8,8.0,8.0,true,t8,", + "9,root.db1.d1,9,8,9.0,8.0,true,t8,", + "1,root.db1.d2,1,8,1.0,8.0,true,t8,", + "2,root.db1.d2,2,2,2.0,2.0,true,t2,", + "3,root.db1.d2,2,3,2.0,3.0,true,t3,", + "4,root.db1.d2,4,3,4.0,3.0,false,t3,", + "5,root.db1.d2,5,5,5.0,5.0,false,t5,", + "6,root.db1.d2,6,5,6.0,5.0,false,t5,", + "8,root.db1.d2,8,8,8.0,8.0,true,t8,", + "9,root.db1.d2,8,9,8.0,9.0,true,t9," }; resultSetEqualTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.* fill(previous) align by device", + "select s1, s2, s3, s4, s5, s6 from root.db1.* fill(previous) align by device", expectedAlignByDeviceHeader, retArray); } @@ -185,25 +185,25 @@ public void previousFillAlignByDeviceTest() { public void previousDescFillAlignByDeviceTest() { String[] retArray = new String[] { - "9,root.sg1.d1,9,null,9.0,null,true,null,", - "8,root.sg1.d1,8,8,8.0,8.0,true,t8,", - "6,root.sg1.d1,8,6,8.0,6.0,true,t6,", - "5,root.sg1.d1,5,5,5.0,5.0,false,t5,", - "4,root.sg1.d1,5,4,5.0,4.0,false,t4,", - "3,root.sg1.d1,3,4,3.0,4.0,false,t4,", - "2,root.sg1.d1,2,2,2.0,2.0,true,t2,", - "1,root.sg1.d1,2,1,2.0,1.0,true,t1,", - "9,root.sg1.d2,2,9,2.0,9.0,true,t9,", - "8,root.sg1.d2,8,8,8.0,8.0,true,t8,", - "6,root.sg1.d2,6,8,6.0,8.0,false,t8,", - "5,root.sg1.d2,5,5,5.0,5.0,false,t5,", - "4,root.sg1.d2,4,5,4.0,5.0,false,t5,", - "3,root.sg1.d2,4,3,4.0,3.0,false,t3,", - "2,root.sg1.d2,2,2,2.0,2.0,true,t2,", - "1,root.sg1.d2,1,2,1.0,2.0,true,t2," + "9,root.db1.d1,9,null,9.0,null,true,null,", + "8,root.db1.d1,8,8,8.0,8.0,true,t8,", + "6,root.db1.d1,8,6,8.0,6.0,true,t6,", + "5,root.db1.d1,5,5,5.0,5.0,false,t5,", + "4,root.db1.d1,5,4,5.0,4.0,false,t4,", + "3,root.db1.d1,3,4,3.0,4.0,false,t4,", + "2,root.db1.d1,2,2,2.0,2.0,true,t2,", + "1,root.db1.d1,2,1,2.0,1.0,true,t1,", + "9,root.db1.d2,2,9,2.0,9.0,true,t9,", + "8,root.db1.d2,8,8,8.0,8.0,true,t8,", + "6,root.db1.d2,6,8,6.0,8.0,false,t8,", + "5,root.db1.d2,5,5,5.0,5.0,false,t5,", + "4,root.db1.d2,4,5,4.0,5.0,false,t5,", + "3,root.db1.d2,4,3,4.0,3.0,false,t3,", + "2,root.db1.d2,2,2,2.0,2.0,true,t2,", + "1,root.db1.d2,1,2,1.0,2.0,true,t2," }; resultSetEqualTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.* fill(previous) order by device,time desc align by device", + "select s1, s2, s3, s4, s5, s6 from root.db1.* fill(previous) order by device,time desc align by device", expectedAlignByDeviceHeader, retArray); } @@ -222,32 +222,32 @@ public void linearFillTest() { "9,9,null,9.0,null,true,null," }; resultSetEqualWithDescOrderTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(linear)", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(linear)", expectedHeader, retArray); } @Test public void linearFillAlignByDeviceTest() { String[] retArray = new String[] { - "1,root.sg1.d1,null,1,null,1.0,null,t1,", - "2,root.sg1.d1,2,2,2.0,2.0,true,t2,", - "3,root.sg1.d1,3,3,3.0,3.0,false,null,", - "4,root.sg1.d1,4,4,4.0,4.0,null,t4,", - "5,root.sg1.d1,5,5,5.0,5.0,false,t5,", - "6,root.sg1.d1,6,6,6.0,6.0,null,t6,", - "8,root.sg1.d1,8,8,8.0,8.0,true,t8,", - "9,root.sg1.d1,9,9,9.0,9.0,true,null,", - "1,root.sg1.d2,1,1,1.0,1.0,true,null,", - "2,root.sg1.d2,2,2,2.0,2.0,true,t2,", - "3,root.sg1.d2,3,3,3.0,3.0,null,t3,", - "4,root.sg1.d2,4,4,4.0,4.0,false,null,", - "5,root.sg1.d2,5,5,5.0,5.0,false,t5,", - "6,root.sg1.d2,6,6,6.0,6.0,false,null,", - "8,root.sg1.d2,8,8,8.0,8.0,true,t8,", - "9,root.sg1.d2,null,9,null,9.0,null,t9," + "1,root.db1.d1,null,1,null,1.0,null,t1,", + "2,root.db1.d1,2,2,2.0,2.0,true,t2,", + "3,root.db1.d1,3,3,3.0,3.0,false,null,", + "4,root.db1.d1,4,4,4.0,4.0,null,t4,", + "5,root.db1.d1,5,5,5.0,5.0,false,t5,", + "6,root.db1.d1,6,6,6.0,6.0,null,t6,", + "8,root.db1.d1,8,8,8.0,8.0,true,t8,", + "9,root.db1.d1,9,9,9.0,9.0,true,null,", + "1,root.db1.d2,1,1,1.0,1.0,true,null,", + "2,root.db1.d2,2,2,2.0,2.0,true,t2,", + "3,root.db1.d2,3,3,3.0,3.0,null,t3,", + "4,root.db1.d2,4,4,4.0,4.0,false,null,", + "5,root.db1.d2,5,5,5.0,5.0,false,t5,", + "6,root.db1.d2,6,6,6.0,6.0,false,null,", + "8,root.db1.d2,8,8,8.0,8.0,true,t8,", + "9,root.db1.d2,null,9,null,9.0,null,t9," }; resultSetEqualTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.* fill(linear) align by device", + "select s1, s2, s3, s4, s5, s6 from root.db1.* fill(linear) align by device", expectedAlignByDeviceHeader, retArray); } @@ -266,7 +266,7 @@ public void intFillTest() { "9,9,1000,9.0,1000.0,true,1000," }; resultSetEqualWithDescOrderTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(1000)", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(1000)", expectedHeader, retArray); } @Test @@ -283,7 +283,7 @@ public void floatFillTest() { "9,9,null,9.0,3.14,true,3.14," }; resultSetEqualWithDescOrderTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(3.14)", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(3.14)", expectedHeader, retArray); } @Test @@ -300,7 +300,7 @@ public void booleanFillTest() { "9,9,null,9.0,null,true,true," }; resultSetEqualWithDescOrderTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(true)", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill(true)", expectedHeader, retArray); } @Test @@ -317,6 +317,6 @@ public void textFillTest() { "9,9,null,9.0,null,true,t0," }; resultSetEqualWithDescOrderTest( - "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill('t0')", expectedHeader, retArray); + "select s1, s2, s3, s4, s5, s6 from root.db1.d1 fill('t0')", expectedHeader, retArray); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryDemoIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryDemoIT.java index 198ea449dcc71..dd4b592abf285 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryDemoIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryDemoIT.java @@ -97,29 +97,29 @@ public class IoTDBQueryDemoIT { "insert into root.ln.wf02.wt02(timestamp,status) values(1509466020000,false)", "insert into root.ln.wf02.wt02(timestamp,status) values(1509466080000,false)", "insert into root.ln.wf02.wt02(timestamp,status) values(1509466140000,false)", - "CREATE DATABASE root.sgcc", - "create timeseries root.sgcc.wf03.wt01.status with datatype=BOOLEAN,encoding=PLAIN", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465600000,true)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465660000,true)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465720000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465780000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465840000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465900000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509465960000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466020000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466080000,false)", - "insert into root.sgcc.wf03.wt01(timestamp,status) values(1509466140000,false)", - "create timeseries root.sgcc.wf03.wt01.temperature with datatype=FLOAT,encoding=RLE", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465600000,25.957603)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465660000,24.359503)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465720000,20.092794)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465780000,20.182663)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465840000,21.125198)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465900000,22.720892)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509465960000,20.71)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466020000,21.451046)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466080000,22.57987)", - "insert into root.sgcc.wf03.wt01(timestamp,temperature) values(1509466140000,20.98177)", + "CREATE DATABASE root.dbcc", + "create timeseries root.dbcc.wf03.wt01.status with datatype=BOOLEAN,encoding=PLAIN", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465600000,true)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465660000,true)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465720000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465780000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465840000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465900000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509465960000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466020000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466080000,false)", + "insert into root.dbcc.wf03.wt01(timestamp,status) values(1509466140000,false)", + "create timeseries root.dbcc.wf03.wt01.temperature with datatype=FLOAT,encoding=RLE", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465600000,25.957603)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465660000,24.359503)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465720000,20.092794)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465780000,20.182663)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465840000,21.125198)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465900000,22.720892)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509465960000,20.71)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466020000,21.451046)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466080000,22.57987)", + "insert into root.dbcc.wf03.wt01(timestamp,temperature) values(1509466140000,20.98177)", }; @BeforeClass @@ -167,14 +167,14 @@ public void selectTest() { Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select * from root.ln.**,root.sgcc.** where time>10"); + statement.executeQuery("select * from root.ln.**,root.dbcc.** where time>10"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -226,14 +226,14 @@ public void LimitTest() { ResultSet resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time>10 limit 5 offset 3"); + "select * from root.ln.**,root.dbcc.** where time>10 limit 5 offset 3"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -265,15 +265,15 @@ public void LimitTest() { Assert.assertEquals(10000, statement.getFetchSize()); resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time>10 limit 5 offset 3"); + "select * from root.ln.**,root.dbcc.** where time>10 limit 5 offset 3"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -325,14 +325,14 @@ public void InTest() { Assert.assertEquals(4, statement.getFetchSize()); ResultSet resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); + "select * from root.ln.**,root.dbcc.** where time in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -369,15 +369,15 @@ public void InTest() { }; resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where time not in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); + "select * from root.ln.**,root.dbcc.** where time not in (1509465780000, 1509465840000, 1509465900000, 1509465960000, 1509466020000)"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, @@ -413,15 +413,15 @@ public void InTest() { resultSet = statement.executeQuery( - "select * from root.ln.**,root.sgcc.** where root.ln.wf01.wt01.temperature in (20.18, 20.71, 22.58)"); + "select * from root.ln.**,root.dbcc.** where root.ln.wf01.wt01.temperature in (20.18, 20.71, 22.58)"); resultSetMetaData = resultSet.getMetaData(); actualIndexToExpectedIndexList = checkHeader( resultSetMetaData, "Time,root.ln.wf01.wt01.status,root.ln.wf01.wt01.temperature," - + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.sgcc.wf03.wt01.status," - + "root.sgcc.wf03.wt01.temperature,", + + "root.ln.wf02.wt02.hardware,root.ln.wf02.wt02.status,root.dbcc.wf03.wt01.status," + + "root.dbcc.wf03.wt01.temperature,", new int[] { Types.TIMESTAMP, Types.BOOLEAN, diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryWithComplexValueFilterIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryWithComplexValueFilterIT.java index fa89c6ebc9996..c2b45219c1ed0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryWithComplexValueFilterIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBQueryWithComplexValueFilterIT.java @@ -57,7 +57,7 @@ public void testRawQuery1() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s1 from root.sg1.d1 where (time > 4 and s1 <= 6) or (s2 > 3 and time <= 5)")) { + "select s1 from root.db1.d1 where (time > 4 and s1 <= 6) or (s2 > 3 and time <= 5)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -76,7 +76,7 @@ public void testRawQuery2() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery( - "select s1 from root.sg1.d1 where (time > 4 and s1 <= 6) and (s2 > 3 and time <= 5)")) { + "select s1 from root.db1.d1 where (time > 4 and s1 <= 6) and (s2 > 3 and time <= 5)")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -95,7 +95,7 @@ public void testRawQuery3() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 == '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 == '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -104,7 +104,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 == '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 == '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -113,7 +113,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 == 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 == 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -122,7 +122,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 != '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 != '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -131,7 +131,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 != '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 != '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -140,7 +140,7 @@ public void testRawQuery3() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 != 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 != 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -158,7 +158,7 @@ public void testRawQuery4() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 > '0'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 > '0'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -167,7 +167,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 > '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 > '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -176,7 +176,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 > 0")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 > 0")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -185,7 +185,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 < '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 < '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -194,7 +194,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 < '2024-01-02'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 < '2024-01-02'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -203,7 +203,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 < 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 < 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -212,7 +212,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 >= '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 >= '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -221,7 +221,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 >= '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 >= '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -230,7 +230,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 >= 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 >= 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -239,7 +239,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 <= '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 <= '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -248,7 +248,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 <= '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 <= '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -257,7 +257,7 @@ public void testRawQuery4() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 <= 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 <= 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -275,7 +275,7 @@ public void testRawQuery5() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 == '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 == '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -284,7 +284,7 @@ public void testRawQuery5() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s3 == '1'")) { + statement.executeQuery("select s1 from root.db1.d1 where s3 == '1'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -293,7 +293,7 @@ public void testRawQuery5() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s4 == '2024-01-01'")) { + statement.executeQuery("select s1 from root.db1.d1 where s4 == '2024-01-01'")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -302,7 +302,7 @@ public void testRawQuery5() { } try (ResultSet resultSet = - statement.executeQuery("select s1 from root.sg1.d1 where s5 == 1")) { + statement.executeQuery("select s1 from root.db1.d1 where s5 == 1")) { int cnt = 0; while (resultSet.next()) { cnt++; @@ -318,28 +318,28 @@ public void testRawQuery5() { private static void prepareData() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("create database root.sg1"); - statement.execute("create timeseries root.sg1.d1.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("create timeseries root.sg1.d1.s2 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("create timeseries root.sg1.d1.s3 with datatype=STRING,encoding=PLAIN"); - statement.execute("create timeseries root.sg1.d1.s4 with datatype=DATE,encoding=PLAIN"); - statement.execute("create timeseries root.sg1.d1.s5 with datatype=TIMESTAMP,encoding=PLAIN"); + statement.execute("create database root.db1"); + statement.execute("create timeseries root.db1.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("create timeseries root.db1.d1.s2 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("create timeseries root.db1.d1.s3 with datatype=STRING,encoding=PLAIN"); + statement.execute("create timeseries root.db1.d1.s4 with datatype=DATE,encoding=PLAIN"); + statement.execute("create timeseries root.db1.d1.s5 with datatype=TIMESTAMP,encoding=PLAIN"); statement.execute( - "insert into root.sg1.d1(time,s1,s2,s3,s4,s5) values(0,0,0,'0','2024-01-01',0)"); + "insert into root.db1.d1(time,s1,s2,s3,s4,s5) values(0,0,0,'0','2024-01-01',0)"); statement.execute( - "insert into root.sg1.d1(time,s1,s2,s3,s4,s5) values(1,1,1,'1','2024-01-02',1)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(2,2,2)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(3,3,3)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(4,4,4)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(5,5,5)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(6,6,6)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(7,7,7)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(8,8,8)"); - statement.execute("insert into root.sg1.d1(time,s1,s2) values(9,9,9)"); + "insert into root.db1.d1(time,s1,s2,s3,s4,s5) values(1,1,1,'1','2024-01-02',1)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(2,2,2)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(3,3,3)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(4,4,4)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(5,5,5)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(6,6,6)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(7,7,7)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(8,8,8)"); + statement.execute("insert into root.db1.d1(time,s1,s2) values(9,9,9)"); // for (int i = 0; i < 10; i++) { // statement.addBatch( // String.format( - // "insert into root.sg1.d1(time,s1,s2) values(%d,%d,%f)", i, i, (double) i)); + // "insert into root.db1.d1(time,s1,s2) values(%d,%d,%f)", i, i, (double) i)); // } // statement.executeBatch(); } catch (Exception e) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java index 33648973284a5..e2f0b8e035d4c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java @@ -59,8 +59,8 @@ public class IoTDBResultSetIT { "CREATE TIMESERIES root.t1.wf01.wt02.temperature WITH DATATYPE=FLOAT, ENCODING=RLE", "CREATE TIMESERIES root.t1.wf01.wt02.type WITH DATATYPE=INT32, ENCODING=RLE", "CREATE TIMESERIES root.t1.wf01.wt02.grade WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.dev.status WITH DATATYPE=text,ENCODING=PLAIN", - "insert into root.sg.dev(time,status) values(1,3.14)" + "CREATE TIMESERIES root.db.dev.status WITH DATATYPE=text,ENCODING=PLAIN", + "insert into root.db.dev(time,status) values(1,3.14)" }; private static final String[] emptyResultSet = new String[] {}; @@ -119,14 +119,14 @@ public void columnTypeTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select status from root.sg.dev")) { + try (ResultSet resultSet = statement.executeQuery("select status from root.db.dev")) { Assert.assertTrue(resultSet.next()); ResultSetMetaData metaData = resultSet.getMetaData(); assertEquals(2, metaData.getColumnCount()); assertEquals("Time", metaData.getColumnName(1)); assertEquals(Types.TIMESTAMP, metaData.getColumnType(1)); assertEquals("TIMESTAMP", metaData.getColumnTypeName(1)); - assertEquals("root.sg.dev.status", metaData.getColumnName(2)); + assertEquals("root.db.dev.status", metaData.getColumnName(2)); assertEquals(Types.VARCHAR, metaData.getColumnType(2)); assertEquals("TEXT", metaData.getColumnTypeName(2)); } @@ -140,7 +140,7 @@ public void columnTypeTest() { @Test public void emptyQueryTest1() { String expectedHeader = ColumnHeaderConstant.TIME + ","; - resultSetEqualTest("select * from root.sg1.d1", expectedHeader, emptyResultSet); + resultSetEqualTest("select * from root.db1.d1", expectedHeader, emptyResultSet); } @Test @@ -180,7 +180,7 @@ public void emptyShowTimeseriesTest() { + "," + ColumnHeaderConstant.VIEW_TYPE + ","; - resultSetEqualTest("show timeseries root.sg1.**", expectedHeader, emptyResultSet); + resultSetEqualTest("show timeseries root.db1.**", expectedHeader, emptyResultSet); } @Test @@ -194,7 +194,7 @@ public void emptyShowDeviceTest() { + "," + ColumnHeaderConstant.COLUMN_TTL + ","; - resultSetEqualTest("show devices root.sg1.**", expectedHeader, emptyResultSet); + resultSetEqualTest("show devices root.db1.**", expectedHeader, emptyResultSet); } @Test @@ -204,20 +204,20 @@ public void timeWasNullTest() throws Exception { // create timeseries statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s3 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s3 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); for (int i = 0; i < 10; i++) { statement.addBatch( - "insert into root.sg1.d1(timestamp, s1, s2) values(" + i + "," + 1 + "," + 1 + ")"); + "insert into root.db1.d1(timestamp, s1, s2) values(" + i + "," + 1 + "," + 1 + ")"); } - statement.execute("insert into root.sg1.d1(timestamp, s3) values(103, 1)"); - statement.execute("insert into root.sg1.d1(timestamp, s3) values(104, 1)"); - statement.execute("insert into root.sg1.d1(timestamp, s3) values(105, 1)"); + statement.execute("insert into root.db1.d1(timestamp, s3) values(103, 1)"); + statement.execute("insert into root.db1.d1(timestamp, s3) values(104, 1)"); + statement.execute("insert into root.db1.d1(timestamp, s3) values(105, 1)"); statement.executeBatch(); try (ResultSet resultSet = statement.executeQuery("select * from root.**")) { ResultSetMetaData metaData = resultSet.getMetaData(); @@ -247,6 +247,6 @@ public void emptyLastQueryTest() { + "," + ColumnHeaderConstant.DATATYPE + ","; - resultSetEqualTest("select last s1 from root.sg.d1", expectedHeader, emptyResultSet); + resultSetEqualTest("select last s1 from root.db.d1", expectedHeader, emptyResultSet); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectCompareExpressionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectCompareExpressionIT.java index ddddf58725f58..8bdfa0916820d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectCompareExpressionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectCompareExpressionIT.java @@ -85,7 +85,7 @@ private static String generateInsertionSQL( String _text) { return String.format( Locale.CHINA, - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6) values (%d, %d, %d, %f, %f, %s, %s);", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6) values (%d, %d, %d, %f, %f, %s, %s);", time, intValue32, intValue64, @@ -117,13 +117,13 @@ private static void generateData() { private static void createTimeSeries() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s3 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s4 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s5 with datatype=BOOLEAN,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s6 with datatype=TEXT,encoding=PLAIN"); + statement.execute("CREATE DATABASE root.db"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s3 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s4 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s5 with datatype=BOOLEAN,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s6 with datatype=TEXT,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -142,7 +142,7 @@ public void testCompareWithConstant() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select s1>=5, s1<=5, s1>5, s1<5, s1==5, s1!=5 from root.sg.d1"); + statement.executeQuery("select s1>=5, s1<=5, s1>5, s1<5, s1==5, s1!=5 from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 6, columnCount); @@ -175,7 +175,7 @@ public void testCompareWithConstant() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select s2>=5, s2<=5, s2>5, s2<5, s2==5, s2!=5 from root.sg.d1"); + statement.executeQuery("select s2>=5, s2<=5, s2>5, s2<5, s2==5, s2!=5 from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 6, columnCount); @@ -208,7 +208,7 @@ public void testCompareWithConstant() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select s3>=5, s3<=5, s3>5, s3<5, s3==5, s3!=5 from root.sg.d1"); + statement.executeQuery("select s3>=5, s3<=5, s3>5, s3<5, s3==5, s3!=5 from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 6, columnCount); @@ -241,7 +241,7 @@ public void testCompareWithConstant() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select s4>=5, s4<=5, s4>5, s4<5, s4==5, s4!=5 from root.sg.d1"); + statement.executeQuery("select s4>=5, s4<=5, s4>5, s4<5, s4==5, s4!=5 from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 6, columnCount); @@ -274,7 +274,7 @@ public void testCompareWithConstant() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = - statement.executeQuery("select s5==true, s5!=true, s5==false, s5!=false from root.sg.d1"); + statement.executeQuery("select s5==true, s5!=true, s5==false, s5!=false from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 4, columnCount); @@ -305,7 +305,7 @@ public void testCompareDifferentType() { Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery( - "select s1>=s2, s1<=s2, s1>s3, s1=s2, s1<=s2, s1>s3, s1=s3, s2<=s3, s2>s4, s2=s3, s2<=s3, s2>s4, s2=s4, s3<=s4, s3>s1, s3=s4, s3<=s4, s3>s1, s3=s1, s4<=s1, s4>s2, s4=s1, s4<=s1, s4>s2, s4=1 && s1<3, !(s1 < 2 || s1> 8), !(s2>3) from root.sg.d1"); + "select s1>=1 && s1<3, !(s1 < 2 || s1> 8), !(s2>3) from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 3, columnCount); @@ -472,7 +472,7 @@ public void testComplexExpression() { Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery( - "select ( s1 + 1 ) * 2 - 4 < ( s3 * 3 - 6) / 2 && ( s1 + 5 ) * 2 > s2 * 3 + 4 from root.sg.d1"); + "select ( s1 + 1 ) * 2 - 4 < ( s3 * 3 - 6) / 2 && ( s1 + 5 ) * 2 > s2 * 3 + 4 from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 1, columnCount); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectSchemaIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectSchemaIT.java index 3fdf6f93d1437..c7cb573638cfc 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectSchemaIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBSelectSchemaIT.java @@ -42,15 +42,15 @@ @Category({LocalStandaloneIT.class, ClusterIT.class}) public class IoTDBSelectSchemaIT { private static String INSERTION_SQLS = - "insert into root.sg.d1(time, s1, s2, s3) values (1, 1, 2, 3.0);"; + "insert into root.db.d1(time, s1, s2, s3) values (1, 1, 2, 3.0);"; private static void createTimeSeries() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s3 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE DATABASE root.db"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s3 with datatype=DOUBLE,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -93,24 +93,24 @@ public void testSchemaExpression() { "((s1+1)*2-1)%2+1.5+s2" }; String[] completeExpressions = { - "root.sg.d1.s1+root.sg.d1.s2", - "-root.sg.d1.s1+root.sg.d1.s2", - "-(root.sg.d1.s1+root.sg.d1.s3)", - "!(root.sg.d1.s1>root.sg.d1.s2)", - "-(-root.sg.d1.s1)", - "(root.sg.d1.s1+root.sg.d1.s2)*root.sg.d1.s3", - "-2+root.sg.d1.s1", - "!true|root.sg.d1.s1>0", - "-(-1)+root.sg.d1.s1", - "sin(root.sg.d1.s1)+root.sg.d1.s1", - "((root.sg.d1.s1+1)*2-1)%2+1.5+root.sg.d1.s2", + "root.db.d1.s1+root.db.d1.s2", + "-root.db.d1.s1+root.db.d1.s2", + "-(root.db.d1.s1+root.db.d1.s3)", + "!(root.db.d1.s1>root.db.d1.s2)", + "-(-root.db.d1.s1)", + "(root.db.d1.s1+root.db.d1.s2)*root.db.d1.s3", + "-2+root.db.d1.s1", + "!true|root.db.d1.s1>0", + "-(-1)+root.db.d1.s1", + "sin(root.db.d1.s1)+root.db.d1.s1", + "((root.db.d1.s1+1)*2-1)%2+1.5+root.db.d1.s2", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery( String.format( - "select %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s from root.sg.d1", + "select %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s from root.db.d1", expressions[0], expressions[1], expressions[2], diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java index 7ed80f7ab4ad6..b8bc752a2dfcd 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/quotas/IoTDBSpaceQuotaIT.java @@ -64,16 +64,16 @@ public void tearDown() throws Exception { public void timeseriesNumExceedTest() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=3 on root.sg0"); + adminStmt.execute("set space quota timeseries=3 on root.db0"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); } catch (SQLException | InterruptedException throwables) { Assert.assertEquals( "1700: The number of timeseries has reached the upper limit", throwables.getMessage()); @@ -84,16 +84,16 @@ public void timeseriesNumExceedTest() { public void devicesNumExceedTest() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3 on root.sg0"); + adminStmt.execute("set space quota devices=3 on root.db0"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); adminStmt.execute( - "create timeseries root.sg0.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); } catch (SQLException | InterruptedException throwables) { Assert.assertEquals( "1700: The number of devices has reached the upper limit", throwables.getMessage()); @@ -104,42 +104,42 @@ public void devicesNumExceedTest() { public void setSpaceQuotaTest0() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=3 on root.sg0"); + adminStmt.execute("set space quota timeseries=3 on root.db0"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); - adminStmt.execute("set space quota timeseries=4 on root.sg0"); + adminStmt.execute("set space quota timeseries=4 on root.db0"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); } catch (SQLException | InterruptedException throwables) { Assert.fail(throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3 on root.sg1"); + adminStmt.execute("set space quota devices=3 on root.db1"); adminStmt.execute( - "create timeseries root.sg1.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg1.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg1.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); - adminStmt.execute("set space quota devices=4 on root.sg1"); + adminStmt.execute("set space quota devices=4 on root.db1"); adminStmt.execute( - "create timeseries root.sg1.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); } catch (SQLException | InterruptedException throwables) { Assert.fail(throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk=100M on root.sg2"); - adminStmt.execute("set space quota disk=200M on root.sg2"); + adminStmt.execute("set space quota disk=100M on root.db2"); + adminStmt.execute("set space quota disk=200M on root.db2"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } @@ -149,15 +149,15 @@ public void setSpaceQuotaTest0() { public void setSpaceQuotaTest1() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=3 on root.sg0"); + adminStmt.execute("set space quota timeseries=3 on root.db0"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); - adminStmt.execute("set space quota timeseries=2 on root.sg0"); + adminStmt.execute("set space quota timeseries=2 on root.db0"); } catch (SQLException | InterruptedException throwables) { Assert.assertEquals( "301: The used quota exceeds the preset quota. Please set a larger value.", @@ -166,15 +166,15 @@ public void setSpaceQuotaTest1() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3 on root.sg1"); + adminStmt.execute("set space quota devices=3 on root.db1"); adminStmt.execute( - "create timeseries root.sg1.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg1.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg1.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db1.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(ConfigNodeDescriptor.getInstance().getConf().getHeartbeatIntervalInMs() * 2); - adminStmt.execute("set space quota devices=2 on root.sg1"); + adminStmt.execute("set space quota devices=2 on root.db1"); } catch (SQLException | InterruptedException throwables) { Assert.assertEquals( "301: The used quota exceeds the preset quota. Please set a larger value.", @@ -186,7 +186,7 @@ public void setSpaceQuotaTest1() { public void setSpaceQuotaTest2() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=0 on root.sg0"); + adminStmt.execute("set space quota timeseries=0 on root.db0"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of timeseries greater than 0", throwables.getMessage()); @@ -194,7 +194,7 @@ public void setSpaceQuotaTest2() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=0 on root.sg1"); + adminStmt.execute("set space quota devices=0 on root.db1"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of devices greater than 0", throwables.getMessage()); @@ -202,14 +202,14 @@ public void setSpaceQuotaTest2() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk=0M on root.sg2"); + adminStmt.execute("set space quota disk=0M on root.db2"); } catch (SQLException throwables) { Assert.assertEquals("701: Please set the disk size greater than 0", throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=0,devices=0,disk=0M on root.sg3"); + adminStmt.execute("set space quota timeseries=0,devices=0,disk=0M on root.db3"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of devices greater than 0", throwables.getMessage()); @@ -220,33 +220,33 @@ public void setSpaceQuotaTest2() { public void setSpaceQuotaTest3() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=2 on root.sg0"); - adminStmt.execute("set space quota timeseries='unlimited' on root.sg0"); + adminStmt.execute("set space quota timeseries=2 on root.db0"); + adminStmt.execute("set space quota timeseries='unlimited' on root.db0"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=2 on root.sg1"); - adminStmt.execute("set space quota devices='unlimited' on root.sg1"); + adminStmt.execute("set space quota devices=2 on root.db1"); + adminStmt.execute("set space quota devices='unlimited' on root.db1"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk=10M on root.sg2"); - adminStmt.execute("set space quota disk='unlimited' on root.sg2"); + adminStmt.execute("set space quota disk=10M on root.db2"); + adminStmt.execute("set space quota disk='unlimited' on root.db2"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=2,devices=2,disk=10M on root.sg3"); + adminStmt.execute("set space quota timeseries=2,devices=2,disk=10M on root.db3"); adminStmt.execute( - "set space quota timeseries='unlimited',devices='unlimited',disk='unlimited' on root.sg3"); + "set space quota timeseries='unlimited',devices='unlimited',disk='unlimited' on root.db3"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } @@ -256,31 +256,31 @@ public void setSpaceQuotaTest3() { public void setSpaceQuotaTest4() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3,timeseries=5 on root.sg0;"); + adminStmt.execute("set space quota devices=3,timeseries=5 on root.db0;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt02.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt02.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt03.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt03.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt04.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt04.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status1 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status2 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); - adminStmt.execute("set space quota devices=4,timeseries=6 on root.sg0;"); + "create timeseries root.db0.wf01.wt01.status3 with datatype=BOOLEAN,encoding=PLAIN;"); + adminStmt.execute("set space quota devices=4,timeseries=6 on root.db0;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt05.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt05.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status5 with datatype=BOOLEAN,encoding=PLAIN;"); - adminStmt.execute("set space quota devices='unlimited',timeseries='unlimited' on root.sg0;"); + "create timeseries root.db0.wf01.wt01.status5 with datatype=BOOLEAN,encoding=PLAIN;"); + adminStmt.execute("set space quota devices='unlimited',timeseries='unlimited' on root.db0;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt06.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt06.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status6 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status6 with datatype=BOOLEAN,encoding=PLAIN;"); } catch (SQLException throwables) { Assert.fail(throwables.getMessage()); } @@ -290,21 +290,21 @@ public void setSpaceQuotaTest4() { public void setSpaceQuotaTest5() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.sg0;"); + adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.db0;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt02.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt02.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf01.wt02.status1 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt02.status1 with datatype=BOOLEAN,encoding=PLAIN;"); Thread.sleep(2000); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg0;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db0;"); String ans1 = - "root.sg0,diskSize,0.09765625G,0.0G" + "root.db0,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg0,deviceNum,3,2" + + "root.db0,deviceNum,3,2" + ",\n" - + "root.sg0,timeSeriesNum,5,3" + + "root.db0,timeSeriesNum,5,3" + ",\n"; validateResultSet(resultSet1, ans1); } catch (InterruptedException | SQLException e) { @@ -316,7 +316,7 @@ public void setSpaceQuotaTest5() { public void setSpaceQuotaTest6() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='100K' on root.sg0;"); + adminStmt.execute("set space quota disk='100K' on root.db0;"); } catch (SQLException e) { Assert.assertEquals( "701: When setting the disk size, the unit is incorrect. Please use 'M', 'G', 'P', 'T' as the unit", @@ -324,14 +324,14 @@ public void setSpaceQuotaTest6() { } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='100M' on root.sg0;"); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg0;"); + adminStmt.execute("set space quota disk='100M' on root.db0;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db0;"); String ans1 = - "root.sg0,diskSize,0.09765625G,0.0G" + "root.db0,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg0,deviceNum,unlimited,0" + + "root.db0,deviceNum,unlimited,0" + ",\n" - + "root.sg0,timeSeriesNum,unlimited,0" + + "root.db0,timeSeriesNum,unlimited,0" + ",\n"; validateResultSet(resultSet1, ans1); } catch (SQLException e) { @@ -339,14 +339,14 @@ public void setSpaceQuotaTest6() { } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='100G' on root.sg1;"); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg1;"); + adminStmt.execute("set space quota disk='100G' on root.db1;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db1;"); String ans1 = - "root.sg1,diskSize,100.0G,0.0G" + "root.db1,diskSize,100.0G,0.0G" + ",\n" - + "root.sg1,deviceNum,unlimited,0" + + "root.db1,deviceNum,unlimited,0" + ",\n" - + "root.sg1,timeSeriesNum,unlimited,0" + + "root.db1,timeSeriesNum,unlimited,0" + ",\n"; validateResultSet(resultSet1, ans1); } catch (SQLException e) { @@ -354,14 +354,14 @@ public void setSpaceQuotaTest6() { } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='100T' on root.sg2;"); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg2;"); + adminStmt.execute("set space quota disk='100T' on root.db2;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db2;"); String ans1 = - "root.sg2,diskSize,102400.0G,0.0G" + "root.db2,diskSize,102400.0G,0.0G" + ",\n" - + "root.sg2,deviceNum,unlimited,0" + + "root.db2,deviceNum,unlimited,0" + ",\n" - + "root.sg2,timeSeriesNum,unlimited,0" + + "root.db2,timeSeriesNum,unlimited,0" + ",\n"; validateResultSet(resultSet1, ans1); } catch (SQLException e) { @@ -369,14 +369,14 @@ public void setSpaceQuotaTest6() { } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='100P' on root.sg3;"); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg3;"); + adminStmt.execute("set space quota disk='100P' on root.db3;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db3;"); String ans1 = - "root.sg3,diskSize,1.048576E8G,0.0G" + "root.db3,diskSize,1.048576E8G,0.0G" + ",\n" - + "root.sg3,deviceNum,unlimited,0" + + "root.db3,deviceNum,unlimited,0" + ",\n" - + "root.sg3,timeSeriesNum,unlimited,0" + + "root.db3,timeSeriesNum,unlimited,0" + ",\n"; validateResultSet(resultSet1, ans1); } catch (SQLException e) { @@ -389,18 +389,18 @@ public void setSpaceQuotaTest7() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { adminStmt.execute( - "create timeseries root.sg0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf01.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf02.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf03.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + "create timeseries root.db0.wf04.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); adminStmt.execute( - "create timeseries root.sg0.wf05.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); - adminStmt.execute("set space quota devices=5 on root.sg0;"); - adminStmt.execute("set space quota disk='5g' on root.sg0;"); - adminStmt.execute("set space quota devices=10 on root.sg0;"); + "create timeseries root.db0.wf05.wt01.status0 with datatype=BOOLEAN,encoding=PLAIN;"); + adminStmt.execute("set space quota devices=5 on root.db0;"); + adminStmt.execute("set space quota disk='5g' on root.db0;"); + adminStmt.execute("set space quota devices=10 on root.db0;"); } catch (SQLException e) { Assert.fail(e.getMessage()); } @@ -410,7 +410,7 @@ public void setSpaceQuotaTest7() { public void setSpaceQuotaTest8() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=-5 on root.sg0"); + adminStmt.execute("set space quota timeseries=-5 on root.db0"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of timeseries greater than 0", throwables.getMessage()); @@ -418,7 +418,7 @@ public void setSpaceQuotaTest8() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=-6 on root.sg1"); + adminStmt.execute("set space quota devices=-6 on root.db1"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of devices greater than 0", throwables.getMessage()); @@ -426,14 +426,14 @@ public void setSpaceQuotaTest8() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota disk='-7M' on root.sg2"); + adminStmt.execute("set space quota disk='-7M' on root.db2"); } catch (SQLException throwables) { Assert.assertEquals("701: Please set the disk size greater than 0", throwables.getMessage()); } try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeseries=-5,devices=6,disk=0M on root.sg3"); + adminStmt.execute("set space quota timeseries=-5,devices=6,disk=0M on root.db3"); } catch (SQLException throwables) { Assert.assertEquals( "701: Please set the number of timeseries greater than 0", throwables.getMessage()); @@ -444,7 +444,7 @@ public void setSpaceQuotaTest8() { public void setSpaceQuotaTest9() { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota timeserie=5 on root.sg0"); + adminStmt.execute("set space quota timeserie=5 on root.db0"); } catch (SQLException throwables) { Assert.assertEquals("701: Wrong space quota type: timeserie", throwables.getMessage()); } @@ -455,31 +455,31 @@ public void showSpaceQuotaTest0() throws SQLException { IoTDBDescriptor.getInstance().getConfig().setQuotaEnable(true); try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.sg1,root.sg2;"); + adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.db1,root.db2;"); ResultSet resultSet1 = adminStmt.executeQuery("show space quota;"); String ans1 = - "root.sg1,diskSize,0.09765625G,0.0G" + "root.db1,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg1,deviceNum,3,0" + + "root.db1,deviceNum,3,0" + ",\n" - + "root.sg1,timeSeriesNum,5,0" + + "root.db1,timeSeriesNum,5,0" + ",\n" - + "root.sg2,diskSize,0.09765625G,0.0G" + + "root.db2,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg2,deviceNum,3,0" + + "root.db2,deviceNum,3,0" + ",\n" - + "root.sg2,timeSeriesNum,5,0" + + "root.db2,timeSeriesNum,5,0" + ",\n"; validateResultSet(resultSet1, ans1); adminStmt.execute( - "set space quota devices='unlimited',timeseries='unlimited',disk='unlimited' on root.sg1;"); - ResultSet resultSet2 = adminStmt.executeQuery("show space quota root.sg1;"); + "set space quota devices='unlimited',timeseries='unlimited',disk='unlimited' on root.db1;"); + ResultSet resultSet2 = adminStmt.executeQuery("show space quota root.db1;"); String ans2 = - "root.sg1,diskSize,unlimited,0.0G" + "root.db1,diskSize,unlimited,0.0G" + ",\n" - + "root.sg1,deviceNum,unlimited,0" + + "root.db1,deviceNum,unlimited,0" + ",\n" - + "root.sg1,timeSeriesNum,unlimited,0" + + "root.db1,timeSeriesNum,unlimited,0" + ",\n"; validateResultSet(resultSet2, ans2); IoTDBDescriptor.getInstance().getConfig().setQuotaEnable(false); @@ -490,20 +490,20 @@ public void showSpaceQuotaTest0() throws SQLException { public void showSpaceQuotaTest1() throws SQLException { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { - adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.sg4,root.sg5;"); - ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.sg4,root.sg5;"); + adminStmt.execute("set space quota devices=3,timeseries=5,disk='100M' on root.db4,root.db5;"); + ResultSet resultSet1 = adminStmt.executeQuery("show space quota root.db4,root.db5;"); String ans1 = - "root.sg4,diskSize,0.09765625G,0.0G" + "root.db4,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg4,deviceNum,3,0" + + "root.db4,deviceNum,3,0" + ",\n" - + "root.sg4,timeSeriesNum,5,0" + + "root.db4,timeSeriesNum,5,0" + ",\n" - + "root.sg5,diskSize,0.09765625G,0.0G" + + "root.db5,diskSize,0.09765625G,0.0G" + ",\n" - + "root.sg5,deviceNum,3,0" + + "root.db5,deviceNum,3,0" + ",\n" - + "root.sg5,timeSeriesNum,5,0" + + "root.db5,timeSeriesNum,5,0" + ",\n"; validateResultSet(resultSet1, ans1); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAutoCreateSchemaIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAutoCreateSchemaIT.java index 620411b8c78cc..4c325f14fc57d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAutoCreateSchemaIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAutoCreateSchemaIT.java @@ -76,8 +76,8 @@ public void tearDown() throws Exception { @Test public void createTimeseriesTest() throws ClassNotFoundException { String[] sqls = { - "CREATE TIMESERIES root.sg0.d1.s2 WITH DATATYPE=INT32,ENCODING=RLE", - "INSERT INTO root.sg0.d1(timestamp,s2) values(1,123)", + "CREATE TIMESERIES root.db0.d1.s2 WITH DATATYPE=INT32,ENCODING=RLE", + "INSERT INTO root.db0.d1(timestamp,s2) values(1,123)", }; executeSQL(sqls); } @@ -86,9 +86,9 @@ public void createTimeseriesTest() throws ClassNotFoundException { @Test public void insertTest1() throws ClassNotFoundException { String[] sqls = { - "CREATE DATABASE root.sg0", - "INSERT INTO root.sg0.d1(timestamp,s2) values(1,123.123)", - "INSERT INTO root.sg0.d1(timestamp,s3) values(1,\"abc\")", + "CREATE DATABASE root.db0", + "INSERT INTO root.db0.d1(timestamp,s2) values(1,123.123)", + "INSERT INTO root.db0.d1(timestamp,s3) values(1,\"abc\")", }; executeSQL(sqls); } @@ -97,9 +97,9 @@ public void insertTest1() throws ClassNotFoundException { @Test public void insertTest2() throws ClassNotFoundException { String[] sqls = { - "INSERT INTO root.sg0.d1(timestamp,s2) values(1,\"abc\")", - "INSERT INTO root.sg0.d2(timestamp,s3) values(1,123.123)", - "INSERT INTO root.sg0.d2(timestamp,s4) values(1,123456)", + "INSERT INTO root.db0.d1(timestamp,s2) values(1,\"abc\")", + "INSERT INTO root.db0.d2(timestamp,s3) values(1,123.123)", + "INSERT INTO root.db0.d2(timestamp,s4) values(1,123456)", }; executeSQL(sqls); } @@ -164,8 +164,8 @@ private void executeSQL(String[] sqls) throws ClassNotFoundException { */ @Test public void testInsertAutoCreate2() throws Exception { - String database = "root.sg2.a.b.c"; - String timeSeriesPrefix = "root.sg2.a.b"; + String database = "root.db2.a.b.c"; + String timeSeriesPrefix = "root.db2.a.b"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -213,8 +213,8 @@ private void InsertAutoCreate2Tool(Statement statement, String database, String @Test public void testInsertAutoCreate3() throws SQLException { String[] sqls = { - "INSERT INTO root.sg0.d3(timestamp,s1) values(1,null)", - "INSERT INTO root.sg0.d3(timestamp,s1,s2) values(1,null,2)", + "INSERT INTO root.db0.d3(timestamp,s1) values(1,null)", + "INSERT INTO root.db0.d3(timestamp,s1,s2) values(1,null,2)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -222,7 +222,7 @@ public void testInsertAutoCreate3() throws SQLException { try { statement.execute(sql); } catch (SQLException e) { - Assert.assertTrue(e.getMessage().contains("Path [root.sg0.d3.s1] does not exist")); + Assert.assertTrue(e.getMessage().contains("Path [root.db0.d3.s1] does not exist")); } } } @@ -234,34 +234,34 @@ public void testInsertAutoCreate3() throws SQLException { @Test public void testAutoCreateDataType() throws SQLException { String SQL = - "INSERT INTO root.sg0.d1(time,s1,s2,s3,s4,s5,s6) values(1,true,1,now(),X'cafe',\"string\",\"2024-01-01\")"; + "INSERT INTO root.db0.d1(time,s1,s2,s3,s4,s5,s6) values(1,true,1,now(),X'cafe',\"string\",\"2024-01-01\")"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute(SQL); ResultSet resultSet = statement.executeQuery("show timeseries"); while (resultSet.next()) { switch (resultSet.getString(ColumnHeaderConstant.TIMESERIES)) { - case "root.sg0.d1.s1": + case "root.db0.d1.s1": assertEquals( TSDataType.BOOLEAN.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; - case "root.sg0.d1.s2": + case "root.db0.d1.s2": assertEquals( TSDataType.DOUBLE.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; - case "root.sg0.d1.s3": + case "root.db0.d1.s3": assertEquals( TSDataType.INT64.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; - case "root.sg0.d1.s4": + case "root.db0.d1.s4": assertEquals( TSDataType.BLOB.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; - case "root.sg0.d1.s5": + case "root.db0.d1.s5": assertEquals( TSDataType.TEXT.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; - case "root.sg0.d1.s6": + case "root.db0.d1.s6": assertEquals( TSDataType.TEXT.toString(), resultSet.getString(ColumnHeaderConstant.DATATYPE)); break; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCountDeviceIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCountDeviceIT.java index 5478c7e341e4c..7a7e614db60a9 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCountDeviceIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCountDeviceIT.java @@ -168,26 +168,26 @@ public void testCountDevicesWithSpecificPath() throws Exception { Statement statement = connection.createStatement()) { // Create database - statement.execute("CREATE DATABASE root.sg"); + statement.execute("CREATE DATABASE root.db"); // Create devices - statement.execute("CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.g1.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.g2.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d2.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.g1.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.g2.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s1 WITH DATATYPE=INT64, ENCODING=PLAIN"); - // Count devices exactly under root.sg.d1 - long countResult = getCountDevices(statement, "root.sg.d1.*"); + // Count devices exactly under root.db.d1 + long countResult = getCountDevices(statement, "root.db.d1.*"); // Get actual device count using show devices - long showDevicesCount = getShowDevicesCount(statement, "root.sg.d1.*"); + long showDevicesCount = getShowDevicesCount(statement, "root.db.d1.*"); // They should match Assert.assertEquals( "Count devices should match show devices count", showDevicesCount, countResult); - // Expected: root.sg.d1.g1, root.sg.d1.g2 = 2 devices - Assert.assertEquals("Should have exactly 2 devices under root.sg.d1", 2, countResult); + // Expected: root.db.d1.g1, root.db.d1.g2 = 2 devices + Assert.assertEquals("Should have exactly 2 devices under root.db.d1", 2, countResult); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateAlignedTimeseriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateAlignedTimeseriesIT.java index 7b784c034ab60..1536efee97b04 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateAlignedTimeseriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateAlignedTimeseriesIT.java @@ -71,14 +71,14 @@ public void tearDown() throws Exception { public void testCreateAlignedTimeseries() throws Exception { String[] timeSeriesArray = new String[] { - "root.sg1.d1.vector1.s1,FLOAT,PLAIN,UNCOMPRESSED", "root.sg1.d1.vector1.s2,INT64,RLE,LZ4" + "root.db1.d1.vector1.s1,FLOAT,PLAIN,UNCOMPRESSED", "root.db1.d1.vector1.s2,INT64,RLE,LZ4" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); try { statement.execute( - "CREATE ALIGNED TIMESERIES root.sg1.d1.vector1(s1 FLOAT encoding=PLAIN compressor=UNCOMPRESSED,s2 INT64 encoding=RLE)"); + "CREATE ALIGNED TIMESERIES root.db1.d1.vector1(s1 FLOAT encoding=PLAIN compressor=UNCOMPRESSED,s2 INT64 encoding=RLE)"); } catch (SQLException ignored) { } @@ -97,17 +97,17 @@ public void testCreateAlignedTimeseries() throws Exception { public void testCreateAlignedTimeseriesWithDeletion() throws Exception { String[] timeSeriesArray = new String[] { - "root.sg1.d1.vector1.s1,DOUBLE,PLAIN,SNAPPY", "root.sg1.d1.vector1.s2,INT64,RLE,LZ4" + "root.db1.d1.vector1.s1,DOUBLE,PLAIN,SNAPPY", "root.db1.d1.vector1.s2,INT64,RLE,LZ4" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); try { statement.execute( - "CREATE ALIGNED TIMESERIES root.sg1.d1.vector1(s1 FLOAT encoding=PLAIN compressor=UNCOMPRESSED,s2 INT64 encoding=RLE)"); - statement.execute("DELETE TIMESERIES root.sg1.d1.vector1.s1"); + "CREATE ALIGNED TIMESERIES root.db1.d1.vector1(s1 FLOAT encoding=PLAIN compressor=UNCOMPRESSED,s2 INT64 encoding=RLE)"); + statement.execute("DELETE TIMESERIES root.db1.d1.vector1.s1"); statement.execute( - "CREATE ALIGNED TIMESERIES root.sg1.d1.vector1(s1 DOUBLE encoding=PLAIN compressor=SNAPPY)"); + "CREATE ALIGNED TIMESERIES root.db1.d1.vector1(s1 DOUBLE encoding=PLAIN compressor=SNAPPY)"); } catch (SQLException e) { e.printStackTrace(); } @@ -129,7 +129,7 @@ private void assertTimeseriesEquals(String[] timeSeriesArray) throws SQLExceptio int count = 0; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { while (resultSet.next()) { String ActualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -151,13 +151,13 @@ public void testDifferentDeviceAlignment() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // Should ignore the alignment difference - statement.execute("create aligned timeseries root.sg2.d (s2 int64, s3 int64)"); + statement.execute("create aligned timeseries root.db2.d (s2 int64, s3 int64)"); // Should use the existing alignment - statement.execute("create timeseries root.sg2.d.s1 with datatype=INT64"); - statement.execute("insert into root.sg2.d (time, s4) values (-1, 1)"); + statement.execute("create timeseries root.db2.d.s1 with datatype=INT64"); + statement.execute("insert into root.db2.d (time, s4) values (-1, 1)"); TestUtils.assertResultSetEqual( - statement.executeQuery("select * from root.sg2.d"), - "Time,root.sg2.d.s3,root.sg2.d.s4,root.sg2.d.s1,root.sg2.d.s2,", + statement.executeQuery("select * from root.db2.d"), + "Time,root.db2.d.s3,root.db2.d.s4,root.db2.d.s1,root.db2.d.s2,", Collections.singleton("-1,null,1.0,null,null,")); } catch (SQLException ignored) { fail(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateDatabaseIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateDatabaseIT.java index 8681878d254cb..c1d0b06e88e55 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateDatabaseIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateDatabaseIT.java @@ -73,7 +73,7 @@ public void tearDown() throws Exception { /** The test creates three databases */ @Test public void testCreateDatabase() throws Exception { - final String[] databases = {"root.sg1", "root.sg2", "root.sg3"}; + final String[] databases = {"root.db1", "root.db2", "root.db3"}; try (final Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (final String database : databases) { @@ -95,7 +95,7 @@ private void createDatabaseTool(final Statement statement, final String[] Databa throws SQLException { List resultList = new ArrayList<>(); - try (final ResultSet resultSet = statement.executeQuery("SHOW DATABASES root.sg*")) { + try (final ResultSet resultSet = statement.executeQuery("SHOW DATABASES root.db*")) { while (resultSet.next()) { final String databasePath = resultSet.getString(ColumnHeaderConstant.DATABASE); resultList.add(databasePath); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java index b2b6f1c1078ad..419f75e30a639 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java @@ -74,7 +74,7 @@ public void tearDown() throws Exception { /** Test if creating a time series will cause the database with same name to disappear */ @Test public void testCreateTimeseries() throws Exception { - String database = "root.sg1.a.b.c"; + String database = "root.db1.a.b.c"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -126,7 +126,7 @@ public void testCreateTimeseriesWithSpecialCharacter() throws Exception { statement.execute( String.format( "create timeseries %s with datatype=INT64, encoding=PLAIN, compression=SNAPPY", - "root.sg.d.a\".\"b")); + "root.db.d.a\".\"b")); fail(); } catch (SQLException ignored) { } @@ -134,7 +134,7 @@ public void testCreateTimeseriesWithSpecialCharacter() throws Exception { statement.execute( String.format( "create timeseries %s with datatype=INT64, encoding=PLAIN, compression=SNAPPY", - "root.sg.d.a“(Φ)”b")); + "root.db.d.a“(Φ)”b")); fail(); } catch (SQLException ignored) { } @@ -142,17 +142,17 @@ public void testCreateTimeseriesWithSpecialCharacter() throws Exception { statement.execute( String.format( "create timeseries %s with datatype=INT64, encoding=PLAIN, compression=SNAPPY", - "root.sg.d.a>b")); + "root.db.d.a>b")); fail(); } catch (SQLException ignored) { } } String[] timeSeriesArray = { - "root.sg.d.`a.b`", "root.sg.d.`a“(Φ)”b`", "root.sg.d.`a>b`", "root.sg.d.`0e38`" + "root.db.d.`a.b`", "root.db.d.`a“(Φ)”b`", "root.db.d.`a>b`", "root.db.d.`0e38`" }; String[] timeSeriesResArray = { - "root.sg.d.`a.b`", "root.sg.d.`a“(Φ)”b`", "root.sg.d.`a>b`", "root.sg.d.`0e38`", + "root.db.d.`a.b`", "root.db.d.`a“(Φ)”b`", "root.db.d.`a>b`", "root.db.d.`0e38`", }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -173,7 +173,7 @@ private void createTimeSeriesWithSpecialCharacterTool(String[] timeSeriesArray) throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("count timeseries root.sg.**")) { + ResultSet resultSet = statement.executeQuery("count timeseries root.db.**")) { while (resultSet.next()) { long count = resultSet.getLong(1); Assert.assertEquals(timeSeriesArray.length, count); @@ -186,14 +186,14 @@ public void testCreateTimeSeriesWithWrongAttribute() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - String.format("create timeseries %s with datatype=INT64, datatype = test", "root.sg.a")); + String.format("create timeseries %s with datatype=INT64, datatype = test", "root.db.a")); fail(); } catch (SQLException ignored) { } try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute(String.format("create timeseries %s with encoding=plain", "root.sg.a")); + statement.execute(String.format("create timeseries %s with encoding=plain", "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -202,7 +202,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { Statement statement = connection.createStatement()) { statement.execute( String.format( - "create timeseries %s with encoding=plain, compressor=snappy", "root.sg.a")); + "create timeseries %s with encoding=plain, compressor=snappy", "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -210,7 +210,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - String.format("create timeseries %s with datatype=float, encoding=plan", "root.sg.a")); + String.format("create timeseries %s with datatype=float, encoding=plan", "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -218,7 +218,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - String.format("create timeseries %s with datatype=INT64, encoding=test", "root.sg.a")); + String.format("create timeseries %s with datatype=INT64, encoding=test", "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -228,7 +228,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { statement.execute( String.format( "create timeseries %s with datatype=INT64, encoding=test, compression=test", - "root.sg.a")); + "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -236,7 +236,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - String.format("create timeseries %s with datatype=INT64,compression=test", "root.sg.a")); + String.format("create timeseries %s with datatype=INT64,compression=test", "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -246,7 +246,7 @@ public void testCreateTimeSeriesWithWrongAttribute() { statement.execute( String.format( "create timeseries %s with datatype=INT64, encoding=PLAIN, compression=test", - "root.sg.a")); + "root.db.a")); fail(); } catch (SQLException ignored) { } @@ -256,14 +256,14 @@ public void testCreateTimeSeriesWithWrongAttribute() { public void testQueryDataFromTimeSeriesWithoutData() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("create timeseries root.sg2.d.s1 with datatype=INT64"); + statement.execute("create timeseries root.db2.d.s1 with datatype=INT64"); } catch (SQLException ignored) { fail(); } int cnt = 0; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement(); - ResultSet resultSet = statement.executeQuery("select s1 from root.sg2.d")) { + ResultSet resultSet = statement.executeQuery("select s1 from root.db2.d")) { while (resultSet.next()) { cnt++; } @@ -277,19 +277,19 @@ public void testQueryDataFromTimeSeriesWithoutData() { public void testIllegalInput() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("create timeseries root.sg2.d.s1 with datatype=INT64"); + statement.execute("create timeseries root.db2.d.s1 with datatype=INT64"); assertThrows( "Unsupported datatype: UNKNOWN", SQLException.class, - () -> statement.execute("create timeseries root.sg2.d.s1 with datatype=UNKNOWN")); + () -> statement.execute("create timeseries root.db2.d.s1 with datatype=UNKNOWN")); assertThrows( "Unsupported datatype: VECTOR", SQLException.class, - () -> statement.execute("create timeseries root.sg2.d.s1 with datatype=VECTOR")); + () -> statement.execute("create timeseries root.db2.d.s1 with datatype=VECTOR")); assertThrows( "Unsupported datatype: YES", SQLException.class, - () -> statement.execute("create timeseries root.sg2.d.s1 with datatype=YES")); + () -> statement.execute("create timeseries root.db2.d.s1 with datatype=YES")); assertThrows( "Unsupported datatype: UNKNOWN", SQLException.class, @@ -307,14 +307,14 @@ public void testIllegalInput() { public void testDifferentDeviceAlignment() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("create timeseries root.sg2.d.s1 with datatype=INT64"); + statement.execute("create timeseries root.db2.d.s1 with datatype=INT64"); // Should ignore the alignment difference - statement.execute("create aligned timeseries root.sg2.d (s2 int64, s3 int64)"); + statement.execute("create aligned timeseries root.db2.d (s2 int64, s3 int64)"); // Should use the existing alignment - statement.execute("insert into root.sg2.d (time, s4) aligned values (-1, 1)"); + statement.execute("insert into root.db2.d (time, s4) aligned values (-1, 1)"); TestUtils.assertResultSetEqual( - statement.executeQuery("select * from root.sg2.d"), - "Time,root.sg2.d.s3,root.sg2.d.s4,root.sg2.d.s1,root.sg2.d.s2,", + statement.executeQuery("select * from root.db2.d"), + "Time,root.db2.d.s3,root.db2.d.s4,root.db2.d.s1,root.db2.d.s2,", Collections.singleton("-1,null,1.0,null,null,")); } catch (SQLException ignored) { fail(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeactivateTemplateIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeactivateTemplateIT.java index 22572aac6eeb6..9359874c7ac4b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeactivateTemplateIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeactivateTemplateIT.java @@ -72,23 +72,23 @@ private void prepareTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE DATABASE root.sg2"); - statement.execute("CREATE DATABASE root.sg3"); - statement.execute("CREATE DATABASE root.sg4"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE DATABASE root.db2"); + statement.execute("CREATE DATABASE root.db3"); + statement.execute("CREATE DATABASE root.db4"); // create device template statement.execute("CREATE DEVICE TEMPLATE t1 (s1 INT64, s2 DOUBLE)"); statement.execute("CREATE DEVICE TEMPLATE t2 (s1 INT64, s2 DOUBLE)"); // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg2"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg3"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg4"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db2"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db3"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db4"); for (int j = 1; j <= 4; j++) { - statement.execute(String.format("create timeseries of device template on root.sg%d.d1", j)); + statement.execute(String.format("create timeseries of device template on root.db%d.d1", j)); } } } @@ -97,26 +97,26 @@ private void prepareTemplate() throws SQLException { public void deactivateTemplateAndReactivateTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.sg1.d1"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.db1.d1"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); } - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d1"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d1"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(3, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); } - statement.execute("insert into root.sg1.d1(time, s1, s2) values(1, 1, 1)"); + statement.execute("insert into root.db1.d1(time, s1, s2) values(1, 1, 1)"); String[] retArray = new String[] {"1,1,1.0,"}; int cnt = 0; - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(3, resultSetMetaData.getColumnCount()); while (resultSet.next()) { @@ -136,13 +136,13 @@ public void deactivateTemplateAndReactivateTest() throws Exception { public void deactivateTemplateAndAutoDeleteDeviceTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.sg1.d1"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.db1.d1"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertFalse(resultSet.next()); } @@ -151,7 +151,7 @@ public void deactivateTemplateAndAutoDeleteDeviceTest() throws Exception { @Test public void deactivateTemplateCrossSchemaRegionTest() throws Exception { - String insertSql = "insert into root.sg1.d%d(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db1.d%d(time, s1, s2) values(%d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -160,8 +160,8 @@ public void deactivateTemplateCrossSchemaRegionTest() throws Exception { } } - statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.sg1.*"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.**")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.db1.*"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.**")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); @@ -171,7 +171,7 @@ public void deactivateTemplateCrossSchemaRegionTest() throws Exception { @Test public void deactivateTemplateCrossDatabaseTest() throws Exception { - String insertSql = "insert into root.sg%d.d2(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db%d.d2(time, s1, s2) values(%d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -184,7 +184,7 @@ public void deactivateTemplateCrossDatabaseTest() throws Exception { String[] retArray = new String[] {"1,1,1.0,1,1.0,", "2,2,2.0,2,2.0,", "3,3,3.0,3,3.0,", "4,4,4.0,4,4.0,"}; int cnt = 0; - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.**,root.sg2.**")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.**,root.db2.**")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(5, resultSetMetaData.getColumnCount()); while (resultSet.next()) { @@ -198,8 +198,8 @@ public void deactivateTemplateCrossDatabaseTest() throws Exception { Assert.assertEquals(retArray.length, cnt); } - statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.**, root.sg1.*"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.**,root.sg2.**")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.**, root.db1.*"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.**,root.db2.**")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); @@ -211,8 +211,8 @@ public void deactivateTemplateCrossDatabaseTest() throws Exception { public void deactivateTemplateWithMultiPatternTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.sg1.d1, root.sg2.*"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*, root.sg2.*")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.db1.d1, root.db2.*"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*, root.db2.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); @@ -225,19 +225,19 @@ public void deactivateNoneUsageTemplateTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try { - statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.sg5.d1"); + statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.db5.d1"); Assert.fail(); } catch (SQLException e) { Assert.assertEquals( TSStatusCode.TEMPLATE_NOT_SET.getStatusCode() - + ": Device Template t1 is not set on any prefix path of [root.sg5.d1]", + + ": Device Template t1 is not set on any prefix path of [root.db5.d1]", e.getMessage()); } - statement.execute("CREATE DATABASE root.sg5"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg5 "); + statement.execute("CREATE DATABASE root.db5"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db5 "); try { - statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.sg5.d1"); + statement.execute("DEACTIVATE DEVICE TEMPLATE t1 FROM root.db5.d1"); Assert.fail(); } catch (SQLException e) { Assert.assertEquals( @@ -252,22 +252,22 @@ public void deactivateNoneUsageTemplateTest() throws Exception { public void multiSyntaxTest() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("DELETE TIMESERIES OF DEVICE TEMPLATE t1 FROM root.sg1.d1"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.*")) { + statement.execute("DELETE TIMESERIES OF DEVICE TEMPLATE t1 FROM root.db1.d1"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); } - statement.execute("DEACTIVATE DEVICE TEMPLATE t2 FROM root.sg3.d1"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg3.*")) { + statement.execute("DEACTIVATE DEVICE TEMPLATE t2 FROM root.db3.d1"); + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db3.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); } statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.**"); - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg1.**,root.sg2.**")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db1.**,root.db2.**")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Assert.assertEquals(1, resultSetMetaData.getColumnCount()); Assert.assertFalse(resultSet.next()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteAlignedTimeseriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteAlignedTimeseriesIT.java index 2ade000fbb664..c0f02f111d30e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteAlignedTimeseriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteAlignedTimeseriesIT.java @@ -160,23 +160,23 @@ public void deleteTimeseriesAndChangeDeviceAlignmentTest() throws Exception { int cnt = 0; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("INSERT INTO root.sg3.d1(timestamp,s1,s2) ALIGNED VALUES(1,1,2)"); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg3.**")) { + statement.execute("INSERT INTO root.db3.d1(timestamp,s1,s2) ALIGNED VALUES(1,1,2)"); + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db3.**")) { while (resultSet.next()) { Assert.assertEquals("true", resultSet.getString(ColumnHeaderConstant.IS_ALIGNED)); } } cnt = 0; - statement.execute("DELETE timeseries root.sg3.d1.s1"); - statement.execute("DELETE timeseries root.sg3.d1.s2"); - statement.execute("INSERT INTO root.sg3.d1(timestamp,s1,s2) VALUES(1,1,2)"); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg3.**")) { + statement.execute("DELETE timeseries root.db3.d1.s1"); + statement.execute("DELETE timeseries root.db3.d1.s2"); + statement.execute("INSERT INTO root.db3.d1(timestamp,s1,s2) VALUES(1,1,2)"); + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db3.**")) { while (resultSet.next()) { Assert.assertEquals("false", resultSet.getString(ColumnHeaderConstant.IS_ALIGNED)); } } - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg3.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db3.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); while (resultSet.next()) { StringBuilder builder = new StringBuilder(); @@ -188,16 +188,16 @@ public void deleteTimeseriesAndChangeDeviceAlignmentTest() throws Exception { } } cnt = 0; - statement.execute("DELETE timeseries root.sg3.d1.s1"); - statement.execute("DELETE timeseries root.sg3.d1.s2"); - statement.execute("INSERT INTO root.sg3.d1(timestamp,s1,s2) ALIGNED VALUES(1,1,2)"); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg3.**")) { + statement.execute("DELETE timeseries root.db3.d1.s1"); + statement.execute("DELETE timeseries root.db3.d1.s2"); + statement.execute("INSERT INTO root.db3.d1(timestamp,s1,s2) ALIGNED VALUES(1,1,2)"); + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db3.**")) { while (resultSet.next()) { Assert.assertEquals("true", resultSet.getString(ColumnHeaderConstant.IS_ALIGNED)); } } - try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.sg3.d1")) { + try (ResultSet resultSet = statement.executeQuery("SELECT * FROM root.db3.d1")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); while (resultSet.next()) { StringBuilder builder = new StringBuilder(); @@ -217,21 +217,21 @@ public void deleteTimeSeriesMultiIntervalTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - String insertSql = "insert into root.sg.d1(time, s1) aligned values(%d, %d)"; + String insertSql = "insert into root.db.d1(time, s1) aligned values(%d, %d)"; for (int i = 1; i <= 4; i++) { statement.execute(String.format(insertSql, i, i)); } statement.execute("flush"); - statement.execute("delete from root.sg.d1.s1 where time >= 1 and time <= 2"); - statement.execute("delete from root.sg.d1.s1 where time >= 3 and time <= 4"); + statement.execute("delete from root.db.d1.s1 where time >= 1 and time <= 2"); + statement.execute("delete from root.db.d1.s1 where time >= 3 and time <= 4"); int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(s1) from root.sg.d1 where time >= 3 and time <= 4")) { + "select count(s1) from root.db.d1 where time >= 3 and time <= 4")) { while (resultSet.next()) { - String ans = resultSet.getString(count("root.sg.d1.s1")); + String ans = resultSet.getString(count("root.db.d1.s1")); Assert.assertEquals(retArray1[cnt], ans); cnt++; } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteDatabaseIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteDatabaseIT.java index 4de6b726d44ec..11bb3770dce9c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteDatabaseIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteDatabaseIT.java @@ -168,17 +168,17 @@ public void testDeleteAllDatabases() throws Exception { public void testDeleteDatabaseAndThenQuery() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg1.d1(time,s1) values(1,1);"); + statement.execute("insert into root.db1.d1(time,s1) values(1,1);"); statement.execute("flush"); - statement.execute("select count(*) from root.sg1.**;"); - statement.execute("delete database root.sg1"); - statement.execute("insert into root.sg1.sdhkajhd(time,s1) values(1,1);"); + statement.execute("select count(*) from root.db1.**;"); + statement.execute("delete database root.db1"); + statement.execute("insert into root.db1.sdhkajhd(time,s1) values(1,1);"); statement.execute("flush"); int count = 0; - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.**")) { while (resultSet.next()) { count++; - assertEquals(1, resultSet.getLong("count(root.sg1.sdhkajhd.s1)")); + assertEquals(1, resultSet.getLong("count(root.db1.sdhkajhd.s1)")); } } assertEquals(1, count); @@ -190,15 +190,15 @@ public void testDeleteDatabaseInvalidateCache() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { try { - statement.execute("insert into root.sg1.d1(s1) values(1);"); - statement.execute("insert into root.sg2(s2) values(1);"); - statement.execute("select last(s1) from root.sg1.d1;"); - statement.execute("select last(s2) from root.sg2;"); - statement.execute("insert into root.sg1.d1(s1) values(1);"); - statement.execute("insert into root.sg2(s2) values(1);"); + statement.execute("insert into root.db1.d1(s1) values(1);"); + statement.execute("insert into root.db2(s2) values(1);"); + statement.execute("select last(s1) from root.db1.d1;"); + statement.execute("select last(s2) from root.db2;"); + statement.execute("insert into root.db1.d1(s1) values(1);"); + statement.execute("insert into root.db2(s2) values(1);"); statement.execute("delete database root.**"); - statement.execute("insert into root.sg1.d1(s1) values(\"2001-08-01\");"); - statement.execute("insert into root.sg2(s2) values(\"2001-08-01\");"); + statement.execute("insert into root.db1.d1(s1) values(\"2001-08-01\");"); + statement.execute("insert into root.db2(s2) values(\"2001-08-01\");"); } catch (final Exception e) { Assert.fail(e.getMessage()); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteTimeSeriesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteTimeSeriesIT.java index 0866b37836e23..9dfc4c9df11e2 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteTimeSeriesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteTimeSeriesIT.java @@ -173,21 +173,21 @@ public void deleteTimeSeriesMultiIntervalTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - String insertSql = "insert into root.sg.d1(time, s1) values(%d, %d)"; + String insertSql = "insert into root.db.d1(time, s1) values(%d, %d)"; for (int i = 1; i <= 4; i++) { statement.execute(String.format(insertSql, i, i)); } statement.execute("flush"); - statement.execute("delete from root.sg.d1.s1 where time >= 1 and time <= 2"); - statement.execute("delete from root.sg.d1.s1 where time >= 3 and time <= 4"); + statement.execute("delete from root.db.d1.s1 where time >= 1 and time <= 2"); + statement.execute("delete from root.db.d1.s1 where time >= 3 and time <= 4"); int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(s1) from root.sg.d1 where time >= 3 and time <= 4")) { + "select count(s1) from root.db.d1 where time >= 3 and time <= 4")) { while (resultSet.next()) { - String ans = resultSet.getString(count("root.sg.d1.s1")); + String ans = resultSet.getString(count("root.db.d1.s1")); Assert.assertEquals(retArray1[cnt], ans); cnt++; } @@ -203,7 +203,7 @@ public void deleteTimeSeriesMultiIntervalTest() { public void deleteTimeSeriesAndAutoDeleteDeviceTest() throws Exception { String[] retArray1 = new String[] {"4,4,4,4"}; - String insertSql = "insert into root.sg.d1(time, s1, s2, s3, s4) values(%d, %d, %d, %d, %d)"; + String insertSql = "insert into root.db.d1(time, s1, s2, s3, s4) values(%d, %d, %d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -213,11 +213,11 @@ public void deleteTimeSeriesAndAutoDeleteDeviceTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), count(s2), count(s3), count(s4) from root.sg.d1")) { + "select count(s1), count(s2), count(s3), count(s4) from root.db.d1")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg.d1.s1"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db.d1.s1"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg.d1.s" + i))); + ans.append(",").append(resultSet.getString(count("root.db.d1.s" + i))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -225,16 +225,16 @@ public void deleteTimeSeriesAndAutoDeleteDeviceTest() throws Exception { Assert.assertEquals(retArray1.length, cnt); } - statement.execute("delete timeseries root.sg.d1.*"); - try (ResultSet resultSet = statement.executeQuery("select * from root.sg.d1")) { + statement.execute("delete timeseries root.db.d1.*"); + try (ResultSet resultSet = statement.executeQuery("select * from root.db.d1")) { Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg.d1.*")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db.d1.*")) { Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("show devices root.sg.d1")) { + try (ResultSet resultSet = statement.executeQuery("show devices root.db.d1")) { Assert.assertFalse(resultSet.next()); } } @@ -244,9 +244,9 @@ public void deleteTimeSeriesAndAutoDeleteDeviceTest() throws Exception { public void deleteTimeSeriesAndInvalidationTest() throws Exception { try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { - statement.execute("insert into root.sg.d1 (c1, c2) values (1, 1)"); - statement.execute("delete timeSeries root.sg.d1.**"); - try (final ResultSet resultSet = statement.executeQuery("select c1, c2 from root.sg.d1")) { + statement.execute("insert into root.db.d1 (c1, c2) values (1, 1)"); + statement.execute("delete timeSeries root.db.d1.**"); + try (final ResultSet resultSet = statement.executeQuery("select c1, c2 from root.db.d1")) { Assert.assertEquals(1, resultSet.getMetaData().getColumnCount()); Assert.assertFalse(resultSet.next()); } @@ -257,7 +257,7 @@ public void deleteTimeSeriesAndInvalidationTest() throws Exception { public void deleteTimeSeriesCrossSchemaRegionTest() throws Exception { String[] retArray1 = new String[] {"4,4,4,4"}; - String insertSql = "insert into root.sg.d%d(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db.d%d(time, s1, s2) values(%d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -267,11 +267,11 @@ public void deleteTimeSeriesCrossSchemaRegionTest() throws Exception { } int cnt = 0; - try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.sg.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.db.*")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg.d1.s1"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db.d1.s1"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg.d" + i + ".s1"))); + ans.append(",").append(resultSet.getString(count("root.db.d" + i + ".s1"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -279,21 +279,21 @@ public void deleteTimeSeriesCrossSchemaRegionTest() throws Exception { Assert.assertEquals(retArray1.length, cnt); } - statement.execute("delete timeseries root.sg.*.s1"); - try (ResultSet resultSet = statement.executeQuery("select s1 from root.sg.*")) { + statement.execute("delete timeseries root.db.*.s1"); + try (ResultSet resultSet = statement.executeQuery("select s1 from root.db.*")) { Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg.*.s1")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db.*.s1")) { Assert.assertFalse(resultSet.next()); } cnt = 0; - try (ResultSet resultSet = statement.executeQuery("select count(s2) from root.sg.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(s2) from root.db.*")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg.d1.s2"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db.d1.s2"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg.d" + i + ".s2"))); + ans.append(",").append(resultSet.getString(count("root.db.d" + i + ".s2"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -307,7 +307,7 @@ public void deleteTimeSeriesCrossSchemaRegionTest() throws Exception { public void deleteTimeSeriesCrossDatabaseTest() throws Exception { String[] retArray1 = new String[] {"4,4,4,4"}; - String insertSql = "insert into root.sg%d.d1(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db%d.d1(time, s1, s2) values(%d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -319,9 +319,9 @@ public void deleteTimeSeriesCrossDatabaseTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.*.d1")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg1.d1.s1"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db1.d1.s1"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg" + i + ".d1.s1"))); + ans.append(",").append(resultSet.getString(count("root.db" + i + ".d1.s1"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -341,9 +341,9 @@ public void deleteTimeSeriesCrossDatabaseTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery("select count(s2) from root.*.*")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg1.d1.s2"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db1.d1.s2"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg" + i + ".d1.s2"))); + ans.append(",").append(resultSet.getString(count("root.db" + i + ".d1.s2"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -351,12 +351,12 @@ public void deleteTimeSeriesCrossDatabaseTest() throws Exception { Assert.assertEquals(retArray1.length, cnt); } - statement.execute("delete timeseries root.sg1.d1.s2, root.sg2.**"); - try (ResultSet resultSet = statement.executeQuery("select s2 from root.sg1.*")) { + statement.execute("delete timeseries root.db1.d1.s2, root.db2.**"); + try (ResultSet resultSet = statement.executeQuery("select s2 from root.db1.*")) { Assert.assertFalse(resultSet.next()); } - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg2.*.s2")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db2.*.s2")) { Assert.assertFalse(resultSet.next()); } @@ -364,9 +364,9 @@ public void deleteTimeSeriesCrossDatabaseTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery("select count(s2) from root.*.*")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg3.d1.s2"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db3.d1.s2"))); for (int i = 4; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg" + i + ".d1.s2"))); + ans.append(",").append(resultSet.getString(count("root.db" + i + ".d1.s2"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -380,7 +380,7 @@ public void deleteTimeSeriesCrossDatabaseTest() throws Exception { public void deleteTimeSeriesWithMultiPatternTest() throws Exception { String[] retArray1 = new String[] {"4,4,4,4"}; - String insertSql = "insert into root.sg%d.d1(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db%d.d1(time, s1, s2) values(%d, %d, %d)"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { for (int i = 1; i <= 4; i++) { @@ -392,9 +392,9 @@ public void deleteTimeSeriesWithMultiPatternTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.*.d1")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg1.d1.s1"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db1.d1.s1"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg" + i + ".d1.s1"))); + ans.append(",").append(resultSet.getString(count("root.db" + i + ".d1.s1"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; @@ -461,7 +461,7 @@ public void deleteTimeSeriesAndReturnPathNotExistsTest() throws Exception { String[] retArray1 = new String[] {"4,4,4,4"}; - String insertSql = "insert into root.sg%d.d1(time, s1, s2) values(%d, %d, %d)"; + String insertSql = "insert into root.db%d.d1(time, s1, s2) values(%d, %d, %d)"; for (int i = 1; i <= 4; i++) { for (int j = 1; j <= 4; j++) { statement.execute(String.format(insertSql, j, i, i, i)); @@ -472,9 +472,9 @@ public void deleteTimeSeriesAndReturnPathNotExistsTest() throws Exception { try (ResultSet resultSet = statement.executeQuery("select count(s1) from root.*.d1")) { while (resultSet.next()) { - StringBuilder ans = new StringBuilder(resultSet.getString(count("root.sg1.d1.s1"))); + StringBuilder ans = new StringBuilder(resultSet.getString(count("root.db1.d1.s1"))); for (int i = 2; i <= 4; i++) { - ans.append(",").append(resultSet.getString(count("root.sg" + i + ".d1.s1"))); + ans.append(",").append(resultSet.getString(count("root.db" + i + ".d1.s1"))); } Assert.assertEquals(retArray1[cnt], ans.toString()); cnt++; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBMetadataFetchIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBMetadataFetchIT.java index 1b6818d39f0a5..8f635e4f26707 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBMetadataFetchIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBMetadataFetchIT.java @@ -268,31 +268,31 @@ public void showDevicesWithSgTest() throws SQLException { public void showDevicesWithTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE DATABASE root.sg2"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE DATABASE root.db2"); statement.execute("CREATE DEVICE TEMPLATE t1 (s1 INT64, s2 DOUBLE)"); statement.execute("CREATE DEVICE TEMPLATE t2 aligned (s1 INT64, s2 DOUBLE)"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg1.d2"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg2.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg2.d2"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d2"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg2.d1"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg2.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db1.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db2.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db2.d2"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d2"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db2.d1"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db2.d2"); String[] sqls = new String[] { "show devices root.** where template is not null", - "show devices root.sg2.** with database where template = 't2'", + "show devices root.db2.** with database where template = 't2'", }; Set[] standards = new Set[] { new HashSet<>( Arrays.asList( - "root.sg1.d2,true,t2,INF,", - "root.sg2.d1,false,t1,INF,", - "root.sg2.d2,true,t2,INF,")), - new HashSet<>(Arrays.asList("root.sg2.d2,root.sg2,true,t2,INF,")), + "root.db1.d2,true,t2,INF,", + "root.db2.d1,false,t1,INF,", + "root.db2.d2,true,t2,INF,")), + new HashSet<>(Arrays.asList("root.db2.d2,root.db2,true,t2,INF,")), }; for (int n = 0; n < sqls.length; n++) { @@ -774,15 +774,15 @@ public void showAlignedTimeseriesWithAliasAndTags() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( - "create aligned timeseries root.sg.d(s1(alias1) int32 tags('tag1'='v1', 'tag2'='v2'), s2 double attributes('attr3'='v3'))"); + "create aligned timeseries root.db.d(s1(alias1) int32 tags('tag1'='v1', 'tag2'='v2'), s2 double attributes('attr3'='v3'))"); String[] expected = new String[] { - "root.sg.d.s1,alias1,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", - "root.sg.d.s2,null,root.sg,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE," + "root.db.d.s1,alias1,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", + "root.db.d.s2,null,root.db,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE," }; int num = 0; - try (ResultSet resultSet = statement.executeQuery("show timeseries root.sg.d.*")) { + try (ResultSet resultSet = statement.executeQuery("show timeseries root.db.d.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); while (resultSet.next()) { StringBuilder builder = new StringBuilder(); @@ -835,9 +835,9 @@ public void showDeadbandInfo() throws SQLException { String[] sqls = new String[] { - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32", - "CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2", - "CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15" + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32", + "CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2", + "CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15" }; for (String sql : sqls) { statement.execute(sql); @@ -845,10 +845,10 @@ public void showDeadbandInfo() throws SQLException { Set standard = new HashSet<>( Arrays.asList( - "root.sg1.d0.s0,null,root.sg1,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,\n", - "root.sg1.d0.s1,null,root.sg1,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,\n", - "root.sg1.d0.s2,null,root.sg1,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,\n")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.d0.*")) { + "root.db1.d0.s0,null,root.db1,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,\n", + "root.db1.d0.s1,null,root.db1,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,\n", + "root.db1.d0.s2,null,root.db1,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,\n")); + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.d0.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); while (resultSet.next()) { StringBuilder builder = new StringBuilder(); @@ -861,7 +861,7 @@ public void showDeadbandInfo() throws SQLException { } catch (SQLException e) { fail(e.getMessage()); } finally { - statement.execute("delete timeseries root.sg1.d0.*"); + statement.execute("delete timeseries root.db1.d0.*"); } } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBSchemaTemplateIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBSchemaTemplateIT.java index 822cca2e78cec..9c01717991209 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBSchemaTemplateIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBSchemaTemplateIT.java @@ -80,9 +80,9 @@ private void prepareTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // create database - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE DATABASE root.sg2"); - statement.execute("CREATE DATABASE root.sg3"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE DATABASE root.db2"); + statement.execute("CREATE DATABASE root.db3"); // create device template statement.execute("CREATE DEVICE TEMPLATE t1 (s1 INT64, s2 DOUBLE)"); @@ -120,9 +120,9 @@ public void testCreateTemplateAndCreateTimeseries() throws SQLException { } // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg1.d2"); - statement.execute("SET DEVICE TEMPLATE t3 TO root.sg1.d3"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db1.d2"); + statement.execute("SET DEVICE TEMPLATE t3 TO root.db1.d3"); // test drop template which has been set try { @@ -135,25 +135,25 @@ public void testCreateTemplateAndCreateTimeseries() throws SQLException { e.getMessage()); } - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { Assert.assertFalse(resultSet.next()); } // create timeseries of device template - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d1"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d2"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d3"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d1"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d2"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d3"); Set expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d1.s1,INT64,TS_2DIFF,LZ4", - "root.sg1.d1.s2,DOUBLE,GORILLA,LZ4", - "root.sg1.d2.s1,INT64,TS_2DIFF,LZ4", - "root.sg1.d2.s2,DOUBLE,GORILLA,LZ4", - "root.sg1.d3.s1,INT64,TS_2DIFF,LZ4")); + "root.db1.d1.s1,INT64,TS_2DIFF,LZ4", + "root.db1.d1.s2,DOUBLE,GORILLA,LZ4", + "root.db1.d2.s1,INT64,TS_2DIFF,LZ4", + "root.db1.d2.s2,DOUBLE,GORILLA,LZ4", + "root.db1.d3.s1,INT64,TS_2DIFF,LZ4")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**"); ) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**"); ) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -169,15 +169,15 @@ public void testCreateTemplateAndCreateTimeseries() throws SQLException { } Assert.assertTrue(expectedResult.isEmpty()); - try (ResultSet resultSet = statement.executeQuery("COUNT TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("COUNT TIMESERIES root.db1.**")) { resultSet.next(); Assert.assertEquals(5, resultSet.getLong(1)); } expectedResult = - new HashSet<>(Arrays.asList("root.sg1.d1,false", "root.sg1.d2,true", "root.sg1.d3,true")); + new HashSet<>(Arrays.asList("root.db1.d1,false", "root.db1.d2,true", "root.db1.d3,true")); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db1.**")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.DEVICE) @@ -190,11 +190,11 @@ public void testCreateTemplateAndCreateTimeseries() throws SQLException { Assert.assertTrue(expectedResult.isEmpty()); try { - statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.sg1.d1"); + statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.db1.d1"); fail(); } catch (SQLException e) { Assert.assertEquals( - TSStatusCode.TEMPLATE_IS_IN_USE.getStatusCode() + ": Template is in use on root.sg1.d1", + TSStatusCode.TEMPLATE_IS_IN_USE.getStatusCode() + ": Template is in use on root.db1.d1", e.getMessage()); } } @@ -216,26 +216,26 @@ public void testCreateAndSetSchemaTemplate() throws SQLException { } // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg1.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db1.d2"); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { Assert.assertFalse(resultSet.next()); } // set using device template - statement.execute("INSERT INTO root.sg1.d1(time,s1) VALUES (1,1)"); - statement.execute("INSERT INTO root.sg1.d2(time,s1) ALIGNED VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1) VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d2(time,s1) ALIGNED VALUES (1,1)"); Set expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d1.s1,INT64,TS_2DIFF,LZ4", - "root.sg1.d1.s2,DOUBLE,GORILLA,LZ4", - "root.sg1.d2.s1,INT64,TS_2DIFF,LZ4", - "root.sg1.d2.s2,DOUBLE,GORILLA,LZ4")); + "root.db1.d1.s1,INT64,TS_2DIFF,LZ4", + "root.db1.d1.s2,DOUBLE,GORILLA,LZ4", + "root.db1.d2.s1,INT64,TS_2DIFF,LZ4", + "root.db1.d2.s2,DOUBLE,GORILLA,LZ4")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.**")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -251,14 +251,14 @@ public void testCreateAndSetSchemaTemplate() throws SQLException { } Assert.assertTrue(expectedResult.isEmpty()); - try (ResultSet resultSet = statement.executeQuery("COUNT TIMESERIES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("COUNT TIMESERIES root.db1.**")) { resultSet.next(); Assert.assertEquals(4, resultSet.getLong(1)); } - expectedResult = new HashSet<>(Arrays.asList("root.sg1.d1,false", "root.sg1.d2,true")); + expectedResult = new HashSet<>(Arrays.asList("root.db1.d1,false", "root.db1.d2,true")); - try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("SHOW DEVICES root.db1.**")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.DEVICE) @@ -271,11 +271,11 @@ public void testCreateAndSetSchemaTemplate() throws SQLException { Assert.assertTrue(expectedResult.isEmpty()); try { - statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.sg1.d1"); + statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.db1.d1"); fail(); } catch (SQLException e) { Assert.assertEquals( - TSStatusCode.TEMPLATE_IS_IN_USE.getStatusCode() + ": Template is in use on root.sg1.d1", + TSStatusCode.TEMPLATE_IS_IN_USE.getStatusCode() + ": Template is in use on root.db1.d1", e.getMessage()); } } @@ -341,13 +341,13 @@ public void testShowPathsSetOrUsingSchemaTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d2"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg2.d1"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg2.d2"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg3.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg3.d2"); - statement.execute("INSERT INTO root.sg3.d2.verify(time, show) ALIGNED VALUES (1, 1)"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db2.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db2.d2"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db3.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db3.d2"); + statement.execute("INSERT INTO root.db3.d2.verify(time, show) ALIGNED VALUES (1, 1)"); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS USING DEVICE TEMPLATE t1")) { String resultRecord; @@ -358,12 +358,12 @@ public void testShowPathsSetOrUsingSchemaTemplate() throws SQLException { } // activate device template - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d2"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg2.d1"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d2"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db2.d1"); // show paths set device template String[] expectedResult = - new String[] {"root.sg1.d1", "root.sg2.d2", "root.sg1.d2", "root.sg2.d1"}; + new String[] {"root.db1.d1", "root.db2.d2", "root.db1.d2", "root.db2.d1"}; Set expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { String resultRecord; @@ -375,7 +375,7 @@ public void testShowPathsSetOrUsingSchemaTemplate() throws SQLException { } Assert.assertEquals(0, expectedResultSet.size()); - expectedResult = new String[] {"root.sg3.d1", "root.sg3.d2"}; + expectedResult = new String[] {"root.db3.d1", "root.db3.d2"}; expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t2")) { String resultRecord; @@ -387,7 +387,7 @@ public void testShowPathsSetOrUsingSchemaTemplate() throws SQLException { } Assert.assertEquals(0, expectedResultSet.size()); - expectedResult = new String[] {"root.sg1.d2", "root.sg2.d1"}; + expectedResult = new String[] {"root.db1.d2", "root.db2.d1"}; expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS USING DEVICE TEMPLATE t1")) { String resultRecord; @@ -437,15 +437,15 @@ public void testDeleteTimeSeriesWhenUsingTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg1.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db1.d2"); - statement.execute("CREATE TIMESERIES root.sg3.d1.s1 INT64"); + statement.execute("CREATE TIMESERIES root.db3.d1.s1 INT64"); // set using device template - statement.execute("INSERT INTO root.sg1.d1(time,s1) VALUES (1,1)"); - statement.execute("INSERT INTO root.sg1.d2(time,s1) ALIGNED VALUES (1,1)"); - statement.execute("INSERT INTO root.sg3.d1(time,s1) VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1) VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d2(time,s1) ALIGNED VALUES (1,1)"); + statement.execute("INSERT INTO root.db3.d1(time,s1) VALUES (1,1)"); Set expectedResult = new HashSet<>(Collections.singletonList("1,1,1,1,")); @@ -467,7 +467,7 @@ public void testDeleteTimeSeriesWhenUsingTemplate() throws SQLException { expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d1.s1,INT64,TS_2DIFF,LZ4", "root.sg1.d2.s1,INT64,TS_2DIFF,LZ4")); + "root.db1.d1.s1,INT64,TS_2DIFF,LZ4", "root.db1.d2.s1,INT64,TS_2DIFF,LZ4")); try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.**.s1")) { while (resultSet.next()) { @@ -498,12 +498,12 @@ public void testSchemaQueryAndFetchWithUnrelatedTemplate() throws SQLException { statement.execute("CREATE DEVICE TEMPLATE t4 (s3 INT64, s4 DOUBLE)"); // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t4 TO root.sg1.d2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t4 TO root.db1.d2"); // set using device template - statement.execute("INSERT INTO root.sg1.d1(time,s1) VALUES (1,1)"); - statement.execute("INSERT INTO root.sg1.d2(time,s3) VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1) VALUES (1,1)"); + statement.execute("INSERT INTO root.db1.d2(time,s3) VALUES (1,1)"); Set expectedResult = new HashSet<>(Collections.singletonList("1,1,")); @@ -521,7 +521,7 @@ public void testSchemaQueryAndFetchWithUnrelatedTemplate() throws SQLException { Assert.assertTrue(expectedResult.isEmpty()); expectedResult = - new HashSet<>(Collections.singletonList("root.sg1.d1.s1,INT64,TS_2DIFF,LZ4")); + new HashSet<>(Collections.singletonList("root.db1.d1.s1,INT64,TS_2DIFF,LZ4")); try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.**.s1")) { while (resultSet.next()) { @@ -546,17 +546,17 @@ public void testInsertDataWithMeasurementsBeyondTemplate() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); // insert data and auto activate device template - statement.execute("INSERT INTO root.sg1.d1(time,s1,s2) VALUES (1,1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1,s2) VALUES (1,1,1)"); // insert twice to make sure the timeseries in template has been cached - statement.execute("INSERT INTO root.sg1.d1(time,s1,s2) VALUES (2,1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1,s2) VALUES (2,1,1)"); // insert data with extra measurement s3 which should be checked by schema fetch and auto // created - statement.execute("INSERT INTO root.sg1.d1(time,s1,s2,s3) VALUES (2,1,1,1)"); + statement.execute("INSERT INTO root.db1.d1(time,s1,s2,s3) VALUES (2,1,1,1)"); - try (ResultSet resultSet = statement.executeQuery("count timeseries root.sg1.**")) { + try (ResultSet resultSet = statement.executeQuery("count timeseries root.db1.**")) { Assert.assertTrue(resultSet.next()); long resultRecord = resultSet.getLong(1); Assert.assertEquals(3, resultRecord); @@ -569,9 +569,9 @@ public void testUnsetTemplate() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); // show paths set device template - String[] expectedResult = new String[] {"root.sg1.d1"}; + String[] expectedResult = new String[] {"root.db1.d1"}; Set expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { String resultRecord; @@ -583,7 +583,7 @@ public void testUnsetTemplate() throws SQLException { } Assert.assertEquals(0, expectedResultSet.size()); // unset device template - statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.sg1.d1"); + statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.db1.d1"); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { Assert.assertFalse(resultSet.next()); } @@ -595,9 +595,9 @@ public void testTemplateSetAndTimeSeriesExistenceCheck() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); // show paths set device template - String[] expectedResult = new String[] {"root.sg1.d1"}; + String[] expectedResult = new String[] {"root.db1.d1"}; Set expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { String resultRecord; @@ -610,34 +610,34 @@ public void testTemplateSetAndTimeSeriesExistenceCheck() throws SQLException { Assert.assertEquals(0, expectedResultSet.size()); try { - statement.execute("CREATE TIMESERIES root.sg1.d1.s INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.s INT32"); fail(); } catch (SQLException e) { Assert.assertEquals( - "516: Cannot create timeseries [root.sg1.d1.s] since device template [t1] already set on path [root.sg1.d1].", + "516: Cannot create timeseries [root.db1.d1.s] since device template [t1] already set on path [root.db1.d1].", e.getMessage()); } // unset device template - statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.sg1.d1"); + statement.execute("UNSET DEVICE TEMPLATE t1 FROM root.db1.d1"); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { Assert.assertFalse(resultSet.next()); } - statement.execute("CREATE TIMESERIES root.sg1.d1.s INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.s INT32"); try { - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); } catch (SQLException e) { Assert.assertEquals( - "516: Cannot set device template [t1] to path [root.sg1.d1] since there's timeseries under path [root.sg1.d1].", + "516: Cannot set device template [t1] to path [root.db1.d1] since there's timeseries under path [root.db1.d1].", e.getMessage()); } - statement.execute("DELETE TIMESERIES root.sg1.d1.s"); + statement.execute("DELETE TIMESERIES root.db1.d1.s"); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - expectedResult = new String[] {"root.sg1.d1"}; + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + expectedResult = new String[] {"root.db1.d1"}; expectedResultSet = new HashSet<>(Arrays.asList(expectedResult)); try (ResultSet resultSet = statement.executeQuery("SHOW PATHS SET DEVICE TEMPLATE t1")) { String resultRecord; @@ -649,22 +649,22 @@ public void testTemplateSetAndTimeSeriesExistenceCheck() throws SQLException { } Assert.assertEquals(0, expectedResultSet.size()); - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d2.tmp.m"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d2.tmp.m"); try { - statement.execute("CREATE TIMESERIES root.sg1.d2 INT32"); + statement.execute("CREATE TIMESERIES root.db1.d2 INT32"); } catch (SQLException e) { Assert.assertEquals( - "516: Cannot create timeseries [root.sg1.d2] since device template [t1] already set on path [root.sg1.d2.tmp.m].", + "516: Cannot create timeseries [root.db1.d2] since device template [t1] already set on path [root.db1.d2.tmp.m].", e.getMessage()); } try { - statement.execute("CREATE TIMESERIES root.sg1.d2.s(tmp) INT32"); + statement.execute("CREATE TIMESERIES root.db1.d2.s(tmp) INT32"); } catch (SQLException e) { Assert.assertEquals( - "516: Cannot create timeseries [root.sg1.d2.s] since device template [t1] already set on path [root.sg1.d2.tmp.m].", + "516: Cannot create timeseries [root.db1.d2.s] since device template [t1] already set on path [root.db1.d2.tmp.m].", e.getMessage()); } - statement.execute("CREATE TIMESERIES root.sg1.d2.s INT32"); + statement.execute("CREATE TIMESERIES root.db1.d2.s INT32"); } } @@ -674,24 +674,24 @@ public void testShowTemplateSeriesWithFuzzyQuery() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg2"); - statement.execute("SET DEVICE TEMPLATE t3 TO root.sg3"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db2"); + statement.execute("SET DEVICE TEMPLATE t3 TO root.db3"); // activate device template - statement.execute("create timeseries using device template on root.sg1.d1"); - statement.execute("create timeseries using device template on root.sg2.d2"); - statement.execute("create timeseries using device template on root.sg3.d3"); + statement.execute("create timeseries using device template on root.db1.d1"); + statement.execute("create timeseries using device template on root.db2.d2"); + statement.execute("create timeseries using device template on root.db3.d3"); Set expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d1.s1,INT64,TS_2DIFF,LZ4", - "root.sg1.d1.s2,DOUBLE,GORILLA,LZ4", - "root.sg2.d2.s1,INT64,TS_2DIFF,LZ4", - "root.sg2.d2.s2,DOUBLE,GORILLA,LZ4", - "root.sg3.d3.s1,INT64,TS_2DIFF,LZ4")); + "root.db1.d1.s1,INT64,TS_2DIFF,LZ4", + "root.db1.d1.s2,DOUBLE,GORILLA,LZ4", + "root.db2.d2.s1,INT64,TS_2DIFF,LZ4", + "root.db2.d2.s2,DOUBLE,GORILLA,LZ4", + "root.db3.d3.s1,INT64,TS_2DIFF,LZ4")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg*.*.s*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db*.*.s*")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -709,9 +709,9 @@ public void testShowTemplateSeriesWithFuzzyQuery() throws Exception { expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d1.s1,INT64,TS_2DIFF,LZ4", "root.sg1.d1.s2,DOUBLE,GORILLA,LZ4")); + "root.db1.d1.s1,INT64,TS_2DIFF,LZ4", "root.db1.d1.s2,DOUBLE,GORILLA,LZ4")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg1.d1.s*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db1.d1.s*")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -736,7 +736,7 @@ public void testEmptySchemaTemplate() throws Exception { // create empty device template statement.execute("create device template e_t"); // set device template - statement.execute("SET DEVICE TEMPLATE e_t TO root.sg1"); + statement.execute("SET DEVICE TEMPLATE e_t TO root.db1"); try (ResultSet resultSet = statement.executeQuery("show nodes in device template e_t")) { Assert.assertFalse(resultSet.next()); } @@ -747,16 +747,16 @@ public void testEmptySchemaTemplate() throws Exception { } statement.execute("alter device template e_t add(s1 int32)"); - statement.execute("insert into root.sg1.d(time, s2, s3) values(1, 1, 1)"); + statement.execute("insert into root.db1.d(time, s2, s3) values(1, 1, 1)"); Set expectedResult = new HashSet<>( Arrays.asList( - "root.sg1.d.s1,INT32,TS_2DIFF,LZ4", - "root.sg1.d.s2,DOUBLE,GORILLA,LZ4", - "root.sg1.d.s3,DOUBLE,GORILLA,LZ4")); + "root.db1.d.s1,INT32,TS_2DIFF,LZ4", + "root.db1.d.s2,DOUBLE,GORILLA,LZ4", + "root.db1.d.s3,DOUBLE,GORILLA,LZ4")); - try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.sg*.*.s*")) { + try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.db*.*.s*")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.TIMESERIES) @@ -778,18 +778,18 @@ public void testEmptySchemaTemplate() throws Exception { public void testLevelCountWithTemplate() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1"); - statement.execute("SET DEVICE TEMPLATE t2 TO root.sg1.d2"); - statement.execute("SET DEVICE TEMPLATE t3 TO root.sg1.d3"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1"); + statement.execute("SET DEVICE TEMPLATE t2 TO root.db1.d2"); + statement.execute("SET DEVICE TEMPLATE t3 TO root.db1.d3"); // create timeseries of device template - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d1"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d2"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d3"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d1"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d2"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d3"); // count Set expectedResult = - new HashSet<>(Arrays.asList("root.sg1.d1,2", "root.sg1.d2,2", "root.sg1.d3,1")); + new HashSet<>(Arrays.asList("root.db1.d1,2", "root.db1.d2,2", "root.db1.d3,1")); try (ResultSet resultSet = - statement.executeQuery("COUNT TIMESERIES root.sg1.** group by level=2")) { + statement.executeQuery("COUNT TIMESERIES root.db1.** group by level=2")) { while (resultSet.next()) { String actualResult = resultSet.getString(ColumnHeaderConstant.COLUMN) @@ -807,26 +807,26 @@ public void testLevelCountWithTemplate() throws Exception { public void testAlterTemplateTimeseries() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1;"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.d1;"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d1;"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.d1;"); try { statement.execute( - "ALTER timeseries root.sg1.d1.s1 UPSERT tags(s0_tag1=s0_tag1, s0_tag2=s0_tag2) attributes(s0_attr1=s0_attr1, s0_attr2=s0_attr2);"); + "ALTER timeseries root.db1.d1.s1 UPSERT tags(s0_tag1=s0_tag1, s0_tag2=s0_tag2) attributes(s0_attr1=s0_attr1, s0_attr2=s0_attr2);"); Assert.fail("expect exception because the template timeseries does not support tag"); } catch (Exception e) { Assert.assertTrue( e.getMessage() .contains( - "Cannot alter template timeseries [root.sg1.d1.s1] since device template [t1] already set on path [root.sg1.d1]")); + "Cannot alter template timeseries [root.db1.d1.s1] since device template [t1] already set on path [root.db1.d1]")); } try { - statement.execute("ALTER timeseries root.sg1.d1.s1 UPSERT ALIAS=s0Alias;"); + statement.execute("ALTER timeseries root.db1.d1.s1 UPSERT ALIAS=s0Alias;"); Assert.fail("expect exception because the template timeseries does not support alias"); } catch (Exception e) { Assert.assertTrue( e.getMessage() .contains( - "Cannot alter template timeseries [root.sg1.d1.s1] since device template [t1] already set on path [root.sg1.d1]")); + "Cannot alter template timeseries [root.db1.d1.s1] since device template [t1] already set on path [root.db1.d1]")); } } } @@ -836,9 +836,9 @@ public void testActivateAndDropEmptyTemplate() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute("CREATE DEVICE TEMPLATE e_t;"); - statement.execute("SET DEVICE TEMPLATE e_t TO root.sg1.t.d1;"); - statement.execute("insert into root.sg1.t.d2(timestamp,s1) values(now(),false);"); - statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg1.t.d1;"); + statement.execute("SET DEVICE TEMPLATE e_t TO root.db1.t.d1;"); + statement.execute("insert into root.db1.t.d2(timestamp,s1) values(now(),false);"); + statement.execute("CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db1.t.d1;"); try (ResultSet resultSet = statement.executeQuery("show nodes in device template e_t")) { Assert.assertFalse(resultSet.next()); } @@ -846,8 +846,8 @@ public void testActivateAndDropEmptyTemplate() throws Exception { Assert.assertTrue(resultSet.next()); Assert.assertFalse(resultSet.next()); } - statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.sg1.t.d1;"); - statement.execute("UNSET DEVICE TEMPLATE e_t FROM root.sg1.t.d1;"); + statement.execute("DEACTIVATE DEVICE TEMPLATE FROM root.db1.t.d1;"); + statement.execute("UNSET DEVICE TEMPLATE e_t FROM root.db1.t.d1;"); try (ResultSet resultSet = statement.executeQuery("show paths set device template e_t")) { Assert.assertFalse(resultSet.next()); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterMixQuotaIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterMixQuotaIT.java index e910918e1c485..3afa41b075361 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterMixQuotaIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterMixQuotaIT.java @@ -54,49 +54,49 @@ public void testClusterSchemaQuota2() { Statement statement = connection.createStatement()) { try { statement.execute( - "create timeseries root.sg1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } try { - statement.execute("create timeseries of device template on root.sg2.d2;"); + statement.execute("create timeseries of device template on root.db2.d2;"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } // delete some timeseries and database - statement.execute("delete database root.sg2;"); - statement.execute("delete timeseries root.sg1.d0.s0;"); + statement.execute("delete database root.db2;"); + statement.execute("delete timeseries root.db1.d0.s0;"); Thread.sleep(2000); // wait heartbeat // now we can create 3 new timeseries and 1 new device - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d4"); - statement.execute("create timeseries of device template on root.sg1.d4"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d4"); + statement.execute("create timeseries of device template on root.db1.d4"); statement.execute( - "create timeseries root.sg1.d1.s3 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d1.s3 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Thread.sleep(2000); // wait heartbeat try { statement.execute( - "create timeseries root.sg1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } try { statement.execute( - "create timeseries root.sg1.d1.s4 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d1.s4 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } try { - statement.execute("insert into root.sg1.d1(timestamp,s4) values(1,1.0)"); + statement.execute("insert into root.db1.d1(timestamp,s4) values(1,1.0)"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } try { - statement.execute("insert into root.sg1.d4(timestamp,s4) values(1,1.0)"); + statement.execute("insert into root.db1.d4(timestamp,s4) values(1,1.0)"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterQuotaIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterQuotaIT.java index 8eea7fc04709d..dfc3fa1c7b231 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterQuotaIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/quota/IoTDBClusterQuotaIT.java @@ -52,21 +52,21 @@ private void prepareTimeSeries() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { // create database - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE DATABASE root.sg2"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE DATABASE root.db2"); // create device template statement.execute("CREATE DEVICE TEMPLATE t1 (s1 INT64, s2 DOUBLE)"); // set device template - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg2"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db2"); statement.execute( - "create timeseries root.sg1.d0.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d0.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); statement.execute( - "create timeseries root.sg1.d0.s1 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d0.s1 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); statement.execute( - "create timeseries root.sg1.d1.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d1.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); statement.execute( - "create timeseries root.sg1.d1.s1 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); - statement.execute("create timeseries of device template on root.sg2.d1;"); + "create timeseries root.db1.d1.s1 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + statement.execute("create timeseries of device template on root.db2.d1;"); } } @@ -76,30 +76,30 @@ public void testClusterSchemaQuota() { Statement statement = connection.createStatement()) { try { statement.execute( - "create timeseries root.sg1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } try { - statement.execute("create timeseries of device template on root.sg2.d2;"); + statement.execute("create timeseries of device template on root.db2.d2;"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); } // delete some timeseries and database - statement.execute("delete database root.sg2;"); - statement.execute("delete timeseries root.sg1.d0.s0;"); + statement.execute("delete database root.db2;"); + statement.execute("delete timeseries root.db1.d0.s0;"); Thread.sleep(2000); // wait heartbeat // now we can create 3 new timeseries or 1 new device - statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d4"); - statement.execute("create timeseries of device template on root.sg1.d4"); + statement.execute("SET DEVICE TEMPLATE t1 TO root.db1.d4"); + statement.execute("create timeseries of device template on root.db1.d4"); statement.execute( - "create timeseries root.sg1.d1.s3 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d1.s3 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Thread.sleep(2000); // wait heartbeat try { statement.execute( - "create timeseries root.sg1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); + "create timeseries root.db1.d3.s0 with datatype=FLOAT, encoding=RLE, compression=SNAPPY"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("capacity has exceeded the cluster quota")); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanIT.java index 7b4f5ab78b039..f767f2999c757 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanIT.java @@ -49,78 +49,78 @@ public class IoTDBActiveRegionScanIT extends AbstractSchemaIT { // https://docs.google.com/spreadsheets/d/11tNRIaHmNdFWc0RC4yAloO6JJbmo9S5qxwAqWxeVY6c/edit#gid=0 public static final String[] common_insert_sqls = new String[] { - "create aligned timeseries root.sg.aligned.d1(s1 INT32 encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY)", - "create aligned timeseries root.sg.aligned.d2(s3 BOOLEAN, s4 TEXT)", - "create timeseries root.sg.unaligned.d2.s1 WITH DATATYPE=INT64, encoding=RLE", - "create timeseries root.sg.unaligned.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", - "create timeseries root.sg.unaligned.d3.s4 WITH DATATYPE=INT32, encoding=Gorilla", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(1, 1, 2)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(2, 2, 3)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(3, 3, 4)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(5, 5, 6)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(6, 6, 7)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(7, 7, 8)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(8, null, 9)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(9, 9, 10)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(10, 10, 11)", + "create aligned timeseries root.db.aligned.d1(s1 INT32 encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY)", + "create aligned timeseries root.db.aligned.d2(s3 BOOLEAN, s4 TEXT)", + "create timeseries root.db.unaligned.d2.s1 WITH DATATYPE=INT64, encoding=RLE", + "create timeseries root.db.unaligned.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", + "create timeseries root.db.unaligned.d3.s4 WITH DATATYPE=INT32, encoding=Gorilla", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(1, 1, 2)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(2, 2, 3)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(3, 3, 4)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(5, 5, 6)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(6, 6, 7)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(7, 7, 8)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(8, null, 9)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(9, 9, 10)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(10, 10, 11)", "flush", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(5, FALSE, 'aligned_test1')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(6, TRUE, 'aligned_test2')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(7, TRUE, 'aligned_test3')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(8, null, 'aligned_test4')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(9, TRUE, 'aligned_test5')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(10, TRUE, 'aligned_test6')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(12, TRUE, 'aligned_test8')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(13, TRUE, null)", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(14, TRUE, 'aligned_test10')", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(11, 11, 12)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(12, 12, 13)", - "insert into root.sg.unaligned.d2(time, s1) values(1, 1)", - "insert into root.sg.unaligned.d2(time, s1) values(2, 2)", - "insert into root.sg.unaligned.d2(time, s1) values(3, 3)", - "insert into root.sg.unaligned.d2(time, s1) values(4, 4)", - "insert into root.sg.unaligned.d2(time, s1) values(5, 5)", - "insert into root.sg.unaligned.d2(time, s1) values(7, null)", - "insert into root.sg.unaligned.d2(time, s1) values(8, 8)", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(5, FALSE, 'aligned_test1')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(6, TRUE, 'aligned_test2')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(7, TRUE, 'aligned_test3')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(8, null, 'aligned_test4')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(9, TRUE, 'aligned_test5')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(10, TRUE, 'aligned_test6')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(12, TRUE, 'aligned_test8')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(13, TRUE, null)", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(14, TRUE, 'aligned_test10')", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(11, 11, 12)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(12, 12, 13)", + "insert into root.db.unaligned.d2(time, s1) values(1, 1)", + "insert into root.db.unaligned.d2(time, s1) values(2, 2)", + "insert into root.db.unaligned.d2(time, s1) values(3, 3)", + "insert into root.db.unaligned.d2(time, s1) values(4, 4)", + "insert into root.db.unaligned.d2(time, s1) values(5, 5)", + "insert into root.db.unaligned.d2(time, s1) values(7, null)", + "insert into root.db.unaligned.d2(time, s1) values(8, 8)", "flush", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(20, 1, 2)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(22, 2, 3)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(23, 3, 4)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(25, 5, 6)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(26, 6, 7)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(27, 7, 8)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(28, null, 9)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(29, 9, 10)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(30, 10, 11)", - "insert into root.sg.unaligned.d2(time, s2) values(22, 1)", - "insert into root.sg.unaligned.d2(time, s2) values(24, 2)", - "insert into root.sg.unaligned.d3(time, s4) values(22, 1)", - "insert into root.sg.unaligned.d3(time, s4) values(23, 2)", - "insert into root.sg.unaligned.d3(time, s4) values(24, 3)", - "insert into root.sg.unaligned.d3(time, s4) values(25, 4)", - "insert into root.sg.unaligned.d3(time, s4) values(26, 5)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(20, 1, 2)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(22, 2, 3)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(23, 3, 4)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(25, 5, 6)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(26, 6, 7)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(27, 7, 8)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(28, null, 9)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(29, 9, 10)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(30, 10, 11)", + "insert into root.db.unaligned.d2(time, s2) values(22, 1)", + "insert into root.db.unaligned.d2(time, s2) values(24, 2)", + "insert into root.db.unaligned.d3(time, s4) values(22, 1)", + "insert into root.db.unaligned.d3(time, s4) values(23, 2)", + "insert into root.db.unaligned.d3(time, s4) values(24, 3)", + "insert into root.db.unaligned.d3(time, s4) values(25, 4)", + "insert into root.db.unaligned.d3(time, s4) values(26, 5)", "flush", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(40, TRUE, 'aligned_test1')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(42, TRUE, 'aligned_test2')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(41, TRUE, 'aligned_test3')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(43, TRUE, 'aligned_test4')", - "insert into root.sg.aligned.d2(time, s3, s4) aligned values(44, TRUE, 'aligned_test5')", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(40, 1, 2)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(42, 2, 3)", - "insert into root.sg.aligned.d1(time, s1, s2) aligned values(44, 3, 4)", - "insert into root.sg.unaligned.d2(time, s1) values(40, 1)", - "insert into root.sg.unaligned.d2(time, s1) values(41, 2)", - "insert into root.sg.unaligned.d2(time, s1) values(42, 3)", - "insert into root.sg.unaligned.d2(time, s1) values(43, 4)", - "insert into root.sg.unaligned.d2(time, s1) values(44, 5)", - "insert into root.sg.unaligned.d2(time, s1) values(45, 6)", - "insert into root.sg.unaligned.d2(time, s2) values(40, 1)", - "insert into root.sg.unaligned.d2(time, s2) values(41, 2)", - "insert into root.sg.unaligned.d2(time, s2) values(42, 3)", - "insert into root.sg.unaligned.d2(time, s2) values(43, 4)", - "insert into root.sg.unaligned.d3(time, s4) values(40, 1)", - "insert into root.sg.unaligned.d3(time, s4) values(41, 2)", - "insert into root.sg.unaligned.d3(time, s4) values(42, 3)", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(40, TRUE, 'aligned_test1')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(42, TRUE, 'aligned_test2')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(41, TRUE, 'aligned_test3')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(43, TRUE, 'aligned_test4')", + "insert into root.db.aligned.d2(time, s3, s4) aligned values(44, TRUE, 'aligned_test5')", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(40, 1, 2)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(42, 2, 3)", + "insert into root.db.aligned.d1(time, s1, s2) aligned values(44, 3, 4)", + "insert into root.db.unaligned.d2(time, s1) values(40, 1)", + "insert into root.db.unaligned.d2(time, s1) values(41, 2)", + "insert into root.db.unaligned.d2(time, s1) values(42, 3)", + "insert into root.db.unaligned.d2(time, s1) values(43, 4)", + "insert into root.db.unaligned.d2(time, s1) values(44, 5)", + "insert into root.db.unaligned.d2(time, s1) values(45, 6)", + "insert into root.db.unaligned.d2(time, s2) values(40, 1)", + "insert into root.db.unaligned.d2(time, s2) values(41, 2)", + "insert into root.db.unaligned.d2(time, s2) values(42, 3)", + "insert into root.db.unaligned.d2(time, s2) values(43, 4)", + "insert into root.db.unaligned.d3(time, s4) values(40, 1)", + "insert into root.db.unaligned.d3(time, s4) values(41, 2)", + "insert into root.db.unaligned.d3(time, s4) values(42, 3)", }; public static final String[] SHOW_DEVICES_COLUMN_NAMES = @@ -184,7 +184,7 @@ public void showActiveDeviceTest() { String sql = "show devices where time = 4"; String[] retArray = new String[] { - "root.sg.unaligned.d2", + "root.db.unaligned.d2", }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); @@ -198,7 +198,7 @@ public void showActiveDeviceTest2() { String sql = "show devices where time >= 6 and time <=10"; String[] retArray = new String[] { - "root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d2", + "root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d2", }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); @@ -212,7 +212,7 @@ public void showActiveDeviceTest3() { String sql = "show devices where time >= 6 and time <=30"; String[] retArray = new String[] { - "root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d2", "root.sg.unaligned.d3" + "root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d2", "root.db.unaligned.d3" }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); @@ -224,7 +224,7 @@ public void showActiveDeviceTest3() { @Test public void showActiveDeviceTest4() { String sql = "show devices where time >= 25 and time <= 28"; - String[] retArray = new String[] {"root.sg.aligned.d1", "root.sg.unaligned.d3"}; + String[] retArray = new String[] {"root.db.aligned.d1", "root.db.unaligned.d3"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); sql = "count devices where time >= 25 and time <= 28"; @@ -237,7 +237,7 @@ public void showActiveDeviceTest5() { String sql = "show devices where time >= 40 and time <= 44"; String[] retArray = new String[] { - "root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d2", "root.sg.unaligned.d3" + "root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d2", "root.db.unaligned.d3" }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); @@ -251,22 +251,22 @@ public void showActiveDeviceTest6() { String sql = "show devices where time >= 43 and time < 44"; String[] retArray = new String[] { - "root.sg.aligned.d2", "root.sg.unaligned.d2", + "root.db.aligned.d2", "root.db.unaligned.d2", }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); } @Test public void showActiveDeviceTest7() { - String sql = "show devices root.sg.** where time > 45"; + String sql = "show devices root.db.** where time > 45"; String[] retArray = new String[] {}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); } @Test public void showActiveDeviceTest8() { - String sql = "show devices root.sg.** where time > 44 or time < 4"; - String[] retArray = new String[] {"root.sg.aligned.d1", "root.sg.unaligned.d2"}; + String sql = "show devices root.db.** where time > 44 or time < 4"; + String[] retArray = new String[] {"root.db.aligned.d1", "root.db.unaligned.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); } @@ -274,7 +274,7 @@ public void showActiveDeviceTest8() { public void showActiveDeviceTest9() { String sql = "show devices where time = 8"; String[] retArray = - new String[] {"root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d2"}; + new String[] {"root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); } @@ -283,7 +283,7 @@ public void showActiveDeviceTest10() { String sql = "show devices where time < 50"; String[] retArray = new String[] { - "root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d3", "root.sg.unaligned.d2" + "root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d3", "root.db.unaligned.d2" }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); } @@ -315,7 +315,7 @@ public void showActiveTimeseriesTest() { String sql = "show timeseries where time = 4"; String[] retArray = new String[] { - "root.sg.unaligned.d2.s1", + "root.db.unaligned.d2.s1", }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); } @@ -325,11 +325,11 @@ public void showActiveTimeseriesTest2() { String sql = "show timeseries where time >= 6 and time <=10"; String[] retArray = new String[] { - "root.sg.aligned.d1.s1", - "root.sg.aligned.d1.s2", - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", + "root.db.aligned.d1.s1", + "root.db.aligned.d1.s2", + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); @@ -340,13 +340,13 @@ public void showActiveTimeseriesTest3() { String sql = "show timeseries where time >= 6 and time <=30"; String[] retArray = new String[] { - "root.sg.aligned.d1.s1", - "root.sg.aligned.d1.s2", - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", - "root.sg.unaligned.d2.s2", - "root.sg.unaligned.d3.s4" + "root.db.aligned.d1.s1", + "root.db.aligned.d1.s2", + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", + "root.db.unaligned.d2.s2", + "root.db.unaligned.d3.s4" }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); } @@ -355,7 +355,7 @@ public void showActiveTimeseriesTest3() { public void showActiveTimeseriesTest4() { String sql = "show timeseries where time >= 25 and time <= 28"; String[] retArray = - new String[] {"root.sg.aligned.d1.s1", "root.sg.aligned.d1.s2", "root.sg.unaligned.d3.s4"}; + new String[] {"root.db.aligned.d1.s1", "root.db.aligned.d1.s2", "root.db.unaligned.d3.s4"}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); } @@ -364,13 +364,13 @@ public void showActiveTimeseriesTest5() { String sql = "show timeseries where time >= 40 and time <= 44"; String[] retArray = new String[] { - "root.sg.aligned.d1.s1", - "root.sg.aligned.d1.s2", - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", - "root.sg.unaligned.d2.s2", - "root.sg.unaligned.d3.s4" + "root.db.aligned.d1.s1", + "root.db.aligned.d1.s2", + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", + "root.db.unaligned.d2.s2", + "root.db.unaligned.d3.s4" }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); @@ -384,10 +384,10 @@ public void showActiveTimeseriesTest6() { String sql = "show timeseries where time >= 43 and time < 44"; String[] retArray = new String[] { - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", - "root.sg.unaligned.d2.s2" + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", + "root.db.unaligned.d2.s2" }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); @@ -398,23 +398,23 @@ public void showActiveTimeseriesTest6() { @Test public void showActiveTimeseriesTest7() { - String sql = "show timeseries root.sg.** where time > 45"; + String sql = "show timeseries root.db.** where time > 45"; String[] retArray = new String[] {}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); - sql = "count timeseries root.sg.** where time > 45"; + sql = "count timeseries root.db.** where time > 45"; long value = 0; basicCountActiveDeviceTest(sql, COUNT_TIMESERIES_COLUMN_NAMES, value); } @Test public void showActiveTimeseriesTest8() { - String sql = "show timeseries root.sg.** where time > 44 or time < 4"; + String sql = "show timeseries root.db.** where time > 44 or time < 4"; String[] retArray = - new String[] {"root.sg.aligned.d1.s1", "root.sg.aligned.d1.s2", "root.sg.unaligned.d2.s1"}; + new String[] {"root.db.aligned.d1.s1", "root.db.aligned.d1.s2", "root.db.unaligned.d2.s1"}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); - sql = "count timeseries root.sg.** where time > 44 or time < 4"; + sql = "count timeseries root.db.** where time > 44 or time < 4"; long value = 3; basicCountActiveDeviceTest(sql, COUNT_TIMESERIES_COLUMN_NAMES, value); } @@ -423,7 +423,7 @@ public void showActiveTimeseriesTest8() { public void showActiveTimeseriesTest9() { String sql = "show timeseries where time = 8"; String[] retArray = - new String[] {"root.sg.aligned.d1.s2", "root.sg.aligned.d2.s4", "root.sg.unaligned.d2.s1"}; + new String[] {"root.db.aligned.d1.s2", "root.db.aligned.d2.s4", "root.db.unaligned.d2.s1"}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); sql = "count timeseries where time = 8"; @@ -436,13 +436,13 @@ public void showActiveTimeseriesTest10() { String sql = "show timeseries where time < 50"; String[] retArray = new String[] { - "root.sg.aligned.d1.s1", - "root.sg.aligned.d1.s2", - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", - "root.sg.unaligned.d2.s2", - "root.sg.unaligned.d3.s4" + "root.db.aligned.d1.s1", + "root.db.aligned.d1.s2", + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", + "root.db.unaligned.d2.s2", + "root.db.unaligned.d3.s4" }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithModsIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithModsIT.java index 2f614a4763d9d..3f1198161ddec 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithModsIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithModsIT.java @@ -45,13 +45,13 @@ public class IoTDBActiveRegionScanWithModsIT extends AbstractSchemaIT { private static String[] delete_sqls = new String[] { - "delete from root.sg.aligned.** where time >= 1 and time <= 3", - "delete from root.sg.aligned.d1.* where time = 20", - "delete from root.sg.aligned.d2.* where time = 30", + "delete from root.db.aligned.** where time >= 1 and time <= 3", + "delete from root.db.aligned.d1.* where time = 20", + "delete from root.db.aligned.d2.* where time = 30", "delete from root.** where time >=9 and time <=15", - "delete from root.sg.unaligned.** where time >= 20 and time <= 30", - "delete from root.sg.aligned.** where time > 40 and time <= 43", - "delete from root.sg.unaligned.d2.* where time > 40 and time <= 43" + "delete from root.db.unaligned.** where time >= 20 and time <= 30", + "delete from root.db.aligned.** where time > 40 and time <= 43", + "delete from root.db.unaligned.d2.* where time > 40 and time <= 43" }; public IoTDBActiveRegionScanWithModsIT(final SchemaTestMode schemaTestMode) { @@ -97,7 +97,7 @@ public static void after() throws Exception { @Test public void showActiveDataWithMods() { String sql = "show devices where time < 5"; - String[] retArray = new String[] {"root.sg.unaligned.d2"}; + String[] retArray = new String[] {"root.db.unaligned.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); sql = "count devices where time < 5"; @@ -105,7 +105,7 @@ public void showActiveDataWithMods() { basicCountActiveDeviceTest(sql, COUNT_DEVICES_COLUMN_NAMES, value); sql = "show timeseries where time < 5"; - retArray = new String[] {"root.sg.unaligned.d2.s1"}; + retArray = new String[] {"root.db.unaligned.d2.s1"}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); sql = "count timeseries where time < 5"; @@ -116,7 +116,7 @@ public void showActiveDataWithMods() { @Test public void showActiveDataWithMods2() { String sql = "show devices where time < 31 and time > 15"; - String[] retArray = new String[] {"root.sg.aligned.d1"}; + String[] retArray = new String[] {"root.db.aligned.d1"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); sql = "count devices where time < 31 and time > 15"; @@ -126,7 +126,7 @@ public void showActiveDataWithMods2() { sql = "show timeseries where time < 31 and time > 15"; retArray = new String[] { - "root.sg.aligned.d1.s1", "root.sg.aligned.d1.s2", + "root.db.aligned.d1.s1", "root.db.aligned.d1.s2", }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); @@ -139,7 +139,7 @@ public void showActiveDataWithMods2() { public void showActiveDataWithMods3() { String sql = "show devices where time > 7 and time < 20"; String[] retArray = - new String[] {"root.sg.aligned.d1", "root.sg.aligned.d2", "root.sg.unaligned.d2"}; + new String[] {"root.db.aligned.d1", "root.db.aligned.d2", "root.db.unaligned.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); sql = "count devices where time > 7 and time < 20"; @@ -148,7 +148,7 @@ public void showActiveDataWithMods3() { sql = "show timeseries where time > 7 and time < 20"; retArray = - new String[] {"root.sg.aligned.d1.s2", "root.sg.aligned.d2.s4", "root.sg.unaligned.d2.s1"}; + new String[] {"root.db.aligned.d1.s2", "root.db.aligned.d2.s4", "root.db.unaligned.d2.s1"}; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); sql = "count timeseries where time > 7 and time < 20"; @@ -158,33 +158,33 @@ public void showActiveDataWithMods3() { @Test public void showActiveDataWithMods4() { - String sql = "show devices root.sg.** where time > 40"; + String sql = "show devices root.db.** where time > 40"; String[] retArray = new String[] { - "root.sg.aligned.d1", - "root.sg.aligned.d2", - "root.sg.unaligned.d2", - "root.sg.unaligned.d3", + "root.db.aligned.d1", + "root.db.aligned.d2", + "root.db.unaligned.d2", + "root.db.unaligned.d3", }; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); - sql = "count devices root.sg.** where time > 40"; + sql = "count devices root.db.** where time > 40"; long value = 4; basicCountActiveDeviceTest(sql, COUNT_DEVICES_COLUMN_NAMES, value); - sql = "show timeseries root.sg.** where time > 40"; + sql = "show timeseries root.db.** where time > 40"; retArray = new String[] { - "root.sg.aligned.d1.s1", - "root.sg.aligned.d1.s2", - "root.sg.aligned.d2.s3", - "root.sg.aligned.d2.s4", - "root.sg.unaligned.d2.s1", - "root.sg.unaligned.d3.s4", + "root.db.aligned.d1.s1", + "root.db.aligned.d1.s2", + "root.db.aligned.d2.s3", + "root.db.aligned.d2.s4", + "root.db.unaligned.d2.s1", + "root.db.unaligned.d3.s4", }; basicShowActiveDeviceTest(sql, SHOW_TIMESERIES_COLUMN_NAMES, retArray); - sql = "count timeseries root.sg.** where time > 40"; + sql = "count timeseries root.db.** where time > 40"; value = 6; basicCountActiveDeviceTest(sql, COUNT_TIMESERIES_COLUMN_NAMES, value); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithTTLIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithTTLIT.java index 124b37323036e..5fe7a3ffadb4a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithTTLIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveRegionScanWithTTLIT.java @@ -44,23 +44,23 @@ public IoTDBActiveRegionScanWithTTLIT(final SchemaTestMode schemaTestMode) { private static String[] sqls = new String[] { - "create timeseries root.sg.d1.s1 WITH DATATYPE=INT64, encoding=RLE", - "create timeseries root.sg.d1.s2 WITH DATATYPE=INT32, encoding=Gorilla", - "create timeseries root.sg.d2.s1 WITH DATATYPE=INT64, encoding=RLE", - "create timeseries root.sg.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", - "insert into root.sg.d1(time, s1, s2) values(1, 1, 2)", - "insert into root.sg.d1(time, s1, s2) values(2, 2, 3)", - "insert into root.sg.d1(time, s1, s2) values(3, 3, 4)", - "insert into root.sg.d1(time, s1, s2) values(5, 5, 6)", - "insert into root.sg.d1(time, s1, s2) values(6, 6, 7)", - "insert into root.sg.d1(time, s1, s2) values(7, 7, 8)", - "insert into root.sg.d1(time, s1, s2) values(8, null, 9)", - "insert into root.sg.d1(time, s1, s2) values(9, 9, 10)", - "insert into root.sg.d1(time, s1, s2) values(10, 10, 11)", + "create timeseries root.db.d1.s1 WITH DATATYPE=INT64, encoding=RLE", + "create timeseries root.db.d1.s2 WITH DATATYPE=INT32, encoding=Gorilla", + "create timeseries root.db.d2.s1 WITH DATATYPE=INT64, encoding=RLE", + "create timeseries root.db.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", + "insert into root.db.d1(time, s1, s2) values(1, 1, 2)", + "insert into root.db.d1(time, s1, s2) values(2, 2, 3)", + "insert into root.db.d1(time, s1, s2) values(3, 3, 4)", + "insert into root.db.d1(time, s1, s2) values(5, 5, 6)", + "insert into root.db.d1(time, s1, s2) values(6, 6, 7)", + "insert into root.db.d1(time, s1, s2) values(7, 7, 8)", + "insert into root.db.d1(time, s1, s2) values(8, null, 9)", + "insert into root.db.d1(time, s1, s2) values(9, 9, 10)", + "insert into root.db.d1(time, s1, s2) values(10, 10, 11)", "flush", - "insert into root.sg.d2(time, s1, s2) values(now(), null, 9)", - "insert into root.sg.d2(time, s1, s2) values(now(), 9, 10)", - "insert into root.sg.d2(time, s1, s2) values(now(), 10, 11)" + "insert into root.db.d2(time, s1, s2) values(now(), null, 9)", + "insert into root.db.d2(time, s1, s2) values(now(), 9, 10)", + "insert into root.db.d2(time, s1, s2) values(now(), 10, 11)" }; public static void insertData() { @@ -77,7 +77,7 @@ public static void insertData() { } private static void setTTL() { - final String[] ttl_sqls = {"set ttl to root.sg.d1 3600000", "set ttl to root.sg.d2 3600000"}; + final String[] ttl_sqls = {"set ttl to root.db.d1 3600000", "set ttl to root.db.d2 3600000"}; try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { for (final String sql : ttl_sqls) { @@ -90,7 +90,7 @@ private static void setTTL() { } private static void unsetTTL() { - final String[] ttl_sqls = {"unset ttl to root.sg.d1", "unset ttl to root.sg.d2"}; + final String[] ttl_sqls = {"unset ttl to root.db.d1", "unset ttl to root.db.d2"}; try (final Connection connection = EnvFactory.getEnv().getConnection(); final Statement statement = connection.createStatement()) { for (final String sql : ttl_sqls) { @@ -123,13 +123,13 @@ public static void after() throws Exception { @Test public void showActiveDataWithMods() { - final String sql = "show devices root.sg.** where time > 0"; - String[] retArray = new String[] {"root.sg.d1", "root.sg.d2"}; + final String sql = "show devices root.db.** where time > 0"; + String[] retArray = new String[] {"root.db.d1", "root.db.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); setTTL(); - retArray = new String[] {"root.sg.d2"}; + retArray = new String[] {"root.db.d2"}; basicShowActiveDeviceTest(sql, SHOW_DEVICES_COLUMN_NAMES, retArray); unsetTTL(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveSchemaQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveSchemaQueryIT.java index c0e7673d7d642..8145a3ee5c19c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveSchemaQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/regionscan/IoTDBActiveSchemaQueryIT.java @@ -45,17 +45,17 @@ public class IoTDBActiveSchemaQueryIT extends AbstractSchemaIT { private static String[] sqls = new String[] { - "create aligned timeseries root.sg.d1(s1(alias1) int32 tags('tag1'='v1', 'tag2'='v2'), s2 double attributes('attr3'='v3'))", - "CREATE TIMESERIES root.sg.d0.s0 WITH DATATYPE=INT32", - "CREATE TIMESERIES root.sg.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2", - "CREATE TIMESERIES root.sg.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15", + "create aligned timeseries root.db.d1(s1(alias1) int32 tags('tag1'='v1', 'tag2'='v2'), s2 double attributes('attr3'='v3'))", + "CREATE TIMESERIES root.db.d0.s0 WITH DATATYPE=INT32", + "CREATE TIMESERIES root.db.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT,COMPDEV=2", + "CREATE TIMESERIES root.db.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN,LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15", "CREATE DEVICE TEMPLATE t1 (s1 INT64 encoding=RLE compressor=SNAPPY, s2 INT32)", "CREATE DEVICE TEMPLATE t2 aligned(s1 INT64 encoding=RLE compressor=SNAPPY, s2 INT32)", - "SET DEVICE TEMPLATE t1 to root.sg.d2", - "SET DEVICE TEMPLATE t2 to root.sg.d3", - "CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg.d2", - "CREATE TIMESERIES OF DEVICE TEMPLATE ON root.sg.d3", - "set ttl to root.sg.d3 60000", + "SET DEVICE TEMPLATE t1 to root.db.d2", + "SET DEVICE TEMPLATE t2 to root.db.d3", + "CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db.d2", + "CREATE TIMESERIES OF DEVICE TEMPLATE ON root.db.d3", + "set ttl to root.db.d3 60000", }; public IoTDBActiveSchemaQueryIT(SchemaTestMode schemaTestMode) { @@ -107,19 +107,19 @@ public void testShowTimeSeries() { Set expected = new HashSet<>( Arrays.asList( - "root.sg.d1.s1,alias1,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", - "root.sg.d1.s2,null,root.sg,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", - "root.sg.d0.s0,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d0.s1,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", - "root.sg.d0.s2,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,", - "root.sg.d2.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d2.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d3.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d3.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); - checkResultSet(statement, "show timeseries root.sg.**", expected); + "root.db.d1.s1,alias1,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", + "root.db.d1.s2,null,root.db,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", + "root.db.d0.s0,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d0.s1,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", + "root.db.d0.s2,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,", + "root.db.d2.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d2.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d3.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d3.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); + checkResultSet(statement, "show timeseries root.db.**", expected); // 1. Without any data, result set should be empty try (ResultSet resultSet = - statement.executeQuery("show timeseries root.sg.** where time>0")) { + statement.executeQuery("show timeseries root.db.** where time>0")) { Assert.assertFalse(resultSet.next()); } // 2. Insert data and check again. @@ -127,107 +127,107 @@ public void testShowTimeSeries() { // - root.db.d1.* time=2 // - root.db.d2.* time=3 // - root.db.d3.* time=now() - statement.execute("insert into root.sg.d0(timestamp,s0, s1, s2) values(1,1,1,1)"); - statement.execute("insert into root.sg.d1(timestamp,s1,s2) values(2,2,2)"); - statement.execute("insert into root.sg.d2(timestamp,s1,s2) values(3,3,3)"); - statement.execute("insert into root.sg.d3(timestamp,s1,s2) values(now(),4,4)"); + statement.execute("insert into root.db.d0(timestamp,s0, s1, s2) values(1,1,1,1)"); + statement.execute("insert into root.db.d1(timestamp,s1,s2) values(2,2,2)"); + statement.execute("insert into root.db.d2(timestamp,s1,s2) values(3,3,3)"); + statement.execute("insert into root.db.d3(timestamp,s1,s2) values(now(),4,4)"); expected = new HashSet<>( Arrays.asList( - "root.sg.d1.s1,alias1,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", - "root.sg.d1.s2,null,root.sg,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", - "root.sg.d0.s0,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d0.s1,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", - "root.sg.d0.s2,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,", - "root.sg.d2.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d2.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d3.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d3.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); - checkResultSet(statement, "show timeseries root.sg.** where time>0", expected); + "root.db.d1.s1,alias1,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", + "root.db.d1.s2,null,root.db,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", + "root.db.d0.s0,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d0.s1,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", + "root.db.d0.s2,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,", + "root.db.d2.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d2.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d3.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d3.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); + checkResultSet(statement, "show timeseries root.db.** where time>0", expected); checkResultSet( statement, - "count timeseries root.sg.** where time>0", + "count timeseries root.db.** where time>0", new HashSet<>(Collections.singletonList("9,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d1.s1,alias1,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", - "root.sg.d1.s2,null,root.sg,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", - "root.sg.d2.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d2.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d3.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d3.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); - checkResultSet(statement, "show timeseries root.sg.** where time>1", expected); + "root.db.d1.s1,alias1,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", + "root.db.d1.s2,null,root.db,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", + "root.db.d2.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d2.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d3.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d3.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); + checkResultSet(statement, "show timeseries root.db.** where time>1", expected); checkResultSet( statement, - "count timeseries root.sg.** where time>1", + "count timeseries root.db.** where time>1", new HashSet<>(Collections.singletonList("6,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d1.s1,alias1,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", - "root.sg.d1.s2,null,root.sg,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", - "root.sg.d2.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d2.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d3.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,", - "root.sg.d3.s2,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); - checkResultSet(statement, "show timeseries root.sg.** where time!=1", expected); + "root.db.d1.s1,alias1,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},null,null,null,BASE,", + "root.db.d1.s2,null,root.db,DOUBLE,GORILLA,LZ4,null,{\"attr3\":\"v3\"},null,null,BASE,", + "root.db.d2.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d2.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d3.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,", + "root.db.d3.s2,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,")); + checkResultSet(statement, "show timeseries root.db.** where time!=1", expected); checkResultSet( statement, - "count timeseries root.sg.** where time!=1", + "count timeseries root.db.** where time!=1", new HashSet<>(Collections.singletonList("6,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d0.s0,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d0.s1,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", - "root.sg.d0.s2,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,")); - checkResultSet(statement, "show timeseries root.sg.** where time<2", expected); + "root.db.d0.s0,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d0.s1,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", + "root.db.d0.s2,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,")); + checkResultSet(statement, "show timeseries root.db.** where time<2", expected); checkResultSet( statement, - "count timeseries root.sg.** where time<2", + "count timeseries root.db.** where time<2", new HashSet<>(Collections.singletonList("3,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d0.s0,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.d0.s1,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", - "root.sg.d0.s2,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,")); - checkResultSet(statement, "show timeseries root.sg.** where time=1", expected); + "root.db.d0.s0,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.d0.s1,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", + "root.db.d0.s2,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=0.01, compmintime=2, compmaxtime=15},BASE,")); + checkResultSet(statement, "show timeseries root.db.** where time=1", expected); checkResultSet( statement, - "count timeseries root.sg.** where time=1", + "count timeseries root.db.** where time=1", new HashSet<>(Collections.singletonList("3,"))); // 3. Check non-root user statement.execute("CREATE USER user1 'password123456'"); - statement.execute("GRANT READ_SCHEMA ON root.sg.d0.s1 TO USER user1"); - statement.execute("GRANT READ_SCHEMA ON root.sg.d3.s1 TO USER user1"); + statement.execute("GRANT READ_SCHEMA ON root.db.d0.s1 TO USER user1"); + statement.execute("GRANT READ_SCHEMA ON root.db.d3.s1 TO USER user1"); try (Connection userCon = EnvFactory.getEnv().getConnection("user1", "password123456"); Statement userStmt = userCon.createStatement()) { // 3.1 Without read data permission, result set should be empty try (ResultSet resultSet = - userStmt.executeQuery("show timeseries root.sg.** where time>0")) { + userStmt.executeQuery("show timeseries root.db.** where time>0")) { Assert.assertFalse(resultSet.next()); } checkResultSet( userStmt, - "count timeseries root.sg.** where time>0", + "count timeseries root.db.** where time>0", new HashSet<>(Collections.singletonList("0,"))); } - statement.execute("GRANT READ_DATA ON root.sg.d0.s1 TO USER user1"); - statement.execute("GRANT READ_DATA ON root.sg.d3.s1 TO USER user1"); + statement.execute("GRANT READ_DATA ON root.db.d0.s1 TO USER user1"); + statement.execute("GRANT READ_DATA ON root.db.d3.s1 TO USER user1"); try (Connection userCon = EnvFactory.getEnv().getConnection("user1", "password123456"); Statement userStmt = userCon.createStatement()) { // 3.2 With read data permission, result set should not be empty expected = new HashSet<>( Arrays.asList( - "root.sg.d0.s1,null,root.sg,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", - "root.sg.d3.s1,null,root.sg,INT64,RLE,SNAPPY,null,null,null,null,BASE,")); - checkResultSet(userStmt, "show timeseries root.sg.** where time>0", expected); + "root.db.d0.s1,null,root.db,INT32,PLAIN,LZ4,null,null,SDT,{compdev=2},BASE,", + "root.db.d3.s1,null,root.db,INT64,RLE,SNAPPY,null,null,null,null,BASE,")); + checkResultSet(userStmt, "show timeseries root.db.** where time>0", expected); checkResultSet( userStmt, - "count timeseries root.sg.** where time>0", + "count timeseries root.db.** where time>0", new HashSet<>(Collections.singletonList("2,"))); } } catch (Exception e) { @@ -244,96 +244,96 @@ public void testShowDevices() { Set expected = new HashSet<>( Arrays.asList( - "root.sg.d0,false,null,INF,", - "root.sg.d1,true,null,INF,", - "root.sg.d2,false,t1,INF,", - "root.sg.d3,true,t2,60000,")); - checkResultSet(statement, "show devices root.sg.*", expected); + "root.db.d0,false,null,INF,", + "root.db.d1,true,null,INF,", + "root.db.d2,false,t1,INF,", + "root.db.d3,true,t2,60000,")); + checkResultSet(statement, "show devices root.db.*", expected); // 1. Without any data, result set should be empty - try (ResultSet resultSet = statement.executeQuery("show devices root.sg.* where time>0")) { + try (ResultSet resultSet = statement.executeQuery("show devices root.db.* where time>0")) { Assert.assertFalse(resultSet.next()); } // 2. Insert data and check again. - // - root.sg.d0.* time=1 - // - root.sg.d1.* time=2 - // - root.sg.d2.* time=3 - // - root.sg.d3.* time=now() - statement.execute("insert into root.sg.d0(timestamp,s0, s1, s2) values(1,1,1,1)"); - statement.execute("insert into root.sg.d1(timestamp,s1,s2) values(2,2,2)"); - statement.execute("insert into root.sg.d2(timestamp,s1,s2) values(3,3,3)"); - statement.execute("insert into root.sg.d3(timestamp,s1,s2) values(now(),4,4)"); + // - root.db.d0.* time=1 + // - root.db.d1.* time=2 + // - root.db.d2.* time=3 + // - root.db.d3.* time=now() + statement.execute("insert into root.db.d0(timestamp,s0, s1, s2) values(1,1,1,1)"); + statement.execute("insert into root.db.d1(timestamp,s1,s2) values(2,2,2)"); + statement.execute("insert into root.db.d2(timestamp,s1,s2) values(3,3,3)"); + statement.execute("insert into root.db.d3(timestamp,s1,s2) values(now(),4,4)"); expected = new HashSet<>( Arrays.asList( - "root.sg.d0,false,null,INF,", - "root.sg.d1,true,null,INF,", - "root.sg.d2,false,t1,INF,", - "root.sg.d3,true,t2,60000,")); - checkResultSet(statement, "show devices root.sg.* where time>0", expected); + "root.db.d0,false,null,INF,", + "root.db.d1,true,null,INF,", + "root.db.d2,false,t1,INF,", + "root.db.d3,true,t2,60000,")); + checkResultSet(statement, "show devices root.db.* where time>0", expected); checkResultSet( statement, - "count devices root.sg.* where time>0", + "count devices root.db.* where time>0", new HashSet<>(Collections.singletonList("4,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d1,true,null,INF,", - "root.sg.d2,false,t1,INF,", - "root.sg.d3,true,t2,60000,")); - checkResultSet(statement, "show devices root.sg.* where time>1", expected); + "root.db.d1,true,null,INF,", + "root.db.d2,false,t1,INF,", + "root.db.d3,true,t2,60000,")); + checkResultSet(statement, "show devices root.db.* where time>1", expected); checkResultSet( statement, - "count devices root.sg.* where time>1", + "count devices root.db.* where time>1", new HashSet<>(Collections.singletonList("3,"))); expected = new HashSet<>( Arrays.asList( - "root.sg.d1,true,null,INF,", - "root.sg.d2,false,t1,INF,", - "root.sg.d3,true,t2,60000,")); - checkResultSet(statement, "show devices root.sg.* where time!=1", expected); + "root.db.d1,true,null,INF,", + "root.db.d2,false,t1,INF,", + "root.db.d3,true,t2,60000,")); + checkResultSet(statement, "show devices root.db.* where time!=1", expected); checkResultSet( statement, - "count devices root.sg.* where time!=1", + "count devices root.db.* where time!=1", new HashSet<>(Collections.singletonList("3,"))); - expected = new HashSet<>(Collections.singletonList("root.sg.d0,false,null,INF,")); - checkResultSet(statement, "show devices root.sg.* where time<2", expected); + expected = new HashSet<>(Collections.singletonList("root.db.d0,false,null,INF,")); + checkResultSet(statement, "show devices root.db.* where time<2", expected); checkResultSet( statement, - "count devices root.sg.* where time<2", + "count devices root.db.* where time<2", new HashSet<>(Collections.singletonList("1,"))); - expected = new HashSet<>(Collections.singletonList("root.sg.d0,false,null,INF,")); - checkResultSet(statement, "show devices root.sg.* where time=1", expected); + expected = new HashSet<>(Collections.singletonList("root.db.d0,false,null,INF,")); + checkResultSet(statement, "show devices root.db.* where time=1", expected); checkResultSet( statement, - "count devices root.sg.* where time=1", + "count devices root.db.* where time=1", new HashSet<>(Collections.singletonList("1,"))); // 3. Check non-root user statement.execute("CREATE USER user1 'password123456'"); - statement.execute("GRANT READ_SCHEMA ON root.sg.d0.s1 TO USER user1"); - statement.execute("GRANT READ_SCHEMA ON root.sg.d3.s1 TO USER user1"); + statement.execute("GRANT READ_SCHEMA ON root.db.d0.s1 TO USER user1"); + statement.execute("GRANT READ_SCHEMA ON root.db.d3.s1 TO USER user1"); try (Connection userCon = EnvFactory.getEnv().getConnection("user1", "password123456"); Statement userStmt = userCon.createStatement()) { // 3.1 Without read data permission, result set should be empty - try (ResultSet resultSet = userStmt.executeQuery("show devices root.sg.* where time>0")) { + try (ResultSet resultSet = userStmt.executeQuery("show devices root.db.* where time>0")) { Assert.assertFalse(resultSet.next()); } checkResultSet( userStmt, - "count devices root.sg.* where time>0", + "count devices root.db.* where time>0", new HashSet<>(Collections.singletonList("0,"))); } - statement.execute("GRANT READ_DATA ON root.sg.d0.s1 TO USER user1"); - statement.execute("GRANT READ_DATA ON root.sg.d3.s1 TO USER user1"); + statement.execute("GRANT READ_DATA ON root.db.d0.s1 TO USER user1"); + statement.execute("GRANT READ_DATA ON root.db.d3.s1 TO USER user1"); try (Connection userCon = EnvFactory.getEnv().getConnection("user1", "password123456"); Statement userStmt = userCon.createStatement()) { // 3.2 With read data permission, result set should not be empty expected = - new HashSet<>(Arrays.asList("root.sg.d0,false,null,INF,", "root.sg.d3,true,t2,60000,")); - checkResultSet(userStmt, "show devices root.sg.* where time>0", expected); + new HashSet<>(Arrays.asList("root.db.d0,false,null,INF,", "root.db.d3,true,t2,60000,")); + checkResultSet(userStmt, "show devices root.db.* where time>0", expected); checkResultSet( userStmt, - "count devices root.sg.* where time>0", + "count devices root.db.* where time>0", new HashSet<>(Collections.singletonList("2,"))); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java index 620e2718b04d9..8f2f750806b81 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java @@ -54,38 +54,38 @@ public class IoTDBSelectIntoIT { public static final List SELECT_INTO_SQL_LIST = new ArrayList<>( Arrays.asList( - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.s1 WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", - "INSERT INTO root.sg.d1(time, s1) VALUES (1, 1)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (2, 2, 2)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (3, 3, 3)", - "INSERT INTO root.sg.d1(time, s2) VALUES (4, 4)", - "INSERT INTO root.sg.d1(time, s1) VALUES (5, 5)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (6, 6, 6)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (7, 7, 7)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (8, 8, 8)", - "INSERT INTO root.sg.d1(time, s2) VALUES (9, 9)", - "INSERT INTO root.sg.d1(time, s1) VALUES (10, 10)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (11, 11, 11)", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES (12, 12, 12)", - "INSERT INTO root.sg.d2(time, s1, s2) VALUES (1, 1, 1)", - "INSERT INTO root.sg.d2(time, s2) VALUES (2, 2)", - "INSERT INTO root.sg.d2(time, s1) VALUES (3, 3)", - "INSERT INTO root.sg.d2(time, s1, s2) VALUES (4, 4, 4)", - "INSERT INTO root.sg.d2(time, s2) VALUES (5, 5)", - "INSERT INTO root.sg.d2(time, s2) VALUES (6, 6)", - "INSERT INTO root.sg.d2(time, s1) VALUES (7, 7)", - "INSERT INTO root.sg.d2(time, s1, s2) VALUES (8, 8, 8)", - "INSERT INTO root.sg.d2(time, s1, s2) VALUES (10, 10, 10)", - "INSERT INTO root.sg.d2(time, s2) VALUES (11, 11)", - "INSERT INTO root.sg.d2(time, s1) VALUES (12, 12)", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.s1 WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", + "INSERT INTO root.db.d1(time, s1) VALUES (1, 1)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (2, 2, 2)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (3, 3, 3)", + "INSERT INTO root.db.d1(time, s2) VALUES (4, 4)", + "INSERT INTO root.db.d1(time, s1) VALUES (5, 5)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (6, 6, 6)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (7, 7, 7)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (8, 8, 8)", + "INSERT INTO root.db.d1(time, s2) VALUES (9, 9)", + "INSERT INTO root.db.d1(time, s1) VALUES (10, 10)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (11, 11, 11)", + "INSERT INTO root.db.d1(time, s1, s2) VALUES (12, 12, 12)", + "INSERT INTO root.db.d2(time, s1, s2) VALUES (1, 1, 1)", + "INSERT INTO root.db.d2(time, s2) VALUES (2, 2)", + "INSERT INTO root.db.d2(time, s1) VALUES (3, 3)", + "INSERT INTO root.db.d2(time, s1, s2) VALUES (4, 4, 4)", + "INSERT INTO root.db.d2(time, s2) VALUES (5, 5)", + "INSERT INTO root.db.d2(time, s2) VALUES (6, 6)", + "INSERT INTO root.db.d2(time, s1) VALUES (7, 7)", + "INSERT INTO root.db.d2(time, s1, s2) VALUES (8, 8, 8)", + "INSERT INTO root.db.d2(time, s1, s2) VALUES (10, 10, 10)", + "INSERT INTO root.db.d2(time, s2) VALUES (11, 11)", + "INSERT INTO root.db.d2(time, s1) VALUES (12, 12)", "flush", - "CREATE DATABASE root.sg1", - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", + "CREATE DATABASE root.db1", + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE", "create timeseries root.db.d1.s1 BOOLEAN encoding=PLAIN", "create timeseries root.db.d1.s2 FLOAT encoding=RLE", "create timeseries root.db.d1.s3 TEXT encoding=PLAIN", @@ -102,13 +102,13 @@ public class IoTDBSelectIntoIT { "insert into root.db.d1(time,s2) values(2,1.2)")); static { - SELECT_INTO_SQL_LIST.add("CREATE DATABASE root.sg_type"); + SELECT_INTO_SQL_LIST.add("CREATE DATABASE root.db_type"); for (int deviceId = 0; deviceId < 6; deviceId++) { for (TSDataType dataType : TSDataType.values()) { if (!dataType.equals(TSDataType.VECTOR) && !dataType.equals(TSDataType.UNKNOWN)) { SELECT_INTO_SQL_LIST.add( String.format( - "CREATE TIMESERIES root.sg_type.d_%d.s_%s %s", + "CREATE TIMESERIES root.db_type.d_%d.s_%s %s", deviceId, dataType.name().toLowerCase(), dataType)); } } @@ -117,7 +117,7 @@ public class IoTDBSelectIntoIT { SELECT_INTO_SQL_LIST.add( String.format( Locale.ENGLISH, - "INSERT INTO root.sg_type.d_0(time, s_int32, s_int64, s_float, s_double, s_boolean, s_text) " + "INSERT INTO root.db_type.d_0(time, s_int32, s_int64, s_float, s_double, s_boolean, s_text) " + "VALUES (%d, %d, %d, %f, %f, %s, 'text%d')", time, time, @@ -171,39 +171,39 @@ public static void tearDown() throws Exception { public void testRawDataQuery1() { String[] intoRetArray = new String[] { - "root.sg.d1.s1,root.sg_bk1.new_d.t1,10,", - "root.sg.d2.s1,root.sg_bk1.new_d.t2,7,", - "root.sg.d1.s2,root.sg_bk1.new_d.t3,9,", - "root.sg.d2.s2,root.sg_bk1.new_d.t4,8,", + "root.db.d1.s1,root.db_bk1.new_d.t1,10,", + "root.db.d2.s1,root.db_bk1.new_d.t2,7,", + "root.db.d1.s2,root.db_bk1.new_d.t3,9,", + "root.db.d2.s2,root.db_bk1.new_d.t4,8,", }; resultSetEqualTest( - "select s1, s2 into root.sg_bk1.new_d(t1, t2, t3, t4) from root.sg.*;", + "select s1, s2 into root.db_bk1.new_d(t1, t2, t3, t4) from root.db.*;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_bk1.new_d.t1,root.sg_bk1.new_d.t3,root.sg_bk1.new_d.t2,root.sg_bk1.new_d.t4,"; + "Time,root.db_bk1.new_d.t1,root.db_bk1.new_d.t3,root.db_bk1.new_d.t2,root.db_bk1.new_d.t4,"; resultSetEqualTest( - "select t1, t3, t2, t4 from root.sg_bk1.new_d;", expectedQueryHeader, rawDataSet); + "select t1, t3, t2, t4 from root.db_bk1.new_d;", expectedQueryHeader, rawDataSet); } @Test public void testRawDataQuery2() { String[] intoRetArray = new String[] { - "root.sg.d1.s1,root.sg_bk2.new_d1.s1,10,", - "root.sg.d2.s1,root.sg_bk2.new_d2.s1,7,", - "root.sg.d1.s2,root.sg_bk2.new_d1.s2,9,", - "root.sg.d2.s2,root.sg_bk2.new_d2.s2,8," + "root.db.d1.s1,root.db_bk2.new_d1.s1,10,", + "root.db.d2.s1,root.db_bk2.new_d2.s1,7,", + "root.db.d1.s2,root.db_bk2.new_d1.s2,9,", + "root.db.d2.s2,root.db_bk2.new_d2.s2,8," }; resultSetEqualTest( - "select s1, s2 into root.sg_bk2.new_${2}(::) from root.sg.*;", + "select s1, s2 into root.db_bk2.new_${2}(::) from root.db.*;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_bk2.new_d1.s1,root.sg_bk2.new_d1.s2,root.sg_bk2.new_d2.s1,root.sg_bk2.new_d2.s2,"; + "Time,root.db_bk2.new_d1.s1,root.db_bk2.new_d1.s2,root.db_bk2.new_d2.s1,root.db_bk2.new_d2.s2,"; resultSetEqualTest( - "select new_d1.s1, new_d1.s2, new_d2.s1, new_d2.s2 from root.sg_bk2;", + "select new_d1.s1, new_d1.s2, new_d2.s1, new_d2.s2 from root.db_bk2;", expectedQueryHeader, rawDataSet); } @@ -212,18 +212,18 @@ public void testRawDataQuery2() { public void testSamePathQuery() { String[] intoRetArray = new String[] { - "root.sg.d1.s1,root.sg_bk3.new_d1.t1,10,", - "root.sg.d1.s2,root.sg_bk3.new_d1.t2,9,", - "root.sg.d1.s1,root.sg_bk3.new_d2.t1,10,", - "root.sg.d1.s2,root.sg_bk3.new_d2.t2,9," + "root.db.d1.s1,root.db_bk3.new_d1.t1,10,", + "root.db.d1.s2,root.db_bk3.new_d1.t2,9,", + "root.db.d1.s1,root.db_bk3.new_d2.t1,10,", + "root.db.d1.s2,root.db_bk3.new_d2.t2,9," }; resultSetEqualTest( - "select s1, s2, s1, s2 into root.sg_bk3.new_d1(t1, t2), aligned root.sg_bk3.new_d2(t1, t2) from root.sg.d1;", + "select s1, s2, s1, s2 into root.db_bk3.new_d1(t1, t2), aligned root.db_bk3.new_d2(t1, t2) from root.db.d1;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_bk3.new_d1.t1,root.sg_bk3.new_d1.t2,root.sg_bk3.new_d2.t1,root.sg_bk3.new_d2.t2,"; + "Time,root.db_bk3.new_d1.t1,root.db_bk3.new_d1.t2,root.db_bk3.new_d2.t1,root.db_bk3.new_d2.t2,"; String[] queryRetArray = new String[] { "1,1,null,1,null,", @@ -240,7 +240,7 @@ public void testSamePathQuery() { "12,12,12.0,12,12.0," }; resultSetEqualTest( - "select new_d1.t1, new_d1.t2, new_d2.t1, new_d2.t2 from root.sg_bk3;", + "select new_d1.t1, new_d1.t2, new_d2.t1, new_d2.t2 from root.db_bk3;", expectedQueryHeader, queryRetArray); } @@ -248,7 +248,7 @@ public void testSamePathQuery() { @Test public void testEmptyQuery() { resultSetEqualTest( - "select s1, s2 into root.sg_bk4.new_${2}(::) from root.sg1.d1, root.sg1.d2;", + "select s1, s2 into root.db_bk4.new_${2}(::) from root.db1.d1, root.db1.d2;", selectIntoHeader, new String[] {}); } @@ -256,23 +256,23 @@ public void testEmptyQuery() { public void testAggregationQuery1() { String[] intoRetArray = new String[] { - "count(root.sg.d1.s1),root.sg_agg1.d1.count_s1,1,", - "last_value(root.sg.d1.s2),root.sg_agg1.d1.last_value_s2,1,", - "count(root.sg.d2.s1),root.sg_agg1.d2.count_s1,1,", - "last_value(root.sg.d2.s2),root.sg_agg1.d2.last_value_s2,1," + "count(root.db.d1.s1),root.db_agg1.d1.count_s1,1,", + "last_value(root.db.d1.s2),root.db_agg1.d1.last_value_s2,1,", + "count(root.db.d2.s1),root.db_agg1.d2.count_s1,1,", + "last_value(root.db.d2.s2),root.db_agg1.d2.last_value_s2,1," }; resultSetEqualTest( "select count(d1.s1), last_value(d1.s2), count(d2.s1), last_value(d2.s2) " - + "into root.sg_agg1.d1(count_s1, last_value_s2), aligned root.sg_agg1.d2(count_s1, last_value_s2) " - + "from root.sg;", + + "into root.db_agg1.d1(count_s1, last_value_s2), aligned root.db_agg1.d2(count_s1, last_value_s2) " + + "from root.db;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_agg1.d1.count_s1,root.sg_agg1.d2.count_s1,root.sg_agg1.d1.last_value_s2,root.sg_agg1.d2.last_value_s2,"; + "Time,root.db_agg1.d1.count_s1,root.db_agg1.d2.count_s1,root.db_agg1.d1.last_value_s2,root.db_agg1.d2.last_value_s2,"; String[] queryRetArray = new String[] {"0,10,7,12.0,11.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_agg1.d1, root.sg_agg1.d2;", + "select count_s1, last_value_s2 from root.db_agg1.d1, root.db_agg1.d2;", expectedQueryHeader, queryRetArray); } @@ -281,24 +281,24 @@ public void testAggregationQuery1() { public void testAggregationQuery2() { String[] intoRetArray = new String[] { - "count(root.sg.d1.s1),root.sg_agg2.d1.count_s1,4,", - "last_value(root.sg.d1.s2),root.sg_agg2.d1.last_value_s2,4,", - "count(root.sg.d2.s1),root.sg_agg2.d2.count_s1,4,", - "last_value(root.sg.d2.s2),root.sg_agg2.d2.last_value_s2,4," + "count(root.db.d1.s1),root.db_agg2.d1.count_s1,4,", + "last_value(root.db.d1.s2),root.db_agg2.d1.last_value_s2,4,", + "count(root.db.d2.s1),root.db_agg2.d2.count_s1,4,", + "last_value(root.db.d2.s2),root.db_agg2.d2.last_value_s2,4," }; resultSetEqualTest( "select count(d1.s1), last_value(d1.s2), count(d2.s1), last_value(d2.s2) " - + "into aligned root.sg_agg2.d1(count_s1, last_value_s2), aligned root.sg_agg2.d2(count_s1, last_value_s2) " - + "from root.sg group by ([1, 13), 3ms);", + + "into aligned root.db_agg2.d1(count_s1, last_value_s2), aligned root.db_agg2.d2(count_s1, last_value_s2) " + + "from root.db group by ([1, 13), 3ms);", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_agg2.d1.count_s1,root.sg_agg2.d2.count_s1,root.sg_agg2.d1.last_value_s2,root.sg_agg2.d2.last_value_s2,"; + "Time,root.db_agg2.d1.count_s1,root.db_agg2.d2.count_s1,root.db_agg2.d1.last_value_s2,root.db_agg2.d2.last_value_s2,"; String[] queryRetArray = new String[] {"1,3,2,3.0,2.0,", "4,2,1,6.0,6.0,", "7,2,2,9.0,8.0,", "10,3,2,12.0,11.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_agg2.d1, root.sg_agg2.d2;", + "select count_s1, last_value_s2 from root.db_agg2.d1, root.db_agg2.d2;", expectedQueryHeader, queryRetArray); } @@ -307,17 +307,17 @@ public void testAggregationQuery2() { public void testExpression() { String[] intoRetArray = new String[] { - "root.sg.d1.s1 + root.sg.d2.s1,root.sg_expr.d.k1,6,", - "-sin(root.sg.d1.s2),root.sg_expr.d.k2,9,", - "top_k(root.sg.d2.s2, \"k\"=\"3\"),root.sg_expr.d.k3,3," + "root.db.d1.s1 + root.db.d2.s1,root.db_expr.d.k1,6,", + "-sin(root.db.d1.s2),root.db_expr.d.k2,9,", + "top_k(root.db.d2.s2, \"k\"=\"3\"),root.db_expr.d.k3,3," }; resultSetEqualTest( "select d1.s1 + d2.s1, -sin(d1.s2), top_k(d2.s2,'k'='3') " - + "into root.sg_expr.d(k1, k2, k3) from root.sg;", + + "into root.db_expr.d(k1, k2, k3) from root.db;", selectIntoHeader, intoRetArray); - String expectedQueryHeader = "Time,root.sg_expr.d.k1,root.sg_expr.d.k2,root.sg_expr.d.k3,"; + String expectedQueryHeader = "Time,root.db_expr.d.k1,root.db_expr.d.k2,root.db_expr.d.k3,"; String[] queryRetArray = new String[] { "1,2.0,null,null,", @@ -333,37 +333,37 @@ public void testExpression() { "12,24.0,0.5365729180004349,null," }; resultSetEqualTest( - "select k1, k2, k3 from root.sg_expr.d;", expectedQueryHeader, queryRetArray); + "select k1, k2, k3 from root.db_expr.d;", expectedQueryHeader, queryRetArray); } @Test public void testUsingUnMatchedAlignment() { String[] intoRetArray = new String[] { - "root.sg.d1.s1,root.sg_bk1.new_aligned_d.t1,10,", - "root.sg.d2.s1,root.sg_bk1.new_aligned_d.t2,7,", - "root.sg.d1.s2,root.sg_bk1.new_aligned_d.t3,9,", - "root.sg.d2.s2,root.sg_bk1.new_aligned_d.t4,8,", + "root.db.d1.s1,root.db_bk1.new_aligned_d.t1,10,", + "root.db.d2.s1,root.db_bk1.new_aligned_d.t2,7,", + "root.db.d1.s2,root.db_bk1.new_aligned_d.t3,9,", + "root.db.d2.s2,root.db_bk1.new_aligned_d.t4,8,", }; executeNonQuery( - "CREATE ALIGNED TIMESERIES root.sg_bk1.new_aligned_d(t1 INT32, t2 INT32, t3 FLOAT, t4 FLOAT);"); + "CREATE ALIGNED TIMESERIES root.db_bk1.new_aligned_d(t1 INT32, t2 INT32, t3 FLOAT, t4 FLOAT);"); // use matched interface (aligned == aligned) resultSetEqualTest( - "select s1, s2 into aligned root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;", + "select s1, s2 into aligned root.db_bk1.new_aligned_d(t1, t2, t3, t4) from root.db.*;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_bk1.new_aligned_d.t1,root.sg_bk1.new_aligned_d.t3,root.sg_bk1.new_aligned_d.t2,root.sg_bk1.new_aligned_d.t4,"; + "Time,root.db_bk1.new_aligned_d.t1,root.db_bk1.new_aligned_d.t3,root.db_bk1.new_aligned_d.t2,root.db_bk1.new_aligned_d.t4,"; resultSetEqualTest( - "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); + "select t1, t3, t2, t4 from root.db_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); // use unmatched interface (non-aligned != aligned) resultSetEqualTest( - "select s1, s2 into root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;", + "select s1, s2 into root.db_bk1.new_aligned_d(t1, t2, t3, t4) from root.db.*;", selectIntoHeader, intoRetArray); resultSetEqualTest( - "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); + "select t1, t3, t2, t4 from root.db_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); } // -------------------------------------- ALIGN BY DEVICE ------------------------------------- @@ -372,39 +372,39 @@ public void testUsingUnMatchedAlignment() { public void testRawDataQueryAlignByDevice1() { String[] intoRetArray = new String[] { - "root.sg.d1,s1,root.sg_abd_bk1.new_d.t1,10,", - "root.sg.d1,s2,root.sg_abd_bk1.new_d.t2,9,", - "root.sg.d2,s1,root.sg_abd_bk1.new_d.t3,7,", - "root.sg.d2,s2,root.sg_abd_bk1.new_d.t4,8,", + "root.db.d1,s1,root.db_abd_bk1.new_d.t1,10,", + "root.db.d1,s2,root.db_abd_bk1.new_d.t2,9,", + "root.db.d2,s1,root.db_abd_bk1.new_d.t3,7,", + "root.db.d2,s2,root.db_abd_bk1.new_d.t4,8,", }; resultSetEqualTest( - "select s1, s2 into root.sg_abd_bk1.new_d(t1, t2), root.sg_abd_bk1.new_d(t3, t4) from root.sg.* align by device;", + "select s1, s2 into root.db_abd_bk1.new_d(t1, t2), root.db_abd_bk1.new_d(t3, t4) from root.db.* align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_bk1.new_d.t1,root.sg_abd_bk1.new_d.t2,root.sg_abd_bk1.new_d.t3,root.sg_abd_bk1.new_d.t4,"; + "Time,root.db_abd_bk1.new_d.t1,root.db_abd_bk1.new_d.t2,root.db_abd_bk1.new_d.t3,root.db_abd_bk1.new_d.t4,"; resultSetEqualTest( - "select t1, t2, t3, t4 from root.sg_abd_bk1.new_d;", expectedQueryHeader, rawDataSet); + "select t1, t2, t3, t4 from root.db_abd_bk1.new_d;", expectedQueryHeader, rawDataSet); } @Test public void testRawDataQueryAlignByDevice2() { String[] intoRetArray = new String[] { - "root.sg.d1,s1,root.sg_abd_bk2.new_d1.s1,10,", - "root.sg.d1,s2,root.sg_abd_bk2.new_d1.s2,9,", - "root.sg.d2,s1,root.sg_abd_bk2.new_d2.s1,7,", - "root.sg.d2,s2,root.sg_abd_bk2.new_d2.s2,8," + "root.db.d1,s1,root.db_abd_bk2.new_d1.s1,10,", + "root.db.d1,s2,root.db_abd_bk2.new_d1.s2,9,", + "root.db.d2,s1,root.db_abd_bk2.new_d2.s1,7,", + "root.db.d2,s2,root.db_abd_bk2.new_d2.s2,8," }; resultSetEqualTest( - "select s1, s2 into root.sg_abd_bk2.new_${2}(::) from root.sg.* align by device;", + "select s1, s2 into root.db_abd_bk2.new_${2}(::) from root.db.* align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_bk2.new_d1.s1,root.sg_abd_bk2.new_d1.s2,root.sg_abd_bk2.new_d2.s1,root.sg_abd_bk2.new_d2.s2,"; + "Time,root.db_abd_bk2.new_d1.s1,root.db_abd_bk2.new_d1.s2,root.db_abd_bk2.new_d2.s1,root.db_abd_bk2.new_d2.s2,"; resultSetEqualTest( - "select new_d1.s1, new_d1.s2, new_d2.s1, new_d2.s2 from root.sg_abd_bk2;", + "select new_d1.s1, new_d1.s2, new_d2.s1, new_d2.s2 from root.db_abd_bk2;", expectedQueryHeader, rawDataSet); } @@ -413,18 +413,18 @@ public void testRawDataQueryAlignByDevice2() { public void testSamePathQueryAlignByDevice() { String[] intoRetArray = new String[] { - "root.sg.d1,s1,root.sg_abd_bk3.new_d1.t1,10,", - "root.sg.d1,s2,root.sg_abd_bk3.new_d1.t2,9,", - "root.sg.d1,s1,root.sg_abd_bk3.new_d1.t3,10,", - "root.sg.d1,s2,root.sg_abd_bk3.new_d1.t4,9," + "root.db.d1,s1,root.db_abd_bk3.new_d1.t1,10,", + "root.db.d1,s2,root.db_abd_bk3.new_d1.t2,9,", + "root.db.d1,s1,root.db_abd_bk3.new_d1.t3,10,", + "root.db.d1,s2,root.db_abd_bk3.new_d1.t4,9," }; resultSetEqualTest( - "select s1, s2, s1, s2 into root.sg_abd_bk3.new_d1(t1, t2, t3, t4) from root.sg.d1 align by device;", + "select s1, s2, s1, s2 into root.db_abd_bk3.new_d1(t1, t2, t3, t4) from root.db.d1 align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_bk3.new_d1.t1,root.sg_abd_bk3.new_d1.t2,root.sg_abd_bk3.new_d1.t3,root.sg_abd_bk3.new_d1.t4,"; + "Time,root.db_abd_bk3.new_d1.t1,root.db_abd_bk3.new_d1.t2,root.db_abd_bk3.new_d1.t3,root.db_abd_bk3.new_d1.t4,"; String[] queryRetArray = new String[] { "1,1,null,1,null,", @@ -441,13 +441,13 @@ public void testSamePathQueryAlignByDevice() { "12,12,12.0,12,12.0," }; resultSetEqualTest( - "select t1, t2, t3, t4 from root.sg_abd_bk3.new_d1;", expectedQueryHeader, queryRetArray); + "select t1, t2, t3, t4 from root.db_abd_bk3.new_d1;", expectedQueryHeader, queryRetArray); } @Test public void testEmptyQueryAlignByDevice() { resultSetEqualTest( - "select s1, s2 into root.sg_abd_bk4.new_${2}(::) from root.sg1.d1, root.sg1.d2 align by device;", + "select s1, s2 into root.db_abd_bk4.new_${2}(::) from root.db1.d1, root.db1.d2 align by device;", selectIntoAlignByDeviceHeader, new String[] {}); } @@ -455,23 +455,23 @@ public void testEmptyQueryAlignByDevice() { public void testAggregationQueryAlignByDevice1() { String[] intoRetArray = new String[] { - "root.sg.d1,count(s1),root.sg_abd_agg1.d1.count_s1,1,", - "root.sg.d1,last_value(s2),root.sg_abd_agg1.d1.last_value_s2,1,", - "root.sg.d2,count(s1),root.sg_abd_agg1.d2.count_s1,1,", - "root.sg.d2,last_value(s2),root.sg_abd_agg1.d2.last_value_s2,1," + "root.db.d1,count(s1),root.db_abd_agg1.d1.count_s1,1,", + "root.db.d1,last_value(s2),root.db_abd_agg1.d1.last_value_s2,1,", + "root.db.d2,count(s1),root.db_abd_agg1.d2.count_s1,1,", + "root.db.d2,last_value(s2),root.db_abd_agg1.d2.last_value_s2,1," }; resultSetEqualTest( "select count(s1), last_value(s2) " - + "into root.sg_abd_agg1.${2}(count_s1, last_value_s2) " - + "from root.sg.* align by device;", + + "into root.db_abd_agg1.${2}(count_s1, last_value_s2) " + + "from root.db.* align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_agg1.d1.count_s1,root.sg_abd_agg1.d2.count_s1," - + "root.sg_abd_agg1.d1.last_value_s2,root.sg_abd_agg1.d2.last_value_s2,"; + "Time,root.db_abd_agg1.d1.count_s1,root.db_abd_agg1.d2.count_s1," + + "root.db_abd_agg1.d1.last_value_s2,root.db_abd_agg1.d2.last_value_s2,"; String[] queryRetArray = new String[] {"0,10,7,12.0,11.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_abd_agg1.d1, root.sg_abd_agg1.d2;", + "select count_s1, last_value_s2 from root.db_abd_agg1.d1, root.db_abd_agg1.d2;", expectedQueryHeader, queryRetArray); } @@ -480,24 +480,24 @@ public void testAggregationQueryAlignByDevice1() { public void testAggregationQueryAlignByDevice2() { String[] intoRetArray = new String[] { - "root.sg.d1,count(s1),root.sg_abd_agg2.d1.count_s1,4,", - "root.sg.d1,last_value(s2),root.sg_abd_agg2.d1.last_value_s2,4,", - "root.sg.d2,count(s1),root.sg_abd_agg2.d2.count_s1,4,", - "root.sg.d2,last_value(s2),root.sg_abd_agg2.d2.last_value_s2,4," + "root.db.d1,count(s1),root.db_abd_agg2.d1.count_s1,4,", + "root.db.d1,last_value(s2),root.db_abd_agg2.d1.last_value_s2,4,", + "root.db.d2,count(s1),root.db_abd_agg2.d2.count_s1,4,", + "root.db.d2,last_value(s2),root.db_abd_agg2.d2.last_value_s2,4," }; resultSetEqualTest( "select count(s1), last_value(s2) " - + "into aligned root.sg_abd_agg2.${2}(count_s1, last_value_s2) " - + "from root.sg.* group by ([1, 13), 3ms) align by device;", + + "into aligned root.db_abd_agg2.${2}(count_s1, last_value_s2) " + + "from root.db.* group by ([1, 13), 3ms) align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_agg2.d1.count_s1,root.sg_abd_agg2.d2.count_s1," - + "root.sg_abd_agg2.d1.last_value_s2,root.sg_abd_agg2.d2.last_value_s2,"; + "Time,root.db_abd_agg2.d1.count_s1,root.db_abd_agg2.d2.count_s1," + + "root.db_abd_agg2.d1.last_value_s2,root.db_abd_agg2.d2.last_value_s2,"; String[] queryRetArray = new String[] {"1,3,2,3.0,2.0,", "4,2,1,6.0,6.0,", "7,2,2,9.0,8.0,", "10,3,2,12.0,11.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_abd_agg2.d1, root.sg_abd_agg2.d2;", + "select count_s1, last_value_s2 from root.db_abd_agg2.d1, root.db_abd_agg2.d2;", expectedQueryHeader, queryRetArray); } @@ -506,22 +506,22 @@ public void testAggregationQueryAlignByDevice2() { public void testExpressionAlignByDevice() { String[] intoRetArray = new String[] { - "root.sg.d1,s1 + s2,root.sg_abd_expr.d1.k1,7,", - "root.sg.d1,-sin(s1),root.sg_abd_expr.d1.k2,10,", - "root.sg.d1,top_k(s2, \"k\"=\"3\"),root.sg_abd_expr.d1.k3,3,", - "root.sg.d2,s1 + s2,root.sg_abd_expr.d2.k1,4,", - "root.sg.d2,-sin(s1),root.sg_abd_expr.d2.k2,7,", - "root.sg.d2,top_k(s2, \"k\"=\"3\"),root.sg_abd_expr.d2.k3,3,", + "root.db.d1,s1 + s2,root.db_abd_expr.d1.k1,7,", + "root.db.d1,-sin(s1),root.db_abd_expr.d1.k2,10,", + "root.db.d1,top_k(s2, \"k\"=\"3\"),root.db_abd_expr.d1.k3,3,", + "root.db.d2,s1 + s2,root.db_abd_expr.d2.k1,4,", + "root.db.d2,-sin(s1),root.db_abd_expr.d2.k2,7,", + "root.db.d2,top_k(s2, \"k\"=\"3\"),root.db_abd_expr.d2.k3,3,", }; resultSetEqualTest( "select s1 + s2, -sin(s1), top_k(s2,'k'='3') " - + "into root.sg_abd_expr.::(k1, k2, k3) from root.sg.* align by device;", + + "into root.db_abd_expr.::(k1, k2, k3) from root.db.* align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_expr.d1.k1,root.sg_abd_expr.d2.k1,root.sg_abd_expr.d1.k2," - + "root.sg_abd_expr.d2.k2,root.sg_abd_expr.d1.k3,root.sg_abd_expr.d2.k3,"; + "Time,root.db_abd_expr.d1.k1,root.db_abd_expr.d2.k1,root.db_abd_expr.d1.k2," + + "root.db_abd_expr.d2.k2,root.db_abd_expr.d1.k3,root.db_abd_expr.d2.k3,"; String[] queryRetArray = new String[] { "1,null,2.0,-0.8414709848078965,-0.8414709848078965,null,null,", @@ -538,24 +538,24 @@ public void testExpressionAlignByDevice() { "12,24.0,null,0.5365729180004349,0.5365729180004349,12.0,null," }; resultSetEqualTest( - "select k1, k2, k3 from root.sg_abd_expr.*;", expectedQueryHeader, queryRetArray); + "select k1, k2, k3 from root.db_abd_expr.*;", expectedQueryHeader, queryRetArray); } @Test public void testExpressionAlignByDevice2() { String[] intoRetArray = new String[] { - "root.sg.d1,avg(s1),root.agg_expr.d1.avg_s1,1,", - "root.sg.d1,sum(s1) + sum(s1),root.agg_expr.d1.sum_s1_add_s1,1,", - "root.sg.d1,count(s2),root.agg_expr.d1.count_s2,1,", - "root.sg.d2,avg(s1),root.agg_expr.d2.avg_s1,1,", - "root.sg.d2,sum(s1) + sum(s1),root.agg_expr.d2.sum_s1_add_s1,1,", - "root.sg.d2,count(s2),root.agg_expr.d2.count_s2,1,", + "root.db.d1,avg(s1),root.agg_expr.d1.avg_s1,1,", + "root.db.d1,sum(s1) + sum(s1),root.agg_expr.d1.sum_s1_add_s1,1,", + "root.db.d1,count(s2),root.agg_expr.d1.count_s2,1,", + "root.db.d2,avg(s1),root.agg_expr.d2.avg_s1,1,", + "root.db.d2,sum(s1) + sum(s1),root.agg_expr.d2.sum_s1_add_s1,1,", + "root.db.d2,count(s2),root.agg_expr.d2.count_s2,1,", }; resultSetEqualTest( "select avg(s1), sum(s1) + sum(s1), count(s2)" + " into root.agg_expr.${2}(avg_s1, sum_s1_add_s1, count_s2)" - + " from root.sg.d1, root.sg.d2 align by device;", + + " from root.db.d1, root.db.d2 align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = @@ -575,19 +575,19 @@ public void testExpressionAlignByDevice2() { public void testAliasAlignByDevice() { String[] intoRetArray = new String[] { - "root.sg.d1,s1,root.sg_abd_alias.d1.k1,10,", + "root.db.d1,s1,root.db_abd_alias.d1.k1,10,", }; resultSetEqualTest( - "select s1 as k1 " + "into root.sg_abd_alias.d1(::) from root.sg.d1 align by device;", + "select s1 as k1 " + "into root.db_abd_alias.d1(::) from root.db.d1 align by device;", selectIntoAlignByDeviceHeader, intoRetArray); intoRetArray = new String[] { - "k1,root.sg_abd_alias.d2.k1,10,", + "k1,root.db_abd_alias.d2.k1,10,", }; resultSetEqualTest( - "select s1 as k1 " + "into root.sg_abd_alias.d2(::) from root.sg.d1;", + "select s1 as k1 " + "into root.db_abd_alias.d2(::) from root.db.d1;", selectIntoHeader, intoRetArray); } @@ -599,14 +599,14 @@ public void testPermission1() throws SQLException { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { adminStmt.execute("CREATE USER tempuser1 'temppw1123456'"); - adminStmt.execute("GRANT WRITE_DATA on root.sg_bk.** TO USER tempuser1;"); + adminStmt.execute("GRANT WRITE_DATA on root.db_bk.** TO USER tempuser1;"); ResultSet resultSet; try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser1", "temppw1123456"); Statement userStmt = userCon.createStatement()) { userStmt.executeQuery( - "select s1, s2 into root.sg_bk.new_d(t1, t2, t3, t4) from root.sg.*;"); - resultSet = userStmt.executeQuery("select * from root.sg_bk.new_d"); + "select s1, s2 into root.db_bk.new_d(t1, t2, t3, t4) from root.db.*;"); + resultSet = userStmt.executeQuery("select * from root.db_bk.new_d"); Assert.assertEquals(resultSet.next(), false); } catch (SQLException e) { Assert.assertTrue( @@ -622,12 +622,12 @@ public void testPermission2() throws SQLException { try (Connection adminCon = EnvFactory.getEnv().getConnection(); Statement adminStmt = adminCon.createStatement()) { adminStmt.execute("CREATE USER tempuser2 'temppw2123456'"); - adminStmt.execute("GRANT WRITE_DATA on root.sg.** TO USER tempuser2;"); + adminStmt.execute("GRANT WRITE_DATA on root.db.** TO USER tempuser2;"); try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser2", "temppw2123456"); Statement userStmt = userCon.createStatement()) { userStmt.executeQuery( - "select s1, s2 into root.sg_bk.new_d(t1, t2, t3, t4) from root.sg.*;"); + "select s1, s2 into root.db_bk.new_d(t1, t2, t3, t4) from root.db.*;"); fail("No exception!"); } catch (SQLException e) { Assert.assertTrue( @@ -644,112 +644,112 @@ public void testPermission2() throws SQLException { public void testDataTypeIncompatible() { // test INT32 assertTestFail( - "select s_int32 into root.sg_type.d_1(s_boolean) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.sg_type.d_0.s_int32[INT32])."); + "select s_int32 into root.db_type.d_1(s_boolean) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.db_type.d_0.s_int32[INT32])."); assertTestFail( - "select s_int32 into root.sg_type.d_1(s_text) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.sg_type.d_0.s_int32[INT32])."); + "select s_int32 into root.db_type.d_1(s_text) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.db_type.d_0.s_int32[INT32])."); // test INT64 assertTestFail( - "select s_int64 into root.sg_type.d_1(s_int32) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.sg_type.d_0.s_int64[INT64])."); + "select s_int64 into root.db_type.d_1(s_int32) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.db_type.d_0.s_int64[INT64])."); assertTestFail( - "select s_int64 into root.sg_type.d_1(s_float) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.sg_type.d_0.s_int64[INT64])."); + "select s_int64 into root.db_type.d_1(s_float) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.db_type.d_0.s_int64[INT64])."); assertTestFail( - "select s_int64 into root.sg_type.d_1(s_boolean) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.sg_type.d_0.s_int64[INT64])."); + "select s_int64 into root.db_type.d_1(s_boolean) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.db_type.d_0.s_int64[INT64])."); assertTestFail( - "select s_int64 into root.sg_type.d_1(s_text) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.sg_type.d_0.s_int64[INT64])."); + "select s_int64 into root.db_type.d_1(s_text) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.db_type.d_0.s_int64[INT64])."); // test FLOAT assertTestFail( - "select s_float into root.sg_type.d_1(s_int32) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.sg_type.d_0.s_float[FLOAT])."); + "select s_float into root.db_type.d_1(s_int32) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.db_type.d_0.s_float[FLOAT])."); assertTestFail( - "select s_float into root.sg_type.d_1(s_int64) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.sg_type.d_0.s_float[FLOAT])."); + "select s_float into root.db_type.d_1(s_int64) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.db_type.d_0.s_float[FLOAT])."); assertTestFail( - "select s_float into root.sg_type.d_1(s_boolean) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.sg_type.d_0.s_float[FLOAT])."); + "select s_float into root.db_type.d_1(s_boolean) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.db_type.d_0.s_float[FLOAT])."); assertTestFail( - "select s_float into root.sg_type.d_1(s_text) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.sg_type.d_0.s_float[FLOAT])."); + "select s_float into root.db_type.d_1(s_text) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.db_type.d_0.s_float[FLOAT])."); // test DOUBLE assertTestFail( - "select s_double into root.sg_type.d_1(s_int32) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.sg_type.d_0.s_double[DOUBLE])."); + "select s_double into root.db_type.d_1(s_int32) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.db_type.d_0.s_double[DOUBLE])."); assertTestFail( - "select s_double into root.sg_type.d_1(s_int64) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.sg_type.d_0.s_double[DOUBLE])."); + "select s_double into root.db_type.d_1(s_int64) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.db_type.d_0.s_double[DOUBLE])."); assertTestFail( - "select s_double into root.sg_type.d_1(s_float) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.sg_type.d_0.s_double[DOUBLE])."); + "select s_double into root.db_type.d_1(s_float) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.db_type.d_0.s_double[DOUBLE])."); assertTestFail( - "select s_double into root.sg_type.d_1(s_boolean) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.sg_type.d_0.s_double[DOUBLE])."); + "select s_double into root.db_type.d_1(s_boolean) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.db_type.d_0.s_double[DOUBLE])."); assertTestFail( - "select s_double into root.sg_type.d_1(s_text) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.sg_type.d_0.s_double[DOUBLE])."); + "select s_double into root.db_type.d_1(s_text) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.db_type.d_0.s_double[DOUBLE])."); // test BOOLEAN assertTestFail( - "select s_boolean into root.sg_type.d_1(s_int32) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.sg_type.d_0.s_boolean[BOOLEAN])."); + "select s_boolean into root.db_type.d_1(s_int32) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.db_type.d_0.s_boolean[BOOLEAN])."); assertTestFail( - "select s_boolean into root.sg_type.d_1(s_int64) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.sg_type.d_0.s_boolean[BOOLEAN])."); + "select s_boolean into root.db_type.d_1(s_int64) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.db_type.d_0.s_boolean[BOOLEAN])."); assertTestFail( - "select s_boolean into root.sg_type.d_1(s_float) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.sg_type.d_0.s_boolean[BOOLEAN])."); + "select s_boolean into root.db_type.d_1(s_float) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.db_type.d_0.s_boolean[BOOLEAN])."); assertTestFail( - "select s_boolean into root.sg_type.d_1(s_double) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_double[DOUBLE]) is not compatible with the data type of source column (root.sg_type.d_0.s_boolean[BOOLEAN])."); + "select s_boolean into root.db_type.d_1(s_double) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_double[DOUBLE]) is not compatible with the data type of source column (root.db_type.d_0.s_boolean[BOOLEAN])."); assertTestFail( - "select s_boolean into root.sg_type.d_1(s_text) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.sg_type.d_0.s_boolean[BOOLEAN])."); + "select s_boolean into root.db_type.d_1(s_text) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_text[TEXT]) is not compatible with the data type of source column (root.db_type.d_0.s_boolean[BOOLEAN])."); // test TEXT assertTestFail( - "select s_text into root.sg_type.d_1(s_int32) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.sg_type.d_0.s_text[TEXT])."); + "select s_text into root.db_type.d_1(s_int32) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int32[INT32]) is not compatible with the data type of source column (root.db_type.d_0.s_text[TEXT])."); assertTestFail( - "select s_text into root.sg_type.d_1(s_int64) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.sg_type.d_0.s_text[TEXT])."); + "select s_text into root.db_type.d_1(s_int64) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_int64[INT64]) is not compatible with the data type of source column (root.db_type.d_0.s_text[TEXT])."); assertTestFail( - "select s_text into root.sg_type.d_1(s_float) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.sg_type.d_0.s_text[TEXT])."); + "select s_text into root.db_type.d_1(s_float) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_float[FLOAT]) is not compatible with the data type of source column (root.db_type.d_0.s_text[TEXT])."); assertTestFail( - "select s_text into root.sg_type.d_1(s_double) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_double[DOUBLE]) is not compatible with the data type of source column (root.sg_type.d_0.s_text[TEXT])."); + "select s_text into root.db_type.d_1(s_double) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_double[DOUBLE]) is not compatible with the data type of source column (root.db_type.d_0.s_text[TEXT])."); assertTestFail( - "select s_text into root.sg_type.d_1(s_boolean) from root.sg_type.d_0;", - "The data type of target path (root.sg_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.sg_type.d_0.s_text[TEXT])."); + "select s_text into root.db_type.d_1(s_boolean) from root.db_type.d_0;", + "The data type of target path (root.db_type.d_1.s_boolean[BOOLEAN]) is not compatible with the data type of source column (root.db_type.d_0.s_text[TEXT])."); } @Test public void testDataTypeAutoCast() { String[] intoRetArray = new String[] { - "root.sg_type.d_0.s_int32,root.sg_type.d_1.s_int64,12,", - "root.sg_type.d_0.s_int32,root.sg_type.d_1.s_float,12,", - "root.sg_type.d_0.s_int32,root.sg_type.d_1.s_double,12,", - "root.sg_type.d_0.s_int64,root.sg_type.d_2.s_double,12,", - "root.sg_type.d_0.s_float,root.sg_type.d_3.s_double,12,", + "root.db_type.d_0.s_int32,root.db_type.d_1.s_int64,12,", + "root.db_type.d_0.s_int32,root.db_type.d_1.s_float,12,", + "root.db_type.d_0.s_int32,root.db_type.d_1.s_double,12,", + "root.db_type.d_0.s_int64,root.db_type.d_2.s_double,12,", + "root.db_type.d_0.s_float,root.db_type.d_3.s_double,12,", }; resultSetEqualTest( "select s_int32, s_int32, s_int32, s_int64, s_float " - + " into root.sg_type.d_1(s_int64, s_float, s_double), root.sg_type.d_2(s_double), root.sg_type.d_3(s_double) " - + " from root.sg_type.d_0;", + + " into root.db_type.d_1(s_int64, s_float, s_double), root.db_type.d_2(s_double), root.db_type.d_3(s_double) " + + " from root.db_type.d_0;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_type.d_1.s_int64,root.sg_type.d_1.s_float,root.sg_type.d_1.s_double," - + "root.sg_type.d_2.s_double,root.sg_type.d_3.s_double,"; + "Time,root.db_type.d_1.s_int64,root.db_type.d_1.s_float,root.db_type.d_1.s_double," + + "root.db_type.d_2.s_double,root.db_type.d_3.s_double,"; String[] queryRetArray = new String[] { "0,0,0.0,0.0,0.0,0.0,", @@ -766,7 +766,7 @@ public void testDataTypeAutoCast() { "11,11,11.0,11.0,11.0,11.0," }; resultSetEqualTest( - "select d_1.s_int64, d_1.s_float, d_1.s_double, d_2.s_double, d_3.s_double from root.sg_type;", + "select d_1.s_int64, d_1.s_float, d_1.s_double, d_2.s_double, d_3.s_double from root.db_type;", expectedQueryHeader, queryRetArray); } @@ -813,23 +813,23 @@ public void testNewDataType() { public void testRemoveBackQuote() { String[] intoRetArray = new String[] { - "count(root.sg.d1.s1),root.sg_agg1.d1.count_s1,1,", - "last_value(root.sg.d1.s2),root.sg_agg1.d1.last_value_s2,1,", - "count(root.sg.d2.s1),root.sg_agg1.d2.count_s1,1,", - "last_value(root.sg.d2.s2),root.sg_agg1.d2.last_value_s2,1," + "count(root.db.d1.s1),root.db_agg1.d1.count_s1,1,", + "last_value(root.db.d1.s2),root.db_agg1.d1.last_value_s2,1,", + "count(root.db.d2.s1),root.db_agg1.d2.count_s1,1,", + "last_value(root.db.d2.s2),root.db_agg1.d2.last_value_s2,1," }; resultSetEqualTest( "select count(d1.s1), last_value(d1.s2), count(d2.s1), last_value(d2.s2) " - + "into root.sg_agg1.`d1`(`count_s1`, last_value_s2), aligned root.sg_agg1.d2(count_s1, last_value_s2) " - + "from root.sg;", + + "into root.db_agg1.`d1`(`count_s1`, last_value_s2), aligned root.db_agg1.d2(count_s1, last_value_s2) " + + "from root.db;", selectIntoHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_agg1.d1.count_s1,root.sg_agg1.d2.count_s1,root.sg_agg1.d1.last_value_s2,root.sg_agg1.d2.last_value_s2,"; + "Time,root.db_agg1.d1.count_s1,root.db_agg1.d2.count_s1,root.db_agg1.d1.last_value_s2,root.db_agg1.d2.last_value_s2,"; String[] queryRetArray = new String[] {"0,10,7,12.0,11.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_agg1.d1, root.sg_agg1.d2;", + "select count_s1, last_value_s2 from root.db_agg1.d1, root.db_agg1.d2;", expectedQueryHeader, queryRetArray); } @@ -838,21 +838,21 @@ public void testRemoveBackQuote() { public void testRemoveBackQuoteAlignByDevice() { String[] intoRetArray = new String[] { - "root.sg.d1,count(s1),root.sg_abd_agg1.d1.count_s1,1,", - "root.sg.d1,last_value(s2),root.sg_abd_agg1.d1.last_value_s2,1," + "root.db.d1,count(s1),root.db_abd_agg1.d1.count_s1,1,", + "root.db.d1,last_value(s2),root.db_abd_agg1.d1.last_value_s2,1," }; resultSetEqualTest( "select count(s1), last_value(s2) " - + "into root.sg_abd_agg1.`d1`(`count_s1`, last_value_s2) " - + "from root.sg.d1 align by device;", + + "into root.db_abd_agg1.`d1`(`count_s1`, last_value_s2) " + + "from root.db.d1 align by device;", selectIntoAlignByDeviceHeader, intoRetArray); String expectedQueryHeader = - "Time,root.sg_abd_agg1.d1.count_s1," + "root.sg_abd_agg1.d1.last_value_s2,"; + "Time,root.db_abd_agg1.d1.count_s1," + "root.db_abd_agg1.d1.last_value_s2,"; String[] queryRetArray = new String[] {"0,10,12.0,"}; resultSetEqualTest( - "select count_s1, last_value_s2 from root.sg_abd_agg1.d1, root.sg_abd_agg1.d2;", + "select count_s1, last_value_s2 from root.db_abd_agg1.d1, root.db_abd_agg1.d2;", expectedQueryHeader, queryRetArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/specialwords/IoTDBSpecialWordsIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/specialwords/IoTDBSpecialWordsIT.java index 6ccc2d3272085..a25b5d057a093 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/specialwords/IoTDBSpecialWordsIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/specialwords/IoTDBSpecialWordsIT.java @@ -55,16 +55,16 @@ public void testDeviceId() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.deviceId.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("INSERT INTO root.sg1.deviceId(time, s1) values(1, 1)"); + "CREATE TIMESERIES root.db1.deviceId.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("INSERT INTO root.db1.deviceId(time, s1) values(1, 1)"); - try (ResultSet resultSet = statement.executeQuery("select s1 from root.sg1.deviceId")) { + try (ResultSet resultSet = statement.executeQuery("select s1 from root.db1.deviceId")) { int count = 0; while (resultSet.next()) { assertEquals("1", resultSet.getString("Time")); - assertEquals("1", resultSet.getString("root.sg1.deviceId.s1")); + assertEquals("1", resultSet.getString("root.db1.deviceId.s1")); count++; } assertEquals(1, count); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByConditionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByConditionIT.java index c327d6301d0fa..c108782d49dcb 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByConditionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByConditionIT.java @@ -47,65 +47,65 @@ public class IoTDBUDAFGroupByConditionIT { private static final String[] dataset = new String[] { - "CREATE DATABASE root.sg.beijing.car01", - "CREATE TIMESERIES root.sg.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "CREATE DATABASE root.db.beijing.car01", + "CREATE TIMESERIES root.db.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", "flush", - "CREATE DATABASE root.sg.beijing.car02", - "CREATE TIMESERIES root.sg.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "CREATE DATABASE root.db.beijing.car02", + "CREATE TIMESERIES root.db.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.soc WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(110000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(120000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(130000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(140000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(150000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(160000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(170000000, null, null, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(180000000, null, null, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", "flush" }; @@ -152,14 +152,14 @@ public void UDAFGroupByConditionNotIgnoreNullTest() { String sqlWithEndTime = "SELECT __endTime, max_time(charging_status) - min_time(charging_status), " + "count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY CONDITION(charging_status=1, KEEP>=2, ignoreNull=false)"; UDAFGroupByConditionITChecker(sqlWithEndTime, expected, true); String sqlWithoutEndTime = "SELECT max_time(charging_status) - min_time(charging_status), " + "count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY CONDITION(charging_status=1, KEEP>=2, ignoreNull=false)"; UDAFGroupByConditionITChecker(sqlWithoutEndTime, expected, false); } @@ -175,7 +175,7 @@ public void UDAFGroupByConditionIgnoreNullTest() { String sql = "SELECT max_time(charging_status) - min_time(charging_status), " + "count_udaf(vehicle_status),last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY CONDITION(charging_status=1, KEEP>=2, ignoreNull=true)"; UDAFGroupByConditionITChecker(sql, expected, false); } @@ -189,7 +189,7 @@ public void UDAFGroupByConditionKeepTest() { String sql = "SELECT __endTime, max_time(charging_status) - min_time(charging_status)," + "count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 GROUP BY CONDITION(soc>=24.0, KEEP<=15)"; + + "FROM root.db.beijing.car01 GROUP BY CONDITION(soc>=24.0, KEEP<=15)"; UDAFGroupByConditionITChecker(sql, expected, true); } @@ -197,10 +197,10 @@ public void UDAFGroupByConditionKeepTest() { public void UDAFGroupByConditionTestAlignByDevice() { String[][] expected = new String[][] { - {"1", "root.sg.beijing.car01", "2", "1.0", "2", "16.0"}, - {"5", "root.sg.beijing.car01", "2500000000", "2499999995.0", "9", "100.0"}, - {"1", "root.sg.beijing.car02", "2", "1.0", "2", "16.0"}, - {"5", "root.sg.beijing.car02", "2500000000", "2499999995.0", "9", "100.0"}, + {"1", "root.db.beijing.car01", "2", "1.0", "2", "16.0"}, + {"5", "root.db.beijing.car01", "2500000000", "2499999995.0", "9", "100.0"}, + {"1", "root.db.beijing.car02", "2", "1.0", "2", "16.0"}, + {"5", "root.db.beijing.car02", "2500000000", "2499999995.0", "9", "100.0"}, }; String sqlWithEndTime = @@ -232,7 +232,7 @@ public void UDAFGroupByConditionTestWithHaving() { String sqlWithEndTime = "SELECT __endTime,max_time(charging_status) - min_time(charging_status)," + "count_udaf(vehicle_status),last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY CONDITION(charging_status=1, KEEP>=2, ignoreNull=false) " + "HAVING last_value(soc)>50"; UDAFGroupByConditionITChecker(sqlWithEndTime, expected, true); @@ -240,16 +240,16 @@ public void UDAFGroupByConditionTestWithHaving() { String sqlWithoutEndTime = "SELECT max_time(charging_status) - min_time(charging_status)," + "count_udaf(vehicle_status),last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY CONDITION(charging_status=1, KEEP>=2, ignoreNull=false) " + "HAVING last_value(soc)>50"; UDAFGroupByConditionITChecker(sqlWithoutEndTime, expected, false); } private void UDAFGroupByConditionITChecker(String sql, String[][] expected, boolean hasEndTime) { - String targetSeries1 = "root.sg.beijing.car01.charging_status"; - String targetSeries2 = "root.sg.beijing.car01.vehicle_status"; - String targetSeries3 = "root.sg.beijing.car01.soc"; + String targetSeries1 = "root.db.beijing.car01.charging_status"; + String targetSeries2 = "root.db.beijing.car01.vehicle_status"; + String targetSeries3 = "root.db.beijing.car01.soc"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByCountIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByCountIT.java index 839aea68522ee..efe01d6adc36c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByCountIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByCountIT.java @@ -43,55 +43,55 @@ public class IoTDBUDAFGroupByCountIT { private static final String[] dataset = new String[] { - "CREATE DATABASE root.sg.beijing.car01", - "CREATE TIMESERIES root.sg.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.soc WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", - "INSERT INTO root.sg.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", + "CREATE DATABASE root.db.beijing.car01", + "CREATE TIMESERIES root.db.beijing.car01.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.soc WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car01.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "INSERT INTO root.db.beijing.car01(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", "flush", - "CREATE DATABASE root.sg.beijing.car02", - "CREATE TIMESERIES root.sg.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.soc WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", - "INSERT INTO root.sg.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", + "CREATE DATABASE root.db.beijing.car02", + "CREATE TIMESERIES root.db.beijing.car02.charging_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.soc WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.beijing.car02.vehicle_status WITH DATATYPE=INT32, ENCODING=PLAIN", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1, 1, 14, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2, 1, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(3, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(4, 0, 16, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(5, 1, 18, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(6, 1, 24, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(7, 1, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(8, null, 36, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(9, 1, 45, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(10, 1, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1100000000, null, 60, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1200000000, null, 0, 0)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(1900000000, 1, 55, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2000000000, 1, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2100000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2200000000, null, 70, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2300000000, null, 69, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2400000000, 1, 80, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2500000000, 1, 100, 1)", + "INSERT INTO root.db.beijing.car02(timestamp, charging_status, soc, vehicle_status) values(2600000000, 0, 101, 1)", "flush" }; @@ -134,13 +134,13 @@ public void UDAFGroupByCountTest() { }; String sqlWithoutEndTime = "SELECT sum_udaf(charging_status), count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY COUNT(charging_status, 5)"; UDAFGroupByCountITChecker(sqlWithoutEndTime, expected, false); String sqlWithEndTime = "SELECT __endTime, sum_udaf(charging_status), count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY COUNT(charging_status, 5)"; UDAFGroupByCountITChecker(sqlWithEndTime, expected, true); } @@ -153,7 +153,7 @@ public void UDAFGroupByCountWithHavingTest() { }; String sql = "SELECT sum_udaf(charging_status), count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY COUNT(charging_status, 2) " + "HAVING sum_udaf(charging_status) < 2"; UDAFGroupByCountITChecker(sql, expected, false); @@ -170,13 +170,13 @@ public void UDAFGroupByCountIgnoreNullTest() { String sqlWithoutEndTime = "SELECT sum_udaf(charging_status), count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY COUNT(charging_status, 5, ignoreNull=false)"; UDAFGroupByCountITChecker(sqlWithoutEndTime, expected, false); String sqlWithEndTime = "SELECT __endTime, sum_udaf(charging_status), count_udaf(vehicle_status), last_value(soc) " - + "FROM root.sg.beijing.car01 " + + "FROM root.db.beijing.car01 " + "GROUP BY COUNT(charging_status, 5, ignoreNull=false)"; UDAFGroupByCountITChecker(sqlWithEndTime, expected, true); } @@ -184,20 +184,20 @@ public void UDAFGroupByCountIgnoreNullTest() { @Test public void UDAFGroupByCountAlignByDeviceTest() { String[][] expected = { - {"1", "root.sg.beijing.car01", "2", "2.0", "2", "16"}, - {"3", "root.sg.beijing.car01", "4", "0.0", "2", "16"}, - {"5", "root.sg.beijing.car01", "6", "2.0", "2", "24"}, - {"7", "root.sg.beijing.car01", "9", "2.0", "2", "45"}, - {"10", "root.sg.beijing.car01", "1900000000", "2.0", "2", "55"}, - {"2000000000", "root.sg.beijing.car01", "2400000000", "2.0", "2", "80"}, - {"2500000000", "root.sg.beijing.car01", "2600000000", "1.0", "2", "101"}, - {"1", "root.sg.beijing.car02", "2", "2.0", "2", "16"}, - {"3", "root.sg.beijing.car02", "4", "0.0", "2", "16"}, - {"5", "root.sg.beijing.car02", "6", "2.0", "2", "24"}, - {"7", "root.sg.beijing.car02", "9", "2.0", "2", "45"}, - {"10", "root.sg.beijing.car02", "1900000000", "2.0", "2", "55"}, - {"2000000000", "root.sg.beijing.car02", "2400000000", "2.0", "2", "80"}, - {"2500000000", "root.sg.beijing.car02", "2600000000", "1.0", "2", "101"}, + {"1", "root.db.beijing.car01", "2", "2.0", "2", "16"}, + {"3", "root.db.beijing.car01", "4", "0.0", "2", "16"}, + {"5", "root.db.beijing.car01", "6", "2.0", "2", "24"}, + {"7", "root.db.beijing.car01", "9", "2.0", "2", "45"}, + {"10", "root.db.beijing.car01", "1900000000", "2.0", "2", "55"}, + {"2000000000", "root.db.beijing.car01", "2400000000", "2.0", "2", "80"}, + {"2500000000", "root.db.beijing.car01", "2600000000", "1.0", "2", "101"}, + {"1", "root.db.beijing.car02", "2", "2.0", "2", "16"}, + {"3", "root.db.beijing.car02", "4", "0.0", "2", "16"}, + {"5", "root.db.beijing.car02", "6", "2.0", "2", "24"}, + {"7", "root.db.beijing.car02", "9", "2.0", "2", "45"}, + {"10", "root.db.beijing.car02", "1900000000", "2.0", "2", "55"}, + {"2000000000", "root.db.beijing.car02", "2400000000", "2.0", "2", "80"}, + {"2500000000", "root.db.beijing.car02", "2600000000", "1.0", "2", "101"}, }; String sqlWithoutEndTime = @@ -216,9 +216,9 @@ public void UDAFGroupByCountAlignByDeviceTest() { } private void UDAFGroupByCountITChecker(String sql, String[][] expected, boolean hasEndTime) { - String targetSeries1 = "root.sg.beijing.car01.charging_status"; - String targetSeries2 = "root.sg.beijing.car01.vehicle_status"; - String targetSeries3 = "root.sg.beijing.car01.soc"; + String targetSeries1 = "root.db.beijing.car01.charging_status"; + String targetSeries2 = "root.db.beijing.car01.vehicle_status"; + String targetSeries3 = "root.db.beijing.car01.soc"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByLevelIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByLevelIT.java index 35447f295747f..4263cd47474dd 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByLevelIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFGroupByLevelIT.java @@ -42,25 +42,25 @@ public class IoTDBUDAFGroupByLevelIT { private static final String[] dataset = new String[] { - "CREATE DATABASE root.sg1", - "CREATE DATABASE root.sg2", - "CREATE TIMESERIES root.sg1.d1.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d2.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg1.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d1.status WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg2.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "INSERT INTO root.sg1.d1(timestamp,status) values(150,true)", - "INSERT INTO root.sg1.d1(timestamp,status,temperature) values(200,false,20.71)", - "INSERT INTO root.sg1.d1(timestamp,status,temperature) values(600,false,71.12)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(200,false,42.66)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(300,false,46.77)", - "INSERT INTO root.sg1.d2(timestamp,status,temperature) values(700,true,62.15)", - "INSERT INTO root.sg2.d1(timestamp,status,temperature) values(100,3,88.24)", - "INSERT INTO root.sg2.d1(timestamp,status,temperature) values(500,5,125.5)", - "INSERT INTO root.sg2.d2(timestamp,temperature) values(200,105.5)", - "INSERT INTO root.sg2.d2(timestamp,temperature) values(800,61.22)", + "CREATE DATABASE root.db1", + "CREATE DATABASE root.db2", + "CREATE TIMESERIES root.db1.d1.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d2.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db1.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d1.status WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d1.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db2.d2.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "INSERT INTO root.db1.d1(timestamp,status) values(150,true)", + "INSERT INTO root.db1.d1(timestamp,status,temperature) values(200,false,20.71)", + "INSERT INTO root.db1.d1(timestamp,status,temperature) values(600,false,71.12)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(200,false,42.66)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(300,false,46.77)", + "INSERT INTO root.db1.d2(timestamp,status,temperature) values(700,true,62.15)", + "INSERT INTO root.db2.d1(timestamp,status,temperature) values(100,3,88.24)", + "INSERT INTO root.db2.d1(timestamp,status,temperature) values(500,5,125.5)", + "INSERT INTO root.db2.d2(timestamp,temperature) values(200,105.5)", + "INSERT INTO root.db2.d2(timestamp,temperature) values(800,61.22)", }; @BeforeClass @@ -97,9 +97,9 @@ public void UDAFGroupByLevelTest() throws Exception { int cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "SELECT avg_udaf(temperature) " + "FROM root.sg1.* " + "GROUP BY LEVEL=1")) { + "SELECT avg_udaf(temperature) " + "FROM root.db1.* " + "GROUP BY LEVEL=1")) { while (resultSet.next()) { - String actual = resultSet.getString(avgUDAF("root.sg1.*.temperature")); + String actual = resultSet.getString(avgUDAF("root.db1.*.temperature")); Assert.assertEquals(expected[cnt], Double.parseDouble(actual), DELTA); cnt++; } @@ -107,9 +107,9 @@ public void UDAFGroupByLevelTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( - "SELECT avg_udaf(temperature) " + "FROM root.sg2.* " + "GROUP BY LEVEL=1")) { + "SELECT avg_udaf(temperature) " + "FROM root.db2.* " + "GROUP BY LEVEL=1")) { while (resultSet.next()) { - String actual = resultSet.getString(avgUDAF("root.sg2.*.temperature")); + String actual = resultSet.getString(avgUDAF("root.db2.*.temperature")); Assert.assertEquals(expected[cnt], Double.parseDouble(actual), DELTA); cnt++; } @@ -127,10 +127,10 @@ public void UDAFGroupByLevelTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( - "SELECT avg_udaf(temperature) " + "FROM root.sg1.* " + "GROUP BY LEVEL=1, 2")) { + "SELECT avg_udaf(temperature) " + "FROM root.db1.* " + "GROUP BY LEVEL=1, 2")) { while (resultSet.next()) { - String actual1 = resultSet.getString(avgUDAF("root.sg1.d1.temperature")); - String actual2 = resultSet.getString(avgUDAF("root.sg1.d2.temperature")); + String actual1 = resultSet.getString(avgUDAF("root.db1.d1.temperature")); + String actual2 = resultSet.getString(avgUDAF("root.db1.d2.temperature")); Assert.assertEquals(expected[cnt++], Double.parseDouble(actual1), DELTA); Assert.assertEquals(expected[cnt++], Double.parseDouble(actual2), DELTA); } @@ -140,9 +140,9 @@ public void UDAFGroupByLevelTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 1 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 1 * - *

Result is [root.sg.*.temperature] + *

Result is [root.db.*.temperature] */ @Test public void UDAFGroupByLevelWithAliasTest() throws Exception { @@ -154,7 +154,7 @@ public void UDAFGroupByLevelWithAliasTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( "SELECT count_udaf(temperature) AS ct " - + "FROM root.sg1.d1, root.sg1.d2 " + + "FROM root.db1.d1, root.db1.d2 " + "GROUP BY LEVEL=1")) { while (resultSet.next()) { String actual = resultSet.getString("ct"); @@ -166,7 +166,7 @@ public void UDAFGroupByLevelWithAliasTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "SELECT count_udaf(temperature) AS ct " + "FROM root.sg1.* " + "GROUP BY LEVEL=1")) { + "SELECT count_udaf(temperature) AS ct " + "FROM root.db1.* " + "GROUP BY LEVEL=1")) { while (resultSet.next()) { String actual = resultSet.getString("ct"); Assert.assertEquals(expected[cnt], actual); @@ -177,7 +177,7 @@ public void UDAFGroupByLevelWithAliasTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 2 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 2 * *

Result is [root.*.d1.temperature, root.*.d2.temperature] */ @@ -186,21 +186,21 @@ public void UDAFGroupByLevelWithAliasFailTest() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( - "SELECT count_udaf(temperature) AS ct " + "FROM root.sg1.* " + "GROUP BY LEVEL=2"); + "SELECT count_udaf(temperature) AS ct " + "FROM root.db1.* " + "GROUP BY LEVEL=2"); fail("No exception thrown"); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("can only be matched with one")); } } - // Different from above at: root.sg1.*.temperature is just one ResultColumn + // Different from above at: root.db1.*.temperature is just one ResultColumn @Test public void UDAFGroupByLevelWithAliasFailTest2() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( "SELECT count_udaf(temperature) AS ct " - + "FROM root.sg1.d1, root.sg2.d2 " + + "FROM root.db1.d1, root.db2.d2 " + "GROUP BY LEVEL=2"); fail("No exception thrown"); } catch (Exception e) { @@ -215,7 +215,7 @@ public void UDAFGroupByLevelWithAliasFailTest3() { Statement statement = connection.createStatement()) { statement.executeQuery( "SELECT count_udaf(temperature) AS ct, count_udaf(temperature) AS ct2 " - + "FROM root.sg1.d1 " + + "FROM root.db1.d1 " + "GROUP BY LEVEL=2"); fail("No exception thrown"); } catch (Exception e) { @@ -233,7 +233,7 @@ public void UDAFGroupByLevelWithAliasWithTimeIntervalTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( "SELECT count_udaf(temperature) AS ct " - + "FROM root.sg1.d1, root.sg1.d2 " + + "FROM root.db1.d1, root.db1.d2 " + "GROUP BY ([0, 600), 100ms), LEVEL=1")) { while (resultSet.next()) { String actual = @@ -246,7 +246,7 @@ public void UDAFGroupByLevelWithAliasWithTimeIntervalTest() throws Exception { cnt = 0; try (ResultSet resultSet = statement.executeQuery( - "SELECT count_udaf(temperature) AS ct FROM root.sg1.* " + "SELECT count_udaf(temperature) AS ct FROM root.db1.* " + "GROUP BY ([0, 600), 100ms), LEVEL=1")) { while (resultSet.next()) { String actual = @@ -259,7 +259,7 @@ public void UDAFGroupByLevelWithAliasWithTimeIntervalTest() throws Exception { } /** - * [root.sg.d1.temperature, root.sg.d2.temperature] with level = 2 + * [root.db.d1.temperature, root.db.d2.temperature] with level = 2 * *

Result is [root.*.d1.temperature, root.*.d2.temperature] */ @@ -269,7 +269,7 @@ public void UDAFGroupByLevelWithAliasWithTimeIntervalFailTest() { Statement statement = connection.createStatement()) { statement.executeQuery( "SELECT count_udaf(temperature) AS ct " - + "FROM root.sg1.* " + + "FROM root.db1.* " + "GROUP BY ([0, 600), 100ms), LEVEL=2"); fail(); } catch (Exception e) { @@ -277,14 +277,14 @@ public void UDAFGroupByLevelWithAliasWithTimeIntervalFailTest() { } } - // Different from above at: root.sg1.*.temperature is just one ResultColumn + // Different from above at: root.db1.*.temperature is just one ResultColumn @Test public void UDAFGroupByLevelWithAliasWithTimeIntervalFailTest2() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.executeQuery( "SELECT count_udaf(temperature) AS ct " - + "FROM root.sg1.d1, root.sg1.d2 " + + "FROM root.db1.d1, root.db1.d2 " + "GROUP BY ([0, 600), 100ms), level=2"); fail(); } catch (Exception e) { @@ -307,9 +307,9 @@ public void UDAFGroupByLevelSLimitTest() throws Exception { + "SLIMIT 2")) { while (resultSet.next()) { String actual = - resultSet.getString(countUDAF("root.sg1.*.temperature")) + resultSet.getString(countUDAF("root.db1.*.temperature")) + "," - + resultSet.getString(countUDAF("root.sg2.*.temperature")); + + resultSet.getString(countUDAF("root.db2.*.temperature")); Assert.assertEquals(expected[cnt], actual); cnt++; } @@ -323,9 +323,9 @@ public void UDAFGroupByLevelSLimitTest() throws Exception { + "SLIMIT 2 SOFFSET 1")) { while (resultSet.next()) { String actual = - resultSet.getString(countUDAF("root.sg2.*.temperature")) + resultSet.getString(countUDAF("root.db2.*.temperature")) + "," - + resultSet.getString(countUDAF("root.sg1.*.status")); + + resultSet.getString(countUDAF("root.db1.*.status")); Assert.assertEquals(expected[cnt], actual); cnt++; } @@ -338,7 +338,7 @@ public void UDAFGroupByLevelSLimitTest() throws Exception { + "GROUP BY level=1,2 " + "slimit 1 soffset 4")) { while (resultSet.next()) { - String actual = resultSet.getString(countUDAF("root.sg1.d1.status")); + String actual = resultSet.getString(countUDAF("root.db1.d1.status")); Assert.assertEquals(expected[cnt], actual); cnt++; } @@ -368,10 +368,10 @@ public void UDAFGroupByLevelWithTimeIntervalTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( "SELECT sum_udaf(temperature) " - + "FROM root.sg2.* " + + "FROM root.db2.* " + "GROUP BY ([0, 600), 100ms), LEVEL=1")) { while (resultSet.next()) { - String actual = "" + resultSet.getString(sumUDAF("root.sg2.*.temperature")); + String actual = "" + resultSet.getString(sumUDAF("root.db2.*.temperature")); Assert.assertEquals(expected1[cnt], actual); cnt++; } @@ -385,13 +385,13 @@ public void UDAFGroupByLevelWithTimeIntervalTest() throws Exception { + "GROUP BY ([0, 600), 100ms), LEVEL=1")) { while (resultSet.next()) { String actual = - resultSet.getString(maxTime("root.sg1.*.temperature")) + resultSet.getString(maxTime("root.db1.*.temperature")) + "," - + resultSet.getString(maxTime("root.sg2.*.temperature")) + + resultSet.getString(maxTime("root.db2.*.temperature")) + "," - + resultSet.getString(avgUDAF("root.sg1.*.temperature")) + + resultSet.getString(avgUDAF("root.db1.*.temperature")) + "," - + resultSet.getString(avgUDAF("root.sg2.*.temperature")); + + resultSet.getString(avgUDAF("root.db2.*.temperature")); Assert.assertEquals(expected2[cnt], actual); cnt++; } @@ -412,10 +412,10 @@ public void UDAFGroupByMultiLevelWithTimeIntervalTest() throws Exception { try (ResultSet resultSet = statement.executeQuery( "SELECT sum_udaf(temperature) " - + "FROM root.sg2.* " + + "FROM root.db2.* " + "GROUP BY ([0, 600), 100ms), LEVEL=0,1")) { while (resultSet.next()) { - String actual = "" + resultSet.getString(sumUDAF("root.sg2.*.temperature")); + String actual = "" + resultSet.getString(sumUDAF("root.db2.*.temperature")); Assert.assertEquals(expected[cnt], actual); cnt++; } @@ -445,9 +445,9 @@ public void UDAFGroupByMultiLevelWithTimeIntervalSLimitTest() throws Exception { String actual = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(countUDAF("root.sg1.*.temperature")) + + resultSet.getString(countUDAF("root.db1.*.temperature")) + "," - + resultSet.getString(countUDAF("root.sg2.*.temperature")); + + resultSet.getString(countUDAF("root.db2.*.temperature")); Assert.assertEquals(expected[cnt], actual); cnt++; } @@ -464,9 +464,9 @@ public void UDAFGroupByMultiLevelWithTimeIntervalSLimitTest() throws Exception { String actual = resultSet.getString(TIMESTAMP_STR) + "," - + resultSet.getString(countUDAF("root.sg2.*.temperature")) + + resultSet.getString(countUDAF("root.db2.*.temperature")) + "," - + resultSet.getString(countUDAF("root.sg1.*.status")); + + resultSet.getString(countUDAF("root.db1.*.status")); Assert.assertEquals(expected2[cnt], actual); cnt++; } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFMiscIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFMiscIT.java index fc4bbf588157a..33073173d1808 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFMiscIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFMiscIT.java @@ -45,12 +45,12 @@ public class IoTDBUDAFMiscIT { private static final String[] dataset = new String[] { - "CREATE DATABASE root.sg;", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN;", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN;", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES(1, 1, 1);", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES(2, 2, 2);", - "INSERT INTO root.sg.d1(time, s1, s2) VALUES(3, 3, 3);", + "CREATE DATABASE root.db;", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN;", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=INT32, ENCODING=PLAIN;", + "INSERT INTO root.db.d1(time, s1, s2) VALUES(1, 1, 1);", + "INSERT INTO root.db.d1(time, s1, s2) VALUES(2, 2, 2);", + "INSERT INTO root.db.d1(time, s1, s2) VALUES(3, 3, 3);", "flush;", }; @@ -92,7 +92,7 @@ public void mixUDAFAndUDTFTest() throws Exception { int count = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT udaf(udf(s1, s2)) AS res " + "FROM root.sg.d1 ")) { + statement.executeQuery("SELECT udaf(udf(s1, s2)) AS res " + "FROM root.db.d1 ")) { while (resultSet.next()) { String actual = resultSet.getString("res"); Assert.assertEquals(expected[count], actual); @@ -112,7 +112,7 @@ public void UDAFAsOperandTest() throws Exception { int count = 0; try (ResultSet resultSet = - statement.executeQuery("SELECT udaf(s1) + udaf(s2) AS res " + "FROM root.sg.d1 ")) { + statement.executeQuery("SELECT udaf(s1) + udaf(s2) AS res " + "FROM root.db.d1 ")) { while (resultSet.next()) { String actual = resultSet.getString("res"); Assert.assertEquals(expected[count], actual); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFNormalQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFNormalQueryIT.java index 82f61879dd774..15428a56d3e0b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFNormalQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFNormalQueryIT.java @@ -76,16 +76,16 @@ public class IoTDBUDAFNormalQueryIT { }; private static final String[] dataSet3 = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", - "insert into root.sg.d1(timestamp,s1) values(5,5)", - "insert into root.sg.d1(timestamp,s1) values(12,12)", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=RLE", + "insert into root.db.d1(timestamp,s1) values(5,5)", + "insert into root.db.d1(timestamp,s1) values(12,12)", "flush", - "insert into root.sg.d1(timestamp,s1) values(15,15)", - "insert into root.sg.d1(timestamp,s1) values(25,25)", + "insert into root.db.d1(timestamp,s1) values(15,15)", + "insert into root.db.d1(timestamp,s1) values(25,25)", "flush", - "insert into root.sg.d1(timestamp,s1) values(1,111)", - "insert into root.sg.d1(timestamp,s1) values(20,200)", + "insert into root.db.d1(timestamp,s1) values(1,111)", + "insert into root.db.d1(timestamp,s1) values(20,200)", "flush", }; private final String d0s0 = "root.vehicle.d0.s0"; diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFOrderByIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFOrderByIT.java index 46f0a35a249ee..9cee6bec0f29d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFOrderByIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udaf/IoTDBUDAFOrderByIT.java @@ -50,48 +50,48 @@ public class IoTDBUDAFOrderByIT { protected static final String[] dataset = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d.bigNum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d.floatNum WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)", + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d.bigNum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d.floatNum WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)", "flush", - "CREATE TIMESERIES root.sg.d2.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.bigNum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.floatNum WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d2(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)", + "CREATE TIMESERIES root.db.d2.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.bigNum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.floatNum WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d2(timestamp,num,bigNum,floatNum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)", }; @BeforeClass @@ -124,7 +124,7 @@ private static void registerUDAF() { @Test public void UDAFOrderByWithAggregationTest() { String sql = - "SELECT avg_udaf(num) FROM root.sg.d " + "SELECT avg_udaf(num) FROM root.db.d " + "GROUP BY SESSION(10000ms) " + "ORDER BY avg_udaf(num) DESC"; double[][] ans = new double[][] {{15.0}, {13.0}, {13.0}, {11.0}, {6.4}, {4.6}}; @@ -153,7 +153,7 @@ public void UDAFOrderByWithAggregationTest() { public void UDAFOrderByWithAggregationTest2() { String sql = "SELECT avg_udaf(num) " - + "FROM root.sg.d " + + "FROM root.db.d " + "GROUP BY SESSION(10000ms) " + "ORDER BY max_value(floatNum)"; double[][] ans = @@ -190,7 +190,7 @@ public void UDAFOrderByWithAggregationTest2() { public void UDAFOrderByWithAggregationTest3() { String sql = "SELECT avg_udaf(num) " - + "FROM root.sg.d GROUP BY SESSION(10000ms) " + + "FROM root.db.d GROUP BY SESSION(10000ms) " + "ORDER BY avg_udaf(num) DESC, max_value(floatNum)"; double[] ans = new double[] {15.0, 13.0, 13.0, 11.0, 6.4, 4.6}; long[] times = @@ -218,7 +218,7 @@ public void UDAFOrderByWithAggregationTest3() { public void UDAFOrderByWithAggregationTest4() { String sql = "SELECT avg_udaf(num) + avg_udaf(floatNum) " - + "FROM root.sg.d " + + "FROM root.db.d " + "GROUP BY SESSION(10000ms) " + "ORDER BY avg_udaf(num) + avg_udaf(floatNum)"; double[][] ans = @@ -272,18 +272,18 @@ public void UDAFOrderByWithAggregationAlignByDeviceTest() { }; String[] device = new String[] { - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d", - "root.sg.d2", - "root.sg.d2", - "root.sg.d", - "root.sg.d2" + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d", + "root.db.d2", + "root.db.d2", + "root.db.d", + "root.db.d2" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -426,8 +426,8 @@ public void UDAFOrderByWithAggregationAlignByDeviceTest12() { } private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { - String device = "root.sg.d"; - if (!deviceAsc) device = "root.sg.d2"; + String device = "root.db.d"; + if (!deviceAsc) device = "root.db.d2"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { @@ -451,10 +451,10 @@ private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { assertEquals(device, actualDeviceList.get(0)); assertEquals(Double.parseDouble(value.toString()), actualValueList.get(0), 1); // Change device name - if (device.equals("root.sg.d")) { - device = "root.sg.d2"; + if (device.equals("root.db.d")) { + device = "root.db.d2"; } else { - device = "root.sg.d"; + device = "root.db.d"; } assertEquals(device, actualDeviceList.get(1)); assertEquals(Double.parseDouble(value.toString()), actualValueList.get(1), 1); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFIntermediateBlockSerdeIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFIntermediateBlockSerdeIT.java index 06464debd9ea6..7e7b6d65874ee 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFIntermediateBlockSerdeIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFIntermediateBlockSerdeIT.java @@ -39,12 +39,12 @@ public class IoTDBUDFIntermediateBlockSerdeIT { private static final String[] SQLs = new String[] { - "insert into root.sg.d1(time, s1) values (1,1)", - "insert into root.sg.d1(time, s1) values (2,2)", - "insert into root.sg.d1(time, s1) values (3,3)", - "insert into root.sg.d1(time, s1) values (4,4)", - "insert into root.sg.d1(time, s1) values (5,5)", - "insert into root.sg.d1(time, s1) values (6,6)" + "insert into root.db.d1(time, s1) values (1,1)", + "insert into root.db.d1(time, s1) values (2,2)", + "insert into root.db.d1(time, s1) values (3,3)", + "insert into root.db.d1(time, s1) values (4,4)", + "insert into root.db.d1(time, s1) values (5,5)", + "insert into root.db.d1(time, s1) values (6,6)" }; @BeforeClass @@ -63,11 +63,11 @@ public static void tearDown() throws Exception { public void testM4() { String[] expectedHeader = new String[] { - TIMESTAMP_STR, "EQUAL_SIZE_BUCKET_M4_SAMPLE(root.sg.d1.s1, \"proportion\"=\"1\")" + TIMESTAMP_STR, "EQUAL_SIZE_BUCKET_M4_SAMPLE(root.db.d1.s1, \"proportion\"=\"1\")" }; String[] retArray = new String[] {"1,1.0,", "2,2.0,", "3,3.0,", "4,4.0,", "5,5.0,", "6,6.0,"}; resultSetEqualWithDescOrderTest( - "select EQUAL_SIZE_BUCKET_M4_SAMPLE(s1,'proportion'='1') from root.sg.d1", + "select EQUAL_SIZE_BUCKET_M4_SAMPLE(s1,'proportion'='1') from root.db.d1", expectedHeader, retArray); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFWindowQuery2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFWindowQuery2IT.java index c2a2db78b36d9..42ed5cecc5622 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFWindowQuery2IT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFWindowQuery2IT.java @@ -65,9 +65,9 @@ public static void tearDown() throws Exception { private static void createTimeSeries() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE DATABASE root.db"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 with datatype=INT32,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -77,16 +77,16 @@ private static void generateData() { // SessionWindow try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (1, 1, 1)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (2, 2, 2)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (3, 3, 3)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (9, 9, 9)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (5, 5, 5)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (12, 12, 12)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (14, 14, 14)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (18, 18, 18)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (21, 21, 21)"); - statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (24, 24, 24)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (1, 1, 1)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (2, 2, 2)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (3, 3, 3)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (9, 9, 9)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (5, 5, 5)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (12, 12, 12)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (14, 14, 14)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (18, 18, 18)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (21, 21, 21)"); + statement.execute("INSERT INTO root.db.d1(time, s1, s2) VALUES (24, 24, 24)"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -129,7 +129,7 @@ private void testSessionTimeWindowSS( if (displayBegin == null) { sql = String.format( - "select window_start_end(s1, '%s'='%s', '%s'='%s') from root.sg.d1", + "select window_start_end(s1, '%s'='%s', '%s'='%s') from root.db.d1", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_SESSION, UDFTestConstant.SESSION_GAP_KEY, @@ -137,7 +137,7 @@ private void testSessionTimeWindowSS( } else { sql = String.format( - "select window_start_end(s1, '%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s') from root.sg.d1", + "select window_start_end(s1, '%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s') from root.db.d1", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_SESSION, UDFTestConstant.DISPLAY_WINDOW_BEGIN_KEY, @@ -171,12 +171,12 @@ private void testStateWindowSS( if (delta == null) { sql = String.format( - "select window_start_end(%s, '%s'='%s') from root.sg.d1", + "select window_start_end(%s, '%s'='%s') from root.db.d1", "s2", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_STATE); } else { sql = String.format( - "select window_start_end(%s, '%s'='%s', '%s'='%s') from root.sg.d1", + "select window_start_end(%s, '%s'='%s', '%s'='%s') from root.db.d1", "s2", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_STATE, @@ -186,7 +186,7 @@ private void testStateWindowSS( } else { sql = String.format( - "select window_start_end(%s, '%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s') from root.sg.d1", + "select window_start_end(%s, '%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s') from root.db.d1", "s2", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_STATE, diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFAlignByTimeQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFAlignByTimeQueryIT.java index e3955df58d604..eb0e2a74b449b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFAlignByTimeQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFAlignByTimeQueryIT.java @@ -86,8 +86,8 @@ private static void createTimeSeries() { statement.execute("CREATE TIMESERIES root.vehicle.d4.s1 with datatype=INT32,encoding=PLAIN"); statement.execute("CREATE TIMESERIES root.vehicle.d4.s2 with datatype=INT32,encoding=PLAIN"); // create aligned timeseries - statement.execute(("CREATE DATABASE root.sg1")); - statement.execute("CREATE ALIGNED TIMESERIES root.sg1(s1 INT32, s2 INT32)"); + statement.execute(("CREATE DATABASE root.db1")); + statement.execute("CREATE ALIGNED TIMESERIES root.db1(s1 INT32, s2 INT32)"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -116,7 +116,7 @@ private static void generateData() { "insert into root.vehicle.d4(timestamp,s1) values(%d,%d)", 2 * i, 3 * i))); statement.execute( (String.format( - "insert into root.sg1(timestamp,s1, s2) aligned values(%d,%d,%d)", i, i, i))); + "insert into root.db1(timestamp,s1, s2) aligned values(%d,%d,%d)", i, i, i))); } } catch (SQLException throwable) { fail(throwable.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java index 61de72829ccc9..32f97e990160c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java @@ -55,12 +55,12 @@ public class IoTDBUDTFBuiltinFunctionIT { private static final String[] INSERTION_SQLS = { - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s8, s10, s11, s12) values (0, 0, 0, 0, 0, true, '0', 0, 0, '2024-01-01', 0, '0')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s10, s11, s12) values (2, 1, 1, 1, 1, false, '1', 1, '2024-01-02', 1, '1')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s10, s11, s12) values (4, 2, 2, 2, 2, false, '2', 2, '2024-01-03', 2, '2')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (6, 3, 3, 3, 3, true, '3', 3, '2024-01-04', 3, '3')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (8, 4, 4, 4, 4, true, '4', 4, '2024-01-05', 4, '4')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (10000000000, 5, 5, 5, 5, false, '5', 5, '2024-01-06', 5, '5')" + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s8, s10, s11, s12) values (0, 0, 0, 0, 0, true, '0', 0, 0, '2024-01-01', 0, '0')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s10, s11, s12) values (2, 1, 1, 1, 1, false, '1', 1, '2024-01-02', 1, '1')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s10, s11, s12) values (4, 2, 2, 2, 2, false, '2', 2, '2024-01-03', 2, '2')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (6, 3, 3, 3, 3, true, '3', 3, '2024-01-04', 3, '3')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (8, 4, 4, 4, 4, true, '4', 4, '2024-01-05', 4, '4')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s8, s10, s11, s12) values (10000000000, 5, 5, 5, 5, false, '5', 5, '2024-01-06', 5, '5')" }; private static final double E = 0.0001; @@ -80,16 +80,16 @@ public static void tearDown() throws Exception { private static void createTimeSeries() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg"); - statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s3 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s4 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s5 with datatype=BOOLEAN,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s6 with datatype=TEXT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s10 with datatype=DATE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s11 with datatype=TIMESTAMP,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d1.s12 with datatype=STRING,encoding=PLAIN"); + statement.execute("CREATE DATABASE root.db"); + statement.execute("CREATE TIMESERIES root.db.d1.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s3 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s4 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s5 with datatype=BOOLEAN,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s6 with datatype=TEXT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s10 with datatype=DATE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s11 with datatype=TIMESTAMP,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d1.s12 with datatype=STRING,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -141,7 +141,7 @@ private void testMathFunction(String functionName, MathFunctionProxy functionPro ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4) from root.sg.d1", + "select %s(s1), %s(s2), %s(s3), %s(s4) from root.db.d1", functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); @@ -160,7 +160,7 @@ private void testMathFunction(String functionName, MathFunctionProxy functionPro resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4) from root.sg.d1 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4) from root.db.d1 align by device", functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); @@ -191,7 +191,7 @@ public void testSelectorFunctions() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s), %s(s10, %s), %s(s11, %s), %s(s12, %s) from root.sg.d1", + "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s), %s(s10, %s), %s(s11, %s), %s(s12, %s) from root.db.d1", TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K)); int columnCount = resultSet.getMetaData().getColumnCount(); @@ -214,7 +214,7 @@ public void testSelectorFunctions() { resultSet = statement.executeQuery( String.format( - "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s) from root.sg.d1 align by device", + "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s) from root.db.d1 align by device", TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K, TOP_K, K)); columnCount = resultSet.getMetaData().getColumnCount(); @@ -236,7 +236,7 @@ public void testSelectorFunctions() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s), %s(s10, %s), %s(s11, %s), %s(s12, %s) from root.sg.d1", + "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s), %s(s10, %s), %s(s11, %s), %s(s12, %s) from root.db.d1", BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K)); @@ -260,7 +260,7 @@ public void testSelectorFunctions() { resultSet = statement.executeQuery( String.format( - "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s) from root.sg.d1 align by device", + "select %s(s1, %s), %s(s2, %s), %s(s3, %s), %s(s4, %s), %s(s6, %s) from root.db.d1 align by device", BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K, BOTTOM_K, K)); columnCount = resultSet.getMetaData().getColumnCount(); @@ -284,7 +284,7 @@ public void testStringProcessingFunctions() { Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery( - "select STRING_CONTAINS(s6, 's'='0'), STRING_MATCHES(s6, 'regex'='\\d') from root.sg.d1"); + "select STRING_CONTAINS(s6, 's'='0'), STRING_MATCHES(s6, 'regex'='\\d') from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 2, columnCount); @@ -302,7 +302,7 @@ public void testStringProcessingFunctions() { resultSet = statement.executeQuery( - "select STRING_CONTAINS(s6, 's'='0'), STRING_MATCHES(s6, 'regex'='\\d') from root.sg.d1 align by device"); + "select STRING_CONTAINS(s6, 's'='0'), STRING_MATCHES(s6, 'regex'='\\d') from root.db.d1 align by device"); columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(2 + 2, columnCount); @@ -338,7 +338,7 @@ public void testVariationTrendCalculationFunction( ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4) from root.sg.d1", + "select %s(s1), %s(s2), %s(s3), %s(s4) from root.db.d1", functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); @@ -359,7 +359,7 @@ public void testVariationTrendCalculationFunction( resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4) from root.sg.d1 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4) from root.db.d1 align by device", functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); @@ -397,7 +397,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select s7, s8, const(s7, 'value'='1024', 'type'='INT64'), pi(s7, s7), e(s7, s8, s7, s8) from root.sg.d1")) { + "select s7, s8, const(s7, 'value'='1024', 'type'='INT64'), pi(s7, s7), e(s7, s8, s7, s8) from root.db.d1")) { assertEquals(1 + 5, resultSet.getMetaData().getColumnCount()); for (int i = 0; i < INSERTION_SQLS.length; ++i) { @@ -415,7 +415,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery( - "select s7, s8, const(s7, 'value'='1024', 'type'='INT64'), pi(s7, s7), e(s7, s8, s7, s8) from root.sg.d1 align by device")) { + "select s7, s8, const(s7, 'value'='1024', 'type'='INT64'), pi(s7, s7), e(s7, s8, s7, s8) from root.db.d1 align by device")) { assertEquals(2 + 5, resultSet.getMetaData().getColumnCount()); for (int i = 0; i < INSERTION_SQLS.length; ++i) { @@ -433,7 +433,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet ignored = - statement.executeQuery("select const(s7, 'value'='1024') from root.sg.d1")) { + statement.executeQuery("select const(s7, 'value'='1024') from root.db.d1")) { fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("attribute \"type\" is required but was not provided")); @@ -441,7 +441,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet ignored = - statement.executeQuery("select const(s8, 'type'='INT64') from root.sg.d1")) { + statement.executeQuery("select const(s8, 'type'='INT64') from root.db.d1")) { fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("attribute \"value\" is required but was not provided")); @@ -450,7 +450,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet ignored = statement.executeQuery( - "select const(s8, 'value'='1024', 'type'='long') from root.sg.d1")) { + "select const(s8, 'value'='1024', 'type'='long') from root.db.d1")) { fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("the given value type is not supported")); @@ -459,7 +459,7 @@ public void testConstantTimeSeriesGeneratingFunctions() { try (Statement statement = connection.createStatement(); ResultSet ignored = statement.executeQuery( - "select const(s8, 'value'='1024e', 'type'='INT64') from root.sg.d1")) { + "select const(s8, 'value'='1024e', 'type'='INT64') from root.db.d1")) { fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("java.lang.NumberFormatException")); @@ -483,7 +483,7 @@ public void testConversionFunction() { Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery( - "select cast(s1, 'type'='TEXT'), cast(s3, 'type'='FLOAT'), cast(s5, 'type'='INT32'), cast(s7, 'type'='DOUBLE') from root.sg.d1"); + "select cast(s1, 'type'='TEXT'), cast(s3, 'type'='FLOAT'), cast(s5, 'type'='INT32'), cast(s7, 'type'='DOUBLE') from root.db.d1"); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(5, columnCount); @@ -500,7 +500,7 @@ public void testConversionFunction() { resultSet = statement.executeQuery( - "select cast(s1, 'type'='TEXT'), cast(s3, 'type'='FLOAT'), cast(s5, 'type'='INT32'), cast(s7, 'type'='DOUBLE') from root.sg.d1 align by device"); + "select cast(s1, 'type'='TEXT'), cast(s3, 'type'='FLOAT'), cast(s5, 'type'='INT32'), cast(s7, 'type'='DOUBLE') from root.db.d1 align by device"); columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(6, columnCount); @@ -524,26 +524,26 @@ public void testConversionFunction() { public void testContinuouslySatisfies() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d2.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d2.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d2.s3 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d2.s4 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d2.s5 with datatype=BOOLEAN,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s3 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s4 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d2.s5 with datatype=BOOLEAN,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } // create timeseries with only 0,1 values String[] ZERO_ONE_SQL = { - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (0, 0, 0, 0, 0, false)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (1, 1, 1, 1, 1, true)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (2, 1, 1, 1, 1, true)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (3, 0, 0, 0, 0, false)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (4, 1, 1, 1, 1, true)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (5, 0, 0, 0, 0, false)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (6, 0, 0, 0, 0, false)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (7, 1, 1, 1, 1, true)", - "insert into root.sg.d2(time, s1, s2, s3, s4, s5) values (10000000000, 0, 0, 0, 0, false)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (0, 0, 0, 0, 0, false)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (1, 1, 1, 1, 1, true)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (2, 1, 1, 1, 1, true)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (3, 0, 0, 0, 0, false)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (4, 1, 1, 1, 1, true)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (5, 0, 0, 0, 0, false)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (6, 0, 0, 0, 0, false)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (7, 1, 1, 1, 1, true)", + "insert into root.db.d2(time, s1, s2, s3, s4, s5) values (10000000000, 0, 0, 0, 0, false)", }; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -565,7 +565,7 @@ public void testContinuouslySatisfies() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2", functionName, functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 5, columnCount); @@ -586,7 +586,7 @@ public void testContinuouslySatisfies() { resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2 align by device", functionName, functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(2 + 5, columnCount); @@ -617,7 +617,7 @@ public void testContinuouslySatisfies() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2", functionName, functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); @@ -639,7 +639,7 @@ public void testContinuouslySatisfies() { resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2 align by device", functionName, functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); @@ -671,7 +671,7 @@ public void testContinuouslySatisfies() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2", functionName, functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 5, columnCount); @@ -692,7 +692,7 @@ public void testContinuouslySatisfies() { resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2 align by device", functionName, functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(2 + 5, columnCount); @@ -723,7 +723,7 @@ public void testContinuouslySatisfies() { ResultSet resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2", functionName, functionName, functionName, functionName, functionName)); int columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(1 + 5, columnCount); @@ -744,7 +744,7 @@ public void testContinuouslySatisfies() { resultSet = statement.executeQuery( String.format( - "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.sg.d2 align by device", + "select %s(s1), %s(s2), %s(s3), %s(s4), %s(s5) from root.db.d2 align by device", functionName, functionName, functionName, functionName, functionName)); columnCount = resultSet.getMetaData().getColumnCount(); assertEquals(2 + 5, columnCount); @@ -776,7 +776,7 @@ public void testOnOffFunction() { statement.executeQuery( String.format( Locale.ENGLISH, - "select on_off(s1,'threshold'='%f'), on_off(s2,'threshold'='%f'), on_off(s3,'threshold'='%f'), on_off(s4,'threshold'='%f') from root.sg.d1", + "select on_off(s1,'threshold'='%f'), on_off(s2,'threshold'='%f'), on_off(s3,'threshold'='%f'), on_off(s4,'threshold'='%f') from root.db.d1", threshold, threshold, threshold, @@ -799,7 +799,7 @@ public void testOnOffFunction() { statement.executeQuery( String.format( Locale.ENGLISH, - "select on_off(s1,'threshold'='%f'), on_off(s2,'threshold'='%f'), on_off(s3,'threshold'='%f'), on_off(s4,'threshold'='%f') from root.sg.d1 align by device", + "select on_off(s1,'threshold'='%f'), on_off(s2,'threshold'='%f'), on_off(s3,'threshold'='%f'), on_off(s4,'threshold'='%f') from root.db.d1 align by device", threshold, threshold, threshold, @@ -837,7 +837,7 @@ public void testInRange() { String.format( Locale.ENGLISH, "select in_range(s1,'upper'='%f','lower'='%f'), in_range(s2,'upper'='%f','lower'='%f'), " - + "in_range(s3,'upper'='%f','lower'='%f'), in_range(s4,'upper'='%f','lower'='%f') from root.sg.d1", + + "in_range(s3,'upper'='%f','lower'='%f'), in_range(s4,'upper'='%f','lower'='%f') from root.db.d1", upper, lower, upper, @@ -865,7 +865,7 @@ public void testInRange() { String.format( Locale.ENGLISH, "select in_range(s1,'upper'='%f','lower'='%f'), in_range(s2,'upper'='%f','lower'='%f'), " - + "in_range(s3,'upper'='%f','lower'='%f'), in_range(s4,'upper'='%f','lower'='%f') from root.sg.d1 align by device", + + "in_range(s3,'upper'='%f','lower'='%f'), in_range(s4,'upper'='%f','lower'='%f') from root.db.d1 align by device", upper, lower, upper, @@ -897,14 +897,14 @@ public void testInRange() { public void testEqualBucketSampleForRandom() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d5.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d5.s1 with datatype=INT32,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } String[] SQL_FOR_SAMPLE_S1 = new String[100]; for (int i = 0; i < 100; i++) { SQL_FOR_SAMPLE_S1[i] = - String.format("insert into root.sg.d5(time, s1) values (%d, %d)", i, i); + String.format("insert into root.db.d5(time, s1) values (%d, %d)", i, i); } try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -923,7 +923,7 @@ public void testEqualBucketSampleForRandom() { statement.executeQuery( String.format( Locale.ENGLISH, - "select " + "%s(s1, 'proportion'='%f') from root.sg.d5", + "select " + "%s(s1, 'proportion'='%f') from root.db.d5", functionName, proportionValue)); int columnCount = resultSet.getMetaData().getColumnCount(); @@ -942,12 +942,12 @@ public void testEqualBucketSampleForRandom() { public void testEqualBucketSampleForAgg() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d4.s1 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d4.s2 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d4.s3 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d4.s4 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d4.s5 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d4.s6 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s1 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s2 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s3 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s4 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s5 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d4.s6 with datatype=DOUBLE,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -961,19 +961,19 @@ public void testEqualBucketSampleForAgg() { for (int i = 0; i < 100; i++) { SQL_FOR_SAMPLE_S1[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d4(time, s1) values (%d, %f)", i, i * 1.0); + Locale.ENGLISH, "insert into root.db.d4(time, s1) values (%d, %f)", i, i * 1.0); SQL_FOR_SAMPLE_S2[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d4(time, s2) values (%d, %f)", i, i * 1.0); + Locale.ENGLISH, "insert into root.db.d4(time, s2) values (%d, %f)", i, i * 1.0); SQL_FOR_SAMPLE_S3[i] = - String.format(Locale.ENGLISH, "insert into root.sg.d4(time, s3) values (%d, %d)", i, i); + String.format(Locale.ENGLISH, "insert into root.db.d4(time, s3) values (%d, %d)", i, i); SQL_FOR_SAMPLE_S4[i] = - String.format(Locale.ENGLISH, "insert into root.sg.d4(time, s4) values (%d, %d)", i, i); + String.format(Locale.ENGLISH, "insert into root.db.d4(time, s4) values (%d, %d)", i, i); SQL_FOR_SAMPLE_S5[i] = - String.format(Locale.ENGLISH, "insert into root.sg.d4(time, s5) values (%d, %d)", i, -i); + String.format(Locale.ENGLISH, "insert into root.db.d4(time, s5) values (%d, %d)", i, -i); SQL_FOR_SAMPLE_S6[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d4(time, s6) values (%d, %f)", i, i * 1.0); + Locale.ENGLISH, "insert into root.db.d4(time, s6) values (%d, %f)", i, i * 1.0); } float[] ANSWER1 = new float[] {4.5F, 14.5F, 24.5F, 34.5F, 44.5F, 54.5F, 64.5F, 74.5F, 84.5F, 94.5F}; @@ -1011,7 +1011,7 @@ public void testEqualBucketSampleForAgg() { + "%s(s4, 'type'='%s', 'proportion'='%f'), " + "%s(s5, 'type'='%s', 'proportion'='%f'), " + "%s(s6, 'type'='%s', 'proportion'='%f')" - + "from root.sg.d4", + + "from root.db.d4", functionName, proportionValue, functionName, @@ -1049,14 +1049,14 @@ public void testEqualBucketSampleForAgg() { public void testEqualBucketSampleForM4() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d3.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d3.s1 with datatype=INT32,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } String[] SQL_FOR_SAMPLE = new String[100]; for (int i = 0; i < 100; i++) { SQL_FOR_SAMPLE[i] = - String.format("insert into root.sg.d3(time, s1) values (%d, %d)", i, i + 1); + String.format("insert into root.db.d3(time, s1) values (%d, %d)", i, i + 1); } int[] ANSWER1 = new int[] {1, 2, 39, 40, 41, 42, 79, 80, 81, 82, 99, 100}; try (Connection connection = EnvFactory.getEnv().getConnection(); @@ -1077,7 +1077,7 @@ public void testEqualBucketSampleForM4() { statement.executeQuery( String.format( Locale.ENGLISH, - "select %s(s1, 'method'='%s', 'proportion'='%f') from root.sg.d3", + "select %s(s1, 'method'='%s', 'proportion'='%f') from root.db.d3", functionName, methodName, proportionValue)); @@ -1096,11 +1096,11 @@ public void testEqualBucketSampleForM4() { public void testEqualBucketSampleForOutlier() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d6.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d6.s2 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d6.s3 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d6.s4 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d6.s5 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d6.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d6.s2 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d6.s3 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d6.s4 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d6.s5 with datatype=FLOAT,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -1112,24 +1112,24 @@ public void testEqualBucketSampleForOutlier() { for (int i = 0; i < 100; i++) { SQL_FOR_SAMPLE_S1[i] = String.format( - "insert into root.sg.d6(time, s1) values (%d, %d)", + "insert into root.db.d6(time, s1) values (%d, %d)", i, i % 5 == 0 && i % 10 != 0 ? i + 100 : i); SQL_FOR_SAMPLE_S2[i] = String.format( - "insert into root.sg.d6(time, s2) values (%d, %d)", i, i % 10 == 6 ? i + 100 : i); + "insert into root.db.d6(time, s2) values (%d, %d)", i, i % 10 == 6 ? i + 100 : i); if (i % 10 == 9 || i % 20 == 0) { - SQL_FOR_SAMPLE_S2[i] = String.format("insert into root.sg.d6(time, s2) values (%d, 0)", i); + SQL_FOR_SAMPLE_S2[i] = String.format("insert into root.db.d6(time, s2) values (%d, 0)", i); } SQL_FOR_SAMPLE_S3[i] = String.format( - "insert into root.sg.d6(time, s3) values (%d, %d)", i, i % 10 == 7 ? i + 100 : i); + "insert into root.db.d6(time, s3) values (%d, %d)", i, i % 10 == 7 ? i + 100 : i); SQL_FOR_SAMPLE_S4[i] = String.format( - "insert into root.sg.d6(time, s4) values (%d, %d)", i, i % 10 == 8 ? i + 100 : i); + "insert into root.db.d6(time, s4) values (%d, %d)", i, i % 10 == 8 ? i + 100 : i); } for (int i = 0; i < 20; i++) { SQL_FOR_SAMPLE_S5[i] = - String.format("insert into root.sg.d6(time, s5) values (%d, %d)", i, i); + String.format("insert into root.db.d6(time, s5) values (%d, %d)", i, i); } int[] ANSWER1 = new int[] {105, 115, 125, 135, 145, 155, 165, 175, 185, 195}; long[] ANSWER2 = new long[] {106, 116, 126, 136, 146, 156, 166, 176, 186, 196}; @@ -1162,7 +1162,7 @@ public void testEqualBucketSampleForOutlier() { Locale.ENGLISH, "select " + "%s(s1, 'proportion'='%f', 'type'='%s', 'number'='%d') " - + "from root.sg.d6", + + "from root.db.d6", functionName, proportionValue, "avg", @@ -1180,7 +1180,7 @@ public void testEqualBucketSampleForOutlier() { Locale.ENGLISH, "select " + "%s(s2, 'proportion'='%f', 'type'='%s', 'number'='%d') " - + "from root.sg.d6", + + "from root.db.d6", functionName, proportionValue, "stendis", @@ -1198,7 +1198,7 @@ public void testEqualBucketSampleForOutlier() { Locale.ENGLISH, "select " + "%s(s3, 'proportion'='%f', 'type'='%s', 'number'='%d') " - + "from root.sg.d6", + + "from root.db.d6", functionName, proportionValue, "cos", @@ -1216,7 +1216,7 @@ public void testEqualBucketSampleForOutlier() { Locale.ENGLISH, "select " + "%s(s4, 'proportion'='%f', 'type'='%s', 'number'='%d') " - + "from root.sg.d6", + + "from root.db.d6", functionName, proportionValue, "prenextdis", @@ -1234,7 +1234,7 @@ public void testEqualBucketSampleForOutlier() { Locale.ENGLISH, "select " + "%s(s5, 'proportion'='%f', 'type'='%s', 'number'='%d') " - + "from root.sg.d6", + + "from root.db.d6", functionName, 0.5, "cos", @@ -1494,15 +1494,15 @@ private void test_M4_constantTimeSeries() { public void testUDTFJexl() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg.d7.s1 with datatype=INT32,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s2 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s3 with datatype=DOUBLE,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s4 with datatype=TEXT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s5 with datatype=BOOLEAN,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s6 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s7 with datatype=INT64,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s8 with datatype=FLOAT,encoding=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg.d7.s9 with datatype=TEXT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s1 with datatype=INT32,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s2 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s3 with datatype=DOUBLE,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s4 with datatype=TEXT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s5 with datatype=BOOLEAN,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s6 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s7 with datatype=INT64,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s8 with datatype=FLOAT,encoding=PLAIN"); + statement.execute("CREATE TIMESERIES root.db.d7.s9 with datatype=TEXT,encoding=PLAIN"); } catch (SQLException throwable) { fail(throwable.getMessage()); } @@ -1518,77 +1518,77 @@ public void testUDTFJexl() { for (int i = 0; i < 5; i++) { SQL_FOR_SAMPLE_1[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s1) values (%d, %d)", i, i + 1); + Locale.ENGLISH, "insert into root.db.d7(time, s1) values (%d, %d)", i, i + 1); SQL_FOR_SAMPLE_2[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s2) values (%d, %f)", i, i + 1.0); + Locale.ENGLISH, "insert into root.db.d7(time, s2) values (%d, %f)", i, i + 1.0); SQL_FOR_SAMPLE_3[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s3) values (%d, %f)", i, i + 1.0); + Locale.ENGLISH, "insert into root.db.d7(time, s3) values (%d, %f)", i, i + 1.0); SQL_FOR_SAMPLE_4[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s4) values (%d, '%s')", i, "string"); - SQL_FOR_SAMPLE_5[i] = String.format("insert into root.sg.d7(time, s5) values (%d, true)", i); + Locale.ENGLISH, "insert into root.db.d7(time, s4) values (%d, '%s')", i, "string"); + SQL_FOR_SAMPLE_5[i] = String.format("insert into root.db.d7(time, s5) values (%d, true)", i); SQL_FOR_SAMPLE_6[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s6) values (%d, %d)", i, i + 8); + Locale.ENGLISH, "insert into root.db.d7(time, s6) values (%d, %d)", i, i + 8); SQL_FOR_SAMPLE_7[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s7) values (%d, %d)", i, i + 1); + Locale.ENGLISH, "insert into root.db.d7(time, s7) values (%d, %d)", i, i + 1); SQL_FOR_SAMPLE_8[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s8) values (%d, %f)", i, i + 1.0); + Locale.ENGLISH, "insert into root.db.d7(time, s8) values (%d, %f)", i, i + 1.0); SQL_FOR_SAMPLE_9[i] = String.format( - Locale.ENGLISH, "insert into root.sg.d7(time, s9) values (%d, '%s')", i, "string"); + Locale.ENGLISH, "insert into root.db.d7(time, s9) values (%d, '%s')", i, "string"); } SQL_FOR_SAMPLE_1[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s1) values (%d, %d)", + "insert into root.db.d7(time, s1) values (%d, %d)", 10000000000L, 5 + 1); SQL_FOR_SAMPLE_2[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s2) values (%d, %f)", + "insert into root.db.d7(time, s2) values (%d, %f)", 10000000000L, 5 + 1.0); SQL_FOR_SAMPLE_3[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s3) values (%d, %f)", + "insert into root.db.d7(time, s3) values (%d, %f)", 10000000000L, 5 + 1.0); SQL_FOR_SAMPLE_4[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s4) values (%d, '%s')", + "insert into root.db.d7(time, s4) values (%d, '%s')", 10000000000L, "string"); - SQL_FOR_SAMPLE_5[5] = String.format("insert into root.sg.d7(time, s5) values (%d, true)", 5); + SQL_FOR_SAMPLE_5[5] = String.format("insert into root.db.d7(time, s5) values (%d, true)", 5); SQL_FOR_SAMPLE_6[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s6) values (%d, %d)", + "insert into root.db.d7(time, s6) values (%d, %d)", 10000000000L, 5 + 8); SQL_FOR_SAMPLE_7[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s7) values (%d, %d)", + "insert into root.db.d7(time, s7) values (%d, %d)", 10000000000L, 5 + 1); SQL_FOR_SAMPLE_8[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s8) values (%d, %f)", + "insert into root.db.d7(time, s8) values (%d, %f)", 10000000000L, 5 + 1.0); SQL_FOR_SAMPLE_9[5] = String.format( Locale.ENGLISH, - "insert into root.sg.d7(time, s9) values (%d, '%s')", + "insert into root.db.d7(time, s9) values (%d, '%s')", 10000000000L, "string"); double[] ANSWER1 = new double[] {2, 4, 6, 8, 10, 12}; @@ -1641,7 +1641,7 @@ public void testUDTFJexl() { + "%s(s7, s8, 'expr'='%s'), " + "%s(s4, s7, s1, 'expr'='%s'), " + "%s(s1, s7, s8, s5, 'expr'='%s') " - + "from root.sg.d7", + + "from root.db.d7", functionName, expr1, functionName, @@ -1687,7 +1687,7 @@ public void testUDTFJexl() { + "%s(s7, s8, 'expr'='%s'), " + "%s(s4, s7, s1, 'expr'='%s'), " + "%s(s1, s7, s8, s5, 'expr'='%s') " - + "from root.sg.d7 align by device", + + "from root.db.d7 align by device", functionName, expr1, functionName, diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFHybridQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFHybridQueryIT.java index 93e7a09bb51af..297c3fe0cbc6d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFHybridQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFHybridQueryIT.java @@ -198,7 +198,7 @@ public void testUserDefinedFunctionFillFunctionHybridQuery() { public void testLastUserDefinedFunctionQuery() { String sql = String.format( - "select last counter(temperature, '%s'='%s') from root.sgcc.wf03.wt01", + "select last counter(temperature, '%s'='%s') from root.dbcc.wf03.wt01", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_ROW_BY_ROW); try (Connection connection = EnvFactory.getEnv().getConnection(); diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/AlignedWriteUtil.java b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/AlignedWriteUtil.java index 798f1b2b889d4..9f39b00e2a27e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/AlignedWriteUtil.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/AlignedWriteUtil.java @@ -37,99 +37,99 @@ public class AlignedWriteUtil { private static final String[] sqls = new String[] { - "CREATE DATABASE root.sg1", - "create aligned timeseries root.sg1.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64, s4 BOOLEAN, s5 TEXT)", - "create timeseries root.sg1.d2.s1 WITH DATATYPE=FLOAT, encoding=RLE", - "create timeseries root.sg1.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", - "create timeseries root.sg1.d2.s3 WITH DATATYPE=INT64", - "create timeseries root.sg1.d2.s4 WITH DATATYPE=BOOLEAN", - "create timeseries root.sg1.d2.s5 WITH DATATYPE=TEXT", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(1, 1.0, 1, 1, TRUE, 'aligned_test1')", - "insert into root.sg1.d1(time, s1, s2, s3, s5) aligned values(2, 2.0, 2, 2, 'aligned_test2')", - "insert into root.sg1.d1(time, s1, s3, s4, s5) aligned values(3, 3.0, 3, FALSE, 'aligned_test3')", - "insert into root.sg1.d1(time, s1, s2, s4, s5) aligned values(4, 4.0, 4, TRUE, 'aligned_test4')", - "insert into root.sg1.d1(time, s1, s2, s4, s5) aligned values(5, 5.0, 5, TRUE, 'aligned_test5')", - "insert into root.sg1.d1(time, s1, s2, s3, s4) aligned values(6, 6.0, 6, 6, TRUE)", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(7, 7.0, 7, 7, FALSE, 'aligned_test7')", - "insert into root.sg1.d1(time, s1, s2, s3, s5) aligned values(8, 8.0, 8, 8, 'aligned_test8')", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(9, 9.0, 9, 9, FALSE, 'aligned_test9')", - "insert into root.sg1.d1(time, s2, s3, s4, s5) aligned values(10, 10, 10, TRUE, 'aligned_test10')", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(1, 1.0, 1, 1, TRUE, 'non_aligned_test1')", - "insert into root.sg1.d2(time, s1, s2, s3, s5) values(2, 2.0, 2, 2, 'non_aligned_test2')", - "insert into root.sg1.d2(time, s1, s3, s4, s5) values(3, 3.0, 3, FALSE, 'non_aligned_test3')", - "insert into root.sg1.d2(time, s1, s2, s4, s5) values(4, 4.0, 4, TRUE, 'non_aligned_test4')", - "insert into root.sg1.d2(time, s1, s2, s4, s5) values(5, 5.0, 5, TRUE, 'non_aligned_test5')", - "insert into root.sg1.d2(time, s1, s2, s3, s4) values(6, 6.0, 6, 6, TRUE)", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(7, 7.0, 7, 7, FALSE, 'non_aligned_test7')", - "insert into root.sg1.d2(time, s1, s2, s3, s5) values(8, 8.0, 8, 8, 'non_aligned_test8')", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(9, 9.0, 9, 9, FALSE, 'non_aligned_test9')", - "insert into root.sg1.d2(time, s2, s3, s4, s5) values(10, 10, 10, TRUE, 'non_aligned_test10')", + "CREATE DATABASE root.db1", + "create aligned timeseries root.db1.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64, s4 BOOLEAN, s5 TEXT)", + "create timeseries root.db1.d2.s1 WITH DATATYPE=FLOAT, encoding=RLE", + "create timeseries root.db1.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", + "create timeseries root.db1.d2.s3 WITH DATATYPE=INT64", + "create timeseries root.db1.d2.s4 WITH DATATYPE=BOOLEAN", + "create timeseries root.db1.d2.s5 WITH DATATYPE=TEXT", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(1, 1.0, 1, 1, TRUE, 'aligned_test1')", + "insert into root.db1.d1(time, s1, s2, s3, s5) aligned values(2, 2.0, 2, 2, 'aligned_test2')", + "insert into root.db1.d1(time, s1, s3, s4, s5) aligned values(3, 3.0, 3, FALSE, 'aligned_test3')", + "insert into root.db1.d1(time, s1, s2, s4, s5) aligned values(4, 4.0, 4, TRUE, 'aligned_test4')", + "insert into root.db1.d1(time, s1, s2, s4, s5) aligned values(5, 5.0, 5, TRUE, 'aligned_test5')", + "insert into root.db1.d1(time, s1, s2, s3, s4) aligned values(6, 6.0, 6, 6, TRUE)", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(7, 7.0, 7, 7, FALSE, 'aligned_test7')", + "insert into root.db1.d1(time, s1, s2, s3, s5) aligned values(8, 8.0, 8, 8, 'aligned_test8')", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(9, 9.0, 9, 9, FALSE, 'aligned_test9')", + "insert into root.db1.d1(time, s2, s3, s4, s5) aligned values(10, 10, 10, TRUE, 'aligned_test10')", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(1, 1.0, 1, 1, TRUE, 'non_aligned_test1')", + "insert into root.db1.d2(time, s1, s2, s3, s5) values(2, 2.0, 2, 2, 'non_aligned_test2')", + "insert into root.db1.d2(time, s1, s3, s4, s5) values(3, 3.0, 3, FALSE, 'non_aligned_test3')", + "insert into root.db1.d2(time, s1, s2, s4, s5) values(4, 4.0, 4, TRUE, 'non_aligned_test4')", + "insert into root.db1.d2(time, s1, s2, s4, s5) values(5, 5.0, 5, TRUE, 'non_aligned_test5')", + "insert into root.db1.d2(time, s1, s2, s3, s4) values(6, 6.0, 6, 6, TRUE)", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(7, 7.0, 7, 7, FALSE, 'non_aligned_test7')", + "insert into root.db1.d2(time, s1, s2, s3, s5) values(8, 8.0, 8, 8, 'non_aligned_test8')", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(9, 9.0, 9, 9, FALSE, 'non_aligned_test9')", + "insert into root.db1.d2(time, s2, s3, s4, s5) values(10, 10, 10, TRUE, 'non_aligned_test10')", "flush", - "insert into root.sg1.d1(time, s1, s3, s4, s5) aligned values(3, 30000.0, 30000, TRUE, 'aligned_unseq_test3')", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(11, 11.0, 11, 11)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(12, 12.0, 12, 12)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(13, 13.0, 13, 13)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(14, 14.0, 14, 14)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(15, 15.0, 15, 15)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(16, 16.0, 16, 16)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(17, 17.0, 17, 17)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(18, 18.0, 18, 18)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(19, 19.0, 19, 19)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(20, 20.0, 20, 20)", - "insert into root.sg1.d2(time, s1, s2, s3) values(11, 11.0, 11, 11)", - "insert into root.sg1.d2(time, s1, s2, s3) values(12, 12.0, 12, 12)", - "insert into root.sg1.d2(time, s1, s2, s3) values(13, 13.0, 13, 13)", - "insert into root.sg1.d2(time, s1, s2, s3) values(14, 14.0, 14, 14)", - "insert into root.sg1.d2(time, s1, s2, s3) values(15, 15.0, 15, 15)", - "insert into root.sg1.d2(time, s1, s2, s3) values(16, 16.0, 16, 16)", - "insert into root.sg1.d2(time, s1, s2, s3) values(17, 17.0, 17, 17)", - "insert into root.sg1.d2(time, s1, s2, s3) values(18, 18.0, 18, 18)", - "insert into root.sg1.d2(time, s1, s2, s3) values(19, 19.0, 19, 19)", - "insert into root.sg1.d2(time, s1, s2, s3) values(20, 20.0, 20, 20)", + "insert into root.db1.d1(time, s1, s3, s4, s5) aligned values(3, 30000.0, 30000, TRUE, 'aligned_unseq_test3')", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(11, 11.0, 11, 11)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(12, 12.0, 12, 12)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(13, 13.0, 13, 13)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(14, 14.0, 14, 14)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(15, 15.0, 15, 15)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(16, 16.0, 16, 16)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(17, 17.0, 17, 17)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(18, 18.0, 18, 18)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(19, 19.0, 19, 19)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(20, 20.0, 20, 20)", + "insert into root.db1.d2(time, s1, s2, s3) values(11, 11.0, 11, 11)", + "insert into root.db1.d2(time, s1, s2, s3) values(12, 12.0, 12, 12)", + "insert into root.db1.d2(time, s1, s2, s3) values(13, 13.0, 13, 13)", + "insert into root.db1.d2(time, s1, s2, s3) values(14, 14.0, 14, 14)", + "insert into root.db1.d2(time, s1, s2, s3) values(15, 15.0, 15, 15)", + "insert into root.db1.d2(time, s1, s2, s3) values(16, 16.0, 16, 16)", + "insert into root.db1.d2(time, s1, s2, s3) values(17, 17.0, 17, 17)", + "insert into root.db1.d2(time, s1, s2, s3) values(18, 18.0, 18, 18)", + "insert into root.db1.d2(time, s1, s2, s3) values(19, 19.0, 19, 19)", + "insert into root.db1.d2(time, s1, s2, s3) values(20, 20.0, 20, 20)", "flush", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(13, 130000.0, 130000, 130000, TRUE, 'aligned_unseq_test13')", - "insert into root.sg1.d1(time, s3, s4) aligned values(21, 21, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(22, 22, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(23, 23, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(24, 24, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(25, 25, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(26, 26, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(27, 27, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(28, 28, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(29, 29, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(30, 30, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(21, 21, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(22, 22, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(23, 23, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(24, 24, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(25, 25, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(26, 26, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(27, 27, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(28, 28, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(29, 29, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(30, 30, FALSE)", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(13, 130000.0, 130000, 130000, TRUE, 'aligned_unseq_test13')", + "insert into root.db1.d1(time, s3, s4) aligned values(21, 21, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(22, 22, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(23, 23, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(24, 24, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(25, 25, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(26, 26, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(27, 27, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(28, 28, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(29, 29, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(30, 30, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(21, 21, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(22, 22, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(23, 23, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(24, 24, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(25, 25, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(26, 26, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(27, 27, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(28, 28, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(29, 29, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(30, 30, FALSE)", "flush", - "insert into root.sg1.d1(time, s1, s3, s4) aligned values(23, 230000.0, 230000, FALSE)", - "insert into root.sg1.d1(time, s2, s5) aligned values(31, 31, 'aligned_test31')", - "insert into root.sg1.d1(time, s2, s5) aligned values(32, 32, 'aligned_test32')", - "insert into root.sg1.d1(time, s2, s5) aligned values(33, 33, 'aligned_test33')", - "insert into root.sg1.d1(time, s2, s5) aligned values(34, 34, 'aligned_test34')", - "insert into root.sg1.d1(time, s2, s5) aligned values(35, 35, 'aligned_test35')", - "insert into root.sg1.d1(time, s2, s5) aligned values(36, 36, 'aligned_test36')", - "insert into root.sg1.d1(time, s2, s5) aligned values(37, 37, 'aligned_test37')", - "insert into root.sg1.d1(time, s2, s5) aligned values(38, 38, 'aligned_test38')", - "insert into root.sg1.d1(time, s2, s5) aligned values(39, 39, 'aligned_test39')", - "insert into root.sg1.d1(time, s2, s5) aligned values(40, 40, 'aligned_test40')", - "insert into root.sg1.d2(time, s2, s5) values(31, 31, 'non_aligned_test31')", - "insert into root.sg1.d2(time, s2, s5) values(32, 32, 'non_aligned_test32')", - "insert into root.sg1.d2(time, s2, s5) values(33, 33, 'non_aligned_test33')", - "insert into root.sg1.d2(time, s2, s5) values(34, 34, 'non_aligned_test34')", - "insert into root.sg1.d2(time, s2, s5) values(35, 35, 'non_aligned_test35')", - "insert into root.sg1.d2(time, s2, s5) values(36, 36, 'non_aligned_test36')", - "insert into root.sg1.d2(time, s2, s5) values(37, 37, 'non_aligned_test37')", - "insert into root.sg1.d2(time, s2, s5) values(38, 38, 'non_aligned_test38')", - "insert into root.sg1.d2(time, s2, s5) values(39, 39, 'non_aligned_test39')", - "insert into root.sg1.d2(time, s2, s5) values(40, 40, 'non_aligned_test40')", + "insert into root.db1.d1(time, s1, s3, s4) aligned values(23, 230000.0, 230000, FALSE)", + "insert into root.db1.d1(time, s2, s5) aligned values(31, 31, 'aligned_test31')", + "insert into root.db1.d1(time, s2, s5) aligned values(32, 32, 'aligned_test32')", + "insert into root.db1.d1(time, s2, s5) aligned values(33, 33, 'aligned_test33')", + "insert into root.db1.d1(time, s2, s5) aligned values(34, 34, 'aligned_test34')", + "insert into root.db1.d1(time, s2, s5) aligned values(35, 35, 'aligned_test35')", + "insert into root.db1.d1(time, s2, s5) aligned values(36, 36, 'aligned_test36')", + "insert into root.db1.d1(time, s2, s5) aligned values(37, 37, 'aligned_test37')", + "insert into root.db1.d1(time, s2, s5) aligned values(38, 38, 'aligned_test38')", + "insert into root.db1.d1(time, s2, s5) aligned values(39, 39, 'aligned_test39')", + "insert into root.db1.d1(time, s2, s5) aligned values(40, 40, 'aligned_test40')", + "insert into root.db1.d2(time, s2, s5) values(31, 31, 'non_aligned_test31')", + "insert into root.db1.d2(time, s2, s5) values(32, 32, 'non_aligned_test32')", + "insert into root.db1.d2(time, s2, s5) values(33, 33, 'non_aligned_test33')", + "insert into root.db1.d2(time, s2, s5) values(34, 34, 'non_aligned_test34')", + "insert into root.db1.d2(time, s2, s5) values(35, 35, 'non_aligned_test35')", + "insert into root.db1.d2(time, s2, s5) values(36, 36, 'non_aligned_test36')", + "insert into root.db1.d2(time, s2, s5) values(37, 37, 'non_aligned_test37')", + "insert into root.db1.d2(time, s2, s5) values(38, 38, 'non_aligned_test38')", + "insert into root.db1.d2(time, s2, s5) values(39, 39, 'non_aligned_test39')", + "insert into root.db1.d2(time, s2, s5) values(40, 40, 'non_aligned_test40')", }; public static void insertData() { diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/enhanced/IoTDBPipeSinkParallelIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/enhanced/IoTDBPipeSinkParallelIT.java index 85f3b93aa7635..e88d786473e28 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/enhanced/IoTDBPipeSinkParallelIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/tablemodel/manual/enhanced/IoTDBPipeSinkParallelIT.java @@ -96,10 +96,10 @@ public void testIoTConnectorParallel() throws Exception { TestUtils.executeNonQueries( senderEnv, Arrays.asList( - "insert into root.sg1.d1(time, s1) values (0, 1)", - "insert into root.sg1.d1(time, s1) values (1, 2)", - "insert into root.sg1.d1(time, s1) values (2, 3)", - "insert into root.sg1.d1(time, s1) values (3, 4)", + "insert into root.db1.d1(time, s1) values (0, 1)", + "insert into root.db1.d1(time, s1) values (1, 2)", + "insert into root.db1.d1(time, s1) values (2, 3)", + "insert into root.db1.d1(time, s1) values (3, 4)", "flush"), null); TableModelUtils.insertData("test", "test", 100, 200, senderEnv); @@ -109,8 +109,8 @@ public void testIoTConnectorParallel() throws Exception { expectedResSet.add("3,4.0,"); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "select * from root.sg1.**", - "Time,root.sg1.d1.s1,", + "select * from root.db1.**", + "Time,root.db1.d1.s1,", expectedResSet, handleFailure); diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSinkParallelIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSinkParallelIT.java index 9cd61d68fbf11..195f6b254a406 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSinkParallelIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSinkParallelIT.java @@ -85,10 +85,10 @@ public void testIoTConnectorParallel() throws Exception { TestUtils.executeNonQueries( senderEnv, Arrays.asList( - "insert into root.sg1.d1(time, s1) values (0, 1)", - "insert into root.sg1.d1(time, s1) values (1, 2)", - "insert into root.sg1.d1(time, s1) values (2, 3)", - "insert into root.sg1.d1(time, s1) values (3, 4)", + "insert into root.db1.d1(time, s1) values (0, 1)", + "insert into root.db1.d1(time, s1) values (1, 2)", + "insert into root.db1.d1(time, s1) values (2, 3)", + "insert into root.db1.d1(time, s1) values (3, 4)", "flush"), null); @@ -97,7 +97,7 @@ public void testIoTConnectorParallel() throws Exception { expectedResSet.add("2,3.0,"); expectedResSet.add("3,4.0,"); TestUtils.assertDataEventuallyOnEnv( - receiverEnv, "select * from root.sg1.**", "Time,root.sg1.d1.s1,", expectedResSet); + receiverEnv, "select * from root.db1.**", "Time,root.db1.d1.s1,", expectedResSet); } } } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeAutoConflictIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeAutoConflictIT.java index d8a191c371964..e1321e6e93257 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeAutoConflictIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeAutoConflictIT.java @@ -398,15 +398,15 @@ public void testHistoricalActivationRace() throws Exception { TestUtils.executeNonQueries( senderEnv, Arrays.asList( - "create database root.sg_aligned", + "create database root.db_aligned", "create device template aligned_template aligned (s0 int32, s1 int64, s2 float, s3 double, s4 boolean, s5 text)", - "set device template aligned_template to root.sg_aligned.device_aligned", - "create timeseries using device template on root.sg_aligned.device_aligned.d10", - "create timeseries using device template on root.sg_aligned.device_aligned.d12", - "insert into root.sg_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5) values (1706659200,1706659200,10,20.245,25.24555,true,''),(1706662800,null,1706662800,20.241,25.24111,false,'2'),(1706666400,3,null,20.242,25.24222,true,'3'),(1706670000,4,40,null,35.5474,true,'4'),(1706670600,5,1706670600000,20.246,null,false,'5'),(1706671200,6,60,20.248,25.24888,null,'6'),(1706671800,7,1706671800,20.249,25.24999,false,null),(1706672400,8,80,1245.392,75.51234,false,'8'),(1706672600,9,90,2345.397,2285.58734,false,'9'),(1706673000,10,100,20.241,25.24555,false,'10'),(1706673600,11,110,3345.394,4105.544,false,'11'),(1706674200,12,1706674200,30.245,35.24555,false,'12'),(1706674800,13,130,5.39,125.51234,false,'13'),(1706675400,14,1706675400,5.39,135.51234,false,'14'),(1706676000,15,150,5.39,145.51234,false,'15'),(1706676600,16,160,5.39,155.51234,false,'16'),(1706677200,17,170,5.39,165.51234,false,'17'),(1706677600,18,180,5.39,175.51234,false,'18'),(1706677800,19,190,5.39,185.51234,false,'19'),(1706678000,20,200,5.39,195.51234,false,'20'),(1706678200,21,210,5.39,null,false,'21')", - "insert into root.sg_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5) values (-1,1,10,5.39,5.51234,false,'negative')", - "insert into root.sg_aligned.device_aligned.d11(time, s0, s1, s2,s3,s4,s5) values (-1,-11,-110,-5.39,-5.51234,false,'activate:1')", - "insert into root.sg_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5,s6) values(1706678800,1,1706678800,5.39,5.51234,false,'add:s6',32);"), + "set device template aligned_template to root.db_aligned.device_aligned", + "create timeseries using device template on root.db_aligned.device_aligned.d10", + "create timeseries using device template on root.db_aligned.device_aligned.d12", + "insert into root.db_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5) values (1706659200,1706659200,10,20.245,25.24555,true,''),(1706662800,null,1706662800,20.241,25.24111,false,'2'),(1706666400,3,null,20.242,25.24222,true,'3'),(1706670000,4,40,null,35.5474,true,'4'),(1706670600,5,1706670600000,20.246,null,false,'5'),(1706671200,6,60,20.248,25.24888,null,'6'),(1706671800,7,1706671800,20.249,25.24999,false,null),(1706672400,8,80,1245.392,75.51234,false,'8'),(1706672600,9,90,2345.397,2285.58734,false,'9'),(1706673000,10,100,20.241,25.24555,false,'10'),(1706673600,11,110,3345.394,4105.544,false,'11'),(1706674200,12,1706674200,30.245,35.24555,false,'12'),(1706674800,13,130,5.39,125.51234,false,'13'),(1706675400,14,1706675400,5.39,135.51234,false,'14'),(1706676000,15,150,5.39,145.51234,false,'15'),(1706676600,16,160,5.39,155.51234,false,'16'),(1706677200,17,170,5.39,165.51234,false,'17'),(1706677600,18,180,5.39,175.51234,false,'18'),(1706677800,19,190,5.39,185.51234,false,'19'),(1706678000,20,200,5.39,195.51234,false,'20'),(1706678200,21,210,5.39,null,false,'21')", + "insert into root.db_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5) values (-1,1,10,5.39,5.51234,false,'negative')", + "insert into root.db_aligned.device_aligned.d11(time, s0, s1, s2,s3,s4,s5) values (-1,-11,-110,-5.39,-5.51234,false,'activate:1')", + "insert into root.db_aligned.device_aligned.d10(time, s0, s1, s2,s3,s4,s5,s6) values(1706678800,1,1706678800,5.39,5.51234,false,'add:s6',32);"), null); final Map extractorAttributes = new HashMap<>(); @@ -432,7 +432,7 @@ public void testHistoricalActivationRace() throws Exception { TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "count devices root.sg_aligned.**", + "count devices root.db_aligned.**", "count(devices),", Collections.singleton("3,")); } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeIdempotentIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeIdempotentIT.java index 39bdd8216470e..d3f099de34ad9 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeIdempotentIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeIdempotentIT.java @@ -176,7 +176,7 @@ public void testDeleteTimeSeriesIdempotent() throws Exception { Collections.singletonList( "create timeSeries root.ln.wf01.wt01.status0(status0) with datatype=BOOLEAN,encoding=PLAIN"), "delete timeSeries root.ln.wf01.wt01.status0", - "create database root.sg", + "create database root.db", "count databases", "count,", Collections.singleton("3,")); @@ -187,7 +187,7 @@ public void testCreateTemplateIdempotent() throws Exception { testIdempotent( Collections.emptyList(), "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -199,7 +199,7 @@ public void testExtendTemplateIdempotent() throws Exception { Collections.singletonList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)"), "alter schema template t1 add (rest FLOAT encoding=RLE, FLOAT2 TEXT encoding=PLAIN compression=SNAPPY)", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -211,7 +211,7 @@ public void testDropTemplateIdempotent() throws Exception { Collections.singletonList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)"), "drop schema template t1", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -222,9 +222,9 @@ public void testSetTemplateIdempotent() throws Exception { testIdempotent( Arrays.asList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1"), - "set schema template t1 to root.sg1", - "create database root.sg2", + "create database root.db1"), + "set schema template t1 to root.db1", + "create database root.db2", "count databases", "count,", Collections.singleton("3,")); @@ -235,10 +235,10 @@ public void testUnsetTemplateIdempotent() throws Exception { testIdempotent( Arrays.asList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1", - "set schema template t1 to root.sg1"), - "unset schema template t1 from root.sg1", - "create database root.sg2", + "create database root.db1", + "set schema template t1 to root.db1"), + "unset schema template t1 from root.db1", + "create database root.db2", "count databases", "count,", Collections.singleton("3,")); @@ -249,11 +249,11 @@ public void testActivateTemplateIdempotent() throws Exception { testIdempotent( Arrays.asList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1", - "set schema template t1 to root.sg1"), - "create timeSeries using device template on root.sg1.d1", - "create timeSeries using device template on root.sg1.d2", - "count timeSeries root.sg1.**", + "create database root.db1", + "set schema template t1 to root.db1"), + "create timeSeries using device template on root.db1.d1", + "create timeSeries using device template on root.db1.d2", + "count timeSeries root.db1.**", "count(timeseries),", Collections.singleton("6,")); } @@ -263,12 +263,12 @@ public void testDeactivateTemplateIdempotent() throws Exception { testIdempotent( Arrays.asList( "create schema template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1", - "set schema template t1 to root.sg1", - "create timeSeries using device template on root.sg1.d1", - "create timeSeries using device template on root.sg1.d2"), - "delete timeSeries of schema template t1 from root.sg1.*", - "create database root.sg2", + "create database root.db1", + "set schema template t1 to root.db1", + "create timeSeries using device template on root.db1.d1", + "create timeSeries using device template on root.db1.d2"), + "delete timeSeries of schema template t1 from root.db1.*", + "create database root.db2", "count databases", "count,", Collections.singleton("3,")); @@ -278,8 +278,8 @@ public void testDeactivateTemplateIdempotent() throws Exception { public void testCreateDatabaseIdempotent() throws Exception { testIdempotent( Collections.emptyList(), - "create database root.sg1", - "create database root.sg2", + "create database root.db1", + "create database root.db2", "count databases", "count,", Collections.singleton("3,")); @@ -288,9 +288,9 @@ public void testCreateDatabaseIdempotent() throws Exception { @Test public void testAlterDatabaseIdempotent() throws Exception { testIdempotent( - Collections.singletonList("create database root.sg1"), - "ALTER DATABASE root.sg1 WITH SCHEMA_REGION_GROUP_NUM=2, DATA_REGION_GROUP_NUM=3;", - "create database root.sg2", + Collections.singletonList("create database root.db1"), + "ALTER DATABASE root.db1 WITH SCHEMA_REGION_GROUP_NUM=2, DATA_REGION_GROUP_NUM=3;", + "create database root.db2", "count databases", "count,", Collections.singleton("3,")); @@ -299,9 +299,9 @@ public void testAlterDatabaseIdempotent() throws Exception { @Test public void testDropDatabaseIdempotent() throws Exception { testIdempotent( - Collections.singletonList("create database root.sg1"), - "drop database root.sg1", - "create database root.sg2", + Collections.singletonList("create database root.db1"), + "drop database root.db1", + "create database root.db2", "count databases", "count,", Collections.singleton("2,")); @@ -312,7 +312,7 @@ public void testCreateUserIdempotent() throws Exception { testIdempotent( Collections.emptyList(), "create user `ln_write_user` 'write_pwd123456'", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -323,7 +323,7 @@ public void testCreateRoleIdempotent() throws Exception { testIdempotent( Collections.emptyList(), "create role `test`", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -334,7 +334,7 @@ public void testGrantRoleToUserIdempotent() throws Exception { testIdempotent( Arrays.asList("create user `ln_write_user` 'write_pwd123456'", "create role `test`"), "grant role test to ln_write_user", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -347,7 +347,7 @@ public void testRevokeUserIdempotent() throws Exception { "create user `ln_write_user` 'write_pwd123456'", "GRANT READ_DATA, WRITE_DATA ON root.t1.** TO USER ln_write_user;"), "REVOKE READ_DATA, WRITE_DATA ON root.t1.** FROM USER ln_write_user;", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -358,7 +358,7 @@ public void testRevokeRoleIdempotent() throws Exception { testIdempotent( Arrays.asList("create role `test`", "GRANT READ ON root.** TO ROLE test;"), "REVOKE READ ON root.** FROM ROLE test;", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -372,7 +372,7 @@ public void testRevokeRoleFromUserIdempotent() throws Exception { "create role `test`", "grant role test to ln_write_user"), "revoke role test from ln_write_user", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -383,7 +383,7 @@ public void testDropUserIdempotent() throws Exception { testIdempotent( Collections.singletonList("create user `ln_write_user` 'write_pwd123456'"), "drop user `ln_write_user`", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); @@ -394,7 +394,7 @@ public void testDropRoleIdempotent() throws Exception { testIdempotent( Collections.singletonList("create role `test`"), "drop role test", - "create database root.sg1", + "create database root.db1", "count databases", "count,", Collections.singleton("2,")); diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeNullValueIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeNullValueIT.java index 9dc07aaa6c3ae..66f0a9c8e8621 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeNullValueIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeNullValueIT.java @@ -73,13 +73,13 @@ private enum InsertType { private static final List CREATE_TIMESERIES_SQL = Arrays.asList( - "create timeseries root.sg.d1.s0 with datatype=float", - "create timeseries root.sg.d1.s1 with datatype=float"); + "create timeseries root.db.d1.s0 with datatype=float", + "create timeseries root.db.d1.s1 with datatype=float"); private static final List CREATE_ALIGNED_TIMESERIES_SQL = - Collections.singletonList("create aligned timeseries root.sg.d1(s0 float, s1 float)"); + Collections.singletonList("create aligned timeseries root.db.d1(s0 float, s1 float)"); - private final String deviceId = "root.sg.d1"; + private final String deviceId = "root.db.d1"; private final List measurements = Arrays.asList("s0", "s1"); private final List types = Arrays.asList(TSDataType.FLOAT, TSDataType.FLOAT); @@ -189,18 +189,18 @@ public void setUp() { senderEnv, isAligned ? Collections.singletonList( - "insert into root.sg.d1(time, s0, s1) aligned values (3, null, 25.34)") + "insert into root.db.d1(time, s0, s1) aligned values (3, null, 25.34)") : Collections.singletonList( - "insert into root.sg.d1(time, s0, s1) values (3, null, 25.34)"), + "insert into root.db.d1(time, s0, s1) values (3, null, 25.34)"), null); // All null TestUtils.executeNonQueries( senderEnv, isAligned ? Collections.singletonList( - "insert into root.sg.d1(time, s0, s1) aligned values (4, null, null)") + "insert into root.db.d1(time, s0, s1) aligned values (4, null, null)") : Collections.singletonList( - "insert into root.sg.d1(time, s0, s1) values (4, null, null)"), + "insert into root.db.d1(time, s0, s1) values (4, null, null)"), null); }); } @@ -226,7 +226,7 @@ private void testInsertNullValueTemplate( if (withParsing) { extractorAttributes.put("start-time", "1970-01-01T08:00:00.000+08:00"); extractorAttributes.put("end-time", "1970-01-01T09:00:00.000+08:00"); - extractorAttributes.put("extractor.pattern", "root.sg.d1"); + extractorAttributes.put("extractor.pattern", "root.db.d1"); } final TSStatus status = @@ -248,8 +248,8 @@ private void testInsertNullValueTemplate( TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "select count(*) from root.sg.**", - "count(root.sg.d1.s0),count(root.sg.d1.s1),", + "select count(*) from root.db.**", + "count(root.db.d1.s0),count(root.db.d1.s1),", Collections.singleton("0,1,")); } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeManualConflictIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeManualConflictIT.java index cc391f39b437d..b1fe0b49c6c28 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeManualConflictIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeManualConflictIT.java @@ -218,40 +218,40 @@ public void testDoubleLivingTemplate() throws Exception { senderEnv, Arrays.asList( "create device template t1 (s1 INT64 encoding=RLE, s2 INT64 encoding=RLE, s3 INT64 encoding=RLE compression=SNAPPY)", - "create database root.sg1", - "set device template t1 to root.sg1", - "create timeseries using device template on root.sg1.d1", - "insert into root.sg1.d1(time, s1, s2, s3) values(0, 1, 2, 3);", + "create database root.db1", + "set device template t1 to root.db1", + "create timeseries using device template on root.db1.d1", + "insert into root.db1.d1(time, s1, s2, s3) values(0, 1, 2, 3);", "flush"), null); TestUtils.executeNonQueries( receiverEnv, Arrays.asList( - "create timeseries using device template on root.sg1.d2", - "insert into root.sg1.d2(time, s1, s2, s3) values(0, 1, 2, 3);", + "create timeseries using device template on root.db1.d2", + "insert into root.db1.d2(time, s1, s2, s3) values(0, 1, 2, 3);", "flush"), null); TestUtils.assertDataEventuallyOnEnv( senderEnv, - "count timeseries root.sg1.**", + "count timeseries root.db1.**", "count(timeseries),", Collections.singleton("6,")); TestUtils.assertDataEventuallyOnEnv( senderEnv, - "select count(*) from root.sg1.** group by level=1", - "count(root.sg1.*.*),", + "select count(*) from root.db1.** group by level=1", + "count(root.db1.*.*),", Collections.singleton("6,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "count timeseries root.sg1.**", + "count timeseries root.db1.**", "count(timeseries),", Collections.singleton("6,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "select count(*) from root.sg1.** group by level=1", - "count(root.sg1.*.*),", + "select count(*) from root.db1.** group by level=1", + "count(root.db1.*.*),", Collections.singleton("6,")); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMetaHistoricalIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMetaHistoricalIT.java index cb0c334f68b9a..36d364788703e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMetaHistoricalIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMetaHistoricalIT.java @@ -282,9 +282,9 @@ public void testTimeSeriesInclusion() throws Exception { TestUtils.executeNonQueries( senderEnv, Arrays.asList( - "create database root.sg", - "create timeseries root.sg.a.b int32", - "create aligned timeseries root.sg.`apache|timecho-tag-attr`.d1(s1 INT32 tags(tag1=v1, tag2=v2) attributes(attr1=v1, attr2=v2), s2 DOUBLE tags(tag3=v3, tag4=v4) attributes(attr3=v3, attr4=v4))"), + "create database root.db", + "create timeseries root.db.a.b int32", + "create aligned timeseries root.db.`apache|timecho-tag-attr`.d1(s1 INT32 tags(tag1=v1, tag2=v2) attributes(attr1=v1, attr2=v2), s2 DOUBLE tags(tag3=v3, tag4=v4) attributes(attr3=v3, attr4=v4))"), null); final Map extractorAttributes = new HashMap<>(); @@ -312,13 +312,13 @@ public void testTimeSeriesInclusion() throws Exception { TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "show timeseries root.sg.**", + "show timeseries root.db.**", "Timeseries,Alias,Database,DataType,Encoding,Compression,Tags,Attributes,Deadband,DeadbandParameters,ViewType,", new HashSet<>( Arrays.asList( - "root.sg.a.b,null,root.sg,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", - "root.sg.`apache|timecho-tag-attr`.d1.s1,null,root.sg,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},{\"attr2\":\"v2\",\"attr1\":\"v1\"},null,null,BASE,", - "root.sg.`apache|timecho-tag-attr`.d1.s2,null,root.sg,DOUBLE,GORILLA,LZ4,{\"tag4\":\"v4\",\"tag3\":\"v3\"},{\"attr4\":\"v4\",\"attr3\":\"v3\"},null,null,BASE,"))); + "root.db.a.b,null,root.db,INT32,TS_2DIFF,LZ4,null,null,null,null,BASE,", + "root.db.`apache|timecho-tag-attr`.d1.s1,null,root.db,INT32,TS_2DIFF,LZ4,{\"tag1\":\"v1\",\"tag2\":\"v2\"},{\"attr2\":\"v2\",\"attr1\":\"v1\"},null,null,BASE,", + "root.db.`apache|timecho-tag-attr`.d1.s2,null,root.db,DOUBLE,GORILLA,LZ4,{\"tag4\":\"v4\",\"tag3\":\"v3\"},{\"attr4\":\"v4\",\"attr3\":\"v3\"},null,null,BASE,"))); } } } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMultiSchemaRegionIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMultiSchemaRegionIT.java index a0d5ee7e1d135..46f9186ea1c3e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMultiSchemaRegionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeMultiSchemaRegionIT.java @@ -55,7 +55,7 @@ public void testMultiSchemaRegion() throws Exception { senderEnv, Arrays.asList( "create timeseries root.ln.wf01.GPS.status0 with datatype=BOOLEAN,encoding=PLAIN", - "create timeseries root.sg.wf01.GPS.status0 with datatype=BOOLEAN,encoding=PLAIN"), + "create timeseries root.db.wf01.GPS.status0 with datatype=BOOLEAN,encoding=PLAIN"), null); final Map extractorAttributes = new HashMap<>(); @@ -87,7 +87,7 @@ public void testMultiSchemaRegion() throws Exception { senderEnv, Arrays.asList( "create timeseries root.ln.wf01.GPS.status1 with datatype=BOOLEAN,encoding=PLAIN", - "create timeseries root.sg.wf01.GPS.status1 with datatype=BOOLEAN,encoding=PLAIN"), + "create timeseries root.db.wf01.GPS.status1 with datatype=BOOLEAN,encoding=PLAIN"), null); TestUtils.assertDataEventuallyOnEnv( @@ -97,7 +97,7 @@ public void testMultiSchemaRegion() throws Exception { Collections.singleton("2,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "count timeseries root.sg.**", + "count timeseries root.db.**", "count(timeseries),", Collections.singleton("2,")); } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeTsFileDecompositionWithModsIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeTsFileDecompositionWithModsIT.java index 89f1c3fb4401d..2ec5770f1f684 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeTsFileDecompositionWithModsIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeTsFileDecompositionWithModsIT.java @@ -47,7 +47,7 @@ protected void setupConfig() { /** * Test IoTDB pipe handling TsFile decomposition with Mods (modification operations) in tree model * - *

Test scenario: 1. Create database root.sg1 with 4 devices: d1 (aligned timeseries), d2 + *

Test scenario: 1. Create database root.db1 with 4 devices: d1 (aligned timeseries), d2 * (non-aligned timeseries), d3 (aligned timeseries), d4 (aligned timeseries) 2. Insert initial * data into d1, d2, d3 3. Execute FLUSH operation to persist data to TsFile 4. Execute DELETE * operation on d1.s1, deleting data in time range 2-4 5. Insert large amount of data into d4 @@ -64,42 +64,42 @@ protected void setupConfig() { */ @Test public void testTsFileDecompositionWithMods() throws Exception { - TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.sg1"); - TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.sg1"); + TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.db1"); + TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.db1"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d1(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d1(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE TIMESERIES root.sg1.d2.s1 WITH DATATYPE=FLOAT"); + senderEnv, "CREATE TIMESERIES root.db1.d2.s1 WITH DATATYPE=FLOAT"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE TIMESERIES root.sg1.d2.s2 WITH DATATYPE=FLOAT"); + senderEnv, "CREATE TIMESERIES root.db1.d2.s2 WITH DATATYPE=FLOAT"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d3(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d3(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d1(time, s1, s2, s3) ALIGNED VALUES (1, 1.0, 2.0, 3.0), (2, 1.1, 2.1, 3.1), (3, 1.2, 2.2, 3.2), (4, 1.3, 2.3, 3.3), (5, 1.4, 2.4, 3.4)"); + "INSERT INTO root.db1.d1(time, s1, s2, s3) ALIGNED VALUES (1, 1.0, 2.0, 3.0), (2, 1.1, 2.1, 3.1), (3, 1.2, 2.2, 3.2), (4, 1.3, 2.3, 3.3), (5, 1.4, 2.4, 3.4)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d2(time, s1, s2) VALUES (1, 10.0, 20.0), (2, 10.1, 20.1), (3, 10.2, 20.2), (4, 10.3, 20.3), (5, 10.4, 20.4)"); + "INSERT INTO root.db1.d2(time, s1, s2) VALUES (1, 10.0, 20.0), (2, 10.1, 20.1), (3, 10.2, 20.2), (4, 10.3, 20.3), (5, 10.4, 20.4)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); + "INSERT INTO root.db1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s1 WHERE time >= 2 AND time <= 4"); + senderEnv, "DELETE FROM root.db1.d1.s1 WHERE time >= 2 AND time <= 4"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); + "INSERT INTO root.db1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d4(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); - String s = "INSERT INTO root.sg1.d4(time, s1, s2, s3) ALIGNED VALUES "; + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d4(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + String s = "INSERT INTO root.db1.d4(time, s1, s2, s3) ALIGNED VALUES "; StringBuilder insertBuilder = new StringBuilder(s); for (int i = 1; i <= 11000; i++) { insertBuilder @@ -122,13 +122,13 @@ public void testTsFileDecompositionWithMods() throws Exception { TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s1 WHERE time <= 10000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s2 WHERE time > 1000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s3 WHERE time <= 8000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s1 WHERE time <= 10000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s2 WHERE time > 1000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s3 WHERE time <= 8000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d2.*"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d2.*"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d3.*"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d3.*"); TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); @@ -144,8 +144,8 @@ public void testTsFileDecompositionWithMods() throws Exception { TestUtils.assertDataEventuallyOnEnv( senderEnv, - "SELECT * FROM root.sg1.d1 ORDER BY time", - "Time,root.sg1.d1.s3,root.sg1.d1.s1,root.sg1.d1.s2,", + "SELECT * FROM root.db1.d1 ORDER BY time", + "Time,root.db1.d1.s3,root.db1.d1.s1,root.db1.d1.s2,", results); executeNonQueryWithRetry( @@ -157,26 +157,26 @@ public void testTsFileDecompositionWithMods() throws Exception { TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT * FROM root.sg1.d1 ORDER BY time", - "Time,root.sg1.d1.s3,root.sg1.d1.s1,root.sg1.d1.s2,", + "SELECT * FROM root.db1.d1 ORDER BY time", + "Time,root.db1.d1.s3,root.db1.d1.s1,root.db1.d1.s2,", results); TestUtils.assertDataEventuallyOnEnv( - receiverEnv, "SELECT * FROM root.sg1.d2 ORDER BY time", "Time,", Collections.emptySet()); + receiverEnv, "SELECT * FROM root.db1.d2 ORDER BY time", "Time,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( - receiverEnv, "SELECT * FROM root.sg1.d3 ORDER BY time", "Time,", Collections.emptySet()); + receiverEnv, "SELECT * FROM root.db1.d3 ORDER BY time", "Time,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT s1 FROM root.sg1.d1 WHERE time >= 2 AND time <= 4", - "Time,root.sg1.d1.s1,", + "SELECT s1 FROM root.db1.d1 WHERE time >= 2 AND time <= 4", + "Time,root.db1.d1.s1,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(**) FROM root.sg1.d4", - "COUNT(root.sg1.d4.s3),COUNT(root.sg1.d4.s1),COUNT(root.sg1.d4.s2),", + "SELECT COUNT(**) FROM root.db1.d4", + "COUNT(root.db1.d4.s3),COUNT(root.db1.d4.s1),COUNT(root.db1.d4.s2),", Collections.singleton("3000,1000,1000,")); } @@ -184,7 +184,7 @@ public void testTsFileDecompositionWithMods() throws Exception { * Test IoTDB pipe handling TsFile decomposition with Mods (modification operations) in tree model * - Multi-pipe scenario * - *

Test scenario: 1. Create database root.sg1 with 4 devices: d1 (aligned timeseries), d2 + *

Test scenario: 1. Create database root.db1 with 4 devices: d1 (aligned timeseries), d2 * (non-aligned timeseries), d3 (aligned timeseries), d4 (aligned timeseries) 2. Insert initial * data into d1, d2, d3 3. Execute FLUSH operation to persist data to TsFile 4. Execute DELETE * operation on d1.s1, deleting data in time range 2-4 5. Insert large amount of data into d4 @@ -192,8 +192,8 @@ public void testTsFileDecompositionWithMods() throws Exception { * field data where time<=10000 - Delete s2 field data where time>1000 - Delete s3 field data * where time<=8000 7. Delete all data from d2 and d3 8. Execute FLUSH operation again 9. Create 4 * independent pipes, each targeting different device paths: - test_pipe1: handles data for - * root.sg1.d1.** path - test_pipe2: handles data for root.sg1.d2.** path - test_pipe3: handles - * data for root.sg1.d3.** path - test_pipe4: handles data for root.sg1.d4.** path 10. Verify + * root.db1.d1.** path - test_pipe2: handles data for root.db1.d2.** path - test_pipe3: handles + * data for root.db1.d3.** path - test_pipe4: handles data for root.db1.d4.** path 10. Verify * correctness of receiver data: - d1 s1 field is null in time range 2-4, other data is normal - * d2 and d3 data is completely deleted - d4 DELETE operation results meet expectations for each * field @@ -206,42 +206,42 @@ public void testTsFileDecompositionWithMods() throws Exception { */ @Test public void testTsFileDecompositionWithMods2() throws Exception { - TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.sg1"); - TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.sg1"); + TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.db1"); + TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.db1"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d1(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d1(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE TIMESERIES root.sg1.d2.s1 WITH DATATYPE=FLOAT"); + senderEnv, "CREATE TIMESERIES root.db1.d2.s1 WITH DATATYPE=FLOAT"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE TIMESERIES root.sg1.d2.s2 WITH DATATYPE=FLOAT"); + senderEnv, "CREATE TIMESERIES root.db1.d2.s2 WITH DATATYPE=FLOAT"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d3(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d3(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d1(time, s1, s2, s3) ALIGNED VALUES (1, 1.0, 2.0, 3.0), (2, 1.1, 2.1, 3.1), (3, 1.2, 2.2, 3.2), (4, 1.3, 2.3, 3.3), (5, 1.4, 2.4, 3.4)"); + "INSERT INTO root.db1.d1(time, s1, s2, s3) ALIGNED VALUES (1, 1.0, 2.0, 3.0), (2, 1.1, 2.1, 3.1), (3, 1.2, 2.2, 3.2), (4, 1.3, 2.3, 3.3), (5, 1.4, 2.4, 3.4)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d2(time, s1, s2) VALUES (1, 10.0, 20.0), (2, 10.1, 20.1), (3, 10.2, 20.2), (4, 10.3, 20.3), (5, 10.4, 20.4)"); + "INSERT INTO root.db1.d2(time, s1, s2) VALUES (1, 10.0, 20.0), (2, 10.1, 20.1), (3, 10.2, 20.2), (4, 10.3, 20.3), (5, 10.4, 20.4)"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); + "INSERT INTO root.db1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s1 WHERE time >= 2 AND time <= 4"); + senderEnv, "DELETE FROM root.db1.d1.s1 WHERE time >= 2 AND time <= 4"); TestUtils.executeNonQueryWithRetry( senderEnv, - "INSERT INTO root.sg1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); + "INSERT INTO root.db1.d3(time, s1, s2, s3) ALIGNED VALUES (1, 100.0, 200.0, 300.0), (2, 100.1, 200.1, 300.1), (3, 100.2, 200.2, 300.2)"); TestUtils.executeNonQueryWithRetry( - senderEnv, "CREATE ALIGNED TIMESERIES root.sg1.d4(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); - String s = "INSERT INTO root.sg1.d4(time, s1, s2, s3) ALIGNED VALUES "; + senderEnv, "CREATE ALIGNED TIMESERIES root.db1.d4(s1 FLOAT, s2 FLOAT, s3 FLOAT)"); + String s = "INSERT INTO root.db1.d4(time, s1, s2, s3) ALIGNED VALUES "; StringBuilder insertBuilder = new StringBuilder(s); for (int i = 1; i <= 11000; i++) { insertBuilder @@ -264,13 +264,13 @@ public void testTsFileDecompositionWithMods2() throws Exception { TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s1 WHERE time <= 10000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s2 WHERE time > 1000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d4.s3 WHERE time <= 8000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s1 WHERE time <= 10000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s2 WHERE time > 1000"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d4.s3 WHERE time <= 8000"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d2.*"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d2.*"); - TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.sg1.d3.*"); + TestUtils.executeNonQueryWithRetry(senderEnv, "DELETE FROM root.db1.d3.*"); TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); @@ -286,60 +286,60 @@ public void testTsFileDecompositionWithMods2() throws Exception { TestUtils.assertDataEventuallyOnEnv( senderEnv, - "SELECT * FROM root.sg1.d1 ORDER BY time", - "Time,root.sg1.d1.s3,root.sg1.d1.s1,root.sg1.d1.s2,", + "SELECT * FROM root.db1.d1 ORDER BY time", + "Time,root.db1.d1.s3,root.db1.d1.s1,root.db1.d1.s2,", results); executeNonQueryWithRetry( senderEnv, String.format( - "CREATE PIPE test_pipe1 WITH SOURCE ('mods.enable'='true','path'='root.sg1.d1.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", + "CREATE PIPE test_pipe1 WITH SOURCE ('mods.enable'='true','path'='root.db1.d1.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", receiverEnv.getDataNodeWrapperList().get(0).getIp(), receiverEnv.getDataNodeWrapperList().get(0).getPort())); executeNonQueryWithRetry( senderEnv, String.format( - "CREATE PIPE test_pipe2 WITH SOURCE ('mods.enable'='true','path'='root.sg1.d2.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", + "CREATE PIPE test_pipe2 WITH SOURCE ('mods.enable'='true','path'='root.db1.d2.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", receiverEnv.getDataNodeWrapperList().get(0).getIp(), receiverEnv.getDataNodeWrapperList().get(0).getPort())); executeNonQueryWithRetry( senderEnv, String.format( - "CREATE PIPE test_pipe3 WITH SOURCE ('mods.enable'='true','path'='root.sg1.d3.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", + "CREATE PIPE test_pipe3 WITH SOURCE ('mods.enable'='true','path'='root.db1.d3.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", receiverEnv.getDataNodeWrapperList().get(0).getIp(), receiverEnv.getDataNodeWrapperList().get(0).getPort())); executeNonQueryWithRetry( senderEnv, String.format( - "CREATE PIPE test_pipe4 WITH SOURCE ('mods.enable'='true','path'='root.sg1.d4.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", + "CREATE PIPE test_pipe4 WITH SOURCE ('mods.enable'='true','path'='root.db1.d4.**') WITH CONNECTOR('ip'='%s', 'port'='%s', 'format'='tablet')", receiverEnv.getDataNodeWrapperList().get(0).getIp(), receiverEnv.getDataNodeWrapperList().get(0).getPort())); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT * FROM root.sg1.d1 ORDER BY time", - "Time,root.sg1.d1.s3,root.sg1.d1.s1,root.sg1.d1.s2,", + "SELECT * FROM root.db1.d1 ORDER BY time", + "Time,root.db1.d1.s3,root.db1.d1.s1,root.db1.d1.s2,", results); TestUtils.assertDataEventuallyOnEnv( - receiverEnv, "SELECT * FROM root.sg1.d2 ORDER BY time", "Time,", Collections.emptySet()); + receiverEnv, "SELECT * FROM root.db1.d2 ORDER BY time", "Time,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( - receiverEnv, "SELECT * FROM root.sg1.d3 ORDER BY time", "Time,", Collections.emptySet()); + receiverEnv, "SELECT * FROM root.db1.d3 ORDER BY time", "Time,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT s1 FROM root.sg1.d1 WHERE time >= 2 AND time <= 4", - "Time,root.sg1.d1.s1,", + "SELECT s1 FROM root.db1.d1 WHERE time >= 2 AND time <= 4", + "Time,root.db1.d1.s1,", Collections.emptySet()); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(**) FROM root.sg1.d4", - "COUNT(root.sg1.d4.s3),COUNT(root.sg1.d4.s1),COUNT(root.sg1.d4.s2),", + "SELECT COUNT(**) FROM root.db1.d4", + "COUNT(root.db1.d4.s3),COUNT(root.db1.d4.s1),COUNT(root.db1.d4.s2),", Collections.singleton("3000,1000,1000,")); } @@ -347,7 +347,7 @@ public void testTsFileDecompositionWithMods2() throws Exception { * Test IoTDB pipe handling TsFile decomposition with Mods (modification operations) in tree model * - Large scale single point deletion scenario * - *

Test scenario: 1. Create database root.sg1 with 1 device: d1 (aligned timeseries with 5 + *

Test scenario: 1. Create database root.db1 with 1 device: d1 (aligned timeseries with 5 * sensors) 2. Insert 20000 data points for each sensor with different time ranges: - s1: time * 1-20000 - s2: time 10001-30000 - s3: time 20001-40000 - s4: time 30001-50000 - s5: time * 40001-60000 3. Execute FLUSH operation to persist data to TsFile 4. Execute 2000 single point @@ -361,11 +361,11 @@ public void testTsFileDecompositionWithMods2() throws Exception { */ @Test public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throws Exception { - TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.sg1"); - TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.sg1"); + TestUtils.executeNonQueryWithRetry(senderEnv, "CREATE DATABASE root.db1"); + TestUtils.executeNonQueryWithRetry(receiverEnv, "CREATE DATABASE root.db1"); // Insert 20000 data points for s1 (time 1-20000) - String s1 = "INSERT INTO root.sg1.d1(time, s1) ALIGNED VALUES "; + String s1 = "INSERT INTO root.db1.d1(time, s1) ALIGNED VALUES "; StringBuilder insertBuilder1 = new StringBuilder(s1); for (int i = 1; i <= 20000; i++) { insertBuilder1.append("(").append(i).append(",").append(1.0f).append(")"); @@ -382,7 +382,7 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw } // Insert 20000 data points for s2 (time 10001-30000) - String s2 = "INSERT INTO root.sg1.d1(time, s2) ALIGNED VALUES "; + String s2 = "INSERT INTO root.db1.d1(time, s2) ALIGNED VALUES "; StringBuilder insertBuilder2 = new StringBuilder(s2); for (int i = 10001; i <= 30000; i++) { insertBuilder2.append("(").append(i).append(",").append(2.0f).append(")"); @@ -399,7 +399,7 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw } // Insert 20000 data points for s3 (time 20001-40000) - String s3 = "INSERT INTO root.sg1.d1(time, s3) ALIGNED VALUES "; + String s3 = "INSERT INTO root.db1.d1(time, s3) ALIGNED VALUES "; StringBuilder insertBuilder3 = new StringBuilder(s3); for (int i = 20001; i <= 40000; i++) { insertBuilder3.append("(").append(i).append(",").append(3.0f).append(")"); @@ -416,7 +416,7 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw } // Insert 20000 data points for s4 (time 30001-50000) - String s4 = "INSERT INTO root.sg1.d1(time, s4) ALIGNED VALUES "; + String s4 = "INSERT INTO root.db1.d1(time, s4) ALIGNED VALUES "; StringBuilder insertBuilder4 = new StringBuilder(s4); for (int i = 30001; i <= 50000; i++) { insertBuilder4.append("(").append(i).append(",").append(4.0f).append(")"); @@ -433,7 +433,7 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw } // Insert 20000 data points for s5 (time 40001-60000) - String s5 = "INSERT INTO root.sg1.d1(time, s5) ALIGNED VALUES "; + String s5 = "INSERT INTO root.db1.d1(time, s5) ALIGNED VALUES "; StringBuilder insertBuilder5 = new StringBuilder(s5); for (int i = 40001; i <= 60000; i++) { insertBuilder5.append("(").append(i).append(",").append(5.0f).append(")"); @@ -456,23 +456,23 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw for (int i = 0; i < 400; i++) { // Delete from s1: every 10th point starting from 10 TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s1 WHERE time = " + (10 + i * 10)); + senderEnv, "DELETE FROM root.db1.d1.s1 WHERE time = " + (10 + i * 10)); // Delete from s2: every 10th point starting from 10010 TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s2 WHERE time = " + (10010 + i * 10)); + senderEnv, "DELETE FROM root.db1.d1.s2 WHERE time = " + (10010 + i * 10)); // Delete from s3: every 10th point starting from 20010 TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s3 WHERE time = " + (20010 + i * 10)); + senderEnv, "DELETE FROM root.db1.d1.s3 WHERE time = " + (20010 + i * 10)); // Delete from s4: every 10th point starting from 30010 TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s4 WHERE time = " + (30010 + i * 10)); + senderEnv, "DELETE FROM root.db1.d1.s4 WHERE time = " + (30010 + i * 10)); // Delete from s5: every 10th point starting from 40010 TestUtils.executeNonQueryWithRetry( - senderEnv, "DELETE FROM root.sg1.d1.s5 WHERE time = " + (40010 + i * 10)); + senderEnv, "DELETE FROM root.db1.d1.s5 WHERE time = " + (40010 + i * 10)); } TestUtils.executeNonQueryWithRetry(senderEnv, "FLUSH"); @@ -482,8 +482,8 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw // before starting the pipe synchronization process TestUtils.assertDataEventuallyOnEnv( senderEnv, - "SELECT COUNT(**) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s3),COUNT(root.sg1.d1.s4),COUNT(root.sg1.d1.s5),COUNT(root.sg1.d1.s1),COUNT(root.sg1.d1.s2),", + "SELECT COUNT(**) FROM root.db1.d1", + "COUNT(root.db1.d1.s3),COUNT(root.db1.d1.s4),COUNT(root.db1.d1.s5),COUNT(root.db1.d1.s1),COUNT(root.db1.d1.s2),", Collections.singleton("19600,19600,19600,19600,19600,")); executeNonQueryWithRetry( @@ -496,165 +496,165 @@ public void testTsFileDecompositionWithModsLargeScaleSinglePointDeletion() throw // Verify total count of all sensors using COUNT(*) TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(**) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s3),COUNT(root.sg1.d1.s4),COUNT(root.sg1.d1.s5),COUNT(root.sg1.d1.s1),COUNT(root.sg1.d1.s2),", + "SELECT COUNT(**) FROM root.db1.d1", + "COUNT(root.db1.d1.s3),COUNT(root.db1.d1.s4),COUNT(root.db1.d1.s5),COUNT(root.db1.d1.s1),COUNT(root.db1.d1.s2),", Collections.singleton("19600,19600,19600,19600,19600,")); // Verify individual sensor counts TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s1) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s1),", + "SELECT COUNT(s1) FROM root.db1.d1", + "COUNT(root.db1.d1.s1),", Collections.singleton("19600,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s2) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s2),", + "SELECT COUNT(s2) FROM root.db1.d1", + "COUNT(root.db1.d1.s2),", Collections.singleton("19600,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s3) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s3),", + "SELECT COUNT(s3) FROM root.db1.d1", + "COUNT(root.db1.d1.s3),", Collections.singleton("19600,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s4) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s4),", + "SELECT COUNT(s4) FROM root.db1.d1", + "COUNT(root.db1.d1.s4),", Collections.singleton("19600,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s5) FROM root.sg1.d1", - "COUNT(root.sg1.d1.s5),", + "SELECT COUNT(s5) FROM root.db1.d1", + "COUNT(root.db1.d1.s5),", Collections.singleton("19600,")); // Verify count of deleted time ranges using COUNT with WHERE clause // These should return 0 since all points in these ranges were deleted TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s1) FROM root.sg1.d1 WHERE time >= 10 AND time <= 4000 AND time % 10 = 0", - "COUNT(root.sg1.d1.s1),", + "SELECT COUNT(s1) FROM root.db1.d1 WHERE time >= 10 AND time <= 4000 AND time % 10 = 0", + "COUNT(root.db1.d1.s1),", Collections.singleton("0,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s2) FROM root.sg1.d1 WHERE time >= 10010 AND time <= 14000 AND time % 10 = 0", - "COUNT(root.sg1.d1.s2),", + "SELECT COUNT(s2) FROM root.db1.d1 WHERE time >= 10010 AND time <= 14000 AND time % 10 = 0", + "COUNT(root.db1.d1.s2),", Collections.singleton("0,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s3) FROM root.sg1.d1 WHERE time >= 20010 AND time <= 24000 AND time % 10 = 0", - "COUNT(root.sg1.d1.s3),", + "SELECT COUNT(s3) FROM root.db1.d1 WHERE time >= 20010 AND time <= 24000 AND time % 10 = 0", + "COUNT(root.db1.d1.s3),", Collections.singleton("0,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s4) FROM root.sg1.d1 WHERE time >= 30010 AND time <= 34000 AND time % 10 = 0", - "COUNT(root.sg1.d1.s4),", + "SELECT COUNT(s4) FROM root.db1.d1 WHERE time >= 30010 AND time <= 34000 AND time % 10 = 0", + "COUNT(root.db1.d1.s4),", Collections.singleton("0,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s5) FROM root.sg1.d1 WHERE time >= 40010 AND time <= 44000 AND time % 10 = 0", - "COUNT(root.sg1.d1.s5),", + "SELECT COUNT(s5) FROM root.db1.d1 WHERE time >= 40010 AND time <= 44000 AND time % 10 = 0", + "COUNT(root.db1.d1.s5),", Collections.singleton("0,")); // Verify count of non-deleted time ranges using multiple range queries // Check ranges before deletion area TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s1) FROM root.sg1.d1 WHERE time >= 1 AND time < 10", - "COUNT(root.sg1.d1.s1),", + "SELECT COUNT(s1) FROM root.db1.d1 WHERE time >= 1 AND time < 10", + "COUNT(root.db1.d1.s1),", Collections.singleton("9,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s2) FROM root.sg1.d1 WHERE time >= 10001 AND time < 10010", - "COUNT(root.sg1.d1.s2),", + "SELECT COUNT(s2) FROM root.db1.d1 WHERE time >= 10001 AND time < 10010", + "COUNT(root.db1.d1.s2),", Collections.singleton("9,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s3) FROM root.sg1.d1 WHERE time >= 20001 AND time < 20010", - "COUNT(root.sg1.d1.s3),", + "SELECT COUNT(s3) FROM root.db1.d1 WHERE time >= 20001 AND time < 20010", + "COUNT(root.db1.d1.s3),", Collections.singleton("9,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s4) FROM root.sg1.d1 WHERE time >= 30001 AND time < 30010", - "COUNT(root.sg1.d1.s4),", + "SELECT COUNT(s4) FROM root.db1.d1 WHERE time >= 30001 AND time < 30010", + "COUNT(root.db1.d1.s4),", Collections.singleton("9,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s5) FROM root.sg1.d1 WHERE time >= 40001 AND time < 40010", - "COUNT(root.sg1.d1.s5),", + "SELECT COUNT(s5) FROM root.db1.d1 WHERE time >= 40001 AND time < 40010", + "COUNT(root.db1.d1.s5),", Collections.singleton("9,")); // Check ranges after deletion area TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s1) FROM root.sg1.d1 WHERE time > 4000 AND time <= 20000", - "COUNT(root.sg1.d1.s1),", + "SELECT COUNT(s1) FROM root.db1.d1 WHERE time > 4000 AND time <= 20000", + "COUNT(root.db1.d1.s1),", Collections.singleton("16000,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s2) FROM root.sg1.d1 WHERE time > 14000 AND time <= 30000", - "COUNT(root.sg1.d1.s2),", + "SELECT COUNT(s2) FROM root.db1.d1 WHERE time > 14000 AND time <= 30000", + "COUNT(root.db1.d1.s2),", Collections.singleton("16000,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s3) FROM root.sg1.d1 WHERE time > 24000 AND time <= 40000", - "COUNT(root.sg1.d1.s3),", + "SELECT COUNT(s3) FROM root.db1.d1 WHERE time > 24000 AND time <= 40000", + "COUNT(root.db1.d1.s3),", Collections.singleton("16000,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s4) FROM root.sg1.d1 WHERE time > 34000 AND time <= 50000", - "COUNT(root.sg1.d1.s4),", + "SELECT COUNT(s4) FROM root.db1.d1 WHERE time > 34000 AND time <= 50000", + "COUNT(root.db1.d1.s4),", Collections.singleton("16000,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s5) FROM root.sg1.d1 WHERE time > 44000 AND time <= 60000", - "COUNT(root.sg1.d1.s5),", + "SELECT COUNT(s5) FROM root.db1.d1 WHERE time > 44000 AND time <= 60000", + "COUNT(root.db1.d1.s5),", Collections.singleton("16000,")); // Check non-deleted points within deletion range (every 10th point except the ones we deleted) TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s1) FROM root.sg1.d1 WHERE time >= 10 AND time <= 4000 AND time % 10 != 0", - "COUNT(root.sg1.d1.s1),", + "SELECT COUNT(s1) FROM root.db1.d1 WHERE time >= 10 AND time <= 4000 AND time % 10 != 0", + "COUNT(root.db1.d1.s1),", Collections.singleton("3591,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s2) FROM root.sg1.d1 WHERE time >= 10010 AND time <= 14000 AND time % 10 != 0", - "COUNT(root.sg1.d1.s2),", + "SELECT COUNT(s2) FROM root.db1.d1 WHERE time >= 10010 AND time <= 14000 AND time % 10 != 0", + "COUNT(root.db1.d1.s2),", Collections.singleton("3591,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s3) FROM root.sg1.d1 WHERE time >= 20010 AND time <= 24000 AND time % 10 != 0", - "COUNT(root.sg1.d1.s3),", + "SELECT COUNT(s3) FROM root.db1.d1 WHERE time >= 20010 AND time <= 24000 AND time % 10 != 0", + "COUNT(root.db1.d1.s3),", Collections.singleton("3591,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s4) FROM root.sg1.d1 WHERE time >= 30010 AND time <= 34000 AND time % 10 != 0", - "COUNT(root.sg1.d1.s4),", + "SELECT COUNT(s4) FROM root.db1.d1 WHERE time >= 30010 AND time <= 34000 AND time % 10 != 0", + "COUNT(root.db1.d1.s4),", Collections.singleton("3591,")); TestUtils.assertDataEventuallyOnEnv( receiverEnv, - "SELECT COUNT(s5) FROM root.sg1.d1 WHERE time >= 40010 AND time <= 44000 AND time % 10 != 0", - "COUNT(root.sg1.d1.s5),", + "SELECT COUNT(s5) FROM root.db1.d1 WHERE time >= 40010 AND time <= 44000 AND time % 10 != 0", + "COUNT(root.db1.d1.s5),", Collections.singleton("3591,")); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/triple/IoTDBPipeForwardIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/triple/IoTDBPipeForwardIT.java index 25019a705f6dd..ad639c4101622 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/triple/IoTDBPipeForwardIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/triple/IoTDBPipeForwardIT.java @@ -104,14 +104,14 @@ public void testForwardingPipeRequests() throws Exception { TestUtils.executeNonQueries( env1, Arrays.asList( - "create database root.sg", - "create timeseries root.sg.wf01.GPS.status0 with datatype=BOOLEAN,encoding=PLAIN", - "insert into root.sg.wf01.GPS (time, status0) values (0, 1)"), + "create database root.db", + "create timeseries root.db.wf01.GPS.status0 with datatype=BOOLEAN,encoding=PLAIN", + "insert into root.db.wf01.GPS (time, status0) values (0, 1)"), null); TestUtils.assertDataEventuallyOnEnv( env3, - "select status0 from root.sg.**", - "Time,root.sg.wf01.GPS.status0,", + "select status0 from root.db.**", + "Time,root.db.wf01.GPS.status0,", Collections.singleton("0,true,")); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBCaseWhenThenTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBCaseWhenThenTableIT.java index cda57e726ea9d..a1d18062153e6 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBCaseWhenThenTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBCaseWhenThenTableIT.java @@ -435,7 +435,7 @@ public void testKind2UseOtherOperation() { @Test @Ignore public void testKind1Wildcard() { - String sql = "select case when *=* then * else * end from root.sg.d2"; + String sql = "select case when *=* then * else * end from root.db.d2"; String[] expectedHeaders = new String[16]; for (int i = 0; i < expectedHeaders.length; i++) { expectedHeaders[i] = "_col" + i; @@ -501,10 +501,10 @@ public void testKind1AlignedByDevice() { tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE); // from same device - sql = "select case when s3<=11 then s3 else s4 end from table1, root.sg.d2 align by device"; + sql = "select case when s3<=11 then s3 else s4 end from table1, root.db.d2 align by device"; retArray = new String[] { - "root.sg.d2,0.0,", "root.sg.d2,11.0,", "root.sg.d2,66.0,", "root.sg.d2,77.0,", + "root.db.d2,0.0,", "root.db.d2,11.0,", "root.db.d2,66.0,", "root.db.d2,77.0,", }; tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE); @@ -521,10 +521,10 @@ public void testKind1AlignedByDevice() { "table1,11.0,null,", "table1,44.0,null,", "table1,66.0,null,", - "root.sg.d2,null,0.0,", - "root.sg.d2,null,11.0,", - "root.sg.d2,null,66.0,", - "root.sg.d2,null,77.0,", + "root.db.d2,null,0.0,", + "root.db.d2,null,11.0,", + "root.db.d2,null,66.0,", + "root.db.d2,null,77.0,", }; tableResultSetEqualTest(sql, new String[] {"_col0", "_col1"}, retArray, DATABASE); } @@ -538,7 +538,7 @@ public void testKind2AlignedByDevice() { tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE); // from same device - sql = "select case s3 when 11 then s3 else s4 end from table1, root.sg.d2 align by device"; + sql = "select case s3 when 11 then s3 else s4 end from table1, root.db.d2 align by device"; retArray = new String[] { "table2,44.0,", "table2,11.0,", "table2,66.0,", "table2,77.0,", @@ -550,17 +550,17 @@ public void testKind2AlignedByDevice() { "select " + "case s1 when 11 then s1 else s1*2 end, " + "case s3 when 11 then s3 else s4 end " - + "from table1, root.sg.d2 align by device"; + + "from table1, root.db.d2 align by device"; retArray = new String[] { "0,table1,0.0,null,", "1000000,table1,11.0,null,", "20000000,table1,44.0,null,", "210000000,table1,66.0,null,", - "0,root.sg.d2,null,44.0,", - "1000000,root.sg.d2,null,11.0,", - "20000000,root.sg.d2,null,66.0,", - "210000000,root.sg.d2,null,77.0,", + "0,root.db.d2,null,44.0,", + "1000000,root.db.d2,null,11.0,", + "20000000,root.db.d2,null,66.0,", + "210000000,root.db.d2,null,77.0,", }; resultSetEqualTest(sql, expectedHeader, retArray); } @@ -610,7 +610,7 @@ public void testKind2MultipleTimeseries() { "select " + "case s2%2 when 1 then s2 else s2/2 end, " + "case s3 when 11 then s3 else s4 end " - + "from table1, root.sg.d2 limit 5 offset 98"; + + "from table1, root.db.d2 limit 5 offset 98"; retArray = new String[] { "49.0,null,", "99.0,null,", "null,11.0,", "null,66.0,", "null,77.0,", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterTableIT.java index 7ecc9673b2344..ddde07b8d2a7e 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterTableIT.java @@ -201,10 +201,10 @@ public void testMismatchedDataTypes() { DATABASE_NAME); // TODO After Aggregation supported /*assertTestFail( - "select count(s1) from root.sg1.d1 group by ([0, 40), 5ms) having count(s1) + 1;", + "select count(s1) from root.db1.d1 group by ([0, 40), 5ms) having count(s1) + 1;", "The output type of the expression in HAVING clause should be BOOLEAN, actual data type: DOUBLE."); assertTestFail( - "select count(s1) from root.sg1.d1 group by ([0, 40), 5ms) having count(s1) + 1 align by device;", + "select count(s1) from root.db1.d1 group by ([0, 40), 5ms) having count(s1) + 1 align by device;", "The output type of the expression in HAVING clause should be BOOLEAN, actual data type: DOUBLE.");*/ } diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBSimpleQueryTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBSimpleQueryTableIT.java index 57a187950e27b..f9fd74a18f03a 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBSimpleQueryTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBSimpleQueryTableIT.java @@ -356,12 +356,12 @@ public void testDescribeWithLimitOffset() throws SQLException { public void testShowDevicesWithLimitOffset() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d1(timestamp, s2) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d2(timestamp, s3) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d3(timestamp, s4) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d1(timestamp, s2) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d2(timestamp, s3) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d3(timestamp, s4) VALUES (5, 5)"); - List exps = Arrays.asList("root.sg1.d1,false", "root.sg1.d2,false"); + List exps = Arrays.asList("root.db1.d1,false", "root.db1.d2,false"); int count = 0; try (ResultSet resultSet = statement.executeQuery("show devices limit 2 offset 1")) { while (resultSet.next()) { @@ -380,12 +380,12 @@ public void testShowDevicesWithLimit() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { - List exps = Arrays.asList("root.sg1.d0,false", "root.sg1.d1,false"); + List exps = Arrays.asList("root.db1.d0,false", "root.db1.d1,false"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d1(timestamp, s2) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d2(timestamp, s3) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d3(timestamp, s4) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d1(timestamp, s2) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d2(timestamp, s3) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d3(timestamp, s4) VALUES (5, 5)"); int count = 0; try (ResultSet resultSet = statement.executeQuery("show devices limit 2")) { diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedSeriesQueryTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedSeriesQueryTableIT.java index 8ddb2a6223243..ed2b382249c70 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedSeriesQueryTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/aligned/IoTDBAlignedSeriesQueryTableIT.java @@ -913,7 +913,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { try (Connection connection = EnvFactory.getEnv().getTableConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2138,7 +2138,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.* align by device")) { + statement.executeQuery("select count(*) from root.db1.* align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2617,7 +2617,7 @@ public void groupByWithNonAlignedTimeseriesAlignByDeviceTest() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.* " + "select count(s1), sum(s2), avg(s1) from root.db1.* " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -2902,7 +2902,7 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -2928,7 +2928,7 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = @@ -3158,7 +3158,7 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -3189,7 +3189,7 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = @@ -3393,7 +3393,7 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -3415,7 +3415,7 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 " + + "from root.db1 where time > 5 and time < 38 " + "GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/orderBy/IoTDBOrderByTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/orderBy/IoTDBOrderByTableIT.java index 9f4f78011020f..138c07d3b75e7 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/orderBy/IoTDBOrderByTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/orderBy/IoTDBOrderByTableIT.java @@ -446,7 +446,7 @@ public void orderByTest19() { @Ignore @Test public void orderByInAggregationTest() { - String sql = "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc"; + String sql = "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc"; double[][] ans = new double[][] {{15.0}, {13.0}, {13.0}, {11.0}, {6.4}, {4.6}}; long[] times = new long[] {51536000000L, 41536000000L, 41536900000L, 31536100000L, 31536000000L, 0L}; @@ -473,7 +473,7 @@ public void orderByInAggregationTest() { @Test public void orderByInAggregationTest2() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12}, @@ -508,7 +508,7 @@ public void orderByInAggregationTest2() { @Test public void orderByInAggregationTest3() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; double[] ans = new double[] {15.0, 13.0, 13.0, 11.0, 6.4, 4.6}; long[] times = new long[] {51536000000L, 41536900000L, 41536000000L, 31536100000L, 31536000000L, 0L}; @@ -535,7 +535,7 @@ public void orderByInAggregationTest3() { @Test public void orderByInAggregationTest4() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -564,7 +564,7 @@ public void orderByInAggregationTest4() { @Test public void orderByInAggregationTest5() { String sql = - "select min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483646L, 2147483650L, 2147468648L, 2146483648L, 2107483648L, 3147483648L}; long[] times = @@ -593,7 +593,7 @@ public void orderByInAggregationTest5() { @Test public void orderByInAggregationTest6() { String sql = - "select min_value(num)+min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(num)+min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483647L, 2147483654L, 2147468659L, 2146483660L, 2107483661L, 3147483663L}; long[] times = @@ -622,7 +622,7 @@ public void orderByInAggregationTest6() { @Test public void orderByInAggregationTest7() { String sql = - "select avg(num)+min_value(floatNum) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num)+min_value(floatNum) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12, 54.12}, @@ -657,7 +657,7 @@ public void orderByInAggregationTest7() { @Test public void orderByInAggregationTest8() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(floatNum)+avg(num)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(floatNum)+avg(num)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -1053,18 +1053,18 @@ public void orderByInAggregationAlignByDeviceTest() { }; String[] device = new String[] { - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d", - "root.sg.d2", - "root.sg.d2", - "root.sg.d", - "root.sg.d2" + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d", + "root.db.d2", + "root.db.d2", + "root.db.d", + "root.db.d2" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -1097,8 +1097,8 @@ public void orderByInAggregationAlignByDeviceTest2() { } private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { - String device = "root.sg.d"; - if (!deviceAsc) device = "root.sg.d2"; + String device = "root.db.d"; + if (!deviceAsc) device = "root.db.d2"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { @@ -1108,8 +1108,8 @@ private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { double actualVal = resultSet.getDouble(2); assertEquals(deviceName, device); assertEquals(Double.parseDouble(value.toString()), actualVal, 1); - if (device.equals("root.sg.d")) device = "root.sg.d2"; - else device = "root.sg.d"; + if (device.equals("root.db.d")) device = "root.db.d2"; + else device = "root.db.d"; i++; } assertEquals(i, 2); @@ -1286,7 +1286,7 @@ private void orderByUDFTest(String sql, int[] ans) { @Test public void orderByUDFTest1() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; int[] ans = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 11, 12, 14}; orderByUDFTest(sql, ans); } @@ -1295,7 +1295,7 @@ public void orderByUDFTest1() { @Test public void orderByUDFTest2() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; int[] ans = {12, 14, 13, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; orderByUDFTest(sql, ans); } @@ -1313,7 +1313,7 @@ private void errorTest(String sql, String error) { @Test public void errorTest1() { errorTest( - "select num from root.sg.d order by avg(bigNum)", + "select num from root.db.d order by avg(bigNum)", "701: Raw data and aggregation hybrid query is not supported."); } @@ -1321,7 +1321,7 @@ public void errorTest1() { @Test public void errorTest2() { errorTest( - "select avg(num) from root.sg.d order by bigNum", + "select avg(num) from root.db.d order by bigNum", "701: Raw data and aggregation hybrid query is not supported."); } @@ -1344,8 +1344,8 @@ public void errorTest4() { @Test public void errorTest7() { errorTest( - "select last bigNum,floatNum from root.** order by root.sg.d.bigNum", - "701: root.sg.d.bigNum in order by clause doesn't exist in the result of last query."); + "select last bigNum,floatNum from root.** order by root.db.d.bigNum", + "701: root.db.d.bigNum in order by clause doesn't exist in the result of last query."); } // last query @@ -1381,7 +1381,7 @@ public void lastQueryOrderBy() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d.num", "root.sg.d2.num", "root.sg.d.bigNum", "root.sg.d2.bigNum"}, + {"root.db.d.num", "root.db.d2.num", "root.db.d.bigNum", "root.db.d2.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1395,7 +1395,7 @@ public void lastQueryOrderBy2() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1409,7 +1409,7 @@ public void lastQueryOrderBy3() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1423,7 +1423,7 @@ public void lastQueryOrderBy4() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1437,7 +1437,7 @@ public void lastQueryOrderBy5() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java index 27d14c0e1fccb..28b66e941560d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNoSelectExpressionAfterAnalyzedTableIT.java @@ -73,7 +73,7 @@ public void testAlignByDevice() { // mix test /* expectedHeader = new String[] {DEVICE, count(s1), count(s2)}; - retArray = new String[] {"sg,1,null,", "root.sg.d2,1,1,"}; + retArray = new String[] {"sg,1,null,", "root.db.d2,1,1,"}; tableResultSetEqualTest( "select count(s1), count(s2) from sg where s1>0 order by device", expectedHeader, diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBFilterTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBFilterTableViewIT.java index 1f6bacf097177..3eb53acc7f791 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBFilterTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBFilterTableViewIT.java @@ -117,7 +117,7 @@ private static void generateData() { } } statement.execute( - " insert into root.sg1.d1(time, s1, s2) aligned values (1,1, \"1\"), (2,2,\"2\")"); + " insert into root.db1.d1(time, s1, s2) aligned values (1,1, \"1\"), (2,2,\"2\")"); statement.execute( " insert into root.vehicle.testUDTF.d1(time, s1, s2) values (1,\"ss\",0), (2,\"d\",3)"); } catch (SQLException throwable) { @@ -137,7 +137,7 @@ private static void createTableView() { statement.execute( "CREATE VIEW testUDTF(device STRING TAG, s1 TEXT FIELD, s2 DOUBLE FIELD) as root.vehicle.testUDTF.**"); statement.execute( - "CREATE VIEW sg1(device STRING TAG, s1 DOUBLE FIELD, s2 TEXT FIELD) as root.sg1.**"); + "CREATE VIEW sg1(device STRING TAG, s1 DOUBLE FIELD, s2 TEXT FIELD) as root.db1.**"); } catch (SQLException throwable) { fail(throwable.getMessage()); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBSimpleQueryTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBSimpleQueryTableViewIT.java index 91f4998ac537b..293203e9b206c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBSimpleQueryTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/IoTDBSimpleQueryTableViewIT.java @@ -73,8 +73,8 @@ public void testCreateTimeseries1() { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); } catch (SQLException e) { e.printStackTrace(); @@ -84,7 +84,7 @@ public void testCreateTimeseries1() { statement.setFetchSize(5); statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute("CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD) as root.sg1.**"); + statement.execute("CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD) as root.db1.**"); try (ResultSet resultSet = statement.executeQuery("describe table1")) { if (resultSet.next() @@ -105,15 +105,15 @@ public void testOrderByTimeDesc() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TREE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (2, 2)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (3, 3)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (4, 4)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (3, 3)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s1) VALUES (1, 1)"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (2, 2)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (3, 3)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (4, 4)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (3, 3)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s1) VALUES (1, 1)"); statement.execute("flush"); } try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); @@ -122,7 +122,7 @@ public void testOrderByTimeDesc() throws Exception { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD, s1 INT32 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD, s1 INT32 FIELD) as root.db1.**"); statement.execute("flush"); String[] expectedHeader = new String[] {"time", "device", "s0", "s1"}; @@ -145,17 +145,17 @@ public void testShowTimeseriesDataSet1() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TREE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.setFetchSize(5); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); } @@ -165,7 +165,7 @@ public void testShowTimeseriesDataSet1() throws SQLException { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.db1.**"); int count = 0; try (ResultSet resultSet = statement.executeQuery("describe table1")) { @@ -187,17 +187,17 @@ public void testShowTimeseriesDataSet2() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(10); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); } @@ -207,7 +207,7 @@ public void testShowTimeseriesDataSet2() throws SQLException { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.db1.**"); statement.execute("flush"); @@ -231,17 +231,17 @@ public void testShowTimeseriesDataSet3() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.setFetchSize(15); - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s2 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s3 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s4 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s5 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s6 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s7 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s8 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s9 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s10 WITH DATATYPE=INT32,ENCODING=PLAIN"); statement.execute("flush"); } @@ -251,7 +251,7 @@ public void testShowTimeseriesDataSet3() throws SQLException { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 INT32 FIELD, s3 INT32 FIELD, s4 INT32 FIELD, s5 INT32 FIELD, s6 INT32 FIELD, s7 INT32 FIELD, s8 INT32 FIELD, s9 INT32 FIELD, s10 INT32 FIELD) as root.db1.**"); statement.execute("flush"); @@ -275,24 +275,24 @@ public void testFirstOverlappedPageFiltered() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); // seq chunk : [1,10] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (10, 10)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (10, 10)"); statement.execute("flush"); // seq chunk : [13,20] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (13, 13)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (20, 20)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (13, 13)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (20, 20)"); statement.execute("flush"); // unseq chunk : [5,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 15)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 15)"); statement.execute("flush"); } @@ -300,7 +300,7 @@ public void testFirstOverlappedPageFiltered() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute("CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD) as root.sg1.**"); + statement.execute("CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD) as root.db1.**"); long count = 0; try (ResultSet resultSet = statement.executeQuery("select s0 from table1 where s0 > 18")) { @@ -317,12 +317,12 @@ public void testFirstOverlappedPageFiltered() throws SQLException { public void testPartialInsertion() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT32,ENCODING=PLAIN"); try { - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0, s1) VALUES (1, 1, 2.2)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0, s1) VALUES (1, 1, 2.2)"); fail(); } catch (SQLException e) { assertTrue(e.getMessage().contains("s1")); @@ -333,7 +333,7 @@ public void testPartialInsertion() throws SQLException { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD, s1 INT32 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD, s1 INT32 FIELD) as root.db1.**"); try (ResultSet resultSet = statement.executeQuery("select s0, s1 from table1")) { while (resultSet.next()) { @@ -349,28 +349,28 @@ public void testOverlappedPagesMerge() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); - statement.execute("CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); + statement.execute("CREATE DATABASE root.db1"); + statement.execute("CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT32,ENCODING=PLAIN"); // seq chunk : start-end [1000, 1000] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1000, 0)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1000, 0)"); statement.execute("flush"); // unseq chunk : [1,10] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (1, 1)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (10, 10)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (1, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (10, 10)"); statement.execute("flush"); // usneq chunk : [5,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (5, 5)"); - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 15)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (5, 5)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 15)"); statement.execute("flush"); // unseq chunk : [15,15] - statement.execute("INSERT INTO root.sg1.d0(timestamp, s0) VALUES (15, 150)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s0) VALUES (15, 150)"); statement.execute("flush"); } @@ -378,7 +378,7 @@ public void testOverlappedPagesMerge() throws SQLException { Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE " + DATABASE_NAME); statement.execute("USE " + DATABASE_NAME); - statement.execute("CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD) as root.sg1.**"); + statement.execute("CREATE VIEW table1(device STRING TAG, s0 INT32 FIELD) as root.db1.**"); long count = 0; @@ -397,13 +397,13 @@ public void testTimeseriesMetadataCache() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); for (int i = 0; i < 10000; i++) { statement.execute( - "CREATE TIMESERIES root.sg1.d0.s" + i + " WITH DATATYPE=INT32,ENCODING=PLAIN"); + "CREATE TIMESERIES root.db1.d0.s" + i + " WITH DATATYPE=INT32,ENCODING=PLAIN"); } for (int i = 1; i < 10000; i++) { - statement.execute("INSERT INTO root.sg1.d0(timestamp, s" + i + ") VALUES (1000, 1)"); + statement.execute("INSERT INTO root.db1.d0(timestamp, s" + i + ") VALUES (1000, 1)"); } statement.execute("flush"); } @@ -419,7 +419,7 @@ public void testTimeseriesMetadataCache() throws SQLException { } createTableBuilder .deleteCharAt(createTableBuilder.lastIndexOf(",")) - .append(") as root.sg1.**"); + .append(") as root.db1.**"); statement.execute(createTableBuilder.toString()); statement.executeQuery("select s0 from table1"); } catch (SQLException e) { @@ -432,26 +432,26 @@ public void testUseSameStatement() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d0.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d0.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s0 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); - statement.execute("insert into root.sg1.d0(timestamp,s0,s1) values(1,1,1)"); - statement.execute("insert into root.sg1.d1(timestamp,s0,s1) values(1000,1000,1000)"); - statement.execute("insert into root.sg1.d0(timestamp,s0,s1) values(10,10,10)"); + statement.execute("insert into root.db1.d0(timestamp,s0,s1) values(1,1,1)"); + statement.execute("insert into root.db1.d1(timestamp,s0,s1) values(1000,1000,1000)"); + statement.execute("insert into root.db1.d0(timestamp,s0,s1) values(10,10,10)"); } try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE test"); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s0 INT64 FIELD, s1 INT64 FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s0 INT64 FIELD, s1 INT64 FIELD) as root.db1.**"); List resultSetList = new ArrayList<>(); @@ -485,15 +485,15 @@ public void testUseSameStatement() throws SQLException { public void testEnableAlign() throws Exception { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT32"); - statement.execute("CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=BOOLEAN"); + statement.execute("CREATE TIMESERIES root.db1.d1.s1 WITH DATATYPE=INT32"); + statement.execute("CREATE TIMESERIES root.db1.d1.s2 WITH DATATYPE=BOOLEAN"); } try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE test"); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 BOOLEAN FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s1 INT32 FIELD, s2 BOOLEAN FIELD) as root.db1.**"); ResultSet resultSet = statement.executeQuery("select time, s1, s2 from table1"); ResultSetMetaData metaData = resultSet.getMetaData(); int[] types = {Types.TIMESTAMP, Types.INTEGER, Types.BOOLEAN}; @@ -510,19 +510,19 @@ public void testNewDataType() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { - statement.execute("CREATE DATABASE root.sg1"); + statement.execute("CREATE DATABASE root.db1"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s4 WITH DATATYPE=DATE, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s5 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s6 WITH DATATYPE=BLOB, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); statement.execute( - "CREATE TIMESERIES root.sg1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); + "CREATE TIMESERIES root.db1.d1.s7 WITH DATATYPE=STRING, ENCODING=PLAIN, COMPRESSOR=SNAPPY"); for (int i = 1; i <= 10; i++) { statement.execute( String.format( - "insert into root.sg1.d1(timestamp, s4, s5, s6, s7) values(%d, \"%s\", %d, %s, \"%s\")", + "insert into root.db1.d1(timestamp, s4, s5, s6, s7) values(%d, \"%s\", %d, %s, \"%s\")", i, LocalDate.of(2024, 5, i % 31 + 1), i, "X'cafebabe'", i)); } } @@ -531,7 +531,7 @@ public void testNewDataType() throws SQLException { statement.execute("CREATE DATABASE test"); statement.execute("USE " + DATABASE_NAME); statement.execute( - "CREATE VIEW table1(device STRING TAG, s4 DATE FIELD, s5 TIMESTAMP FIELD, s6 BLOB FIELD, s7 STRING FIELD) as root.sg1.**"); + "CREATE VIEW table1(device STRING TAG, s4 DATE FIELD, s5 TIMESTAMP FIELD, s6 BLOB FIELD, s7 STRING FIELD) as root.db1.**"); try (ResultSet resultSet = statement.executeQuery("select * from table1")) { final ResultSetMetaData metaData = resultSet.getMetaData(); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableViewIT.java index 668cd36a71a01..dcf603603b9a0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/alignbydevice/IoTDBAlignByDeviceWithTemplateTableViewIT.java @@ -49,29 +49,29 @@ public class IoTDBAlignByDeviceWithTemplateTableViewIT { private static final String[] sqls = new String[] { // non-aligned template - "CREATE database root.sg1;", + "CREATE database root.db1;", "CREATE schema template t1 (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t1 to root.sg1;", - "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", - "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", - "INSERT INTO root.sg1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", - "INSERT INTO root.sg1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", + "SET SCHEMA TEMPLATE t1 to root.db1;", + "INSERT INTO root.db1.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", + "INSERT INTO root.db1.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", + "INSERT INTO root.db1.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", + "INSERT INTO root.db1.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", // aligned template - "CREATE database root.sg2;", + "CREATE database root.db2;", "CREATE schema template t2 aligned (s1 FLOAT encoding=RLE, s2 BOOLEAN encoding=PLAIN compression=SNAPPY, s3 INT32);", - "SET SCHEMA TEMPLATE t2 to root.sg2;", - "INSERT INTO root.sg2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", - "INSERT INTO root.sg2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", - "INSERT INTO root.sg2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", - "INSERT INTO root.sg2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", + "SET SCHEMA TEMPLATE t2 to root.db2;", + "INSERT INTO root.db2.d1(timestamp,s1,s2,s3) values(1,1.1,false,1), (2,2.2,false,2);", + "INSERT INTO root.db2.d2(timestamp,s1,s2,s3) values(1,11.1,false,11), (2,22.2,false,22);", + "INSERT INTO root.db2.d3(timestamp,s1,s2,s3) values(1,111.1,true,null), (4,444.4,true,44);", + "INSERT INTO root.db2.d4(timestamp,s1,s2,s3) values(1,1111.1,true,1111), (5,5555.5,false,5555);", }; private static final String[] createTableViewSqls = new String[] { "CREATE database " + DATABASE_NAME, "use " + DATABASE_NAME, - "create view table1(device_id STRING TAG, s1 FLOAT FIELD, s2 BOOLEAN FIELD, s3 INT32 FIELD) as root.sg2.**", + "create view table1(device_id STRING TAG, s1 FLOAT FIELD, s2 BOOLEAN FIELD, s3 INT32 FIELD) as root.db2.**", }; @BeforeClass diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/IoTDBAlignedSeriesQueryTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/IoTDBAlignedSeriesQueryTableViewIT.java index 34051a1d26260..daef532c9d6c0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/IoTDBAlignedSeriesQueryTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/IoTDBAlignedSeriesQueryTableViewIT.java @@ -913,7 +913,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterTest() { try (Connection connection = EnvFactory.getEnv().getTableConnection(); Statement statement = connection.createStatement()) { - try (ResultSet resultSet = statement.executeQuery("select count(*) from root.sg1.*")) { + try (ResultSet resultSet = statement.executeQuery("select count(*) from root.db1.*")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2138,7 +2138,7 @@ public void countAllAlignedAndNonAlignedWithoutTimeFilterAlignByDeviceTest() { Statement statement = connection.createStatement()) { try (ResultSet resultSet = - statement.executeQuery("select count(*) from root.sg1.* align by device")) { + statement.executeQuery("select count(*) from root.db1.* align by device")) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); Map map = new HashMap<>(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { @@ -2617,7 +2617,7 @@ public void groupByWithNonAlignedTimeseriesAlignByDeviceTest() throws SQLExcepti int cnt; try (ResultSet resultSet = statement.executeQuery( - "select count(s1), sum(s2), avg(s1) from root.sg1.* " + "select count(s1), sum(s2), avg(s1) from root.db1.* " + "where time > 5 GROUP BY ([1, 41), 4ms, 6ms) align by device")) { cnt = 0; while (resultSet.next()) { @@ -2902,7 +2902,7 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -2928,7 +2928,7 @@ public void countSumAvgGroupByWithNonAlignedTimeseriesTest() throws SQLException try (ResultSet resultSet = statement.executeQuery( "select count(d1.s1), sum(d2.s2), avg(d2.s1), count(d1.s3), sum(d1.s2), avg(d2.s3) " - + "from root.sg1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = @@ -3158,7 +3158,7 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -3189,7 +3189,7 @@ public void maxMinValueTimeGroupByWithNonAlignedTimeseriesTest() throws SQLExcep statement.executeQuery( "select max_value(d2.s3), min_value(d1.s1), max_time(d2.s2), min_time(d1.s3), " + "max_value(d1.s3), min_value(d2.s1), max_time(d1.s2), min_time(d2.s3) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { String ans = @@ -3393,7 +3393,7 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { + + "from root.db1 where time > 5 and time < 38 GROUP BY ([1, 41), 4ms, 6ms)")) { cnt = 0; while (resultSet.next()) { String ans = @@ -3415,7 +3415,7 @@ public void firstLastGroupByWithNonAlignedTimeseriesTest() throws SQLException { try (ResultSet resultSet = statement.executeQuery( "select last_value(d2.s5), first_value(d1.s4), last_value(d1.s5), first_value(d2.s4) " - + "from root.sg1 where time > 5 and time < 38 " + + "from root.db1 where time > 5 and time < 38 " + "GROUP BY ([1, 41), 4ms, 6ms) order by time desc")) { cnt = retArray.length; while (resultSet.next()) { diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/TableViewUtils.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/TableViewUtils.java index 656f1b24fafea..63cd1ae9b1a81 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/TableViewUtils.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/aligned/TableViewUtils.java @@ -44,104 +44,104 @@ public class TableViewUtils { private static final String[] sqls = new String[] { - "CREATE DATABASE root.sg1", - "create aligned timeseries root.sg1.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64, s4 BOOLEAN, s5 TEXT)", - "create timeseries root.sg1.d2.s1 WITH DATATYPE=FLOAT, encoding=RLE", - "create timeseries root.sg1.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", - "create timeseries root.sg1.d2.s3 WITH DATATYPE=INT64", - "create timeseries root.sg1.d2.s4 WITH DATATYPE=BOOLEAN", - "create timeseries root.sg1.d2.s5 WITH DATATYPE=TEXT", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(1, 1.0, 1, 1, TRUE, 'aligned_test1')", - "insert into root.sg1.d1(time, s1, s2, s3, s5) aligned values(2, 2.0, 2, 2, 'aligned_test2')", - "insert into root.sg1.d1(time, s1, s3, s4, s5) aligned values(3, 3.0, 3, FALSE, 'aligned_test3')", - "insert into root.sg1.d1(time, s1, s2, s4, s5) aligned values(4, 4.0, 4, TRUE, 'aligned_test4')", - "insert into root.sg1.d1(time, s1, s2, s4, s5) aligned values(5, 5.0, 5, TRUE, 'aligned_test5')", - "insert into root.sg1.d1(time, s1, s2, s3, s4) aligned values(6, 6.0, 6, 6, TRUE)", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(7, 7.0, 7, 7, FALSE, 'aligned_test7')", - "insert into root.sg1.d1(time, s1, s2, s3, s5) aligned values(8, 8.0, 8, 8, 'aligned_test8')", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(9, 9.0, 9, 9, FALSE, 'aligned_test9')", - "insert into root.sg1.d1(time, s2, s3, s4, s5) aligned values(10, 10, 10, TRUE, 'aligned_test10')", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(1, 1.0, 1, 1, TRUE, 'non_aligned_test1')", - "insert into root.sg1.d2(time, s1, s2, s3, s5) values(2, 2.0, 2, 2, 'non_aligned_test2')", - "insert into root.sg1.d2(time, s1, s3, s4, s5) values(3, 3.0, 3, FALSE, 'non_aligned_test3')", - "insert into root.sg1.d2(time, s1, s2, s4, s5) values(4, 4.0, 4, TRUE, 'non_aligned_test4')", - "insert into root.sg1.d2(time, s1, s2, s4, s5) values(5, 5.0, 5, TRUE, 'non_aligned_test5')", - "insert into root.sg1.d2(time, s1, s2, s3, s4) values(6, 6.0, 6, 6, TRUE)", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(7, 7.0, 7, 7, FALSE, 'non_aligned_test7')", - "insert into root.sg1.d2(time, s1, s2, s3, s5) values(8, 8.0, 8, 8, 'non_aligned_test8')", - "insert into root.sg1.d2(time, s1, s2, s3, s4, s5) values(9, 9.0, 9, 9, FALSE, 'non_aligned_test9')", - "insert into root.sg1.d2(time, s2, s3, s4, s5) values(10, 10, 10, TRUE, 'non_aligned_test10')", + "CREATE DATABASE root.db1", + "create aligned timeseries root.db1.d1(s1 FLOAT encoding=RLE, s2 INT32 encoding=Gorilla compression=SNAPPY, s3 INT64, s4 BOOLEAN, s5 TEXT)", + "create timeseries root.db1.d2.s1 WITH DATATYPE=FLOAT, encoding=RLE", + "create timeseries root.db1.d2.s2 WITH DATATYPE=INT32, encoding=Gorilla", + "create timeseries root.db1.d2.s3 WITH DATATYPE=INT64", + "create timeseries root.db1.d2.s4 WITH DATATYPE=BOOLEAN", + "create timeseries root.db1.d2.s5 WITH DATATYPE=TEXT", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(1, 1.0, 1, 1, TRUE, 'aligned_test1')", + "insert into root.db1.d1(time, s1, s2, s3, s5) aligned values(2, 2.0, 2, 2, 'aligned_test2')", + "insert into root.db1.d1(time, s1, s3, s4, s5) aligned values(3, 3.0, 3, FALSE, 'aligned_test3')", + "insert into root.db1.d1(time, s1, s2, s4, s5) aligned values(4, 4.0, 4, TRUE, 'aligned_test4')", + "insert into root.db1.d1(time, s1, s2, s4, s5) aligned values(5, 5.0, 5, TRUE, 'aligned_test5')", + "insert into root.db1.d1(time, s1, s2, s3, s4) aligned values(6, 6.0, 6, 6, TRUE)", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(7, 7.0, 7, 7, FALSE, 'aligned_test7')", + "insert into root.db1.d1(time, s1, s2, s3, s5) aligned values(8, 8.0, 8, 8, 'aligned_test8')", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(9, 9.0, 9, 9, FALSE, 'aligned_test9')", + "insert into root.db1.d1(time, s2, s3, s4, s5) aligned values(10, 10, 10, TRUE, 'aligned_test10')", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(1, 1.0, 1, 1, TRUE, 'non_aligned_test1')", + "insert into root.db1.d2(time, s1, s2, s3, s5) values(2, 2.0, 2, 2, 'non_aligned_test2')", + "insert into root.db1.d2(time, s1, s3, s4, s5) values(3, 3.0, 3, FALSE, 'non_aligned_test3')", + "insert into root.db1.d2(time, s1, s2, s4, s5) values(4, 4.0, 4, TRUE, 'non_aligned_test4')", + "insert into root.db1.d2(time, s1, s2, s4, s5) values(5, 5.0, 5, TRUE, 'non_aligned_test5')", + "insert into root.db1.d2(time, s1, s2, s3, s4) values(6, 6.0, 6, 6, TRUE)", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(7, 7.0, 7, 7, FALSE, 'non_aligned_test7')", + "insert into root.db1.d2(time, s1, s2, s3, s5) values(8, 8.0, 8, 8, 'non_aligned_test8')", + "insert into root.db1.d2(time, s1, s2, s3, s4, s5) values(9, 9.0, 9, 9, FALSE, 'non_aligned_test9')", + "insert into root.db1.d2(time, s2, s3, s4, s5) values(10, 10, 10, TRUE, 'non_aligned_test10')", "flush", - "insert into root.sg1.d1(time, s1, s3, s4, s5) aligned values(3, 30000.0, 30000, TRUE, 'aligned_unseq_test3')", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(11, 11.0, 11, 11)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(12, 12.0, 12, 12)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(13, 13.0, 13, 13)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(14, 14.0, 14, 14)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(15, 15.0, 15, 15)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(16, 16.0, 16, 16)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(17, 17.0, 17, 17)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(18, 18.0, 18, 18)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(19, 19.0, 19, 19)", - "insert into root.sg1.d1(time, s1, s2, s3) aligned values(20, 20.0, 20, 20)", - "insert into root.sg1.d2(time, s1, s2, s3) values(11, 11.0, 11, 11)", - "insert into root.sg1.d2(time, s1, s2, s3) values(12, 12.0, 12, 12)", - "insert into root.sg1.d2(time, s1, s2, s3) values(13, 13.0, 13, 13)", - "insert into root.sg1.d2(time, s1, s2, s3) values(14, 14.0, 14, 14)", - "insert into root.sg1.d2(time, s1, s2, s3) values(15, 15.0, 15, 15)", - "insert into root.sg1.d2(time, s1, s2, s3) values(16, 16.0, 16, 16)", - "insert into root.sg1.d2(time, s1, s2, s3) values(17, 17.0, 17, 17)", - "insert into root.sg1.d2(time, s1, s2, s3) values(18, 18.0, 18, 18)", - "insert into root.sg1.d2(time, s1, s2, s3) values(19, 19.0, 19, 19)", - "insert into root.sg1.d2(time, s1, s2, s3) values(20, 20.0, 20, 20)", + "insert into root.db1.d1(time, s1, s3, s4, s5) aligned values(3, 30000.0, 30000, TRUE, 'aligned_unseq_test3')", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(11, 11.0, 11, 11)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(12, 12.0, 12, 12)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(13, 13.0, 13, 13)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(14, 14.0, 14, 14)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(15, 15.0, 15, 15)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(16, 16.0, 16, 16)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(17, 17.0, 17, 17)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(18, 18.0, 18, 18)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(19, 19.0, 19, 19)", + "insert into root.db1.d1(time, s1, s2, s3) aligned values(20, 20.0, 20, 20)", + "insert into root.db1.d2(time, s1, s2, s3) values(11, 11.0, 11, 11)", + "insert into root.db1.d2(time, s1, s2, s3) values(12, 12.0, 12, 12)", + "insert into root.db1.d2(time, s1, s2, s3) values(13, 13.0, 13, 13)", + "insert into root.db1.d2(time, s1, s2, s3) values(14, 14.0, 14, 14)", + "insert into root.db1.d2(time, s1, s2, s3) values(15, 15.0, 15, 15)", + "insert into root.db1.d2(time, s1, s2, s3) values(16, 16.0, 16, 16)", + "insert into root.db1.d2(time, s1, s2, s3) values(17, 17.0, 17, 17)", + "insert into root.db1.d2(time, s1, s2, s3) values(18, 18.0, 18, 18)", + "insert into root.db1.d2(time, s1, s2, s3) values(19, 19.0, 19, 19)", + "insert into root.db1.d2(time, s1, s2, s3) values(20, 20.0, 20, 20)", "flush", - "insert into root.sg1.d1(time, s1, s2, s3, s4, s5) aligned values(13, 130000.0, 130000, 130000, TRUE, 'aligned_unseq_test13')", - "insert into root.sg1.d1(time, s3, s4) aligned values(21, 21, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(22, 22, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(23, 23, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(24, 24, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(25, 25, TRUE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(26, 26, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(27, 27, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(28, 28, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(29, 29, FALSE)", - "insert into root.sg1.d1(time, s3, s4) aligned values(30, 30, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(21, 21, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(22, 22, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(23, 23, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(24, 24, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(25, 25, TRUE)", - "insert into root.sg1.d2(time, s3, s4) values(26, 26, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(27, 27, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(28, 28, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(29, 29, FALSE)", - "insert into root.sg1.d2(time, s3, s4) values(30, 30, FALSE)", + "insert into root.db1.d1(time, s1, s2, s3, s4, s5) aligned values(13, 130000.0, 130000, 130000, TRUE, 'aligned_unseq_test13')", + "insert into root.db1.d1(time, s3, s4) aligned values(21, 21, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(22, 22, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(23, 23, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(24, 24, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(25, 25, TRUE)", + "insert into root.db1.d1(time, s3, s4) aligned values(26, 26, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(27, 27, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(28, 28, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(29, 29, FALSE)", + "insert into root.db1.d1(time, s3, s4) aligned values(30, 30, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(21, 21, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(22, 22, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(23, 23, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(24, 24, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(25, 25, TRUE)", + "insert into root.db1.d2(time, s3, s4) values(26, 26, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(27, 27, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(28, 28, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(29, 29, FALSE)", + "insert into root.db1.d2(time, s3, s4) values(30, 30, FALSE)", "flush", - "insert into root.sg1.d1(time, s1, s3, s4) aligned values(23, 230000.0, 230000, FALSE)", - "insert into root.sg1.d1(time, s2, s5) aligned values(31, 31, 'aligned_test31')", - "insert into root.sg1.d1(time, s2, s5) aligned values(32, 32, 'aligned_test32')", - "insert into root.sg1.d1(time, s2, s5) aligned values(33, 33, 'aligned_test33')", - "insert into root.sg1.d1(time, s2, s5) aligned values(34, 34, 'aligned_test34')", - "insert into root.sg1.d1(time, s2, s5) aligned values(35, 35, 'aligned_test35')", - "insert into root.sg1.d1(time, s2, s5) aligned values(36, 36, 'aligned_test36')", - "insert into root.sg1.d1(time, s2, s5) aligned values(37, 37, 'aligned_test37')", - "insert into root.sg1.d1(time, s2, s5) aligned values(38, 38, 'aligned_test38')", - "insert into root.sg1.d1(time, s2, s5) aligned values(39, 39, 'aligned_test39')", - "insert into root.sg1.d1(time, s2, s5) aligned values(40, 40, 'aligned_test40')", - "insert into root.sg1.d2(time, s2, s5) values(31, 31, 'non_aligned_test31')", - "insert into root.sg1.d2(time, s2, s5) values(32, 32, 'non_aligned_test32')", - "insert into root.sg1.d2(time, s2, s5) values(33, 33, 'non_aligned_test33')", - "insert into root.sg1.d2(time, s2, s5) values(34, 34, 'non_aligned_test34')", - "insert into root.sg1.d2(time, s2, s5) values(35, 35, 'non_aligned_test35')", - "insert into root.sg1.d2(time, s2, s5) values(36, 36, 'non_aligned_test36')", - "insert into root.sg1.d2(time, s2, s5) values(37, 37, 'non_aligned_test37')", - "insert into root.sg1.d2(time, s2, s5) values(38, 38, 'non_aligned_test38')", - "insert into root.sg1.d2(time, s2, s5) values(39, 39, 'non_aligned_test39')", - "insert into root.sg1.d2(time, s2, s5) values(40, 40, 'non_aligned_test40')", + "insert into root.db1.d1(time, s1, s3, s4) aligned values(23, 230000.0, 230000, FALSE)", + "insert into root.db1.d1(time, s2, s5) aligned values(31, 31, 'aligned_test31')", + "insert into root.db1.d1(time, s2, s5) aligned values(32, 32, 'aligned_test32')", + "insert into root.db1.d1(time, s2, s5) aligned values(33, 33, 'aligned_test33')", + "insert into root.db1.d1(time, s2, s5) aligned values(34, 34, 'aligned_test34')", + "insert into root.db1.d1(time, s2, s5) aligned values(35, 35, 'aligned_test35')", + "insert into root.db1.d1(time, s2, s5) aligned values(36, 36, 'aligned_test36')", + "insert into root.db1.d1(time, s2, s5) aligned values(37, 37, 'aligned_test37')", + "insert into root.db1.d1(time, s2, s5) aligned values(38, 38, 'aligned_test38')", + "insert into root.db1.d1(time, s2, s5) aligned values(39, 39, 'aligned_test39')", + "insert into root.db1.d1(time, s2, s5) aligned values(40, 40, 'aligned_test40')", + "insert into root.db1.d2(time, s2, s5) values(31, 31, 'non_aligned_test31')", + "insert into root.db1.d2(time, s2, s5) values(32, 32, 'non_aligned_test32')", + "insert into root.db1.d2(time, s2, s5) values(33, 33, 'non_aligned_test33')", + "insert into root.db1.d2(time, s2, s5) values(34, 34, 'non_aligned_test34')", + "insert into root.db1.d2(time, s2, s5) values(35, 35, 'non_aligned_test35')", + "insert into root.db1.d2(time, s2, s5) values(36, 36, 'non_aligned_test36')", + "insert into root.db1.d2(time, s2, s5) values(37, 37, 'non_aligned_test37')", + "insert into root.db1.d2(time, s2, s5) values(38, 38, 'non_aligned_test38')", + "insert into root.db1.d2(time, s2, s5) values(39, 39, 'non_aligned_test39')", + "insert into root.db1.d2(time, s2, s5) values(40, 40, 'non_aligned_test40')", }; private static final String[] createTableViewSqls = { "CREATE DATABASE db", "USE db", - "CREATE VIEW table0 (device string tag, s1 FLOAT field, s2 INT32 field, s3 INT64 field, s4 BOOLEAN field, s5 TEXT field) as root.sg1.**", + "CREATE VIEW table0 (device string tag, s1 FLOAT field, s2 INT32 field, s3 INT64 field, s4 BOOLEAN field, s5 TEXT field) as root.db1.**", }; public static void insertData() { diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/orderby/IoTDBOrderByTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/orderby/IoTDBOrderByTableViewIT.java index 9aa60526da027..5bb2252db7582 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/orderby/IoTDBOrderByTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/orderby/IoTDBOrderByTableViewIT.java @@ -61,58 +61,58 @@ public class IoTDBOrderByTableViewIT { // https://docs.google.com/spreadsheets/d/1OWA1bKraArCwWVnuTjuhJ5yLG0PFLdD78gD6FjquepI/edit#gid=0 private static final String[] sql = new String[] { - "CREATE DATABASE root.sg", - "CREATE TIMESERIES root.sg.d1.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d1.bignum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d1.floatnum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", - "CREATE TIMESERIES root.sg.d1.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d1(timestamp,num,bignum,floatnum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" + "CREATE DATABASE root.db", + "CREATE TIMESERIES root.db.d1.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d1.bignum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d1.floatnum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", + "CREATE TIMESERIES root.db.d1.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d1(timestamp,num,bignum,floatnum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" }; private static final String[] createTableViewSql = { "CREATE DATABASE db", "USE db", "CREATE VIEW table0 (device string tag, num int32 field, bignum int64 field, " - + "floatnum double field, str TEXT field, bool BOOLEAN field) as root.sg.**", + + "floatnum double field, str TEXT field, bool BOOLEAN field) as root.db.**", }; private static final String[] sql2 = new String[] { - "CREATE TIMESERIES root.sg.d2.num WITH DATATYPE=INT32, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.bignum WITH DATATYPE=INT64, ENCODING=RLE", - "CREATE TIMESERIES root.sg.d2.floatnum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", - "CREATE TIMESERIES root.sg.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", - "insert into root.sg.d2(timestamp,num,bignum,floatnum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" + "CREATE TIMESERIES root.db.d2.num WITH DATATYPE=INT32, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.bignum WITH DATATYPE=INT64, ENCODING=RLE", + "CREATE TIMESERIES root.db.d2.floatnum WITH DATATYPE=DOUBLE, ENCODING=RLE, 'MAX_POINT_NUMBER'='5'", + "CREATE TIMESERIES root.db.d2.str WITH DATATYPE=TEXT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d2.bool WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(0,3,2947483648,231.2121,\"coconut\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(20,2,2147483648,434.12,\"pineapple\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(40,1,2247483648,12.123,\"apricot\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(80,9,2147483646,43.12,\"apple\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(100,8,2147483964,4654.231,\"papaya\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000000,6,2147483650,1231.21,\"banana\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000100,10,3147483648,231.55,\"pumelo\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536000500,4,2147493648,213.1,\"peach\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536001000,5,2149783648,56.32,\"orange\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536010000,7,2147983648,213.112,\"lemon\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(31536100000,11,2147468648,54.121,\"pitaya\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(41536000000,12,2146483648,45.231,\"strawberry\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(41536000020,14,2907483648,231.34,\"cherry\",FALSE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(41536900000,13,2107483648,54.12,\"lychee\",TRUE)", + "insert into root.db.d2(timestamp,num,bignum,floatnum,str,bool) values(51536000000,15,3147483648,235.213,\"watermelon\",TRUE)" }; @BeforeClass @@ -470,7 +470,7 @@ public void orderByTest19() { @Ignore @Test public void orderByInAggregationTest() { - String sql = "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc"; + String sql = "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc"; double[][] ans = new double[][] {{15.0}, {13.0}, {13.0}, {11.0}, {6.4}, {4.6}}; long[] times = new long[] {51536000000L, 41536000000L, 41536900000L, 31536100000L, 31536000000L, 0L}; @@ -497,7 +497,7 @@ public void orderByInAggregationTest() { @Test public void orderByInAggregationTest2() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12}, @@ -532,7 +532,7 @@ public void orderByInAggregationTest2() { @Test public void orderByInAggregationTest3() { String sql = - "select avg(num) from root.sg.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; + "select avg(num) from root.db.d group by session(10000ms) order by avg(num) desc,max_value(floatNum)"; double[] ans = new double[] {15.0, 13.0, 13.0, 11.0, 6.4, 4.6}; long[] times = new long[] {51536000000L, 41536900000L, 41536000000L, 31536100000L, 31536000000L, 0L}; @@ -559,7 +559,7 @@ public void orderByInAggregationTest3() { @Test public void orderByInAggregationTest4() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -588,7 +588,7 @@ public void orderByInAggregationTest4() { @Test public void orderByInAggregationTest5() { String sql = - "select min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483646L, 2147483650L, 2147468648L, 2146483648L, 2107483648L, 3147483648L}; long[] times = @@ -617,7 +617,7 @@ public void orderByInAggregationTest5() { @Test public void orderByInAggregationTest6() { String sql = - "select min_value(num)+min_value(bigNum) from root.sg.d group by session(10000ms) order by avg(num)+avg(floatNum)"; + "select min_value(num)+min_value(bigNum) from root.db.d group by session(10000ms) order by avg(num)+avg(floatNum)"; long[] ans = new long[] {2147483647L, 2147483654L, 2147468659L, 2146483660L, 2107483661L, 3147483663L}; long[] times = @@ -646,7 +646,7 @@ public void orderByInAggregationTest6() { @Test public void orderByInAggregationTest7() { String sql = - "select avg(num)+min_value(floatNum) from root.sg.d group by session(10000ms) order by max_value(floatNum)"; + "select avg(num)+min_value(floatNum) from root.db.d group by session(10000ms) order by max_value(floatNum)"; double[][] ans = new double[][] { {13.0, 54.12, 54.12}, @@ -681,7 +681,7 @@ public void orderByInAggregationTest7() { @Test public void orderByInAggregationTest8() { String sql = - "select avg(num)+avg(floatNum) from root.sg.d group by session(10000ms) order by avg(floatNum)+avg(num)"; + "select avg(num)+avg(floatNum) from root.db.d group by session(10000ms) order by avg(floatNum)+avg(num)"; double[][] ans = new double[][] {{1079.56122}, {395.4584}, {65.121}, {151.2855}, {67.12}, {250.213}}; long[] times = @@ -1077,18 +1077,18 @@ public void orderByInAggregationAlignByDeviceTest() { }; String[] device = new String[] { - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d2", - "root.sg.d", - "root.sg.d", - "root.sg.d2", - "root.sg.d2", - "root.sg.d", - "root.sg.d2" + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d2", + "root.db.d", + "root.db.d", + "root.db.d2", + "root.db.d2", + "root.db.d", + "root.db.d2" }; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { @@ -1121,8 +1121,8 @@ public void orderByInAggregationAlignByDeviceTest2() { } private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { - String device = "root.sg.d"; - if (!deviceAsc) device = "root.sg.d2"; + String device = "root.db.d"; + if (!deviceAsc) device = "root.db.d2"; try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { try (ResultSet resultSet = statement.executeQuery(sql)) { @@ -1132,8 +1132,8 @@ private void checkSingleDouble(String sql, Object value, boolean deviceAsc) { double actualVal = resultSet.getDouble(2); assertEquals(deviceName, device); assertEquals(Double.parseDouble(value.toString()), actualVal, 1); - if (device.equals("root.sg.d")) device = "root.sg.d2"; - else device = "root.sg.d"; + if (device.equals("root.db.d")) device = "root.db.d2"; + else device = "root.db.d"; i++; } assertEquals(i, 2); @@ -1310,7 +1310,7 @@ private void orderByUDFTest(String sql, int[] ans) { @Test public void orderByUDFTest1() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2') nulls first, bottom_k(bigNum, 'k'='2') nulls first"; int[] ans = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 11, 12, 14}; orderByUDFTest(sql, ans); } @@ -1319,7 +1319,7 @@ public void orderByUDFTest1() { @Test public void orderByUDFTest2() { String sql = - "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.sg.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; + "select num, top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2') from root.db.d order by top_k(num, 'k'='2'), bottom_k(bigNum, 'k'='2')"; int[] ans = {12, 14, 13, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; orderByUDFTest(sql, ans); } @@ -1337,7 +1337,7 @@ private void errorTest(String sql, String error) { @Test public void errorTest1() { errorTest( - "select num from root.sg.d order by avg(bigNum)", + "select num from root.db.d order by avg(bigNum)", "701: Raw data and aggregation hybrid query is not supported."); } @@ -1345,7 +1345,7 @@ public void errorTest1() { @Test public void errorTest2() { errorTest( - "select avg(num) from root.sg.d order by bigNum", + "select avg(num) from root.db.d order by bigNum", "701: Raw data and aggregation hybrid query is not supported."); } @@ -1368,8 +1368,8 @@ public void errorTest4() { @Test public void errorTest7() { errorTest( - "select last bigNum,floatNum from root.** order by root.sg.d.bigNum", - "701: root.sg.d.bigNum in order by clause doesn't exist in the result of last query."); + "select last bigNum,floatNum from root.** order by root.db.d.bigNum", + "701: root.db.d.bigNum in order by clause doesn't exist in the result of last query."); } // last query @@ -1405,7 +1405,7 @@ public void lastQueryOrderBy() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d.num", "root.sg.d2.num", "root.sg.d.bigNum", "root.sg.d2.bigNum"}, + {"root.db.d.num", "root.db.d2.num", "root.db.d.bigNum", "root.db.d2.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1419,7 +1419,7 @@ public void lastQueryOrderBy2() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1433,7 +1433,7 @@ public void lastQueryOrderBy3() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d2.bigNum", "root.sg.d.num", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d2.bigNum", "root.db.d.num", "root.db.d.bigNum"}, {"15", "3147483648", "15", "3147483648"}, {"INT32", "INT64", "INT32", "INT64"} }; @@ -1447,7 +1447,7 @@ public void lastQueryOrderBy4() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; @@ -1461,7 +1461,7 @@ public void lastQueryOrderBy5() { String[][] ans = new String[][] { {"51536000000", "51536000000", "51536000000", "51536000000"}, - {"root.sg.d2.num", "root.sg.d.num", "root.sg.d2.bigNum", "root.sg.d.bigNum"}, + {"root.db.d2.num", "root.db.d.num", "root.db.d2.bigNum", "root.db.d.bigNum"}, {"15", "15", "3147483648", "3147483648"}, {"INT32", "INT32", "INT64", "INT64"} }; diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/query/IoTDBArithmeticTableViewIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/query/IoTDBArithmeticTableViewIT.java index e8a19eb2c59cd..fbf700061dba6 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/query/IoTDBArithmeticTableViewIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/old/query/IoTDBArithmeticTableViewIT.java @@ -73,27 +73,27 @@ public class IoTDBArithmeticTableViewIT { private static final String[] INSERTION_SQLS = { "CREATE DATABASE root.test", - "CREATE TIMESERIES root.sg.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s5 WITH DATATYPE=DATE, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s6 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s7 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", - "CREATE TIMESERIES root.sg.d1.s8 WITH DATATYPE=TEXT, ENCODING=PLAIN", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (1, 1, 1, 1.0, 1.0, '2024-01-01', 10, true, 'test')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (2, 2, 2, 2.0, 2.0, '2024-02-01', 20, true, 'test')", - "insert into root.sg.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (3, 3, 3, 3.0, 3.0, '2024-03-01', 30, true, 'test')", - "CREATE ALIGNED TIMESERIES root.sg2.d1(date DATE)", - "insert into root.sg2.d1(time, date) values (1, '9999-12-31')", - "insert into root.sg2.d1(time, date) values (2, '1000-01-01')" + "CREATE TIMESERIES root.db.d1.s1 WITH DATATYPE=INT32, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s2 WITH DATATYPE=INT64, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s3 WITH DATATYPE=FLOAT, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s4 WITH DATATYPE=DOUBLE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s5 WITH DATATYPE=DATE, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s6 WITH DATATYPE=TIMESTAMP, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s7 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN", + "CREATE TIMESERIES root.db.d1.s8 WITH DATATYPE=TEXT, ENCODING=PLAIN", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (1, 1, 1, 1.0, 1.0, '2024-01-01', 10, true, 'test')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (2, 2, 2, 2.0, 2.0, '2024-02-01', 20, true, 'test')", + "insert into root.db.d1(time, s1, s2, s3, s4, s5, s6, s7, s8) values (3, 3, 3, 3.0, 3.0, '2024-03-01', 30, true, 'test')", + "CREATE ALIGNED TIMESERIES root.db2.d1(date DATE)", + "insert into root.db2.d1(time, date) values (1, '9999-12-31')", + "insert into root.db2.d1(time, date) values (2, '1000-01-01')" }; private static final String[] CREATE_TABLE_VIEW_SQLS = { "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE VIEW table1 (device STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 DATE FIELD, s6 TIMESTAMP FIELD, s7 BOOLEAN FIELD, s8 TEXT FIELD) as root.sg.**", - "CREATE VIEW table2 (device STRING TAG, date DATE FIELD) as root.sg2.**", + "CREATE VIEW table1 (device STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD, s5 DATE FIELD, s6 TIMESTAMP FIELD, s7 BOOLEAN FIELD, s8 TEXT FIELD) as root.db.**", + "CREATE VIEW table2 (device STRING TAG, date DATE FIELD) as root.db2.**", }; @BeforeClass diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionAlignedInsertIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionAlignedInsertIT.java index 2340cf3f326b2..67571e9caf9bd 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionAlignedInsertIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionAlignedInsertIT.java @@ -48,9 +48,9 @@ @Category({LocalStandaloneIT.class, ClusterIT.class}) public class IoTDBSessionAlignedInsertIT { - private static final String ROOT_SG1_D1_VECTOR1 = "root.sg_1.d1.vector"; - private static final String ROOT_SG1_D1 = "root.sg_1.d1"; - private static final String ROOT_SG1_D2 = "root.sg_1.d2"; + private static final String ROOT_SG1_D1_VECTOR1 = "root.db_1.d1.vector"; + private static final String ROOT_SG1_D1 = "root.db_1.d1"; + private static final String ROOT_SG1_D2 = "root.db_1.d2"; private static final double DELTA_DOUBLE = 1e-7d; @Before @@ -69,7 +69,7 @@ public void insertAlignedTabletTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { insertTabletWithAlignedTimeseriesMethod(session); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db_1.d1.vector"); assertEquals(dataSet.getColumnNames().size(), 3); assertEquals(dataSet.getColumnNames().get(0), "Time"); assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s1"); @@ -118,7 +118,7 @@ public void insertAlignedRecordTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { insertAlignedRecord(session, ROOT_SG1_D1_VECTOR1); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s2"); @@ -142,7 +142,7 @@ public void insertAlignedStringRecordTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { insertAlignedStringRecord(session, ROOT_SG1_D1_VECTOR1); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); assertEquals(ROOT_SG1_D1_VECTOR1 + ".s2", dataSet.getColumnNames().get(1)); @@ -166,7 +166,7 @@ public void insertAlignedStringRecordsTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { insertAlignedStringRecords(session, ROOT_SG1_D1_VECTOR1); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s2"); @@ -190,7 +190,7 @@ public void insertAlignedRecordsTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { insertAlignedRecords(session, ROOT_SG1_D1_VECTOR1); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s2"); @@ -214,7 +214,7 @@ public void insertAlignedRecordsOfOneDeviceTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { insertAlignedRecordsOfOneDevice(session, ROOT_SG1_D1_VECTOR1); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s2"); @@ -240,7 +240,7 @@ public void nonAlignedSingleSelectTest() { insertTabletWithAlignedTimeseriesMethod(session); insertNonAlignedRecord(session, ROOT_SG1_D2); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select s2 from root.db_1.d1.vector"); assertEquals(2, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); assertEquals(dataSet.getColumnNames().get(1), ROOT_SG1_D1_VECTOR1 + ".s2"); @@ -266,7 +266,7 @@ public void nonAlignedVectorSelectTest() { insertTabletWithAlignedTimeseriesMethod(session); insertNonAlignedRecord(session, ROOT_SG1_D2); session.executeNonQueryStatement("flush"); - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg_1.d1.vector"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db_1.d1.vector"); assertEquals(3, dataSet.getColumnNames().size()); assertEquals("Time", dataSet.getColumnNames().get(0)); assertEquals(ROOT_SG1_D1_VECTOR1 + ".s1", dataSet.getColumnNames().get(1)); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java index a456a05d0229f..8fa8a64fabec0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java @@ -85,11 +85,11 @@ public void insertByStrTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); createTimeseries(session); insertByStr(session); insertViaSQL(session); - queryByDevice(session, "root.sg1.d1"); + queryByDevice(session, "root.db1.d1"); } catch (Exception e) { e.printStackTrace(); @@ -99,7 +99,7 @@ public void insertByStrTest() { private void createTimeseries(ISession session) throws StatementExecutionException, IoTDBConnectionException { - createTimeseries(session, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + createTimeseries(session, Arrays.asList("root.db1.d1", "root.db1.d2")); } private void createTimeseries(ISession session, List deviceIds) @@ -116,7 +116,7 @@ private void createTimeseries(ISession session, List deviceIds) private void insertByStr(ISession session) throws IoTDBConnectionException, StatementExecutionException { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -134,7 +134,7 @@ private void insertByStr(ISession session) private void insertViaSQL(ISession session) throws IoTDBConnectionException, StatementExecutionException { session.executeNonQueryStatement( - "insert into root.sg1.d1(timestamp,s1, s2, s3) values(100, 1,2,3)"); + "insert into root.db1.d1(timestamp,s1, s2, s3) values(100, 1,2,3)"); } private void queryByDevice(ISession session, String deviceId) @@ -153,10 +153,10 @@ private void queryByDevice(ISession session, String deviceId) } switch (deviceId) { - case "root.sg1.d1": + case "root.db1.d1": assertEquals(101, count); break; - case "root.sg1.d2": + case "root.db1.d2": assertEquals(500, count); break; } @@ -168,10 +168,10 @@ private void queryByDevice(ISession session, String deviceId) public void insertByObjectTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); createTimeseries(session); - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); List types = new ArrayList<>(); measurements.add("s1"); @@ -184,30 +184,30 @@ public void insertByObjectTest() { // auth test try (ISession authSession = EnvFactory.getEnv().getSessionConnection("test", "test123123456")) { - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s1"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s2"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s1"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s2"); try { authSession.insertRecord(deviceId, 0, measurements, types, 1L, 2L, 3L); } catch (Exception e) { if (!e.getMessage() .contains( - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg1.d1.s3]")) { + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db1.d1.s3]")) { fail(e.getMessage()); } } - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s3"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s3"); try { authSession.insertRecord(deviceId, 0, measurements, types, 1L, 2L, 3L); } catch (Exception e) { if (!e.getMessage() .contains( - "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg1.d1.s1, root.sg1.d1.s2, root.sg1.d1.s3]")) { + "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db1.d1.s1, root.db1.d1.s2, root.db1.d1.s3]")) { fail(e.getMessage()); } } - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); try { authSession.insertRecord(deviceId, 0, measurements, types, 1L, 2L, 3L); } catch (Exception e) { @@ -226,10 +226,10 @@ public void insertByObjectTest() { } catch (Exception e) { fail(e.getMessage()); } - revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s1"); - revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s2"); - revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s3"); - revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); + revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s1"); + revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s2"); + revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s3"); + revokeUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); revokeUserSeriesPrivilege("test", PrivilegeType.SYSTEM, "root.**"); for (long time = 0; time < 100; time++) { @@ -237,7 +237,7 @@ public void insertByObjectTest() { } insertViaSQL(session); - queryByDevice(session, "root.sg1.d1"); + queryByDevice(session, "root.db1.d1"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -249,11 +249,11 @@ public void insertByObjectTest() { public void alignByDeviceTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); createTimeseries(session); - insertTablet(session, "root.sg1.d1"); + insertTablet(session, "root.db1.d1"); SessionDataSet sessionDataSet = - session.executeQueryStatement("select s1 from root.sg1.d1 align by device"); + session.executeQueryStatement("select s1 from root.db1.d1 align by device"); sessionDataSet.setFetchSize(1024); int count = 0; @@ -264,7 +264,7 @@ public void alignByDeviceTest() { for (Field f : fields) { sb.append(f.getStringValue()).append(","); } - assertEquals("root.sg1.d1,0,", sb.toString()); + assertEquals("root.db1.d1,0,", sb.toString()); } assertEquals(100, count); sessionDataSet.closeOperationHandle(); @@ -446,13 +446,13 @@ public void testBatchInsertSeqAndUnseq() try (ISession session = EnvFactory.getEnv().getSessionConnection()) { createTimeseries(session); - insertTablet(session, "root.sg1.d1"); + insertTablet(session, "root.db1.d1"); session.executeNonQueryStatement("FLUSH"); - session.executeNonQueryStatement("FLUSH root.sg1"); + session.executeNonQueryStatement("FLUSH root.db1"); List deviceIds = new ArrayList<>(); - queryForBatch(Collections.singletonList("root.sg1.d1"), 400); + queryForBatch(Collections.singletonList("root.db1.d1"), 400); } catch (Exception e) { e.printStackTrace(); @@ -499,12 +499,12 @@ public void sessionClusterTest() { } try (ISession session = EnvFactory.getEnv().getSessionConnection(nodeList)) { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); createTimeseries(session); insertByStr(session); insertViaSQL(session); - queryByDevice(session, "root.sg1.d1"); + queryByDevice(session, "root.db1.d1"); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -532,17 +532,17 @@ public void errorSessionClusterTest() { public void insertWithMultipleTimeSlotsTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - createTimeseries(session, Arrays.asList("root.sg1.d1", "root.sg1.d2")); - insertRecords(session, Arrays.asList("root.sg1.d1", "root.sg1.d2")); - queryForBatch(Arrays.asList("root.sg1.d1", "root.sg1.d2"), 400); + createTimeseries(session, Arrays.asList("root.db1.d1", "root.db1.d2")); + insertRecords(session, Arrays.asList("root.db1.d1", "root.db1.d2")); + queryForBatch(Arrays.asList("root.db1.d1", "root.db1.d2"), 400); - createTimeseries(session, Arrays.asList("root.sg2.d1", "root.sg2.d2")); - insertMultiTablets(session, Arrays.asList("root.sg2.d1", "root.sg2.d2")); - queryForBatch(Arrays.asList("root.sg2.d1", "root.sg2.d2"), 400); + createTimeseries(session, Arrays.asList("root.db2.d1", "root.db2.d2")); + insertMultiTablets(session, Arrays.asList("root.db2.d1", "root.db2.d2")); + queryForBatch(Arrays.asList("root.db2.d1", "root.db2.d2"), 400); - createTimeseries(session, Collections.singletonList("root.sg3.d1")); - insertRecordsOfOneDevice(session, "root.sg3.d1"); - queryForBatch(Collections.singletonList("root.sg3.d1"), 400); + createTimeseries(session, Collections.singletonList("root.db3.d1")); + insertRecordsOfOneDevice(session, "root.db3.d1"); + queryForBatch(Collections.singletonList("root.db3.d1"), 400); } catch (Exception e) { e.printStackTrace(); @@ -555,42 +555,42 @@ public void insertNotAutoCreateSchemaTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { session.executeNonQueryStatement("SET CONFIGURATION 'enable_auto_create_schema'='false'"); - session.createDatabase("root.sg1"); - session.createDatabase("root.sg2"); - session.createDatabase("root.sg3"); + session.createDatabase("root.db1"); + session.createDatabase("root.db2"); + session.createDatabase("root.db3"); try { - insertTablet(session, "root.sg1.d1"); + insertTablet(session, "root.db1.d1"); } catch (Exception e) { Assert.assertTrue( e.getMessage() != null - && e.getMessage().contains("Path [root.sg1.d1.s1] does not exist")); + && e.getMessage().contains("Path [root.db1.d1.s1] does not exist")); } try { - insertRecords(session, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertRecords(session, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { Assert.assertTrue( e.getMessage() != null - && e.getMessage().contains("Path [root.sg1.d2.s1] does not exist") - || e.getMessage().contains("Path [root.sg1.d1.s1] does not exist")); + && e.getMessage().contains("Path [root.db1.d2.s1] does not exist") + || e.getMessage().contains("Path [root.db1.d1.s1] does not exist")); } try { - insertMultiTablets(session, Arrays.asList("root.sg2.d1", "root.sg2.d2")); + insertMultiTablets(session, Arrays.asList("root.db2.d1", "root.db2.d2")); } catch (Exception e) { Assert.assertTrue( e.getMessage() != null - && e.getMessage().contains("Path [root.sg2.d2.s1] does not exist") - || e.getMessage().contains("Path [root.sg2.d1.s1] does not exist")); + && e.getMessage().contains("Path [root.db2.d2.s1] does not exist") + || e.getMessage().contains("Path [root.db2.d1.s1] does not exist")); } try { - insertRecordsOfOneDevice(session, "root.sg3.d1"); + insertRecordsOfOneDevice(session, "root.db3.d1"); } catch (Exception e) { Assert.assertTrue( e.getMessage() != null - && e.getMessage().contains("Path [root.sg3.d1.s1] does not exist")); + && e.getMessage().contains("Path [root.db3.d1.s1] does not exist")); } } catch (Exception e) { @@ -602,73 +602,73 @@ public void insertNotAutoCreateSchemaTest() { public void testAuth() { // auth test try (ISession authSession = EnvFactory.getEnv().getSessionConnection("test", "test123123456")) { - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s1"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s2"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d2.**"); - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d2.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s1"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s2"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d2.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d2.**"); try { - insertRecords(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertRecords(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { if (!e.getMessage() .contains( - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg1.d1.s3]")) { + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db1.d1.s3]")) { fail(e.getMessage()); } } try { - insertTablet(authSession, "root.sg1.d1"); + insertTablet(authSession, "root.db1.d1"); } catch (Exception e) { if (!e.getMessage() .contains( - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg1.d1.s3]")) { + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db1.d1.s3]")) { fail(e.getMessage()); } } try { - insertMultiTablets(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d1")); + insertMultiTablets(authSession, Arrays.asList("root.db1.d1", "root.db1.d1")); } catch (Exception e) { if (!e.getMessage() .contains( - "803: No permissions for this operation, please add privilege WRITE_DATA on [root.sg1.d1.s3]")) { + "803: No permissions for this operation, please add privilege WRITE_DATA on [root.db1.d1.s3]")) { fail(e.getMessage()); } } - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.sg1.d1.s3"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_DATA, "root.db1.d1.s3"); try { - insertRecords(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertRecords(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { if (!e.getMessage() .contains( "No permissions for this operation, please add privilege WRITE_SCHEMA on ") - && !e.getMessage().contains("root.sg1.d1.s1") - && !e.getMessage().contains("root.sg1.d1.s2") - && !e.getMessage().contains("root.sg1.d1.s3")) { + && !e.getMessage().contains("root.db1.d1.s1") + && !e.getMessage().contains("root.db1.d1.s2") + && !e.getMessage().contains("root.db1.d1.s3")) { fail(e.getMessage()); } } try { - insertTablet(authSession, "root.sg1.d1"); + insertTablet(authSession, "root.db1.d1"); } catch (Exception e) { if (!e.getMessage() .contains( - "No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg1.d1.s1, root.sg1.d1.s2, root.sg1.d1.s3]")) { + "No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db1.d1.s1, root.db1.d1.s2, root.db1.d1.s3]")) { fail(e.getMessage()); } } try { - insertMultiTablets(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertMultiTablets(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { if (!e.getMessage() .contains( - "No permissions for this operation, please add privilege WRITE_SCHEMA on [root.sg1.d1.s1, root.sg1.d1.s2, root.sg1.d1.s3]")) { + "No permissions for this operation, please add privilege WRITE_SCHEMA on [root.db1.d1.s1, root.db1.d1.s2, root.db1.d1.s3]")) { fail(e.getMessage()); } } - grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.sg1.d1.**"); + grantUserSeriesPrivilege("test", PrivilegeType.WRITE_SCHEMA, "root.db1.d1.**"); try { - insertRecords(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertRecords(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { if (!e.getMessage() .contains("No permissions for this operation, please add privilege SYSTEM")) { @@ -676,7 +676,7 @@ public void testAuth() { } } try { - insertTablet(authSession, "root.sg1.d1"); + insertTablet(authSession, "root.db1.d1"); } catch (Exception e) { if (!e.getMessage() .contains("No permissions for this operation, please add privilege SYSTEM")) { @@ -684,7 +684,7 @@ public void testAuth() { } } try { - insertMultiTablets(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertMultiTablets(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { if (!e.getMessage() .contains("No permissions for this operation, please add privilege SYSTEM")) { @@ -694,15 +694,15 @@ public void testAuth() { grantUserSystemPrivileges("test", PrivilegeType.SYSTEM); try { - insertRecords(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); - insertTablet(authSession, "root.sg1.d1"); - insertMultiTablets(authSession, Arrays.asList("root.sg1.d1", "root.sg1.d2")); + insertRecords(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); + insertTablet(authSession, "root.db1.d1"); + insertMultiTablets(authSession, Arrays.asList("root.db1.d1", "root.db1.d2")); } catch (Exception e) { fail(e.getMessage()); } } catch (Exception e) { fail(e.getMessage()); } - executeNonQuery("drop timeseries root.sg1.d1.**, root.sg1.d2.**"); + executeNonQuery("drop timeseries root.db1.d1.**, root.db1.d2.**"); } } diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionDisableMemControlIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionDisableMemControlIT.java index a24e2c20c2615..d16349bc0acd7 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionDisableMemControlIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionDisableMemControlIT.java @@ -74,24 +74,24 @@ public void tearDown() throws Exception { @Test public void insertPartialTabletTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - if (!session.checkTimeseriesExists("root.sg.d.s1")) { + if (!session.checkTimeseriesExists("root.db.d.s1")) { session.createTimeseries( - "root.sg.d.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists("root.sg.d.s2")) { + if (!session.checkTimeseriesExists("root.db.d.s2")) { session.createTimeseries( - "root.sg.d.s2", TSDataType.DOUBLE, TSEncoding.GORILLA, CompressionType.SNAPPY); + "root.db.d.s2", TSDataType.DOUBLE, TSEncoding.GORILLA, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists("root.sg.d.s3")) { + if (!session.checkTimeseriesExists("root.db.d.s3")) { session.createTimeseries( - "root.sg.d.s3", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d.s3", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg.d", schemaList, 10); + Tablet tablet = new Tablet("root.db.d", schemaList, 10); long timestamp = System.currentTimeMillis(); @@ -107,7 +107,7 @@ public void insertPartialTabletTest() { } catch (StatementExecutionException e) { LOGGER.error(e.getMessage()); assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } @@ -120,13 +120,13 @@ public void insertPartialTabletTest() { } catch (StatementExecutionException e) { LOGGER.error(e.getMessage()); assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } SessionDataSet dataSet = - session.executeQueryStatement("select count(s1), count(s2), count(s3) from root.sg.d"); + session.executeQueryStatement("select count(s1), count(s2), count(s3) from root.db.d"); while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); assertEquals(15L, rowRecord.getFields().get(0).getLongV()); @@ -157,7 +157,7 @@ public void insertPartialAlignedTabletTest() { compressors.add(CompressionType.SNAPPY); } session.createAlignedTimeseries( - "root.sg.d", + "root.db.d", multiMeasurementComponents, dataTypes, encodings, @@ -170,7 +170,7 @@ public void insertPartialAlignedTabletTest() { schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg.d", schemaList, 10); + Tablet tablet = new Tablet("root.db.d", schemaList, 10); long timestamp = System.currentTimeMillis(); @@ -186,7 +186,7 @@ public void insertPartialAlignedTabletTest() { } catch (StatementExecutionException e) { LOGGER.error(e.getMessage()); assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } @@ -199,12 +199,12 @@ public void insertPartialAlignedTabletTest() { } catch (StatementExecutionException e) { LOGGER.error(e.getMessage()); assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } - SessionDataSet dataSet = session.executeQueryStatement("select s1, s2, s3 from root.sg.d"); + SessionDataSet dataSet = session.executeQueryStatement("select s1, s2, s3 from root.db.d"); while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); assertEquals(1, rowRecord.getFields().get(0).getLongV()); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionInsertNullIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionInsertNullIT.java index 5fdf733578f75..e1f73463c6edd 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionInsertNullIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionInsertNullIT.java @@ -72,21 +72,21 @@ public void tearDown() throws Exception { private void prepareData(ISession session) throws IoTDBConnectionException, StatementExecutionException { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); session.createTimeseries( - "root.sg1.clsu.d1.s1", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s1", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d1.s2", TSDataType.INT32, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s2", TSDataType.INT32, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d1.s3", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s3", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d1.s4", TSDataType.FLOAT, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s4", TSDataType.FLOAT, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d1.s5", TSDataType.DOUBLE, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s5", TSDataType.DOUBLE, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d1.s6", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d1.s6", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.SNAPPY); session.createTimeseries( - "root.sg1.clsu.d2.s1", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db1.clsu.d2.s1", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); } private long queryCountRecords(ISession session, String sql) @@ -113,7 +113,7 @@ public void insertRecordNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId = "root.sg1.clsu.d1"; + String deviceId = "root.db1.clsu.d1"; session.insertRecord(deviceId, 100, Arrays.asList("s1"), Arrays.asList("true")); List t = new ArrayList<>(); t.add(null); @@ -149,7 +149,7 @@ public void insertAlignedRecordNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId = "root.sg1.clsu.aligned_d1"; + String deviceId = "root.db1.clsu.aligned_d1"; session.insertAlignedRecord(deviceId, 100, Arrays.asList("s1"), Arrays.asList("true")); List t = new ArrayList<>(); t.add(null); @@ -193,8 +193,8 @@ public void insertRecordsNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId1 = "root.sg1.clsu.d2"; - String deviceId2 = "root.sg1.clsu.d3"; + String deviceId1 = "root.db1.clsu.d2"; + String deviceId2 = "root.db1.clsu.d3"; session.insertRecords( Arrays.asList(deviceId1, deviceId2), Arrays.asList(300L, 300L), @@ -245,8 +245,8 @@ public void insertRecordsNullTest() { public void insertAlignedRecordsNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId1 = "root.sg1.clsu.aligned_d2"; - String deviceId2 = "root.sg1.clsu.aligned_d3"; + String deviceId1 = "root.db1.clsu.aligned_d2"; + String deviceId2 = "root.db1.clsu.aligned_d3"; session.insertAlignedRecords( Arrays.asList(deviceId1, deviceId2), Arrays.asList(300L, 300L), @@ -288,7 +288,7 @@ public void insertAlignedRecordsNullTest() { public void insertRecordsOfOneDeviceNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId1 = "root.sg1.clsu.InsertRecordsOfOneDevice"; + String deviceId1 = "root.db1.clsu.InsertRecordsOfOneDevice"; session.insertRecordsOfOneDevice( deviceId1, Arrays.asList(300L, 301L), @@ -327,7 +327,7 @@ public void insertRecordsOfOneDeviceNullTest() { public void insertAlignedRecordsOfOneDeviceNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId1 = "root.sg1.clsu.InsertAlignedRecordsOfOneDevice"; + String deviceId1 = "root.db1.clsu.InsertAlignedRecordsOfOneDevice"; session.insertAlignedRecordsOfOneDevice( deviceId1, Arrays.asList(300L, 301L), @@ -367,7 +367,7 @@ public void insertTabletNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId = "root.sg1.clsu.d1"; + String deviceId = "root.db1.clsu.d1"; Tablet tablet = new Tablet( deviceId, @@ -401,7 +401,7 @@ public void insertAlignedTabletNullTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { prepareData(session); - String deviceId = "root.sg1.clsu.aligned_d1"; + String deviceId = "root.db1.clsu.aligned_d1"; Tablet tablet = new Tablet( deviceId, @@ -435,7 +435,7 @@ public void insertAlignedTabletNullTest() { + File.separator + "sequence" + File.separator - + "root.sg1" + + "root.db1" + File.separator + "1" + File.separator @@ -458,7 +458,7 @@ public void insertAlignedTabletNullTest() { @Test public void insertTabletNullMeasurementTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.clsu.aligned_d1"; + String deviceId = "root.db1.clsu.aligned_d1"; Tablet tablet = new Tablet( deviceId, @@ -476,7 +476,7 @@ public void insertTabletNullMeasurementTest() { } try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.clsu.aligned_d1"; + String deviceId = "root.db1.clsu.aligned_d1"; Tablet tablet = new Tablet( deviceId, @@ -494,7 +494,7 @@ public void insertTabletNullMeasurementTest() { } try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.clsu.aligned_d1"; + String deviceId = "root.db1.clsu.aligned_d1"; Tablet tablet = new Tablet( deviceId, diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionQueryIT.java index ba5c22ab9969e..54ebef938868d 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionQueryIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionQueryIT.java @@ -87,7 +87,7 @@ public void rawDataQueryWithTimeRangeTest1() throws IoTDBConnectionException { "34,null,null,aligned_test34", }; - List columnNames = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s4", "root.sg1.d1.s5"); + List columnNames = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s4", "root.db1.d1.s5"); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { try (SessionDataSet resultSet = session.executeRawDataQuery(columnNames, 16, 35)) { @@ -126,12 +126,12 @@ public void rawDataQueryWithTimeRangeTest2() throws IoTDBConnectionException { List columnNames = Arrays.asList( - "root.sg1.d2.s5", - "root.sg1.d1.s4", - "root.sg1.d2.s1", - "root.sg1.d1.s5", - "root.sg1.d2.s4", - "root.sg1.d1.s1"); + "root.db1.d2.s5", + "root.db1.d1.s4", + "root.db1.d2.s1", + "root.db1.d1.s5", + "root.db1.d2.s4", + "root.db1.d1.s1"); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { try (SessionDataSet resultSet = session.executeRawDataQuery(columnNames, 16, 35)) { @@ -149,9 +149,9 @@ public void rawDataQueryWithTimeRangeTest2() throws IoTDBConnectionException { @Test public void lastQueryTest() throws IoTDBConnectionException { - String[] retArray = new String[] {"23,root.sg1.d1.s1,230000.0,FLOAT"}; + String[] retArray = new String[] {"23,root.db1.d1.s1,230000.0,FLOAT"}; - List selectedPaths = Collections.singletonList("root.sg1.d1.s1"); + List selectedPaths = Collections.singletonList("root.db1.d1.s1"); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { try (SessionDataSet resultSet = session.executeLastDataQuery(selectedPaths)) { @@ -167,7 +167,7 @@ public void lastQueryTest() throws IoTDBConnectionException { public void lastQueryWithLastTimeTest() throws IoTDBConnectionException { String[] retArray = new String[] {}; - List selectedPaths = Collections.singletonList("root.sg1.d1.s1"); + List selectedPaths = Collections.singletonList("root.db1.d1.s1"); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { try (SessionDataSet resultSet = session.executeLastDataQuery(selectedPaths, 30)) { @@ -181,19 +181,19 @@ public void lastQueryWithLastTimeTest() throws IoTDBConnectionException { @Test public void lastQueryForOneDevice() throws IoTDBConnectionException { - String[] retArray = new String[] {"23,root.sg1.d1.s1,230000.0,FLOAT"}; + String[] retArray = new String[] {"23,root.db1.d1.s1,230000.0,FLOAT"}; try (ISession session = EnvFactory.getEnv().getSessionConnection()) { // first time, cache miss try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.d1", Collections.singletonList("s1"), true)) { + "root.db1", "root.db1.d1", Collections.singletonList("s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray, true); } // second time, cache hit try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.d1", Collections.singletonList("s1"), true)) { + "root.db1", "root.db1.d1", Collections.singletonList("s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray, true); } } catch (StatementExecutionException e) { @@ -205,37 +205,37 @@ public void lastQueryForOneDevice() throws IoTDBConnectionException { @Test public void lastQueryForOneDeviceNoSchema() throws IoTDBConnectionException { String[] retArray = new String[] {}; - String[] retArray2 = new String[] {"23,root.sg1.d1.s1,230000.0,FLOAT"}; + String[] retArray2 = new String[] {"23,root.db1.d1.s1,230000.0,FLOAT"}; try (ISession session = EnvFactory.getEnv().getSessionConnection()) { // database has no schema try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1.d1", "root.sg1.d1", Collections.singletonList("s1"), true)) { + "root.db1.d1", "root.db1.d1", Collections.singletonList("s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray, true); } // device has no schema try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.noThisDevice", Collections.singletonList("s1"), true)) { + "root.db1", "root.db1.noThisDevice", Collections.singletonList("s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray, true); } // sensor has no schema try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.d1", Collections.singletonList("notExist"), true)) { + "root.db1", "root.db1.d1", Collections.singletonList("notExist"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray, true); } // some sensor has no schema try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.d1", Arrays.asList("notExist", "s1"), true)) { + "root.db1", "root.db1.d1", Arrays.asList("notExist", "s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray2, true); } try (SessionDataSet resultSet = session.executeLastDataQueryForOneDevice( - "root.sg1", "root.sg1.d1", Arrays.asList("notExist", "s1"), true)) { + "root.db1", "root.db1.d1", Arrays.asList("notExist", "s1"), true)) { assertResultSetEqual(resultSet, lastQueryColumnNames, retArray2, true); } } catch (StatementExecutionException e) { @@ -250,11 +250,11 @@ public void aggregationQueryTest() { String[] retArray = new String[] {"0,20,29,28,19,20"}; List paths = Arrays.asList( - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5"); + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5"); List aggregations = Collections.nCopies(paths.size(), TAggregationType.COUNT); List columnNames = new ArrayList<>(); @@ -277,11 +277,11 @@ public void aggregationQueryWithTimeRangeTest() { String[] retArray = new String[] {"0,12,15,22,13,6"}; List paths = Arrays.asList( - "root.sg1.d1.s1", - "root.sg1.d1.s2", - "root.sg1.d1.s3", - "root.sg1.d1.s4", - "root.sg1.d1.s5"); + "root.db1.d1.s1", + "root.db1.d1.s2", + "root.db1.d1.s3", + "root.db1.d1.s4", + "root.db1.d1.s5"); List aggregations = Collections.nCopies(paths.size(), TAggregationType.COUNT); List columnNames = new ArrayList<>(); @@ -304,7 +304,7 @@ public void aggregationQueryWithTimeRangeTest() { public void groupByQueryTest1() { String[] retArray = new String[] {"11,10,130142.0,13014.2", "21,1,null,230000.0", "31,0,355.0,null"}; - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s1"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s1"); List aggregations = Arrays.asList(TAggregationType.COUNT, TAggregationType.SUM, TAggregationType.AVG); @@ -336,7 +336,7 @@ public void groupByQueryTest2() { "31,0,130.0,null", "37,0,154.0,null" }; - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s1"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s1"); List aggregations = Arrays.asList(TAggregationType.COUNT, TAggregationType.SUM, TAggregationType.AVG); @@ -369,7 +369,7 @@ public void groupByQueryTest3() { "31,0,355.0,null", "36,0,190.0,null" }; - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2", "root.sg1.d1.s1"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2", "root.db1.d1.s1"); List aggregations = Arrays.asList(TAggregationType.COUNT, TAggregationType.SUM, TAggregationType.AVG); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java index ef7bffdb9f06a..b0dc9aced7200 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSchemaTemplateIT.java @@ -90,16 +90,16 @@ public void testCreateFlatTemplate() List compressors = Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY, CompressionType.LZ4); - session.setStorageGroup("root.sg"); + session.setStorageGroup("root.db"); session.createSchemaTemplate(tempName, measurements, dataTypes, encodings, compressors, true); - session.setSchemaTemplate("flatTemplate", "root.sg.d0"); + session.setSchemaTemplate("flatTemplate", "root.db.d0"); try { - session.setSchemaTemplate("flatTemplate", "root.sg.d0"); + session.setSchemaTemplate("flatTemplate", "root.db.d0"); fail(); } catch (StatementExecutionException e) { assertEquals( - TSStatusCode.METADATA_ERROR.getStatusCode() + ": Template already exists on root.sg.d0", + TSStatusCode.METADATA_ERROR.getStatusCode() + ": Template already exists on root.db.d0", e.getMessage()); } } @@ -107,7 +107,7 @@ public void testCreateFlatTemplate() @Test public void testShowTemplates() throws StatementExecutionException, IoTDBConnectionException, IOException { - session.setStorageGroup("root.sg"); + session.setStorageGroup("root.db"); Template temp1 = getTemplate("template1"); Template temp2 = getTemplate("template2"); @@ -121,68 +121,68 @@ public void testShowTemplates() new HashSet<>(Arrays.asList("template1", "template2")), new HashSet<>(session.showAllTemplates())); - session.setSchemaTemplate("template1", "root.sg.v1"); - session.setSchemaTemplate("template1", "root.sg.v2"); - session.setSchemaTemplate("template1", "root.sg.v3"); + session.setSchemaTemplate("template1", "root.db.v1"); + session.setSchemaTemplate("template1", "root.db.v2"); + session.setSchemaTemplate("template1", "root.db.v3"); assertEquals( - new HashSet<>(Arrays.asList("root.sg.v1", "root.sg.v2", "root.sg.v3")), + new HashSet<>(Arrays.asList("root.db.v1", "root.db.v2", "root.db.v3")), new HashSet<>(session.showPathsTemplateSetOn("template1"))); assertEquals( new HashSet<>(Collections.emptyList()), new HashSet<>(session.showPathsTemplateUsingOn("template1"))); - session.setSchemaTemplate("template2", "root.sg.v4"); - session.setSchemaTemplate("template2", "root.sg.v5"); - session.setSchemaTemplate("template2", "root.sg.v6"); + session.setSchemaTemplate("template2", "root.db.v4"); + session.setSchemaTemplate("template2", "root.db.v5"); + session.setSchemaTemplate("template2", "root.db.v6"); assertEquals( - new HashSet<>(Arrays.asList("root.sg.v4", "root.sg.v5", "root.sg.v6")), + new HashSet<>(Arrays.asList("root.db.v4", "root.db.v5", "root.db.v6")), new HashSet<>(session.showPathsTemplateSetOn("template2"))); assertEquals( new HashSet<>( Arrays.asList( - "root.sg.v1", - "root.sg.v2", - "root.sg.v3", - "root.sg.v4", - "root.sg.v5", - "root.sg.v6")), + "root.db.v1", + "root.db.v2", + "root.db.v3", + "root.db.v4", + "root.db.v5", + "root.db.v6")), new HashSet<>(session.showPathsTemplateSetOn("*"))); session.insertRecord( - "root.sg.v1.GPS", + "root.db.v1.GPS", 110L, Collections.singletonList("x"), Collections.singletonList(TSDataType.FLOAT), Collections.singletonList(1.0f)); assertEquals( - new HashSet<>(Collections.singletonList("root.sg.v1.GPS")), + new HashSet<>(Collections.singletonList("root.db.v1.GPS")), new HashSet<>(session.showPathsTemplateUsingOn("template1"))); session.insertRecord( - "root.sg.v5.GPS", + "root.db.v5.GPS", 110L, Collections.singletonList("x"), Collections.singletonList(TSDataType.FLOAT), Collections.singletonList(1.0f)); assertEquals( - new HashSet<>(Collections.singletonList("root.sg.v1.GPS")), + new HashSet<>(Collections.singletonList("root.db.v1.GPS")), new HashSet<>(session.showPathsTemplateUsingOn("template1"))); assertEquals( - new HashSet<>(Collections.singletonList("root.sg.v5.GPS")), + new HashSet<>(Collections.singletonList("root.db.v5.GPS")), new HashSet<>(session.showPathsTemplateUsingOn("template2"))); } @Test public void testDropTemplate() throws StatementExecutionException, IoTDBConnectionException, IOException { - session.setStorageGroup("root.sg"); + session.setStorageGroup("root.db"); Template temp1 = getTemplate("template1"); @@ -204,7 +204,7 @@ public void testDropTemplate() session.dropSchemaTemplate("template1"); session.createSchemaTemplate(temp1); - session.setSchemaTemplate("template1", "root.sg.v1"); + session.setSchemaTemplate("template1", "root.db.v1"); try { session.dropSchemaTemplate("template1"); @@ -216,7 +216,7 @@ public void testDropTemplate() e.getMessage()); } - session.unsetSchemaTemplate("root.sg.v1", "template1"); + session.unsetSchemaTemplate("root.db.v1", "template1"); session.dropSchemaTemplate("template1"); session.createSchemaTemplate(temp1); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java index ad2939af5aaab..e599b5b0ac33b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSimpleIT.java @@ -92,7 +92,7 @@ public class IoTDBSessionSimpleIT { private static Logger LOGGER = LoggerFactory.getLogger(IoTDBSessionSimpleIT.class); - private static final String[] databasesToClear = new String[] {"root.sg", "root.sg1"}; + private static final String[] databasesToClear = new String[] {"root.db", "root.db1"}; @BeforeClass public static void setUpClass() throws Exception { @@ -124,7 +124,7 @@ public void insertPartialTabletTest() { schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg.d", schemaList, 10); + Tablet tablet = new Tablet("root.db.d", schemaList, 10); long timestamp = System.currentTimeMillis(); @@ -163,21 +163,21 @@ public void insertPartialTabletTest() { public void insertPartialTabletsTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { session.createTimeseries( - "root.sg.d2.s2", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db.d2.s2", TSDataType.BOOLEAN, TSEncoding.PLAIN, CompressionType.SNAPPY); List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet1 = new Tablet("root.sg.d1", schemaList, 10); - Tablet tablet2 = new Tablet("root.sg.d2", schemaList, 10); - Tablet tablet3 = new Tablet("root.sg.d3", schemaList, 10); + Tablet tablet1 = new Tablet("root.db.d1", schemaList, 10); + Tablet tablet2 = new Tablet("root.db.d2", schemaList, 10); + Tablet tablet3 = new Tablet("root.db.d3", schemaList, 10); Map tabletMap = new HashMap<>(); - tabletMap.put("root.sg.d1", tablet1); - tabletMap.put("root.sg.d2", tablet2); - tabletMap.put("root.sg.d3", tablet3); + tabletMap.put("root.db.d1", tablet1); + tabletMap.put("root.db.d2", tablet2); + tabletMap.put("root.db.d3", tablet3); long timestamp = System.currentTimeMillis(); @@ -217,7 +217,7 @@ public void insertPartialTabletsTest() { } fail(); } catch (Exception e) { - assertTrue(e.getMessage().contains("data type of root.sg.d2.s2 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d2.s2 is not consistent")); } } @@ -225,7 +225,7 @@ public void insertPartialTabletsTest() { @Category({LocalStandaloneIT.class, ClusterIT.class}) public void insertByStrAndInferTypeTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -246,7 +246,7 @@ public void insertByStrAndInferTypeTest() { expected.add(TSDataType.TEXT.name()); Set actual = new HashSet<>(); - SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.sg1.**"); + SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.db1.**"); while (dataSet.hasNext()) { actual.add(dataSet.next().getFields().get(3).getStringValue()); } @@ -262,7 +262,7 @@ public void insertByStrAndInferTypeTest() { @Category({LocalStandaloneIT.class, ClusterIT.class}) public void insertWrongPathByStrAndInferTypeTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1..d1"; + String deviceId = "root.db1..d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -293,7 +293,7 @@ public void insertWrongPathByStrAndInferTypeTest() { @Category({LocalStandaloneIT.class, ClusterIT.class}) public void insertIntoIllegalTimeseriesTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1\n"; + String deviceId = "root.db1.d1\n"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -324,7 +324,7 @@ public void insertIntoIllegalTimeseriesTest() { @Category({LocalStandaloneIT.class, ClusterIT.class}) public void insertByObjAndNotInferTypeTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -351,7 +351,7 @@ public void insertByObjAndNotInferTypeTest() { expected.add(TSDataType.TEXT.name()); Set actual = new HashSet<>(); - SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.sg1.**"); + SessionDataSet dataSet = session.executeQueryStatement("show timeseries root.db1.**"); while (dataSet.hasNext()) { actual.add(dataSet.next().getFields().get(3).getStringValue()); } @@ -368,8 +368,8 @@ public void insertByObjAndNotInferTypeTest() { public void createMultiTimeseriesTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { List paths = new ArrayList<>(); - paths.add("root.sg1.d1.s1"); - paths.add("root.sg1.d1.s2"); + paths.add("root.db1.d1.s1"); + paths.add("root.db1.d1.s2"); List tsDataTypes = new ArrayList<>(); tsDataTypes.add(TSDataType.DOUBLE); tsDataTypes.add(TSDataType.DOUBLE); @@ -389,8 +389,8 @@ public void createMultiTimeseriesTest() { session.createMultiTimeseries( paths, tsDataTypes, tsEncodings, compressionTypes, null, tagsList, null, null); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.s1")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.s2")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.s1")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.s2")); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -457,7 +457,7 @@ public void insertTabletWithAlignedTimeseriesTest() { schemaList.add(new MeasurementSchema("s2", TSDataType.INT32)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); long timestamp = System.currentTimeMillis(); for (long row = 0; row < 10; row++) { @@ -504,7 +504,7 @@ public void insertTabletWithNullValuesTest() throws InterruptedException { schemaList.add(new MeasurementSchema("s4", TSDataType.BOOLEAN, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s5", TSDataType.TEXT, TSEncoding.RLE)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); for (long time = 0; time < 10; time++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, time); @@ -537,7 +537,7 @@ public void insertTabletWithNullValuesTest() throws InterruptedException { assertEquals(9L, field.getLongV()); } } - dataSet = session.executeQueryStatement("select s3 from root.sg1.d1"); + dataSet = session.executeQueryStatement("select s3 from root.db1.d1"); int result = 0; assertTrue(dataSet.hasNext()); while (dataSet.hasNext()) { @@ -558,7 +558,7 @@ public void insertTabletWithNullValuesTest() throws InterruptedException { TestUtils.stopForciblyAndRestartDataNodes(); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - SessionDataSet dataSet = session.executeQueryStatement("select s3 from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select s3 from root.db1.d1"); int result = 0; while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); @@ -588,7 +588,7 @@ public void insertTabletWithStringValuesTest() { schemaList.add(new MeasurementSchema("s5", TSDataType.TEXT, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s6", TSDataType.TEXT, TSEncoding.RLE)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); for (long time = 0; time < 10; time++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, time); @@ -610,14 +610,14 @@ public void insertTabletWithStringValuesTest() { tablet.reset(); } - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db1.d1"); while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); List fields = rowRecord.getFields(); // this test may occasionally fail by IndexOutOfBoundsException if (fields.size() != 7) { SessionDataSet showTimeseriesDataSet = - session.executeQueryStatement("show timeseries root.sg1.d1.*"); + session.executeQueryStatement("show timeseries root.db1.d1.*"); LOGGER.error("show timeseries result:"); while (showTimeseriesDataSet.hasNext()) { RowRecord row = showTimeseriesDataSet.next(); @@ -646,7 +646,7 @@ public void insertTabletWithNegativeTimestampTest() { schemaList.add(new MeasurementSchema("s5", TSDataType.TEXT, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s6", TSDataType.TEXT, TSEncoding.RLE)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); for (long time = 0; time < 10; time++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, -time); @@ -668,7 +668,7 @@ public void insertTabletWithNegativeTimestampTest() { tablet.reset(); } - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db1.d1"); long count = 0L; while (dataSet.hasNext()) { count++; @@ -694,7 +694,7 @@ public void insertTabletWithWrongTimestampPrecisionTest() { schemaList.add(new MeasurementSchema("s5", TSDataType.TEXT, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s6", TSDataType.TEXT, TSEncoding.RLE)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); for (long time = 1694689856546000000L; time < 1694689856546000010L; time++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, time); @@ -729,7 +729,7 @@ public void insertTabletWithDuplicatedMeasurementsTest() { schemaList.add(new MeasurementSchema("s0", TSDataType.DOUBLE, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s0", TSDataType.DOUBLE, TSEncoding.RLE)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList); + Tablet tablet = new Tablet("root.db1.d1", schemaList); for (long time = 0L; time < 10L; time++) { int rowIndex = tablet.getRowSize(); tablet.addTimestamp(rowIndex, time); @@ -757,11 +757,11 @@ public void createTimeSeriesWithDoubleTicksTest() { session.close(); return; } - String database = "root.sg"; + String database = "root.db"; session.setStorageGroup(database); session.createTimeseries( - "root.sg.`my.device.with.colon:`.s", + "root.db.`my.device.with.colon:`.s", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); @@ -785,12 +785,12 @@ public void createWrongTimeSeriesTest() { session.close(); return; } - String database = "root.sg"; + String database = "root.db"; session.setStorageGroup(database); try { session.createTimeseries( - "root.sg.d1..s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d1..s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } catch (IoTDBConnectionException | StatementExecutionException e) { LOGGER.error("", e); } @@ -801,7 +801,7 @@ public void createWrongTimeSeriesTest() { LOGGER.error("", e); } - final SessionDataSet dataSet = session.executeQueryStatement("SHOW TIMESERIES root.sg.**"); + final SessionDataSet dataSet = session.executeQueryStatement("SHOW TIMESERIES root.db.**"); assertFalse(dataSet.hasNext()); session.deleteDatabase(database); @@ -816,16 +816,16 @@ public void createWrongTimeSeriesTest() { public void deleteNonExistTimeSeriesTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { session.insertRecord( - "root.sg1.d1", 0, Arrays.asList("t1", "t2", "t3"), Arrays.asList("123", "333", "444")); + "root.db1.d1", 0, Arrays.asList("t1", "t2", "t3"), Arrays.asList("123", "333", "444")); try { session.deleteTimeseries( - Arrays.asList("root.sg1.d1.t6", "root.sg1.d1.t2", "root.sg1.d1.t3")); + Arrays.asList("root.db1.d1.t6", "root.db1.d1.t2", "root.db1.d1.t3")); } catch (BatchExecutionException e) { - assertTrue(e.getMessage().contains("Path [root.sg1.d1.t6] does not exist;")); + assertTrue(e.getMessage().contains("Path [root.db1.d1.t6] does not exist;")); } - assertTrue(session.checkTimeseriesExists("root.sg1.d1.t1")); - assertFalse(session.checkTimeseriesExists("root.sg1.d1.t2")); - assertFalse(session.checkTimeseriesExists("root.sg1.d1.t3")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.t1")); + assertFalse(session.checkTimeseriesExists("root.db1.d1.t2")); + assertFalse(session.checkTimeseriesExists("root.db1.d1.t3")); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -877,7 +877,7 @@ public void insertOneDeviceRecordsTest() { TSDataType.BOOLEAN, 5.0f, Boolean.TRUE); - session.insertRecordsOfOneDevice("root.sg.d1", times, measurements, datatypes, values); + session.insertRecordsOfOneDevice("root.db.d1", times, measurements, datatypes, values); checkResult(session); } catch (Exception e) { e.printStackTrace(); @@ -914,17 +914,17 @@ private void addLine( private void checkResult(ISession session) throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db.d1"); dataSet.getColumnNames(); assertArrayEquals( dataSet.getColumnNames().toArray(new String[0]), new String[] { "Time", - "root.sg.d1.s3", - "root.sg.d1.s4", - "root.sg.d1.s5", - "root.sg.d1.s1", - "root.sg.d1.s2" + "root.db.d1.s3", + "root.db.d1.s4", + "root.db.d1.s5", + "root.db.d1.s1", + "root.db.d1.s2" }); assertArrayEquals( dataSet.getColumnTypes().toArray(new String[0]), @@ -1017,7 +1017,7 @@ public void insertOneDeviceRecordsWithOrderTest() { 1, 2); - session.insertRecordsOfOneDevice("root.sg.d1", times, measurements, datatypes, values, true); + session.insertRecordsOfOneDevice("root.db.d1", times, measurements, datatypes, values, true); checkResult(session); } catch (Exception e) { e.printStackTrace(); @@ -1071,7 +1071,7 @@ public void insertOneDeviceRecordsWithIncorrectOrderTest() { 5.0f, Boolean.TRUE); - session.insertRecordsOfOneDevice("root.sg.d1", times, measurements, datatypes, values, true); + session.insertRecordsOfOneDevice("root.db.d1", times, measurements, datatypes, values, true); checkResult(session); } catch (Exception e) { e.printStackTrace(); @@ -1124,7 +1124,7 @@ public void insertOneDeviceRecordsWithDuplicatedMeasurementsTest() { TSDataType.BOOLEAN, 5.0f, Boolean.TRUE); - session.insertRecordsOfOneDevice("root.sg.d1", times, measurements, datatypes, values); + session.insertRecordsOfOneDevice("root.db.d1", times, measurements, datatypes, values); } catch (Exception e) { assertTrue(e.getMessage().contains("Insertion contains duplicated measurement: s2")); } @@ -1140,7 +1140,7 @@ public void insertRecordsWithDuplicatedMeasurementsTest() { List> values = new ArrayList<>(); List devices = new ArrayList<>(); - devices.add("root.sg.d1"); + devices.add("root.db.d1"); addLine( times, measurements, @@ -1153,7 +1153,7 @@ public void insertRecordsWithDuplicatedMeasurementsTest() { TSDataType.INT32, 1, 2); - devices.add("root.sg.d2"); + devices.add("root.db.d2"); addLine( times, measurements, @@ -1166,7 +1166,7 @@ public void insertRecordsWithDuplicatedMeasurementsTest() { TSDataType.INT32, 3, 4); - devices.add("root.sg.d3"); + devices.add("root.db.d3"); addLine( times, measurements, @@ -1196,7 +1196,7 @@ public void insertRecordsWithExpiredDataTest() List> values = new ArrayList<>(); List devices = new ArrayList<>(); - devices.add("root.sg.d1"); + devices.add("root.db.d1"); addLine( times, measurements, @@ -1209,15 +1209,15 @@ public void insertRecordsWithExpiredDataTest() TSDataType.INT32, 1, 2); - session.executeNonQueryStatement("set ttl to root.sg.d1 1"); + session.executeNonQueryStatement("set ttl to root.db.d1 1"); try { session.insertRecords(devices, times, measurements, datatypes, values); fail(); } catch (Exception e) { assertTrue(e.getMessage().contains("less than ttl time bound")); } - session.executeNonQueryStatement("unset ttl to root.sg.d1"); - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg.d1"); + session.executeNonQueryStatement("unset ttl to root.db.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db.d1"); assertFalse(dataSet.hasNext()); } } @@ -1234,7 +1234,7 @@ public void insertStringRecordsOfOneDeviceWithOrderTest() { addStringLine(times, measurements, values, 2L, "s2", "s3", "3", "4"); addStringLine(times, measurements, values, 3L, "s1", "s2", "false", "6"); - session.insertStringRecordsOfOneDevice("root.sg.d1", times, measurements, values, true); + session.insertStringRecordsOfOneDevice("root.db.d1", times, measurements, values, true); checkResultForInsertStringRecordsOfOneDevice(session); } catch (Exception e) { e.printStackTrace(); @@ -1244,17 +1244,17 @@ public void insertStringRecordsOfOneDeviceWithOrderTest() { private void checkResultForInsertStringRecordsOfOneDevice(ISession session) throws StatementExecutionException, IoTDBConnectionException { - SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select * from root.db.d1"); dataSet.getColumnNames(); assertArrayEquals( dataSet.getColumnNames().toArray(new String[0]), new String[] { "Time", - "root.sg.d1.s3", - "root.sg.d1.s4", - "root.sg.d1.s5", - "root.sg.d1.s1", - "root.sg.d1.s2" + "root.db.d1.s3", + "root.db.d1.s4", + "root.db.d1.s5", + "root.db.d1.s1", + "root.db.d1.s2" }); assertArrayEquals( dataSet.getColumnTypes().toArray(new String[0]), @@ -1330,7 +1330,7 @@ public void insertStringRecordsOfOneDeviceWithIncorrectOrderTest() { addStringLine(times, measurements, values, 1L, "s4", "s5", "5.0", "true"); addStringLine(times, measurements, values, 3L, "s1", "s2", "false", "6"); - session.insertStringRecordsOfOneDevice("root.sg.d1", times, measurements, values); + session.insertStringRecordsOfOneDevice("root.db.d1", times, measurements, values); checkResultForInsertStringRecordsOfOneDevice(session); } catch (Exception e) { e.printStackTrace(); @@ -1351,7 +1351,7 @@ public void insertAlignedStringRecordsOfOneDeviceWithOrderTest() { addStringLine(times, measurements, values, 3L, "s1", "s2", "false", "6"); session.insertAlignedStringRecordsOfOneDevice( - "root.sg.d1", times, measurements, values, true); + "root.db.d1", times, measurements, values, true); checkResultForInsertStringRecordsOfOneDevice(session); } catch (Exception e) { e.printStackTrace(); @@ -1371,7 +1371,7 @@ public void insertAlignedStringRecordsOfOneDeviceWithIncorrectOrderTest() { addStringLine(times, measurements, values, 1L, "s4", "s5", "5.0", "true"); addStringLine(times, measurements, values, 3L, "s1", "s2", "false", "6"); - session.insertAlignedStringRecordsOfOneDevice("root.sg.d1", times, measurements, values); + session.insertAlignedStringRecordsOfOneDevice("root.db.d1", times, measurements, values); checkResultForInsertStringRecordsOfOneDevice(session); } catch (Exception e) { e.printStackTrace(); @@ -1384,8 +1384,8 @@ public void insertAlignedStringRecordsOfOneDeviceWithIncorrectOrderTest() { public void insertIllegalPathTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { String msg = "[%s] Exception occurred: %s failed. %s is not a legal path"; - String deviceId = "root.sg..d1"; - List deviceIds = Arrays.asList("root.sg..d1", "root.sg.d2"); + String deviceId = "root.db..d1"; + List deviceIds = Arrays.asList("root.db..d1", "root.db.d2"); List timestamps = Arrays.asList(1L, 1L); List measurements = Arrays.asList("s1", "s2", "s3"); List> allMeasurements = Arrays.asList(measurements, measurements); @@ -1519,14 +1519,14 @@ public void insertIllegalPathTest() { 5); Tablet tablet2 = new Tablet( - "root.sg.d2", + "root.db.d2", Arrays.asList( new MeasurementSchema("s1", TSDataType.INT32), new MeasurementSchema("s2", TSDataType.FLOAT)), 5); HashMap tablets = new HashMap<>(); tablets.put(deviceId, tablet1); - tablets.put("root.sg.d2", tablet2); + tablets.put("root.db.d2", tablet2); long ts = 16L; for (long row = 0; row < 8; row++) { int row1 = tablet1.getRowSize(); @@ -1566,7 +1566,7 @@ public void insertIllegalPathTest() { try { session.createTimeseries( - "root.sg..d1.s1", TSDataType.INT32, TSEncoding.PLAIN, CompressionType.SNAPPY); + "root.db..d1.s1", TSDataType.INT32, TSEncoding.PLAIN, CompressionType.SNAPPY); fail("Exception expected"); } catch (StatementExecutionException e) { assertTrue( @@ -1576,7 +1576,7 @@ public void insertIllegalPathTest() { msg, TSStatusCode.ILLEGAL_PATH, OperationType.CREATE_TIMESERIES, - "root.sg..d1.s1"))); + "root.db..d1.s1"))); } try { @@ -1604,7 +1604,7 @@ public void insertIllegalPathTest() { try { session.createMultiTimeseries( - Arrays.asList("root.sg.d1..s1", "root.sg.d1.s2", "root.sg.d1.s3"), + Arrays.asList("root.db.d1..s1", "root.db.d1.s2", "root.db.d1.s3"), tsDataTypes, tsEncodings, compressionTypes, @@ -1621,11 +1621,11 @@ public void insertIllegalPathTest() { msg, TSStatusCode.ILLEGAL_PATH, OperationType.CREATE_MULTI_TIMESERIES, - "root.sg.d1..s1"))); + "root.db.d1..s1"))); } try { - session.deleteTimeseries("root.sg.d1..s1"); + session.deleteTimeseries("root.db.d1..s1"); fail("Exception expected"); } catch (StatementExecutionException e) { assertTrue( @@ -1635,7 +1635,7 @@ public void insertIllegalPathTest() { msg, TSStatusCode.ILLEGAL_PATH, OperationType.DELETE_TIMESERIES, - "root.sg.d1..s1"))); + "root.db.d1..s1"))); } } catch (Exception e) { e.printStackTrace(); @@ -1648,7 +1648,7 @@ public void insertIllegalPathTest() { public void conversionFunctionTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { // prepare data - String deviceId = "root.sg.d1"; + String deviceId = "root.db.d1"; List times = new ArrayList<>(); List> measurementsList = new ArrayList<>(); List> typesList = new ArrayList<>(); @@ -1695,7 +1695,7 @@ public void conversionFunctionTest() { casts[i] = String.format("cast(s%s, 'type'='%s')", i + 1, targetTypes[i]); } buffer.append(StringUtils.join(casts, ",")); - buffer.append(" from root.sg.d1"); + buffer.append(" from root.db.d1"); String sql = buffer.toString(); SessionDataSet sessionDataSet = session.executeQueryStatement(sql); @@ -1723,24 +1723,24 @@ public void conversionFunctionTest() { @Category({LocalStandaloneIT.class, ClusterIT.class}) public void insertPartialTablet2Test() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - if (!session.checkTimeseriesExists("root.sg.d.s1")) { + if (!session.checkTimeseriesExists("root.db.d.s1")) { session.createTimeseries( - "root.sg.d.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists("root.sg.d.s2")) { + if (!session.checkTimeseriesExists("root.db.d.s2")) { session.createTimeseries( - "root.sg.d.s2", TSDataType.DOUBLE, TSEncoding.GORILLA, CompressionType.SNAPPY); + "root.db.d.s2", TSDataType.DOUBLE, TSEncoding.GORILLA, CompressionType.SNAPPY); } - if (!session.checkTimeseriesExists("root.sg.d.s3")) { + if (!session.checkTimeseriesExists("root.db.d.s3")) { session.createTimeseries( - "root.sg.d.s3", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d.s3", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); } List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE)); schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg.d", schemaList, 10); + Tablet tablet = new Tablet("root.db.d", schemaList, 10); long timestamp = System.currentTimeMillis(); @@ -1755,7 +1755,7 @@ public void insertPartialTablet2Test() { session.insertTablet(tablet, true); } catch (StatementExecutionException e) { assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } @@ -1767,13 +1767,13 @@ public void insertPartialTablet2Test() { session.insertTablet(tablet); } catch (StatementExecutionException e) { assertTrue(e.getMessage().contains("insert measurements [s3] caused by")); - assertTrue(e.getMessage().contains("data type of root.sg.d.s3 is not consistent")); + assertTrue(e.getMessage().contains("data type of root.db.d.s3 is not consistent")); } tablet.reset(); } SessionDataSet dataSet = - session.executeQueryStatement("select count(s1), count(s2), count(s3) from root.sg.d"); + session.executeQueryStatement("select count(s1), count(s2), count(s3) from root.db.d"); while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); assertEquals(15L, rowRecord.getFields().get(0).getLongV()); @@ -1840,7 +1840,7 @@ public void insertBinaryAsTextTest() { byte[] data = (byte[]) bytesData.get(i); Binary dataBinary = new Binary(data); session.insertRecord( - "root.sg1.d1", + "root.db1.d1", i, Collections.singletonList("s0"), Collections.singletonList(TSDataType.TEXT), @@ -1849,7 +1849,7 @@ public void insertBinaryAsTextTest() { // insert data using insertTablet List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.TEXT)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList, 100); + Tablet tablet = new Tablet("root.db1.d1", schemaList, 100); for (int i = 0; i < bytesData.size(); i++) { byte[] data = (byte[]) bytesData.get(i); int rowIndex = tablet.getRowSize(); @@ -1859,10 +1859,10 @@ public void insertBinaryAsTextTest() { } session.insertTablet(tablet); // check result - SessionDataSet dataSet = session.executeQueryStatement("select ** from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select ** from root.db1.d1"); assertArrayEquals( dataSet.getColumnNames().toArray(new String[0]), - new String[] {"Time", "root.sg1.d1.s0", "root.sg1.d1.s1"}); + new String[] {"Time", "root.db1.d1.s0", "root.db1.d1.s1"}); while (dataSet.hasNext()) { RowRecord rowRecord = dataSet.next(); for (int i = 0; i < 2; i++) { @@ -1927,14 +1927,14 @@ public void convertRecordsToTabletsTest() { List> values = new ArrayList<>(); List timestamps = new ArrayList<>(); for (long row = 0; row < 1000; row++) { - devices.add("root.sg1.d1"); + devices.add("root.db1.d1"); measurementsList.add(measurements); typeList.add(types); values.add(value); timestamps.add(row); } List queryMeasurement = new ArrayList<>(); - queryMeasurement.add("root.sg1.d1.s1"); + queryMeasurement.add("root.db1.d1.s1"); List queryType = new ArrayList<>(); queryType.add(TAggregationType.COUNT); try (ISession session = EnvFactory.getEnv().getSessionConnection()) { @@ -2112,20 +2112,20 @@ record = dataSet.next(); public void testWriteRestartAndDeleteDB() throws IoTDBConnectionException, StatementExecutionException { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - session.insertRecord("root.sg1.d1", 1, Arrays.asList("s3"), Arrays.asList("1")); + session.insertRecord("root.db1.d1", 1, Arrays.asList("s3"), Arrays.asList("1")); TestUtils.stopForciblyAndRestartDataNodes(); - SessionDataSet dataSet = session.executeQueryStatement("select s3 from root.sg1.d1"); + SessionDataSet dataSet = session.executeQueryStatement("select s3 from root.db1.d1"); dataSet.next(); dataSet.close(); - session.executeNonQueryStatement("DELETE DATABASE root.sg1"); + session.executeNonQueryStatement("DELETE DATABASE root.db1"); session.insertRecord( - "root.sg1.d1", 1, Arrays.asList("s1", "s2", "s3"), Arrays.asList("1", "1", "1")); + "root.db1.d1", 1, Arrays.asList("s1", "s2", "s3"), Arrays.asList("1", "1", "1")); - dataSet = session.executeQueryStatement("SELECT * FROM root.sg1.d1"); + dataSet = session.executeQueryStatement("SELECT * FROM root.db1.d1"); RowRecord record = dataSet.next(); assertEquals(3, record.getFields().size()); } @@ -2136,7 +2136,7 @@ public void testWriteRestartAndDeleteDB() public void testQueryAllDataType() throws IoTDBConnectionException, StatementExecutionException { Tablet tablet = new Tablet( - "root.sg.d1", + "root.db.d1", Arrays.asList( new MeasurementSchema("s1", TSDataType.INT32), new MeasurementSchema("s2", TSDataType.INT64), @@ -2165,33 +2165,33 @@ public void testQueryAllDataType() throws IoTDBConnectionException, StatementExe try (ISession session = EnvFactory.getEnv().getSessionConnection()) { session.insertTablet(tablet); - try (SessionDataSet dataSet = session.executeQueryStatement("select * from root.sg.d1")) { + try (SessionDataSet dataSet = session.executeQueryStatement("select * from root.db.d1")) { DataIterator iterator = dataSet.iterator(); int count = 0; while (iterator.next()) { count++; - assertFalse(iterator.isNull("root.sg.d1.s1")); - assertEquals(1, iterator.getInt("root.sg.d1.s1")); - assertFalse(iterator.isNull("root.sg.d1.s2")); - assertEquals(1L, iterator.getLong("root.sg.d1.s2")); - assertFalse(iterator.isNull("root.sg.d1.s3")); - assertEquals(0, iterator.getFloat("root.sg.d1.s3"), 0.01); - assertFalse(iterator.isNull("root.sg.d1.s4")); - assertEquals(0, iterator.getDouble("root.sg.d1.s4"), 0.01); - assertFalse(iterator.isNull("root.sg.d1.s5")); - assertEquals("text_value", iterator.getString("root.sg.d1.s5")); - assertFalse(iterator.isNull("root.sg.d1.s6")); - assertTrue(iterator.getBoolean("root.sg.d1.s6")); - assertFalse(iterator.isNull("root.sg.d1.s7")); - assertEquals(new Timestamp(1), iterator.getTimestamp("root.sg.d1.s7")); - assertFalse(iterator.isNull("root.sg.d1.s8")); - assertEquals(new Binary(new byte[] {1}), iterator.getBlob("root.sg.d1.s8")); - assertFalse(iterator.isNull("root.sg.d1.s9")); - assertEquals("string_value", iterator.getString("root.sg.d1.s9")); - assertFalse(iterator.isNull("root.sg.d1.s10")); - assertEquals(DateUtils.parseIntToLocalDate(20250403), iterator.getDate("root.sg.d1.s10")); - assertTrue(iterator.isNull("root.sg.d1.s11")); - assertNull(iterator.getTimestamp("root.sg.d1.s11")); + assertFalse(iterator.isNull("root.db.d1.s1")); + assertEquals(1, iterator.getInt("root.db.d1.s1")); + assertFalse(iterator.isNull("root.db.d1.s2")); + assertEquals(1L, iterator.getLong("root.db.d1.s2")); + assertFalse(iterator.isNull("root.db.d1.s3")); + assertEquals(0, iterator.getFloat("root.db.d1.s3"), 0.01); + assertFalse(iterator.isNull("root.db.d1.s4")); + assertEquals(0, iterator.getDouble("root.db.d1.s4"), 0.01); + assertFalse(iterator.isNull("root.db.d1.s5")); + assertEquals("text_value", iterator.getString("root.db.d1.s5")); + assertFalse(iterator.isNull("root.db.d1.s6")); + assertTrue(iterator.getBoolean("root.db.d1.s6")); + assertFalse(iterator.isNull("root.db.d1.s7")); + assertEquals(new Timestamp(1), iterator.getTimestamp("root.db.d1.s7")); + assertFalse(iterator.isNull("root.db.d1.s8")); + assertEquals(new Binary(new byte[] {1}), iterator.getBlob("root.db.d1.s8")); + assertFalse(iterator.isNull("root.db.d1.s9")); + assertEquals("string_value", iterator.getString("root.db.d1.s9")); + assertFalse(iterator.isNull("root.db.d1.s10")); + assertEquals(DateUtils.parseIntToLocalDate(20250403), iterator.getDate("root.db.d1.s10")); + assertTrue(iterator.isNull("root.db.d1.s11")); + assertNull(iterator.getTimestamp("root.db.d1.s11")); assertEquals(new Timestamp(0), iterator.getTimestamp("Time")); assertFalse(iterator.isNull("Time")); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSyntaxConventionIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSyntaxConventionIT.java index ac65c6be784e6..aaad7923cf2de 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSyntaxConventionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionSyntaxConventionIT.java @@ -69,12 +69,12 @@ public void tearDown() throws Exception { @Test public void createTimeSeriesTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String database = "root.sg"; + String database = "root.db"; session.setStorageGroup(database); try { session.createTimeseries( - "root.sg.d1.`a.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d1.`a.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); fail(); } catch (Exception e) { assertTrue(e.getMessage().contains("is not a legal path")); @@ -82,13 +82,13 @@ public void createTimeSeriesTest() { try { session.createTimeseries( - "root.sg.d1.a`.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); + "root.db.d1.a`.s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.SNAPPY); fail(); } catch (Exception e) { assertTrue(e.getMessage().contains("is not a legal path")); } - final SessionDataSet dataSet = session.executeQueryStatement("SHOW TIMESERIES root.sg.**"); + final SessionDataSet dataSet = session.executeQueryStatement("SHOW TIMESERIES root.db.**"); assertFalse(dataSet.hasNext()); session.deleteDatabase(database); @@ -101,7 +101,7 @@ public void createTimeSeriesTest() { @Test public void insertTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("`\"a“(Φ)”b\"`"); @@ -121,15 +121,15 @@ public void insertTest() { session.insertRecord(deviceId, 1L, measurements, values); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`\"a“(Φ)”b\"`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`\"a>b\"`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.```a.b```")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`'a“(Φ)”b'`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`'a>b'`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`a“(Φ)”b`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`a>b`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.`\\\"a`")); - assertTrue(session.checkTimeseriesExists("root.sg1.d1.aaa")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`\"a“(Φ)”b\"`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`\"a>b\"`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.```a.b```")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`'a“(Φ)”b'`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`'a>b'`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`a“(Φ)”b`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`a>b`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.`\\\"a`")); + assertTrue(session.checkTimeseriesExists("root.db1.d1.aaa")); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); @@ -139,7 +139,7 @@ public void insertTest() { @Test public void inserRecordWithIllegalMeasurementTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); List values = new ArrayList<>(); measurements.add("a.b"); @@ -221,7 +221,7 @@ public void inserRecordWithIllegalMeasurementTest() { @Test public void insertRecordsWithIllegalMeasurementTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("a.b"); measurements.add("111"); @@ -256,7 +256,7 @@ public void insertRecordsWithIllegalMeasurementTest() { @Test public void insertTabletWithIllegalMeasurementTest() { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("wrong`", TSDataType.INT64, TSEncoding.RLE)); schemaList.add(new MeasurementSchema("s2", TSDataType.DOUBLE, TSEncoding.RLE)); @@ -292,7 +292,7 @@ public void insertTabletWithIllegalMeasurementTest() { @Test public void createAlignedTimeseriesWithIllegalMeasurementTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("111"); measurements.add("a.b"); @@ -322,7 +322,7 @@ public void createAlignedTimeseriesWithIllegalMeasurementTest() { @Test public void createAlignedTimeseriesWithIllegalMeasurementAliasTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -363,8 +363,8 @@ public void createAlignedTimeseriesWithIllegalMeasurementAliasTest() { public void createMultiTimeseriesWithIllegalMeasurementAliasTest() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { List paths = new ArrayList<>(); - paths.add("root.sg1.d1.s1"); - paths.add("root.sg1.d1.s2"); + paths.add("root.db1.d1.s1"); + paths.add("root.db1.d1.s2"); List tsDataTypes = new ArrayList<>(); tsDataTypes.add(TSDataType.DOUBLE); tsDataTypes.add(TSDataType.DOUBLE); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/SessionIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/SessionIT.java index 52638352ee37c..12fdc979a27c0 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/SessionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/SessionIT.java @@ -73,7 +73,7 @@ public void tearDown() throws Exception { @Test public void testInsertByStrAndSelectFailedData() { try (ISession session = EnvFactory.getEnv().getSessionConnection()) { - String deviceId = "root.sg1.d1"; + String deviceId = "root.db1.d1"; session.createTimeseries( deviceId + ".s1", TSDataType.INT64, TSEncoding.RLE, CompressionType.UNCOMPRESSED); @@ -90,7 +90,7 @@ public void testInsertByStrAndSelectFailedData() { schemaList.add(new MeasurementSchema("s3", TSDataType.TEXT, TSEncoding.PLAIN)); schemaList.add(new MeasurementSchema("s4", TSDataType.INT64, TSEncoding.PLAIN)); - Tablet tablet = new Tablet("root.sg1.d1", schemaList, 10); + Tablet tablet = new Tablet("root.db1.d1", schemaList, 10); for (long time = 0; time < 10; time++) { int row = tablet.getRowSize(); @@ -109,7 +109,7 @@ public void testInsertByStrAndSelectFailedData() { } SessionDataSet dataSet = - session.executeQueryStatement("select s1, s2, s3, s4 from root.sg1.d1"); + session.executeQueryStatement("select s1, s2, s3, s4 from root.db1.d1"); int i = 0; while (dataSet.hasNext()) { RowRecord record = dataSet.next(); diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/pool/SessionPoolIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/pool/SessionPoolIT.java index d8fb9bb4c5072..03963088f150c 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/pool/SessionPoolIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/pool/SessionPoolIT.java @@ -81,7 +81,7 @@ public void insert() { () -> { try { pool.insertRecord( - "root.sg1.d1", + "root.db1.d1", 1, Collections.singletonList("s" + no), Collections.singletonList(TSDataType.INT64), @@ -110,7 +110,7 @@ public void incorrectSQL() { assertEquals(0, pool.currentAvailableSize()); try { pool.insertRecord( - ".root.sg1.d1", + ".root.db1.d1", 1, Collections.singletonList("s"), Collections.singletonList(TSDataType.INT64), @@ -135,7 +135,7 @@ public void incorrectExecuteQueryStatement() { () -> { try { SessionDataSetWrapper wrapper = - pool.executeQueryStatement("select * from root.sg1.d1 where time = " + no); + pool.executeQueryStatement("select * from root.db1.d1 where time = " + no); // this is incorrect because wrapper is not closed. // so all other 7 queries will be blocked } catch (IoTDBConnectionException | StatementExecutionException e) { @@ -182,11 +182,11 @@ private void correctQuery(ISessionPool pool, long timeoutInMs) { SessionDataSetWrapper wrapper; if (timeoutInMs == DEFAULT_QUERY_TIMEOUT) { wrapper = - pool.executeQueryStatement("select * from root.sg1.d1 where time = " + no); + pool.executeQueryStatement("select * from root.db1.d1 where time = " + no); } else { wrapper = pool.executeQueryStatement( - "select * from root.sg1.d1 where time = " + no, timeoutInMs); + "select * from root.db1.d1 where time = " + no, timeoutInMs); } pool.closeResultSet(wrapper); } catch (Exception e) { @@ -212,7 +212,7 @@ public void executeRawDataQuery() { ExecutorService service = Executors.newFixedThreadPool(10); write10Data(pool, true); List pathList = new ArrayList<>(); - pathList.add("root.sg1.d1.s1"); + pathList.add("root.db1.d1.s1"); for (int i = 0; i < 10; i++) { final int no = i; service.submit( @@ -247,7 +247,7 @@ public void tryIfTheServerIsRestart() { SessionDataSetWrapper wrapper = null; BaseNodeWrapper node = EnvFactory.getEnv().getDataNodeWrapper(0); try { - wrapper = pool.executeQueryStatement("select * from root.sg1.d1 where time > 1"); + wrapper = pool.executeQueryStatement("select * from root.db1.d1 where time > 1"); node.stop(); EnvFactory.getEnv() .ensureNodeStatus( @@ -316,7 +316,7 @@ public void tryIfTheServerIsRestartButDataIsGotten() { assertEquals(1, pool.currentAvailableSize()); SessionDataSetWrapper wrapper; try { - wrapper = pool.executeQueryStatement("select * from root.sg1.d1 where time > 1"); + wrapper = pool.executeQueryStatement("select * from root.db1.d1 where time > 1"); // user does not know what happens. assertEquals(0, pool.currentAvailableSize()); assertEquals(1, pool.currentOccupiedSize()); @@ -361,7 +361,7 @@ private void write10Data(ISessionPool pool, boolean failWhenThrowException) { for (int i = 0; i < 10; i++) { try { pool.insertRecord( - "root.sg1.d1", + "root.db1.d1", i, Collections.singletonList("s" + i), Collections.singletonList(TSDataType.INT64), @@ -381,7 +381,7 @@ public void testClose() { pool.close(); try { pool.insertRecord( - "root.sg1.d1", + "root.db1.d1", 1, Collections.singletonList("s1"), Collections.singletonList(TSDataType.INT64), diff --git a/iotdb-client/client-cpp/src/main/Session.h b/iotdb-client/client-cpp/src/main/Session.h index 35c05fad22c40..d27e7422277c7 100644 --- a/iotdb-client/client-cpp/src/main/Session.h +++ b/iotdb-client/client-cpp/src/main/Session.h @@ -113,7 +113,7 @@ void safe_cast(const T& value, Target& target) { * A tablet data of one device, the tablet contains multiple measurements of this device that share * the same time column. * - * for example: device root.sg1.d1 + * for example: device root.db1.d1 * * time, m1, m2, m3 * 1, 1, 2, 3 diff --git a/iotdb-client/client-py/iotdb/utils/NumpyTablet.py b/iotdb-client/client-py/iotdb/utils/NumpyTablet.py index 9a0860d3a43e9..83428fad4430a 100644 --- a/iotdb-client/client-py/iotdb/utils/NumpyTablet.py +++ b/iotdb-client/client-py/iotdb/utils/NumpyTablet.py @@ -41,7 +41,7 @@ def __init__( ): """ creating a numpy tablet for insertion - for example using tree-model, considering device: root.sg1.d1 + for example using tree-model, considering device: root.db1.d1 timestamps, m1, m2, m3 1, 125.3, True, text1 2, 111.6, False, text2 diff --git a/iotdb-client/client-py/iotdb/utils/Tablet.py b/iotdb-client/client-py/iotdb/utils/Tablet.py index 9b241723fe5b7..e2ad7ccebe9cf 100644 --- a/iotdb-client/client-py/iotdb/utils/Tablet.py +++ b/iotdb-client/client-py/iotdb/utils/Tablet.py @@ -50,7 +50,7 @@ def __init__( ): """ creating a tablet for insertion - for example using tree-model, considering device: root.sg1.d1 + for example using tree-model, considering device: root.db1.d1 timestamps, m1, m2, m3 1, 125.3, True, text1 2, 111.6, False, text2 diff --git a/iotdb-client/client-py/session_aligned_timeseries_example.py b/iotdb-client/client-py/session_aligned_timeseries_example.py index 450d69f281883..da87a55993c74 100644 --- a/iotdb-client/client-py/session_aligned_timeseries_example.py +++ b/iotdb-client/client-py/session_aligned_timeseries_example.py @@ -33,12 +33,12 @@ session.open(False) # set and delete databases -session.set_storage_group("root.sg_test_01") -session.set_storage_group("root.sg_test_02") -session.set_storage_group("root.sg_test_03") -session.set_storage_group("root.sg_test_04") -session.delete_storage_group("root.sg_test_02") -session.delete_storage_groups(["root.sg_test_03", "root.sg_test_04"]) +session.set_storage_group("root.db_test_01") +session.set_storage_group("root.db_test_02") +session.set_storage_group("root.db_test_03") +session.set_storage_group("root.db_test_04") +session.delete_storage_group("root.db_test_02") +session.delete_storage_groups(["root.db_test_03", "root.db_test_04"]) # setting aligned time series. measurements_lst_ = [ @@ -54,7 +54,7 @@ encoding_lst_ = [TSEncoding.PLAIN for _ in range(len(data_type_lst_))] compressor_lst_ = [Compressor.SNAPPY for _ in range(len(data_type_lst_))] session.create_aligned_time_series( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_lst_, data_type_lst_, encoding_lst_, @@ -81,7 +81,7 @@ encoding_lst_ = [TSEncoding.PLAIN for _ in range(len(data_type_lst_))] compressor_lst_ = [Compressor.SNAPPY for _ in range(len(data_type_lst_))] session.create_aligned_time_series( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_lst_, data_type_lst_, encoding_lst_, @@ -91,20 +91,20 @@ # delete time series session.delete_time_series( [ - "root.sg_test_01.d_02.s_07", - "root.sg_test_01.d_02.s_08", - "root.sg_test_01.d_02.s_09", + "root.db_test_01.d_02.s_07", + "root.db_test_01.d_02.s_08", + "root.db_test_01.d_02.s_09", ] ) # checking time series print( "s_07 expecting False, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_02.s_07"), + session.check_time_series_exists("root.db_test_01.d_02.s_07"), ) print( "s_03 expecting True, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_02.s_03"), + session.check_time_series_exists("root.db_test_01.d_02.s_03"), ) # insert one aligned record into the database. @@ -119,7 +119,7 @@ TSDataType.TEXT, ] session.insert_aligned_record( - "root.sg_test_01.d_02", 1, measurements_, data_types_, values_ + "root.db_test_01.d_02", 1, measurements_, data_types_, values_ ) # insert multiple aligned records into database @@ -132,7 +132,7 @@ [True, 77, 88, 1.25, 8.125, "test_records02"], ] data_type_list_ = [data_types_, data_types_] -device_ids_ = ["root.sg_test_01.d_02", "root.sg_test_01.d_02"] +device_ids_ = ["root.db_test_01.d_02", "root.db_test_01.d_02"] session.insert_aligned_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ ) @@ -146,16 +146,16 @@ ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [4, 5, 6, 7] tablet_ = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_02", measurements_, data_types_, values_, timestamps_ ) session.insert_aligned_tablet(tablet_) # insert multiple aligned tablets into database tablet_01 = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, [8, 9, 10, 11] + "root.db_test_01.d_02", measurements_, data_types_, values_, [8, 9, 10, 11] ) tablet_02 = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, [12, 13, 14, 15] + "root.db_test_01.d_02", measurements_, data_types_, values_, [12, 13, 14, 15] ) session.insert_aligned_tablets([tablet_01, tablet_02]) @@ -168,7 +168,7 @@ ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_02", measurements_, data_types_, values_, timestamps_ ) session.insert_aligned_tablet(tablet_) @@ -187,17 +187,17 @@ values_list = [[False, 22, 33], [True, 1, 23], [False, 15, 26]] session.insert_aligned_records_of_one_device( - "root.sg_test_01.d_02", time_list, measurements_list, data_types_list, values_list + "root.db_test_01.d_02", time_list, measurements_list, data_types_list, values_list ) # execute non-query sql statement session.execute_non_query_statement( - "insert into root.sg_test_01.d_02(timestamp, s_02) aligned values(16, 188)" + "insert into root.db_test_01.d_02(timestamp, s_02) aligned values(16, 188)" ) # execute sql query statement with session.execute_query_statement( - "select * from root.sg_test_01.d_02" + "select * from root.db_test_01.d_02" ) as session_data_set: session_data_set.set_fetch_size(1024) while session_data_set.has_next(): @@ -212,14 +212,14 @@ ] values_list = [["False", "22", "33"], ["True", "1", "23"], ["False", "15", "26"]] session.insert_aligned_string_records_of_one_device( - "root.sg_test_01.d_04", + "root.db_test_01.d_04", time_list, measurements_list, values_list, ) # delete database -session.delete_storage_group("root.sg_test_01") +session.delete_storage_group("root.db_test_01") # close session connection. session.close() diff --git a/iotdb-client/client-py/session_example.py b/iotdb-client/client-py/session_example.py index d0a6a3aba8e37..e30c62b273f0c 100644 --- a/iotdb-client/client-py/session_example.py +++ b/iotdb-client/client-py/session_example.py @@ -42,25 +42,25 @@ session.open(False) # create and delete databases -session.set_storage_group("root.sg_test_01") -session.set_storage_group("root.sg_test_02") -session.set_storage_group("root.sg_test_03") -session.set_storage_group("root.sg_test_04") -session.delete_storage_group("root.sg_test_02") -session.delete_storage_groups(["root.sg_test_03", "root.sg_test_04"]) +session.set_storage_group("root.db_test_01") +session.set_storage_group("root.db_test_02") +session.set_storage_group("root.db_test_03") +session.set_storage_group("root.db_test_04") +session.delete_storage_group("root.db_test_02") +session.delete_storage_groups(["root.db_test_03", "root.db_test_04"]) # setting time series. session.create_time_series( - "root.sg_test_01.d_01.s_01", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY + "root.db_test_01.d_01.s_01", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY ) session.create_time_series( - "root.sg_test_01.d_01.s_02", TSDataType.INT32, TSEncoding.PLAIN, Compressor.SNAPPY + "root.db_test_01.d_01.s_02", TSDataType.INT32, TSEncoding.PLAIN, Compressor.SNAPPY ) session.create_time_series( - "root.sg_test_01.d_01.s_03", TSDataType.INT64, TSEncoding.PLAIN, Compressor.SNAPPY + "root.db_test_01.d_01.s_03", TSDataType.INT64, TSEncoding.PLAIN, Compressor.SNAPPY ) session.create_time_series( - "root.sg_test_01.d_02.s_01", + "root.db_test_01.d_02.s_01", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY, @@ -72,12 +72,12 @@ # setting multiple time series once. ts_path_lst_ = [ - "root.sg_test_01.d_01.s_04", - "root.sg_test_01.d_01.s_05", - "root.sg_test_01.d_01.s_06", - "root.sg_test_01.d_01.s_07", - "root.sg_test_01.d_01.s_08", - "root.sg_test_01.d_01.s_09", + "root.db_test_01.d_01.s_04", + "root.db_test_01.d_01.s_05", + "root.db_test_01.d_01.s_06", + "root.db_test_01.d_01.s_07", + "root.db_test_01.d_01.s_08", + "root.db_test_01.d_01.s_09", ] data_type_lst_ = [ TSDataType.FLOAT, @@ -94,12 +94,12 @@ ) ts_path_lst_ = [ - "root.sg_test_01.d_02.s_04", - "root.sg_test_01.d_02.s_05", - "root.sg_test_01.d_02.s_06", - "root.sg_test_01.d_02.s_07", - "root.sg_test_01.d_02.s_08", - "root.sg_test_01.d_02.s_09", + "root.db_test_01.d_02.s_04", + "root.db_test_01.d_02.s_05", + "root.db_test_01.d_02.s_06", + "root.db_test_01.d_02.s_07", + "root.db_test_01.d_02.s_08", + "root.db_test_01.d_02.s_09", ] data_type_lst_ = [ TSDataType.FLOAT, @@ -127,28 +127,28 @@ # delete time series session.delete_time_series( [ - "root.sg_test_01.d_01.s_07", - "root.sg_test_01.d_01.s_08", - "root.sg_test_01.d_01.s_09", + "root.db_test_01.d_01.s_07", + "root.db_test_01.d_01.s_08", + "root.db_test_01.d_01.s_09", ] ) # checking time series print( "s_07 expecting False, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_01.s_07"), + session.check_time_series_exists("root.db_test_01.d_01.s_07"), ) print( "s_03 expecting True, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_01.s_03"), + session.check_time_series_exists("root.db_test_01.d_01.s_03"), ) print( "d_02.s_01 expecting True, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_02.s_01"), + session.check_time_series_exists("root.db_test_01.d_02.s_01"), ) print( "d_02.s_06 expecting True, checking result: ", - session.check_time_series_exists("root.sg_test_01.d_02.s_06"), + session.check_time_series_exists("root.db_test_01.d_02.s_06"), ) # insert one record into the database. @@ -162,7 +162,7 @@ TSDataType.DOUBLE, TSDataType.TEXT, ] -session.insert_record("root.sg_test_01.d_01", 1, measurements_, data_types_, values_) +session.insert_record("root.db_test_01.d_01", 1, measurements_, data_types_, values_) # insert multiple records into database measurements_list_ = [ @@ -174,7 +174,7 @@ [True, 77, 88, 1.25, 8.125, bytes("test_records02", "utf-8")], ] data_type_list_ = [data_types_, data_types_] -device_ids_ = ["root.sg_test_01.d_01", "root.sg_test_01.d_01"] +device_ids_ = ["root.db_test_01.d_01", "root.db_test_01.d_01"] session.insert_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ ) @@ -188,7 +188,7 @@ ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [4, 5, 6, 7] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) session.insert_tablet(tablet_) @@ -203,7 +203,7 @@ ] np_timestamps_ = np.array([1, 2, 3, 4], TSDataType.INT64.np_dtype()) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_02", measurements_, data_types_, np_values_, np_timestamps_ + "root.db_test_01.d_02", measurements_, data_types_, np_values_, np_timestamps_ ) session.insert_tablet(np_tablet_) @@ -218,7 +218,7 @@ ] np_timestamps_unsorted = np.array([9, 8, 7, 6, 5], np.dtype(">i8")) np_tablet_unsorted = NumpyTablet( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_, data_types_, np_values_unsorted, @@ -244,7 +244,7 @@ np_bitmaps_[4].mark(3) np_bitmaps_[5].mark(3) np_tablet_with_none = NumpyTablet( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_, data_types_, np_values_, @@ -261,10 +261,10 @@ # insert multiple tablets into database tablet_01 = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, [8, 9, 10, 11] + "root.db_test_01.d_01", measurements_, data_types_, values_, [8, 9, 10, 11] ) tablet_02 = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, [12, 13, 14, 15] + "root.db_test_01.d_01", measurements_, data_types_, values_, [12, 13, 14, 15] ) session.insert_tablets([tablet_01, tablet_02]) @@ -277,7 +277,7 @@ ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) session.insert_tablet(tablet_) @@ -296,24 +296,24 @@ values_list = [[False, 22, 33], [True, 1, 23], [False, 15, 26]] session.insert_records_of_one_device( - "root.sg_test_01.d_01", time_list, measurements_list, data_types_list, values_list + "root.db_test_01.d_01", time_list, measurements_list, data_types_list, values_list ) # execute non-query sql statement session.execute_non_query_statement( - "insert into root.sg_test_01.d_01(timestamp, s_02) values(16, 188)" + "insert into root.db_test_01.d_01(timestamp, s_02) values(16, 188)" ) # execute sql query statement with session.execute_query_statement( - "select * from root.sg_test_01.d_01" + "select * from root.db_test_01.d_01" ) as session_data_set: session_data_set.set_fetch_size(1024) while session_data_set.has_next(): print(session_data_set.next()) # execute sql query statement with session.execute_query_statement( - "select s_01, s_02, s_03, s_04, s_05, s_06 from root.sg_test_01.d_02" + "select s_01, s_02, s_03, s_04, s_05, s_06 from root.db_test_01.d_02" ) as session_data_set: session_data_set.set_fetch_size(1024) while session_data_set.has_next(): @@ -321,13 +321,13 @@ # execute statement with session.execute_statement( - "select * from root.sg_test_01.d_01" + "select * from root.db_test_01.d_01" ) as session_data_set: while session_data_set.has_next(): print(session_data_set.next()) session.execute_statement( - "insert into root.sg_test_01.d_01(timestamp, s_02) values(16, 188)" + "insert into root.db_test_01.d_01(timestamp, s_02) values(16, 188)" ) # insert string records of one device @@ -340,21 +340,21 @@ values_list = [["False", "22", "33"], ["True", "1", "23"], ["False", "15", "26"]] session.insert_string_records_of_one_device( - "root.sg_test_01.d_03", + "root.db_test_01.d_03", time_list, measurements_list, values_list, ) with session.execute_raw_data_query( - ["root.sg_test_01.d_03.s_01", "root.sg_test_01.d_03.s_02"], 1, 4 + ["root.db_test_01.d_03.s_01", "root.db_test_01.d_03.s_02"], 1, 4 ) as session_data_set: session_data_set.set_fetch_size(1024) while session_data_set.has_next(): print(session_data_set.next()) with session.execute_last_data_query( - ["root.sg_test_01.d_03.s_01", "root.sg_test_01.d_03.s_02"], 0 + ["root.db_test_01.d_03.s_01", "root.db_test_01.d_03.s_02"], 0 ) as session_data_set: session_data_set.set_fetch_size(1024) while session_data_set.has_next(): @@ -376,7 +376,7 @@ ] timestamps_new_type = [1, 2, 3, 4] tablet_new_type = Tablet( - "root.sg_test_01.d_04", + "root.db_test_01.d_04", measurements_new_type, data_types_new_type, values_new_type, @@ -391,7 +391,7 @@ ] np_timestamps_new_type = np.array([5, 6, 7, 8], TSDataType.INT64.np_dtype()) np_tablet_new_type = NumpyTablet( - "root.sg_test_01.d_04", + "root.db_test_01.d_04", measurements_new_type, data_types_new_type, np_values_new_type, @@ -399,20 +399,20 @@ ) session.insert_tablet(np_tablet_new_type) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: print(dataset.get_column_names()) while dataset.has_next(): print(dataset.next()) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: df = dataset.todf() print(df.to_string()) # delete database -session.delete_storage_group("root.sg_test_01") +session.delete_storage_group("root.db_test_01") # close session connection. session.close() diff --git a/iotdb-client/client-py/tests/integration/tablet_performance_comparison.py b/iotdb-client/client-py/tests/integration/tablet_performance_comparison.py index c22124ec00938..d237857ab4867 100644 --- a/iotdb-client/client-py/tests/integration/tablet_performance_comparison.py +++ b/iotdb-client/client-py/tests/integration/tablet_performance_comparison.py @@ -199,7 +199,7 @@ def performance_test( for i in range(0, col): # if i % 500 == 0: # print(f"insert {i} cols") - device_id = "root.sg%d.%d" % (i % 8, i) + device_id = "root.db%d.%d" % (i % 8, i) if not use_new: # Use the ORIGINAL method to construct tablet timestamps_ = [] diff --git a/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py b/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py index 2c36f9484276e..27a44bbb0cd86 100644 --- a/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py +++ b/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py @@ -52,16 +52,16 @@ def test_aligned_timeseries(): exit(1) # set and delete databases - session.set_storage_group("root.sg_test_01") - session.set_storage_group("root.sg_test_02") - session.set_storage_group("root.sg_test_03") - session.set_storage_group("root.sg_test_04") + session.set_storage_group("root.db_test_01") + session.set_storage_group("root.db_test_02") + session.set_storage_group("root.db_test_03") + session.set_storage_group("root.db_test_04") - if session.delete_storage_group("root.sg_test_02") < 0: + if session.delete_storage_group("root.db_test_02") < 0: test_fail() print_message("delete database failed") - if session.delete_storage_groups(["root.sg_test_03", "root.sg_test_04"]) < 0: + if session.delete_storage_groups(["root.db_test_03", "root.db_test_04"]) < 0: test_fail() print_message("delete databases failed") @@ -79,7 +79,7 @@ def test_aligned_timeseries(): encoding_lst_ = [TSEncoding.PLAIN for _ in range(len(data_type_lst_))] compressor_lst_ = [Compressor.SNAPPY for _ in range(len(data_type_lst_))] session.create_aligned_time_series( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_lst_, data_type_lst_, encoding_lst_, @@ -106,7 +106,7 @@ def test_aligned_timeseries(): encoding_lst_ = [TSEncoding.PLAIN for _ in range(len(data_type_lst_))] compressor_lst_ = [Compressor.SNAPPY for _ in range(len(data_type_lst_))] session.create_aligned_time_series( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_lst_, data_type_lst_, encoding_lst_, @@ -117,9 +117,9 @@ def test_aligned_timeseries(): try: session.delete_time_series( [ - "root.sg_test_01.d_02.s_07", - "root.sg_test_01.d_02.s_08", - "root.sg_test_01.d_02.s_09", + "root.db_test_01.d_02.s_07", + "root.db_test_01.d_02.s_08", + "root.db_test_01.d_02.s_09", ] ) except Exception: @@ -128,14 +128,14 @@ def test_aligned_timeseries(): # checking time series # s_07 expecting False - if session.check_time_series_exists("root.sg_test_01.d_02.s_07"): + if session.check_time_series_exists("root.db_test_01.d_02.s_07"): test_fail() - print_message("root.sg_test_01.d_02.s_07 shouldn't exist") + print_message("root.db_test_01.d_02.s_07 shouldn't exist") # s_03 expecting True - if not session.check_time_series_exists("root.sg_test_01.d_02.s_03"): + if not session.check_time_series_exists("root.db_test_01.d_02.s_03"): test_fail() - print_message("root.sg_test_01.d_02.s_03 should exist") + print_message("root.db_test_01.d_02.s_03 should exist") # insert one record into the database. measurements_ = ["s_01", "s_02", "s_03", "s_04", "s_05", "s_06"] @@ -150,7 +150,7 @@ def test_aligned_timeseries(): ] try: session.insert_aligned_record( - "root.sg_test_01.d_02", 1, measurements_, data_types_, values_ + "root.db_test_01.d_02", 1, measurements_, data_types_, values_ ) except Exception: test_fail() @@ -166,7 +166,7 @@ def test_aligned_timeseries(): [True, 77, 88, 1.25, 8.125, "test_records02"], ] data_type_list_ = [data_types_, data_types_] - device_ids_ = ["root.sg_test_01.d_02", "root.sg_test_01.d_02"] + device_ids_ = ["root.db_test_01.d_02", "root.db_test_01.d_02"] try: session.insert_aligned_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ @@ -184,7 +184,7 @@ def test_aligned_timeseries(): ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [4, 5, 6, 7] tablet_ = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_02", measurements_, data_types_, values_, timestamps_ ) if session.insert_aligned_tablet(tablet_) < 0: test_fail() @@ -192,10 +192,10 @@ def test_aligned_timeseries(): # insert multiple tablets into database tablet_01 = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, [8, 9, 10, 11] + "root.db_test_01.d_02", measurements_, data_types_, values_, [8, 9, 10, 11] ) tablet_02 = Tablet( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_, data_types_, values_, @@ -214,7 +214,7 @@ def test_aligned_timeseries(): ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [20, 21, 22, 23] tablet_ = Tablet( - "root.sg_test_01.d_02", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_02", measurements_, data_types_, values_, timestamps_ ) if session.insert_aligned_tablet(tablet_) < 0: test_fail() @@ -236,7 +236,7 @@ def test_aligned_timeseries(): if ( session.insert_aligned_records_of_one_device( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", time_list, measurements_list, data_types_list, @@ -250,17 +250,17 @@ def test_aligned_timeseries(): # execute non-query sql statement try: session.execute_non_query_statement( - "insert into root.sg_test_01.d_02(timestamp, s_02) aligned values(16, 188)" + "insert into root.db_test_01.d_02(timestamp, s_02) aligned values(16, 188)" ) except Exception: test_fail() print_message( - "execute 'insert into root.sg_test_01.d_02(timestamp, s_02) aligned values(16, 188)' failed" + "execute 'insert into root.db_test_01.d_02(timestamp, s_02) aligned values(16, 188)' failed" ) # execute sql query statement session_data_set = session.execute_query_statement( - "select * from root.sg_test_01.d_02" + "select * from root.db_test_01.d_02" ) session_data_set.set_fetch_size(1024) expect_count = 20 diff --git a/iotdb-client/client-py/tests/integration/test_new_data_types.py b/iotdb-client/client-py/tests/integration/test_new_data_types.py index e59138fa0359d..e85932d7efb46 100644 --- a/iotdb-client/client-py/tests/integration/test_new_data_types.py +++ b/iotdb-client/client-py/tests/integration/test_new_data_types.py @@ -61,7 +61,7 @@ def session_test(use_session_pool=False): print("can't open session") exit(1) - device_id = "root.sg_test_01.d_04" + device_id = "root.db_test_01.d_04" measurements_new_type = ["s_01", "s_02", "s_03", "s_04"] data_types_new_type = [ TSDataType.DATE, @@ -113,20 +113,20 @@ def session_test(use_session_pool=False): ) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: print(dataset.get_column_names()) while dataset.has_next(): print(dataset.next()) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: df = dataset.todf() print(df.to_string()) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: cnt = 0 while dataset.has_next(): @@ -146,7 +146,7 @@ def session_test(use_session_pool=False): assert cnt == 10 with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04" ) as dataset: df = dataset.todf() rows, columns = df.shape @@ -172,7 +172,7 @@ def session_test(use_session_pool=False): ) with session.execute_query_statement( - "select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04 where time > 10" + "select s_01,s_02,s_03,s_04 from root.db_test_01.d_04 where time > 10" ) as dataset: cnt = 0 while dataset.has_next(): diff --git a/iotdb-client/client-py/tests/integration/test_session.py b/iotdb-client/client-py/tests/integration/test_session.py index 75cdf056113b4..f11413dc756d0 100644 --- a/iotdb-client/client-py/tests/integration/test_session.py +++ b/iotdb-client/client-py/tests/integration/test_session.py @@ -80,44 +80,44 @@ def session_test(use_session_pool=False): exit(1) # set and delete databases - session.set_storage_group("root.sg_test_01") - session.set_storage_group("root.sg_test_02") - session.set_storage_group("root.sg_test_03") - session.set_storage_group("root.sg_test_04") + session.set_storage_group("root.db_test_01") + session.set_storage_group("root.db_test_02") + session.set_storage_group("root.db_test_03") + session.set_storage_group("root.db_test_04") try: - session.delete_storage_group("root.sg_test_02") + session.delete_storage_group("root.db_test_02") except Exception: test_fail() print_message("delete database failed") try: - session.delete_storage_groups(["root.sg_test_03", "root.sg_test_04"]) + session.delete_storage_groups(["root.db_test_03", "root.db_test_04"]) except Exception: test_fail() print_message("delete databases failed") # setting time series. session.create_time_series( - "root.sg_test_01.d_01.s_01", + "root.db_test_01.d_01.s_01", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY, ) session.create_time_series( - "root.sg_test_01.d_01.s_02", + "root.db_test_01.d_01.s_02", TSDataType.INT32, TSEncoding.PLAIN, Compressor.SNAPPY, ) session.create_time_series( - "root.sg_test_01.d_01.s_03", + "root.db_test_01.d_01.s_03", TSDataType.INT64, TSEncoding.PLAIN, Compressor.SNAPPY, ) session.create_time_series( - "root.sg_test_01.d_02.s_01", + "root.db_test_01.d_02.s_01", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY, @@ -129,12 +129,12 @@ def session_test(use_session_pool=False): # setting multiple time series once. ts_path_lst_ = [ - "root.sg_test_01.d_01.s_04", - "root.sg_test_01.d_01.s_05", - "root.sg_test_01.d_01.s_06", - "root.sg_test_01.d_01.s_07", - "root.sg_test_01.d_01.s_08", - "root.sg_test_01.d_01.s_09", + "root.db_test_01.d_01.s_04", + "root.db_test_01.d_01.s_05", + "root.db_test_01.d_01.s_06", + "root.db_test_01.d_01.s_07", + "root.db_test_01.d_01.s_08", + "root.db_test_01.d_01.s_09", ] data_type_lst_ = [ TSDataType.FLOAT, @@ -150,12 +150,12 @@ def session_test(use_session_pool=False): ts_path_lst_, data_type_lst_, encoding_lst_, compressor_lst_ ) ts_path_lst_ = [ - "root.sg_test_01.d_02.s_04", - "root.sg_test_01.d_02.s_05", - "root.sg_test_01.d_02.s_06", - "root.sg_test_01.d_02.s_07", - "root.sg_test_01.d_02.s_08", - "root.sg_test_01.d_02.s_09", + "root.db_test_01.d_02.s_04", + "root.db_test_01.d_02.s_05", + "root.db_test_01.d_02.s_06", + "root.db_test_01.d_02.s_07", + "root.db_test_01.d_02.s_08", + "root.db_test_01.d_02.s_09", ] data_type_lst_ = [ TSDataType.FLOAT, @@ -184,9 +184,9 @@ def session_test(use_session_pool=False): try: session.delete_time_series( [ - "root.sg_test_01.d_01.s_07", - "root.sg_test_01.d_01.s_08", - "root.sg_test_01.d_01.s_09", + "root.db_test_01.d_01.s_07", + "root.db_test_01.d_01.s_08", + "root.db_test_01.d_01.s_09", ] ) except Exception: @@ -195,22 +195,22 @@ def session_test(use_session_pool=False): # checking time series # s_07 expecting False - if session.check_time_series_exists("root.sg_test_01.d_01.s_07"): + if session.check_time_series_exists("root.db_test_01.d_01.s_07"): test_fail() - print_message("root.sg_test_01.d_01.s_07 shouldn't exist") + print_message("root.db_test_01.d_01.s_07 shouldn't exist") # s_03 expecting True - if not session.check_time_series_exists("root.sg_test_01.d_01.s_03"): + if not session.check_time_series_exists("root.db_test_01.d_01.s_03"): test_fail() - print_message("root.sg_test_01.d_01.s_03 should exist") + print_message("root.db_test_01.d_01.s_03 should exist") # d_02.s_01 expecting True - if not session.check_time_series_exists("root.sg_test_01.d_02.s_01"): + if not session.check_time_series_exists("root.db_test_01.d_02.s_01"): test_fail() - print_message("root.sg_test_01.d_02.s_01 should exist") + print_message("root.db_test_01.d_02.s_01 should exist") # d_02.s_06 expecting True - if not session.check_time_series_exists("root.sg_test_01.d_02.s_06"): + if not session.check_time_series_exists("root.db_test_01.d_02.s_06"): test_fail() - print_message("root.sg_test_01.d_02.s_06 should exist") + print_message("root.db_test_01.d_02.s_06 should exist") # insert one record into the database. measurements_ = ["s_01", "s_02", "s_03", "s_04", "s_05", "s_06"] @@ -225,7 +225,7 @@ def session_test(use_session_pool=False): ] try: session.insert_record( - "root.sg_test_01.d_01", 1, measurements_, data_types_, values_ + "root.db_test_01.d_01", 1, measurements_, data_types_, values_ ) except Exception: test_fail() @@ -244,7 +244,7 @@ def session_test(use_session_pool=False): ] try: session.insert_record( - "root.sg_test_01.d_01", 1, measurements_, data_types_, values_ + "root.db_test_01.d_01", 1, measurements_, data_types_, values_ ) except Exception: test_fail() @@ -260,7 +260,7 @@ def session_test(use_session_pool=False): [True, 77, 88, 1.25, 8.125, bytes("test_records02", "utf-8")], ] data_type_list_ = [data_types_, data_types_] - device_ids_ = ["root.sg_test_01.d_01", "root.sg_test_01.d_02"] + device_ids_ = ["root.db_test_01.d_01", "root.db_test_01.d_02"] try: session.insert_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ @@ -279,7 +279,7 @@ def session_test(use_session_pool=False): [None, None, None, None, 8.125, bytes("test_records02", "utf-8")], ] data_type_list_ = [data_types_, data_types_] - device_ids_ = ["root.sg_test_01.d_01", "root.sg_test_01.d_02"] + device_ids_ = ["root.db_test_01.d_01", "root.db_test_01.d_02"] try: session.insert_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ @@ -293,7 +293,7 @@ def session_test(use_session_pool=False): [None, None, None, None, None, None], ] data_type_list_ = [data_types_, data_types_] - device_ids_ = ["root.sg_test_01.d_01", "root.sg_test_01.d_02"] + device_ids_ = ["root.db_test_01.d_01", "root.db_test_01.d_02"] try: session.insert_records( device_ids_, [2, 3], measurements_list_, data_type_list_, values_list_ @@ -311,7 +311,7 @@ def session_test(use_session_pool=False): ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [4, 5, 6, 7] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) try: @@ -331,7 +331,7 @@ def session_test(use_session_pool=False): ] np_timestamps_ = np.array([1, 2, 3, 4], np.dtype(">i8")) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_, data_types_, np_values_, @@ -345,10 +345,10 @@ def session_test(use_session_pool=False): # insert multiple tablets into database tablet_01 = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, [8, 9, 10, 11] + "root.db_test_01.d_01", measurements_, data_types_, values_, [8, 9, 10, 11] ) tablet_02 = Tablet( - "root.sg_test_01.d_02", + "root.db_test_01.d_02", measurements_, data_types_, values_, @@ -369,7 +369,7 @@ def session_test(use_session_pool=False): ] # Non-ASCII text will cause error since bytes can only hold 0-128 nums. timestamps_ = [20, 21, 22, 23] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) try: session.insert_tablet(tablet_) @@ -396,7 +396,7 @@ def session_test(use_session_pool=False): np_bitmaps_[4].mark(3) np_bitmaps_[5].mark(3) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_01", + "root.db_test_01.d_01", measurements_, data_types_, np_values_, @@ -425,7 +425,7 @@ def session_test(use_session_pool=False): try: session.insert_records_of_one_device( - "root.sg_test_01.d_01", + "root.db_test_01.d_01", time_list, measurements_list, data_types_list, @@ -438,17 +438,17 @@ def session_test(use_session_pool=False): # execute non-query sql statement try: session.execute_non_query_statement( - "insert into root.sg_test_01.d_01(timestamp, s_02) values(16, 188)" + "insert into root.db_test_01.d_01(timestamp, s_02) values(16, 188)" ) except Exception: test_fail() print_message( - "execute 'insert into root.sg_test_01.d_01(timestamp, s_02) values(16, 188)' failed" + "execute 'insert into root.db_test_01.d_01(timestamp, s_02) values(16, 188)' failed" ) # execute sql query statement session_data_set = session.execute_query_statement( - "select * from root.sg_test_01.d_01" + "select * from root.db_test_01.d_01" ) session_data_set.set_fetch_size(1024) expect_count = 20 diff --git a/iotdb-client/client-py/tests/integration/test_tablet.py b/iotdb-client/client-py/tests/integration/test_tablet.py index f91c1bc6dd645..cbad6af98df7b 100644 --- a/iotdb-client/client-py/tests/integration/test_tablet.py +++ b/iotdb-client/client-py/tests/integration/test_tablet.py @@ -30,7 +30,7 @@ def test_tablet_insertion(): db: IoTDBContainer session = Session(db.get_container_host_ip(), db.get_exposed_port(6667)) session.open(False) - session.execute_non_query_statement("CREATE DATABASE root.sg_test_01") + session.execute_non_query_statement("CREATE DATABASE root.db_test_01") measurements_ = ["s_01", "s_02", "s_03", "s_04", "s_05", "s_06"] data_types_ = [ @@ -49,17 +49,17 @@ def test_tablet_insertion(): ] timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) session.insert_tablet(tablet_) columns = [] for measurement in measurements_: - columns.append("root.sg_test_01.d_01." + measurement) + columns.append("root.db_test_01.d_01." + measurement) df_input = pd.DataFrame(values_, columns=columns, dtype=object) df_input.insert(0, "Time", np.array(timestamps_)) session_data_set = session.execute_query_statement( - "select s_01, s_02, s_03, s_04, s_05, s_06 from root.sg_test_01.d_01" + "select s_01, s_02, s_03, s_04, s_05, s_06 from root.db_test_01.d_01" ) df_output = session_data_set.todf() df_output = df_output[df_input.columns.tolist()].replace( @@ -75,7 +75,7 @@ def test_nullable_tablet_insertion(): db: IoTDBContainer session = Session(db.get_container_host_ip(), db.get_exposed_port(6667)) session.open(False) - session.execute_non_query_statement("CREATE DATABASE root.sg_test_01") + session.execute_non_query_statement("CREATE DATABASE root.db_test_01") measurements_ = ["s_01", "s_02", "s_03", "s_04", "s_05", "s_06"] data_types_ = [ @@ -94,17 +94,17 @@ def test_nullable_tablet_insertion(): ] timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) session.insert_tablet(tablet_) columns = [] for measurement in measurements_: - columns.append("root.sg_test_01.d_01." + measurement) + columns.append("root.db_test_01.d_01." + measurement) df_input = pd.DataFrame(values_, columns=columns, dtype=object) df_input.insert(0, "Time", np.array(timestamps_)) session_data_set = session.execute_query_statement( - "select s_01, s_02, s_03, s_04, s_05, s_06 from root.sg_test_01.d_01" + "select s_01, s_02, s_03, s_04, s_05, s_06 from root.db_test_01.d_01" ) df_output = session_data_set.todf() df_output = df_output[df_input.columns.tolist()] diff --git a/iotdb-client/client-py/tests/unit/test_numpy_tablet.py b/iotdb-client/client-py/tests/unit/test_numpy_tablet.py index 217df22ea2d3d..b3b565f5aadb1 100644 --- a/iotdb-client/client-py/tests/unit/test_numpy_tablet.py +++ b/iotdb-client/client-py/tests/unit/test_numpy_tablet.py @@ -43,7 +43,7 @@ def test_numpy_tablet_serialization(): ] timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) np_values_ = [ np.array([False, True, False, True], np.dtype(">?")), @@ -55,7 +55,7 @@ def test_numpy_tablet_serialization(): ] np_timestamps_ = np.array([16, 17, 18, 19], np.dtype(">i8")) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_01", measurements_, data_types_, np_values_, np_timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, np_values_, np_timestamps_ ) assert tablet_.get_binary_timestamps() == np_tablet_.get_binary_timestamps() assert tablet_.get_binary_values() == np_tablet_.get_binary_values() @@ -80,7 +80,7 @@ def test_numpy_tablet_with_none_serialization(): ] timestamps_ = [16, 17, 18, 19] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) np_values_ = [ np.array([False, True, False, True], np.dtype(">?")), @@ -100,7 +100,7 @@ def test_numpy_tablet_with_none_serialization(): np_bitmaps_[4].mark(3) np_bitmaps_[5].mark(3) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_01", + "root.db_test_01.d_01", measurements_, data_types_, np_values_, @@ -131,7 +131,7 @@ def test_sort_numpy_tablet(): ] timestamps_ = [5, 6, 7, 8, 9] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) np_values_unsorted = [ np.array([False, False, False, True, True], np.dtype(">?")), @@ -143,7 +143,7 @@ def test_sort_numpy_tablet(): ] np_timestamps_unsorted = np.array([9, 8, 7, 6, 5], np.dtype(">i8")) np_tablet_ = NumpyTablet( - "root.sg_test_01.d_01", + "root.db_test_01.d_01", measurements_, data_types_, np_values_unsorted, @@ -173,7 +173,7 @@ def test_numpy_tablet_auto_correct_datatype(): ] timestamps_ = [5, 6, 7, 8, 9] tablet_ = Tablet( - "root.sg_test_01.d_01", measurements_, data_types_, values_, timestamps_ + "root.db_test_01.d_01", measurements_, data_types_, values_, timestamps_ ) np_values_unsorted = [ np.array([False, False, False, True, True]), @@ -189,7 +189,7 @@ def test_numpy_tablet_auto_correct_datatype(): for i in range(1, 4): assert np_values_unsorted[i].dtype != data_types_[i].np_dtype() np_tablet_ = NumpyTablet( - "root.sg_test_01.d_01", + "root.db_test_01.d_01", measurements_, data_types_, np_values_unsorted, diff --git a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java index 40268a54cd340..78aed62aed12c 100644 --- a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java +++ b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionCacheLeaderTest.java @@ -69,13 +69,13 @@ public class SessionCacheLeaderTest { // just for simulation public static TEndPoint getDeviceIdBelongedEndpoint(String deviceId) { - if (deviceId.startsWith("root.sg1")) { + if (deviceId.startsWith("root.db1")) { return endpoints.get(0); - } else if (deviceId.startsWith("root.sg2")) { + } else if (deviceId.startsWith("root.db2")) { return endpoints.get(1); - } else if (deviceId.startsWith("root.sg3")) { + } else if (deviceId.startsWith("root.db3")) { return endpoints.get(2); - } else if (deviceId.startsWith("root.sg4")) { + } else if (deviceId.startsWith("root.db4")) { return endpoints.get(3); } @@ -104,7 +104,7 @@ public void testInsertRecord() throws IoTDBConnectionException, StatementExecuti assertNull(session.deviceIdToEndpoint); assertNull(session.endPointToSessionConnection); - String deviceId = "root.sg2.d1"; + String deviceId = "root.db2.d1"; List measurements = new ArrayList<>(); List types = new ArrayList<>(); measurements.add("s1"); @@ -154,7 +154,7 @@ public void testInsertStringRecord() assertNull(session.deviceIdToEndpoint); assertNull(session.endPointToSessionConnection); - String deviceId = "root.sg2.d1"; + String deviceId = "root.db2.d1"; List measurements = new ArrayList<>(); measurements.add("s1"); measurements.add("s2"); @@ -202,10 +202,10 @@ public void testInsertRecords() throws IoTDBConnectionException, StatementExecut List allDeviceIds = new ArrayList() { { - add("root.sg1.d1"); - add("root.sg2.d1"); - add("root.sg3.d1"); - add("root.sg4.d1"); + add("root.db1.d1"); + add("root.db2.d1"); + add("root.db3.d1"); + add("root.db4.d1"); } }; List measurements = new ArrayList<>(); @@ -303,10 +303,10 @@ public void testInsertStringRecords() List allDeviceIds = new ArrayList() { { - add("root.sg1.d1"); - add("root.sg2.d1"); - add("root.sg3.d1"); - add("root.sg4.d1"); + add("root.db1.d1"); + add("root.db2.d1"); + add("root.db3.d1"); + add("root.db4.d1"); } }; List measurements = new ArrayList<>(); @@ -386,7 +386,7 @@ public void testInsertRecordsOfOneDevice() assertNull(session.deviceIdToEndpoint); assertNull(session.endPointToSessionConnection); - String deviceId = "root.sg2.d2"; + String deviceId = "root.db2.d2"; List times = new ArrayList<>(); List> measurements = new ArrayList<>(); List> datatypes = new ArrayList<>(); @@ -454,7 +454,7 @@ public void testInsertTablet() throws IoTDBConnectionException, StatementExecuti assertNull(session.deviceIdToEndpoint); assertNull(session.endPointToSessionConnection); - String deviceId = "root.sg2.d2"; + String deviceId = "root.db2.d2"; List schemaList = new ArrayList<>(); schemaList.add(new MeasurementSchema("s1", TSDataType.INT64)); schemaList.add(new MeasurementSchema("s2", TSDataType.INT64)); @@ -527,10 +527,10 @@ public void testInsertTablets() throws IoTDBConnectionException, StatementExecut List allDeviceIds = new ArrayList() { { - add("root.sg1.d1"); - add("root.sg2.d1"); - add("root.sg3.d1"); - add("root.sg4.d1"); + add("root.db1.d1"); + add("root.db2.d1"); + add("root.db3.d1"); + add("root.db4.d1"); } }; List schemaList = new ArrayList<>(); @@ -721,10 +721,10 @@ public void testInsertRecordsWithSessionBroken() throws StatementExecutionExcept List allDeviceIds = new ArrayList() { { - add("root.sg1.d1"); - add("root.sg2.d1"); - add("root.sg3.d1"); - add("root.sg4.d1"); + add("root.db1.d1"); + add("root.db2.d1"); + add("root.db3.d1"); + add("root.db4.d1"); } }; List measurements = new ArrayList<>(); @@ -867,10 +867,10 @@ public void testInsertTabletsWithSessionBroken() throws StatementExecutionExcept List allDeviceIds = new ArrayList() { { - add("root.sg1.d1"); - add("root.sg2.d1"); - add("root.sg3.d1"); - add("root.sg4.d1"); + add("root.db1.d1"); + add("root.db2.d1"); + add("root.db3.d1"); + add("root.db4.d1"); } }; List schemaList = new ArrayList<>(); diff --git a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionConnectionTest.java b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionConnectionTest.java index a10d9b1d6f4da..7c3335131eb7e 100644 --- a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionConnectionTest.java +++ b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionConnectionTest.java @@ -348,7 +348,7 @@ public void testInsertRecord() sessionConnection.testInsertTablet(new TSInsertTabletReq()); sessionConnection.insertTablets(new TSInsertTabletsReq()); sessionConnection.testInsertTablets(new TSInsertTabletsReq()); - sessionConnection.deleteTimeseries(Arrays.asList("root.sg1.d1.s1")); + sessionConnection.deleteTimeseries(Arrays.asList("root.db1.d1.s1")); } @Test diff --git a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionTest.java b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionTest.java index e4d2dbbb41dc8..54fa7f432639c 100644 --- a/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionTest.java +++ b/iotdb-client/session/src/test/java/org/apache/iotdb/session/SessionTest.java @@ -78,7 +78,7 @@ public void setUp() throws IoTDBConnectionException, StatementExecutionException .build(); Whitebox.setInternalState(session, "defaultSessionConnection", sessionConnection); TSQueryTemplateResp resp = new TSQueryTemplateResp(); - resp.setMeasurements(Arrays.asList("root.sg1.d1.s1")); + resp.setMeasurements(Arrays.asList("root.db1.d1.s1")); Mockito.when(sessionConnection.querySchemaTemplate(any())).thenReturn(resp); HashMap deviceIdToEndpoint = new HashMap<>(); deviceIdToEndpoint.put("device1", new TEndPoint()); @@ -145,34 +145,34 @@ public void testTimeZone() throws IoTDBConnectionException, StatementExecutionEx @Test public void testSetStorageGroup() throws IoTDBConnectionException, StatementExecutionException { - session.setStorageGroup("root.sg1"); + session.setStorageGroup("root.db1"); } @Test public void testDeleteStorageGroup() throws IoTDBConnectionException, StatementExecutionException { - session.deleteStorageGroup("root.sg1"); + session.deleteStorageGroup("root.db1"); } @Test public void testDeleteStorageGroups() throws IoTDBConnectionException, StatementExecutionException { - session.deleteStorageGroups(Arrays.asList("root.sg1")); + session.deleteStorageGroups(Arrays.asList("root.db1")); } @Test public void testCreateDatabase() throws IoTDBConnectionException, StatementExecutionException { - session.createDatabase("root.sg1"); + session.createDatabase("root.db1"); } @Test public void testDeleteDatabase() throws IoTDBConnectionException, StatementExecutionException { - session.deleteDatabase("root.sg1"); + session.deleteDatabase("root.db1"); } @Test public void testDeleteDatabases() throws IoTDBConnectionException, StatementExecutionException { - session.deleteDatabases(Arrays.asList("root.sg1")); + session.deleteDatabases(Arrays.asList("root.db1")); } @Test @@ -214,7 +214,7 @@ public void testCreateMultiTimeseries() @Test public void testCheckTimeseriesExists() throws IoTDBConnectionException, StatementExecutionException { - session.checkTimeseriesExists("root.sg1.d1.s1"); + session.checkTimeseriesExists("root.db1.d1.s1"); } @Test @@ -229,18 +229,18 @@ public void testSetAndGetQueryTimeout() { public void testInsertRecord() throws IoTDBConnectionException, StatementExecutionException { List measurements = Arrays.asList("s1", "s2"); List types = Arrays.asList(TSDataType.TEXT, TSDataType.FLOAT); - session.insertRecord("root.sg1.d1", 1691999031779l, measurements, types, "测试", 22.3f); + session.insertRecord("root.db1.d1", 1691999031779l, measurements, types, "测试", 22.3f); } @Test public void testDeleteTimeseries() throws IoTDBConnectionException, StatementExecutionException { - session.deleteTimeseries("root.sg1.d1.s1"); + session.deleteTimeseries("root.db1.d1.s1"); } @Test public void testDeleteTimeseriesList() throws IoTDBConnectionException, StatementExecutionException { - session.deleteTimeseries(Arrays.asList("root.sg1.d1.s1")); + session.deleteTimeseries(Arrays.asList("root.db1.d1.s1")); } @Test @@ -249,13 +249,13 @@ public void testInsertAlignedRecord() List measurements = Arrays.asList("s1", "s2"); List types = Arrays.asList(TSDataType.TEXT, TSDataType.FLOAT); List values = Arrays.asList("测试", 22.3f); - session.insertAlignedRecord("root.sg1.d1", 1691999031779l, measurements, types, values); + session.insertAlignedRecord("root.db1.d1", 1691999031779l, measurements, types, values); List values0 = Arrays.asList(null, 22.3f); - session.insertAlignedRecord("root.sg1.d1", 1691999031779l, measurements, types, values0); + session.insertAlignedRecord("root.db1.d1", 1691999031779l, measurements, types, values0); List values1 = Arrays.asList("测试", "22.3f"); - session.insertAlignedRecord("root.sg1.d1", 1691999031779l, measurements, values1); + session.insertAlignedRecord("root.db1.d1", 1691999031779l, measurements, values1); List values2 = Arrays.asList("测试"); - session.insertAlignedRecord("root.sg1.d1", 1691999031779l, measurements, values2); + session.insertAlignedRecord("root.db1.d1", 1691999031779l, measurements, values2); } @Test @@ -280,35 +280,35 @@ public void testExecuteNonQueryStatement() @Test public void testExecuteRawDataQuery() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); session.executeRawDataQuery(paths, 2l, 10l, 500l); } @Test public void testExecuteLastDataQuery() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); session.executeLastDataQuery(paths, 10l); } @Test public void testExecuteLastDataQueryTimeout() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); session.executeLastDataQuery(paths, 10l, 500l); } @Test public void testExecuteLastDataQueryWithPaths() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); session.executeLastDataQuery(paths); } @Test public void testExecuteAggregationQuery() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List aggregations = Arrays.asList(TAggregationType.LAST_VALUE, TAggregationType.MAX_VALUE); session.executeAggregationQuery(paths, aggregations); @@ -317,7 +317,7 @@ public void testExecuteAggregationQuery() @Test public void testExecuteAggregationQueryWithStartTimeEndTime() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List aggregations = Arrays.asList(TAggregationType.LAST_VALUE, TAggregationType.MAX_VALUE); session.executeAggregationQuery(paths, aggregations, 2l, 10l); @@ -326,7 +326,7 @@ public void testExecuteAggregationQueryWithStartTimeEndTime() @Test public void testExecuteAggregationQueryWithInterval() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List aggregations = Arrays.asList(TAggregationType.LAST_VALUE, TAggregationType.MAX_VALUE); session.executeAggregationQuery(paths, aggregations, 2l, 10000l, 5000); @@ -335,7 +335,7 @@ public void testExecuteAggregationQueryWithInterval() @Test public void testExecuteAggregationQueryWithIntervalSlidingStep() throws IoTDBConnectionException, StatementExecutionException { - List paths = Arrays.asList("root.sg1.d1.s1", "root.sg1.d1.s2"); + List paths = Arrays.asList("root.db1.d1.s1", "root.db1.d1.s2"); List aggregations = Arrays.asList(TAggregationType.LAST_VALUE, TAggregationType.MAX_VALUE); session.executeAggregationQuery(paths, aggregations, 2l, 100000l, 5000, 5000); @@ -786,20 +786,20 @@ public void testTestInsertRecordWithDataTypeException() @Test public void testDeleteDataException() throws IoTDBConnectionException, StatementExecutionException { - session.deleteData("root.sg1.d1.s1", System.currentTimeMillis()); + session.deleteData("root.db1.d1.s1", System.currentTimeMillis()); } @Test public void testDeleteDataListException() throws IoTDBConnectionException, StatementExecutionException { - session.deleteData(Arrays.asList("root.sg1.d1.s1"), System.currentTimeMillis()); + session.deleteData(Arrays.asList("root.db1.d1.s1"), System.currentTimeMillis()); } @Test public void testDeleteDataListWithStartTimeAndEndTimeException() throws IoTDBConnectionException, StatementExecutionException { session.deleteData( - Arrays.asList("root.sg1.d1.s1"), + Arrays.asList("root.db1.d1.s1"), System.currentTimeMillis() - 1000 * 60 * 20, System.currentTimeMillis()); } @@ -1091,7 +1091,7 @@ public void testAddAlignedMeasurementsInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { session.addAlignedMeasurementsInTemplate( "template1", - Arrays.asList("root.sg1.d1.s1"), + Arrays.asList("root.db1.d1.s1"), Arrays.asList(TSDataType.INT64), Arrays.asList(TSEncoding.PLAIN), Arrays.asList(CompressionType.SNAPPY)); @@ -1101,7 +1101,7 @@ public void testAddAlignedMeasurementsInTemplate() public void testAddAlignedMeasurementInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { session.addAlignedMeasurementInTemplate( - "template1", "root.sg1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); + "template1", "root.db1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); } @Test @@ -1109,7 +1109,7 @@ public void testAddUnalignedMeasurementsInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { session.addUnalignedMeasurementsInTemplate( "template1", - Arrays.asList("root.sg1.d1.s1"), + Arrays.asList("root.db1.d1.s1"), Arrays.asList(TSDataType.INT64), Arrays.asList(TSEncoding.PLAIN), Arrays.asList(CompressionType.SNAPPY)); @@ -1119,13 +1119,13 @@ public void testAddUnalignedMeasurementsInTemplate() public void testAddUnalignedMeasurementInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { session.addUnalignedMeasurementInTemplate( - "template1", "root.sg1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); + "template1", "root.db1.d1.s1", TSDataType.INT64, TSEncoding.PLAIN, CompressionType.SNAPPY); } @Test public void testDeleteNodeInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { - session.deleteNodeInTemplate("template1", "root.sg1.d1.s1"); + session.deleteNodeInTemplate("template1", "root.db1.d1.s1"); } @Test @@ -1137,13 +1137,13 @@ public void testCountMeasurementsInTemplate() @Test public void testIsMeasurementInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { - session.isMeasurementInTemplate("template1", "root.sg1.d1.s1"); + session.isMeasurementInTemplate("template1", "root.db1.d1.s1"); } @Test public void testIsPathExistInTemplate() throws IoTDBConnectionException, IOException, StatementExecutionException { - session.isPathExistInTemplate("template1", "root.sg1.d1.s1"); + session.isPathExistInTemplate("template1", "root.db1.d1.s1"); } @Test @@ -1155,7 +1155,7 @@ public void testShowMeasurementsInTemplate() @Test public void testShowMeasurementsInTemplatePattern() throws IoTDBConnectionException, StatementExecutionException { - session.showMeasurementsInTemplate("template1", "root.sg1.**"); + session.showMeasurementsInTemplate("template1", "root.db1.**"); } @Test @@ -1178,7 +1178,7 @@ public void testShowPathsTemplateUsingOn() @Test public void testUnsetSchemaTemplate() throws IoTDBConnectionException, StatementExecutionException { - session.unsetSchemaTemplate("root.sg1.d1.**", "template1"); + session.unsetSchemaTemplate("root.db1.d1.**", "template1"); } @Test @@ -1190,7 +1190,7 @@ public void testDropSchemaTemplate() @Test public void testCreateTimeseriesUsingSchemaTemplate() throws IoTDBConnectionException, StatementExecutionException { - session.createTimeseriesUsingSchemaTemplate(Arrays.asList("root.sg1.d1", "root.sg1.d2")); + session.createTimeseriesUsingSchemaTemplate(Arrays.asList("root.db1.d1", "root.db1.d2")); } @Test diff --git a/iotdb-client/session/src/test/java/org/apache/iotdb/session/TabletTest.java b/iotdb-client/session/src/test/java/org/apache/iotdb/session/TabletTest.java index bc9469e57a4a4..13b12586b0e4d 100644 --- a/iotdb-client/session/src/test/java/org/apache/iotdb/session/TabletTest.java +++ b/iotdb-client/session/src/test/java/org/apache/iotdb/session/TabletTest.java @@ -50,7 +50,7 @@ public void testSortTablet() { schemaList.add(new MeasurementSchema("s9", TSDataType.STRING)); ; // insert three rows data - Tablet tablet = new Tablet("root.sg1.d1", schemaList, 3); + Tablet tablet = new Tablet("root.db1.d1", schemaList, 3); Object[] values = tablet.getValues(); /* diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java index 5d4b09adfc710..1a5a38fbdfd5f 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java @@ -825,15 +825,15 @@ private List calculateRelatedSlot( if (path.getFullPath().contains(IoTDBConstant.MULTI_LEVEL_PATH_WILDCARD)) { return new ArrayList<>(); } - // with database = root.sg, path = root.*.d1 - // convert path = root.sg.d1 + // with database = root.db, path = root.*.d1 + // convert path = root.db.d1 final List innerPathList = path.alterPrefixPath(database); if (innerPathList.isEmpty()) { return new ArrayList<>(); } final String[] devicePath = Arrays.copyOf(innerPathList.get(0).getNodes(), innerPathList.get(0).getNodeLength() - 1); - // root.sg1.*.d1 + // root.db1.*.d1 for (final String node : devicePath) { if (node.contains(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD)) { return Collections.emptyList(); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java index 36c4ccc2f05e5..f1f3fdcd7d8d5 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 @@ -194,9 +194,9 @@ public void deleteDatabase(final PartialPath path) throws MetadataException { /** * Get the database that given path pattern matches or belongs to. * - *

Suppose we have (root.sg1.d1.s1, root.sg2.d2.s2), refer the following cases: 1. given path - * "root.sg1", ("root.sg1") will be returned. 2. given path "root.*", ("root.sg1", "root.sg2") - * will be returned. 3. given path "root.*.d1.s1", ("root.sg1", "root.sg2") will be returned. + *

Suppose we have (root.db1.d1.s1, root.db2.d2.s2), refer the following cases: 1. given path + * "root.db1", ("root.db1") will be returned. 2. given path "root.*", ("root.db1", "root.db2") + * will be returned. 3. given path "root.*.d1.s1", ("root.db1", "root.db2") will be returned. * * @param pathPattern a path pattern or a full path * @return a list contains all databases related to given path @@ -289,7 +289,7 @@ public int getDatabaseNum( } /** - * E.g., root.sg is database given [root, sg], if the give path is not a database, throw exception + * E.g., root.db is database given [root, sg], if the give path is not a database, throw exception */ public IDatabaseMNode getDatabaseNodeByDatabasePath(final PartialPath databasePath) throws MetadataException { @@ -320,8 +320,8 @@ public IDatabaseMNode getDatabaseNodeByDatabasePath(final PartialP } /** - * E.g., root.sg is database given [root, sg], return the MNode of root.sg given [root, sg, - * device], return the MNode of root.sg Get database node, the give path don't need to be database + * E.g., root.db is database given [root, sg], return the MNode of root.db given [root, sg, + * device], return the MNode of root.db Get database node, the give path don't need to be database * path. */ public IDatabaseMNode getDatabaseNodeByPath(final PartialPath path) diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java index 4381c120cb445..8044059929335 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java @@ -289,7 +289,7 @@ public void AlterDatabasePlanTest() throws IOException { @Test public void DeleteStorageGroupPlanTest() throws IOException { // TODO: Add serialize and deserialize test - DeleteDatabasePlan req0 = new DeleteDatabasePlan("root.sg"); + DeleteDatabasePlan req0 = new DeleteDatabasePlan("root.db"); DeleteDatabasePlan req1 = (DeleteDatabasePlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer()); Assert.assertEquals(req0, req1); @@ -304,7 +304,7 @@ public void SetTTLPlanTest() throws IOException { @Test public void SetSchemaReplicationFactorPlanTest() throws IOException { - SetSchemaReplicationFactorPlan req0 = new SetSchemaReplicationFactorPlan("root.sg0", 3); + SetSchemaReplicationFactorPlan req0 = new SetSchemaReplicationFactorPlan("root.db0", 3); SetSchemaReplicationFactorPlan req1 = (SetSchemaReplicationFactorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer()); @@ -313,7 +313,7 @@ public void SetSchemaReplicationFactorPlanTest() throws IOException { @Test public void SetDataReplicationFactorPlanTest() throws IOException { - SetDataReplicationFactorPlan req0 = new SetDataReplicationFactorPlan("root.sg0", 3); + SetDataReplicationFactorPlan req0 = new SetDataReplicationFactorPlan("root.db0", 3); SetDataReplicationFactorPlan req1 = (SetDataReplicationFactorPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer()); @@ -322,7 +322,7 @@ public void SetDataReplicationFactorPlanTest() throws IOException { @Test public void SetTimePartitionIntervalPlanTest() throws IOException { - SetTimePartitionIntervalPlan req0 = new SetTimePartitionIntervalPlan("root.sg0", 6048000L); + SetTimePartitionIntervalPlan req0 = new SetTimePartitionIntervalPlan("root.db0", 6048000L); SetTimePartitionIntervalPlan req1 = (SetTimePartitionIntervalPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer()); @@ -333,7 +333,7 @@ public void SetTimePartitionIntervalPlanTest() throws IOException { public void AdjustMaxRegionGroupCountPlanTest() throws IOException { AdjustMaxRegionGroupNumPlan req0 = new AdjustMaxRegionGroupNumPlan(); for (int i = 0; i < 3; i++) { - req0.putEntry("root.sg" + i, new Pair<>(i, i)); + req0.putEntry("root.db" + i, new Pair<>(i, i)); } AdjustMaxRegionGroupNumPlan req1 = @@ -356,11 +356,11 @@ public void CreateRegionsPlanTest() throws IOException { TRegionReplicaSet dataRegionSet = new TRegionReplicaSet(); dataRegionSet.setRegionId(new TConsensusGroupId(TConsensusGroupType.DataRegion, 0)); dataRegionSet.setDataNodeLocations(Collections.singletonList(dataNodeLocation)); - req0.addRegionGroup("root.sg0", dataRegionSet); + req0.addRegionGroup("root.db0", dataRegionSet); TRegionReplicaSet schemaRegionSet = new TRegionReplicaSet(); schemaRegionSet.setRegionId(new TConsensusGroupId(TConsensusGroupType.SchemaRegion, 1)); schemaRegionSet.setDataNodeLocations(Collections.singletonList(dataNodeLocation)); - req0.addRegionGroup("root.sg1", schemaRegionSet); + req0.addRegionGroup("root.db1", schemaRegionSet); CreateRegionGroupsPlan req1 = (CreateRegionGroupsPlan) ConfigPhysicalPlan.Factory.create(req0.serializeToByteBuffer()); @@ -383,9 +383,9 @@ public void OfferRegionMaintainTasksPlanTest() throws IOException { OfferRegionMaintainTasksPlan plan0 = new OfferRegionMaintainTasksPlan(); plan0.appendRegionMaintainTask( - new RegionCreateTask(dataNodeLocation, "root.sg", regionReplicaSet)); + new RegionCreateTask(dataNodeLocation, "root.db", regionReplicaSet)); plan0.appendRegionMaintainTask( - new RegionCreateTask(dataNodeLocation, "root.sg", regionReplicaSet)); + new RegionCreateTask(dataNodeLocation, "root.db", regionReplicaSet)); plan0.appendRegionMaintainTask( new RegionDeleteTask( dataNodeLocation, new TConsensusGroupId(TConsensusGroupType.SchemaRegion, 2))); @@ -415,7 +415,7 @@ public void CreateSchemaPartitionPlanTest() throws IOException { dataNodeLocation.setDataRegionConsensusEndPoint(new TEndPoint("0.0.0.0", 10760)); dataNodeLocation.setSchemaRegionConsensusEndPoint(new TEndPoint("0.0.0.0", 10750)); - String storageGroup = "root.sg0"; + String storageGroup = "root.db0"; TSeriesPartitionSlot seriesPartitionSlot = new TSeriesPartitionSlot(10); TConsensusGroupId consensusGroupId = new TConsensusGroupId(TConsensusGroupType.SchemaRegion, 0); @@ -441,7 +441,7 @@ public void CreateDataPartitionPlanTest() throws IOException { dataNodeLocation.setDataRegionConsensusEndPoint(new TEndPoint("0.0.0.0", 10760)); dataNodeLocation.setSchemaRegionConsensusEndPoint(new TEndPoint("0.0.0.0", 10750)); - String storageGroup = "root.sg0"; + String storageGroup = "root.db0"; TSeriesPartitionSlot seriesPartitionSlot = new TSeriesPartitionSlot(10); TTimePartitionSlot timePartitionSlot = new TTimePartitionSlot(100); TRegionReplicaSet regionReplicaSet = new TRegionReplicaSet(); @@ -703,7 +703,7 @@ public void removeConfigNodePlanTest() throws IOException { public void updateProcedureTest() throws IOException { // test procedure equals DeleteStorageGroupProcedure DeleteDatabaseProcedure deleteDatabaseProcedure = new DeleteDatabaseProcedure(false); - deleteDatabaseProcedure.setDeleteDatabaseSchema(new TDatabaseSchema("root.sg")); + deleteDatabaseProcedure.setDeleteDatabaseSchema(new TDatabaseSchema("root.db")); UpdateProcedurePlan updateProcedurePlan0 = new UpdateProcedurePlan(); updateProcedurePlan0.setProcedure(deleteDatabaseProcedure); UpdateProcedurePlan updateProcedurePlan1 = @@ -731,11 +731,11 @@ public void updateProcedureTest() throws IOException { failedRegions.put(dataRegionGroupId, dataRegionSet); failedRegions.put(schemaRegionGroupId, schemaRegionSet); CreateRegionGroupsPlan createRegionGroupsPlan = new CreateRegionGroupsPlan(); - createRegionGroupsPlan.addRegionGroup("root.sg0", dataRegionSet); - createRegionGroupsPlan.addRegionGroup("root.sg1", schemaRegionSet); + createRegionGroupsPlan.addRegionGroup("root.db0", dataRegionSet); + createRegionGroupsPlan.addRegionGroup("root.db1", schemaRegionSet); CreateRegionGroupsPlan persistPlan = new CreateRegionGroupsPlan(); - persistPlan.addRegionGroup("root.sg0", dataRegionSet); - persistPlan.addRegionGroup("root.sg1", schemaRegionSet); + persistPlan.addRegionGroup("root.db0", dataRegionSet); + persistPlan.addRegionGroup("root.db1", schemaRegionSet); CreateRegionGroupsProcedure procedure0 = new CreateRegionGroupsProcedure( TConsensusGroupType.DataRegion, createRegionGroupsPlan, persistPlan, failedRegions); @@ -752,7 +752,7 @@ public void UpdateProcedurePlanTest() throws IOException { UpdateProcedurePlan req0 = new UpdateProcedurePlan(); DeleteDatabaseProcedure deleteDatabaseProcedure = new DeleteDatabaseProcedure(false); TDatabaseSchema tDatabaseSchema = new TDatabaseSchema(); - tDatabaseSchema.setName("root.sg"); + tDatabaseSchema.setName("root.db"); deleteDatabaseProcedure.setDeleteDatabaseSchema(tDatabaseSchema); req0.setProcedure(deleteDatabaseProcedure); UpdateProcedurePlan req1 = @@ -1618,8 +1618,8 @@ public void AddCQPlanTest() throws IOException { 1000, 0, (byte) 0, - "select s1 into root.backup.d1.s1 from root.sg.d1", - "create cq testCq1 BEGIN select s1 into root.backup.d1.s1 from root.sg.d1 END", + "select s1 into root.backup.d1.s1 from root.db.d1", + "create cq testCq1 BEGIN select s1 into root.backup.d1.s1 from root.db.d1 END", "Asia", "root"), "testCq1_md5", @@ -1783,7 +1783,7 @@ public void DropFunctionPlanTest() throws IOException { @Test public void PreUnsetSchemaTemplatePlanTest() throws IllegalPathException, IOException { - PreUnsetSchemaTemplatePlan plan = new PreUnsetSchemaTemplatePlan(1, new PartialPath("root.sg")); + PreUnsetSchemaTemplatePlan plan = new PreUnsetSchemaTemplatePlan(1, new PartialPath("root.db")); PreUnsetSchemaTemplatePlan deserializedPlan = (PreUnsetSchemaTemplatePlan) ConfigPhysicalPlan.Factory.create(plan.serializeToByteBuffer()); @@ -1794,7 +1794,7 @@ public void PreUnsetSchemaTemplatePlanTest() throws IllegalPathException, IOExce @Test public void RollbackPreUnsetSchemaTemplatePlanTest() throws IllegalPathException, IOException { RollbackPreUnsetSchemaTemplatePlan plan = - new RollbackPreUnsetSchemaTemplatePlan(1, new PartialPath("root.sg")); + new RollbackPreUnsetSchemaTemplatePlan(1, new PartialPath("root.db")); RollbackPreUnsetSchemaTemplatePlan deserializedPlan = (RollbackPreUnsetSchemaTemplatePlan) ConfigPhysicalPlan.Factory.create(plan.serializeToByteBuffer()); @@ -1804,7 +1804,7 @@ public void RollbackPreUnsetSchemaTemplatePlanTest() throws IllegalPathException @Test public void UnsetSchemaTemplatePlanTest() throws IllegalPathException, IOException { - UnsetSchemaTemplatePlan plan = new UnsetSchemaTemplatePlan(1, new PartialPath("root.sg")); + UnsetSchemaTemplatePlan plan = new UnsetSchemaTemplatePlan(1, new PartialPath("root.db")); UnsetSchemaTemplatePlan deserializedPlan = (UnsetSchemaTemplatePlan) ConfigPhysicalPlan.Factory.create(plan.serializeToByteBuffer()); Assert.assertEquals(plan.getTemplateId(), deserializedPlan.getTemplateId()); @@ -1834,7 +1834,7 @@ public void setSpaceQuotaPlanTest() throws IOException { spaceQuota.setTimeserieNum(3); spaceQuota.setDiskSize(1024); SetSpaceQuotaPlan plan = - new SetSpaceQuotaPlan(Collections.singletonList("root.sg"), spaceQuota); + new SetSpaceQuotaPlan(Collections.singletonList("root.db"), spaceQuota); SetSpaceQuotaPlan deserializedPlan = (SetSpaceQuotaPlan) ConfigPhysicalPlan.Factory.create(plan.serializeToByteBuffer()); Assert.assertEquals(plan.getPrefixPathList(), deserializedPlan.getPrefixPathList()); @@ -1889,7 +1889,7 @@ public void pipeEnrichedPlanTest() throws IOException { @Test public void pipeUnsetSchemaTemplatePlanTest() throws IOException { final PipeUnsetSchemaTemplatePlan pipeUnsetSchemaTemplatePlan = - new PipeUnsetSchemaTemplatePlan("template0", "root.sg"); + new PipeUnsetSchemaTemplatePlan("template0", "root.db"); Assert.assertEquals( pipeUnsetSchemaTemplatePlan, ConfigPhysicalPlan.Factory.create(pipeUnsetSchemaTemplatePlan.serializeToByteBuffer())); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java index 151307e280d8c..c91b407495ebc 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/AuthorInfoTest.java @@ -544,7 +544,7 @@ public void testMultiPathsPermission() throws AuthException, IllegalPathExceptio List userPaths = new ArrayList<>(); userPaths.add(new PartialPath("root.ln.**")); - userPaths.add(new PartialPath("root.sg.**")); + userPaths.add(new PartialPath("root.db.**")); List rolePaths = new ArrayList<>(); rolePaths.add(new PartialPath("root.role_1.**")); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java index b9d453d317cec..2af4090f1a291 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CNPhysicalPlanGeneratorTest.java @@ -322,7 +322,7 @@ public void databaseWithoutTemplateGeneratorTest() throws Exception { setupTTLInfo(); final Set answerSet = new HashSet<>(); final Set storageGroupPathList = new TreeSet<>(); - storageGroupPathList.add("root.sg"); + storageGroupPathList.add("root.db"); storageGroupPathList.add("root.ln"); storageGroupPathList.add("root.a.sg"); storageGroupPathList.add("root.a.b.sg"); @@ -441,7 +441,7 @@ public void templateAndDatabaseCompletedTest() throws Exception { setupTTLInfo(); final Set answerSet = new HashSet<>(); final Set storageGroupPathList = new TreeSet<>(); - storageGroupPathList.add("root.sg"); + storageGroupPathList.add("root.db"); storageGroupPathList.add("root.a.sg"); storageGroupPathList.add("root.a.b.sg"); storageGroupPathList.add("root.a.a.a.b.sg"); @@ -487,11 +487,11 @@ public void templateAndDatabaseCompletedTest() throws Exception { answerSet.add(plan2.hashCode()); final PreSetSchemaTemplatePlan preSetSchemaTemplatePlan1 = - new PreSetSchemaTemplatePlan("t1", "root.sg"); + new PreSetSchemaTemplatePlan("t1", "root.db"); final PreSetSchemaTemplatePlan preSetSchemaTemplatePlan2 = new PreSetSchemaTemplatePlan("t2", "root.a.sg.t1"); final CommitSetSchemaTemplatePlan setSchemaTemplatePlan1 = - new CommitSetSchemaTemplatePlan("t1", "root.sg"); + new CommitSetSchemaTemplatePlan("t1", "root.db"); final CommitSetSchemaTemplatePlan setSchemaTemplatePlan2 = new CommitSetSchemaTemplatePlan("t2", "root.a.sg.t1"); clusterSchemaInfo.preSetSchemaTemplate(preSetSchemaTemplatePlan1); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CQInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CQInfoTest.java index 4b409d6cf0cd2..87d88cf3d144d 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CQInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/CQInfoTest.java @@ -66,8 +66,8 @@ public void testSnapshot() throws TException, IOException { 1000, 0, (byte) 0, - "select s1 into root.backup.d1.s1 from root.sg.d1", - "create cq testCq1 BEGIN select s1 into root.backup.d1.s1 from root.sg.d1 END", + "select s1 into root.backup.d1.s1 from root.db.d1", + "create cq testCq1 BEGIN select s1 into root.backup.d1.s1 from root.db.d1 END", "Asia", "root"), "testCq1_md5", @@ -85,8 +85,8 @@ public void testSnapshot() throws TException, IOException { 1000, 0, (byte) 1, - "select s1 into root.backup.d2.s1 from root.sg.d2", - "create cq testCq2 BEGIN select s1 into root.backup.d2.s1 from root.sg.d2 END", + "select s1 into root.backup.d2.s1 from root.db.d2", + "create cq testCq2 BEGIN select s1 into root.backup.d2.s1 from root.db.d2 END", "Asia", "root"), "testCq2_md5", diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/PartitionInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/PartitionInfoTest.java index afccb0c0eba12..6251da56bd910 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/PartitionInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/PartitionInfoTest.java @@ -302,9 +302,9 @@ private OfferRegionMaintainTasksPlan generateOfferRegionMaintainTasksPlan() { OfferRegionMaintainTasksPlan offerPlan = new OfferRegionMaintainTasksPlan(); offerPlan.appendRegionMaintainTask( - new RegionCreateTask(dataNodeLocation, "root.sg", regionReplicaSet)); + new RegionCreateTask(dataNodeLocation, "root.db", regionReplicaSet)); offerPlan.appendRegionMaintainTask( - new RegionCreateTask(dataNodeLocation, "root.sg", regionReplicaSet)); + new RegionCreateTask(dataNodeLocation, "root.db", regionReplicaSet)); offerPlan.appendRegionMaintainTask( new RegionDeleteTask( dataNodeLocation, new TConsensusGroupId(TConsensusGroupType.SchemaRegion, 2))); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/QuotaInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/QuotaInfoTest.java index 88f06f602e25f..5c45772f33b04 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/QuotaInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/QuotaInfoTest.java @@ -65,7 +65,7 @@ public void cleanup() throws IOException { private void prepareSpaceQuotaInfo() { List prefixPathList = new ArrayList<>(); - prefixPathList.add("root.sg"); + prefixPathList.add("root.db"); prefixPathList.add("root.ln"); TSpaceQuota spaceQuota = new TSpaceQuota(); spaceQuota.setTimeserieNum(10000); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/TTLInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/TTLInfoTest.java index 42a23d35cb9f4..56fed6dd4ca4f 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/TTLInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/TTLInfoTest.java @@ -232,12 +232,12 @@ public void testTooManyTTL() { final int tTlRuleCapacity = CommonDescriptor.getInstance().getConfig().getTTlRuleCapacity(); for (int i = 0; i < tTlRuleCapacity - 1; i++) { SetTTLPlan setTTLPlan = - new SetTTLPlan(PathNodesGenerator.splitPathToNodes("root.sg1.d" + i + ".**"), 1000); + new SetTTLPlan(PathNodesGenerator.splitPathToNodes("root.db1.d" + i + ".**"), 1000); assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), ttlInfo.setTTL(setTTLPlan).code); } SetTTLPlan setTTLPlan = new SetTTLPlan( - PathNodesGenerator.splitPathToNodes("root.sg1.d" + tTlRuleCapacity + ".**"), 1000); + PathNodesGenerator.splitPathToNodes("root.db1.d" + tTlRuleCapacity + ".**"), 1000); final TSStatus status = ttlInfo.setTTL(setTTLPlan); assertEquals(TSStatusCode.OVERSIZE_TTL.getStatusCode(), status.code); assertEquals( diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfoTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfoTest.java index 0d9bdf26a982a..21f480f36035c 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfoTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfoTest.java @@ -85,7 +85,7 @@ public void cleanup() throws IOException { @Test public void testSnapshot() throws IOException, IllegalPathException { Set storageGroupPathList = new TreeSet<>(); - storageGroupPathList.add("root.sg"); + storageGroupPathList.add("root.db"); storageGroupPathList.add("root.a.sg"); storageGroupPathList.add("root.a.b.sg"); storageGroupPathList.add("root.a.a.a.b.sg"); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTreeTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTreeTest.java index 0e887886dcc46..c11af31af87b1 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTreeTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTreeTest.java @@ -194,12 +194,12 @@ public void testIllegalStorageGroup() { @Test public void testCountStorageGroup() throws MetadataException { - root.setStorageGroup(new PartialPath("root.sg1")); + root.setStorageGroup(new PartialPath("root.db1")); root.setStorageGroup(new PartialPath("root.a.sg1")); root.setStorageGroup(new PartialPath("root.a.b.sg1")); - root.setStorageGroup(new PartialPath("root.sg2")); + root.setStorageGroup(new PartialPath("root.db2")); root.setStorageGroup(new PartialPath("root.a.sg2")); - root.setStorageGroup(new PartialPath("root.sg3")); + root.setStorageGroup(new PartialPath("root.db3")); root.setStorageGroup(new PartialPath("root.a.b.sg3")); assertEquals(7, root.getDatabaseNum(new PartialPath("root.**"), ALL_MATCH_SCOPE, false, false)); @@ -213,16 +213,16 @@ public void testCountStorageGroup() throws MetadataException { assertEquals( 2, root.getDatabaseNum(new PartialPath("root.**.sg1"), ALL_MATCH_SCOPE, false, false)); assertEquals( - 1, root.getDatabaseNum(new PartialPath("root.sg3"), ALL_MATCH_SCOPE, false, false)); + 1, root.getDatabaseNum(new PartialPath("root.db3"), ALL_MATCH_SCOPE, false, false)); assertEquals( 2, root.getDatabaseNum(new PartialPath("root.*.b.*"), ALL_MATCH_SCOPE, false, false)); } @Test public void testGetNodeListInLevel() throws MetadataException { - root.setStorageGroup(new PartialPath("root.sg1")); + root.setStorageGroup(new PartialPath("root.db1")); - root.setStorageGroup(new PartialPath("root.sg2")); + root.setStorageGroup(new PartialPath("root.db2")); Pair, Set> result = root.getNodesListInGivenLevel(new PartialPath("root.**"), 3, false, ALL_MATCH_SCOPE); @@ -243,16 +243,16 @@ public void testGetNodeListInLevel() throws MetadataException { root.setStorageGroup(new PartialPath("root.test.`001.002.003`")); root.setStorageGroup(new PartialPath("root.test.g_0.s_0_b001")); - root.setStorageGroup(new PartialPath("root.sg")); + root.setStorageGroup(new PartialPath("root.db")); root.setStorageGroup(new PartialPath("root.ln")); result = root.getNodesListInGivenLevel(new PartialPath("root.*.*.s1"), 2, true, ALL_MATCH_SCOPE); Assert.assertEquals(0, result.left.size()); Assert.assertEquals(5, result.right.size()); - Assert.assertTrue(result.right.contains(new PartialPath("root.sg1"))); - Assert.assertTrue(result.right.contains(new PartialPath("root.sg2"))); - Assert.assertTrue(result.right.contains(new PartialPath("root.sg"))); + Assert.assertTrue(result.right.contains(new PartialPath("root.db1"))); + Assert.assertTrue(result.right.contains(new PartialPath("root.db2"))); + Assert.assertTrue(result.right.contains(new PartialPath("root.db"))); Assert.assertTrue(result.right.contains(new PartialPath("root.ln"))); Assert.assertTrue(result.right.contains(new PartialPath("root.test.`001.002.003`"))); } @@ -261,7 +261,7 @@ public void testGetNodeListInLevel() throws MetadataException { public void testSerialization() throws Exception { final PartialPath[] pathList = new PartialPath[] { - new PartialPath("root.sg"), + new PartialPath("root.db"), new PartialPath("root.a.sg"), new PartialPath("root.a.b.sg"), new PartialPath("root.a.a.b.sg") @@ -319,7 +319,7 @@ public void testTableSerialization() throws Exception { final PartialPath[] pathList = new PartialPath[] { - new PartialPath("root.sg"), + new PartialPath("root.db"), new PartialPath("root.a.sg"), new PartialPath("root.a.b.sg"), new PartialPath("root.a.a.b.sg") diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateCQProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateCQProcedureTest.java index d0e92b3281666..40efc2b8c315c 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateCQProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateCQProcedureTest.java @@ -46,7 +46,7 @@ public void serializeDeserializeTest() { PublicBAOS byteArrayOutputStream = new PublicBAOS(); DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); - String sql = "create cq testCq1 BEGIN select s1 into root.backup.d1(s1) from root.sg.d1 END"; + String sql = "create cq testCq1 BEGIN select s1 into root.backup.d1(s1) from root.db.d1 END"; TCreateCQReq req = new TCreateCQReq( @@ -56,7 +56,7 @@ public void serializeDeserializeTest() { 1000, 0, (byte) 0, - "select s1 into root.backup.d1(s1) from root.sg.d1", + "select s1 into root.backup.d1(s1) from root.db.d1", sql, "Asia", "root"); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateRegionGroupsProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateRegionGroupsProcedureTest.java index 6269953736100..9423729e55d0b 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateRegionGroupsProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/CreateRegionGroupsProcedureTest.java @@ -91,12 +91,12 @@ public void serializeDeserializeTest() { assertEquals(failedRegions0, failedRegions1); CreateRegionGroupsPlan createRegionGroupsPlan = new CreateRegionGroupsPlan(); - createRegionGroupsPlan.addRegionGroup("root.sg0", dataRegionSet); - createRegionGroupsPlan.addRegionGroup("root.sg1", schemaRegionSet); + createRegionGroupsPlan.addRegionGroup("root.db0", dataRegionSet); + createRegionGroupsPlan.addRegionGroup("root.db1", schemaRegionSet); CreateRegionGroupsPlan persistPlan = new CreateRegionGroupsPlan(); - persistPlan.addRegionGroup("root.sg0", dataRegionSet); - persistPlan.addRegionGroup("root.sg1", schemaRegionSet); + persistPlan.addRegionGroup("root.db0", dataRegionSet); + persistPlan.addRegionGroup("root.db1", schemaRegionSet); CreateRegionGroupsProcedure procedure0 = new CreateRegionGroupsProcedure( diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java index 3893dff1607e2..4af24353dd535 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/pipe/receiver/PipeEnrichedProcedureTest.java @@ -94,7 +94,7 @@ public class PipeEnrichedProcedureTest { public void deleteDatabaseTest() { PublicBAOS byteArrayOutputStream = new PublicBAOS(); DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); - DeleteDatabaseProcedure p1 = new DeleteDatabaseProcedure(new TDatabaseSchema("root.sg"), true); + DeleteDatabaseProcedure p1 = new DeleteDatabaseProcedure(new TDatabaseSchema("root.db"), true); try { p1.serialize(outputStream); @@ -114,8 +114,8 @@ public void deleteDatabaseTest() { public void deleteTimeseriesTest() throws IllegalPathException, IOException { String queryId = "1"; PathPatternTree patternTree = new PathPatternTree(); - patternTree.appendPathPattern(new PartialPath("root.sg1.**")); - patternTree.appendPathPattern(new PartialPath("root.sg2.*.s1")); + patternTree.appendPathPattern(new PartialPath("root.db1.**")); + patternTree.appendPathPattern(new PartialPath("root.db2.*.s1")); patternTree.constructTree(); DeleteTimeSeriesProcedure deleteTimeSeriesProcedure = new DeleteTimeSeriesProcedure(queryId, patternTree, true, false); @@ -154,8 +154,8 @@ public void deactivateTemplateTest() throws IllegalPathException, IOException { new TSEncoding[] {TSEncoding.BITMAP, TSEncoding.PLAIN}, new CompressionType[] {CompressionType.GZIP, CompressionType.UNCOMPRESSED}); - templateSetInfo.put(new PartialPath("root.sg1.**"), Arrays.asList(t1, t2)); - templateSetInfo.put(new PartialPath("root.sg2.**"), Arrays.asList(t2, t1)); + templateSetInfo.put(new PartialPath("root.db1.**"), Arrays.asList(t1, t2)); + templateSetInfo.put(new PartialPath("root.db2.**"), Arrays.asList(t2, t1)); DeactivateTemplateProcedure deactivateTemplateProcedure = new DeactivateTemplateProcedure(queryId, templateSetInfo, true); @@ -183,7 +183,7 @@ public void unsetTemplateTest() throws IllegalPathException, IOException { new TSDataType[] {TSDataType.INT32, TSDataType.FLOAT}, new TSEncoding[] {TSEncoding.PLAIN, TSEncoding.BITMAP}, new CompressionType[] {CompressionType.UNCOMPRESSED, CompressionType.GZIP}); - PartialPath path = new PartialPath("root.sg"); + PartialPath path = new PartialPath("root.db"); UnsetTemplateProcedure unsetTemplateProcedure = new UnsetTemplateProcedure(queryId, template, path, true); @@ -202,7 +202,7 @@ public void unsetTemplateTest() throws IllegalPathException, IOException { @Test public void setTemplateTest() throws IOException { SetTemplateProcedure setTemplateProcedure = - new SetTemplateProcedure("1", "t1", "root.sg", true); + new SetTemplateProcedure("1", "t1", "root.db", true); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream); @@ -224,7 +224,7 @@ public void alterLogicalViewTest() throws IllegalPathException, IOException { new HashMap() { { put( - new PartialPath("root.sg"), + new PartialPath("root.db"), new ConstantViewOperand(TSDataType.BOOLEAN, "true")); } }, @@ -766,8 +766,8 @@ public void setViewPropertiesTest() throws IOException { public void alterEncodingCompressorTest() throws IllegalPathException, IOException { final String queryId = "1"; final PathPatternTree patternTree = new PathPatternTree(); - patternTree.appendPathPattern(new PartialPath("root.sg1.**")); - patternTree.appendPathPattern(new PartialPath("root.sg2.*.s1")); + patternTree.appendPathPattern(new PartialPath("root.db1.**")); + patternTree.appendPathPattern(new PartialPath("root.db2.*.s1")); patternTree.constructTree(); final AlterEncodingCompressorProcedure alterEncodingCompressorProcedure = new AlterEncodingCompressorProcedure( diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterEncodingCompressorProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterEncodingCompressorProcedureTest.java index b6f2541b21580..e71dc9748e03a 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterEncodingCompressorProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterEncodingCompressorProcedureTest.java @@ -37,8 +37,8 @@ public class AlterEncodingCompressorProcedureTest { public void serializeDeserializeTest() throws IllegalPathException, IOException { final String queryId = "1"; final PathPatternTree patternTree = new PathPatternTree(); - patternTree.appendPathPattern(new PartialPath("root.sg1.**")); - patternTree.appendPathPattern(new PartialPath("root.sg2.*.s1")); + patternTree.appendPathPattern(new PartialPath("root.db1.**")); + patternTree.appendPathPattern(new PartialPath("root.db2.*.s1")); patternTree.constructTree(); final AlterEncodingCompressorProcedure alterEncodingCompressorProcedure = new AlterEncodingCompressorProcedure( diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedureTest.java index 6f690c492a721..4974f70b37e1b 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedureTest.java @@ -44,7 +44,7 @@ public void serializeDeserializeTest() throws IllegalPathException, IOException new HashMap() { { put( - new PartialPath("root.sg"), + new PartialPath("root.db"), new ConstantViewOperand(TSDataType.BOOLEAN, "true")); } }, diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeactivateTemplateProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeactivateTemplateProcedureTest.java index 87efb7a937464..e1f14185724bf 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeactivateTemplateProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeactivateTemplateProcedureTest.java @@ -63,8 +63,8 @@ public void serializeDeserializeTest() throws IllegalPathException, IOException new TSEncoding[] {TSEncoding.BITMAP, TSEncoding.PLAIN}, new CompressionType[] {CompressionType.GZIP, CompressionType.UNCOMPRESSED}); - templateSetInfo.put(new PartialPath("root.sg1.**"), Arrays.asList(t1, t2)); - templateSetInfo.put(new PartialPath("root.sg2.**"), Arrays.asList(t2, t1)); + templateSetInfo.put(new PartialPath("root.db1.**"), Arrays.asList(t1, t2)); + templateSetInfo.put(new PartialPath("root.db2.**"), Arrays.asList(t2, t1)); DeactivateTemplateProcedure deactivateTemplateProcedure = new DeactivateTemplateProcedure(queryId, templateSetInfo, false); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteDatabaseProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteDatabaseProcedureTest.java index b12f49d9bd7da..9c95bafee9098 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteDatabaseProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteDatabaseProcedureTest.java @@ -38,7 +38,7 @@ public void serializeDeserializeTest() { PublicBAOS byteArrayOutputStream = new PublicBAOS(); DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream); - DeleteDatabaseProcedure p1 = new DeleteDatabaseProcedure(new TDatabaseSchema("root.sg"), false); + DeleteDatabaseProcedure p1 = new DeleteDatabaseProcedure(new TDatabaseSchema("root.db"), false); try { p1.serialize(outputStream); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedureTest.java index 8223cac998e66..d4e04557b6b43 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedureTest.java @@ -39,8 +39,8 @@ public class DeleteTimeSeriesProcedureTest { public void serializeDeserializeTest() throws IllegalPathException, IOException { String queryId = "1"; PathPatternTree patternTree = new PathPatternTree(); - patternTree.appendPathPattern(new PartialPath("root.sg1.**")); - patternTree.appendPathPattern(new PartialPath("root.sg2.*.s1")); + patternTree.appendPathPattern(new PartialPath("root.db1.**")); + patternTree.appendPathPattern(new PartialPath("root.db2.*.s1")); patternTree.constructTree(); DeleteTimeSeriesProcedure deleteTimeSeriesProcedure = new DeleteTimeSeriesProcedure(queryId, patternTree, false, false); @@ -61,7 +61,7 @@ public void serializeDeserializeTest() throws IllegalPathException, IOException List pathList = deserializedProcedure.getPatternTree().getAllPathPatterns(); pathList.sort(PartialPath::compareTo); - Assert.assertEquals("root.sg1.**", pathList.get(0).getFullPath()); - Assert.assertEquals("root.sg2.*.s1", pathList.get(1).getFullPath()); + Assert.assertEquals("root.db1.**", pathList.get(0).getFullPath()); + Assert.assertEquals("root.db2.*.s1", pathList.get(1).getFullPath()); } } diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedureTest.java index 53b9fd2dd0f01..945fb68960a85 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedureTest.java @@ -33,7 +33,7 @@ public class SetTemplateProcedureTest { @Test public void serializeDeserializeTest() throws IOException { SetTemplateProcedure setTemplateProcedure = - new SetTemplateProcedure("1", "t1", "root.sg", false); + new SetTemplateProcedure("1", "t1", "root.db", false); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream); diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedureTest.java index b288418e1b561..860541c4984be 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedureTest.java @@ -48,7 +48,7 @@ public void serializeDeserializeTest() throws IllegalPathException, IOException new TSDataType[] {TSDataType.INT32, TSDataType.FLOAT}, new TSEncoding[] {TSEncoding.PLAIN, TSEncoding.BITMAP}, new CompressionType[] {CompressionType.UNCOMPRESSED, CompressionType.GZIP}); - PartialPath path = new PartialPath("root.sg"); + PartialPath path = new PartialPath("root.db"); UnsetTemplateProcedure unsetTemplateProcedure = new UnsetTemplateProcedure(queryId, template, path, false); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java index cc857b7295cf1..0092ba4d02cb5 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java @@ -35,10 +35,10 @@ import java.util.List; /** - * The JSON payload formatter. two json format supported: { "device":"root.sg.d1", + * The JSON payload formatter. two json format supported: { "device":"root.db.d1", * "timestamp":1586076045524, "measurements":["s1","s2"], "values":[0.530635,0.530635] } * - *

{ "device":"root.sg.d1", "timestamps":[1586076045524,1586076065526], + *

{ "device":"root.db.d1", "timestamps":[1586076045524,1586076065526], * "measurements":["s1","s2"], "values":[[0.530635,0.530635], [0.530655,0.530695]] } */ public class JSONPayloadFormatter implements PayloadFormatter { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java index 05932e78b95a3..59da4d8cd313f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java @@ -649,7 +649,7 @@ public static ClusterSchemaTree deserialize(InputStream inputStream) throws IOEx /** * Get database name by device path * - *

e.g., root.sg1 is a database and device path = root.sg1.d1, return root.sg1 + *

e.g., root.db1 is a database and device path = root.db1.d1, return root.db1 * * @param deviceID only full device path, cannot be path pattern * @return database in the given path diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java index 543991a6ff72c..edca7adc0c12f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java @@ -64,7 +64,7 @@ Pair, Integer> searchMeasurementPaths( /** * Get database name by device path * - *

e.g., root.sg1 is a database and device path = root.sg1.d1, return root.sg1 + *

e.g., root.db1 is a database and device path = root.db1.d1, return root.db1 * * @param pathName only full device path, cannot be path pattern * @return database in the given path diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/FileLoaderUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/FileLoaderUtils.java index 35d8a1705ab00..3c2c55a81926f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/FileLoaderUtils.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/FileLoaderUtils.java @@ -174,8 +174,8 @@ public static TimeseriesMetadata loadTimeSeriesMetadata( * Load AlignedTimeSeriesMetadata for aligned time series. * * @param resource corresponding TsFileResource - * @param alignedPath instance of VectorPartialPath, vector's full path, e.g. (root.sg1.d1.vector, - * [root.sg1.d1.vector.s1, root.sg1.d1.vector.s2]) + * @param alignedPath instance of VectorPartialPath, vector's full path, e.g. (root.db1.d1.vector, + * [root.db1.d1.vector.s1, root.db1.d1.vector.s2]) * @throws IOException IOException may be thrown while reading it from disk. */ public static AbstractAlignedTimeSeriesMetadata loadAlignedTimeSeriesMetadata( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java index 9235bc350889a..740df5dc55ee6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java @@ -138,10 +138,10 @@ public class Analysis implements IAnalysis { /* tag values -> (grouped expression -> output expressions) For different combination of tag keys, the grouped expression may be different. Let's say there - are 3 timeseries root.sg.d1.temperature, root.sg.d1.status, root.sg.d2.temperature, and their + are 3 timeseries root.db.d1.temperature, root.db.d1.status, root.db.d2.temperature, and their tags are [k1=v1], [k1=v1] and [k1=v2] respectively. For query "SELECT last_value(**) FROM root GROUP BY k1", timeseries are grouped by their tags into 2 buckets. Bucket [v1] has - [root.sg.d1.temperature, root.sg.d1.status], while bucket [v2] has [root.sg.d2.temperature]. + [root.db.d1.temperature, root.db.d1.status], while bucket [v2] has [root.db.d2.temperature]. Thus, the aggregation results of bucket [v1] and [v2] are different. Bucket [v1] has 2 aggregation results last_value(temperature) and last_value(status), whereas bucket [v2] only has [last_value(temperature)]. @@ -215,7 +215,7 @@ aggregation results last_value(temperature) and last_value(status), whereas buck // The expressions in order by clause // In align by device orderByExpression is the deviceView of expression which doesn't have // device-prefix - // for example, in device root.sg1.d1, [root.sg1.d1.s1] is expression and [s1] is the device-view + // for example, in device root.db1.d1, [root.db1.d1.s1] is expression and [s1] is the device-view // one. private Set orderByExpressions; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java index 7e405d63ebc24..aa13a09503744 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java @@ -2517,8 +2517,8 @@ private void analyzeInto( /** * Check datatype consistency in ALIGN BY DEVICE. * - *

an inconsistent example: select s0 from root.sg1.d1, root.sg1.d2 align by device, return - * false while root.sg1.d1.s0 is INT32 and root.sg1.d2.s0 is FLOAT. + *

an inconsistent example: select s0 from root.db1.d1, root.db1.d2 align by device, return + * false while root.db1.d1.s0 is INT32 and root.db1.d2.s0 is FLOAT. */ private void checkDataTypeConsistencyInAlignByDevice( Analysis analysis, List expressions) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/GroupByLevelHelper.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/GroupByLevelHelper.java index a220fdf2883d3..024fc73f5bad4 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/GroupByLevelHelper.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/GroupByLevelHelper.java @@ -44,10 +44,10 @@ public class GroupByLevelHelper { private final int[] levels; - /** count(root.sg.d1.s1) with level = 1 -> { count(root.*.d1.s1) : count(root.sg.d1.s1) } */ + /** count(root.db.d1.s1) with level = 1 -> { count(root.*.d1.s1) : count(root.db.d1.s1) } */ private final Map> groupedAggregationExpressionToRawExpressionsMap; - /** count(root.sg.d1.s1) with level = 1 -> { root.sg.d1.s1 : root.sg.*.s1 } */ + /** count(root.db.d1.s1) with level = 1 -> { root.db.d1.s1 : root.db.*.s1 } */ private final RawPathToGroupedPathMap rawPathToGroupedPathMap; /** count(root.*.d1.s1) -> alias */ @@ -80,7 +80,7 @@ public Expression applyLevels( Expression outputExpression = ExpressionAnalyzer.replaceSubTreeWithView(expression, analysis); // construct output expression - // e.g. count(root.sg.d1.s1) -> count(root.sg.*.s1) + // e.g. count(root.db.d1.s1) -> count(root.db.*.s1) Expression groupedOutputExpression = ExpressionAnalyzer.replaceRawPathWithGroupedPath( outputExpression, @@ -148,7 +148,7 @@ private void checkAliasAndUpdateAliasMap(String alias, String groupedExpressionS /** * Transform an originalPath to a partial path that satisfies given level. Path nodes don't * satisfy the given level will be replaced by "*" except the sensor level, e.g. - * transformPathByLevels("root.sg.dh.d1.s1", 2) will return "root.*.dh.*.s1". + * transformPathByLevels("root.db.dh.d1.s1", 2) will return "root.*.dh.*.s1". * *

Especially, if count(*), then the sensor level will be replaced by "*" too. * diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java index aef4a199c390e..f7755bd02d3b8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java @@ -64,9 +64,9 @@ public class FunctionExpression extends Expression { private final LinkedHashMap functionAttributes; /** - * example: select udf(a, b, udf(c)) from root.sg.d; + * example: select udf(a, b, udf(c)) from root.db.d; * - *

3 expressions [root.sg.d.a, root.sg.d.b, udf(root.sg.d.c)] will be in this field. + *

3 expressions [root.db.d.a, root.db.d.b, udf(root.db.d.c)] will be in this field. */ private List expressions; @@ -329,9 +329,9 @@ public String getExpressionStringInternal() { * *

Example: * - *

Full column name -> udf(root.sg.d.s1, sin(root.sg.d.s1), 'key1'='value1', 'key2'='value2') + *

Full column name -> udf(root.db.d.s1, sin(root.db.d.s1), 'key1'='value1', 'key2'='value2') * - *

The parameter part -> root.sg.d.s1, sin(root.sg.d.s1), 'key1'='value1', 'key2'='value2' + *

The parameter part -> root.db.d.s1, sin(root.db.d.s1), 'key1'='value1', 'key2'='value2' */ private String getParametersString() { if (parametersString == null) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByLevelNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByLevelNode.java index ddfaed455a74d..e82f8119e2348 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByLevelNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByLevelNode.java @@ -46,10 +46,10 @@ * and belong to one bucket. Here, that two columns belong to one bucket means the partial paths of * device after rolling up in specific level are the same. * - *

For example, let's say there are two columns `root.sg.d1.s1` and `root.sg.d2.s1`. + *

For example, let's say there are two columns `root.db.d1.s1` and `root.db.d2.s1`. * *

If the group by level parameter is [0, 1], then these two columns will belong to one bucket - * and the bucket name is `root.sg.*.s1`. + * and the bucket name is `root.db.*.s1`. * *

If the group by level parameter is [0, 2], then these two columns will not belong to one * bucket. And the total buckets are `root.*.d1.s1` and `root.*.d2.s1` diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByTagNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByTagNode.java index 50b64e029c0bf..6a53a309b94c3 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByTagNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/GroupByTagNode.java @@ -221,19 +221,19 @@ public List getTagKeys() { *

e.g. we have following timeseries: * *

    - *
  • root.sg.d1.s1(k1=v1) - *
  • root.sg.d1.s2(k1=v1) - *
  • root.sg.d2.s1(k1=v2) - *
  • root.sg.d3.s1(k1=v2) + *
  • root.db.d1.s1(k1=v1) + *
  • root.db.d1.s2(k1=v1) + *
  • root.db.d2.s1(k1=v2) + *
  • root.db.d3.s1(k1=v2) *
* * Then the query - * SELECT avg(s1), avg(s2) FROM root.sg.** GROUP BY TAGS(k1) + * SELECT avg(s1), avg(s2) FROM root.db.** GROUP BY TAGS(k1) * will generate a {@link GroupByTagNode} with the TagValuesToAggregationDescriptors * as below: * { - * ["v1"]: [["avg(root.sg.d1.s1)"], ["avg(root.sg.d1.s2)"]], - * ["v2"]: [["avg(root.sg.d2.s1)","avg(root.sg.d3.s1)"], null], + * ["v1"]: [["avg(root.db.d1.s1)"], ["avg(root.db.d1.s2)"]], + * ["v2"]: [["avg(root.db.d2.s1)","avg(root.db.d3.s1)"], null], * } * * diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/DeleteDataNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/DeleteDataNode.java index cfba72d66db62..a741becefd3d2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/DeleteDataNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/DeleteDataNode.java @@ -326,8 +326,8 @@ public List splitByPartition(IAnalysis analysis) { new DeleteDataNode( getPlanNodeId(), // Pick the smaller path list to execute the deletion. - // E.g. There is only one path(root.sg.**) in pathList and two paths(root.sg.d1, - // root.sg.d2) in a map entry in regionToPatternMap. Choose the original path is + // E.g. There is only one path(root.db.**) in pathList and two paths(root.db.d1, + // root.db.d2) in a map entry in regionToPatternMap. Choose the original path is // better. this.pathList.size() < regionToPatternMap.get(o).size() ? this.pathList diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/AggregationDescriptor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/AggregationDescriptor.java index ac30dcf505afd..b589b9fdd5275 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/AggregationDescriptor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/AggregationDescriptor.java @@ -59,9 +59,9 @@ public class AggregationDescriptor { * Input of aggregation function. Currently, we only support one series in the aggregation * function. * - *

example: select sum(s1) from root.sg.d1; expression [root.sg.d1.s1] will be in this field. + *

example: select sum(s1) from root.db.d1; expression [root.db.d1.s1] will be in this field. * - *

example: select sum(s1) from root.** group by level = 1; expression [root.sg.*.s1] may be in + *

example: select sum(s1) from root.** group by level = 1; expression [root.db.*.s1] may be in * this field if the data is in different DataRegion */ protected List inputExpressions; @@ -210,9 +210,9 @@ public List getActualAggregationNames(boolean isPartial) { * *

Example: * - *

Full column name -> udf(root.sg.d.s1, sin(root.sg.d.s1)) + *

Full column name -> udf(root.db.d.s1, sin(root.db.d.s1)) * - *

The parameter part -> root.sg.d.s1, sin(root.sg.d.s1) + *

The parameter part -> root.db.d.s1, sin(root.db.d.s1) */ public String getParametersString() { if (parametersString == null) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/CrossSeriesAggregationDescriptor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/CrossSeriesAggregationDescriptor.java index d986baf2faa3c..b41eec9a67aaa 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/CrossSeriesAggregationDescriptor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/CrossSeriesAggregationDescriptor.java @@ -152,11 +152,11 @@ public List getInputExpressionsAsStringList() { /** * For an aggregate function that takes two inputs, the inputExpressions may be like - * [root.sg.d1.s1, root.sg.d1.s2, root.sg.d2.s1, root.sg.d2.s2]. The inputExpressions is a + * [root.db.d1.s1, root.db.d1.s2, root.db.d2.s1, root.db.d2.s2]. The inputExpressions is a * one-dimensional List, but it is split by expressionNumOfOneInput. The split result is stored in - * groupedInputExpressions So the returned map of this method is : <"root.sg.d1.s1, - * root.sg.d1.s2", [root.sg.d1.s1, root.sg.d1.s2]> <"root.sg.d2.s1, root.sg.d2.s2", - * [root.sg.d2.s1, root.sg.d2.s2]> + * groupedInputExpressions So the returned map of this method is : <"root.db.d1.s1, + * root.db.d1.s2", [root.db.d1.s1, root.db.d1.s2]> <"root.db.d2.s1, root.db.d2.s2", + * [root.db.d2.s1, root.db.d2.s2]> */ public Map> getGroupedInputStringToExpressionsMap() { Map> map = new HashMap<>(); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/component/ResultColumn.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/component/ResultColumn.java index f97391330811e..8da242955449b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/component/ResultColumn.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/component/ResultColumn.java @@ -28,37 +28,37 @@ * This class is used to represent a result column of a query. * *

Assume that we have time series in db as follows:
- * [ root.sg.d.a, root.sg.d.b, root.sg.e.a, root.sg.e.b ] + * [ root.db.d.a, root.db.d.b, root.db.e.a, root.db.e.b ] * *

    - * Example 1: select a, a + b, udf(udf(b)) from root.sg.d, root.sg.e; + * Example 1: select a, a + b, udf(udf(b)) from root.db.d, root.db.e; *
  • Step 1: constructed by sql visitor in logical operator:
    * result columns:
    * [a, a + b, udf(udf(b))] *
  • Step 2: concatenated with prefix paths in logical optimizer:
    * result columns:
    - * [root.sg.d.a, root.sg.e.a, root.sg.d.a + root.sg.d.b, root.sg.d.a + root.sg.e.b, - * root.sg.e.a + root.sg.d.b, root.sg.e.a + root.sg.e.b, udf(udf(root.sg.d.b)), - * udf(udf(root.sg.e.b))] + * [root.db.d.a, root.db.e.a, root.db.d.a + root.db.d.b, root.db.d.a + root.db.e.b, + * root.db.e.a + root.db.d.b, root.db.e.a + root.db.e.b, udf(udf(root.db.d.b)), + * udf(udf(root.db.e.b))] *
  • Step 3: remove wildcards in logical optimizer:
    * result columns:
    - * [root.sg.d.a, root.sg.e.a, root.sg.d.a + root.sg.d.b, root.sg.d.a + root.sg.e.b, - * root.sg.e.a + root.sg.d.b, root.sg.e.a + root.sg.e.b, udf(udf(root.sg.d.b)), - * udf(udf(root.sg.e.b))] + * [root.db.d.a, root.db.e.a, root.db.d.a + root.db.d.b, root.db.d.a + root.db.e.b, + * root.db.e.a + root.db.d.b, root.db.e.a + root.db.e.b, udf(udf(root.db.d.b)), + * udf(udf(root.db.e.b))] *
* *
    - * Example 2: select *, a + *, udf(udf(*)) from root.sg.d; + * Example 2: select *, a + *, udf(udf(*)) from root.db.d; *
  • Step 1: constructed by sql visitor in logical operator:
    * result columns:
    * [*, a + * , udf(udf(*))] *
  • Step 2: concatenated with prefix paths in logical optimizer:
    * result columns:
    - * [root.sg.d.*, root.sg.d.a + root.sg.d.*, udf(udf(root.sg.d.*))] + * [root.db.d.*, root.db.d.a + root.db.d.*, udf(udf(root.db.d.*))] *
  • Step 3: remove wildcards in logical optimizer:
    * result columns:
    - * [root.sg.d.a, root.sg.d.b, root.sg.d.a + root.sg.d.a, root.sg.d.a + root.sg.d.b, - * udf(udf(root.sg.d.a)), udf(udf(root.sg.d.b))] + * [root.db.d.a, root.db.d.b, root.db.d.a + root.db.d.a, root.db.d.a + root.db.d.b, + * udf(udf(root.db.d.a)), udf(udf(root.db.d.b))] *
*/ public class ResultColumn extends StatementNode { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java index 5931023b3cf90..fc8ec1499ec8c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java @@ -426,7 +426,7 @@ private IMemMNode checkAndAutoCreateInternalPath(final PartialPath devicePath) IMemMNode cur = databaseMNode; IMemMNode child; String childName; - // e.g, path = root.sg.d1.s1, create internal nodes and set cur to sg node, parent of d1 + // e.g, path = root.db.d1.s1, create internal nodes and set cur to sg node, parent of d1 for (int i = levelOfSG + 1; i < nodeNames.length - 1; i++) { childName = nodeNames[i]; child = cur.getChild(childName); @@ -753,7 +753,7 @@ public void setAlias(final IMeasurementMNode measurementMNode, final /** * Add an interval path to MTree. This is only used for automatically creating schema * - *

e.g., get root.sg.d1, get or create all internal nodes and return the node of d1 + *

e.g., get root.db.d1, get or create all internal nodes and return the node of d1 */ public IMemMNode getDeviceNodeWithAutoCreating(final PartialPath deviceId) throws MetadataException { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java index 7b6ac7d996e00..99102a523ae42 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java @@ -597,7 +597,7 @@ private ICachedMNode checkAndAutoCreateInternalPath(PartialPath devicePath) ICachedMNode child; String childName; try { - // e.g, path = root.sg.d1.s1, create internal nodes and set cur to sg node, parent of d1 + // e.g, path = root.db.d1.s1, create internal nodes and set cur to sg node, parent of d1 for (int i = levelOfSG + 1; i < nodeNames.length - 1; i++) { childName = nodeNames[i]; child = store.getChild(cur, childName); @@ -825,7 +825,7 @@ public void setAlias(IMeasurementMNode measurementMNode, String al /** * Add an interval path to MTree. This is only used for automatically creating schema * - *

e.g., get root.sg.d1, get or create all internal nodes and return the node of d1 + *

e.g., get root.db.d1, get or create all internal nodes and return the node of d1 */ public ICachedMNode getDeviceNodeWithAutoCreating(PartialPath deviceId) throws MetadataException { String[] nodeNames = deviceId.getNodes(); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/buffer/NodeBuffer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/buffer/NodeBuffer.java index 546d1df726b99..ba467f4c878d0 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/buffer/NodeBuffer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/buffer/NodeBuffer.java @@ -93,7 +93,7 @@ private void addNonVolatileAncestorToBuffer(ICachedMNode node) { CacheEntry cacheEntry = parent.getCacheEntry(); // make sure that the nodeBuffer contains all the root node of volatile subTree - // give that root.sg.d.s, if sg and d have been persisted and s are volatile, then d + // give that root.db.d.s, if sg and d have been persisted and s are volatile, then d // will be added to nodeBuffer synchronized (cacheEntry) { // the cacheEntry may be set to volatile concurrently, the unVolatile node should not be diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/Traverser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/Traverser.java index 211f9e1999911..c04e8072443cc 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/Traverser.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/Traverser.java @@ -82,7 +82,7 @@ public abstract class Traverser> extends AbstractTreeVisi protected Traverser() {} /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/DatabaseTraverser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/DatabaseTraverser.java index 46d1365a2c456..7ffb3a8388198 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/DatabaseTraverser.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/DatabaseTraverser.java @@ -31,7 +31,7 @@ public abstract class DatabaseTraverser> extends Traverse protected boolean collectInternal = false; /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/EntityTraverser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/EntityTraverser.java index 740f6133a549c..715975df1537d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/EntityTraverser.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/EntityTraverser.java @@ -32,7 +32,7 @@ public abstract class EntityTraverser> extends Traverser< private int schemaTemplateId = -1; /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MNodeTraverser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MNodeTraverser.java index 97dba7fc4108c..79de82e9c24c0 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MNodeTraverser.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MNodeTraverser.java @@ -33,12 +33,12 @@ */ public abstract class MNodeTraverser> extends Traverser { - // Level query option started from 0. For example, level of root.sg.d1.s1 is 3. + // Level query option started from 0. For example, level of root.db.d1.s1 is 3. protected int targetLevel = -1; protected N lastVisitNode = null; /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MeasurementTraverser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MeasurementTraverser.java index 4996e3f0c8b36..675ba200fac89 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MeasurementTraverser.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/basic/MeasurementTraverser.java @@ -28,7 +28,7 @@ public abstract class MeasurementTraverser> extends Traverser { /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/EntityUpdater.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/EntityUpdater.java index 4641bffcf93f0..94a54aec3a0bc 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/EntityUpdater.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/EntityUpdater.java @@ -30,7 +30,7 @@ public abstract class EntityUpdater> extends EntityTraverser implements Updater { /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/MeasurementUpdater.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/MeasurementUpdater.java index d8b6ef036210b..ee07da07fde7d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/MeasurementUpdater.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/updater/MeasurementUpdater.java @@ -29,7 +29,7 @@ public abstract class MeasurementUpdater> extends MeasurementTraverser implements Updater { /** - * To traverse subtree under root.sg, e.g., init Traverser(root, "root.sg.**") + * To traverse subtree under root.db, e.g., init Traverser(root, "root.db.**") * * @param startNode denote which tree to traverse by passing its root * @param path use wildcard to specify which part to traverse diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/MetaUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/MetaUtils.java index 11b41b238a340..d375271a3d977 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/MetaUtils.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/MetaUtils.java @@ -77,8 +77,8 @@ public static PartialPath getDatabasePathByLevel(PartialPath path, int level) /** * PartialPath of aligned time series will be organized to one AlignedPath. BEFORE this method, - * all the aligned time series is NOT united. For example, given root.sg.d1.vector1[s1] and - * root.sg.d1.vector1[s2], they will be organized to root.sg.d1.vector1 [s1,s2] + * all the aligned time series is NOT united. For example, given root.db.d1.vector1[s1] and + * root.db.d1.vector1[s2], they will be organized to root.db.d1.vector1 [s1,s2] * * @param fullPaths full path list without uniting the sub measurement under the same aligned time * series. The list has been sorted by the alphabetical order, so all the aligned time series @@ -111,8 +111,8 @@ public static List groupAlignedPaths(List fullPaths) { /** * PartialPath of aligned time series will be organized to one AlignedPath. BEFORE this method, - * all the aligned time series is NOT united. For example, given root.sg.d1.vector1[s1] and - * root.sg.d1.vector1[s2], they will be organized to root.sg.d1.vector1 [s1,s2] + * all the aligned time series is NOT united. For example, given root.db.d1.vector1[s1] and + * root.db.d1.vector1[s2], they will be organized to root.db.d1.vector1 [s1,s2] * * @param fullPaths full path list without uniting the sub measurement under the same aligned time * series. The list has been sorted by the alphabetical order, so all the aligned time series diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/template/ClusterTemplateManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/template/ClusterTemplateManager.java index ac89c86b819d9..5f7c042700179 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/template/ClusterTemplateManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/template/ClusterTemplateManager.java @@ -397,14 +397,14 @@ public List