[ 
https://issues.apache.org/jira/browse/FLINK-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Bali updated FLINK-1956:
-------------------------------
    Description: 
Trying to access the runtime context in a rich window map function results in 
an exception. The following snippet demonstrates the bug:

    env.generateSequence(0, 1000)
    .window(Count.of(10))
    .mapWindow(new RichWindowMapFunction<Long, Tuple2<Long, Long>>() {
        @Override
        public void mapWindow(Iterable<Long> input, Collector<Tuple2<Long, 
Long>> out) throws Exception {
            long self = getRuntimeContext().getIndexOfThisSubtask();
            for (long value : input) {
                out.collect(new Tuple2<>(self, value));
            }
        }
    }).flatten().print();

  was:
Trying to access the runtime context in a rich window map function results in 
an exception. The following snippet demonstrates the bug:

env.generateSequence(0, 1000)
    .window(Count.of(10))
    .mapWindow(new RichWindowMapFunction<Long, Tuple2<Long, Long>>() {
        @Override
        public void mapWindow(Iterable<Long> input, Collector<Tuple2<Long, 
Long>> out) throws Exception {
            long self = getRuntimeContext().getIndexOfThisSubtask();
            for (long value : input) {
                out.collect(new Tuple2<>(self, value));
            }
        }
    }).flatten().print();


> Runtime context not initialized in RichWindowMapFunction
> --------------------------------------------------------
>
>                 Key: FLINK-1956
>                 URL: https://issues.apache.org/jira/browse/FLINK-1956
>             Project: Flink
>          Issue Type: Bug
>          Components: Streaming
>            Reporter: Daniel Bali
>            Assignee: Marton Balassi
>              Labels: context, runtime, streaming, window
>
> Trying to access the runtime context in a rich window map function results in 
> an exception. The following snippet demonstrates the bug:
>     env.generateSequence(0, 1000)
>     .window(Count.of(10))
>     .mapWindow(new RichWindowMapFunction<Long, Tuple2<Long, Long>>() {
>         @Override
>         public void mapWindow(Iterable<Long> input, Collector<Tuple2<Long, 
> Long>> out) throws Exception {
>             long self = getRuntimeContext().getIndexOfThisSubtask();
>             for (long value : input) {
>                 out.collect(new Tuple2<>(self, value));
>             }
>         }
>     }).flatten().print();



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to