【问题标题】:apache beam with python pardo with multi pCollections input带有多 pCollections 输入的带有 python pardo 的 apache 梁
【发布时间】:2020-09-21 07:59:42
【问题描述】:

我是 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

谢谢

【问题讨论】:

  • 您看过侧输入吗? beam.apache.org/documentation/programming-guide/#side-inputs 如果我正确理解你的问题,你想要的是process(self, element, pcoll1, pcoll2),侧面输入可能会帮助你。
  • 我误解了这个问题,我删除了我的答案。明天看看,但看起来你确实需要边输入
  • @MilanCermak。感谢您的评论。这就是我需要的。侧面输入!。

标签: python apache-beam


【解决方案1】:

解决了。

您是否查看过侧输入? beam.apache.org/documentation/programming-guide/#side-inputs 如果我正确理解您的问题,您想要的是拥有 process(self, element, pcoll1, pcoll2),side input 可能会对您有所帮助。 ——昨天的米兰塞尔马克

感谢@MilanCermak

【讨论】:

    猜你喜欢
    • 2021-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-01
    • 2016-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多