You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2021/10/18 02:31:09 UTC

[iotdb] branch remove_countplan_for_executeNonQuery created (now 50ea423)

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

tanxinyu pushed a change to branch remove_countplan_for_executeNonQuery
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at 50ea423  remove

This branch includes the following new commits:

     new 50ea423  remove

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[iotdb] 01/01: remove

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tanxinyu pushed a commit to branch remove_countplan_for_executeNonQuery
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 50ea423c6a8bd43d5fce16ee02336d4c1ffb1eb5
Author: LebronAl <TX...@gmail.com>
AuthorDate: Mon Oct 18 10:30:22 2021 +0800

    remove
---
 .../iotdb/cluster/query/ClusterPlanRouter.java     | 50 ----------------------
 .../cluster/partition/SlotPartitionTableTest.java  | 37 ----------------
 2 files changed, 87 deletions(-)

diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/query/ClusterPlanRouter.java b/cluster/src/main/java/org/apache/iotdb/cluster/query/ClusterPlanRouter.java
index bdbb9d3..598046a 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/query/ClusterPlanRouter.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/query/ClusterPlanRouter.java
@@ -30,7 +30,6 @@ import org.apache.iotdb.cluster.rpc.thrift.Node;
 import org.apache.iotdb.cluster.utils.PartitionUtils;
 import org.apache.iotdb.db.engine.StorageEngine;
 import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
 import org.apache.iotdb.db.metadata.MManager;
 import org.apache.iotdb.db.metadata.PartialPath;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
@@ -40,13 +39,11 @@ import org.apache.iotdb.db.qp.physical.crud.InsertRowsOfOneDevicePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowsPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
 import org.apache.iotdb.db.qp.physical.sys.AlterTimeSeriesPlan;
-import org.apache.iotdb.db.qp.physical.sys.CountPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateMultiTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.LogPlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowChildPathsPlan;
-import org.apache.iotdb.db.qp.physical.sys.ShowPlan.ShowContentType;
 import org.apache.iotdb.db.service.IoTDB;
 import org.apache.iotdb.db.utils.TestOnly;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
