Hi,

I just found another weirdness in the MapState API - method computeIfAbsent returns the _old_ value associated with the key. That is inconsistent with Java API and frankly with what users should expect when using this method. The semantics should be "retrieve current value, if not present associate the key with this one and return me the current value". Is this behavior intentional? What is the motivation? In combination with the previous thread [1] that states, that the value is not updated until read() of the state returned from computeIfAbsent is called this seems to force users to either fetch the state twice or do various workarounds.

 Jan

[1] https://lists.apache.org/thread/mp979twlgm76gjg014f5r0k2p0nlcj2q

Reply via email to