Hi,

Please take a look for example here:
https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/state/state.html#keyed-state
 
<https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/state/state.html#keyed-state>
And the example in particular
https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/state/state.html#using-managed-keyed-state
 
<https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/state/state.html#using-managed-keyed-state>

The part about "there is a specific key implicitly in context” might be 
referring to the fact, that for every instance of `CountWindowAverage` that 
will be running in the cluster, user doesn’t have to set the key context 
explicility. Flink will set the the key context automatically for the 
`ValueState<Tuple2<Long, Long>> sum;` before any invocation of 
`CountWindowAverage#flatMap` method.

In other words, one parallel instance of `CountWindowAverage` function, for two 
consecutive invocations of `CountWindowAverage#flatMap` can be referring to 
different underlying value of `CountWindowAverage#sum` field. For details you 
could take a look at 
`org.apache.flink.streaming.api.operators.AbstractStreamOperator#setKeyContextElement1`
 method and how it’s being used/implemented.

I hope that helps.

Piotrek

> On 13 Mar 2020, at 08:20, Padarn Wilson <pad...@gmail.com> wrote:
> 
> Hi Users,
> 
> I am trying to understand the details of how some aspects of Flink work.
> 
> While understanding `keyed state` I kept coming up against a claim that 
> `there is a specific key implicitly in context` I would like to understand 
> how this works, which I'm guessing means understanding the details of the 
> runtime context: Is there any documentation or FLIP someone can recommend on 
> this?  

Reply via email to