v.23.2New Feature
Added arrayPartialSort and arrayPartialReverseSort Functions
AddedarrayPartialSortandarrayPartialReverseSortfunctions. #46296 (Joanna Hulboj).
Why it matters
These functions provide efficient ways to sort only a specified number of elements within an array, improving performance and flexibility when full sorting is unnecessary. This helps users quickly access top elements without sorting entire arrays, which is valuable in data processing and optimization tasks.How to use it
UsearrayPartialSort(array, n) to obtain the first n elements of the array sorted in ascending order, and arrayPartialReverseSort(array, n) for the first n elements sorted in descending order. Replace array with your target array column or expression and n with the number of elements to sort.