hi,
I am using spark 3.2.1 and utilizing spark mongo connector (10.2.1) to steam directly from mongo.
Below is the error that I am getting .
org.apache.spark.SparkException: Execution of the stream null failed. Please, fill a bug report in, and provide the full stack trace.
at org.apache.spark.sql.execution.QueryExecution$.toInternalError(QueryExecution.scala:500)
at org.apache.spark.sql.execution.streaming.StreamExecution.org$apache$spark$sql$execution$streaming$StreamExecution$$runStream(StreamExecution.scala:324)
at org.apache.spark.sql.execution.streaming.StreamExecution$$anon$1.run(StreamExecution.scala:208)
Caused by: java.lang.NullPointerException
below is my sample code:
val streamingDataFrame = spark.readStream
.format("mongodb")
.option("spark.mongodb.connection.uri", uri)
.option("spark.mongodb.change.stream.publish.full.document.only","true")
.option("spark.mongodb.collection", "plan.header")
.load()
val kk= streamingDataFrame.writeStream
.option("checkpointLocation", "checkpointlocation").
foreachBatch({(result: DataFrame, batchId: Long) =>
result.printSchema()
result.show(10,false)
})