Skip to content

Commit 545a343

Browse files
authored
[IOTDB-4151] Fix IndexOutOfBound Error in last query
1 parent 1cfb04b commit 545a343

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,9 +1586,11 @@ public Operator visitLastQueryMerge(LastQueryMergeNode node, LocalExecutionPlanC
15861586
node.getPlanNodeId(),
15871587
TimeJoinOperator.class.getSimpleName());
15881588

1589-
SortItem item = node.getMergeOrderParameter().getSortItemList().get(0);
1589+
List<SortItem> items = node.getMergeOrderParameter().getSortItemList();
15901590
Comparator<Binary> comparator =
1591-
item.getOrdering() == Ordering.ASC ? ASC_BINARY_COMPARATOR : DESC_BINARY_COMPARATOR;
1591+
(items.isEmpty() || items.get(0).getOrdering() == Ordering.ASC)
1592+
? ASC_BINARY_COMPARATOR
1593+
: DESC_BINARY_COMPARATOR;
15921594

15931595
context.getTimeSliceAllocator().recordExecutionWeight(operatorContext, 1);
15941596
return new LastQueryMergeOperator(operatorContext, children, comparator);

0 commit comments

Comments
 (0)