Cannot use map-side combining with array keys

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sinat_36710456/article/details/85316984

异常:

Exception in thread "main" org.apache.spark.SparkException: Cannot use map-side combining with array keys

原因:

使用 reduceByKey、countByValue 等,需要使用 flatMap,如果用map处理会抛以上异常。
flatMap:主要用于spark Streaming
map:到处用
区别
以读文件例:map会为每一行返回一个对象,但flatMap会汇总每行返回的对象成为一个更大的对象(map-side的错误也能看得出)

猜你喜欢

转载自blog.csdn.net/sinat_36710456/article/details/85316984
今日推荐