Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Getting error saying “Queries with streaming sources must be executed with writeStream.start()” on spark structured streaming

Getting error saying “Queries with streaming sources must be executed with writeStream.start()” on spark structured streaming

New Contributor

I am getting some issues while executing spark SQL on top of spark structures streaming. PFA for error.

here is my code

val rawData = spark.readStream.option("sep", ",").schema(userSchema).csv("file:///C:/Users/R/Documents/spark-poc-centri/csvFolder")

import spark.implicits._

rawData.createOrReplaceTempView("updates")

val sqlResult= spark.sql("select * from updates")

println("sql results here")

sqlResult.show()

println("Otheres")

val query = rawData.writeStream.outputMode("append").format("console").start()

query.awaitTermination()

my question is how can i print sql results in structured streaming

97453-sparqlinssue.png

Don't have an account?
Coming from Hortonworks? Activate your account here