flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjwiesman <...@git.apache.org>
Subject [GitHub] flink pull request #3479: [FLINK-5929] Allow Access to Per-Window State in P...
Date Mon, 13 Mar 2017 20:28:55 GMT
Github user sjwiesman commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3479#discussion_r105763162
  
    --- 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 --
    
    whoops 😱 


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