在dataflow docs之后,我可以使用ParDo.named
命名Google Cloud Dataflow管道的每个步骤:
PCollection<Integer> wordLengths = words.apply(
ParDo
.named("ComputeWordLengths") // the transform name
.of(new DoFn<String, Integer>() {
@Override
public void processElement(ProcessContext c) {
c.output(c.element().length());
}
}));
但是,如果我使用MapElements
,则文档中的示例并未命名该步骤:
PCollection<Integer> wordLengths = words.apply(
MapElements.via((String word) -> word.length())
.withOutputType(new TypeDescriptor<Integer>() {});
如何命名此MapElements
步骤?
我有几个MapElements
步骤,我遇到这样的错误:
Mar 01, 2016 1:36:39 PM com.google.cloud.dataflow.sdk.Pipeline applyInternal
WARNING: Transform MapElements2 does not have a stable unique name. This will prevent updating of pipelines.
答案 0 :(得分:2)
您可以在应用时指定名称。例如:
words.apply("name", MapElements.via(...))
// instead of
words.apply(MapElements.via(...))
有关详细信息,请参阅named apply method上的JavaDoc。