maropu commented on a change in pull request #28316:
URL: https://github.com/apache/spark/pull/28316#discussion_r414206890
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/SparkSessionBuilderSuite.scala
##########
@@ -168,4 +168,33 @@ class SparkSessionBuilderSuite extends SparkFunSuite with
BeforeAndAfterEach {
assert(session.sessionState.conf.getConfString("spark.app.name") ===
"test-app-SPARK-31234")
assert(session.sessionState.conf.getConf(GLOBAL_TEMP_DATABASE) ===
"globaltempdb-spark-31234")
}
+
+ test("SPARK-31532: should not propagate static sql configs to the existing" +
+ " active/default SparkSession") {
+ val session = SparkSession.builder()
+ .master("local")
+ .config(GLOBAL_TEMP_DATABASE.key, value = "globalTempDB-SPARK-31532")
+ .config("spark.app.name", "test-app-SPARK-31234")
+ .getOrCreate()
+ // do not propagate static sql configs to the existing active session
+ val session1 = SparkSession
+ .builder()
+ .config(GLOBAL_TEMP_DATABASE.key, "globalTempDB-SPARK-31532-1")
+ .getOrCreate()
+ assert(session.conf.get(GLOBAL_TEMP_DATABASE) ===
"globaltempdb-spark-31532")
+ assert(session1.conf.get(GLOBAL_TEMP_DATABASE) ===
"globaltempdb-spark-31532")
+
+ // do not propagate static sql configs to the existing default session
+ SparkSession.clearActiveSession()
+ val session2 = SparkSession
+ .builder()
+ .config(WAREHOUSE_PATH.key, "SPARK-31532-db")
+ .config(GLOBAL_TEMP_DATABASE.key, value = "globalTempDB-SPARK-31532-2")
+ .getOrCreate()
+
+ assert(!session.conf.get(WAREHOUSE_PATH).contains("SPARK-31532-db"))
+ assert(session.conf.get(WAREHOUSE_PATH) ===
session2.conf.get(WAREHOUSE_PATH))
+ assert(session2.conf.get(GLOBAL_TEMP_DATABASE) ===
"globaltempdb-spark-31532")
+
Review comment:
nit: remove this blank
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]