[ https://issues.apache.org/jira/browse/FLINK-9225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chesnay Schepler updated FLINK-9225: ------------------------------------ Component/s: Documentation > 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)