[
https://issues.apache.org/jira/browse/IGNITE-18896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yury Gerzhedovich updated IGNITE-18896:
---------------------------------------
Epic Link: IGNITE-19479
> Sql. SortNode optimization for queries with limit.
> --------------------------------------------------
>
> Key: IGNITE-18896
> URL: https://issues.apache.org/jira/browse/IGNITE-18896
> Project: Ignite
> Issue Type: Improvement
> Components: sql
> Reporter: Andrey Mashenkov
> Priority: Major
> Labels: ignite-3
>
> As of now we use 2 structures to get top-n (highest or lowest) rows from
> unsorted stream.
> We use PriorityQueue, which backed with heap, to hold top-n partially sorted
> in backward order, and an array (as a stack) to sort and reverse to get
> expected order.
> Seems, we can use a single array here.
> * Pass the array to the constructor of fastutil's version
> ObjectHeapPriorityQueue.
> * After the stream is processed, the array will be partially sorted.
> * Then we can sort the array using heap-sort algo instantly, without creating
> a new array.
> * Return result from the end of array like we already do.
> Also, I'd suggest to use ObjectArrayList.wrap() to wrap array to a Stack
> interface.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)