val query = lines
.selectExpr("CAST(partition AS STRING) as partition","CAST(topic AS STRING) as topic","CAST(offset AS STRING) as offset","CAST(value AS STRING) as value")
.filter($"value".contains("\"op\":\"ins\"") || $"value".contains("\"op\":\"upd\"") || $"value".contains("\"op\":\"del\""))
.as[(String,String,String,String)]
.writeStream
.outputMode("append")
//.foreach()
.format("console")
.start()
这里的select或者是selectExpr查询的内容,如果源是kafka的话,查询内容是固定的,不是自己配置的
Schema信息
读取后的数据的Schema是固定的,包含的列如下:
来自
https://www.cnblogs.com/xing901022/p/9141334.html