一.场景
当在Flink中使用POJO时,经常会出现该异常,代码如下:
1.POJO类:
class WordWithCount(word : String, count : Int){
def this(){
this(null, 0)
}
}
2.逻辑代码
val input = execution.fromElements(
new WordWithCount("hello", 1),
new WordWithCount("word", 2))
val result = input
.groupBy("word")
.sum("count")