Beam/Dataflow 2.2.0-从pcollection中提取前n个元素 [英] Beam/Dataflow 2.2.0 - extract first n elements from pcollection

查看:70
本文介绍了Beam/Dataflow 2.2.0-从pcollection中提取前n个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以提取光束集合中的前n个元素?该文档似乎并未指示任何此类功能.我认为这样的操作首先需要分配全局元素编号,然后需要过滤器-拥有此功能会很不错.

Is there any way to extract first n elements in a beam pcollection? The documentation doesn't seem to indicate any such function. I think such an operation would require first a global element number assignment and then a filter - would be nice to have this functionality.

我使用Google DataFlow Java SDK 2.2.0.

推荐答案

PCollection本身是无序的,因此不存在前N个元素"的概念-但是:

PCollection's are unordered per se, so the notion of "first N elements" does not exist - however:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