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

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

Github user shaoxuan-wang commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3470#discussion_r104302135
  
    --- Diff: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/functions/aggfunctions/AggFunctionTestBase.scala
 ---
    @@ -36,14 +36,23 @@ abstract class AggFunctionTestBase[T] {
     
       def aggregator: AggregateFunction[T]
     
    +  def ifSupportRetraction: Boolean = true
    +
       @Test
    -  // test aggregate functions without partial merge
    -  def testAggregateWithoutMerge(): Unit = {
    +  // test aggregate and retract functions without partial merge
    +  def testAccumulateAndRetractWithoutMerge(): Unit = {
         // iterate over input sets
         for ((vals, expected) <- inputValueSets.zip(expectedResults)) {
    -      val accumulator = aggregateVals(vals)
    -      val result = aggregator.getValue(accumulator)
    +      val accumulator = accumulateVals(vals)
    +      var result = aggregator.getValue(accumulator)
           validateResult(expected, result)
    +
    +      if (ifSupportRetraction) {
    +        retractVals(accumulator, vals)
    --- End diff --
    
    Regarding to "We also need to check the retraction of a single value not 
all values (the SumAggregator retraction of all values was correct because the 
count was 0)"
    Instead of adding a new test to just retraction one, I think we could just 
add the check to compare two accumulators (comparing the getValues is not 
sufficient enough anymore). 
    assertEquals(accumulator, resultAccum)
    The accumulator should go back the initial status, after retracting all the 
previous inputs. This should be good enough to valid accumulate and retraction. 


> Add retract method into the aggregateFunction
> ---------------------------------------------
>
>                 Key: FLINK-5956
>                 URL: https://issues.apache.org/jira/browse/FLINK-5956
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API & SQL
>            Reporter: Shaoxuan Wang
>            Assignee: Shaoxuan Wang
>
> Retraction method is help for processing updated message. It will also very 
> helpful for window Aggregation. This PR will first add retraction methods 
> into the aggregateFunctions, such that on-going over window Aggregation can 
> get benefit from it.



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

Reply via email to