You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/08/17 05:50:58 UTC

[iotdb] branch master updated: [IOTDB-4151] Fix IndexOutOfBound Error in last query

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 545a34341d [IOTDB-4151] Fix IndexOutOfBound Error in last query
545a34341d is described below

commit 545a34341d32c5b9e6846529794121c2fcd0da98
Author: Jackie Tien <ja...@gmail.com>
AuthorDate: Wed Aug 17 13:50:52 2022 +0800

    [IOTDB-4151] Fix IndexOutOfBound Error in last query
---
 .../org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java
index 5c4570a1fe..214d024741 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java
@@ -1586,9 +1586,11 @@ public class OperatorTreeGenerator extends PlanVisitor<Operator, LocalExecutionP
                 node.getPlanNodeId(),
                 TimeJoinOperator.class.getSimpleName());
 
-    SortItem item = node.getMergeOrderParameter().getSortItemList().get(0);
+    List<SortItem> items = node.getMergeOrderParameter().getSortItemList();
     Comparator<Binary> comparator =
-        item.getOrdering() == Ordering.ASC ? ASC_BINARY_COMPARATOR : DESC_BINARY_COMPARATOR;
+        (items.isEmpty() || items.get(0).getOrdering() == Ordering.ASC)
+            ? ASC_BINARY_COMPARATOR
+            : DESC_BINARY_COMPARATOR;
 
     context.getTimeSliceAllocator().recordExecutionWeight(operatorContext, 1);
     return new LastQueryMergeOperator(operatorContext, children, comparator);