[英]Apache beam Dataflow SDK error with example
我正在尝试谷歌数据流管道示例之一,但我碰到了有关MapElements和方法SingleFunction / SerializableFunction调用的异常。 代码段如下:
static class ParseTableRowJson extends SimpleFunction<String, TableRow> {
@Override
public TableRow apply(String input) {
try {
return Transport.getJsonFactory().fromString(input, TableRow.class);
} catch (IOException e) {
throw new RuntimeException("Failed parsing table row json", e);
}
}
}
......
p.apply(TextIO.read().from(options.getInput()))
.apply(MapElements.via(new ParseTableRowJson()))
.apply(new ComputeTopSessions(samplingThreshold))
.apply("Write",
TextIO.write().withoutSharding().to(options.getOutput()));
例外之处在于它对方法的模棱两可:
Ambiguous method call. Both
via (SimpleFunction<String, TableRow>) in MapElements and
via (SerializableFunction) in MapElements match
是否有人碰到了相同的异常并有办法解决?
完整的示例位于github( https://github.com/apache/beam/blob/master/examples/java/src/main/java/org/apache/beam/examples/complete/TopWikipediaSessions.java )中。
谢谢,
费尔南多
这似乎已在HEAD的代码中修复。 具体来说, MapElements
不再具有via
两个静态版本。 短期,你可以从头梁安装或更新的例子使用ParDo
直接通过使ParseTableRowJson
一个DoFn
而不是SimpleFunction
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.