單項選擇題

在Spark中,假設(shè)lines是一個DStream對象,以下哪個語句可以周期統(tǒng)計這個流上的單詞數(shù)?()

A.lines.flatMap(_.split”””)).map(word=>(word,1)).reduce(_+_).print()
B.lines.flatMap(_.split”””)).map(word=>(word,word.length())).reduceByKey(_+_).print()
C.lines.flatMap(_.split”””)).map(word=>(word,1)).reduceByKey(_+_).print()
D.lines.flatMap(_.split”””)).flatMap(word=>(word,1)).groupByKey(_+_).print()

微信掃碼免費搜題