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

jackietien 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 e085250  [IOTDB-1990] Fix uncheck null result by calling 
IReaderByTimestamp.getValuesInTimestamps() (#4358)
e085250 is described below

commit e08525072a88e6a99ee2026352fb133f40e7c3ee
Author: BaiJian <[email protected]>
AuthorDate: Fri Nov 12 12:08:26 2021 +0800

    [IOTDB-1990] Fix uncheck null result by calling 
IReaderByTimestamp.getValuesInTimestamps() (#4358)
---
 .../org/apache/iotdb/cluster/query/fill/ClusterFillExecutor.java    | 2 +-
 .../iotdb/db/query/dataset/RawQueryDataSetWithValueFilter.java      | 4 ++--
 .../org/apache/iotdb/db/query/executor/AggregationExecutor.java     | 6 ++++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/cluster/src/main/java/org/apache/iotdb/cluster/query/fill/ClusterFillExecutor.java
 
b/cluster/src/main/java/org/apache/iotdb/cluster/query/fill/ClusterFillExecutor.java
index 8315dd5..7fd7a3b 100644
--- 
a/cluster/src/main/java/org/apache/iotdb/cluster/query/fill/ClusterFillExecutor.java
+++ 
b/cluster/src/main/java/org/apache/iotdb/cluster/query/fill/ClusterFillExecutor.java
@@ -91,7 +91,7 @@ public class ClusterFillExecutor extends FillQueryExecutor {
               null);
 
       Object[] results = reader.getValuesInTimestamps(new long[] {queryTime}, 
1);
-      if (results[0] != null) {
+      if (results != null && results[0] != null) {
         ret.add(new TimeValuePair(queryTime, 
TsPrimitiveType.getByType(dataType, results[0])));
       } else {
         ret.add(null);
diff --git 
a/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithValueFilter.java
 
b/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithValueFilter.java
index 88c78ee..8289683 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithValueFilter.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithValueFilter.java
@@ -118,7 +118,7 @@ public class RawQueryDataSetWithValueFilter extends 
QueryDataSet implements UDFI
 
       // 3. use values in results to fill row record
       for (int j = 0; j < cachedTimeCnt; j++) {
-        if (results[j] == null) {
+        if (results == null || results[j] == null) {
           rowRecords[j].addField(null);
         } else {
           hasField[j] = true;
@@ -199,7 +199,7 @@ public class RawQueryDataSetWithValueFilter extends 
QueryDataSet implements UDFI
 
       // 3. use values in results to fill row record
       for (int j = 0; j < cachedTimeCnt; j++) {
-        if (results[j] != null) {
+        if (results != null && results[j] != null) {
           hasField[j] = true;
           rowsInObject[j][i] = results[j];
         }
diff --git 
a/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
 
b/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
index 1aec31e..2c519f8 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
@@ -677,8 +677,10 @@ public class AggregationExecutor {
                 timeArray, timeArrayLength, entry.getKey());
           } else {
             Object[] values = entry.getKey().getValuesInTimestamps(timeArray, 
timeArrayLength);
-            for (Integer i : entry.getValue()) {
-              aggregateResultList[i].updateResultUsingValues(timeArray, 
timeArrayLength, values);
+            if (values != null) {
+              for (Integer i : entry.getValue()) {
+                aggregateResultList[i].updateResultUsingValues(timeArray, 
timeArrayLength, values);
+              }
             }
           }
         }

Reply via email to