kvs = KafkaUtils.createStream(ssc, zkQuorum, "spark-streaming-consumer", {topic: 1})
lines = kvs.map(lambda x: x[1])
words = lines.flatMap(lambda line: line.split(" "))
pairs = words.map(lambda word: (word, 1))
wordCounts = pairs.reduceByKey(lambda x, y: x + y)
print("===============================================================")
wordCounts.pprint()
print("================================================================")
`
当我运行脚本没有得到输出时,只打印两行以下的内容,中间没有任何内容。你知道吗
==================================================================================
此处为空
==================================================================================
目前没有回答
相关问题 更多 >
编程相关推荐