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

rong pushed a commit to branch 1.1-load-tsfile-cp
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 50bcff6dd8d4eb715ffbd155e63bd98b10d46771
Author: yschengzi <[email protected]>
AuthorDate: Tue Jun 20 22:13:46 2023 +0800

    [IOTDB-6015] Pipe: Not checking whether the tsfile data loaded locally is 
in the same time partition during the loading process (#10249)
    
    When determining whether a tsfile should be loaded locally without 
splitting, you should also check that all the data in this tsfile is in the 
same dataregion and the same time division, without previously checking the 
latter
    
    (cherry picked from commit 56faa8ef61b2cae499d1ef42fe994a8c4c9bc9c2)
---
 .../plan/planner/plan/node/load/LoadSingleTsFileNode.java    | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/load/LoadSingleTsFileNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/load/LoadSingleTsFileNode.java
index d68184b04d3..18627c7be19 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/load/LoadSingleTsFileNode.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/load/LoadSingleTsFileNode.java
@@ -86,7 +86,17 @@ public class LoadSingleTsFileNode extends WritePlanNode {
               slotList.add(
                   new Pair<>(o, 
TimePartitionUtils.getTimePartition(resource.getEndTime(o))));
             });
-    needDecodeTsFile = !isDispatchedToLocal(new 
HashSet<>(partitionFetcher.apply(slotList)));
+
+    if (slotList.isEmpty()) {
+      throw new IllegalStateException(
+          String.format("Devices in TsFile %s is empty, this should not happen 
here.", tsFile));
+    } else if (slotList.stream()
+        .anyMatch(slotPair -> 
!slotPair.getRight().equals(slotList.get(0).right))) {
+      needDecodeTsFile = true;
+    } else {
+      needDecodeTsFile = !isDispatchedToLocal(new 
HashSet<>(partitionFetcher.apply(slotList)));
+    }
+
     if (!needDecodeTsFile && !resource.resourceFileExists()) {
       resource.serialize();
     }

Reply via email to