You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/11/28 06:15:26 UTC

[iotdb] branch QueryDataPartionOpt updated: Fix typo

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

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


The following commit(s) were added to refs/heads/QueryDataPartionOpt by this push:
     new 8cadab2f5f Fix typo
8cadab2f5f is described below

commit 8cadab2f5f6f0fb2259b08e66b0a60100acf04f0
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Mon Nov 28 14:15:18 2022 +0800

    Fix typo
---
 .../commons/partition/DataPartitionQueryParam.java | 24 ++++++++++++++++++++++
 .../mpp/plan/analyze/ClusterPartitionFetcher.java  | 16 ++++++++-------
 .../src/main/thrift/confignode.thrift              |  4 ++--
 3 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionQueryParam.java b/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionQueryParam.java
index 83a7cdeb2c..d8e148ed86 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionQueryParam.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionQueryParam.java
@@ -28,6 +28,14 @@ public class DataPartitionQueryParam {
   private String devicePath;
   private List<TTimePartitionSlot> timePartitionSlotList = new ArrayList<>();
 
+  // it will be set to true in query when there exist filter like: time <= XXX
+  // (-oo, timePartitionSlotList.get(0)]
+  private boolean needLeftAll = false;
+
+  // it will be set to true query when there exist filter like: time >= XXX
+  // [timePartitionSlotList.get(timePartitionSlotList.size() - 1), +oo)
+  private boolean needRightAll = false;
+
   public DataPartitionQueryParam(
       String devicePath, List<TTimePartitionSlot> timePartitionSlotList) {
     this.devicePath = devicePath;
@@ -51,4 +59,20 @@ public class DataPartitionQueryParam {
   public void setTimePartitionSlotList(List<TTimePartitionSlot> timePartitionSlotList) {
     this.timePartitionSlotList = timePartitionSlotList;
   }
+
+  public boolean isNeedLeftAll() {
+    return needLeftAll;
+  }
+
+  public void setNeedLeftAll(boolean needLeftAll) {
+    this.needLeftAll = needLeftAll;
+  }
+
+  public boolean isNeedRightAll() {
+    return needRightAll;
+  }
+
+  public void setNeedRightAll(boolean needRightAll) {
+    this.needRightAll = needRightAll;
+  }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java
index 089a661ac8..94c1039428 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java
@@ -37,6 +37,7 @@ import org.apache.iotdb.confignode.rpc.thrift.TSchemaNodeManagementReq;
 import org.apache.iotdb.confignode.rpc.thrift.TSchemaNodeManagementResp;
 import org.apache.iotdb.confignode.rpc.thrift.TSchemaPartitionReq;
 import org.apache.iotdb.confignode.rpc.thrift.TSchemaPartitionTableResp;
+import org.apache.iotdb.confignode.rpc.thrift.TTimePartionSlotList;
 import org.apache.iotdb.db.client.ConfigNodeClient;
 import org.apache.iotdb.db.client.ConfigNodeInfo;
 import org.apache.iotdb.db.client.DataNodeClientPoolFactory;
@@ -59,7 +60,6 @@ import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 public class ClusterPartitionFetcher implements IPartitionFetcher {
   private static final Logger logger = LoggerFactory.getLogger(ClusterPartitionFetcher.class);
@@ -323,19 +323,21 @@ public class ClusterPartitionFetcher implements IPartitionFetcher {
 
   private TDataPartitionReq constructDataPartitionReq(
       Map<String, List<DataPartitionQueryParam>> sgNameToQueryParamsMap) {
-    Map<String, Map<TSeriesPartitionSlot, List<TTimePartitionSlot>>> partitionSlotsMap =
+    Map<String, Map<TSeriesPartitionSlot, TTimePartionSlotList>> partitionSlotsMap =
         new HashMap<>();
     for (Map.Entry<String, List<DataPartitionQueryParam>> entry :
         sgNameToQueryParamsMap.entrySet()) {
       // for each sg
-      Map<TSeriesPartitionSlot, List<TTimePartitionSlot>> deviceToTimePartitionMap =
-          new HashMap<>();
+      Map<TSeriesPartitionSlot, TTimePartionSlotList> deviceToTimePartitionMap = new HashMap<>();
       for (DataPartitionQueryParam queryParam : entry.getValue()) {
+        TTimePartionSlotList timePartitionSlotList =
+            new TTimePartionSlotList(
+                queryParam.getTimePartitionSlotList(),
+                queryParam.isNeedLeftAll(),
+                queryParam.isNeedRightAll());
         deviceToTimePartitionMap.put(
             partitionExecutor.getSeriesPartitionSlot(queryParam.getDevicePath()),
-            queryParam.getTimePartitionSlotList().stream()
-                .map(timePartitionSlot -> new TTimePartitionSlot(timePartitionSlot.getStartTime()))
-                .collect(Collectors.toList()));
+            timePartitionSlotList);
       }
       partitionSlotsMap.put(entry.getKey(), deviceToTimePartitionMap);
     }
diff --git a/thrift-confignode/src/main/thrift/confignode.thrift b/thrift-confignode/src/main/thrift/confignode.thrift
index d4723d857d..bb6303cba9 100644
--- a/thrift-confignode/src/main/thrift/confignode.thrift
+++ b/thrift-confignode/src/main/thrift/confignode.thrift
@@ -198,7 +198,7 @@ struct TSchemaNodeManagementResp {
   3: optional set<common.TSchemaNode> matchedNode
 }
 
-struct TTimePartionSlotList {
+struct TTimePartitionSlotList {
   1: required list<common.TTimePartitionSlot> timePartitionSlots
   2: required bool needLeftAll
   3: required bool needRightAll
@@ -207,7 +207,7 @@ struct TTimePartionSlotList {
 // Data
 struct TDataPartitionReq {
   // map<StorageGroupName, map<TSeriesPartitionSlot, TTimePartionSlotList>>
-  1: required map<string, map<common.TSeriesPartitionSlot, TTimePartionSlotList>> partitionSlotsMap
+  1: required map<string, map<common.TSeriesPartitionSlot, TTimePartitionSlotList>> partitionSlotsMap
 }
 
 struct TDataPartitionTableResp {