Yes, I want count all the elements. But I can't do cumulative.eg: distinctOrder.map(new MapFunction<Order, Object>() {
@Override public Object map(Order value) throws Exception { return null; } }).setParallelism(1).print(); ------------------------------------------------------------------发件人:Tzu-Li (Gordon) Tai <tzuli...@apache.org>发送时间:2018年1月12日(星期五) 22:37收件人:user <user@flink.apache.org>主 题:Re: How can I count the element in datastream Hi! Do you mean that you want to count all elements across all partitions of a DataStream? To do that, you'll need to transform the DataStream with an operator of parallelism 1, e.g. DatatStream<String> stream = ...; stream.map(new CountingMap<>()).setParallelism(1); Cheers, Gordon -- Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/