cloud-fan commented on a change in pull request #30045:
URL: https://github.com/apache/spark/pull/30045#discussion_r506302122
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/SparkSessionBuilderSuite.scala
##########
@@ -300,4 +300,53 @@ class SparkSessionBuilderSuite extends SparkFunSuite with
BeforeAndAfterEach {
session.stop()
}
}
+
+ test("SPARK-32991: Use conf in shared state as the original configuration
for RESET") {
+ val wh = "spark.sql.warehouse.dir"
+ val td = "spark.sql.globalTempDatabase"
+ val custom = "spark.sql.custom"
+
+ val conf = new SparkConf()
+ .setMaster("local")
+ .setAppName("SPARK-32991")
+ .set(wh, "./data1")
+ .set(td, "bob")
+
+ val sc = new SparkContext(conf)
+
+ val spark = SparkSession.builder()
+ .config(wh, "./data2")
+ .config(td, "alice")
+ .config(custom, "kyao")
+ .getOrCreate()
+
+ val sharedWH = spark.sharedState.conf.get(wh)
+ val sharedTD = spark.sharedState.conf.get(td)
+ val sharedCustom = spark.sharedState.conf.get(custom)
+ assert(sharedWH === "./data2",
+ "The warehouse dir in shared state should be determined by the 1st
created spark session")
+ assert(sharedTD === "alice",
+ "Static sql configs in shared state should be determined by the 1st
created spark session")
+ assert(sharedCustom === "kyao",
+ "Dynamic sql configs in shared state should be determined by the 1st
created spark session")
+
+
+ assert(spark.conf.get(wh) === sharedWH)
Review comment:
can we add a comment here? When creating the first session, we will
update the spark conf to the newly specified values.
----------------------------------------------------------------
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]