go - 具有多个输入的 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 函数发出多个输入呢?谢谢你。
解决方案
您可以使用侧输入提供额外的 PCollection 作为输入。请参阅示例。
有一个类似的问题Go SDK Apache Beam : singleton side input Singleton for int ill-defined其中包含更多示例代码。
推荐阅读
- xamarin - Xamarin - 使用 ContentPage.BindingContext 时 PushAsync 失败
- numpy - `scipy.stats.expon.rvs()` 和 `numpy.random.exponential()` 有什么区别?
- frontend - 是否可以从图书馆借用软件前端?
- python - 如何获取嵌套列表中的元素数量?
- python - clang:错误:不支持的选项“-fopenmp”(SparseConvNe 构建错误)
- mongodb - Mongoose 对嵌套对象的查找查询返回空数组
- c++ - 使用带有 SIMD 内部函数的结构
- c++ - static_assert 和 CRTP 的奇怪行为
- firebase - 在 Firebase 中编辑文档和字段
- c++ - 复制浮点数的字节模式不起作用