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

    https://github.com/apache/flink/pull/3479#discussion_r105661470
  
    --- Diff: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/functions/InternalAggregateProcessAllWindowFunction.java
 ---
    @@ -53,22 +57,47 @@ public InternalAggregateProcessAllWindowFunction(
        }
     
        @Override
    -   public void apply(Byte key, final W window, Iterable<T> input, 
Collector<R> out) throws Exception {
    +   public void open(Configuration parameters) throws Exception {
    +           super.open(parameters);
                ProcessAllWindowFunction<V, R, W> wrappedFunction = 
this.wrappedFunction;
    -           ProcessAllWindowFunction<V, R, W>.Context context = 
wrappedFunction.new Context() {
    -                   @Override
    -                   public W window() {
    -                           return window;
    -                   }
    -           };
    +           this.ctx = new 
InternalProcessAllWindowContext<>(wrappedFunction);
    +   }
     
    +   @Override
    +   public void process(Byte aByte, final W window, final 
InternalWindowContext context, Iterable<T> input, Collector<R> out) throws 
Exception {
                final ACC acc = aggFunction.createAccumulator();
     
                for (T val : input) {
                        aggFunction.add(val, acc);
                }
     
    -           wrappedFunction.process(context, 
Collections.singletonList(aggFunction.getResult(acc)), out);
    +           this.ctx.window = window;
    +           this.ctx.internalContext = context;
    +           ProcessAllWindowFunction<V, R, W> wrappedFunction = 
this.wrappedFunction;
    +           wrappedFunction.process(ctx, 
Collections.singletonList(aggFunction.getResult(acc)), out);
    +   }
    +
    +   @Override
    +   public void clear(final W window, final InternalWindowContext context) 
throws Exception {
    +           ProcessAllWindowFunction<V, R, W> wrappedFunction = 
this.wrappedFunction;
    +           final ProcessAllWindowFunction<V, R, W>.Context ctx = 
wrappedFunction.new Context() {
    --- End diff --
    
    leftover anonymous inner `Context`. This should also use `this.ctx` like in 
`process()`.


---
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