Github user zsxwing commented on a diff in the pull request:
https://github.com/apache/spark/pull/15852#discussion_r88580974
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamTest.scala ---
@@ -330,34 +331,51 @@ trait StreamTest extends QueryTest with
SharedSQLContext with Timeouts {
startedTest.foreach { action =>
logInfo(s"Processing test stream action: $action")
action match {
- case StartStream(trigger, triggerClock) =>
+ case StartStream(trigger, triggerClock, additionalConfs) =>
verify(currentStream == null, "stream already running")
verify(triggerClock.isInstanceOf[SystemClock]
|| triggerClock.isInstanceOf[StreamManualClock],
"Use either SystemClock or StreamManualClock to start the
stream")
if (triggerClock.isInstanceOf[StreamManualClock]) {
manualClockExpectedTime =
triggerClock.asInstanceOf[StreamManualClock].getTimeMillis()
}
- lastStream = currentStream
- currentStream =
- spark
- .streams
- .startQuery(
- None,
- Some(metadataRoot),
- stream,
- sink,
- outputMode,
- trigger = trigger,
- triggerClock = triggerClock)
- .asInstanceOf[StreamExecution]
- currentStream.microBatchThread.setUncaughtExceptionHandler(
- new UncaughtExceptionHandler {
- override def uncaughtException(t: Thread, e: Throwable):
Unit = {
- streamDeathCause = e
- }
+
+ val resetConfValues = mutable.Map[String, Option[String]]()
+ try {
+ additionalConfs.foreach(pair => {
+ val value =
+ if (spark.conf.contains(pair._1))
Some(spark.conf.get(pair._1)) else None
+ resetConfValues(pair._1) = value
+ spark.conf.set(pair._1, pair._2)
})
+ lastStream = currentStream
+ currentStream =
+ spark
+ .streams
+ .startQuery(
+ None,
+ Some(metadataRoot),
+ stream,
+ sink,
+ outputMode,
+ trigger = trigger,
+ triggerClock = triggerClock)
+ .asInstanceOf[StreamExecution]
+ currentStream.microBatchThread.setUncaughtExceptionHandler(
+ new UncaughtExceptionHandler {
+ override def uncaughtException(t: Thread, e: Throwable):
Unit = {
+ streamDeathCause = e
+ }
+ })
+ } finally {
+ // Rollback previous configuration values
+ resetConfValues.foreach {
--- End diff --
The reset logic should be at the end of the method. Otherwise, it will
change confs during a query is running.
---
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]