use of com.facebook.presto.operator.PagesIndex in project presto by prestodb.
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());
}
use of com.facebook.presto.operator.PagesIndex in project presto by prestodb.
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);
int positionCount = pagesIndex.getPositionCount();
AdaptiveLongBigArray valueAddresses = pagesIndex.getValueAddresses();
long[] result = new long[positionCount];
for (int i = 0; i < positionCount; i++) {
result[i] = valueAddresses.get(i);
}
return result;
}
Aggregations