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/12/15 14:38:14 UTC

[iotdb] 04/04: remove getAllMeasurement() in ISchemaTree

This is an automated email from the ASF dual-hosted git repository.

hui pushed a commit to branch lmh/modifySchemaTreeInterface
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit c04dfde2f7a24ed53c9e112416b87cd3cc5a5486
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Thu Dec 15 22:27:37 2022 +0800

    remove getAllMeasurement() in ISchemaTree
---
 .../org/apache/iotdb/db/metadata/cache/DataNodeSchemaCache.java   | 3 +--
 .../apache/iotdb/db/mpp/common/schematree/ClusterSchemaTree.java  | 1 -
 .../iotdb/db/mpp/common/schematree/DeviceGroupSchemaTree.java     | 5 -----
 .../org/apache/iotdb/db/mpp/common/schematree/ISchemaTree.java    | 2 --
 .../main/java/org/apache/iotdb/db/mpp/plan/analyze/Analysis.java  | 8 ++++++++
 .../apache/iotdb/db/metadata/cache/DataNodeSchemaCacheTest.java   | 6 +++---
 6 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCache.java b/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCache.java
index c5614e34eb..c8a0f68b0b 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCache.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCache.java
@@ -25,7 +25,6 @@ import org.apache.iotdb.commons.service.metric.MetricService;
 import org.apache.iotdb.db.conf.IoTDBConfig;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.mpp.common.schematree.ClusterSchemaTree;
-import org.apache.iotdb.db.mpp.common.schematree.ISchemaTree;
 import org.apache.iotdb.tsfile.read.TimeValuePair;
 import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
 
@@ -137,7 +136,7 @@ public class DataNodeSchemaCache {
     return schemaTree;
   }
 
-  public void put(ISchemaTree schemaTree) {
+  public void put(ClusterSchemaTree schemaTree) {
     for (MeasurementPath measurementPath : schemaTree.getAllMeasurement()) {
       putSingleMeasurementPath(schemaTree.getBelongedDatabase(measurementPath), measurementPath);
     }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/ClusterSchemaTree.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/ClusterSchemaTree.java
index d1581176ca..b51247fcda 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/ClusterSchemaTree.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/ClusterSchemaTree.java
@@ -90,7 +90,6 @@ public class ClusterSchemaTree implements ISchemaTree {
     return new Pair<>(visitor.getAllResult(), visitor.getNextOffset());
   }
 
-  @Override
   public List<MeasurementPath> getAllMeasurement() {
     return searchMeasurementPaths(ALL_MATCH_PATTERN, 0, 0, false).left;
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/DeviceGroupSchemaTree.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/DeviceGroupSchemaTree.java
index a8a64f38f8..389c38f4d4 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/DeviceGroupSchemaTree.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/DeviceGroupSchemaTree.java
@@ -67,11 +67,6 @@ public class DeviceGroupSchemaTree implements ISchemaTree {
     throw new UnsupportedOperationException();
   }
 
-  @Override
-  public List<MeasurementPath> getAllMeasurement() {
-    throw new UnsupportedOperationException();
-  }
-
   @Override
   public List<DeviceSchemaInfo> getMatchedDevices(PartialPath pathPattern, boolean isPrefixMatch) {
     throw new UnsupportedOperationException();
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/ISchemaTree.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/ISchemaTree.java
index 010443a63a..61e9bf0226 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/ISchemaTree.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/ISchemaTree.java
@@ -39,8 +39,6 @@ public interface ISchemaTree {
 
   Pair<List<MeasurementPath>, Integer> searchMeasurementPaths(PartialPath pathPattern);
 
-  List<MeasurementPath> getAllMeasurement();
-
   /**
    * Get all device matching the path pattern.
    *
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analysis.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analysis.java
index 2b4ad26216..4b08a15181 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analysis.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analysis.java
@@ -36,6 +36,7 @@ import org.apache.iotdb.db.mpp.plan.planner.plan.parameter.GroupByTimeParameter;
 import org.apache.iotdb.db.mpp.plan.planner.plan.parameter.IntoPathDescriptor;
 import org.apache.iotdb.db.mpp.plan.planner.plan.parameter.OrderByParameter;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.crud.QueryStatement;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.read.filter.basic.Filter;
 import org.apache.iotdb.tsfile.utils.Pair;
@@ -257,6 +258,13 @@ public class Analysis {
     return type;
   }
 
+  public boolean hasDataSource() {
+    return (dataPartition != null && !dataPartition.isEmpty())
+        || (schemaPartition != null && !schemaPartition.isEmpty())
+        || (statement instanceof QueryStatement
+            && ((QueryStatement) statement).isAggregationQuery());
+  }
+
   public LinkedHashMap<Expression, Set<Expression>> getCrossGroupByExpressions() {
     return crossGroupByExpressions;
   }
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCacheTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCacheTest.java
index bee7c16e6b..88148499a6 100644
--- a/server/src/test/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCacheTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCacheTest.java
@@ -62,7 +62,7 @@ public class DataNodeSchemaCacheTest {
     measurements[1] = "s2";
     measurements[2] = "s3";
 
-    dataNodeSchemaCache.put(generateSchemaTree1());
+    dataNodeSchemaCache.put((ClusterSchemaTree) generateSchemaTree1());
 
     Map<PartialPath, SchemaCacheEntry> schemaCacheEntryMap =
         dataNodeSchemaCache.get(device1, measurements).getAllMeasurement().stream()
@@ -95,7 +95,7 @@ public class DataNodeSchemaCacheTest {
     otherMeasurements[1] = "s4";
     otherMeasurements[2] = "s5";
 
-    dataNodeSchemaCache.put(generateSchemaTree2());
+    dataNodeSchemaCache.put((ClusterSchemaTree) generateSchemaTree2());
 
     schemaCacheEntryMap =
         dataNodeSchemaCache.get(device1, otherMeasurements).getAllMeasurement().stream()
@@ -133,7 +133,7 @@ public class DataNodeSchemaCacheTest {
     Assert.assertNull(dataNodeSchemaCache.getLastCache(seriesPath2));
     Assert.assertNull(dataNodeSchemaCache.getLastCache(seriesPath3));
     // test no last cache
-    dataNodeSchemaCache.put(generateSchemaTree1());
+    dataNodeSchemaCache.put((ClusterSchemaTree) generateSchemaTree1());
     Assert.assertNull(dataNodeSchemaCache.getLastCache(seriesPath1));
     Assert.assertNull(dataNodeSchemaCache.getLastCache(seriesPath2));
     Assert.assertNull(dataNodeSchemaCache.getLastCache(seriesPath3));