davidradl commented on code in PR #26486:
URL: https://github.com/apache/flink/pull/26486#discussion_r2056427533


##########
flink-core/src/main/java/org/apache/flink/api/common/accumulators/Histogram.java:
##########
@@ -53,12 +53,7 @@ public TreeMap<Integer, Integer> getLocalValue() {
     public void merge(Accumulator<Integer, TreeMap<Integer, Integer>> other) {
         // Merge the values into this map
         for (Map.Entry<Integer, Integer> entryFromOther : 
other.getLocalValue().entrySet()) {
-            Integer ownValue = this.treeMap.get(entryFromOther.getKey());
-            if (ownValue == null) {
-                this.treeMap.put(entryFromOther.getKey(), 
entryFromOther.getValue());
-            } else {
-                this.treeMap.put(entryFromOther.getKey(), 
entryFromOther.getValue() + ownValue);
-            }
+            this.treeMap.merge(entryFromOther.getKey(), 
entryFromOther.getValue(), Integer::sum);

Review Comment:
   can you confirm there is an existing  unit test for this code please. 



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to