Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ case class ScriptTransformationExec(
lazy val unwrappers = outputSoi.getAllStructFieldRefs.asScala.map(unwrapperFor)

private def checkFailureAndPropagate(cause: Throwable = null): Unit = {
proc.waitFor()
if (writerThread.exception.isDefined) {
throw writerThread.exception.get
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,28 @@ class ScriptTransformationSuite extends SparkPlanTest with SQLTestUtils with Tes
assert(uncaughtExceptionHandler.exception.isEmpty)
}


test("SPARK-30973 ScriptTransformationExec should wait for the termination") {
(0 until 10).foreach { index =>
assume(TestUtils.testCommandAvailable("/bin/bash"))

val rowsDf = Seq("a", "b", "c").map(Tuple1.apply).toDF("a")

val e = intercept[SparkException] {
val plan =
new ScriptTransformationExec(
input = Seq(rowsDf.col("a").expr),
script = "some_non_existent_command",
output = Seq(AttributeReference("a", StringType)()),
child = rowsDf.queryExecution.sparkPlan,
ioschema = noSerdeIOSchema)
SparkPlanTest.executePlan(plan, hiveContext)
}
assert(e.getMessage.contains("Subprocess exited with status"))
assert(uncaughtExceptionHandler.exception.isEmpty)
}
}

test("SPARK-24339 verify the result after pruning the unused columns") {
val rowsDf = Seq(
("Bob", 16, 176),
Expand Down