Repository: spark
Updated Branches:
  refs/heads/master d6dc12ef0 -> d16710b4c


[HOTFIX][SQL] Add a timeout for 'cq.stop'

## What changes were proposed in this pull request?

Fix an issue that DataFrameReaderWriterSuite may hang forever.

## How was this patch tested?

Existing tests.

Author: Shixiong Zhu <[email protected]>

Closes #11902 from zsxwing/hotfix.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/d16710b4
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/d16710b4
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/d16710b4

Branch: refs/heads/master
Commit: d16710b4c986f0eaf28552ce0e2db33d8c9343b8
Parents: d6dc12e
Author: Shixiong Zhu <[email protected]>
Authored: Tue Mar 22 16:41:55 2016 -0700
Committer: Shixiong Zhu <[email protected]>
Committed: Tue Mar 22 16:41:55 2016 -0700

----------------------------------------------------------------------
 .../src/test/scala/org/apache/spark/sql/StreamTest.scala  | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/d16710b4/sql/core/src/test/scala/org/apache/spark/sql/StreamTest.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/StreamTest.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/StreamTest.scala
index f356cde..26c597b 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/StreamTest.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/StreamTest.scala
@@ -28,6 +28,7 @@ import scala.util.control.NonFatal
 
 import org.scalatest.Assertions
 import org.scalatest.concurrent.{Eventually, Timeouts}
+import org.scalatest.concurrent.Eventually.timeout
 import org.scalatest.concurrent.PatienceConfiguration.Timeout
 import org.scalatest.exceptions.TestFailedDueToTimeoutException
 import org.scalatest.time.Span
@@ -67,7 +68,14 @@ trait StreamTest extends QueryTest with Timeouts {
 
   implicit class RichContinuousQuery(cq: ContinuousQuery) {
     def stopQuietly(): Unit = quietly {
-      cq.stop()
+      try {
+        failAfter(10.seconds) {
+          cq.stop()
+        }
+      } catch {
+        case e: TestFailedDueToTimeoutException =>
+          logError(e.getMessage(), e)
+      }
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to