use of io.crate.execution.engine.aggregation.impl.CountAggregation in project crate by crate.
the class GroupByOptimizedIteratorTest method prepare.
@Before
public void prepare() throws Exception {
NodeContext nodeCtx = createNodeContext();
IndexWriter iw = new IndexWriter(new ByteBuffersDirectory(), new IndexWriterConfig(new StandardAnalyzer()));
columnName = "x";
expectedResult = new ArrayList<>(20);
for (long i = 0; i < 20; i++) {
Document doc = new Document();
String val = "val_" + i;
doc.add(new SortedSetDocValuesField(columnName, new BytesRef(val)));
iw.addDocument(doc);
expectedResult.add(new Object[] { val, 1L });
}
iw.commit();
indexSearcher = new IndexSearcher(DirectoryReader.open(iw));
inExpr = new InputCollectExpression(0);
CountAggregation aggregation = (CountAggregation) nodeCtx.functions().getQualified(CountAggregation.COUNT_STAR_SIGNATURE, Collections.emptyList(), CountAggregation.COUNT_STAR_SIGNATURE.getReturnType().createType());
aggregationContexts = List.of(new AggregationContext(aggregation, () -> true, List.of()));
}
Aggregations