Spark结构化流可视化

时间:2020-03-27 09:25:27

标签: pyspark visualization spark-structured-streaming

我正在尝试可视化结构化流中的流查询。 我该怎么办? 我应该使用仪表板还是其他工具?

我在网上找不到任何类似的东西。

DF = spark \
    .readStream \
    .format("kafka") \
    .option("kafka.bootstrap.servers", bootstrapServers)\
    .option("subscribe", topics)\
    .load()\
    .selectExpr("CAST(value AS STRING)")

...
 query1 = prediction.writeStream.outputMode("update").format('console').start()
 query1.awaitTermination()

1 个答案:

答案 0 :(得分:0)

尝试类似的方法-queryName线索:

斯卡拉

// Have all the aggregates in an in-memory table
val aggDF
 .writeStream
 .queryName("aggregates")    // this query name will be the table name
 .outputMode("complete")
 .format("memory")
 .start()

spark.sql("select * from aggregates").show() 

pyspark

# Have all the aggregates in an in-memory table. The query name will be the table name
aggDF \
  .writeStream \
  .queryName("aggregates") \
  .outputMode("complete") \
  .format("memory") \
  .start()

spark.sql("select * from aggregates").show()   # interactively query in-memory table

DataBricks的笔记本具有display功能。