Search in sources :

Example 1 with SimplePagesIndexComparator

use of com.facebook.presto.operator.SimplePagesIndexComparator in project presto by prestodb.

the class OrderingCompiler method internalCompilePagesIndexOrdering.

@VisibleForTesting
public PagesIndexOrdering internalCompilePagesIndexOrdering(List<Type> sortTypes, List<Integer> sortChannels, List<SortOrder> sortOrders) throws Exception {
    requireNonNull(sortChannels, "sortChannels is null");
    requireNonNull(sortOrders, "sortOrders is null");
    PagesIndexComparator comparator;
    try {
        Class<? extends PagesIndexComparator> pagesHashStrategyClass = compilePagesIndexComparator(sortTypes, sortChannels, sortOrders);
        comparator = pagesHashStrategyClass.newInstance();
    } catch (Throwable e) {
        log.error(e, "Error compiling comparator for channels %s with order %s", sortChannels, sortChannels);
        comparator = new SimplePagesIndexComparator(sortTypes, sortChannels, sortOrders);
    }
    // we may want to load a separate PagesIndexOrdering for each comparator
    return new PagesIndexOrdering(comparator);
}
Also used : SimplePagesIndexComparator(com.facebook.presto.operator.SimplePagesIndexComparator) PagesIndexComparator(com.facebook.presto.operator.PagesIndexComparator) SimplePagesIndexComparator(com.facebook.presto.operator.SimplePagesIndexComparator) PagesIndexOrdering(com.facebook.presto.operator.PagesIndexOrdering) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

PagesIndexComparator (com.facebook.presto.operator.PagesIndexComparator)1 PagesIndexOrdering (com.facebook.presto.operator.PagesIndexOrdering)1 SimplePagesIndexComparator (com.facebook.presto.operator.SimplePagesIndexComparator)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1