You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by li...@apache.org on 2020/08/24 02:17:11 UTC

[incubator-iotdb] branch reverse_reader updated: fix nullpointer bug

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

liudw pushed a commit to branch reverse_reader
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/reverse_reader by this push:
     new 1b05644  fix nullpointer bug
1b05644 is described below

commit 1b0564479efe4002f9e178dc6baf1aaca2105a9b
Author: liudw <li...@apache.org>
AuthorDate: Mon Aug 24 10:16:26 2020 +0800

    fix nullpointer bug
---
 .../apache/iotdb/db/query/reader/universal/PriorityMergeReader.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/query/reader/universal/PriorityMergeReader.java b/server/src/main/java/org/apache/iotdb/db/query/reader/universal/PriorityMergeReader.java
index 53b477e..e4b707b 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/reader/universal/PriorityMergeReader.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/reader/universal/PriorityMergeReader.java
@@ -45,6 +45,11 @@ public class PriorityMergeReader implements IPointReader {
 
   public PriorityMergeReader(List<IPointReader> prioritySeriesReaders, int startPriority)
       throws IOException {
+    heap = new PriorityQueue<>((o1, o2) -> {
+      int timeCompare = Long.compare(o1.timeValuePair.getTimestamp(),
+          o2.timeValuePair.getTimestamp());
+      return timeCompare != 0 ? timeCompare : Long.compare(o2.priority, o1.priority);
+    });
     for (IPointReader reader : prioritySeriesReaders) {
       addReader(reader, startPriority++);
     }