You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Seth Wiesman (Jira)" <ji...@apache.org> on 2020/12/21 15:59:00 UTC

[jira] [Commented] (FLINK-20698) A single object is reused among windows with different key

    [ https://issues.apache.org/jira/browse/FLINK-20698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17252930#comment-17252930 ] 

Seth Wiesman commented on FLINK-20698:
--------------------------------------

This is the expected behavior, and true of all operators. If you would like to maintain state scoped to a single key (window in this case). You will need to use a ValueState, ListState, or MapState. 

> A single object is reused among windows with different key
> ----------------------------------------------------------
>
>                 Key: FLINK-20698
>                 URL: https://issues.apache.org/jira/browse/FLINK-20698
>             Project: Flink
>          Issue Type: Bug
>          Components: API / Core
>    Affects Versions: 1.10.1
>            Reporter: Yordan Pavlov
>            Priority: Major
>         Attachments: VariablesNotCreatedPerKey.scala
>
>
> When a stream is keyed and time window applied, a single object is being reused among the different keyed streams. I am pasting the essence of my test code with the full version attached.
> {code:scala}
>     source
>       .keyBy( x => x.elementNumber)
>       .timeWindow(Time.milliseconds(1))
>       .apply(new WindowCounter())
> {code}
> In this example a single WindowCounter object is being created. Please correct me if this is not really a bug.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)