python - 是否可以有效地将 PCollection 列表转换为 PCollection(只是列表中的值)?
问题描述
我知道可以使用 ParDo 函数直接从列表中生成元素,但是还有其他直接或更有效的方法吗?
解决方案
按照官方文档,您可以使用该Flatten
方法来合并 PCollections。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())
推荐阅读
- ios - 如果电子邮件未验证,Apple 将替换电子邮件提供商
- python - 如何从 json 文件中获取密钥对值?
- elasticsearch - Elasticsearch 模板中的未知键
- c# - 在 Startup.cs 中使用 await 将字符串添加到列表
- java - 如何使用 SPARQL 进行排名?
- azure-eventhub - 使用 webMethods java 服务直接将 webMethods Integratioin Server 集成到 Azure 事件中心
- audio - 组合两个 WebRTC 对等点时是否可以同步音频?
- python - 该程序将数字转换为列表
- joomla - Joomla 自定义文件上传、处理、保存和搜索
- javascript - 在给定 tr id 的特定行中更改所有 td 元素的样式