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

Shaoxuan Wang commented on FLINK-5984:
--------------------------------------

[~twalthr] Thanks for the suggestion. This seems a new "resetAccumulator" 
method to me. It is valuable for dataset, while dataStream does not need this 
for now. 
  override def resetAccumulator(acc: Accumulator) = {
    val a = acc.asInstanceOf[SumAccumulator[T]]
    a.f0 = numeric.zero //sum
    a.f1 = false
  }
Fabian's proposal also looks good to me, as long as we make the "reuse 
parameter" purely clear to the users with detailed annotations.
[~twalthr], if you have not started on this jira, I can help to make the 
changes.

> Allow reusing of accumulators in AggregateFunction
> --------------------------------------------------
>
>                 Key: FLINK-5984
>                 URL: https://issues.apache.org/jira/browse/FLINK-5984
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API & SQL
>            Reporter: Timo Walther
>
> Right now we have to create a new accumulator object if we just want to reset 
> it. We should allow passing the old one as a {{reuse}} object to 
> {{AggregateFunction#createAccumulator}}. The aggregate function then can 
> decide if it wants to create a new object or reset the old one.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to