有没有办法打印出传入的数据?例如,我在寻找 JSON 文件的文件夹上有一个 readStream,但似乎存在问题,因为我在聚合输出中看到“空值”。
val schema = StructType(
StructField("id", LongType, false) ::
StructField("sid", IntegerType, true) ::
StructField("data", ArrayType(IntegerType, false), true) :: Nil)
val lines = spark.
readStream.
schema(schema).
json("in/*.json")
val top1 = lines.groupBy("id").count()
val query = top1.writeStream
.outputMode("complete")
.format("console")
.option("truncate", "false")
.start()