use of io.crate.testing.BatchSimulatingIterator in project crate by crate.
the class CompositeBatchIteratorTest method testCompositeBatchIteratorWithBatchedSources.
@Test
public void testCompositeBatchIteratorWithBatchedSources() throws Exception {
List<Object[]> expectedResult = new ArrayList<>();
// consumes the unbatched/loaded iterator first
expectedResult.add(new Object[] { 5 });
expectedResult.add(new Object[] { 6 });
expectedResult.add(new Object[] { 7 });
expectedResult.add(new Object[] { 8 });
expectedResult.add(new Object[] { 9 });
expectedResult.add(new Object[] { 0 });
expectedResult.add(new Object[] { 1 });
expectedResult.add(new Object[] { 2 });
expectedResult.add(new Object[] { 3 });
expectedResult.add(new Object[] { 4 });
BatchIteratorTester tester = new BatchIteratorTester(() -> new CompositeBatchIterator(new CloseAssertingBatchIterator(new BatchSimulatingIterator(TestingBatchIterators.range(0, 5), 2, 6, null)), TestingBatchIterators.range(5, 10)));
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
use of io.crate.testing.BatchSimulatingIterator in project crate by crate.
the class LimitingBatchIteratorTest method testLimitingBatchIteratorWithBatchedSource.
@Test
public void testLimitingBatchIteratorWithBatchedSource() throws Exception {
BatchIteratorTester tester = new BatchIteratorTester(() -> {
BatchSimulatingIterator batchSimulatingIt = new BatchSimulatingIterator(TestingBatchIterators.range(0, 10), 2, 5, null);
return LimitingBatchIterator.newInstance(batchSimulatingIt, limit);
});
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
use of io.crate.testing.BatchSimulatingIterator in project crate by crate.
the class NestedLoopBatchIteratorTest method testFullOuterJoinBatchedSource.
@Test
public void testFullOuterJoinBatchedSource() throws Exception {
Supplier<BatchIterator> batchIteratorSupplier = () -> NestedLoopBatchIterator.fullOuterJoin(new BatchSimulatingIterator(TestingBatchIterators.range(0, 4), 2, 2, null), new BatchSimulatingIterator(TestingBatchIterators.range(2, 6), 2, 2, null), getCol0EqCol1JoinCondition());
BatchIteratorTester tester = new BatchIteratorTester(batchIteratorSupplier);
tester.verifyResultAndEdgeCaseBehaviour(fullJoinResult);
}
use of io.crate.testing.BatchSimulatingIterator in project crate by crate.
the class NestedLoopBatchIteratorTest method testRightJoinBatchedSource.
@Test
public void testRightJoinBatchedSource() throws Exception {
Supplier<BatchIterator> batchIteratorSupplier = () -> NestedLoopBatchIterator.rightJoin(new BatchSimulatingIterator(TestingBatchIterators.range(0, 4), 2, 2, null), new BatchSimulatingIterator(TestingBatchIterators.range(2, 6), 2, 2, null), getCol0EqCol1JoinCondition());
BatchIteratorTester tester = new BatchIteratorTester(batchIteratorSupplier);
tester.verifyResultAndEdgeCaseBehaviour(rightJoinResult);
}
use of io.crate.testing.BatchSimulatingIterator in project crate by crate.
the class NestedLoopBatchIteratorTest method testNestedLoopWithBatchedSource.
@Test
public void testNestedLoopWithBatchedSource() throws Exception {
BatchIteratorTester tester = new BatchIteratorTester(() -> NestedLoopBatchIterator.crossJoin(new BatchSimulatingIterator(TestingBatchIterators.range(0, 3), 2, 2, null), new BatchSimulatingIterator(TestingBatchIterators.range(0, 3), 2, 2, null)));
tester.verifyResultAndEdgeCaseBehaviour(threeXThreeRows);
}
Aggregations