【发布时间】:2020-11-01 10:08:29
【问题描述】:
我正在对流数据帧执行聚合并尝试将结果写入输出目录。但我得到一个例外说
pyspark.sql.utils.AnalysisException: 'Data source json does not support Update output mode;
我在“完整”输出模式下遇到类似的错误。
这是我的代码:
grouped_df = logs_df.groupBy('host', 'timestamp').agg(count('host').alias('total_count'))
result_host = grouped_df.filter(col('total_count') > threshold)
writer_query = result_host.writeStream \
.format("json") \
.queryName("JSON Writer") \
.outputMode("update") \
.option("path", "output") \
.option("checkpointLocation", "chk-point-dir") \
.trigger(processingTime="1 minute") \
.start()
writer_query.awaitTermination()
【问题讨论】:
标签: apache-spark pyspark apache-spark-sql spark-structured-streaming