Github user tejasapatil commented on a diff in the pull request:
https://github.com/apache/spark/pull/11628#discussion_r56189655
--- Diff: core/src/test/scala/org/apache/spark/rdd/PipedRDDSuite.scala ---
@@ -50,6 +50,29 @@ class PipedRDDSuite extends SparkFunSuite with
SharedSparkContext {
}
}
+ test("failure in iterating over pipe input") {
+ if (testCommandAvailable("cat")) {
+ val nums =
+ sc.makeRDD(Array(1, 2, 3, 4), 2)
+ .mapPartitionsWithIndex((index, iterator) => {
+ new Iterator[Int] {
+ def hasNext = true
+ def next() = {
+ throw new SparkException("Exception to simulate bad
scenario")
+ }
+ }
+ })
+
+ val piped = nums.pipe(Seq("cat"))
+
+ intercept[SparkException] {
+ piped.collect()
+ }
+ } else {
+ assert(true)
--- End diff --
- Yes. Removed it. I had added it by looking at other tests in the class
which followed the same pattern.
- The test fails if the expected exception is not thrown. eg. If I comment
out the part in PipedRDD where it propagates the child exception, the test
fails with:
```
Expected exception org.apache.spark.SparkException to be thrown, but no
exception was thrown.
ScalaTestFailureLocation: org.apache.spark.rdd.PipedRDDSuite$$anonfun$2 at
(PipedRDDSuite.scala:68)
org.scalatest.exceptions.TestFailedException: Expected exception
org.apache.spark.SparkException to be thrown, but no exception was thrown.
...
...
```
---
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]