Search in sources :

Example 1 with PagesIndex

use of io.prestosql.operator.PagesIndex in project hetu-core by openlookeng.

the class PagesIndexPageSorter method sort.

@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);
}
Also used : PagesIndex(io.prestosql.operator.PagesIndex)

Example 2 with PagesIndex

use of io.prestosql.operator.PagesIndex in project hetu-core by openlookeng.

the class PagesSortBenchmark method runPagesIndexSortBenchmark.

@Benchmark
public List<Page> runPagesIndexSortBenchmark(PagesIndexSortBenchmarkData data) {
    PagesIndex.TestingFactory pagesIndexFactory = new PagesIndex.TestingFactory(false);
    PagesIndex pageIndex = pagesIndexFactory.newPagesIndex(data.getTypes(), data.getTotalPositions());
    for (Page page : data.getPages()) {
        pageIndex.addPage(page);
    }
    pageIndex.sort(data.getSortChannels(), data.getSortOrders());
    return Streams.stream(pageIndex.getSortedPages()).collect(toImmutableList());
}
Also used : SequencePageBuilder.createSequencePage(io.prestosql.SequencePageBuilder.createSequencePage) Page(io.prestosql.spi.Page) PagesIndex(io.prestosql.operator.PagesIndex) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Aggregations

PagesIndex (io.prestosql.operator.PagesIndex)2 SequencePageBuilder.createSequencePage (io.prestosql.SequencePageBuilder.createSequencePage)1 Page (io.prestosql.spi.Page)1 Benchmark (org.openjdk.jmh.annotations.Benchmark)1