score:0

You can use futures to have spark actions kick off in parallel. Something like this.

val queries = Seq(
  "query1",
  "query2",
  "query3"
)

val results = Future.traverse(queries)(q => Future({
  val queryResult = sqlContext.sql(q)
  queryResult.write.format...
}))

Await.result(result, Duration.Inf)

Related Query

More Query from same tag