Search in sources :

Example 11 with BatchConsumer

use of io.crate.data.BatchConsumer in project crate by crate.

the class MultiConsumerTest method testSuccessfulMultiConsumerUsage.

@Test
public void testSuccessfulMultiConsumerUsage() throws Exception {
    TestingBatchConsumer batchConsumer = new TestingBatchConsumer();
    BatchConsumer consumer = new CompositeCollector.MultiConsumer(2, batchConsumer, CompositeBatchIterator::new);
    consumer.accept(TestingBatchIterators.range(3, 6), null);
    consumer.accept(TestingBatchIterators.range(0, 3), null);
    List<Object[]> result = batchConsumer.getResult();
    assertThat(TestingHelpers.printedTable(new CollectionBucket(result)), is("0\n" + "1\n" + "2\n" + "3\n" + "4\n" + "5\n"));
}
Also used : CompositeBatchIterator(io.crate.data.CompositeBatchIterator) TestingBatchConsumer(io.crate.testing.TestingBatchConsumer) BatchConsumer(io.crate.data.BatchConsumer) TestingBatchConsumer(io.crate.testing.TestingBatchConsumer) CollectionBucket(io.crate.data.CollectionBucket) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Aggregations

BatchConsumer (io.crate.data.BatchConsumer)11 ExecutionPhase (io.crate.planner.node.ExecutionPhase)4 CrateUnitTest (io.crate.test.integration.CrateUnitTest)4 Test (org.junit.Test)4 CollectingBatchConsumer (io.crate.data.CollectingBatchConsumer)3 CompositeBatchIterator (io.crate.data.CompositeBatchIterator)2 Row (io.crate.data.Row)2 NodeOperationTree (io.crate.operation.NodeOperationTree)2 ProjectingBatchConsumer (io.crate.operation.projectors.ProjectingBatchConsumer)2 IntCursor (com.carrotsearch.hppc.cursors.IntCursor)1 Function (com.google.common.base.Function)1 FluentIterable (com.google.common.collect.FluentIterable)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Iterables (com.google.common.collect.Iterables)1 ContextPreparer (io.crate.action.job.ContextPreparer)1 JobRequest (io.crate.action.job.JobRequest)1 SharedShardContexts (io.crate.action.job.SharedShardContexts)1 TransportJobAction (io.crate.action.job.TransportJobAction)1 BatchConsumerToResultReceiver (io.crate.action.sql.BatchConsumerToResultReceiver)1