Search in sources :

Example 6 with BatchIteratorTester

use of io.crate.testing.BatchIteratorTester 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);
}
Also used : BatchSimulatingIterator(io.crate.testing.BatchSimulatingIterator) BatchIteratorTester(io.crate.testing.BatchIteratorTester) Test(org.junit.Test)

Example 7 with BatchIteratorTester

use of io.crate.testing.BatchIteratorTester 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);
}
Also used : BatchSimulatingIterator(io.crate.testing.BatchSimulatingIterator) BatchIteratorTester(io.crate.testing.BatchIteratorTester) NestedLoopBatchIterator(io.crate.data.join.NestedLoopBatchIterator) Test(org.junit.Test)

Example 8 with BatchIteratorTester

use of io.crate.testing.BatchIteratorTester 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);
}
Also used : BatchSimulatingIterator(io.crate.testing.BatchSimulatingIterator) BatchIteratorTester(io.crate.testing.BatchIteratorTester) NestedLoopBatchIterator(io.crate.data.join.NestedLoopBatchIterator) Test(org.junit.Test)

Example 9 with BatchIteratorTester

use of io.crate.testing.BatchIteratorTester 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);
}
Also used : BatchSimulatingIterator(io.crate.testing.BatchSimulatingIterator) BatchIteratorTester(io.crate.testing.BatchIteratorTester) Test(org.junit.Test)

Example 10 with BatchIteratorTester

use of io.crate.testing.BatchIteratorTester in project crate by crate.

the class NestedLoopBatchIteratorTest method testLeftJoinBatchedSource.

@Test
public void testLeftJoinBatchedSource() throws Exception {
    Supplier<BatchIterator> batchIteratorSupplier = () -> NestedLoopBatchIterator.leftJoin(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(leftJoinResult);
}
Also used : BatchSimulatingIterator(io.crate.testing.BatchSimulatingIterator) BatchIteratorTester(io.crate.testing.BatchIteratorTester) NestedLoopBatchIterator(io.crate.data.join.NestedLoopBatchIterator) Test(org.junit.Test)

Aggregations

BatchIteratorTester (io.crate.testing.BatchIteratorTester)27 Test (org.junit.Test)26 BatchSimulatingIterator (io.crate.testing.BatchSimulatingIterator)9 NestedLoopBatchIterator (io.crate.data.join.NestedLoopBatchIterator)6 CrateUnitTest (io.crate.test.integration.CrateUnitTest)4 BytesRef (org.apache.lucene.util.BytesRef)3 Symbol (io.crate.analyze.symbol.Symbol)2 BatchIterator (io.crate.data.BatchIterator)2 Row (io.crate.data.Row)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 IntStream (java.util.stream.IntStream)2 OrderBy (io.crate.analyze.OrderBy)1 InputColumn (io.crate.analyze.symbol.InputColumn)1 RamAccountingContext (io.crate.breaker.RamAccountingContext)1 Input (io.crate.data.Input)1 RowsBatchIterator (io.crate.data.RowsBatchIterator)1 ShardUpsertRequest (io.crate.executor.transport.ShardUpsertRequest)1 TransportShardUpsertAction (io.crate.executor.transport.TransportShardUpsertAction)1 SQLTransportIntegrationTest (io.crate.integrationtests.SQLTransportIntegrationTest)1