【发布时间】:2021-01-28 09:45:36
【问题描述】:
我知道可以使用 ParDo 函数直接从列表中生成元素,但是还有其他直接或更有效的方法吗?
【问题讨论】:
-
也许您可以添加一些上下文、您的一些代码以及您尝试过的内容以及预期行为和实际行为之间的区别,以便我们为您提供帮助
标签: python mapreduce apache-beam
我知道可以使用 ParDo 函数直接从列表中生成元素,但是还有其他直接或更有效的方法吗?
【问题讨论】:
标签: python mapreduce apache-beam
按照official Documentation,您可以使用Flatten 方法来合并PCollection。 the Beam Programming Guide 中提供了示例。
# Flatten takes a tuple of PCollection objects.
# Returns a single PCollection that contains all of the elements in the PCollection objects in that tuple.
merged = (
(pcoll1, pcoll2, pcoll3)
# A list of tuples can be "piped" directly into a Flatten transform.
| beam.Flatten())
【讨论】: