在spark-shell上运行spark structuredstreaming程序报如下错误,经排查发现是由于版本问题需添加多一些jar包。
spark版本为3.0.0。
我的代码
spark.sparkContext.setLogLevel("ERROR")
val df = spark.readStream.format("kafka")
.option("kafka.bootstrap.servers","node01:9092")
.option("subscribe","lzj_test")
.load()
import spark.implicits._
val lines = df.selectExpr("CAST(value AS STRING)").as[String]
val words = lines.flatMap(_.split(" "))
val wordCounts = words.groupBy("value").count()
val query = wordCounts.writeStream
.outputMode("update")
.format("console")