Scala中的groupBy與Spark中groupByKey、ReduceByKey用法案例WordCount

1.groupBy指明以某個元素分組函數 val source = Source.fromFile("E://data.txt","UTF-8") val lines = source.getLines() val list = lines.toList.flatMap(line => line.split(" ").map(word => (word,1))) val res0 = list.g
相關文章
相關標籤/搜索