gortiz commented on code in PR #8979: URL: https://github.com/apache/pinot/pull/8979#discussion_r979744101
########## 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 will involve extra overhead, but it won't be that hard. `PriorityQueue(Collection)` is linear when the argument is another Priority queue. In fact it is a call to Arrays.copy(), which is very fast. And that cost comes with a legibility advantage: `SelectionResultsBlock` now treats blocks generated by children operators as they were immutable. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org