You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by zy...@apache.org on 2022/11/18 09:09:37 UTC

[iotdb] branch master updated: Fix multi timeseries creation split bug (#8043)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 10d054e9b0 Fix multi timeseries creation split bug (#8043)
10d054e9b0 is described below

commit 10d054e9b018cf7a6e6f2c9ffb2466bc52a6fd13
Author: Marcos_Zyk <38...@users.noreply.github.com>
AuthorDate: Fri Nov 18 17:09:31 2022 +0800

    Fix multi timeseries creation split bug (#8043)
    
    Fix multi timeseries split bug (#8043)
---
 .../plan/planner/plan/node/metedata/write/MeasurementGroup.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/metedata/write/MeasurementGroup.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/metedata/write/MeasurementGroup.java
index 5d2dda5704..3084844ab2 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/metedata/write/MeasurementGroup.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/metedata/write/MeasurementGroup.java
@@ -196,16 +196,17 @@ public class MeasurementGroup {
 
   public List<MeasurementGroup> split(int targetSize) {
     int totalSize = measurements.size();
-    int num = totalSize / targetSize + (totalSize % targetSize == 0 ? 0 : 1);
-    List<MeasurementGroup> result = new ArrayList<>(num);
+    int fullGroupNum = totalSize / targetSize;
+    int restSize = totalSize % targetSize;
+    List<MeasurementGroup> result = new ArrayList<>(fullGroupNum + (restSize == 0 ? 0 : 1));
     if (totalSize <= targetSize) {
       result.add(this);
       return result;
     }
-    for (int i = 0; i < num - 1; i++) {
+    for (int i = 0; i < fullGroupNum; i++) {
       result.add(getSubMeasurementGroup(i * targetSize, i * targetSize + targetSize));
     }
-    int restSize = totalSize % targetSize;
+
     if (restSize != 0) {
       result.add(getSubMeasurementGroup(totalSize - restSize, totalSize));
     }