You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2024/10/12 04:38:48 UTC

(iotdb) branch master updated: Pipe: fetch isAligned info from TsFileInsertionScanDataContainer when constructing converted tablet insertion stmt (#13724)

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

rong 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 4c42e9b49fa Pipe: fetch isAligned info from TsFileInsertionScanDataContainer when constructing converted tablet insertion stmt (#13724)
4c42e9b49fa is described below

commit 4c42e9b49fafb8822269a6be36ea07443257d99b
Author: V_Galaxy <vg...@apache.org>
AuthorDate: Sat Oct 12 12:38:42 2024 +0800

    Pipe: fetch isAligned info from TsFileInsertionScanDataContainer when constructing converted tablet insertion stmt (#13724)
---
 .../common/tsfile/parser/scan/TsFileInsertionEventScanParser.java | 8 ++++----
 .../visitor/PipeStatementDataTypeConvertExecutionVisitor.java     | 6 ++++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/scan/TsFileInsertionEventScanParser.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/scan/TsFileInsertionEventScanParser.java
index c93dfc479de..ef97ea1a9a1 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/scan/TsFileInsertionEventScanParser.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/scan/TsFileInsertionEventScanParser.java
@@ -151,16 +151,16 @@ public class TsFileInsertionEventScanParser extends TsFileInsertionEventParser {
         };
   }
 
-  public Iterable<Tablet> toTablets() {
+  public Iterable<Pair<Tablet, Boolean>> toTabletWithIsAligneds() {
     return () ->
-        new Iterator<Tablet>() {
+        new Iterator<Pair<Tablet, Boolean>>() {
           @Override
           public boolean hasNext() {
             return Objects.nonNull(chunkReader);
           }
 
           @Override
-          public Tablet next() {
+          public Pair<Tablet, Boolean> next() {
             if (!hasNext()) {
               close();
               throw new NoSuchElementException();
@@ -169,7 +169,7 @@ public class TsFileInsertionEventScanParser extends TsFileInsertionEventParser {
             final Tablet tablet = getNextTablet();
             final boolean hasNext = hasNext();
             try {
-              return tablet;
+              return new Pair<>(tablet, currentIsAligned);
             } finally {
               if (!hasNext) {
                 close();
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipeStatementDataTypeConvertExecutionVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipeStatementDataTypeConvertExecutionVisitor.java
index 02fe45e01f1..0e6696ec2f2 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipeStatementDataTypeConvertExecutionVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipeStatementDataTypeConvertExecutionVisitor.java
@@ -37,6 +37,7 @@ import org.apache.iotdb.db.queryengine.plan.statement.crud.LoadTsFileStatement;
 import org.apache.iotdb.rpc.TSStatusCode;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.tsfile.utils.Pair;
 import org.apache.tsfile.write.record.Tablet;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -98,10 +99,11 @@ public class PipeStatementDataTypeConvertExecutionVisitor
       try (final TsFileInsertionEventScanParser container =
           new TsFileInsertionEventScanParser(
               file, new IoTDBTreePattern(null), Long.MIN_VALUE, Long.MAX_VALUE, null, null)) {
-        for (final Tablet tablet : container.toTablets()) {
+        for (final Pair<Tablet, Boolean> tabletWithIsAligned : container.toTabletWithIsAligneds()) {
           final PipeConvertedInsertTabletStatement statement =
               new PipeConvertedInsertTabletStatement(
-                  PipeTransferTabletRawReq.toTPipeTransferRawReq(tablet, false)
+                  PipeTransferTabletRawReq.toTPipeTransferRawReq(
+                          tabletWithIsAligned.getLeft(), tabletWithIsAligned.getRight())
                       .constructStatement());
           TSStatus result = statementExecutor.execute(statement);