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);
}
}
}
Aggregations