pyspark scrip的空结果

2024-05-15 01:23:35 发布

您现在位置:Python中文网/ 问答频道 /正文

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

`

当我运行脚本没有得到输出时,只打印两行以下的内容,中间没有任何内容。你知道吗

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

此处为空

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


Tags: lambdamap内容linewordwordslinesprint

热门问题