use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class LuceneBatchIteratorTest method testLuceneBatchIterator.
@Test
public void testLuceneBatchIterator() throws Exception {
BatchIteratorTester tester = new BatchIteratorTester(() -> {
return new LuceneBatchIterator(indexSearcher, new MatchAllDocsQuery(), null, false, new CollectorContext(mock(IndexFieldDataService.class), new CollectorFieldsVisitor(0)), new RamAccountingContext("dummy", new NoopCircuitBreaker("dummy")), columnRefs, columnRefs);
});
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class RowTransformingBatchIteratorTest method testRowTransformingIterator.
@Test
public void testRowTransformingIterator() throws Exception {
BatchIteratorTester tester = new BatchIteratorTester(() -> new RowTransformingBatchIterator(TestingBatchIterators.range(0, 10), inputs, expressions));
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class FileReadingIteratorTest method testIteratorContract.
@Test
public void testIteratorContract() throws Exception {
String fileUri = tempFilePath.toUri().toString();
Supplier<BatchIterator> batchIteratorSupplier = () -> createBatchIterator(Collections.singletonList(fileUri), null);
byte[] firstLine = "{\"name\": \"Arthur\", \"id\": 4, \"details\": {\"age\": 38}}".getBytes(StandardCharsets.UTF_8);
byte[] secondLine = "{\"id\": 5, \"name\": \"Trillian\", \"details\": {\"age\": 33}}".getBytes(StandardCharsets.UTF_8);
List<Object[]> expectedResult = Arrays.asList(new Object[] { new BytesRef(firstLine) }, new Object[] { new BytesRef(secondLine) });
BatchIteratorTester tester = new BatchIteratorTester(batchIteratorSupplier);
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class NestedLoopBatchIteratorTest method testFullOuterJoin.
@Test
public void testFullOuterJoin() throws Exception {
Supplier<BatchIterator> batchIteratorSupplier = () -> NestedLoopBatchIterator.fullOuterJoin(TestingBatchIterators.range(0, 4), TestingBatchIterators.range(2, 6), getCol0EqCol1JoinCondition());
BatchIteratorTester tester = new BatchIteratorTester(batchIteratorSupplier);
tester.verifyResultAndEdgeCaseBehaviour(fullJoinResult);
}
use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class NestedLoopBatchIteratorTest method testRightJoin.
@Test
public void testRightJoin() throws Exception {
Supplier<BatchIterator> batchIteratorSupplier = () -> NestedLoopBatchIterator.rightJoin(TestingBatchIterators.range(0, 4), TestingBatchIterators.range(2, 6), getCol0EqCol1JoinCondition());
BatchIteratorTester tester = new BatchIteratorTester(batchIteratorSupplier);
tester.verifyResultAndEdgeCaseBehaviour(rightJoinResult);
}
Aggregations