Search in sources :

Example 1 with SingleBucketBuilder

use of io.crate.executor.transport.distributed.SingleBucketBuilder in project crate by crate.

the class ContextPreparer method registerContextPhases.

private void registerContextPhases(Iterable<? extends NodeOperation> nodeOperations, PreparerContext preparerContext) {
    for (NodeOperation nodeOperation : nodeOperations) {
        // context for nodeOperations without dependencies can be built immediately (e.g. FetchPhase)
        if (nodeOperation.downstreamExecutionPhaseId() == NodeOperation.NO_DOWNSTREAM) {
            logger.trace("Building context for nodeOp without downstream: {}", nodeOperation);
            if (createContexts(nodeOperation.executionPhase(), preparerContext)) {
                preparerContext.opCtx.builtNodeOperations.set(nodeOperation.executionPhase().phaseId());
            }
        }
        if (ExecutionPhases.hasDirectResponseDownstream(nodeOperation.downstreamNodes())) {
            Streamer<?>[] streamers = StreamerVisitor.streamersFromOutputs(nodeOperation.executionPhase());
            SingleBucketBuilder bucketBuilder = new SingleBucketBuilder(streamers);
            preparerContext.directResponseFutures.add(bucketBuilder.completionFuture());
            preparerContext.registerBatchConsumer(nodeOperation.downstreamExecutionPhaseId(), bucketBuilder);
        }
    }
}
Also used : Streamer(io.crate.Streamer) SingleBucketBuilder(io.crate.executor.transport.distributed.SingleBucketBuilder)

Aggregations

Streamer (io.crate.Streamer)1 SingleBucketBuilder (io.crate.executor.transport.distributed.SingleBucketBuilder)1