ajithme commented on a change in pull request #27267: [SPARK-30556][SQL] Copy
sparkContext.localproperties to child thread inSubqueryExec.executionContext
URL: https://github.com/apache/spark/pull/27267#discussion_r369759568
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/internal/ExecutorSideSQLConfSuite.scala
##########
@@ -125,6 +125,38 @@ class ExecutorSideSQLConfSuite extends SparkFunSuite with
SQLTestUtils {
val e = intercept[SparkException](dummyQueryExecution1.toRdd.collect())
assert(e.getCause.isInstanceOf[NoSuchElementException])
}
+
+ test("SPARK-30556 propagate local properties to subquery execution thread") {
+ withSQLConf("spark.sql.subquery.maxThreadThreshold" -> "1") {
+ withTempView("l", "m", "n") {
+ Seq(true).toDF().createOrReplaceTempView("l")
+ val confKey = "spark.sql.y"
+
+ def createDataframe(confKey: String, confValue: String):
Dataset[Boolean] = {
+ Seq(true)
+ .toDF()
+ .mapPartitions { _ =>
+ TaskContext.get.getLocalProperty(confKey) == confValue match {
+ case true => Iterator(true)
+ case false => Iterator.empty
+ }
+ }
+ }
+
+ // set local configuration and assert
+ val confValue1 = "e"
+ createDataframe(confKey, confValue1).createOrReplaceTempView("m")
+ spark.sparkContext.setLocalProperty(confKey, confValue1)
+ assert(sql("select * from l where exists (select * from
m)").collect.size == 1)
+
+ // change the conf value and assert again
+ val confValue2 = "f"
+ createDataframe(confKey, confValue2).createOrReplaceTempView("n")
+ spark.sparkContext.setLocalProperty(confKey, confValue2)
+ assert(sql("select value from l where exists (select * from
n)").collect().size == 1)
Review comment:
done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]