我正在对流数据帧执行聚合,并尝试将结果写入输出目录。但是我听到一个异常的说法
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()