You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2023/01/03 02:44:13 UTC

[GitHub] [iotdb] JackieTien97 commented on a diff in pull request #8650: [IOTDB-5308] Limit the output tsblock's size of each operator[Part1]

JackieTien97 commented on code in PR #8650:
URL: https://github.com/apache/iotdb/pull/8650#discussion_r1060251167


##########
server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/AlignedSeriesScanOperator.java:
##########
@@ -77,13 +84,35 @@ public OperatorContext getOperatorContext() {
 
   @Override
   public TsBlock next() {
-    TsBlock block = builder.build();
+    if (retainedTsBlock != null) {
+      return getResultTsBlock();
+    }
+    retainedTsBlock = builder.build();
     builder.reset();
-    return block;
+    return getResultTsBlock();
+  }
+
+  private TsBlock getResultTsBlock() {
+    long maxSizePerTsBlock = TSFileDescriptor.getInstance().getConfig().getMaxTsBlockSizeInBytes();
+    long length = maxSizePerTsBlock / (1 + seriesScanUtil.getAllSensorsSize());
+    TsBlock resultTsBlock;
+    if (retainedTsBlock.getPositionCount() - startOffset < length) {

Review Comment:
   same as above



##########
server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/join/TimeJoinOperator.java:
##########
@@ -197,14 +206,35 @@ public TsBlock next() {
     // update inputIndex using shadowInputIndex
     System.arraycopy(shadowInputIndex, 0, inputIndex, 0, inputOperatorsCount);
 
-    return tsBlockBuilder.build();
+    retainedTsBlock = tsBlockBuilder.build();
+    LOGGER.debug("Current tsBlock size is : {}", retainedTsBlock.getRetainedSizeInBytes());
+    return getResultTsBlock();
+  }
+
+  private TsBlock getResultTsBlock() {
+    long maxSizePerTsBlock = TSFileDescriptor.getInstance().getConfig().getMaxTsBlockSizeInBytes();
+    long maxLength = maxSizePerTsBlock / (1 + outputColumnCount);
+    TsBlock resultTsBlock;
+    if (retainedTsBlock.getPositionCount() - startOffset < maxLength) {

Review Comment:
   same as above



##########
server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/join/RowBasedTimeJoinOperator.java:
##########
@@ -198,14 +207,35 @@ public TsBlock next() {
       }
       tsBlockBuilder.declarePosition();
     } while (currentTime < currentEndTime && !timeSelector.isEmpty());
-    return tsBlockBuilder.build();
+    retainedTsBlock = tsBlockBuilder.build();
+    LOGGER.info("Current tsBlock size is : {}", retainedTsBlock.getRetainedSizeInBytes());
+    return getResultTsBlock();
+  }
+
+  private TsBlock getResultTsBlock() {
+    long maxSizePerTsBlock = TSFileDescriptor.getInstance().getConfig().getMaxTsBlockSizeInBytes();
+    long maxLength = maxSizePerTsBlock / (1 + outputColumnCount);
+    TsBlock resultTsBlock;
+    if (retainedTsBlock.getPositionCount() - retainedStartOffset < maxLength) {

Review Comment:
   maxLength is size in bytes, but `retainedTsBlock.getPositionCount() - retainedStartOffset` is line number, why comparing these two?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org