[
https://issues.apache.org/jira/browse/FLINK-3659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15210586#comment-15210586
]
ASF GitHub Bot commented on FLINK-3659:
---------------------------------------
Github user aljoscha commented on the pull request:
https://github.com/apache/flink/pull/1831#issuecomment-200933436
To elaborate on this. State right now works well if you stick to the
(admittedly somewhat hidden) rules. That is, you should only access state if
there is a key available.
If there is no key available the behavior changes in unexpected ways based
on what state backend is used and the capabilities of the key serializer. For
example, let's look at access to `ValueState` in `open()`. For mem/fs state:
`ValueState.value()` works, it will return the default value.
`ValueState.update()` will throw a NPE. For RocksDB state: Neither method works
if the key serializer cannot handle null values. If it can, then both methods
will change state for the `null` key.
For these reasons I would like to change the semantics of state such that
the user always has to call `getState` (or a similar method) and that the
returned accessor object is documented to only be valid for the duration of the
processing method. Right now, the user can wreak all kinds of havoc by
down-casting the returned State object. Right now we have a very simple system
that works if the user keeps to the rules and also makes things go fast. If we
want to make it more restrictive we will lose some performance, of course.
> Allow ConnectedStreams to Be Keyed on Only One Side
> ---------------------------------------------------
>
> Key: FLINK-3659
> URL: https://issues.apache.org/jira/browse/FLINK-3659
> Project: Flink
> Issue Type: Improvement
> Components: Streaming
> Affects Versions: 1.0.0
> Reporter: Aljoscha Krettek
> Assignee: Aljoscha Krettek
>
> Currently, we only allow partitioned state when both inputs are keyed (with
> the same key type). I think a valid use case is to have only one side keyed
> and have the other side broadcast to publish some updates that are relevant
> for all keys.
> When relaxing the requirement to have only one side keyed we must still
> ensure that the same key is used if both sides are keyed.
> [~gyfora] Did you try this with what you're working on?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)