【问题标题】:Spark Streaming display (streaming) not workingSpark Streaming 显示(流)不工作
【发布时间】:2022-01-13 19:18:16
【问题描述】:

我按照这个example 从源文件模拟 Spark 中的流式传输。在示例的最后,使用了一个名为 display 的函数,该函数在 databricks仅支持。我在 Jupyter 笔记本中运行我的代码。 Jupyter 中有什么替代方法可以从 display 函数获得相同的输出?

screenshoot_of_the_Example

更新_1: 代码:

 # Source
sourceStream=spark.readStream.format("csv").\
option("header",True).\
schema(schema).option("ignoreLeadingWhiteSpace",True).\
option("mode","dropMalformed").\
option("maxFilesPerTrigger",1).load("D:/PHD Project/Paper_3/Tutorials/HeartTest_1/").\
withColumnRenamed("output","label")

#stream test data to the ML model
streamingHeart=pModel.transform(sourceStream).select('label')

我执行以下操作:

streamingHeart.writeStream.outputMode("append").\
format("csv").option("path", "D:/PHD \
Project/Paper_3/Tutorials/sa1/").option("checkpointLocation",\ 
"checkpoint/filesink_checkpoint").start()\

问题是生成的文件(输出文件)是空的。这可能是什么原因?

【问题讨论】:

标签: file apache-spark jupyter-notebook spark-streaming


【解决方案1】:

我通过更改检查点解决了问题,如下。

Project/Paper_3/Tutorials/sa1/").option("checkpointLocation",\ 
"checkpoint/filesink_checkpoint_1")

【讨论】:

    猜你喜欢
    • 2016-03-12
    • 2017-03-29
    • 1970-01-01
    • 2016-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-17
    • 1970-01-01
    相关资源
    最近更新 更多