presto-main/src/main/java/io/prestosql/PagesIndexPageSorter.java/PagesIndexPageSorter/sort
class PagesIndexPageSorter:    @Override
    public long[] sort(List<Type> types, List<Page> pages, List<Integer> sortChannels, List<SortOrder> sortOrders, int expectedPositions)
    {
        PagesIndex pagesIndex = pagesIndexFactory.newPagesIndex(types, expectedPositions);
        pages.forEach(pagesIndex::addPage);
        pagesIndex.sort(sortChannels, sortOrders);

        return pagesIndex.getValueAddresses().toLongArray(null);
    }