Github user fhueske commented on the issue:

    https://github.com/apache/flink/pull/3783
  
    Thanks for this PR @huawei-flink! 
    
    I think I made a mistake when I suggested to use the code-gen'd functions 
with registered `MapState` to compute distinct window aggregations. Originally, 
I thought it would be possible to register state (i.e., the `MapState` for the 
distinct values) in an `AggregateFunction` (which is used for the grouped 
window aggregates). However, that's unfortunately not possible as I learned 
today. All state of an `AggregateFunction` must be contained in the accumulator.
    
    What does this mean? We cannot use the current approach of registering 
`MapState` in the code-gen'd function for group windowed aggregates. So we 
would need another approach for that.
    
    However, we can still use your code for distinct over windows 
(`ProcessFunction` can obviously register state) once the API supports to 
define DISTINCT aggregates.
    
    I'll try to have a closer look at this PR soon.
    
    Best, Fabian


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to