首页 > 解决方案 > 具有多个输入的 ParDo 函数

问题描述

我想为 Apache Beam 使用 Go SDK,我正在尝试创建一个计算两个向量的点积的管道。

Computesit(a, b []int)int {
return a.Dot(b)
}
A:= beam.Create(s, []int{1,2})
B:= beam.Create(s, []int{3,4})
Dot := beam.ParDo(s,Computesit, A, B)

但我收到以下错误

Cannot use B (type.PCollection) as type beam.Option in argument to beam.ParDo

我的问题是,如果可能的话,我们如何向 ParDo 函数发出多个输入呢?谢谢你。

标签: gosdkapache-beam

解决方案


您可以使用侧输入提供额外的 PCollection 作为输入。请参阅示例

有一个类似的问题Go SDK Apache Beam : singleton side input Singleton for int ill-defined其中包含更多示例代码。


推荐阅读