火花结构化流databrick上没有控制台输出
我正在尝试将带有套接字的Databrick中的结构化流作为源,并将控制器作为输出接收器。
但是,我无法在Databrick上看到任何输出。
from pyspark.sql.functions import *
lines = (spark
.readStream.format("socket")
.option("host", "localhost")
.option("port", 9999)
.load())
countdf = lines.select(split(col("value"), "\\s").alias("word")).groupBy("word").count()
checkpointDir = "/tmp/streaming"
streamingQuery = (countdf
.writeStream
.format("console")
.outputMode("complete")
.trigger(processingTime="1 second")
.option("checkpointLocation", checkpointDir)
.start())
在另一个终端中,通过套接字
我看不到仪表板中的任何更新/更改,也没有显示输出。当我尝试显示countdf时,它显示 AnalySiseXception:必须使用Writestream.start();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能在流媒体查询上使用
.show
。另外,在console
输出的情况下,它将其打印到日志中,而不是笔记本中。如果您只想查看转换的结果,则可以在数据映中使用display
函数支持流数据集的可视化,包括用于检查点位置的设置&触发间隔。You can't use
.show
on the streaming queries. Also, in the case of theconsole
output, it's printed into logs, not into the notebook. If you just want to see the results of your transformations, on Databricks you can usedisplay
function that supports visualization of streaming datasets, including settings for checkpoint location & trigger interval.