flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lincoln-lil <...@git.apache.org>
Subject [GitHub] flink pull request #3733: [FLINK-6091] [table] Implement and turn on retract...
Date Tue, 18 Apr 2017 13:57:51 GMT
Github user lincoln-lil commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3733#discussion_r111959451
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/aggregate/GroupAggProcessFunction.scala
---
    @@ -68,12 +70,35 @@ class GroupAggProcessFunction(
         var accumulators = state.value()
     
         if (null == accumulators) {
    +      previous = null
           accumulators = new Row(aggregates.length)
           i = 0
           while (i < aggregates.length) {
             accumulators.setField(i, aggregates(i).createAccumulator())
             i += 1
           }
    +    } else {
    +      // get previous row
    +      if (generateRetraction) {
    +        if (null == previous) {
    +          previous = new Row(groupings.length + aggregates.length)
    +          // previous is used to output retract message, so command of previous will
always be
    +          // Command.Delete
    +          previous.command = Command.Delete
    +        }
    +        i = 0
    +        while (i < groupings.length) {
    +          previous.setField(i, input.getField(groupings(i)))
    +          i += 1
    +        }
    +        i = 0
    +        while (i < aggregates.length) {
    +          val index = groupings.length + i
    --- End diff --
    
    reduce a local variable:
    previous.setField(groupings.length + i, aggregates(i).getValue(accumulator))
    
    also L118 and L127


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message