具有多个输入的 ParDo 函数

ParDo function with more than one input

我想使用适用于 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 函数发出多个输入? 谢谢。

您可以使用辅助输入来提供额外的 PCollection 作为输入。见 example.

有一个类似的问题,其中包含更多示例代码。