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

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

commit d9fe659e0cd007f5f00f6960194b26b0aaa54d67
Author: Jinrui.Zhang <[email protected]>
AuthorDate: Wed Apr 13 22:54:13 2022 +0800

    spotless
---
 .../apache/iotdb/commons/partition/DataPartition.java   | 17 +++++++++++++----
 .../thrift/impl/DataNodeManagementServiceImpl.java      |  4 ----
 .../iotdb/db/mpp/sql/plan/DistributionPlannerTest.java  |  4 ++--
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git 
a/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java
 
b/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java
index f352d7cdeb..054c01b471 100644
--- 
a/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java
+++ 
b/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java
@@ -70,8 +70,12 @@ public class DataPartition {
     // TODO return the latest dataRegionReplicaSet for each time partition
     String storageGroup = getStorageGroupByDevice(deviceName);
     SeriesPartitionSlot seriesPartitionSlot = 
calculateDeviceGroupId(deviceName);
-    // IMPORTANT TODO: (xingtanzjr) need to handle the situation for write 
operation that there are more than 1 Regions for one timeSlot
-    return 
dataPartitionMap.get(storageGroup).get(seriesPartitionSlot).entrySet().stream().filter(entry
 -> timePartitionSlotList.contains(entry.getKey())).flatMap(entry -> 
entry.getValue().stream()).collect(Collectors.toList());
+    // IMPORTANT TODO: (xingtanzjr) need to handle the situation for write 
operation that there are
+    // more than 1 Regions for one timeSlot
+    return 
dataPartitionMap.get(storageGroup).get(seriesPartitionSlot).entrySet().stream()
+        .filter(entry -> timePartitionSlotList.contains(entry.getKey()))
+        .flatMap(entry -> entry.getValue().stream())
+        .collect(Collectors.toList());
   }
 
   public RegionReplicaSet getDataRegionReplicaSetForWriting(
@@ -81,8 +85,13 @@ public class DataPartition {
     // TODO return the latest dataRegionReplicaSet for each time partition
     String storageGroup = getStorageGroupByDevice(deviceName);
     SeriesPartitionSlot seriesPartitionSlot = 
calculateDeviceGroupId(deviceName);
-    List<RegionReplicaSet> regions = 
dataPartitionMap.get(storageGroup).get(seriesPartitionSlot).entrySet().stream().filter(entry
 -> entry.getKey().equals(timePartitionSlot)).flatMap(entry -> 
entry.getValue().stream()).collect(Collectors.toList());
-    // IMPORTANT TODO: (xingtanzjr) need to handle the situation for write 
operation that there are more than 1 Regions for one timeSlot
+    List<RegionReplicaSet> regions =
+        
dataPartitionMap.get(storageGroup).get(seriesPartitionSlot).entrySet().stream()
+            .filter(entry -> entry.getKey().equals(timePartitionSlot))
+            .flatMap(entry -> entry.getValue().stream())
+            .collect(Collectors.toList());
+    // IMPORTANT TODO: (xingtanzjr) need to handle the situation for write 
operation that there are
+    // more than 1 Regions for one timeSlot
     return regions.get(0);
   }
 
diff --git 
a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeManagementServiceImpl.java
 
b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeManagementServiceImpl.java
index 4976369443..e23140f39d 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeManagementServiceImpl.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeManagementServiceImpl.java
@@ -127,10 +127,6 @@ public class DataNodeManagementServiceImpl implements 
ManagementIService.Iface {
       tsStatus = new 
TSStatus(TSStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
       tsStatus.setMessage(
           String.format("Create Data Region failed because of %s", 
e1.getMessage()));
-    } catch (IOException e2) {
-      LOGGER.error("Can't deserialize regionId", e2);
-      tsStatus = new 
TSStatus(TSStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
-      tsStatus.setMessage(String.format("Can't deserialize regionId %s", e2));
     }
     return tsStatus;
   }
diff --git 
a/server/src/test/java/org/apache/iotdb/db/mpp/sql/plan/DistributionPlannerTest.java
 
b/server/src/test/java/org/apache/iotdb/db/mpp/sql/plan/DistributionPlannerTest.java
index b4b77956f7..41813bd337 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/mpp/sql/plan/DistributionPlannerTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/mpp/sql/plan/DistributionPlannerTest.java
@@ -292,7 +292,7 @@ public class DistributionPlannerTest {
             new PartialPath("root.sg.d1"),
             false,
             new MeasurementSchema[] {
-                new MeasurementSchema("s1", TSDataType.INT32),
+              new MeasurementSchema("s1", TSDataType.INT32),
             },
             new TSDataType[] {TSDataType.INT32},
             1L,
@@ -304,7 +304,7 @@ public class DistributionPlannerTest {
             new PartialPath("root.sg.d1"),
             false,
             new MeasurementSchema[] {
-                new MeasurementSchema("s1", TSDataType.INT32),
+              new MeasurementSchema("s1", TSDataType.INT32),
             },
             new TSDataType[] {TSDataType.INT32},
             100000L,

Reply via email to