use of org.apache.beam.model.pipeline.v1.RunnerApi.SideInput in project beam by apache.
the class StreamingSideInputHandlerFactory method forStage.
/**
* Creates a new state handler for the given stage. Note that this requires a traversal of the
* stage itself, so this should only be called once per stage rather than once per bundle.
*/
public static StreamingSideInputHandlerFactory forStage(ExecutableStage stage, Map<SideInputId, PCollectionView<?>> viewMapping, org.apache.beam.runners.core.SideInputHandler runnerHandler) {
ImmutableMap.Builder<SideInputId, PCollectionView<?>> sideInputBuilder = ImmutableMap.builder();
for (SideInputReference sideInput : stage.getSideInputs()) {
SideInputId sideInputId = SideInputId.newBuilder().setTransformId(sideInput.transform().getId()).setLocalName(sideInput.localName()).build();
sideInputBuilder.put(sideInputId, checkNotNull(viewMapping.get(sideInputId), "No side input for %s/%s", sideInputId.getTransformId(), sideInputId.getLocalName()));
}
StreamingSideInputHandlerFactory factory = new StreamingSideInputHandlerFactory(sideInputBuilder.build(), runnerHandler);
return factory;
}
Aggregations