You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2023/03/27 01:58:18 UTC

[iotdb] 12/13: return tsblock only once

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

hui pushed a commit to branch lmh/fileScan
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 9630dee026c111c13200ed74dbf48dbdd01e5565
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Tue Mar 21 14:55:12 2023 +0800

    return tsblock only once
---
 .../mpp/execution/operator/source/FileAggregationScanOperator.java | 7 +++++--
 .../db/mpp/execution/operator/source/FileAggregationScanUtil.java  | 2 --
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/FileAggregationScanOperator.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/FileAggregationScanOperator.java
index 5250031f42..0f61f0656b 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/FileAggregationScanOperator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/FileAggregationScanOperator.java
@@ -76,10 +76,13 @@ public class FileAggregationScanOperator extends AbstractSourceOperator
 
   @Override
   public TsBlock next() throws Exception {
-    tsBlockBuilder.reset();
     try {
       aggregationScanUtil.consume();
-      return aggregationScanUtil.getAggregationResult(tsBlockBuilder);
+      if (aggregationScanUtil.hasNextFile()) {
+        return null;
+      } else {
+        return aggregationScanUtil.getAggregationResult(tsBlockBuilder);
+      }
     } catch (IOException e) {
       throw new RuntimeException("Error happened while scanning the file", e);
     }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/FileAggregationScanUtil.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/FileAggregationScanUtil.java
index e51fee215e..9267d68cb6 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/FileAggregationScanUtil.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/FileAggregationScanUtil.java
@@ -99,8 +99,6 @@ public class FileAggregationScanUtil {
   }
 
   public void consume() throws IOException {
-    pathToAggregatorMap.clear();
-
     TsFileResource nextFile = fileResourceMaterializer.next();
     TsFileSequenceReader reader =
         FileReaderManager.getInstance().get(nextFile.getTsFilePath(), nextFile.isClosed());