Jackie-Jiang commented on code in PR #8979:
URL: https://github.com/apache/pinot/pull/8979#discussion_r981756231
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/blocks/results/SelectionResultsBlock.java:
##########
@@ -45,6 +56,26 @@ public Collection<Object[]> getRows() {
return _rows;
}
+ public SelectionResultsBlock cloneWithInnerPriorityQueue() {
+ if (_rows instanceof PriorityQueue) {
+ return new SelectionResultsBlock(_dataSchema, new
PriorityQueue<>(_rows));
Review Comment:
I don't follow the advantage though. What I am suggesting is something like:
```suggestion
public SelectionResultsBlock convertToPriorityQueueBased() {
if (_rows instanceof PriorityQueue) {
return this;
}
if (_comparator == null) {
throw new IllegalStateException("This instance doesn't define an order
on which be sorted");
}
PriorityQueue<Object[]> result = new PriorityQueue<>(_comparator);
result.addAll(_rows);
return new SelectionResultsBlock(_dataSchema, result);
}
```
The `SelectionResultsBlock` is still immutable. We just don't create a
duplicate one when it is already backed by a priority queue.
--
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]