You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2022/06/20 09:49:33 UTC
[iotdb] 01/01: fix bug
This is an automated email from the ASF dual-hosted git repository.
hui pushed a commit to branch StandaloneSchemaFetcherDebug
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 1d7e25c077b77d111e4082f45a5cbdeed07896ac
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Mon Jun 20 17:48:49 2022 +0800
fix bug
---
.../mpp/plan/analyze/StandaloneSchemaFetcher.java | 40 +++++-----------------
1 file changed, 9 insertions(+), 31 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/StandaloneSchemaFetcher.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/StandaloneSchemaFetcher.java
index 7d4ac12f5f..2d190a79c3 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/StandaloneSchemaFetcher.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/StandaloneSchemaFetcher.java
@@ -64,18 +64,16 @@ public class StandaloneSchemaFetcher implements ISchemaFetcher {
patternTree.constructTree();
Set<String> storageGroupSet = new HashSet<>();
SchemaTree schemaTree = new SchemaTree();
- List<PartialPath> partialPathList = patternTree.getAllPathPatterns();
+ List<PartialPath> pathPatterns = patternTree.getAllPathPatterns();
try {
- for (PartialPath path : partialPathList) {
- List<PartialPath> storageGroups = localConfigNode.getBelongedStorageGroups(path);
+ for (PartialPath pathPattern : pathPatterns) {
+ List<PartialPath> storageGroups = localConfigNode.getBelongedStorageGroups(pathPattern);
for (PartialPath storageGroupPath : storageGroups) {
- String storageGroup = storageGroupPath.getFullPath();
- storageGroupSet.add(storageGroup);
+ storageGroupSet.add(storageGroupPath.getFullPath());
SchemaRegionId schemaRegionId =
localConfigNode.getBelongedSchemaRegionId(storageGroupPath);
ISchemaRegion schemaRegion = schemaEngine.getSchemaRegion(schemaRegionId);
- schemaTree.appendMeasurementPaths(
- schemaRegion.getMeasurementPaths(storageGroupPath, true));
+ schemaTree.appendMeasurementPaths(schemaRegion.getMeasurementPaths(pathPattern, false));
}
}
} catch (MetadataException e) {
@@ -90,26 +88,6 @@ public class StandaloneSchemaFetcher implements ISchemaFetcher {
return fetchSchema(patternTree);
}
- private SchemaTree fetchSchemaForWrite(PathPatternTree patternTree) {
- patternTree.constructTree();
- Set<String> storageGroupSet = new HashSet<>();
- SchemaTree schemaTree = new SchemaTree();
- List<PartialPath> partialPathList = patternTree.getAllPathPatterns();
- try {
- for (PartialPath path : partialPathList) {
- String storageGroup = localConfigNode.getBelongedStorageGroup(path).getFullPath();
- storageGroupSet.add(storageGroup);
- SchemaRegionId schemaRegionId = localConfigNode.getBelongedSchemaRegionId(path);
- ISchemaRegion schemaRegion = schemaEngine.getSchemaRegion(schemaRegionId);
- schemaTree.appendMeasurementPaths(schemaRegion.getMeasurementPaths(path, false));
- }
- } catch (MetadataException e) {
- throw new RuntimeException(e);
- }
- schemaTree.setStorageGroups(new ArrayList<>(storageGroupSet));
- return schemaTree;
- }
-
@Override
public SchemaTree fetchSchemaWithAutoCreate(
PartialPath devicePath, String[] measurements, TSDataType[] tsDataTypes, boolean aligned) {
@@ -127,12 +105,12 @@ public class StandaloneSchemaFetcher implements ISchemaFetcher {
SchemaTree fetchedSchemaTree;
if (!config.isAutoCreateSchemaEnabled()) {
- fetchedSchemaTree = fetchSchemaForWrite(patternTree);
+ fetchedSchemaTree = fetchSchema(patternTree);
schemaTree.mergeSchemaTree(fetchedSchemaTree);
return schemaTree;
}
- fetchedSchemaTree = fetchSchemaForWrite(patternTree);
+ fetchedSchemaTree = fetchSchema(patternTree);
schemaTree.mergeSchemaTree(fetchedSchemaTree);
SchemaTree missingSchemaTree =
@@ -165,12 +143,12 @@ public class StandaloneSchemaFetcher implements ISchemaFetcher {
SchemaTree fetchedSchemaTree;
if (!config.isAutoCreateSchemaEnabled()) {
- fetchedSchemaTree = fetchSchemaForWrite(patternTree);
+ fetchedSchemaTree = fetchSchema(patternTree);
schemaTree.mergeSchemaTree(fetchedSchemaTree);
return schemaTree;
}
- fetchedSchemaTree = fetchSchemaForWrite(patternTree);
+ fetchedSchemaTree = fetchSchema(patternTree);
schemaTree.mergeSchemaTree(fetchedSchemaTree);
SchemaTree missingSchemaTree;