diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java index c98421e27725..160495e40fb7 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java @@ -456,6 +456,9 @@ public void testMixedDatabase() throws SQLException { EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT); final Statement statement = connection.createStatement()) { statement.execute("create database test"); + statement.execute("use test"); + statement.execute("create table table1(id1 tag, s1 string)"); + statement.execute("insert into table1 values(0, 'd1', null), (1,'d1', 1)"); } try (final Connection connection = EnvFactory.getEnv().getConnection(); @@ -463,6 +466,7 @@ public void testMixedDatabase() throws SQLException { statement.execute("create database root.test"); statement.execute( "alter database root.test WITH SCHEMA_REGION_GROUP_NUM=2, DATA_REGION_GROUP_NUM=3"); + statement.execute("insert into root.test.d1 (s1) values(1)"); statement.execute("drop database root.test"); } @@ -475,8 +479,6 @@ public void testMixedDatabase() throws SQLException { assertTrue(resultSet.next()); } assertEquals("test", resultSet.getString(1)); - assertEquals(0, resultSet.getInt(6)); - assertEquals(0, resultSet.getInt(7)); assertFalse(resultSet.next()); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java index f9f934867829..d0019f339896 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java @@ -358,9 +358,9 @@ public DatabaseSchemaResp getMatchedDatabaseSchemas(final GetDatabasePlan plan) final List matchedPaths = mTree.getMatchedDatabases(patternPath, plan.getScope(), false); for (final PartialPath path : matchedPaths) { - schemaMap.put( - path.getFullPath(), - mTree.getDatabaseNodeByDatabasePath(path).getAsMNode().getDatabaseSchema()); + final TDatabaseSchema schema = + mTree.getDatabaseNodeByDatabasePath(path).getAsMNode().getDatabaseSchema(); + schemaMap.put(schema.getName(), schema); } result.setSchemaMap(schemaMap); result.setStatus(new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()));