acrites commented on PR #40750:
URL: https://github.com/apache/beam/pull/40750#issuecomment-6423039312

   > I find it pretty confusing that MapState.computeIfAbsent doesn't match 
Java Map.computeIfAbsent behavior where it returns the existing or newly 
computed value. 
https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#computeIfAbsent-K-java.util.function.Function-
   > 
   > I think it would be better to update the comment and match Map. Especially 
if the existing implementations are already behaving the other way.
   
   The only other implementation I've found so far is the InMemoryState: 
https://github.com/apache/beam/blob/master/runners/core-java/src/main/java/org/apache/beam/runners/core/InMemoryStateInternals.java#L843.
 It looks like it returns the newly computed value.
   
   So if we're comfortable changing the interface contract, I can do that 
instead. I think we'll still need the changes in this PR to handle the case 
where the current key is mapped to null though.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to