siddharthteotia commented on code in PR #10241:
URL: https://github.com/apache/pinot/pull/10241#discussion_r1099367353


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/SortOperator.java:
##########
@@ -70,8 +72,13 @@ public SortOperator(MultiStageOperator upstreamOperator, 
List<RexExpression> col
     _upstreamErrorBlock = null;
     _isSortedBlockConstructed = false;
     _numRowsToKeep = _fetch > 0 ? _fetch + _offset : defaultHolderCapacity;
-    _rows = new PriorityQueue<>(_numRowsToKeep,
-        new SortComparator(collationKeys, collationDirections, dataSchema, 
false));
+    if (collationKeys.isEmpty()) {
+      _priorityQueue = null;
+    } else {
+      _priorityQueue = new PriorityQueue<>(_numRowsToKeep,
+          new SortComparator(collationKeys, collationDirections, dataSchema, 
false));
+    }
+    _rows = new ArrayList<>();

Review Comment:
   I don't think this initialization is needed for both. Only for `non ORDER 
BY` scenario imo ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to