Github user zsxwing commented on a diff in the pull request:
https://github.com/apache/spark/pull/16238#discussion_r91830324
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala
---
@@ -214,6 +228,10 @@ class StreamExecution(
// While active, repeatedly attempt to run batches.
SparkSession.setActiveSession(sparkSession)
+ updateStatusMessage("Initializing sources")
--- End diff --
Could you move `SparkSession.setActiveSession(sparkSession)`,
`updateStatusMessage("Initializing sources")` and `logicalPlan` above
`postEvent(new QueryStartedEvent(id, runId, name))`? Then we can initialize the
logical plan before returning `StreamingQuery` to the user and ensure
`logicalPlan` is always initialized in the stream thread. And you can also add
`assert(Thread.currentThread().isInstanceOf[StreamExecutionThread])` when
creating `logicalPlan`, and remove the unnecessary test you added since this
assertion will be tested in all current stream tests.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]