use of io.crate.execution.engine.fetch.ReaderContext in project crate by crate.
the class ShortColumnReferenceTest method testShortExpression.
@Test
public void testShortExpression() throws Exception {
ShortColumnReference shortColumn = new ShortColumnReference(column);
shortColumn.startCollect(ctx);
shortColumn.setNextReader(new ReaderContext(readerContext));
IndexSearcher searcher = new IndexSearcher(readerContext.reader());
TopDocs topDocs = searcher.search(new MatchAllDocsQuery(), 20);
short i = -10;
for (ScoreDoc doc : topDocs.scoreDocs) {
shortColumn.setNextDocId(doc.doc);
assertThat(shortColumn.value(), is(i));
i++;
}
}
use of io.crate.execution.engine.fetch.ReaderContext in project crate by crate.
the class DoubleColumnReferenceTest method testFieldCacheExpression.
@Test
public void testFieldCacheExpression() throws Exception {
DoubleColumnReference doubleColumn = new DoubleColumnReference(column);
doubleColumn.startCollect(ctx);
doubleColumn.setNextReader(new ReaderContext(readerContext));
IndexSearcher searcher = new IndexSearcher(readerContext.reader());
TopDocs topDocs = searcher.search(new MatchAllDocsQuery(), 10);
double d = 0.5;
for (ScoreDoc doc : topDocs.scoreDocs) {
doubleColumn.setNextDocId(doc.doc);
assertThat(doubleColumn.value(), is(d));
d++;
}
}
Aggregations