简体   繁体   English

如何在控制台中执行 writeStream a dataframe? (Scala Spark 流媒体)

[英]How to do writeStream a dataframe in console? (Scala Spark Streaming)

I want to debug my notebook thus I need to print out the streaming-data in notebook console mode.我想调试我的笔记本,因此我需要在笔记本控制台模式下打印出流数据。 I have two questions: 1- Is it possible to do:我有两个问题:1-是否可以这样做:

df.writeStream.format("console").start().awaitTermination()

2- If yes, where can I see the output? 2- 如果是,我在哪里可以看到 output?

在此处输入图像描述 This is after 10 minutes... No error or result这是 10 分钟后...没有错误或结果

Thanks!谢谢!

I figured out what the problem in my case was.我弄清楚我的问题是什么。 I had to add the ".outputMode("append")" in my method.我必须在我的方法中添加“.outputMode(“append”)” Here is how it looks:这是它的样子:

def writeStreamData(dataFrame: DataFrame): Unit = {
        /**
         * write the given dataframe into a file or console
         :params: dataframe
         */
        dataFrame.writeStream
            .format("console")
            .outputMode("append")
            .start()
            .awaitTermination()
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 spark scala dataframe 视图上应用过滤器? - How to apply filters on spark scala dataframe view? 如何动态地使用 spark scala 将 spark dataframe 转换为嵌套 json - How to Convert spark dataframe to nested json using spark scala dynamically databricks 中 json 问题的 spark.readstream 和 writestream - spark.readstream and writestream for json issue in databricks Scala schema_of_json function 在 spark 结构化流中失败 - Scala schema_of_json function fails in spark structured streaming 如何为 Spark Structural Streaming 创建 KinesisSink - How to create a KinesisSink for Spark Structural Streaming 如何访问 Spark Streaming 应用程序的统计端点? - How to access statistics endpoint for a Spark Streaming application? 如何在 spark scala 中动态聚合列? - How to aggregate the columns dynamically in spark scala? 如何使用 pyspark writestream 写入存储谷歌云? - how to write to storage google cloud with pyspark writestream? 如何使用 Scala Spark 在 AWS Glue 作业中设置 Spark Config? - How to set Spark Config in an AWS Glue job, using Scala Spark? 如何使用本地 JAR 文件运行 Spark 结构化流 - How to run Spark structured streaming using local JAR files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM