單項(xiàng)選擇題

在Spark中,假設(shè)lines是一個(gè)DStream對(duì)象,以下哪個(gè)語句可以周期統(tǒng)計(jì)這個(gè)流上的單詞數(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()

微信掃碼免費(fèi)搜題