gatorsmile commented on a change in pull request #28262: 
[SPARK-31234][SQL][2.4] ResetCommand should not affect static SQL Configuration
URL: https://github.com/apache/spark/pull/28262#discussion_r410968456
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/SparkSessionBuilderSuite.scala
 ##########
 @@ -151,4 +152,19 @@ class SparkSessionBuilderSuite extends SparkFunSuite with 
BeforeAndAfterEach {
       session.sparkContext.hadoopConfiguration.unset(mySpecialKey)
     }
   }
+
+  test("SPARK-31234: RESET command will not change static sql configs and " +
+    "spark context conf values in SessionState") {
+    val session = SparkSession.builder()
+      .master("local")
+      .config(GLOBAL_TEMP_DATABASE.key, value = "globalTempDB-SPARK-31234")
+      .config("spark.app.name", "test-app-SPARK-31234")
+      .getOrCreate()
+
+    assert(session.sessionState.conf.getConfString("spark.app.name") === 
"test-app-SPARK-31234")
+    assert(session.sessionState.conf.getConf(GLOBAL_TEMP_DATABASE) === 
"globalTempDB-SPARK-31234")
+    session.sql("RESET")
+    assert(session.sessionState.conf.getConfString("spark.app.name") === 
"test-app-SPARK-31234")
+    assert(session.sessionState.conf.getConf(GLOBAL_TEMP_DATABASE) === 
"globalTempDB-SPARK-31234")
 
 Review comment:
   GLOBAL_TEMP_DATABASE is a typical example. The value is being used at the 
runtime. See the code 
https://github.com/apache/spark/blob/4381ad5719cddf557baa57c88a8c8859383d92f3/sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala#L154

----------------------------------------------------------------
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]

Reply via email to