Re:疑似BUG: 在滑动窗口中使用reduce()聚合时数据被多次处理

2023-11-03 文章 Xuyang
Hi, 验证了下,问题疑似出现在reduce函数中,复用了下wordCount1这个对象。我试了下new一个新的WordCount作为输出应该就可以了。 猜测这可能和基于Heap的state backend有关,多个窗口的heap state可能直接使用的是一个对象的地址。 ``` .reduce( (wordCount1, wordCount2) -> { WordCount newWC = new WordCount( wordCount1.word, wordCount1.count + wordCount2.count);

疑似BUG: 在滑动窗口中使用reduce()聚合时数据被多次处理

2023-11-02 文章 tao zhang
reduce()方法的状态在窗口间未被隔离,多个窗口聚合时使用的是同一对象.一个数据进入时,被重复累加 是reduce的特性吗? 还是reduce中的窗口间隔离出现问题? 希望得到回复 测试输入如下: 1001,/home,1000 1002,/home,2000 输出如下: input> test.Event(user=1001, page=/home, ts=1000) input> test.Event(user=1002, page=/home, ts=2000) test.WordCount(word=/home, count=2)