use of com.facebook.presto.operator.PagesIndexComparator in project presto by prestodb.
the class OrderingCompiler method compilePagesIndexComparator.
private Class<? extends PagesIndexComparator> compilePagesIndexComparator(List<Type> sortTypes, List<Integer> sortChannels, List<SortOrder> sortOrders) {
CallSiteBinder callSiteBinder = new CallSiteBinder();
ClassDefinition classDefinition = new ClassDefinition(a(PUBLIC, FINAL), makeClassName("PagesIndexComparator"), type(Object.class), type(PagesIndexComparator.class));
classDefinition.declareDefaultConstructor(a(PUBLIC));
generatePageIndexCompareTo(classDefinition, callSiteBinder, sortTypes, sortChannels, sortOrders);
return defineClass(classDefinition, PagesIndexComparator.class, callSiteBinder.getBindings(), getClass().getClassLoader());
}
use of com.facebook.presto.operator.PagesIndexComparator in project presto by prestodb.
the class OrderingCompiler method internalCompilePagesIndexOrdering.
@VisibleForTesting
public PagesIndexOrdering internalCompilePagesIndexOrdering(List<Type> sortTypes, List<Integer> sortChannels, List<SortOrder> sortOrders) {
requireNonNull(sortChannels, "sortChannels is null");
requireNonNull(sortOrders, "sortOrders is null");
PagesIndexComparator comparator;
try {
Class<? extends PagesIndexComparator> pagesHashStrategyClass = compilePagesIndexComparator(sortTypes, sortChannels, sortOrders);
comparator = pagesHashStrategyClass.getConstructor().newInstance();
} catch (Throwable e) {
log.error(e, "Error compiling comparator for channels %s with order %s", sortChannels, sortOrders);
comparator = new SimplePagesIndexComparator(sortTypes, sortChannels, sortOrders);
}
// we may want to load a separate PagesIndexOrdering for each comparator
return new PagesIndexOrdering(comparator);
}
Aggregations