use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class NestedLoopBatchIteratorTest method testLeftJoin.
@Test
public void testLeftJoin() throws Exception {
Supplier<BatchIterator> batchIteratorSupplier = () -> NestedLoopBatchIterator.leftJoin(TestingBatchIterators.range(0, 4), TestingBatchIterators.range(2, 6), getCol0EqCol1JoinCondition());
BatchIteratorTester tester = new BatchIteratorTester(batchIteratorSupplier);
tester.verifyResultAndEdgeCaseBehaviour(leftJoinResult);
}
use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class NestedLoopBatchIteratorTest method testNestedLoopBatchIterator.
@Test
public void testNestedLoopBatchIterator() throws Exception {
BatchIteratorTester tester = new BatchIteratorTester(() -> NestedLoopBatchIterator.crossJoin(TestingBatchIterators.range(0, 3), TestingBatchIterators.range(0, 3)));
tester.verifyResultAndEdgeCaseBehaviour(threeXThreeRows);
}
use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class RowsBatchIteratorTest method testCollectRows.
@Test
public void testCollectRows() throws Exception {
List<Row> rows = Arrays.asList(new Row1(10), new Row1(20));
Supplier<BatchIterator> batchIteratorSupplier = () -> RowsBatchIterator.newInstance(rows, 1);
BatchIteratorTester tester = new BatchIteratorTester(batchIteratorSupplier);
List<Object[]> expectedResult = Arrays.asList(new Object[] { 10 }, new Object[] { 20 });
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class SkippingBatchIteratorTest method testSkippingBatchIterator.
@Test
public void testSkippingBatchIterator() throws Exception {
BatchIteratorTester tester = new BatchIteratorTester(() -> new SkippingBatchIterator(TestingBatchIterators.range(0, 10), offset));
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class BatchPagingIteratorTest method testBatchPagingIterator.
@Test
public void testBatchPagingIterator() throws Exception {
Iterable<Row> rows = RowGenerator.range(0, 3);
List<Object[]> expectedResult = StreamSupport.stream(rows.spliterator(), false).map(Row::materialize).collect(Collectors.toList());
BatchIteratorTester tester = new BatchIteratorTester(() -> {
PassThroughPagingIterator<Integer, Row> pagingIterator = PassThroughPagingIterator.repeatable();
pagingIterator.merge(Collections.singletonList(new KeyIterable<>(0, rows)));
return new BatchPagingIterator<>(pagingIterator, exhaustedIt -> false, () -> true, () -> {
}, 1);
});
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
Aggregations