You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Chesnay Schepler (JIRA)" <ji...@apache.org> on 2018/04/25 07:37:01 UTC
[jira] [Closed] (FLINK-9225) Minor code comments fix in
RuntimeContext
[ https://issues.apache.org/jira/browse/FLINK-9225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chesnay Schepler closed FLINK-9225.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.5.0
master: 8b98f79c90c26291755dbccb5b7065a9fba768a2
1.5: 300dc4cdae03142132728ac345c782efab97724b
> Minor code comments fix in RuntimeContext
> -----------------------------------------
>
> Key: FLINK-9225
> URL: https://issues.apache.org/jira/browse/FLINK-9225
> Project: Flink
> Issue Type: Bug
> Components: Documentation
> Affects Versions: 1.5.0
> Reporter: binlijin
> Assignee: binlijin
> Priority: Trivial
> Fix For: 1.5.0
>
> Attachments: FLINK-9225.patch
>
>
> * <pre>{@code
> * DataStream<MyType> stream = ...;
> * KeyedStream<MyType> keyedStream = stream.keyBy("id");
> *
> * keyedStream.map(new RichMapFunction<MyType, Tuple2<MyType, Long>>() {
> *
> * private ValueState<Long> count;
> *
> * public void open(Configuration cfg) {
> * state = getRuntimeContext().getState(
> * new ValueStateDescriptor<Long>("count", LongSerializer.INSTANCE, 0L));
> * }
> *
> * public Tuple2<MyType, Long> map(MyType value) {
> * long count = state.value() + 1;
> * state.update(value);
> * return new Tuple2<>(value, count);
> * }
> * });
> * }</pre>
>
> "private ValueState<Long> count;" should be "private ValueState<Long> state;"
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)