Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-1956

Runtime context not initialized in RichWindowMapFunction

    XMLWordPrintableJSON

Details

    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();
      

      Attachments

        Activity

          People

            mbalassi Márton Balassi
            balidani Daniel Bali
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: