来自pyspark脚本的空结果

时间:2017-06-07 10:51:14

标签: python apache-spark pyspark spark-streaming

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("================================================================")

`

当我运行脚本没有获得输出时,只打印两行以下,其间没有任何内容。

=============================================== =================

空在这里

=============================================== =================

0 个答案:

没有答案