Hi Jark
If the state is very big, it may occupy a lot of memory if we return
Set>.
By wrapping the returned iterator, we can easily implement a method
returning Iterable>.
Users can use that returned Iterable in the foreach loop.
Regards
Xiaogang
2016-10-19
Hi Xiaogang,
I think maybe return Set> is better than
Iterator>.
Because users can use foreach on Set but not Iterator, and can use iterator
access via set.iterator().
Maybe Map.entrySet() is a more familiar way to users.
- Jark Wu
> 在 2016年10月19日,下午5:18,SHI
Agreed.
contains(K key) should be provided.
The iterator() method should return Iterator> instead of
Iterator>.
Besides, size() may also be provided.
With these methods, MapStates appear very similar to Java Maps. Users will
be very happy to use them.
Regards,
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
Xiaogang Shi created FLINK-4856:
---
Summary: Add MapState for keyed streams
Key: FLINK-4856
URL: https://issues.apache.org/jira/browse/FLINK-4856
Project: Flink
Issue Type: New Feature