gpt4 book ai didi

python - apache beam 与 python pardo 与多 pCollections 输入

转载 作者:行者123 更新时间:2023-12-05 07:00:54 26 4
gpt4 key购买 nike

我是 apache_beam 的新手,我正在尝试开发一个管道。我有 2 个具有相同格式的 pCollection,还有另一个具有其他格式的 pCollection。我尝试为 pCollection 3 中的每个项目执行一个 ParDo 函数,该函数取决于该项目的值搜索 pCollection 1 或 2 中是否存在项目,以使用 pCollection 1 或 2 的信息完成输出。但是我不知道这个 ParDo 函数是怎么做到的。

这是我的代码:

output = (
pCollection1, pCollection2, pCollection3
| 'ParDo function' >> beam.ParDo(SearchData()))

这是我的 ParDo 函数:

class SampleScores(beam.DoFn):
def process(self,element):

# here I don't know how call a collection because I have only a "element"

return xxx

谢谢

最佳答案

已解决。

Have you looked at Side inputs? beam.apache.org/documentation/programming-guide/#side- inputs If I understand your question correctly, what you want is to have process(self, element, pcoll1, pcoll2), side inputs might help you with that. – Milan Cermak yesterday

感谢@MilanCermak

关于python - apache beam 与 python pardo 与多 pCollections 输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63988255/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com