[ 
https://issues.apache.org/jira/browse/FLINK-7206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16144442#comment-16144442
 ] 

ASF GitHub Bot commented on FLINK-7206:
---------------------------------------

Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4355#discussion_r135561193
  
    --- Diff: 
flink-libraries/flink-table/src/test/java/org/apache/flink/table/runtime/utils/JavaUserDefinedAggFunctions.java
 ---
    @@ -237,9 +248,13 @@ public void resetAccumulator(CountDistinctAccum acc) {
                //Overloaded retract method
                public void retract(CountDistinctAccum accumulator, long id) {
                        try {
    -                           if 
(!accumulator.map.contains(String.valueOf(id))) {
    -                                   
accumulator.map.remove(String.valueOf(id));
    -                                   accumulator.count -= 1;
    +                           Integer cnt = 
accumulator.map.get(String.valueOf(id));
    +                           if (cnt != null) {
    +                                   cnt -= 1;
    +                                   if (cnt <= 0) {
    +                                           
accumulator.map.remove(String.valueOf(id));
    +                                           accumulator.count -= 1;
    +                                   }
    --- End diff --
    
    We should update the count if it is > 0:
    
    ```
    else { 
      accumulator.map.put(String.valueOf(id), cnt)
    }
    ```


> Implementation of DataView to support state access for UDAGG
> ------------------------------------------------------------
>
>                 Key: FLINK-7206
>                 URL: https://issues.apache.org/jira/browse/FLINK-7206
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API & SQL
>            Reporter: Kaibo Zhou
>            Assignee: Kaibo Zhou
>
> Implementation of MapView and ListView to support state access for UDAGG.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to