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 2022/04/15 01:37:47 UTC

[iotdb] branch iotdb-2924 created (now 625ff447b1)

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

rong pushed a change to branch iotdb-2924
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 625ff447b1 [IOTDB-2924] UDF Framework: index overflow while iterating sliding windows

This branch includes the following new commits:

     new 625ff447b1 [IOTDB-2924] UDF Framework: index overflow while iterating sliding windows

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: [IOTDB-2924] UDF Framework: index overflow while iterating sliding windows

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 625ff447b105f384c3ca268bb838320bc7c28be7
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Fri Apr 15 09:37:20 2022 +0800

    [IOTDB-2924] UDF Framework: index overflow while iterating sliding windows
---
 .../udf/core/layer/MultiInputColumnIntermediateLayer.java  | 14 ++++++++++++++
 .../SingleInputColumnMultiReferenceIntermediateLayer.java  | 14 ++++++++++++++
 .../SingleInputColumnSingleReferenceIntermediateLayer.java | 14 ++++++++++++++
 3 files changed, 42 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/MultiInputColumnIntermediateLayer.java b/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/MultiInputColumnIntermediateLayer.java
index 505367215f..843bd85504 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/MultiInputColumnIntermediateLayer.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/MultiInputColumnIntermediateLayer.java
@@ -36,6 +36,9 @@ import org.apache.iotdb.db.utils.datastructure.TimeSelector;
 import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
@@ -43,6 +46,9 @@ import java.util.List;
 public class MultiInputColumnIntermediateLayer extends IntermediateLayer
     implements IUDFInputDataSet {
 
+  private static final Logger LOGGER =
+      LoggerFactory.getLogger(MultiInputColumnIntermediateLayer.class);
+
   private final LayerPointReader[] layerPointReaders;
   private final TSDataType[] dataTypes;
   private final TimeSelector timeHeap;
@@ -226,6 +232,14 @@ public class MultiInputColumnIntermediateLayer extends IntermediateLayer
 
         beginIndex += slidingStep;
         int endIndex = beginIndex + windowSize;
+        if (beginIndex < 0 || endIndex < 0) {
+          LOGGER.warn(
+              "MultiInputColumnIntermediateLayer$LayerRowWindowReader: index overflow. beginIndex: {}, endIndex: {}, windowSize: {}.",
+              beginIndex,
+              endIndex,
+              windowSize);
+          return false;
+        }
 
         int rowsToBeCollected = endIndex - rowRecordList.size();
         if (0 < rowsToBeCollected) {
diff --git a/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/SingleInputColumnMultiReferenceIntermediateLayer.java b/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/SingleInputColumnMultiReferenceIntermediateLayer.java
index eb8f10f1eb..c1359d5771 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/SingleInputColumnMultiReferenceIntermediateLayer.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/SingleInputColumnMultiReferenceIntermediateLayer.java
@@ -35,10 +35,16 @@ import org.apache.iotdb.db.query.udf.datastructure.tv.ElasticSerializableTVList;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.utils.Binary;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.IOException;
 
 public class SingleInputColumnMultiReferenceIntermediateLayer extends IntermediateLayer {
 
+  private static final Logger LOGGER =
+      LoggerFactory.getLogger(SingleInputColumnMultiReferenceIntermediateLayer.class);
+
   private final LayerPointReader parentLayerPointReader;
   private final TSDataType dataType;
   private final ElasticSerializableTVList tvList;
@@ -220,6 +226,14 @@ public class SingleInputColumnMultiReferenceIntermediateLayer extends Intermedia
 
         beginIndex += slidingStep;
         int endIndex = beginIndex + windowSize;
+        if (beginIndex < 0 || endIndex < 0) {
+          LOGGER.warn(
+              "SingleInputColumnMultiReferenceIntermediateLayer$LayerRowWindowReader: index overflow. beginIndex: {}, endIndex: {}, windowSize: {}.",
+              beginIndex,
+              endIndex,
+              windowSize);
+          return false;
+        }
 
         int pointsToBeCollected = endIndex - tvList.size();
         if (0 < pointsToBeCollected) {
diff --git a/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/SingleInputColumnSingleReferenceIntermediateLayer.java b/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/SingleInputColumnSingleReferenceIntermediateLayer.java
index 7a8822da26..29549ccdd0 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/SingleInputColumnSingleReferenceIntermediateLayer.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/udf/core/layer/SingleInputColumnSingleReferenceIntermediateLayer.java
@@ -33,10 +33,16 @@ import org.apache.iotdb.db.query.udf.core.reader.LayerRowWindowReader;
 import org.apache.iotdb.db.query.udf.datastructure.tv.ElasticSerializableTVList;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.IOException;
 
 public class SingleInputColumnSingleReferenceIntermediateLayer extends IntermediateLayer {
 
+  private static final Logger LOGGER =
+      LoggerFactory.getLogger(SingleInputColumnSingleReferenceIntermediateLayer.class);
+
   private final LayerPointReader parentLayerPointReader;
   private final TSDataType dataType;
 
@@ -132,6 +138,14 @@ public class SingleInputColumnSingleReferenceIntermediateLayer extends Intermedi
 
         beginIndex += slidingStep;
         int endIndex = beginIndex + windowSize;
+        if (beginIndex < 0 || endIndex < 0) {
+          LOGGER.warn(
+              "SingleInputColumnSingleReferenceIntermediateLayer$LayerRowWindowReader: index overflow. beginIndex: {}, endIndex: {}, windowSize: {}.",
+              beginIndex,
+              endIndex,
+              windowSize);
+          return false;
+        }
 
         int pointsToBeCollected = endIndex - tvList.size();
         if (0 < pointsToBeCollected) {