如何解决是否可以有效地将 PCollection 列表转换为 PCollection只是列表中的值?
我知道可以使用 ParDo 函数直接从列表中生成元素,但有没有其他直接或更有效的方法可以做到这一点?
解决方法
在 official Documentation 之后,您可以使用 Flatten
方法来合并 PCollections。 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())
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。