use of io.crate.expression.reference.doc.lucene.OrderByCollectorExpression in project crate by crate.
the class OrderedLuceneBatchIteratorFactoryTest method createOrderedCollector.
private LuceneOrderedDocCollector createOrderedCollector(IndexSearcher searcher, int shardId) {
CollectorContext collectorContext = new CollectorContext();
List<LuceneCollectorExpression<?>> expressions = Collections.singletonList(new OrderByCollectorExpression(reference, orderBy, o -> o));
return new LuceneOrderedDocCollector(new ShardId("dummy", UUIDs.randomBase64UUID(), shardId), searcher, new MatchAllDocsQuery(), null, false, // batchSize < 10 to have at least one searchMore call.
5, RamAccounting.NO_ACCOUNTING, collectorContext, f -> null, new Sort(new SortedNumericSortField(columnName, SortField.Type.LONG, reverseFlags[0])), expressions, expressions);
}
use of io.crate.expression.reference.doc.lucene.OrderByCollectorExpression in project crate by crate.
the class DocInputFactory method extractImplementations.
public InputFactory.Context<? extends LuceneCollectorExpression<?>> extractImplementations(TransactionContext txnCtx, RoutedCollectPhase phase) {
OrderBy orderBy = phase.orderBy();
ReferenceResolver<? extends LuceneCollectorExpression<?>> refResolver;
if (orderBy == null) {
refResolver = referenceResolver;
} else {
refResolver = ref -> {
if (orderBy.orderBySymbols().contains(ref)) {
DataType<?> dataType = ref.valueType();
return new OrderByCollectorExpression(ref, orderBy, dataType::sanitizeValue);
}
return referenceResolver.getImplementation(ref);
};
}
InputFactory.Context<? extends LuceneCollectorExpression<?>> ctx = inputFactory.ctxForRefs(txnCtx, refResolver);
ctx.add(phase.toCollect());
return ctx;
}
Aggregations