Мигать нет результатов после нажатия клавиши keyBy, окна и окна - PullRequest
0 голосов
/ 26 апреля 2020

Я пытаюсь выполнить некоторые операции Flink для моего потока данных. Но я не получаю никакого результата. У кого-нибудь есть идеи почему бы и нет. Спасибо за вашу помощь.

KeyedStream<Tuple2<String, Long>, Tuple> stream1 = stream.keyBy(0);

stream1.print(); //Here I have results

DataStream<Tuple3<Integer, String, Date>> stream2 = stream1.window(TumblingEventTimeWindows.of(Time.seconds(15))).apply(new WindowFunction<Tuple2<String, Long>, Tuple3<Integer, String, Date>, Tuple, TimeWindow>() {
                    @Override
                    public void apply(Tuple tuple, TimeWindow window, Iterable<Tuple2<String, Long>> input, Collector<Tuple3<Integer, String, Date>> out) {
                        int counter = 0;
                        for (Tuple2<String, Long> ignored : input) {
                            counter++;
                        }
                        out.collect(new Tuple3<>(
                                counter,
                                tuple.get(0), //I also manually extracted the key from the Tuple, but that did also not work
                                new Date(window.getEnd())));
                    }

        });

stream2.print(); //here I do not have any resulat

Flink Версия: 1.10 Нет ошибок

1 Ответ

0 голосов
/ 27 апреля 2020

Благодаря Доминику Восински я нашел решение.

Я извлек метку времени, но забыл установить TimeCharacteristi c. Я забыл следующую строку:

env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
...