You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Marco Villalobos <mv...@kineteque.com> on 2021/02/09 21:46:10 UTC

What is the difference between RuntimeContext state and ProcessWindowFunction.Context state when using a ProcessWindowFunction?

Hi,

I am having a difficult time distinguishing the difference between
RuntimeContext state and global state when using a ProcessWindowFunction.

A ProcessWindowFunction has three access different kinds of state.
1. RuntimeContext state.
2. ProcessWindowFunction.Context global state
3. ProcessWindowFunction.Context window state.

It's clear to me that the window state belongs to a window, the lines
seemed a bit blurred between RuntimeContext state and
ProcessWindowFunction.Context global state.

Can somebody please elaborate on the differences, and when I should use
global state vs runtime context state?

Thank you.

Re: What is the difference between RuntimeContext state and ProcessWindowFunction.Context state when using a ProcessWindowFunction?

Posted by Arvid Heise <ar...@apache.org>.
Hi Marco,

1. RuntimeContext is available to all operators and is bound to the current
key (if used in a keyed context).
2. Is the same actually. Not sure why it's exposed twice... So use either
one.
3. Is additionally bound to the current window.

On Tue, Feb 9, 2021 at 10:46 PM Marco Villalobos <mv...@kineteque.com>
wrote:

> Hi,
>
> I am having a difficult time distinguishing the difference between
> RuntimeContext state and global state when using a ProcessWindowFunction.
>
> A ProcessWindowFunction has three access different kinds of state.
> 1. RuntimeContext state.
> 2. ProcessWindowFunction.Context global state
> 3. ProcessWindowFunction.Context window state.
>
> It's clear to me that the window state belongs to a window, the lines
> seemed a bit blurred between RuntimeContext state and
> ProcessWindowFunction.Context global state.
>
> Can somebody please elaborate on the differences, and when I should use
> global state vs runtime context state?
>
> Thank you.
>