Search in sources :

Example 11 with ExecutionPhase

use of io.crate.execution.dsl.phases.ExecutionPhase in project crate by crate.

the class NodeOperationCtxTest method testFindLeafWithNodeOperationsThatHaveNoLeaf.

@Test
public void testFindLeafWithNodeOperationsThatHaveNoLeaf() {
    ExecutionPhase p1 = newPhase(0, "n1");
    NodeOperationCtx opCtx = new NodeOperationCtx("n1", singletonList(NodeOperation.withDownstream(p1, p1, (byte) 0)));
    assertThat(stream(opCtx.findLeafs().spliterator(), false).count(), is(0L));
}
Also used : ExecutionPhase(io.crate.execution.dsl.phases.ExecutionPhase) NodeOperationCtx(io.crate.execution.jobs.JobSetup.NodeOperationCtx) Test(org.junit.Test)

Example 12 with ExecutionPhase

use of io.crate.execution.dsl.phases.ExecutionPhase in project crate by crate.

the class JobLauncher method execute.

public void execute(RowConsumer consumer, TransactionContext txnCtx) {
    assert nodeOperationTrees.size() == 1 : "must only have 1 NodeOperationTree for non-bulk operations";
    NodeOperationTree nodeOperationTree = nodeOperationTrees.get(0);
    Map<String, Collection<NodeOperation>> operationByServer = NodeOperationGrouper.groupByServer(nodeOperationTree.nodeOperations());
    List<ExecutionPhase> handlerPhases = Collections.singletonList(nodeOperationTree.leaf());
    List<RowConsumer> handlerConsumers = Collections.singletonList(consumer);
    try {
        setupTasks(txnCtx, operationByServer, handlerPhases, handlerConsumers);
    } catch (Throwable throwable) {
        consumer.accept(null, throwable);
    }
}
Also used : NodeOperationTree(io.crate.execution.dsl.phases.NodeOperationTree) Collection(java.util.Collection) ExecutionPhase(io.crate.execution.dsl.phases.ExecutionPhase) CollectingRowConsumer(io.crate.data.CollectingRowConsumer) RowConsumer(io.crate.data.RowConsumer)

Aggregations

ExecutionPhase (io.crate.execution.dsl.phases.ExecutionPhase)12 RowConsumer (io.crate.data.RowConsumer)5 NodeOperationCtx (io.crate.execution.jobs.JobSetup.NodeOperationCtx)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 Tuple (io.crate.common.collections.Tuple)3 CollectingRowConsumer (io.crate.data.CollectingRowConsumer)3 NodeOperation (io.crate.execution.dsl.phases.NodeOperation)3 TransactionContext (io.crate.metadata.TransactionContext)3 Collection (java.util.Collection)3 IntHashSet (com.carrotsearch.hppc.IntHashSet)2 IntCursor (com.carrotsearch.hppc.cursors.IntCursor)2 ExecutionPhases (io.crate.execution.dsl.phases.ExecutionPhases)2 StreamBucket (io.crate.execution.engine.distribution.StreamBucket)2 DownstreamRXTask (io.crate.execution.jobs.DownstreamRXTask)2 PageBucketReceiver (io.crate.execution.jobs.PageBucketReceiver)2 RootTask (io.crate.execution.jobs.RootTask)2 Task (io.crate.execution.jobs.Task)2 List (java.util.List)2 Map (java.util.Map)2