flink-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Till Rohrmann <trohrm...@apache.org>
Subject Re: Add MapState for keyed streams
Date Wed, 19 Oct 2016 08:55:27 GMT
Hi Xiaogang,

I really like your proposal and think that this would be a valuable
addition to Flink :-)

For convenience we could maybe add contains(K key), too.

Java's Map interface returns a Set of Entry when calling entrySet() (which
is the equivalent of iterator() in our interface). The Entry interface not
only allows to get access to the key and value of the map entry but also
allows to set a value for the respective key via setValue (even though it's
an optional operation). Maybe we want to offer something similar when
getting access to the entry set via the iterator method.


On Wed, Oct 19, 2016 at 4:18 AM, SHI Xiaogang <shixiaogangg@gmail.com>

> Hi, all. I created the JIRA https://issues.apache.org/
> jira/browse/FLINK-4856 to
> propose adding MapStates into Flink.
> MapStates are very useful in our daily jobs. For example, when implementing
> DistinctCount, we store the values into a MapState and the result of each
> group(key) is exactly the number of entries in the MapState.
> In my opinion, the methods provided by the MapState may include:
> * void put(K key, V value)
> * V get(K key)
> * Iterable<K> keys()
> * Iterable<V> values()
> * Iterator<Tuple2<K, V>> iterator()
> Do you have any comments? Any is appreciated.
> Xiaogang

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message