@@ -127,8 +124,6 @@ public class ClusterPlanRouter {
       return splitAndRoutePlan((InsertTabletPlan) plan);
     } else if (plan instanceof InsertMultiTabletPlan) {
       return splitAndRoutePlan((InsertMultiTabletPlan) plan);
-    } else if (plan instanceof CountPlan) {
-      return splitAndRoutePlan((CountPlan) plan);
     } else if (plan instanceof CreateTimeSeriesPlan) {
       return splitAndRoutePlan((CreateTimeSeriesPlan) plan);
     } else if (plan instanceof CreateAlignedTimeSeriesPlan) {
@@ -410,51 +405,6 @@ public class ClusterPlanRouter {
     return bitMaps;
   }
 
-  private Map<PhysicalPlan, PartitionGroup> splitAndRoutePlan(CountPlan plan)
-      throws MetadataException {
-    // CountPlan is quite special because it has the behavior of wildcard at the tail of the path
-    // even though there is no wildcard
-    Map<String, String> sgPathMap = getMManager().groupPathByStorageGroup(plan.getPath());
-    if (sgPathMap.isEmpty()) {
-      throw new StorageGroupNotSetException(plan.getPath().getFullPath());
-    }
-    Map<PhysicalPlan, PartitionGroup> result = new HashMap<>();
-    if (plan.getShowContentType().equals(ShowContentType.COUNT_TIMESERIES)) {
-      // support wildcard
-      for (Map.Entry<String, String> entry : sgPathMap.entrySet()) {
-        CountPlan plan1 =
-            new CountPlan(
-                ShowContentType.COUNT_TIMESERIES,
-                new PartialPath(entry.getValue()),
-                plan.getLevel());
-        result.put(plan1, partitionTable.route(entry.getKey(), 0));
-      }
-    } else {
-      // do not support wildcard
-      if (sgPathMap.size() == 1) {
-        // the path of the original plan has only one SG, or there is only one SG in the system.
-        for (Map.Entry<String, String> entry : sgPathMap.entrySet()) {
-          // actually, there is only one entry
-          result.put(plan, partitionTable.route(entry.getKey(), 0));
-        }
-      } else {
-        // the path of the original plan contains more than one SG, and we added a wildcard at the
-        // tail.
-        // we have to remove it.
-        for (Map.Entry<String, String> entry : sgPathMap.entrySet()) {
-          CountPlan plan1 =
-              new CountPlan(
-                  ShowContentType.COUNT_TIMESERIES,
-                  new PartialPath(
-                      entry.getValue().substring(0, entry.getValue().lastIndexOf(".*"))),
-                  plan.getLevel());
-          result.put(plan1, partitionTable.route(entry.getKey(), 0));
-        }
-      }
-    }
-    return result;
-  }
-
   private Map<PhysicalPlan, PartitionGroup> splitAndRoutePlan(CreateMultiTimeSeriesPlan plan)
       throws MetadataException {
     Map<PhysicalPlan, PartitionGroup> result = new HashMap<>();
diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/partition/SlotPartitionTableTest.java b/cluster/src/test/java/org/apache/iotdb/cluster/partition/SlotPartitionTableTest.java
index 510e6bc..04ff3d9 100644
--- a/cluster/src/test/java/org/apache/iotdb/cluster/partition/SlotPartitionTableTest.java
+++ b/cluster/src/test/java/org/apache/iotdb/cluster/partition/SlotPartitionTableTest.java
@@ -42,7 +42,6 @@ import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
 import org.apache.iotdb.db.qp.physical.sys.AuthorPlan;
-import org.apache.iotdb.db.qp.physical.sys.CountPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.DataAuthPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteStorageGroupPlan;
@@ -493,42 +492,6 @@ public class SlotPartitionTableTest {
   }
 
   // @Test
-  public void testCountPlan() throws IllegalPathException {
-    PhysicalPlan countPlan1 =
-        new CountPlan(
-            ShowContentType.COUNT_TIMESERIES, new PartialPath("root.sg.*.l3" + ".l4.28.*"));
-    PhysicalPlan countPlan2 =
-        new CountPlan(ShowContentType.COUNT_TIMESERIES, new PartialPath("root.sg.*.l3" + ".*"));
-    PhysicalPlan countPlan3 =
-        new CountPlan(
-            ShowContentType.COUNT_NODE_TIMESERIES, new PartialPath("root.sg" + ".l2.l3.l4.28"));
-    PhysicalPlan countPlan4 =
-        new CountPlan(
-            ShowContentType.COUNT_NODE_TIMESERIES, new PartialPath("root.sg" + ".l2.l3"), 6);
-    PhysicalPlan countPlan5 =
-        new CountPlan(ShowContentType.COUNT_NODES, new PartialPath("root.sg.l2.l3"), 5);
-    try {
-      ClusterPlanRouter router = new ClusterPlanRouter(localTable);
-      assertTrue(countPlan1.canBeSplit());
-      Map<PhysicalPlan, PartitionGroup> result1 = router.splitAndRoutePlan(countPlan1);
-      assertEquals(1, result1.size());
-      Map<PhysicalPlan, PartitionGroup> result2 = router.splitAndRoutePlan(countPlan2);
-      assertEquals(40, result2.size());
-      Map<PhysicalPlan, PartitionGroup> result3 = router.splitAndRoutePlan(countPlan3);
-      assertEquals(1, result3.size());
-      Map<PhysicalPlan, PartitionGroup> result4 = router.splitAndRoutePlan(countPlan4);
-      // TODO this case can be optimized
-      assertEquals(40, result4.size());
-      Map<PhysicalPlan, PartitionGroup> result5 = router.splitAndRoutePlan(countPlan5);
-      // TODO this case can be optimized
-      assertEquals(40, result5.size());
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  // @Test
   public void testShowChildPathsPlan() throws IllegalPathException {
     PhysicalPlan showChildPathsPlan1 =
         new ShowChildPathsPlan(ShowContentType.CHILD_PATH, new PartialPath("root.sg.l2.l3.l4.28"));